reaktoro / reaktoro

a unified framework for modeling chemically reactive systems
https://reaktoro.org
GNU Lesser General Public License v2.1
164 stars 56 forks source link

[Enhancement] Return density from ChemicalState #201

Closed thoerbr closed 2 years ago

thoerbr commented 3 years ago

It would be a handy addition being able to return the density of aqueous and solid phase components from the chemical state. So assuming that state is my ChemicalState, the following already works.

state.phaseAmount("Calcite") state.temperature()

Having something like this would be great:

state.phaseDensity("Calcite") state.phaseDensity("Aqueous") and maybe because aqueous density is most frequently needed: state.density() # also returns aqueous density

Why am I interested in this feature? When coupling Reaktoro for reactive transport, the transport-code might have a different fluid model (pressure / temperature dependent density) then Reaktoro has. Being able to inspect these differences would be helpful. Furthermore it would be a nice feature to use Reaktoro for calculating densities with the HKF-formalism.

volpatto commented 3 years ago

Great idea, @thoerbr. Indeed, it would be handy! I'm marking it as enhancement and will bring it for discussion with others Reaktoro's devs.

However, I can't promise you that we will implement it in Reaktoro soon, unfortunately.

allanleal commented 3 years ago

Dear @thoerbr ,

Something like state.props().phaseDensity("Aqueous") (and also other similar methods) in a new version should be possible.

As to state.density() implicitly meaning aqueous phase density, this would be against the general-purpose philosophy of Reaktoro, which can be used for chemical systems without water.

Best regards, Allan

thoerbr commented 3 years ago

Hi Allan,

that's fine for me. Great to hear.

allanleal commented 2 years ago

Hi Thorsten, Reaktoro v2 has improved interface for this functionality. You may be interested in these two tutorials:

To get the density of a phase, you can do: props.phaseProps("Aqueous").density(). These tutorials and the API reference for classes ChemicalProps and AqueousProps should be helpful to you.