Generalize API for Thermo Module #54
Replies: 2 comments 4 replies
-
Hi @TJP-Karpowski , I think those are indeed valid suggestions. The reason that I used different interfaces in Thermo.jl was mainly due to that mass-based properties can usually be derived from mole-based ones. But indeed, they are a little bit messy. It will be great to make them more consistent. Meanwhile, I would suggest keeping backward compatibility when changing the function names and interface. I would suggest making a new set of functions, like For the real gas behavior, I guess there are multiple ways to do it with Julia's multi-dispatch. As you have proposed, we can create a new class/struct of Thermo::RealGasThermo and creating a RealGasThermo when creating a gas Solution. Or alternatively, one can simply dispatch the function get_S in the application code as well. |
Beta Was this translation helpful? Give feedback.
-
Hi @jiweiqi , I would like to change the implementation to enable the usage of other thermo models in the future. One way would be to implement the functions with the thermo interface as input: |
Beta Was this translation helpful? Give feedback.
-
Hi,
I noticed , that the thermo interface has different function interfaces for H/S and cp/cv. The first return a vector of mole and a second function for mass, while the second return both in the same function call. I would propose to make the behaviour uniform. So each quantity gets a function
I could implement that if you are okay with that.
Furthermore in the long term I would like to simulate real gas behavior. To do that a different Thermo module would be needed. To do that, one could adapt the thermo functions to take an thermo class as input:
get_S(thermo::IdealGasThermo , temperature, pressure, X0)
and pass the function forward to thermo if a Solution is given:get_S(gas::Solution, T,p,X) = get_S(gas.thermo,T,p,X)
That way one could easily extend Arrhenius with more Thermomodels as long as it supplies the required function.
Beta Was this translation helpful? Give feedback.
All reactions