Skip to content
Snippets Groups Projects
Commit 878f53a1 authored by Simon Emmert's avatar Simon Emmert
Browse files

[brineco2][tests] disable brineco2-test phase restriction and make brineco2 non-ideal mixture

parent ac03ea6b
No related branches found
No related tags found
1 merge request!1204[brineco2][tests] disable brineco2-test phase restriction and make brineco2 non-ideal mixture
......@@ -250,8 +250,8 @@ public:
static bool isIdealMixture(int phaseIdx)
{
assert(0 <= phaseIdx && phaseIdx < numPhases);
if (!useConstantSalinity && phaseIdx == liquidPhaseIdx)
return VariableSalinityBrine::isIdealMixture(VariableSalinityBrine::liquidPhaseIdx);
if (phaseIdx == liquidPhaseIdx)
return false;
return true;
}
......
......@@ -89,10 +89,7 @@ public:
BaseFluidState::setMolarDensity(phaseIdx, 1.0);
for (int compIdx = 0; compIdx < numComponents; ++compIdx)
{
BaseFluidState::setMoleFraction(phaseIdx, compIdx, 1.0 / numComponents);
}
}
// initially, do not allow anything
......@@ -398,8 +395,16 @@ int checkFluidState(const BaseFluidState &fs)
}
}
/*!
* \brief This is a consistency check for FluidSystems.
* \param enablePhaseRestriction Parameter passed to the fluidState. If set to true,
* the fluidState will only allow calls to properties of the current phase.
* \note While this is very common, it is not necessarily the case for all FluidSystems.
* We keep this, because it might help finding mistakes in FluidSystems that have this invariant.
* If you verified that a fluid system does not have this invariant you can set this option to false.
*/
template<class Scalar, class FluidSystem>
int checkFluidSystem()
int checkFluidSystem(bool enablePhaseRestriction = true)
{
int success = 0;
std::cout << "Testing fluid system '" << Dune::className<FluidSystem>() << "'\n";
......@@ -460,7 +465,8 @@ int checkFluidSystem()
for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx)
{
fs.restrictToPhase(phaseIdx);
if (enablePhaseRestriction)
fs.restrictToPhase(phaseIdx);
try
{
paramCache.updatePhase(fs, phaseIdx);
......@@ -519,10 +525,11 @@ int checkFluidSystem()
// actually check the fluid system API
for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx)
{
fs.restrictToPhase(phaseIdx);
fs.allowPressure(FluidSystem::isCompressible(phaseIdx));
fs.allowComposition(true);
fs.allowDensity(false);
if (enablePhaseRestriction)
fs.restrictToPhase(phaseIdx);
try
{
val = FluidSystem::density(fs, paramCache, phaseIdx);
......
......@@ -149,30 +149,34 @@ int main()
success += checkFluidSystem<Scalar, FluidSystem>(); }
// Brine -- CO2
// BrineCO2 does not fulfill the restrictToPhase-assertion where we assume that for all
// functions depending on a phase index only fluid properties of this phase are used
// that is why checkFluidSystem() needs to be called with "false" here
// see checkFLuidSystem documentation!
{ using H2OType = Components::SimpleH2O<Scalar>;
using FluidSystem = FluidSystems::BrineCO2< Scalar, HeterogeneousCO2Tables::CO2Tables,
H2OType, FluidSystems::BrineCO2DefaultPolicy</*useConstantSalinity=*/true> >;
success += checkFluidSystem<Scalar, FluidSystem>(); }
success += checkFluidSystem<Scalar, FluidSystem>( false ); }
{ using H2OType = Components::SimpleH2O<Scalar>;
using FluidSystem = FluidSystems::BrineCO2< Scalar, HeterogeneousCO2Tables::CO2Tables,
H2OType, FluidSystems::BrineCO2DefaultPolicy</*useConstantSalinity=*/false> >;
success += checkFluidSystem<Scalar, FluidSystem>(); }
success += checkFluidSystem<Scalar, FluidSystem>( false ); }
{ using H2OType = Components::H2O<Scalar>;
using FluidSystem = FluidSystems::BrineCO2< Scalar, HeterogeneousCO2Tables::CO2Tables,
H2OType, FluidSystems::BrineCO2DefaultPolicy</*useConstantSalinity=*/true> >;
success += checkFluidSystem<Scalar, FluidSystem>(); }
success += checkFluidSystem<Scalar, FluidSystem>( false ); }
{ using H2OType = Components::H2O<Scalar>;
using FluidSystem = FluidSystems::BrineCO2< Scalar, HeterogeneousCO2Tables::CO2Tables,
H2OType, FluidSystems::BrineCO2DefaultPolicy</*useConstantSalinity=*/false> >;
success += checkFluidSystem<Scalar, FluidSystem>(); }
success += checkFluidSystem<Scalar, FluidSystem>( false ); }
{ using H2OType = Components::TabulatedComponent<Components::H2O<Scalar>>;
using FluidSystem = FluidSystems::BrineCO2< Scalar, HeterogeneousCO2Tables::CO2Tables,
H2OType, FluidSystems::BrineCO2DefaultPolicy</*useConstantSalinity=*/true> >;
success += checkFluidSystem<Scalar, FluidSystem>(); }
success += checkFluidSystem<Scalar, FluidSystem>( false ); }
{ using H2OType = Components::TabulatedComponent<Components::H2O<Scalar>>;
using FluidSystem = FluidSystems::BrineCO2< Scalar, HeterogeneousCO2Tables::CO2Tables,
H2OType, FluidSystems::BrineCO2DefaultPolicy</*useConstantSalinity=*/false> >;
success += checkFluidSystem<Scalar, FluidSystem>(); }
success += checkFluidSystem<Scalar, FluidSystem>( false ); }
// H2O -- Air
{ using H2OType = Components::SimpleH2O<Scalar>;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment