Correct computation of molar densities (fixes small mass balances errors)

Merged Simon Emmert requested to merge feature/useComplexRelations into master

Closes #450 (closed) Depends !836 (merged)

-name change is subject to further discussion (new Issue: #509 (closed))

  • Introduce liquidMolarDensity and gasMolarDensity for components
  • Use more meaningful functions in computation of the molar density
  • in tutorial include liquidmolardensity in mycompressible component
  • introduce molardensity in new liquid and gas component

in component LNAPL include a liquidmolardensity -> opened Issue #464 (closed)

To summarize the changes:

  • introduced liquidMolarDensity() respectively gasMolarDensity() in all fluid components
    • liquidMolarDensity as liquidDensity(temperature, pressure)/molarMass();
    • gasMolarDensity as IdealGas::molarDensity(temperature, pressure);
    • exceptions are:
      • brine: salinity is included in the liquidMolarDensity
      • co2: is not considered an ideal gas, therefore gasDensity(temperature, pressure)/molarMass(); is used
      • h2o: gasMolarDensity uses IAPWS by gasDensity(temperature, pressure)/molarMass();
      • mesitylene: liquidMolarDensity was already implemented with a law from Reid et al. 1987 (see Doxygen)
      • xylene: liquidMolarDensity was already implemented with a law from Reid et al. 1987 (see Doxygen)
  • introduced molarDensity() in all fluidsystems
    • for wPhaseIdx: MainComponent::liquidMolarDensity(temperature, pressure)
    • for a gas nPhaseIdx and !useComplexRelations: IdealGas::molarDensity(temperature, pressure)
    • for a gas nPhaseIdx and useComplexRelations: Component1::gasMolarDensity(temperature, pressure) + Component2::gasMolarDensity(temperature, pressure) + ...
    • for a NAPL nPhaseIdx: NAPL::liquidMolarDensity(temperature, pressure);
    • exceptions are:
      • co2: density(fluidState, phaseIdx)/fluidState.averageMolarMass(phaseIdx)
      • spe5: uses Peng-Robinson molarVolume calculation as before
  • all general fluidstates have setMolarDensity(), and the volVars set the densities in the fluidstate and get them directly from the fluidstate instead of calculating density()/averageMolarMass()
  • exceptions:
    • tracer: uses fluidDensity_/fluidMolarMass_;
Edited by Timo Koch

Merge request reports