Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions src/coreComponents/constitutive/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ set( constitutive_headers
fluid/PVTFunctions/SpanWagnerCO2Density.hpp
fluid/PVTFunctions/BrineEnthalpy.hpp
fluid/PVTFunctions/CO2Enthalpy.hpp
fluid/PVTFunctions/BrineInternalEnergy.hpp
fluid/PVTFunctions/CO2InternalEnergy.hpp
fluid/PVTFunctions/CO2EOSSolver.hpp
fluid/PVTFunctions/PureWaterProperties.hpp
fluid/ParticleFluid.hpp
Expand Down Expand Up @@ -150,8 +148,6 @@ set( constitutive_sources
fluid/PVTFunctions/PVTFunctionHelpers.cpp
fluid/PVTFunctions/BrineEnthalpy.cpp
fluid/PVTFunctions/CO2Enthalpy.cpp
fluid/PVTFunctions/BrineInternalEnergy.cpp
fluid/PVTFunctions/CO2InternalEnergy.cpp
fluid/PVTFunctions/CO2EOSSolver.cpp
fluid/PVTFunctions/PureWaterProperties.cpp
fluid/ParticleFluid.cpp
Expand Down
68 changes: 25 additions & 43 deletions src/coreComponents/constitutive/fluid/CO2BrineFluid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,33 +36,33 @@ template< typename PHASE1, typename PHASE2, typename FLASH > class
TwoPhaseCatalogNames {};

template<> class
TwoPhaseCatalogNames< PhaseModel< PVTProps::PhillipsBrineDensity, PVTProps::PhillipsBrineViscosity, PVTProps::NoOpPVTFunction, PVTProps::NoOpPVTFunction >,
PhaseModel< PVTProps::SpanWagnerCO2Density, PVTProps::FenghourCO2Viscosity, PVTProps::NoOpPVTFunction, PVTProps::NoOpPVTFunction >,
TwoPhaseCatalogNames< PhaseModel< PVTProps::PhillipsBrineDensity, PVTProps::PhillipsBrineViscosity, PVTProps::NoOpPVTFunction >,
PhaseModel< PVTProps::SpanWagnerCO2Density, PVTProps::FenghourCO2Viscosity, PVTProps::NoOpPVTFunction >,
PVTProps::CO2Solubility >
{
public:
static string name() { return "CO2BrinePhillipsFluid"; }
};
template<> class
TwoPhaseCatalogNames< PhaseModel< PVTProps::PhillipsBrineDensity, PVTProps::PhillipsBrineViscosity, PVTProps::BrineEnthalpy, PVTProps::BrineInternalEnergy >,
PhaseModel< PVTProps::SpanWagnerCO2Density, PVTProps::FenghourCO2Viscosity, PVTProps::CO2Enthalpy, PVTProps::CO2InternalEnergy >,
TwoPhaseCatalogNames< PhaseModel< PVTProps::PhillipsBrineDensity, PVTProps::PhillipsBrineViscosity, PVTProps::BrineEnthalpy >,
PhaseModel< PVTProps::SpanWagnerCO2Density, PVTProps::FenghourCO2Viscosity, PVTProps::CO2Enthalpy >,
PVTProps::CO2Solubility >
{
public:
static string name() { return "CO2BrinePhillipsThermalFluid"; }
};

template<> class
TwoPhaseCatalogNames< PhaseModel< PVTProps::EzrokhiBrineDensity, PVTProps::EzrokhiBrineViscosity, PVTProps::NoOpPVTFunction, PVTProps::NoOpPVTFunction >,
PhaseModel< PVTProps::SpanWagnerCO2Density, PVTProps::FenghourCO2Viscosity, PVTProps::NoOpPVTFunction, PVTProps::NoOpPVTFunction >,
TwoPhaseCatalogNames< PhaseModel< PVTProps::EzrokhiBrineDensity, PVTProps::EzrokhiBrineViscosity, PVTProps::NoOpPVTFunction >,
PhaseModel< PVTProps::SpanWagnerCO2Density, PVTProps::FenghourCO2Viscosity, PVTProps::NoOpPVTFunction >,
PVTProps::CO2Solubility >
{
public:
static string name() { return "CO2BrineEzrokhiFluid"; }
};
template<> class
TwoPhaseCatalogNames< PhaseModel< PVTProps::EzrokhiBrineDensity, PVTProps::EzrokhiBrineViscosity, PVTProps::BrineEnthalpy, PVTProps::BrineInternalEnergy >,
PhaseModel< PVTProps::SpanWagnerCO2Density, PVTProps::FenghourCO2Viscosity, PVTProps::CO2Enthalpy, PVTProps::CO2InternalEnergy >,
TwoPhaseCatalogNames< PhaseModel< PVTProps::EzrokhiBrineDensity, PVTProps::EzrokhiBrineViscosity, PVTProps::BrineEnthalpy >,
PhaseModel< PVTProps::SpanWagnerCO2Density, PVTProps::FenghourCO2Viscosity, PVTProps::CO2Enthalpy >,
PVTProps::CO2Solubility >
{
public:
Expand Down Expand Up @@ -109,10 +109,8 @@ CO2BrineFluid( string const & name, Group * const parent ):
template< typename PHASE1, typename PHASE2, typename FLASH >
bool CO2BrineFluid< PHASE1, PHASE2, FLASH >::isThermal() const
{
return ( PHASE1::Enthalpy::catalogName() != PVTProps::NoOpPVTFunction::catalogName() &&
PHASE1::InternalEnergy::catalogName() != PVTProps::NoOpPVTFunction::catalogName() &&
PHASE2::Enthalpy::catalogName() != PVTProps::NoOpPVTFunction::catalogName() &&
PHASE2::InternalEnergy::catalogName() != PVTProps::NoOpPVTFunction::catalogName() );
return ( PHASE1::Enthalpy::catalogName() != PVTProps::NoOpPVTFunction::catalogName() &&
PHASE2::Enthalpy::catalogName() != PVTProps::NoOpPVTFunction::catalogName() );
}


Expand Down Expand Up @@ -174,11 +172,11 @@ void CO2BrineFluid< PHASE1, PHASE2, FLASH >::createPVTModels()
// TODO: get rid of these external files and move into XML, this is too error prone
// For now, to support the legacy input, we read all the input parameters at once in the arrays below, and then we create the models
array1d< array1d< string > > phase1InputParams;
phase1InputParams.resize( 4 );
phase1InputParams.resize( 3 );
array1d< array1d< string > > phase2InputParams;
phase2InputParams.resize( 4 );
phase2InputParams.resize( 3 );

// 1) Create the viscosity, density, enthalpy, and internal energy models
// 1) Create the viscosity, density, enthalpy models
for( string const & filename : m_phasePVTParaFiles )
{
std::ifstream is( filename );
Expand Down Expand Up @@ -220,17 +218,6 @@ void CO2BrineFluid< PHASE1, PHASE2, FLASH >::createPVTModels()
phase2InputParams[PHASE2::InputParamOrder::ENTHALPY] = strs;
}
}
else if( strs[0] == toString( SubModelInputNames::INTERNALENERGY ) )
{
if( strs[1] == PHASE1::InternalEnergy::catalogName() )
{
phase1InputParams[PHASE1::InputParamOrder::INTERNALENERGY] = strs;
}
else if( strs[1] == PHASE2::InternalEnergy::catalogName() )
{
phase2InputParams[PHASE2::InputParamOrder::INTERNALENERGY] = strs;
}
}
else
{
GEOSX_THROW( GEOSX_FMT( "{}: invalid PVT function type '{}'", getFullName(), strs[0] ), InputError );
Expand All @@ -253,15 +240,7 @@ void CO2BrineFluid< PHASE1, PHASE2, FLASH >::createPVTModels()
GEOSX_FMT( "{}: PVT model {} not found in input files", getFullName(), PHASE2::Viscosity::catalogName() ),
InputError );

// we also detect any inconsistency arising in the enthalpy/internal energy models
GEOSX_THROW_IF( phase1InputParams[PHASE1::InputParamOrder::INTERNALENERGY].empty() &&
( PHASE1::InternalEnergy::catalogName() != PVTProps::NoOpPVTFunction::catalogName() ),
GEOSX_FMT( "{}: PVT model {} not found in input files", getFullName(), PHASE1::InternalEnergy::catalogName() ),
InputError );
GEOSX_THROW_IF( phase2InputParams[PHASE2::InputParamOrder::INTERNALENERGY].empty() &&
( PHASE2::InternalEnergy::catalogName() != PVTProps::NoOpPVTFunction::catalogName() ),
GEOSX_FMT( "{}: PVT model {} not found in input files", getFullName(), PHASE2::InternalEnergy::catalogName() ),
InputError );
// we also detect any inconsistency arising in the enthalpy models
GEOSX_THROW_IF( phase1InputParams[PHASE1::InputParamOrder::ENTHALPY].empty() &&
( PHASE1::Enthalpy::catalogName() != PVTProps::NoOpPVTFunction::catalogName() ),
GEOSX_FMT( "{}: PVT model {} not found in input files", getFullName(), PHASE1::Enthalpy::catalogName() ),
Expand Down Expand Up @@ -317,6 +296,7 @@ CO2BrineFluid< PHASE1, PHASE2, FLASH >::createKernelWrapper()
*m_flash,
m_componentMolarWeight.toViewConst(),
m_useMass,
isThermal(),
m_phaseFraction.toView(),
m_phaseDensity.toView(),
m_phaseMassDensity.toView(),
Expand All @@ -336,6 +316,7 @@ CO2BrineFluid< PHASE1, PHASE2, FLASH >::KernelWrapper::
FLASH const & flash,
arrayView1d< geosx::real64 const > componentMolarWeight,
bool const useMass,
bool const isThermal,
PhaseProp::ViewType phaseFraction,
PhaseProp::ViewType phaseDensity,
PhaseProp::ViewType phaseMassDensity,
Expand All @@ -356,24 +337,25 @@ CO2BrineFluid< PHASE1, PHASE2, FLASH >::KernelWrapper::
std::move( totalDensity ) ),
m_p1Index( p1Index ),
m_p2Index( p2Index ),
m_isThermal( isThermal ),
m_phase1( phase1.createKernelWrapper() ),
m_phase2( phase2.createKernelWrapper() ),
m_flash( flash.createKernelWrapper() )
{}

// explicit instantiation of the model template; unfortunately we can't use the aliases for this
template class CO2BrineFluid< PhaseModel< PVTProps::PhillipsBrineDensity, PVTProps::PhillipsBrineViscosity, PVTProps::NoOpPVTFunction, PVTProps::NoOpPVTFunction >,
PhaseModel< PVTProps::SpanWagnerCO2Density, PVTProps::FenghourCO2Viscosity, PVTProps::NoOpPVTFunction, PVTProps::NoOpPVTFunction >,
template class CO2BrineFluid< PhaseModel< PVTProps::PhillipsBrineDensity, PVTProps::PhillipsBrineViscosity, PVTProps::NoOpPVTFunction >,
PhaseModel< PVTProps::SpanWagnerCO2Density, PVTProps::FenghourCO2Viscosity, PVTProps::NoOpPVTFunction >,
PVTProps::CO2Solubility >;
template class CO2BrineFluid< PhaseModel< PVTProps::PhillipsBrineDensity, PVTProps::PhillipsBrineViscosity, PVTProps::BrineEnthalpy, PVTProps::BrineInternalEnergy >,
PhaseModel< PVTProps::SpanWagnerCO2Density, PVTProps::FenghourCO2Viscosity, PVTProps::CO2Enthalpy, PVTProps::CO2InternalEnergy >,
template class CO2BrineFluid< PhaseModel< PVTProps::PhillipsBrineDensity, PVTProps::PhillipsBrineViscosity, PVTProps::BrineEnthalpy >,
PhaseModel< PVTProps::SpanWagnerCO2Density, PVTProps::FenghourCO2Viscosity, PVTProps::CO2Enthalpy >,
PVTProps::CO2Solubility >;

template class CO2BrineFluid< PhaseModel< PVTProps::EzrokhiBrineDensity, PVTProps::EzrokhiBrineViscosity, PVTProps::NoOpPVTFunction, PVTProps::NoOpPVTFunction >,
PhaseModel< PVTProps::SpanWagnerCO2Density, PVTProps::FenghourCO2Viscosity, PVTProps::NoOpPVTFunction, PVTProps::NoOpPVTFunction >,
template class CO2BrineFluid< PhaseModel< PVTProps::EzrokhiBrineDensity, PVTProps::EzrokhiBrineViscosity, PVTProps::NoOpPVTFunction >,
PhaseModel< PVTProps::SpanWagnerCO2Density, PVTProps::FenghourCO2Viscosity, PVTProps::NoOpPVTFunction >,
PVTProps::CO2Solubility >;
template class CO2BrineFluid< PhaseModel< PVTProps::EzrokhiBrineDensity, PVTProps::EzrokhiBrineViscosity, PVTProps::BrineEnthalpy, PVTProps::BrineInternalEnergy >,
PhaseModel< PVTProps::SpanWagnerCO2Density, PVTProps::FenghourCO2Viscosity, PVTProps::CO2Enthalpy, PVTProps::CO2InternalEnergy >,
template class CO2BrineFluid< PhaseModel< PVTProps::EzrokhiBrineDensity, PVTProps::EzrokhiBrineViscosity, PVTProps::BrineEnthalpy >,
PhaseModel< PVTProps::SpanWagnerCO2Density, PVTProps::FenghourCO2Viscosity, PVTProps::CO2Enthalpy >,
PVTProps::CO2Solubility >;

REGISTER_CATALOG_ENTRY( ConstitutiveBase, CO2BrinePhillipsFluid, string const &, Group * const )
Expand Down
Loading