2015-06-18 13:47:07 +02:00
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
// vi: set et ts=4 sw=4 sts=4:
2013-12-02 16:31:53 +01:00
/*
This file is part of the Open Porous Media project ( OPM ) .
OPM is free software : you can redistribute it and / or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation , either version 2 of the License , or
( at your option ) any later version .
OPM is distributed in the hope that it will be useful ,
but WITHOUT ANY WARRANTY ; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
GNU General Public License for more details .
You should have received a copy of the GNU General Public License
along with OPM . If not , see < http : //www.gnu.org/licenses/>.
2016-03-14 14:11:22 +01:00
Consult the COPYING file in the top - level source directory of this
module for the precise wording of the license and the list of
copyright holders .
2013-12-02 16:31:53 +01:00
*/
2013-05-30 18:44:10 +02:00
/*!
* \ file
* \ copydoc checkFluidSystem
*/
2013-11-13 18:45:52 +01:00
# ifndef OPM_CHECK_FLUIDSYSTEM_HPP
# define OPM_CHECK_FLUIDSYSTEM_HPP
2013-05-30 18:44:10 +02:00
2022-12-22 11:10:23 +01:00
# include <opm/common/utility/Demangle.hpp>
2013-05-30 18:44:10 +02:00
// include all fluid systems in opm-material
2014-05-08 16:53:53 +02:00
# include <opm/material/fluidsystems/SinglePhaseFluidSystem.hpp>
# include <opm/material/fluidsystems/TwoPhaseImmiscibleFluidSystem.hpp>
2013-09-10 14:55:59 +02:00
# include <opm/material/fluidsystems/H2ON2FluidSystem.hpp>
# include <opm/material/fluidsystems/H2ON2LiquidPhaseFluidSystem.hpp>
# include <opm/material/fluidsystems/H2OAirFluidSystem.hpp>
# include <opm/material/fluidsystems/H2OAirMesityleneFluidSystem.hpp>
# include <opm/material/fluidsystems/H2OAirXyleneFluidSystem.hpp>
# include <opm/material/fluidsystems/Spe5FluidSystem.hpp>
2013-05-30 18:44:10 +02:00
// include all fluid states
2013-09-10 14:55:59 +02:00
# include <opm/material/fluidstates/PressureOverlayFluidState.hpp>
# include <opm/material/fluidstates/SaturationOverlayFluidState.hpp>
# include <opm/material/fluidstates/TemperatureOverlayFluidState.hpp>
# include <opm/material/fluidstates/CompositionalFluidState.hpp>
# include <opm/material/fluidstates/NonEquilibriumFluidState.hpp>
# include <opm/material/fluidstates/ImmiscibleFluidState.hpp>
2013-05-30 18:44:10 +02:00
# include <iostream>
# include <string>
2022-12-22 11:10:23 +01:00
# include <typeinfo>
2013-05-30 18:44:10 +02:00
/*!
* \ brief This is a fluid state which makes sure that only the quantities
2013-12-03 11:56:45 +01:00
* allowed are accessed .
2013-05-30 18:44:10 +02:00
*/
2015-05-21 15:33:14 +02:00
template < class ScalarT ,
2013-05-30 18:44:10 +02:00
class FluidSystem ,
2015-05-21 15:33:14 +02:00
class BaseFluidState = Opm : : CompositionalFluidState < ScalarT , FluidSystem > >
2013-05-30 18:44:10 +02:00
class HairSplittingFluidState
: protected BaseFluidState
{
public :
enum { numPhases = FluidSystem : : numPhases } ;
enum { numComponents = FluidSystem : : numComponents } ;
2015-05-21 15:33:14 +02:00
typedef ScalarT Scalar ;
2013-05-30 18:44:10 +02:00
HairSplittingFluidState ( )
{
// initially, do not allow anything
allowTemperature ( false ) ;
allowPressure ( false ) ;
allowComposition ( false ) ;
allowDensity ( false ) ;
// do not allow accessing any phase
restrictToPhase ( 1000 ) ;
}
void allowTemperature ( bool yesno )
{ allowTemperature_ = yesno ; }
void allowPressure ( bool yesno )
{ allowPressure_ = yesno ; }
void allowComposition ( bool yesno )
{ allowComposition_ = yesno ; }
void allowDensity ( bool yesno )
{ allowDensity_ = yesno ; }
void restrictToPhase ( int phaseIdx )
{ restrictPhaseIdx_ = phaseIdx ; }
2016-02-12 11:49:38 +01:00
BaseFluidState & base ( )
{ return * static_cast < BaseFluidState * > ( this ) ; }
const BaseFluidState & base ( ) const
{ return * static_cast < const BaseFluidState * > ( this ) ; }
2016-02-12 18:06:33 +01:00
auto temperature ( unsigned phaseIdx ) const
- > decltype ( this - > base ( ) . temperature ( phaseIdx ) )
2013-05-30 18:44:10 +02:00
{
assert ( allowTemperature_ ) ;
2015-09-22 11:20:55 +02:00
assert ( restrictPhaseIdx_ < 0 | | restrictPhaseIdx_ = = static_cast < int > ( phaseIdx ) ) ;
2016-02-12 18:06:33 +01:00
return this - > base ( ) . temperature ( phaseIdx ) ;
2013-05-30 18:44:10 +02:00
}
2016-02-12 18:06:33 +01:00
auto pressure ( unsigned phaseIdx ) const
- > decltype ( this - > base ( ) . pressure ( phaseIdx ) )
2013-05-30 18:44:10 +02:00
{
assert ( allowPressure_ ) ;
2015-09-22 11:20:55 +02:00
assert ( restrictPhaseIdx_ < 0 | | restrictPhaseIdx_ = = static_cast < int > ( phaseIdx ) ) ;
2016-02-12 18:06:33 +01:00
return this - > base ( ) . pressure ( phaseIdx ) ;
2013-05-30 18:44:10 +02:00
}
2016-02-12 18:06:33 +01:00
auto moleFraction ( unsigned phaseIdx , unsigned compIdx ) const
- > decltype ( this - > base ( ) . moleFraction ( phaseIdx , compIdx ) )
2013-05-30 18:44:10 +02:00
{
assert ( allowComposition_ ) ;
2015-09-22 11:20:55 +02:00
assert ( restrictPhaseIdx_ < 0 | | restrictPhaseIdx_ = = static_cast < int > ( phaseIdx ) ) ;
2016-02-12 18:06:33 +01:00
return this - > base ( ) . moleFraction ( phaseIdx , compIdx ) ;
2013-05-30 18:44:10 +02:00
}
2016-02-12 18:06:33 +01:00
auto massFraction ( unsigned phaseIdx , unsigned compIdx ) const
- > decltype ( this - > base ( ) . massFraction ( phaseIdx , compIdx ) )
2013-05-30 18:44:10 +02:00
{
assert ( allowComposition_ ) ;
2015-09-22 11:20:55 +02:00
assert ( restrictPhaseIdx_ < 0 | | restrictPhaseIdx_ = = static_cast < int > ( phaseIdx ) ) ;
2016-02-12 18:06:33 +01:00
return this - > base ( ) . massFraction ( phaseIdx , compIdx ) ;
2013-05-30 18:44:10 +02:00
}
2016-02-12 18:06:33 +01:00
auto averageMolarMass ( unsigned phaseIdx ) const
- > decltype ( this - > base ( ) . averageMolarMass ( phaseIdx ) )
2013-05-30 18:44:10 +02:00
{
assert ( allowComposition_ ) ;
2015-09-22 11:20:55 +02:00
assert ( restrictPhaseIdx_ < 0 | | restrictPhaseIdx_ = = static_cast < int > ( phaseIdx ) ) ;
2016-02-12 18:06:33 +01:00
return this - > base ( ) . averageMolarMass ( phaseIdx ) ;
2013-05-30 18:44:10 +02:00
}
2016-02-12 18:06:33 +01:00
auto molarity ( unsigned phaseIdx , unsigned compIdx ) const
- > decltype ( this - > base ( ) . molarity ( phaseIdx , compIdx ) )
2013-05-30 18:44:10 +02:00
{
assert ( allowDensity_ & & allowComposition_ ) ;
2015-09-22 11:20:55 +02:00
assert ( restrictPhaseIdx_ < 0 | | restrictPhaseIdx_ = = static_cast < int > ( phaseIdx ) ) ;
2016-02-12 18:06:33 +01:00
return this - > base ( ) . molarity ( phaseIdx , compIdx ) ;
2013-05-30 18:44:10 +02:00
}
2016-02-12 18:06:33 +01:00
auto molarDensity ( unsigned phaseIdx ) const
- > decltype ( this - > base ( ) . molarDensity ( phaseIdx ) )
2013-05-30 18:44:10 +02:00
{
assert ( allowDensity_ ) ;
2015-09-22 11:20:55 +02:00
assert ( restrictPhaseIdx_ < 0 | | restrictPhaseIdx_ = = static_cast < int > ( phaseIdx ) ) ;
2016-02-12 18:06:33 +01:00
return this - > base ( ) . molarDensity ( phaseIdx ) ;
2013-05-30 18:44:10 +02:00
}
2016-02-12 18:06:33 +01:00
auto molarVolume ( unsigned phaseIdx ) const
- > decltype ( this - > base ( ) . molarVolume ( phaseIdx ) )
2013-05-30 18:44:10 +02:00
{
assert ( allowDensity_ ) ;
2015-09-22 11:20:55 +02:00
assert ( restrictPhaseIdx_ < 0 | | restrictPhaseIdx_ = = static_cast < int > ( phaseIdx ) ) ;
2016-02-12 18:06:33 +01:00
return this - > base ( ) . molarVolume ( phaseIdx ) ;
2013-05-30 18:44:10 +02:00
}
2016-02-12 18:06:33 +01:00
auto density ( unsigned phaseIdx ) const
- > decltype ( this - > base ( ) . density ( phaseIdx ) )
2013-05-30 18:44:10 +02:00
{
assert ( allowDensity_ ) ;
2015-09-22 11:20:55 +02:00
assert ( restrictPhaseIdx_ < 0 | | restrictPhaseIdx_ = = static_cast < int > ( phaseIdx ) ) ;
2016-02-12 18:06:33 +01:00
return this - > base ( ) . density ( phaseIdx ) ;
2013-05-30 18:44:10 +02:00
}
2016-02-12 18:06:33 +01:00
auto saturation ( unsigned phaseIdx ) const
- > decltype ( this - > base ( ) . saturation ( phaseIdx ) )
2013-05-30 18:44:10 +02:00
{
assert ( false ) ;
2016-02-12 18:06:33 +01:00
return this - > base ( ) . saturation ( phaseIdx ) ;
2013-05-30 18:44:10 +02:00
}
2016-02-12 18:06:33 +01:00
auto fugacity ( unsigned phaseIdx , unsigned compIdx ) const
- > decltype ( this - > base ( ) . fugacity ( phaseIdx , compIdx ) )
2013-05-30 18:44:10 +02:00
{
assert ( false ) ;
2016-02-12 18:06:33 +01:00
return this - > base ( ) . fugacity ( phaseIdx , compIdx ) ;
2013-05-30 18:44:10 +02:00
}
2016-02-12 18:06:33 +01:00
auto fugacityCoefficient ( unsigned phaseIdx , unsigned compIdx ) const
- > decltype ( this - > base ( ) . fugacityCoefficient ( phaseIdx , compIdx ) )
2013-05-30 18:44:10 +02:00
{
assert ( false ) ;
2016-02-12 18:06:33 +01:00
return this - > base ( ) . fugacityCoefficient ( phaseIdx , compIdx ) ;
2013-05-30 18:44:10 +02:00
}
2016-02-12 18:06:33 +01:00
auto enthalpy ( unsigned phaseIdx ) const
- > decltype ( this - > base ( ) . enthalpy ( phaseIdx ) )
2013-05-30 18:44:10 +02:00
{
assert ( false ) ;
2016-02-12 18:06:33 +01:00
return this - > base ( ) . enthalpy ( phaseIdx ) ;
2013-05-30 18:44:10 +02:00
}
2016-02-12 18:06:33 +01:00
auto internalEnergy ( unsigned phaseIdx ) const
- > decltype ( this - > base ( ) . internalEnergy ( phaseIdx ) )
2013-05-30 18:44:10 +02:00
{
assert ( false ) ;
2016-02-12 18:06:33 +01:00
return this - > base ( ) . internalEnergy ( phaseIdx ) ;
2013-05-30 18:44:10 +02:00
}
2016-02-12 18:06:33 +01:00
auto viscosity ( unsigned phaseIdx ) const
- > decltype ( this - > base ( ) . viscosity ( phaseIdx ) )
2013-05-30 18:44:10 +02:00
{
assert ( false ) ;
2016-02-12 18:06:33 +01:00
return this - > base ( ) . viscosity ( phaseIdx ) ;
2013-05-30 18:44:10 +02:00
}
private :
bool allowSaturation_ ;
bool allowTemperature_ ;
bool allowPressure_ ;
bool allowComposition_ ;
bool allowDensity_ ;
int restrictPhaseIdx_ ;
} ;
template < class Scalar , class BaseFluidState >
2017-01-18 17:04:59 +01:00
void checkFluidState ( const BaseFluidState & fs )
2013-05-30 18:44:10 +02:00
{
// fluid states must be copy-able
2021-08-03 09:12:52 +02:00
[[maybe_unused]] BaseFluidState tmpFs ( fs ) ;
2013-05-30 18:44:10 +02:00
tmpFs = fs ;
// a fluid state must provide a checkDefined() method
fs . checkDefined ( ) ;
2015-05-21 15:33:14 +02:00
// fluid states must export the types which they use as Scalars
typedef typename BaseFluidState : : Scalar FsScalar ;
static_assert ( std : : is_same < FsScalar , Scalar > : : value ,
" Fluid states must export the type they are given as scalar in an unmodified way " ) ;
2013-05-30 18:44:10 +02:00
// make sure the fluid state provides all mandatory methods
while ( false ) {
2015-09-22 16:44:28 +02:00
Scalar val = 1.0 ;
val = 2 * val ; // get rid of GCC warning (only occurs with paranoid warning flags)
2013-05-30 18:44:10 +02:00
val = fs . temperature ( /*phaseIdx=*/ 0 ) ;
val = fs . pressure ( /*phaseIdx=*/ 0 ) ;
val = fs . moleFraction ( /*phaseIdx=*/ 0 , /*compIdx=*/ 0 ) ;
val = fs . massFraction ( /*phaseIdx=*/ 0 , /*compIdx=*/ 0 ) ;
val = fs . averageMolarMass ( /*phaseIdx=*/ 0 ) ;
val = fs . molarity ( /*phaseIdx=*/ 0 , /*compIdx=*/ 0 ) ;
val = fs . molarDensity ( /*phaseIdx=*/ 0 ) ;
val = fs . molarVolume ( /*phaseIdx=*/ 0 ) ;
val = fs . density ( /*phaseIdx=*/ 0 ) ;
val = fs . saturation ( /*phaseIdx=*/ 0 ) ;
val = fs . fugacity ( /*phaseIdx=*/ 0 , /*compIdx=*/ 0 ) ;
val = fs . fugacityCoefficient ( /*phaseIdx=*/ 0 , /*compIdx=*/ 0 ) ;
val = fs . enthalpy ( /*phaseIdx=*/ 0 ) ;
val = fs . internalEnergy ( /*phaseIdx=*/ 0 ) ;
val = fs . viscosity ( /*phaseIdx=*/ 0 ) ;
} ;
}
/*!
* \ brief Checks whether a fluid system adheres to the specification .
*/
2015-05-21 15:33:16 +02:00
template < class Scalar , class FluidSystem , class RhsEval , class LhsEval >
2013-05-30 18:44:10 +02:00
void checkFluidSystem ( )
{
2023-05-24 22:03:21 +02:00
std : : cout < < " Testing fluid system ' "
< < Opm : : demangle ( typeid ( FluidSystem ) . name ( ) )
< < " , RhsEval = " < < Opm : : demangle ( typeid ( RhsEval ) . name ( ) )
< < " , LhsEval = " < < Opm : : demangle ( typeid ( LhsEval ) . name ( ) ) < < " ' \n " ;
2013-05-30 18:44:10 +02:00
// make sure the fluid system provides the number of phases and
// the number of components
enum { numPhases = FluidSystem : : numPhases } ;
enum { numComponents = FluidSystem : : numComponents } ;
2015-05-21 15:33:16 +02:00
typedef HairSplittingFluidState < RhsEval , FluidSystem > FluidState ;
FluidState fs ;
2013-05-30 18:44:10 +02:00
fs . allowTemperature ( true ) ;
fs . allowPressure ( true ) ;
fs . allowComposition ( true ) ;
fs . restrictToPhase ( - 1 ) ;
2016-02-12 11:49:38 +01:00
// initialize memory the fluid state
fs . base ( ) . setTemperature ( 273.15 + 20.0 ) ;
for ( int phaseIdx = 0 ; phaseIdx < numPhases ; + + phaseIdx ) {
fs . base ( ) . setPressure ( phaseIdx , 1e5 ) ;
fs . base ( ) . setSaturation ( phaseIdx , 1.0 / numPhases ) ;
for ( int compIdx = 0 ; compIdx < numComponents ; + + compIdx ) {
fs . base ( ) . setMoleFraction ( phaseIdx , compIdx , 1.0 / numComponents ) ;
}
}
2016-01-04 15:31:30 +01:00
static_assert ( std : : is_same < typename FluidSystem : : Scalar , Scalar > : : value ,
" The type used for floating point used by the fluid system must be the same "
" as the one passed to the checkFluidSystem() function " ) ;
2013-05-30 18:44:10 +02:00
// check whether the parameter cache adheres to the API
2016-04-17 11:28:04 +02:00
typedef typename FluidSystem : : template ParameterCache < LhsEval > ParameterCache ;
ParameterCache paramCache ;
2013-05-30 18:44:10 +02:00
try { paramCache . updateAll ( fs ) ; } catch ( . . . ) { } ;
2016-04-17 11:28:04 +02:00
try { paramCache . updateAll ( fs , /*except=*/ ParameterCache : : None ) ; } catch ( . . . ) { } ;
try { paramCache . updateAll ( fs , /*except=*/ ParameterCache : : Temperature | ParameterCache : : Pressure | ParameterCache : : Composition ) ; } catch ( . . . ) { } ;
2013-05-30 18:44:10 +02:00
try { paramCache . updateAllPressures ( fs ) ; } catch ( . . . ) { } ;
2015-09-22 11:20:55 +02:00
for ( unsigned phaseIdx = 0 ; phaseIdx < numPhases ; + + phaseIdx ) {
fs . restrictToPhase ( static_cast < int > ( phaseIdx ) ) ;
2013-05-30 18:44:10 +02:00
try { paramCache . updatePhase ( fs , phaseIdx ) ; } catch ( . . . ) { } ;
2016-04-17 11:28:04 +02:00
try { paramCache . updatePhase ( fs , phaseIdx , /*except=*/ ParameterCache : : None ) ; } catch ( . . . ) { } ;
try { paramCache . updatePhase ( fs , phaseIdx , /*except=*/ ParameterCache : : Temperature | ParameterCache : : Pressure | ParameterCache : : Composition ) ; } catch ( . . . ) { } ;
2013-05-30 18:44:10 +02:00
try { paramCache . updateTemperature ( fs , phaseIdx ) ; } catch ( . . . ) { } ;
try { paramCache . updatePressure ( fs , phaseIdx ) ; } catch ( . . . ) { } ;
try { paramCache . updateComposition ( fs , phaseIdx ) ; } catch ( . . . ) { } ;
try { paramCache . updateSingleMoleFraction ( fs , phaseIdx , /*compIdx=*/ 0 ) ; } catch ( . . . ) { } ;
}
// some value to make sure the return values of the fluid system
// are convertible to scalars
2015-09-22 16:44:28 +02:00
LhsEval val = 0.0 ;
Scalar scalarVal = 0.0 ;
scalarVal = 2 * scalarVal ; // get rid of GCC warning (only occurs with paranoid warning flags)
val = 2 * val ; // get rid of GCC warning (only occurs with paranoid warning flags)
2013-05-30 18:44:10 +02:00
// actually check the fluid system API
try { FluidSystem : : init ( ) ; } catch ( . . . ) { } ;
2015-09-22 11:20:55 +02:00
for ( unsigned phaseIdx = 0 ; phaseIdx < numPhases ; + + phaseIdx ) {
fs . restrictToPhase ( static_cast < int > ( phaseIdx ) ) ;
2013-05-30 18:44:10 +02:00
fs . allowPressure ( FluidSystem : : isCompressible ( phaseIdx ) ) ;
fs . allowComposition ( true ) ;
fs . allowDensity ( false ) ;
2021-08-03 09:12:52 +02:00
try { [[maybe_unused]] auto tmpVal = FluidSystem : : density ( fs , paramCache , phaseIdx ) ; static_assert ( std : : is_same < decltype ( tmpVal ) , RhsEval > : : value , " The default return value must be the scalar used by the fluid state! " ) ; } catch ( . . . ) { } ;
2015-05-21 15:33:16 +02:00
try { val = FluidSystem : : template density < FluidState , LhsEval > ( fs , paramCache , phaseIdx ) ; } catch ( . . . ) { } ;
try { scalarVal = FluidSystem : : template density < FluidState , Scalar > ( fs , paramCache , phaseIdx ) ; } catch ( . . . ) { } ;
2013-05-30 18:44:10 +02:00
fs . allowPressure ( true ) ;
fs . allowDensity ( true ) ;
2021-08-03 09:12:52 +02:00
try { [[maybe_unused]] auto tmpVal = FluidSystem : : viscosity ( fs , paramCache , phaseIdx ) ; static_assert ( std : : is_same < decltype ( tmpVal ) , RhsEval > : : value , " The default return value must be the scalar used by the fluid state! " ) ; } catch ( . . . ) { } ;
try { [[maybe_unused]] auto tmpVal = FluidSystem : : enthalpy ( fs , paramCache , phaseIdx ) ; static_assert ( std : : is_same < decltype ( tmpVal ) , RhsEval > : : value , " The default return value must be the scalar used by the fluid state! " ) ; } catch ( . . . ) { } ;
try { [[maybe_unused]] auto tmpVal = FluidSystem : : heatCapacity ( fs , paramCache , phaseIdx ) ; static_assert ( std : : is_same < decltype ( tmpVal ) , RhsEval > : : value , " The default return value must be the scalar used by the fluid state! " ) ; } catch ( . . . ) { } ;
try { [[maybe_unused]] auto tmpVal = FluidSystem : : thermalConductivity ( fs , paramCache , phaseIdx ) ; static_assert ( std : : is_same < decltype ( tmpVal ) , RhsEval > : : value , " The default return value must be the scalar used by the fluid state! " ) ; } catch ( . . . ) { } ;
2015-05-21 15:33:16 +02:00
try { val = FluidSystem : : template viscosity < FluidState , LhsEval > ( fs , paramCache , phaseIdx ) ; } catch ( . . . ) { } ;
try { val = FluidSystem : : template enthalpy < FluidState , LhsEval > ( fs , paramCache , phaseIdx ) ; } catch ( . . . ) { } ;
try { val = FluidSystem : : template heatCapacity < FluidState , LhsEval > ( fs , paramCache , phaseIdx ) ; } catch ( . . . ) { } ;
try { val = FluidSystem : : template thermalConductivity < FluidState , LhsEval > ( fs , paramCache , phaseIdx ) ; } catch ( . . . ) { } ;
try { scalarVal = FluidSystem : : template viscosity < FluidState , Scalar > ( fs , paramCache , phaseIdx ) ; } catch ( . . . ) { } ;
try { scalarVal = FluidSystem : : template enthalpy < FluidState , Scalar > ( fs , paramCache , phaseIdx ) ; } catch ( . . . ) { } ;
try { scalarVal = FluidSystem : : template heatCapacity < FluidState , Scalar > ( fs , paramCache , phaseIdx ) ; } catch ( . . . ) { } ;
try { scalarVal = FluidSystem : : template thermalConductivity < FluidState , Scalar > ( fs , paramCache , phaseIdx ) ; } catch ( . . . ) { } ;
2013-05-30 18:44:10 +02:00
2015-09-22 11:20:55 +02:00
for ( unsigned compIdx = 0 ; compIdx < numComponents ; + + compIdx ) {
2013-05-30 18:44:10 +02:00
fs . allowComposition ( ! FluidSystem : : isIdealMixture ( phaseIdx ) ) ;
2021-08-03 09:12:52 +02:00
try { [[maybe_unused]] auto tmpVal = FluidSystem : : fugacityCoefficient ( fs , paramCache , phaseIdx , compIdx ) ; static_assert ( std : : is_same < decltype ( tmpVal ) , RhsEval > : : value , " The default return value must be the scalar used by the fluid state! " ) ; } catch ( . . . ) { } ;
2015-05-21 15:33:16 +02:00
try { val = FluidSystem : : template fugacityCoefficient < FluidState , LhsEval > ( fs , paramCache , phaseIdx , compIdx ) ; } catch ( . . . ) { } ;
try { scalarVal = FluidSystem : : template fugacityCoefficient < FluidState , Scalar > ( fs , paramCache , phaseIdx , compIdx ) ; } catch ( . . . ) { } ;
2013-05-30 18:44:10 +02:00
fs . allowComposition ( true ) ;
2021-08-03 09:12:52 +02:00
try { [[maybe_unused]] auto tmpVal = FluidSystem : : diffusionCoefficient ( fs , paramCache , phaseIdx , compIdx ) ; static_assert ( std : : is_same < decltype ( tmpVal ) , RhsEval > : : value , " The default return value must be the scalar used by the fluid state! " ) ; } catch ( . . . ) { } ;
2015-05-21 15:33:16 +02:00
try { val = FluidSystem : : template diffusionCoefficient < FluidState , LhsEval > ( fs , paramCache , phaseIdx , compIdx ) ; } catch ( . . . ) { } ;
try { scalarVal = FluidSystem : : template fugacityCoefficient < FluidState , Scalar > ( fs , paramCache , phaseIdx , compIdx ) ; } catch ( . . . ) { } ;
2013-05-30 18:44:10 +02:00
}
}
// test for phaseName(), isLiquid() and isIdealGas()
2015-09-22 11:20:55 +02:00
for ( unsigned phaseIdx = 0 ; phaseIdx < numPhases ; + + phaseIdx ) {
2021-08-03 09:12:52 +02:00
[[maybe_unused]] std : : string name = FluidSystem : : phaseName ( phaseIdx ) ;
2015-09-22 16:44:28 +02:00
bool bVal = FluidSystem : : isLiquid ( phaseIdx ) ;
2013-05-30 18:44:10 +02:00
bVal = FluidSystem : : isIdealGas ( phaseIdx ) ;
2015-09-22 16:44:28 +02:00
bVal = ! bVal ; // get rid of GCC warning (only occurs with paranoid warning flags)
2013-05-30 18:44:10 +02:00
}
2015-05-21 15:33:16 +02:00
// test for molarMass() and componentName()
2015-09-22 11:20:55 +02:00
for ( unsigned compIdx = 0 ; compIdx < numComponents ; + + compIdx ) {
2013-05-30 18:44:10 +02:00
val = FluidSystem : : molarMass ( compIdx ) ;
2015-09-22 16:44:28 +02:00
std : : string name = FluidSystem : : componentName ( compIdx ) ;
2013-05-30 18:44:10 +02:00
}
}
# endif