Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

revamp kwarg and dispatch handling for methods (NFC) #174

Merged
merged 11 commits into from
Apr 19, 2023

Conversation

longemen3000
Copy link
Member

we now call a new function init_preferred_method(method,model,kwargs) to initialize a method. this helps specially in the cases where we need to define another methods for specific models (activity, composite models), while not interfering with the default args, and even expanding those. julia kwarg handling has improved, so using kwargs does not cause performance penalties like before. now we can do:

saturation_pressure(model,T,vl = 1.8e-5,vv = 0.03) #init_preferred_method(saturation_pressure,model::EoSModel,kwargs) = ChemPotVSaturation(;kwargs...)

tp_flash(model,p,T,z,equilibrium = :vle) #dispatch to MichelsenTPFlash
tp_flash(model,p,T,z) DETPFlash
tp_flash(activity_model,p,T,z) #RRTPFlash
tp_flash(activity_model,p,T,z,equilibrium = :vle) #RRTPFlash

all this while not touching any methods.
should solve "bubble_temperature no longer takes T0 as an initial guess for activity coefficient models" (#173)

@codecov
Copy link

codecov bot commented Apr 19, 2023

Codecov Report

Merging #174 (42d29bc) into master (e6a31f6) will decrease coverage by 0.23%.
The diff coverage is 54.41%.

@@            Coverage Diff             @@
##           master     #174      +/-   ##
==========================================
- Coverage   86.25%   86.03%   -0.23%     
==========================================
  Files         219      219              
  Lines       14772    14836      +64     
==========================================
+ Hits        12742    12764      +22     
- Misses       2030     2072      +42     
Impacted Files Coverage Δ
src/base/EoSModel.jl 90.47% <ø> (ø)
src/methods/methods.jl 76.31% <0.00%> (-1.02%) ⬇️
.../property_solvers/multicomponent/multicomponent.jl 74.25% <ø> (ø)
...y_solvers/singlecomponent/saturation/AntoineSat.jl 87.09% <ø> (-3.82%) ⬇️
src/models/Activity/methods/Michelsentp_flash.jl 94.87% <0.00%> (-2.50%) ⬇️
...ethods/property_solvers/multicomponent/tp_flash.jl 46.15% <18.18%> (-24.44%) ⬇️
...ds/property_solvers/multicomponent/bubble_point.jl 75.44% <36.36%> (-2.92%) ⬇️
...thods/property_solvers/multicomponent/dew_point.jl 72.05% <36.36%> (-2.60%) ⬇️
src/models/CompositeModel/CompositeModel.jl 65.68% <66.66%> (-0.66%) ⬇️
...y_solvers/singlecomponent/saturation/saturation.jl 88.33% <78.57%> (-8.55%) ⬇️
... and 4 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@longemen3000 longemen3000 merged commit 66179a9 into master Apr 19, 2023
@pw0908 pw0908 deleted the easier_notebooks branch September 10, 2023 00:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant