Commit d95ed189 authored by Beatrix Becker's avatar Beatrix Becker
Browse files

[fluidsystems] remove isLiquid in favor of isGas

Also replace all calls to isLiquid by equivalent calls to isGas
parent e8944efa
......@@ -85,10 +85,10 @@ public:
{
using FluidSystem = typename VolumeVariables::FluidSystem;
static_assert(FluidSystem::numPhases == 2, "ThermalConductivitySomerton only works for two-phase fluid systems!");
static_assert(!FluidSystem::isLiquid(0) || !FluidSystem::isLiquid(1), "ThermalConductivitySomerton only works if one phase is gaseous and one is liquid!");
static_assert(FluidSystem::isGas(0) || FluidSystem::isGas(1), "ThermalConductivitySomerton only works if one phase is gaseous and one is liquid!");
constexpr int liquidPhaseIdx = FluidSystem::isLiquid(0) ? 0 : 1;
constexpr int gasPhaseIdx = FluidSystem::isLiquid(0) ? 1 : 0;
constexpr int liquidPhaseIdx = FluidSystem::isGas(0) ? 1 : 0;
constexpr int gasPhaseIdx = FluidSystem::isGas(0) ? 0 : 1;
const Scalar satLiquid = volVars.saturation(liquidPhaseIdx);
const Scalar lambdaLiquid = volVars.fluidThermalConductivity(liquidPhaseIdx);
......
......@@ -136,10 +136,10 @@ public:
{ return false; }
/*!
* \brief Returns whether the fluid is a liquid
* \brief Returns whether the fluid is gaseous
*/
static constexpr bool isLiquid(int phaseIdx = 0)
{ return MultiPhaseFluidSystem::isLiquid(phase); }
static constexpr bool isGas(int phaseIdx = 0)
{ return MultiPhaseFluidSystem::isGas(phase); }
/*!
* \brief Returns true if and only if a fluid phase is assumed to
......
......@@ -96,10 +96,10 @@ public:
{ return false; }
/*!
* \brief Returns whether the fluid is a liquid
* \brief Returns whether the fluid is gaseous
*/
static constexpr bool isLiquid(int phaseIdx = 0)
{ return false; }
static constexpr bool isGas(int phaseIdx = 0)
{ return true; }
/*!
* \brief Returns true if and only if a fluid phase is assumed to
......
......@@ -98,8 +98,8 @@ public:
/*!
* \brief Returns whether the fluid is a liquid
*/
static constexpr bool isLiquid(int phaseIdx = 0)
{ return true; }
static constexpr bool isGas(int phaseIdx = 0)
{ return false; }
/*!
* \brief Returns true if and only if a fluid phase is assumed to
......
......@@ -83,14 +83,14 @@ public:
{ return false; }
/*!
* \brief Return whether a phase is liquid
* \brief Return whether a phase is gaseous
*
* \param phaseIdx The index of the fluid phase to consider
*/
static constexpr bool isLiquid(int phaseIdx)
static constexpr bool isGas(int phaseIdx)
{
assert(0 <= phaseIdx && phaseIdx < numPhases);
return phaseIdx == liquidPhaseIdx;
return phaseIdx == gasPhaseIdx;
}
/*!
......
......@@ -60,7 +60,7 @@ class TwoPImmiscible
static_assert((Fluid0::numComponents == 1), "Fluid0 has more than one component");
static_assert((Fluid1::numComponents == 1), "Fluid1 has more than one component");
// two gaseous phases at once do not make sense physically! (but two liquids are fine)
static_assert(Fluid0::isLiquid() || Fluid1::isLiquid(), "One phase has to be a liquid!");
static_assert(!Fluid0::isGas() || !Fluid1::isGas(), "One phase has to be a liquid!");
using ThisType = TwoPImmiscible<Scalar, Fluid0, Fluid1>;
using Base = BaseFluidSystem<Scalar, ThisType>;
......@@ -98,16 +98,16 @@ public:
{ return false; }
/*!
* \brief Return whether a phase is liquid
* \brief Return whether a phase is gaseous
* \param phaseIdx The index of the fluid phase to consider
*/
static constexpr bool isLiquid(int phaseIdx)
static constexpr bool isGas(int phaseIdx)
{
assert(0 <= phaseIdx && phaseIdx < numPhases);
if (phaseIdx == phase0Idx)
return Fluid0::isLiquid();
return Fluid1::isLiquid();
return Fluid0::isGas();
return Fluid1::isGas();
}
/*!
......
......@@ -105,18 +105,18 @@ public:
{ return false; }
/*!
* \brief Return whether a phase is liquid
* \brief Return whether a phase is gaseous
* \param phaseIdx The index of the fluid phase to consider
*/
static constexpr bool isLiquid(int phaseIdx)
static constexpr bool isGas(int phaseIdx)
{
assert(0 <= phaseIdx && phaseIdx < numPhases);
switch (phaseIdx)
{
case wPhaseIdx: return WettingFluid::isLiquid(); break;
case nPhaseIdx: return NonwettingFluid::isLiquid(); break;
case gPhaseIdx: return Gas::isLiquid(); break;
case wPhaseIdx: return WettingFluid::isGas(); break;
case nPhaseIdx: return NonwettingFluid::isGas(); break;
case gPhaseIdx: return Gas::isGas(); break;
}
}
......@@ -288,7 +288,7 @@ public:
{
// two gaseous phases at once do not make sense physically!
// (But two liquids are fine)
static_assert(WettingFluid::isLiquid() && NonwettingFluid::isLiquid() && !Gas::isLiquid(), "There can only be one gaseous phase!");
static_assert(!WettingFluid::isGas() && !NonwettingFluid::isGas() && Gas::isGas(), "There can only be one gaseous phase!");
}
/*!
......@@ -306,7 +306,7 @@ public:
Scalar pressMin, Scalar pressMax, unsigned nPress)
{
// two gaseous phases at once do not make sense physically!
static_assert(WettingFluid::isLiquid() && NonwettingFluid::isLiquid() && !Gas::isLiquid(), "There can only be one gaseous phase!");
static_assert(!WettingFluid::isGas() && !NonwettingFluid::isGas() && Gas::isGas(), "There can only be one gaseous phase!");
if (WettingFluid::Component::isTabulated)
{
......
......@@ -82,13 +82,13 @@ public:
}
/*!
* \brief Return whether a phase is liquid
* \brief Return whether a phase is gaseous
* \param phaseIdx The index of the fluid phase to consider
*/
static constexpr bool isLiquid(int phaseIdx = liquidPhaseIdx)
static constexpr bool isGas(int phaseIdx = liquidPhaseIdx)
{
assert(phaseIdx == liquidPhaseIdx);
return true;
return false;
}
/*!
......
......@@ -161,16 +161,6 @@ public:
static constexpr bool isMiscible()
{ return true; }
/*!
* \brief Return whether a phase is liquid
* \param phaseIdx The index of the fluid phase to consider
*/
static bool isLiquid(int phaseIdx)
{
assert(0 <= phaseIdx && phaseIdx < numPhases);
return phaseIdx != gasPhaseIdx;
}
/*!
* \brief Return whether a phase is gaseous
* \param phaseIdx The index of the fluid phase to consider
......
......@@ -103,15 +103,15 @@ public:
{ return true; }
/*!
* \brief Return whether a phase is liquid
* \brief Return whether a phase is gaseous
*
* \param phaseIdx The index of the fluid phase to consider
*/
static constexpr bool isLiquid(int phaseIdx)
static constexpr bool isGas(int phaseIdx)
{
assert(0 <= phaseIdx && phaseIdx < numPhases);
return phaseIdx != gasPhaseIdx;
return phaseIdx == gasPhaseIdx;
}
/*!
......
......@@ -115,17 +115,6 @@ public:
static constexpr bool isMiscible()
{ return true; }
/*!
* \brief Return whether a phase is liquid
*
* \param phaseIdx The index of the fluid phase to consider
*/
static constexpr bool isLiquid(int phaseIdx)
{
assert(0 <= phaseIdx && phaseIdx < numPhases);
return phaseIdx != gasPhaseIdx;
}
/*!
* \brief Return whether a phase is gaseous
*
......
......@@ -123,17 +123,6 @@ public:
static constexpr bool isMiscible()
{ return true; }
/*!
* \brief Return whether a phase is liquid
*
* \param phaseIdx The index of the fluid phase to consider
*/
static bool isLiquid(int phaseIdx)
{
assert(0 <= phaseIdx && phaseIdx < numPhases);
return phaseIdx != gPhaseIdx;
}
/*!
* \brief Return whether a phase is gaseous
*
......
......@@ -123,17 +123,6 @@ public:
static constexpr bool isMiscible()
{ return true; }
/*!
* \brief Return whether a phase is liquid
*
* \param phaseIdx The index of the fluid phase to consider
*/
static bool isLiquid(int phaseIdx)
{
assert(0 <= phaseIdx && phaseIdx < numPhases);
return phaseIdx != gPhaseIdx;
}
/*!
* \brief Return whether a phase is gaseous
*
......
......@@ -113,17 +113,6 @@ public:
static constexpr bool isMiscible()
{ return true; }
/*!
* \brief Return whether a phase is liquid
*
* \param phaseIdx The index of the fluid phase to consider
*/
static bool isLiquid(int phaseIdx)
{
assert(0 <= phaseIdx && phaseIdx < numPhases);
return phaseIdx != gPhaseIdx;
}
/*!
* \brief Return whether a phase is gaseous
*
......
......@@ -113,17 +113,6 @@ public:
static constexpr bool isMiscible()
{ return true; }
/*!
* \brief Return whether a phase is liquid
*
* \param phaseIdx The index of the fluid phase to consider
*/
static constexpr bool isLiquid(int phaseIdx)
{
assert(0 <= phaseIdx && phaseIdx < numPhases);
return phaseIdx != gasPhaseIdx;
}
/*!
* \brief Return whether a phase is gaseous
*
......
......@@ -130,17 +130,6 @@ public:
return name[phaseIdx];
}
/*!
* \brief Return whether a phase is liquid
*
* \param phaseIdx The index of the fluid phase to consider
*/
static bool isLiquid(int phaseIdx)
{
assert(0 <= phaseIdx && phaseIdx < numPhases);
return phaseIdx != gasPhaseIdx;
}
/*!
* \brief Return whether a phase is gaseous
*
......
......@@ -99,10 +99,10 @@ public:
{ return "LiquidPhaseTwoC"; }
/*!
* \brief Returns whether the fluid is a liquid
* \brief Returns whether the fluid is gaseous
*/
static bool isLiquid(int phaseIdx = 0)
{ return true; }
static constexpr bool isGas(int phaseIdx = 0)
{ return false; }
/*!
* \brief Returns true if and only if a fluid phase is assumed to
......
......@@ -103,13 +103,13 @@ public:
{ return true; }
/*!
* \brief Return whether a phase is liquid
* \brief Return whether a phase is gaseous
* \param phaseIdx The index of the fluid phase to consider
*/
static bool isLiquid(int phaseIdx)
static constexpr bool isGas(int phaseIdx)
{
assert(0 <= phaseIdx && phaseIdx < numPhases);
return phaseIdx != gPhaseIdx;
return phaseIdx == gPhaseIdx;
}
/*!
......
......@@ -110,7 +110,7 @@ public:
// The computations in the explicit composition update most probably assume a liquid-gas interface with
// liquid as first phase. TODO: is this really needed? The constraint solver does the job anyway, doesn't it?
static_assert(useConstraintSolver || (FluidSystem::isLiquid(phase0Idx) && !FluidSystem::isLiquid(phase1Idx)),
static_assert(useConstraintSolver || (!FluidSystem::isGas(phase0Idx) && FluidSystem::isGas(phase1Idx)),
"Explicit composition calculation has to be re-checked for NON-liquid-gas equilibria");
/*!
......
......@@ -623,13 +623,13 @@ int checkFluidSystem()
}
}
// test for phaseName(), isLiquid() and isIdealGas()
// test for phaseName(), isGas() and isIdealGas()
for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx)
{
std::string
DUNE_UNUSED name = FluidSystem::phaseName(phaseIdx);
bool DUNE_UNUSED
bVal = FluidSystem::isLiquid(phaseIdx);
bVal = FluidSystem::isGas(phaseIdx);
bVal = FluidSystem::isIdealGas(phaseIdx);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment