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

Solid solubility #194

Merged
merged 4 commits into from
Aug 30, 2023
Merged

Solid solubility #194

merged 4 commits into from
Aug 30, 2023

Conversation

pw0908
Copy link
Member

@pw0908 pw0908 commented Aug 21, 2023

Some preliminary work on a solid solubility solver. Right now we can calculate both the eutectic point and the solubility of a solid at a given temperature, pressure and solvent composition. This makes use of the CompositeModel API. A Simple example of this would be:

julia> model = CompositeModel(["water","ethanol","paracetamol"]; liquid=PCSAFT,gas=nothing,saturation=nothing,melting=nothing,solid=SolidSolubility,solid_userlocations=(;Hfus=[6000.,4969.00,27000], Tm=[273.15,158.70,443.6]))
Composite Model:
 Liquid Model: PCSAFT{BasicIdeal}("water", "ethanol", "paracetamol")
 Solid Model: SolidSolubility("water", "ethanol", "paracetamol")


julia> solid_solubility(model,1e5,298.15,[0.5,0.5,0.];solute=["paracetamol"])
3-element Vector{Float64}:
 0.4905731673763385
 0.4905731673763385
 0.01885366524732288

@codecov
Copy link

codecov bot commented Aug 21, 2023

Codecov Report

Merging #194 (a10c660) into master (6daaf22) will decrease coverage by 0.34%.
The diff coverage is 1.51%.

@@            Coverage Diff             @@
##           master     #194      +/-   ##
==========================================
- Coverage   83.42%   83.08%   -0.34%     
==========================================
  Files         245      249       +4     
  Lines       15935    16000      +65     
==========================================
  Hits        13293    13293              
- Misses       2642     2707      +65     
Files Changed Coverage Δ
.../property_solvers/multicomponent/multicomponent.jl 76.81% <ø> (ø)
...ty_solvers/multicomponent/solids/eutectic_point.jl 0.00% <0.00%> (ø)
..._solvers/multicomponent/solids/solid_solubility.jl 0.00% <0.00%> (ø)
src/models/CompositeModel/CompositeModel.jl 64.15% <ø> (-0.34%) ⬇️
...odels/CompositeModel/SolidModel/SolidSolubility.jl 0.00% <0.00%> (ø)
src/models/types.jl 100.00% <100.00%> (ø)

@pw0908
Copy link
Member Author

pw0908 commented Aug 21, 2023

Things that need to be done before merging:

  • Add tests
  • Add API docs
  • Add example notebooks?

Some feedback:

  • The API is really flexibility because of CompositeModel. However, it is really intricate and not straight-forward. Could we create a sub-model of CompositeModel which handles solid solubility only where we'd only need to specify the liquid model?

Some additional stuff I noticed that could be improved:

  • Propagating group-contribution structure to the liquid model but not the solid model (e.g. when using SAFT-gamma Mie, we'd need to specify the groups of the molecules, but only when initialising the liquid model, not the solid)
  • Merging X_userlocations to just one universal userlocations (we've talked about this before but I'm debating when the right time to do this change is?)
  • We should make it optional to load-in activity coefficient models without a pure model. In the case of SLE, there's no reason to have a saturation model.

@longemen3000
Copy link
Member

longemen3000 commented Aug 21, 2023

Could we create a sub-model of CompositeModel which handles solid solubility only where we'd only need to specify the liquid model?

You could create a function that does that, something ĺike this?

function Solid(components, liquidmodel = PC-SAFT, solidmodel =SolidSolubility, liquid_userlocations = String[], solid_userlocations = String[], verbose) 
  li= init_model(liquid, components, liquid_userlocations, verbose)
  so = init_model(solidmodel, components, solid_userlocations, verbose) 
  return CompositeModel(components, liquid=li, gas=nothing,saturation=nothing,melting=nothing,solid=so)
end

@longemen3000 longemen3000 merged commit a10c660 into master Aug 30, 2023
20 of 22 checks passed
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

2 participants