From 4e53595bb05d01039b3ab9848d33c2931e1e69ec Mon Sep 17 00:00:00 2001 From: dkachuma Date: Mon, 22 Jul 2024 23:56:34 -0500 Subject: [PATCH 1/8] Add immiscible water flash model --- .../constitutive/CMakeLists.txt | 4 + .../CompositionalMultiphaseFluid.cpp | 2 +- .../models/ComponentProperties.hpp | 1 + .../models/ImmiscibleWaterFlashModel.cpp | 105 ++++++ .../models/ImmiscibleWaterFlashModel.hpp | 212 +++++++++++ .../models/ImmiscibleWaterParameters.cpp | 89 +++++ .../models/ImmiscibleWaterParameters.hpp | 59 +++ .../compositional/models/ModelParameters.hpp | 3 + .../constitutive/unitTests/CMakeLists.txt | 1 + .../constitutive/unitTests/TestFluid.hpp | 9 +- .../testImmiscibleWaterFlashModel.cpp | 349 ++++++++++++++++++ 11 files changed, 831 insertions(+), 3 deletions(-) create mode 100644 src/coreComponents/constitutive/fluid/multifluid/compositional/models/ImmiscibleWaterFlashModel.cpp create mode 100644 src/coreComponents/constitutive/fluid/multifluid/compositional/models/ImmiscibleWaterFlashModel.hpp create mode 100644 src/coreComponents/constitutive/fluid/multifluid/compositional/models/ImmiscibleWaterParameters.cpp create mode 100644 src/coreComponents/constitutive/fluid/multifluid/compositional/models/ImmiscibleWaterParameters.hpp create mode 100644 src/coreComponents/constitutive/unitTests/testImmiscibleWaterFlashModel.cpp diff --git a/src/coreComponents/constitutive/CMakeLists.txt b/src/coreComponents/constitutive/CMakeLists.txt index cae2dbc2e7f..728045c8305 100644 --- a/src/coreComponents/constitutive/CMakeLists.txt +++ b/src/coreComponents/constitutive/CMakeLists.txt @@ -74,6 +74,8 @@ set( constitutive_headers fluid/multifluid/compositional/models/ConstantViscosity.hpp fluid/multifluid/compositional/models/EquationOfState.hpp fluid/multifluid/compositional/models/FunctionBase.hpp + fluid/multifluid/compositional/models/ImmiscibleWaterFlashModel.hpp + fluid/multifluid/compositional/models/ImmiscibleWaterParameters.hpp fluid/multifluid/compositional/models/LohrenzBrayClarkViscosity.hpp fluid/multifluid/compositional/models/LohrenzBrayClarkViscosityImpl.hpp fluid/multifluid/compositional/models/NegativeTwoPhaseFlashModel.hpp @@ -224,6 +226,8 @@ set( constitutive_sources fluid/multifluid/CO2Brine/functions/WaterDensity.cpp fluid/multifluid/compositional/models/CompositionalDensity.cpp fluid/multifluid/compositional/models/ConstantViscosity.cpp + fluid/multifluid/compositional/models/ImmiscibleWaterFlashModel.cpp + fluid/multifluid/compositional/models/ImmiscibleWaterParameters.cpp fluid/multifluid/compositional/models/LohrenzBrayClarkViscosity.cpp fluid/multifluid/compositional/models/NegativeTwoPhaseFlashModel.cpp fluid/multifluid/compositional/CompositionalMultiphaseFluid.cpp diff --git a/src/coreComponents/constitutive/fluid/multifluid/compositional/CompositionalMultiphaseFluid.cpp b/src/coreComponents/constitutive/fluid/multifluid/compositional/CompositionalMultiphaseFluid.cpp index c90f0fe9366..a7ee0896835 100644 --- a/src/coreComponents/constitutive/fluid/multifluid/compositional/CompositionalMultiphaseFluid.cpp +++ b/src/coreComponents/constitutive/fluid/multifluid/compositional/CompositionalMultiphaseFluid.cpp @@ -85,7 +85,7 @@ CompositionalMultiphaseFluid( string const & name, Group * const parent ) template< typename FLASH, typename PHASE1, typename PHASE2, typename PHASE3 > integer CompositionalMultiphaseFluid< FLASH, PHASE1, PHASE2, PHASE3 >::getWaterPhaseIndex() const { - string const expectedWaterPhaseNames[] = { "water" }; + string const expectedWaterPhaseNames[] = { "water", "wat", "aqueous" }; return PVTProps::PVTFunctionHelpers::findName( m_phaseNames, expectedWaterPhaseNames, viewKeyStruct::phaseNamesString() ); } diff --git a/src/coreComponents/constitutive/fluid/multifluid/compositional/models/ComponentProperties.hpp b/src/coreComponents/constitutive/fluid/multifluid/compositional/models/ComponentProperties.hpp index e11290a280b..250b4d7a60c 100644 --- a/src/coreComponents/constitutive/fluid/multifluid/compositional/models/ComponentProperties.hpp +++ b/src/coreComponents/constitutive/fluid/multifluid/compositional/models/ComponentProperties.hpp @@ -56,6 +56,7 @@ class ComponentProperties final /** * Data accessors */ + arrayView1d< string > const & getComponentName() const { return m_componentNames; } arrayView1d< real64 > const & getComponentMolarWeight() const { return m_componentMolarWeight; } arrayView1d< real64 > const & getComponentCriticalPressure() const { return m_componentCriticalPressure; } arrayView1d< real64 > const & getComponentCriticalTemperature() const { return m_componentCriticalTemperature; } diff --git a/src/coreComponents/constitutive/fluid/multifluid/compositional/models/ImmiscibleWaterFlashModel.cpp b/src/coreComponents/constitutive/fluid/multifluid/compositional/models/ImmiscibleWaterFlashModel.cpp new file mode 100644 index 00000000000..007924f41a4 --- /dev/null +++ b/src/coreComponents/constitutive/fluid/multifluid/compositional/models/ImmiscibleWaterFlashModel.cpp @@ -0,0 +1,105 @@ +/* + * ------------------------------------------------------------------------------------------------------------ + * SPDX-License-Identifier: LGPL-2.1-only + * + * Copyright (c) 2016-2024 Lawrence Livermore National Security LLC + * Copyright (c) 2018-2024 Total, S.A + * Copyright (c) 2018-2024 The Board of Trustees of the Leland Stanford Junior University + * Copyright (c) 2018-2024 Chevron + * Copyright (c) 2019- GEOS/GEOSX Contributors + * All rights reserved + * + * See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details. + * ------------------------------------------------------------------------------------------------------------ + */ + +/** + * @file ImmiscibleWaterFlashModel.cpp + */ + +#include "ImmiscibleWaterFlashModel.hpp" +#include "ImmiscibleWaterParameters.hpp" +#include "EquationOfState.hpp" + +namespace geos +{ + +namespace constitutive +{ + +namespace compositional +{ + +// Naming conventions +string ImmiscibleWaterFlashModel::catalogName() +{ + return "ThreePhase"; +} + +ImmiscibleWaterFlashModel::ImmiscibleWaterFlashModel( string const & name, + ComponentProperties const & componentProperties, + ModelParameters const & modelParameters ): + FunctionBase( name, componentProperties ), + m_parameters( modelParameters ) +{ + m_waterComponentIndex = ImmiscibleWaterParameters::getWaterComponentIndex( componentProperties ); +} + +ImmiscibleWaterFlashModel::KernelWrapper +ImmiscibleWaterFlashModel::createKernelWrapper() const +{ + constexpr integer liquidIndex = 0; + constexpr integer vapourIndex = 1; + constexpr integer aqueousIndex = 2; + EquationOfState const * equationOfState = m_parameters.get< EquationOfState >(); + EquationOfStateType const liquidEos = EnumStrings< EquationOfStateType >::fromString( equationOfState->m_equationsOfStateNames[liquidIndex] ); + EquationOfStateType const vapourEos = EnumStrings< EquationOfStateType >::fromString( equationOfState->m_equationsOfStateNames[vapourIndex] ); + + array1d< real64 > componentCriticalVolume( m_componentProperties.getNumberOfComponents()); + + return KernelWrapper( m_componentProperties.getNumberOfComponents(), + liquidIndex, + vapourIndex, + aqueousIndex, + m_waterComponentIndex, + liquidEos, + vapourEos, + componentCriticalVolume ); +} + +ImmiscibleWaterFlashModelUpdate::ImmiscibleWaterFlashModelUpdate( + integer const numComponents, + integer const liquidIndex, + integer const vapourIndex, + integer const aqueousIndex, + integer const waterComponentIndex, + EquationOfStateType const liquidEos, + EquationOfStateType const vapourEos, + arrayView1d< real64 const > const componentCriticalVolume ): + m_twoPhaseModel( numComponents, + liquidIndex, + vapourIndex, + liquidEos, + vapourEos ), + m_numComponents( numComponents ), + m_liquidIndex( liquidIndex ), + m_vapourIndex( vapourIndex ), + m_aquoesIndex( aqueousIndex ), + m_waterComponentIndex( waterComponentIndex ) +{ + GEOS_UNUSED_VAR( componentCriticalVolume ); +} + +std::unique_ptr< ModelParameters > +ImmiscibleWaterFlashModel::createParameters( std::unique_ptr< ModelParameters > parameters ) +{ + auto params = NegativeTwoPhaseFlashModel::createParameters( std::move( parameters ) ); + params = ImmiscibleWaterParameters::create( std::move( params ) ); + return params; +} + +} // end namespace compositional + +} // namespace constitutive + +} // end namespace geos diff --git a/src/coreComponents/constitutive/fluid/multifluid/compositional/models/ImmiscibleWaterFlashModel.hpp b/src/coreComponents/constitutive/fluid/multifluid/compositional/models/ImmiscibleWaterFlashModel.hpp new file mode 100644 index 00000000000..c1c7cc43886 --- /dev/null +++ b/src/coreComponents/constitutive/fluid/multifluid/compositional/models/ImmiscibleWaterFlashModel.hpp @@ -0,0 +1,212 @@ +/* + * ------------------------------------------------------------------------------------------------------------ + * SPDX-License-Identifier: LGPL-2.1-only + * + * Copyright (c) 2016-2024 Lawrence Livermore National Security LLC + * Copyright (c) 2018-2024 Total, S.A + * Copyright (c) 2018-2024 The Board of Trustees of the Leland Stanford Junior University + * Copyright (c) 2018-2024 Chevron + * Copyright (c) 2019- GEOS/GEOSX Contributors + * All rights reserved + * + * See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details. + * ------------------------------------------------------------------------------------------------------------ + */ + +/** + * @file ImmiscibleWaterFlashModel.hpp + */ + +#ifndef GEOS_CONSTITUTIVE_FLUID_MULTIFLUID_COMPOSITIONAL_MODELS_IMMISCIBLEWATERFLASHMODEL_HPP_ +#define GEOS_CONSTITUTIVE_FLUID_MULTIFLUID_COMPOSITIONAL_MODELS_IMMISCIBLEWATERFLASHMODEL_HPP_ + +#include "FunctionBase.hpp" +#include "EquationOfState.hpp" + +#include "constitutive/fluid/multifluid/Layouts.hpp" +#include "constitutive/fluid/multifluid/MultiFluidUtils.hpp" +#include "NegativeTwoPhaseFlashModel.hpp" + +namespace geos +{ + +namespace constitutive +{ + +namespace compositional +{ + +class ModelParameters; + +class ImmiscibleWaterFlashModelUpdate final : public FunctionBaseUpdate +{ +private: + static constexpr integer maxNumComps = MultiFluidConstants::MAX_NUM_COMPONENTS; +public: + + using PhaseProp = MultiFluidVar< real64, 3, multifluid::LAYOUT_PHASE, multifluid::LAYOUT_PHASE_DC >; + using PhaseComp = MultiFluidVar< real64, 4, multifluid::LAYOUT_PHASE_COMP, multifluid::LAYOUT_PHASE_COMP_DC >; + using Deriv = multifluid::DerivativeOffset; + + ImmiscibleWaterFlashModelUpdate( integer const numComponents, + integer const liquidIndex, + integer const vapourIndex, + integer const aqueousIndex, + integer const waterComponentIndex, + EquationOfStateType const liquidEos, + EquationOfStateType const vapourEos, + arrayView1d< real64 const > const componentCriticalVolume ); + + // Mark as a 3-phase flash + GEOS_HOST_DEVICE + static constexpr integer getNumberOfPhases() { return 3; } + + template< int USD1, int USD2 > + GEOS_HOST_DEVICE + void compute( ComponentProperties::KernelWrapper const & componentProperties, + real64 const & pressure, + real64 const & temperature, + arraySlice1d< real64 const, USD1 > const & compFraction, + arraySlice2d< real64, USD2 > const & kValues, + PhaseProp::SliceType const phaseFraction, + PhaseComp::SliceType const phaseCompFraction ) const; + +private: + template< int USD > + GEOS_FORCE_INLINE + GEOS_HOST_DEVICE + void convertCompositionDerivatives( real64 const hcMoleFraction, + arraySlice1d< real64 const > const & composition, + arraySlice1d< real64, USD > const & derivatives ) const + { + real64 dvdzi = 0.0; + for( integer ic = 0; ic < m_numComponents; ++ic ) + { + dvdzi += derivatives[Deriv::dC+ic] * composition[ic]; + } + for( integer ic = 0; ic < m_numComponents; ++ic ) + { + derivatives[Deriv::dC+ic] /= hcMoleFraction; + } + derivatives[Deriv::dC+m_waterComponentIndex] = dvdzi / hcMoleFraction; + } + +private: + NegativeTwoPhaseFlashModel::KernelWrapper const m_twoPhaseModel; + integer const m_numComponents; + integer const m_liquidIndex; + integer const m_vapourIndex; + integer const m_aquoesIndex; + integer const m_waterComponentIndex; +}; + +class ImmiscibleWaterFlashModel : public FunctionBase +{ +public: + ImmiscibleWaterFlashModel( string const & name, + ComponentProperties const & componentProperties, + ModelParameters const & modelParameters ); + + static string catalogName(); + + FunctionType functionType() const override + { + return FunctionType::FLASH; + } + + /// Type of kernel wrapper for in-kernel update + using KernelWrapper = ImmiscibleWaterFlashModelUpdate; + + /** + * @brief Create an update kernel wrapper. + * @return the wrapper + */ + KernelWrapper createKernelWrapper() const; + + // Create parameters unique to this model + static std::unique_ptr< ModelParameters > createParameters( std::unique_ptr< ModelParameters > parameters ); + +private: + ModelParameters const & m_parameters; + integer m_waterComponentIndex{-1}; +}; + +template< int USD1, int USD2 > +GEOS_HOST_DEVICE +void ImmiscibleWaterFlashModelUpdate::compute( ComponentProperties::KernelWrapper const & componentProperties, + real64 const & pressure, + real64 const & temperature, + arraySlice1d< real64 const, USD1 > const & compFraction, + arraySlice2d< real64, USD2 > const & kValues, + PhaseProp::SliceType const phaseFraction, + PhaseComp::SliceType const phaseCompFraction ) const +{ + LvArray::forValuesInSlice( phaseFraction.value, setZero ); + LvArray::forValuesInSlice( phaseFraction.derivs, setZero ); + LvArray::forValuesInSlice( phaseCompFraction.value, setZero ); + LvArray::forValuesInSlice( phaseCompFraction.derivs, setZero ); + + // Water phase + phaseFraction.value[m_aquoesIndex] = compFraction[m_waterComponentIndex]; + phaseFraction.derivs( m_aquoesIndex, Deriv::dC + m_waterComponentIndex ) = 1.0; + phaseCompFraction.value( m_aquoesIndex, m_waterComponentIndex ) = 1.0; + + // Total hydrocarbon mole fraction + real64 const z_hc = 1.0 - compFraction[m_waterComponentIndex]; + + if( z_hc < MultiFluidConstants::minForSpeciesPresence ) + { + // Single phase water + real64 const constantComposition = 1.0 / (m_numComponents - 1); + for( integer ic = 0; ic < m_numComponents; ++ic ) + { + phaseCompFraction.value( m_liquidIndex, ic ) = constantComposition; + phaseCompFraction.value( m_vapourIndex, ic ) = constantComposition; + } + phaseCompFraction.value( m_liquidIndex, m_waterComponentIndex ) = 0.0; + phaseCompFraction.value( m_vapourIndex, m_waterComponentIndex ) = 0.0; + } + else + { + // Hydrocarbon phases + + // Calculate normalised hyrdocarbon composition + stackArray1d< real64, maxNumComps > composition( m_numComponents ); + for( integer ic = 0; ic < m_numComponents; ++ic ) + { + composition[ic] = compFraction[ic] / z_hc; + } + composition[m_waterComponentIndex] = 0.0; + + // Perform negative two-phase flash + m_twoPhaseModel.compute( componentProperties, + pressure, + temperature, + composition.toSliceConst(), + kValues, + phaseFraction, + phaseCompFraction ); + + for( integer const phaseIndex : {m_liquidIndex, m_vapourIndex} ) + { + real64 const v = phaseFraction.value[phaseIndex]; + phaseFraction.value[phaseIndex] *= z_hc; + LvArray::forValuesInSlice( phaseFraction.derivs[phaseIndex], [&]( real64 & a ){ a *= z_hc; } ); + convertCompositionDerivatives( z_hc, composition.toSliceConst(), phaseFraction.derivs[phaseIndex] ); + phaseFraction.derivs( phaseIndex, Deriv::dC+m_waterComponentIndex ) = -v; + + for( integer ic = 0; ic < m_numComponents; ++ic ) + { + convertCompositionDerivatives( z_hc, composition.toSliceConst(), phaseCompFraction.derivs[phaseIndex][ic] ); + } + } + } +} + +} // end namespace compositional + +} // end namespace constitutive + +} // end namespace geos + +#endif //GEOS_CONSTITUTIVE_FLUID_MULTIFLUID_COMPOSITIONAL_MODELS_IMMISCIBLEWATERFLASHMODEL_HPP_ diff --git a/src/coreComponents/constitutive/fluid/multifluid/compositional/models/ImmiscibleWaterParameters.cpp b/src/coreComponents/constitutive/fluid/multifluid/compositional/models/ImmiscibleWaterParameters.cpp new file mode 100644 index 00000000000..947a8037a89 --- /dev/null +++ b/src/coreComponents/constitutive/fluid/multifluid/compositional/models/ImmiscibleWaterParameters.cpp @@ -0,0 +1,89 @@ +/* + * ------------------------------------------------------------------------------------------------------------ + * SPDX-License-Identifier: LGPL-2.1-only + * + * Copyright (c) 2016-2024 Lawrence Livermore National Security LLC + * Copyright (c) 2018-2024 Total, S.A + * Copyright (c) 2018-2024 The Board of Trustees of the Leland Stanford Junior University + * Copyright (c) 2018-2024 Chevron + * Copyright (c) 2019- GEOS/GEOSX Contributors + * All rights reserved + * + * See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details. + * ------------------------------------------------------------------------------------------------------------ + */ + +/** + * @file ImmiscibleWaterParameters.cpp + */ + +#include "ImmiscibleWaterParameters.hpp" +#include "ComponentProperties.hpp" +#include "constitutive/fluid/multifluid/MultiFluidBase.hpp" +#include "dataRepository/InputFlags.hpp" +#include "codingUtilities/StringUtilities.hpp" + +namespace geos +{ + +namespace constitutive +{ + +namespace compositional +{ + +ImmiscibleWaterParameters::ImmiscibleWaterParameters( std::unique_ptr< ModelParameters > parameters ): + ModelParameters( std::move( parameters ) ) +{} + +std::unique_ptr< ModelParameters > +ImmiscibleWaterParameters::create( std::unique_ptr< ModelParameters > parameters ) +{ + if( parameters && parameters->get< ImmiscibleWaterParameters >() != nullptr ) + { + return parameters; + } + return std::make_unique< ImmiscibleWaterParameters >( std::move( parameters ) ); +} + +integer ImmiscibleWaterParameters::getWaterComponentIndex( ComponentProperties const & componentProperties ) +{ + auto componentNames = componentProperties.getComponentName(); + integer const numComps = componentNames.size(); + for( integer ic = 0; ic < numComps; ++ic ) + { + string const compName = stringutilities::toLower( componentNames[ic] ); + if( compName == waterComponentName ) + { + return ic; + } + } + return -1; +} + +void ImmiscibleWaterParameters::registerParametersImpl( MultiFluidBase * fluid ) +{ + GEOS_UNUSED_VAR( fluid ); +} + +void ImmiscibleWaterParameters::postInputInitializationImpl( MultiFluidBase const * fluid, + ComponentProperties const & componentProperties ) +{ + integer const waterIndex = fluid->getWaterPhaseIndex(); + GEOS_THROW_IF_LT_MSG( waterIndex, 0, + GEOS_FMT( "{}: water phase not found '{}'", fluid->getFullName(), + MultiFluidBase::viewKeyStruct::phaseNamesString() ), + InputError ); + + integer const h2oIndex = getWaterComponentIndex( componentProperties ); + GEOS_THROW_IF_LT_MSG( h2oIndex, 0, + GEOS_FMT( "{}: water component not found '{}'", fluid->getFullName(), + MultiFluidBase::viewKeyStruct::componentNamesString() ), + InputError ); +} + +} // end namespace compositional + +} // end namespace constitutive + +} // end namespace geos diff --git a/src/coreComponents/constitutive/fluid/multifluid/compositional/models/ImmiscibleWaterParameters.hpp b/src/coreComponents/constitutive/fluid/multifluid/compositional/models/ImmiscibleWaterParameters.hpp new file mode 100644 index 00000000000..2cca343202e --- /dev/null +++ b/src/coreComponents/constitutive/fluid/multifluid/compositional/models/ImmiscibleWaterParameters.hpp @@ -0,0 +1,59 @@ +/* + * ------------------------------------------------------------------------------------------------------------ + * SPDX-License-Identifier: LGPL-2.1-only + * + * Copyright (c) 2016-2024 Lawrence Livermore National Security LLC + * Copyright (c) 2018-2024 Total, S.A + * Copyright (c) 2018-2024 The Board of Trustees of the Leland Stanford Junior University + * Copyright (c) 2018-2024 Chevron + * Copyright (c) 2019- GEOS/GEOSX Contributors + * All rights reserved + * + * See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details. + * ------------------------------------------------------------------------------------------------------------ + */ + +/** + * @file ImmiscibleWaterParameters.hpp + */ + +#ifndef GEOS_CONSTITUTIVE_FLUID_MULTIFLUID_COMPOSITIONAL_MODELS_IMMISCIBLEWATERPARAMETERS_HPP_ +#define GEOS_CONSTITUTIVE_FLUID_MULTIFLUID_COMPOSITIONAL_MODELS_IMMISCIBLEWATERPARAMETERS_HPP_ + +#include "ModelParameters.hpp" +#include "common/DataTypes.hpp" + +namespace geos +{ + +namespace constitutive +{ + +namespace compositional +{ + +class ImmiscibleWaterParameters : public ModelParameters +{ + static constexpr char const * waterComponentName = "h2o"; + +public: + ImmiscibleWaterParameters( std::unique_ptr< ModelParameters > parameters ); + ~ImmiscibleWaterParameters() override = default; + + static std::unique_ptr< ModelParameters > create( std::unique_ptr< ModelParameters > parameters ); + + static integer getWaterComponentIndex( ComponentProperties const & componentProperties ); + +protected: + void registerParametersImpl( MultiFluidBase * fluid ) override; + + void postInputInitializationImpl( MultiFluidBase const * fluid, ComponentProperties const & componentProperties ) override; +}; + +} // end namespace compositional + +} // end namespace constitutive + +} // end namespace geos + +#endif //GEOS_CONSTITUTIVE_FLUID_MULTIFLUID_COMPOSITIONAL_MODELS_IMMISCIBLEWATERPARAMETERS_HPP_ diff --git a/src/coreComponents/constitutive/fluid/multifluid/compositional/models/ModelParameters.hpp b/src/coreComponents/constitutive/fluid/multifluid/compositional/models/ModelParameters.hpp index 498f35810a2..d84d770c39e 100644 --- a/src/coreComponents/constitutive/fluid/multifluid/compositional/models/ModelParameters.hpp +++ b/src/coreComponents/constitutive/fluid/multifluid/compositional/models/ModelParameters.hpp @@ -20,6 +20,9 @@ #ifndef GEOS_CONSTITUTIVE_FLUID_MULTIFLUID_COMPOSITIONAL_MODELS_MODELPARAMETERS_HPP_ #define GEOS_CONSTITUTIVE_FLUID_MULTIFLUID_COMPOSITIONAL_MODELS_MODELPARAMETERS_HPP_ +#include +#include "common/GeosxMacros.hpp" + namespace geos { diff --git a/src/coreComponents/constitutive/unitTests/CMakeLists.txt b/src/coreComponents/constitutive/unitTests/CMakeLists.txt index 09f808eeb27..cf9d0fa5ebd 100644 --- a/src/coreComponents/constitutive/unitTests/CMakeLists.txt +++ b/src/coreComponents/constitutive/unitTests/CMakeLists.txt @@ -7,6 +7,7 @@ set( gtest_geosx_tests testDruckerPrager.cpp testElasticIsotropic.cpp testKValueInitialization.cpp + testImmiscibleWaterFlashModel.cpp testLohrenzBrayClarkViscosity.cpp testModifiedCamClay.cpp testNegativeTwoPhaseFlash.cpp diff --git a/src/coreComponents/constitutive/unitTests/TestFluid.hpp b/src/coreComponents/constitutive/unitTests/TestFluid.hpp index 5713310cbec..1245cbe3218 100644 --- a/src/coreComponents/constitutive/unitTests/TestFluid.hpp +++ b/src/coreComponents/constitutive/unitTests/TestFluid.hpp @@ -67,9 +67,14 @@ class TestFluid static std::unique_ptr< TestFluid< NC > > create( std::array< integer, NC > const & components ) { std::unique_ptr< TestFluid< NC > > testFluid( new TestFluid() ); - for( integer ic = 0; ic < NC; ++ic ) + const std::unordered_map< integer, string > componentNames = { + {Fluid::H2O, "H2O"}, {Fluid::CO2, "CO2"}, {Fluid::N2, "N2"}, {Fluid::H2S, "H2S"}, + {Fluid::C1, "CH4"}, {Fluid::C2, "C2H6"}, {Fluid::C3, "C3H8"}, {Fluid::C4, "C4H10"}, + {Fluid::C5, "C5H12"}, {Fluid::C8, "C8H18"}, {Fluid::C10, "C10+"}, + }; + for( integer const ic : components ) { - testFluid->componentNames.emplace_back( GEOS_FMT( "COMP{}", ic+1 )); + testFluid->componentNames.emplace_back( componentNames.at( ic ) ); } createArray( testFluid->criticalPressure, components, Fluid::Pc, Fluid::data ); createArray( testFluid->criticalTemperature, components, Fluid::Tc, Fluid::data ); diff --git a/src/coreComponents/constitutive/unitTests/testImmiscibleWaterFlashModel.cpp b/src/coreComponents/constitutive/unitTests/testImmiscibleWaterFlashModel.cpp new file mode 100644 index 00000000000..32378ad6ce4 --- /dev/null +++ b/src/coreComponents/constitutive/unitTests/testImmiscibleWaterFlashModel.cpp @@ -0,0 +1,349 @@ +/* + * ------------------------------------------------------------------------------------------------------------ + * SPDX-License-Identifier: LGPL-2.1-only + * + * Copyright (c) 2016-2024 Lawrence Livermore National Security LLC + * Copyright (c) 2018-2024 Total, S.A + * Copyright (c) 2018-2024 The Board of Trustees of the Leland Stanford Junior University + * Copyright (c) 2018-2024 Chevron + * Copyright (c) 2019- GEOS/GEOSX Contributors + * All rights reserved + * + * See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details. + * ------------------------------------------------------------------------------------------------------------ + */ + +// Source includes +#include "codingUtilities/UnitTestUtilities.hpp" +#include "constitutive/fluid/multifluid/MultiFluidUtils.hpp" +#include "constitutive/fluid/multifluid/compositional/models/EquationOfState.hpp" +#include "constitutive/fluid/multifluid/compositional/models/ImmiscibleWaterFlashModel.hpp" +#include "TestFluid.hpp" +#include "TestFluidUtilities.hpp" + +using namespace geos::constitutive; +using namespace geos::constitutive::compositional; + +namespace geos +{ +namespace testing +{ + +constexpr integer numTestComps = 3; + +template< integer NC > +using FlashData = std::tuple< + real64 const, // pressure + real64 const, // temperature + Feed< NC > const, // phase composition + real64 const, // expected liquid fraction + real64 const, // expected vapour fraction + real64 const, // expected aqueous fraction + Feed< numTestComps > const, // expected liquid mole fractions + Feed< numTestComps > const, // expected vapour mole fractions + Feed< numTestComps > const // expected aqueous mole fractions + >; + +template< integer NC > +struct FluidData {}; + +template<> +struct FluidData< 3 > +{ + static constexpr integer testComponents[numTestComps] = {0, 1, 2}; + static std::unique_ptr< TestFluid< 3 > > createFluid() + { + auto fluid = TestFluid< 3 >::create( {Fluid::C1, Fluid::C10, Fluid::H2O} ); + const std::array< real64 const, 3 > bics = { 0.25, 0.0, 0.0 }; + fluid->setBinaryCoefficients( bics ); + return fluid; + } +}; + +template<> +struct FluidData< 9 > +{ + static constexpr integer testComponents[numTestComps] = {0, 2, 8}; + static std::unique_ptr< TestFluid< 9 > > createFluid() + { + auto fluid = TestFluid< 9 >::create( {Fluid::H2O, Fluid::CO2, Fluid::N2, Fluid::C5, Fluid::C2, Fluid::C3, Fluid::C4, Fluid::C5, Fluid::C10} ); + const std::array< real64 const, 36 > bics = { + 0.01, 0, 0.003732, 0, 0.01, 0, 0, 0.01, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0.01, 0, 0.028, 0.01, 0.01, 0, 0, 0.01, 0, 0.04532, 0.01, 0.01, 0, 0, 0 + }; + fluid->setBinaryCoefficients( bics ); + return fluid; + } +}; + +template< integer NC > +class ImmiscibleWaterFlashModelTestFixture : public ::testing::TestWithParam< FlashData< NC > > +{ + static constexpr real64 relTol = 1.0e-5; + static constexpr real64 absTol = 1.0e-7; + static constexpr integer numPhases = 3; + static constexpr integer numComps = NC; + static constexpr integer numDofs = NC + 2; + using Deriv = geos::constitutive::multifluid::DerivativeOffset; + using PhasePropSlice = ImmiscibleWaterFlashModelUpdate::PhaseProp::SliceType; + using PhaseCompSlice = ImmiscibleWaterFlashModelUpdate::PhaseComp::SliceType; + +public: + ImmiscibleWaterFlashModelTestFixture() + : m_fluid( FluidData< NC >::createFluid() ) + { + ComponentProperties const & componentProperties = this->m_fluid->getComponentProperties(); + + m_parameters = ImmiscibleWaterFlashModel::createParameters( std::move( m_parameters ) ); + + auto * equationOfState = const_cast< EquationOfState * >(m_parameters->get< EquationOfState >()); + string const eosName = EnumStrings< EquationOfStateType >::toString( EquationOfStateType::PengRobinson ); + equationOfState->m_equationsOfStateNames.emplace_back( eosName ); + equationOfState->m_equationsOfStateNames.emplace_back( eosName ); + equationOfState->m_equationsOfStateNames.emplace_back( eosName ); + + m_flash = std::make_unique< ImmiscibleWaterFlashModel >( "FlashModel", componentProperties, *m_parameters ); + } + + ~ImmiscibleWaterFlashModelTestFixture() = default; + + void testFlash( FlashData< NC > const & data ) + { + real64 const pressure = std::get< 0 >( data ); + real64 const temperature = std::get< 1 >( data ); + stackArray1d< real64, numComps > composition; + TestFluid< NC >::createArray( composition, std::get< 2 >( data )); + + real64 const expectedPhaseFraction[numPhases] = {std::get< 3 >( data ), std::get< 4 >( data ), std::get< 5 >( data )}; + Feed< numTestComps > const expectedPhaseComponentFraction[numPhases] = {std::get< 6 >( data ), std::get< 7 >( data ), std::get< 8 >( data ) }; + + stackArray2d< real64, (numPhases-1)*numComps > kValues( numPhases-1, numComps ); + LvArray::forValuesInSlice( kValues.toSlice(), []( real64 & v ){ v = 0.0; } ); + + stackArray1d< real64, numPhases > phaseFraction( numPhases ); + stackArray2d< real64, numPhases *numDofs > dPhaseFraction( numPhases, numDofs ); + stackArray2d< real64, numPhases *numComps > phaseComponentFraction( numPhases, numComps ); + stackArray3d< real64, numPhases *numComps *numDofs > dPhaseComponentFraction( numPhases, numComps, numDofs ); + + auto componentProperties = m_fluid->createKernelWrapper(); + auto flashKernelWrapper = m_flash->createKernelWrapper(); + + flashKernelWrapper.compute( componentProperties, + pressure, + temperature, + composition.toSliceConst(), + kValues.toSlice(), + PhasePropSlice( phaseFraction, dPhaseFraction ), + PhaseCompSlice( phaseComponentFraction, dPhaseComponentFraction ) ); + + for( integer ip = 0; ip < numPhases; ip++ ) + { + checkRelativeError( phaseFraction[ip], expectedPhaseFraction[ip], relTol, absTol ); + for( integer i = 0; i < numTestComps; ++i ) + { + integer const ic = FluidData< numComps >::testComponents[i]; + checkRelativeError( phaseComponentFraction[ip][ic], expectedPhaseComponentFraction[ip][i], relTol, absTol ); + } + } + } + + void testFlashDerivatives( FlashData< NC > const & data ) + { + // Number of output values from each flash calculation + constexpr integer numValues = numPhases * (1 + numComps); + + real64 const pressure = std::get< 0 >( data ); + real64 const temperature = std::get< 1 >( data ); + stackArray1d< real64, numComps > composition; + TestFluid< NC >::createArray( composition, std::get< 2 >( data )); + + stackArray2d< real64, (numPhases-1)*numComps > kValues( numPhases-1, numComps ); + LvArray::forValuesInSlice( kValues.toSlice(), []( real64 & v ){ v = 0.0; } ); + + stackArray1d< real64, numPhases > phaseFraction( numPhases ); + stackArray2d< real64, numPhases *numDofs > dPhaseFraction( numPhases, numDofs ); + stackArray2d< real64, numPhases *numComps > phaseComponentFraction( numPhases, numComps ); + stackArray3d< real64, numPhases *numComps *numDofs > dPhaseComponentFraction( numPhases, numComps, numDofs ); + stackArray1d< real64, numValues > derivatives( numValues ); + + auto componentProperties = m_fluid->createKernelWrapper(); + auto flashKernelWrapper = m_flash->createKernelWrapper(); + + flashKernelWrapper.compute( componentProperties, + pressure, + temperature, + composition.toSliceConst(), + kValues.toSlice(), + PhasePropSlice( phaseFraction, dPhaseFraction ), + PhaseCompSlice( phaseComponentFraction, dPhaseComponentFraction ) ); + + // Combine derivatives into a single output + auto const concatDerivatives = []( integer const kc, auto & derivs, auto const & phaseFractionDerivs, auto const & phaseComponentFractionDerivs ){ + integer j = 0; + for( integer ip = 0; ip < numPhases; ++ip ) + { + derivs[j++] = phaseFractionDerivs( ip, kc ); + for( integer ic = 0; ic < numComps; ++ic ) + { + derivs[j++] = phaseComponentFractionDerivs( ip, ic, kc ); + } + } + }; + + auto const evaluateFlash = [&]( real64 const p, real64 const t, auto const & zmf, auto & values ){ + stackArray1d< real64, numPhases > displacedPhaseFraction( numPhases ); + stackArray2d< real64, numPhases *numDofs > displacedPhaseFractionDerivs( numPhases, numDofs ); + stackArray2d< real64, numPhases *numComps > displacedPhaseComponentFraction( numPhases, numComps ); + stackArray3d< real64, numPhases *numComps *numDofs > displacedPhaseComponentFractionDerivs( numPhases, numComps, numDofs ); + + flashKernelWrapper.compute( componentProperties, + p, + t, + zmf, + kValues.toSlice(), + PhasePropSlice( displacedPhaseFraction, displacedPhaseFractionDerivs ), + PhaseCompSlice( displacedPhaseComponentFraction, displacedPhaseComponentFractionDerivs ) ); + integer j = 0; + for( integer ip = 0; ip < numPhases; ++ip ) + { + values[j++] = displacedPhaseFraction[ip]; + for( integer ic = 0; ic < numComps; ++ic ) + { + values[j++] = displacedPhaseComponentFraction( ip, ic ); + } + } + }; + + // Test against numerically calculated values + // --- Pressure derivatives --- + concatDerivatives( Deriv::dP, derivatives, dPhaseFraction, dPhaseComponentFraction ); + real64 const dp = 1.0e-4 * pressure; + geos::testing::internal::testNumericalDerivative< numValues >( + pressure, dp, derivatives, + [&]( real64 const p, auto & values ) { + evaluateFlash( p, temperature, composition.toSliceConst(), values ); + } ); + + // -- Temperature derivative + concatDerivatives( Deriv::dT, derivatives, dPhaseFraction, dPhaseComponentFraction ); + real64 const dT = 1.0e-6 * temperature; + geos::testing::internal::testNumericalDerivative< numValues >( + temperature, dT, derivatives, + [&]( real64 const t, auto & values ) { + evaluateFlash( pressure, t, composition.toSliceConst(), values ); + } ); + // -- Composition derivatives derivative + real64 const dz = 1.0e-7; + for( integer const ic : FluidData< numComps >::testComponents ) + { + concatDerivatives( Deriv::dC+ic, derivatives, dPhaseFraction, dPhaseComponentFraction ); + geos::testing::internal::testNumericalDerivative< numValues >( + 0.0, dz, derivatives, + [&]( real64 const z, auto & values ) { + stackArray1d< real64, numComps > zmf( numComps ); + for( integer jc = 0; jc < numComps; ++jc ) + { + zmf[jc] = composition[jc]; + } + zmf[ic] += z; + evaluateFlash( pressure, temperature, zmf.toSliceConst(), values ); + } ); + } + } + +protected: + std::unique_ptr< TestFluid< NC > > m_fluid{}; + std::unique_ptr< ImmiscibleWaterFlashModel > m_flash{}; + std::unique_ptr< ModelParameters > m_parameters{}; +}; + +using ImmiscibleWaterFlashModel3 = ImmiscibleWaterFlashModelTestFixture< 3 >; +using ImmiscibleWaterFlashModel9 = ImmiscibleWaterFlashModelTestFixture< 9 >; + +TEST_P( ImmiscibleWaterFlashModel3, testFlash ) +{ + testFlash( GetParam() ); +} +TEST_P( ImmiscibleWaterFlashModel3, testFlashDerivatives ) +{ + testFlashDerivatives( GetParam() ); +} + +TEST_P( ImmiscibleWaterFlashModel9, testFlash ) +{ + testFlash( GetParam() ); +} +TEST_P( ImmiscibleWaterFlashModel9, testFlashDerivatives ) +{ + testFlashDerivatives( GetParam() ); +} + +//------------------------------------------------------------------------------- +// Data +//------------------------------------------------------------------------------- +/* UNCRUSTIFY-OFF */ + +INSTANTIATE_TEST_SUITE_P( + ImmiscibleWaterFlashModel, ImmiscibleWaterFlashModel3, + ::testing::Values( + FlashData<3>{1.0e+05, 293.15, {0.000000, 0.000000, 1.000000}, 0.000000, 0.000000, 1.000000, {0.500000, 0.500000, 0.000000}, {0.500000, 0.500000, 0.000000}, {0.000000, 0.000000, 1.000000}}, + FlashData<3>{1.0e+06, 293.15, {0.000000, 0.000000, 1.000000}, 0.000000, 0.000000, 1.000000, {0.500000, 0.500000, 0.000000}, {0.500000, 0.500000, 0.000000}, {0.000000, 0.000000, 1.000000}}, + FlashData<3>{1.0e+07, 293.15, {0.000000, 0.000000, 1.000000}, 0.000000, 0.000000, 1.000000, {0.500000, 0.500000, 0.000000}, {0.500000, 0.500000, 0.000000}, {0.000000, 0.000000, 1.000000}}, + FlashData<3>{1.0e+05, 313.15, {0.000000, 0.000000, 1.000000}, 0.000000, 0.000000, 1.000000, {0.500000, 0.500000, 0.000000}, {0.500000, 0.500000, 0.000000}, {0.000000, 0.000000, 1.000000}}, + FlashData<3>{1.0e+06, 313.15, {0.000000, 0.000000, 1.000000}, 0.000000, 0.000000, 1.000000, {0.500000, 0.500000, 0.000000}, {0.500000, 0.500000, 0.000000}, {0.000000, 0.000000, 1.000000}}, + FlashData<3>{1.0e+07, 313.15, {0.000000, 0.000000, 1.000000}, 0.000000, 0.000000, 1.000000, {0.500000, 0.500000, 0.000000}, {0.500000, 0.500000, 0.000000}, {0.000000, 0.000000, 1.000000}}, + FlashData<3>{1.0e+05, 353.15, {0.000000, 0.000000, 1.000000}, 0.000000, 0.000000, 1.000000, {0.500000, 0.500000, 0.000000}, {0.500000, 0.500000, 0.000000}, {0.000000, 0.000000, 1.000000}}, + FlashData<3>{1.0e+06, 353.15, {0.000000, 0.000000, 1.000000}, 0.000000, 0.000000, 1.000000, {0.500000, 0.500000, 0.000000}, {0.500000, 0.500000, 0.000000}, {0.000000, 0.000000, 1.000000}}, + FlashData<3>{1.0e+07, 353.15, {0.000000, 0.000000, 1.000000}, 0.000000, 0.000000, 1.000000, {0.500000, 0.500000, 0.000000}, {0.500000, 0.500000, 0.000000}, {0.000000, 0.000000, 1.000000}}, + FlashData<3>{1.0e+05, 293.15, {0.300000, 0.300000, 0.400000}, 0.300217, 0.299783, 0.400000, {0.000723, 0.999277, 0.000000}, {1.000000, 0.000000, 0.000000}, {0.000000, 0.000000, 1.000000}}, + FlashData<3>{1.0e+06, 293.15, {0.300000, 0.300000, 0.400000}, 0.302162, 0.297838, 0.400000, {0.007157, 0.992843, 0.000000}, {1.000000, 0.000000, 0.000000}, {0.000000, 0.000000, 1.000000}}, + FlashData<3>{1.0e+07, 293.15, {0.300000, 0.300000, 0.400000}, 0.320811, 0.279189, 0.400000, {0.064871, 0.935129, 0.000000}, {1.000000, 0.000000, 0.000000}, {0.000000, 0.000000, 1.000000}}, + FlashData<3>{1.0e+05, 313.15, {0.300000, 0.300000, 0.400000}, 0.300236, 0.299764, 0.400000, {0.000787, 0.999213, 0.000000}, {1.000000, 0.000000, 0.000000}, {0.000000, 0.000000, 1.000000}}, + FlashData<3>{1.0e+06, 313.15, {0.300000, 0.300000, 0.400000}, 0.302354, 0.297646, 0.400000, {0.007785, 0.992215, 0.000000}, {1.000000, 0.000000, 0.000000}, {0.000000, 0.000000, 1.000000}}, + FlashData<3>{1.0e+07, 313.15, {0.300000, 0.300000, 0.400000}, 0.322797, 0.277203, 0.400000, {0.070623, 0.929377, 0.000000}, {1.000000, 0.000000, 0.000000}, {0.000000, 0.000000, 1.000000}}, + FlashData<3>{1.0e+05, 353.15, {0.300000, 0.300000, 0.400000}, 0.300271, 0.299729, 0.400000, {0.000919, 0.999081, 0.000000}, {0.999982, 0.000018, 0.000000}, {0.000000, 0.000000, 1.000000}}, + FlashData<3>{1.0e+06, 353.15, {0.300000, 0.300000, 0.400000}, 0.302753, 0.297247, 0.400000, {0.009094, 0.990906, 0.000000}, {0.999998, 0.000002, 0.000000}, {0.000000, 0.000000, 1.000000}}, + FlashData<3>{1.0e+07, 353.15, {0.300000, 0.300000, 0.400000}, 0.326941, 0.273059, 0.400000, {0.082404, 0.917596, 0.000000}, {0.999999, 0.000001, 0.000000}, {0.000000, 0.000000, 1.000000}}, + FlashData<3>{1.0e+05, 293.15, {0.200000, 0.800000, 0.000000}, 0.800579, 0.199421, 0.000000, {0.000723, 0.999277, 0.000000}, {1.000000, 0.000000, 0.000000}, {0.000000, 0.000000, 1.000000}}, + FlashData<3>{1.0e+06, 293.15, {0.200000, 0.800000, 0.000000}, 0.805767, 0.194233, 0.000000, {0.007157, 0.992843, 0.000000}, {1.000000, 0.000000, 0.000000}, {0.000000, 0.000000, 1.000000}}, + FlashData<3>{1.0e+07, 293.15, {0.200000, 0.800000, 0.000000}, 0.855497, 0.144503, 0.000000, {0.064871, 0.935129, 0.000000}, {1.000000, 0.000000, 0.000000}, {0.000000, 0.000000, 1.000000}}, + FlashData<3>{1.0e+05, 313.15, {0.200000, 0.800000, 0.000000}, 0.800630, 0.199370, 0.000000, {0.000787, 0.999213, 0.000000}, {1.000000, 0.000000, 0.000000}, {0.000000, 0.000000, 1.000000}}, + FlashData<3>{1.0e+06, 313.15, {0.200000, 0.800000, 0.000000}, 0.806277, 0.193723, 0.000000, {0.007785, 0.992215, 0.000000}, {1.000000, 0.000000, 0.000000}, {0.000000, 0.000000, 1.000000}}, + FlashData<3>{1.0e+07, 313.15, {0.200000, 0.800000, 0.000000}, 0.860791, 0.139209, 0.000000, {0.070623, 0.929377, 0.000000}, {1.000000, 0.000000, 0.000000}, {0.000000, 0.000000, 1.000000}}, + FlashData<3>{1.0e+05, 353.15, {0.200000, 0.800000, 0.000000}, 0.800732, 0.199268, 0.000000, {0.000919, 0.999081, 0.000000}, {0.999982, 0.000018, 0.000000}, {0.000000, 0.000000, 1.000000}}, + FlashData<3>{1.0e+06, 353.15, {0.200000, 0.800000, 0.000000}, 0.807341, 0.192659, 0.000000, {0.009094, 0.990906, 0.000000}, {0.999998, 0.000002, 0.000000}, {0.000000, 0.000000, 1.000000}}, + FlashData<3>{1.0e+07, 353.15, {0.200000, 0.800000, 0.000000}, 0.871843, 0.128157, 0.000000, {0.082404, 0.917596, 0.000000}, {0.999999, 0.000001, 0.000000}, {0.000000, 0.000000, 1.000000}} + ) +); + +INSTANTIATE_TEST_SUITE_P( + ImmiscibleWaterFlashModel, ImmiscibleWaterFlashModel9, + ::testing::Values( + FlashData<9>{1.0e+06, 293.15, {0.009000, 0.003000, 0.534700, 0.114600, 0.087900, 0.045600, 0.020900, 0.015100, 0.169200}, 0.198828, 0.792172, 0.009000, {0.000000, 0.011551, 0.850986}, {0.000000, 0.672081, 0.000000}, {1.000000, 0.000000, 0.000000}}, + FlashData<9>{1.0e+07, 293.15, {0.009000, 0.003000, 0.534700, 0.114600, 0.087900, 0.045600, 0.020900, 0.015100, 0.169200}, 0.307007, 0.683993, 0.009000, {0.000000, 0.111647, 0.551128}, {0.000000, 0.731621, 0.000000}, {1.000000, 0.000000, 0.000000}}, + FlashData<9>{1.0e+08, 293.15, {0.009000, 0.003000, 0.534700, 0.114600, 0.087900, 0.045600, 0.020900, 0.015100, 0.169200}, 0.991000, 0.000000, 0.009000, {0.000000, 0.539556, 0.170737}, {0.000000, 0.539556, 0.170737}, {1.000000, 0.000000, 0.000000}}, + FlashData<9>{1.0e+06, 313.15, {0.009000, 0.003000, 0.534700, 0.114600, 0.087900, 0.045600, 0.020900, 0.015100, 0.169200}, 0.190493, 0.800507, 0.009000, {0.000000, 0.010985, 0.888223}, {0.000000, 0.665337, 0.000000}, {1.000000, 0.000000, 0.000000}}, + FlashData<9>{1.0e+07, 313.15, {0.009000, 0.003000, 0.534700, 0.114600, 0.087900, 0.045600, 0.020900, 0.015100, 0.169200}, 0.288620, 0.702380, 0.009000, {0.000000, 0.106713, 0.586237}, {0.000000, 0.717418, 0.000001}, {1.000000, 0.000000, 0.000000}}, + FlashData<9>{1.0e+08, 313.15, {0.009000, 0.003000, 0.534700, 0.114600, 0.087900, 0.045600, 0.020900, 0.015100, 0.169200}, 0.991000, 0.000000, 0.009000, {0.000000, 0.539556, 0.170737}, {0.000000, 0.539556, 0.170737}, {1.000000, 0.000000, 0.000000}}, + FlashData<9>{1.0e+06, 353.15, {0.009000, 0.003000, 0.534700, 0.114600, 0.087900, 0.045600, 0.020900, 0.015100, 0.169200}, 0.181787, 0.809213, 0.009000, {0.000000, 0.010453, 0.930750}, {0.000000, 0.658417, 0.000003}, {1.000000, 0.000000, 0.000000}}, + FlashData<9>{1.0e+07, 353.15, {0.009000, 0.003000, 0.534700, 0.114600, 0.087900, 0.045600, 0.020900, 0.015100, 0.169200}, 0.261660, 0.729340, 0.009000, {0.000000, 0.101277, 0.646622}, {0.000000, 0.696794, 0.000007}, {1.000000, 0.000000, 0.000000}}, + FlashData<9>{1.0e+08, 353.15, {0.009000, 0.003000, 0.534700, 0.114600, 0.087900, 0.045600, 0.020900, 0.015100, 0.169200}, 0.947424, 0.043576, 0.009000, {0.000000, 0.529993, 0.178339}, {0.000000, 0.747468, 0.005438}, {1.000000, 0.000000, 0.000000}}, + FlashData<9>{1.0e+06, 293.15, {0.400000, 0.001820, 0.323730, 0.069380, 0.053220, 0.027610, 0.012650, 0.009140, 0.102450}, 0.120388, 0.479612, 0.400000, {0.000000, 0.011551, 0.850996}, {0.000000, 0.672084, 0.000000}, {1.000000, 0.000000, 0.000000}}, + FlashData<9>{1.0e+07, 293.15, {0.400000, 0.001820, 0.323730, 0.069380, 0.053220, 0.027610, 0.012650, 0.009140, 0.102450}, 0.185888, 0.414112, 0.400000, {0.000000, 0.111648, 0.551139}, {0.000000, 0.731628, 0.000000}, {1.000000, 0.000000, 0.000000}}, + FlashData<9>{1.0e+08, 293.15, {0.400000, 0.001820, 0.323730, 0.069380, 0.053220, 0.027610, 0.012650, 0.009140, 0.102450}, 0.600000, 0.000000, 0.400000, {0.000000, 0.539550, 0.170750}, {0.000000, 0.539550, 0.170750}, {1.000000, 0.000000, 0.000000}}, + FlashData<9>{1.0e+06, 313.15, {0.400000, 0.001820, 0.323730, 0.069380, 0.053220, 0.027610, 0.012650, 0.009140, 0.102450}, 0.115342, 0.484658, 0.400000, {0.000000, 0.010985, 0.888229}, {0.000000, 0.665341, 0.000000}, {1.000000, 0.000000, 0.000000}}, + FlashData<9>{1.0e+07, 313.15, {0.400000, 0.001820, 0.323730, 0.069380, 0.053220, 0.027610, 0.012650, 0.009140, 0.102450}, 0.174755, 0.425245, 0.400000, {0.000000, 0.106714, 0.586247}, {0.000000, 0.717425, 0.000001}, {1.000000, 0.000000, 0.000000}}, + FlashData<9>{1.0e+08, 313.15, {0.400000, 0.001820, 0.323730, 0.069380, 0.053220, 0.027610, 0.012650, 0.009140, 0.102450}, 0.600000, 0.000000, 0.400000, {0.000000, 0.539550, 0.170750}, {0.000000, 0.539550, 0.170750}, {1.000000, 0.000000, 0.000000}}, + FlashData<9>{1.0e+06, 353.15, {0.400000, 0.001820, 0.323730, 0.069380, 0.053220, 0.027610, 0.012650, 0.009140, 0.102450}, 0.110071, 0.489929, 0.400000, {0.000000, 0.010453, 0.930753}, {0.000000, 0.658421, 0.000003}, {1.000000, 0.000000, 0.000000}}, + FlashData<9>{1.0e+07, 353.15, {0.400000, 0.001820, 0.323730, 0.069380, 0.053220, 0.027610, 0.012650, 0.009140, 0.102450}, 0.158432, 0.441568, 0.400000, {0.000000, 0.101278, 0.646630}, {0.000000, 0.696800, 0.000007}, {1.000000, 0.000000, 0.000000}}, + FlashData<9>{1.0e+08, 353.15, {0.400000, 0.001820, 0.323730, 0.069380, 0.053220, 0.027610, 0.012650, 0.009140, 0.102450}, 0.573644, 0.026356, 0.400000, {0.000000, 0.529997, 0.178345}, {0.000000, 0.747479, 0.005437}, {1.000000, 0.000000, 0.000000}}, + FlashData<9>{1.0e+06, 313.15, {1.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000}, 0.000000, 0.000000, 1.000000, {0.000000, 0.125000, 0.125000}, {0.000000, 0.125000, 0.125000}, {1.000000, 0.000000, 0.000000}}, + FlashData<9>{1.0e+08, 353.15, {1.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000}, 0.000000, 0.000000, 1.000000, {0.000000, 0.125000, 0.125000}, {0.000000, 0.125000, 0.125000}, {1.000000, 0.000000, 0.000000}} + ) +); + +/* UNCRUSTIFY-ON */ + +} // testing + +} // geos From ba4032bd0b6f46fc4c54bc94f974d894602ba7d6 Mon Sep 17 00:00:00 2001 From: dkachuma Date: Tue, 23 Jul 2024 00:04:34 -0500 Subject: [PATCH 2/8] Remove unwanted changes --- .../multifluid/compositional/CompositionalMultiphaseFluid.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/coreComponents/constitutive/fluid/multifluid/compositional/CompositionalMultiphaseFluid.cpp b/src/coreComponents/constitutive/fluid/multifluid/compositional/CompositionalMultiphaseFluid.cpp index a7ee0896835..c90f0fe9366 100644 --- a/src/coreComponents/constitutive/fluid/multifluid/compositional/CompositionalMultiphaseFluid.cpp +++ b/src/coreComponents/constitutive/fluid/multifluid/compositional/CompositionalMultiphaseFluid.cpp @@ -85,7 +85,7 @@ CompositionalMultiphaseFluid( string const & name, Group * const parent ) template< typename FLASH, typename PHASE1, typename PHASE2, typename PHASE3 > integer CompositionalMultiphaseFluid< FLASH, PHASE1, PHASE2, PHASE3 >::getWaterPhaseIndex() const { - string const expectedWaterPhaseNames[] = { "water", "wat", "aqueous" }; + string const expectedWaterPhaseNames[] = { "water" }; return PVTProps::PVTFunctionHelpers::findName( m_phaseNames, expectedWaterPhaseNames, viewKeyStruct::phaseNamesString() ); } From 19574abb53bb04d9ad8fa9111d57f8a8ed7493a2 Mon Sep 17 00:00:00 2001 From: dkachuma Date: Fri, 16 Aug 2024 09:46:10 -0500 Subject: [PATCH 3/8] Fix include file --- .../compositional/models/ImmiscibleWaterParameters.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/coreComponents/constitutive/fluid/multifluid/compositional/models/ImmiscibleWaterParameters.cpp b/src/coreComponents/constitutive/fluid/multifluid/compositional/models/ImmiscibleWaterParameters.cpp index 947a8037a89..ac8c8da3749 100644 --- a/src/coreComponents/constitutive/fluid/multifluid/compositional/models/ImmiscibleWaterParameters.cpp +++ b/src/coreComponents/constitutive/fluid/multifluid/compositional/models/ImmiscibleWaterParameters.cpp @@ -21,7 +21,7 @@ #include "ComponentProperties.hpp" #include "constitutive/fluid/multifluid/MultiFluidBase.hpp" #include "dataRepository/InputFlags.hpp" -#include "codingUtilities/StringUtilities.hpp" +#include "common/format/StringUtilities.hpp" namespace geos { From 29d3c13e27aa6fc199e49ff31528b941fd6691f1 Mon Sep 17 00:00:00 2001 From: dkachuma Date: Thu, 22 Aug 2024 14:08:38 -0500 Subject: [PATCH 4/8] Fix unit test --- .../functions/NegativeTwoPhaseFlash.hpp | 16 ++++---- .../models/ImmiscibleWaterFlashModel.hpp | 4 +- .../testImmiscibleWaterFlashModel.cpp | 40 +++++++++++++------ 3 files changed, 38 insertions(+), 22 deletions(-) diff --git a/src/coreComponents/constitutive/fluid/multifluid/compositional/functions/NegativeTwoPhaseFlash.hpp b/src/coreComponents/constitutive/fluid/multifluid/compositional/functions/NegativeTwoPhaseFlash.hpp index 96b2bdf5de4..3134d96a724 100644 --- a/src/coreComponents/constitutive/fluid/multifluid/compositional/functions/NegativeTwoPhaseFlash.hpp +++ b/src/coreComponents/constitutive/fluid/multifluid/compositional/functions/NegativeTwoPhaseFlash.hpp @@ -174,7 +174,7 @@ struct NegativeTwoPhaseFlash * @param[out] fugacityRatios the fugacity rations * @return The error */ - template< integer USD > + template< integer USD1, integer USD2 > GEOS_HOST_DEVICE static real64 computeFugacityRatio( integer const numComps, @@ -184,11 +184,11 @@ struct NegativeTwoPhaseFlash ComponentProperties::KernelWrapper const & componentProperties, EquationOfStateType const liquidEos, EquationOfStateType const vapourEos, - arraySlice1d< real64 const, USD > const & kValues, + arraySlice1d< real64 const, USD1 > const & kValues, arraySlice1d< integer const > const & presentComponents, real64 & vapourPhaseMoleFraction, - arraySlice1d< real64, USD > const & liquidComposition, - arraySlice1d< real64, USD > const & vapourComposition, + arraySlice1d< real64, USD2 > const & liquidComposition, + arraySlice1d< real64, USD2 > const & vapourComposition, arraySlice1d< real64 > const & logLiquidFugacity, arraySlice1d< real64 > const & logVapourFugacity, arraySlice1d< real64 > const & fugacityRatios ); @@ -512,7 +512,7 @@ void NegativeTwoPhaseFlash::computeDerivatives( } } -template< integer USD > +template< integer USD1, integer USD2 > GEOS_HOST_DEVICE real64 NegativeTwoPhaseFlash::computeFugacityRatio( integer const numComps, @@ -522,11 +522,11 @@ real64 NegativeTwoPhaseFlash::computeFugacityRatio( ComponentProperties::KernelWrapper const & componentProperties, EquationOfStateType const liquidEos, EquationOfStateType const vapourEos, - arraySlice1d< real64 const, USD > const & kValues, + arraySlice1d< real64 const, USD1 > const & kValues, arraySlice1d< integer const > const & presentComponents, real64 & vapourPhaseMoleFraction, - arraySlice1d< real64, USD > const & liquidComposition, - arraySlice1d< real64, USD > const & vapourComposition, + arraySlice1d< real64, USD2 > const & liquidComposition, + arraySlice1d< real64, USD2 > const & vapourComposition, arraySlice1d< real64 > const & logLiquidFugacity, arraySlice1d< real64 > const & logVapourFugacity, arraySlice1d< real64 > const & fugacityRatios ) diff --git a/src/coreComponents/constitutive/fluid/multifluid/compositional/models/ImmiscibleWaterFlashModel.hpp b/src/coreComponents/constitutive/fluid/multifluid/compositional/models/ImmiscibleWaterFlashModel.hpp index c1c7cc43886..42c8c18706b 100644 --- a/src/coreComponents/constitutive/fluid/multifluid/compositional/models/ImmiscibleWaterFlashModel.hpp +++ b/src/coreComponents/constitutive/fluid/multifluid/compositional/models/ImmiscibleWaterFlashModel.hpp @@ -44,8 +44,8 @@ class ImmiscibleWaterFlashModelUpdate final : public FunctionBaseUpdate static constexpr integer maxNumComps = MultiFluidConstants::MAX_NUM_COMPONENTS; public: - using PhaseProp = MultiFluidVar< real64, 3, multifluid::LAYOUT_PHASE, multifluid::LAYOUT_PHASE_DC >; - using PhaseComp = MultiFluidVar< real64, 4, multifluid::LAYOUT_PHASE_COMP, multifluid::LAYOUT_PHASE_COMP_DC >; + using PhaseProp = NegativeTwoPhaseFlashModelUpdate::PhaseProp; + using PhaseComp = NegativeTwoPhaseFlashModelUpdate::PhaseComp; using Deriv = multifluid::DerivativeOffset; ImmiscibleWaterFlashModelUpdate( integer const numComponents, diff --git a/src/coreComponents/constitutive/unitTests/testImmiscibleWaterFlashModel.cpp b/src/coreComponents/constitutive/unitTests/testImmiscibleWaterFlashModel.cpp index 32378ad6ce4..f4a72c7cdee 100644 --- a/src/coreComponents/constitutive/unitTests/testImmiscibleWaterFlashModel.cpp +++ b/src/coreComponents/constitutive/unitTests/testImmiscibleWaterFlashModel.cpp @@ -120,10 +120,15 @@ class ImmiscibleWaterFlashModelTestFixture : public ::testing::TestWithParam< F stackArray2d< real64, (numPhases-1)*numComps > kValues( numPhases-1, numComps ); LvArray::forValuesInSlice( kValues.toSlice(), []( real64 & v ){ v = 0.0; } ); - stackArray1d< real64, numPhases > phaseFraction( numPhases ); - stackArray2d< real64, numPhases *numDofs > dPhaseFraction( numPhases, numDofs ); - stackArray2d< real64, numPhases *numComps > phaseComponentFraction( numPhases, numComps ); - stackArray3d< real64, numPhases *numComps *numDofs > dPhaseComponentFraction( numPhases, numComps, numDofs ); + StackArray< real64, 3, numPhases, multifluid::LAYOUT_PHASE > phaseFractionData( 1, 1, numPhases ); + StackArray< real64, 4, numPhases *numDofs, multifluid::LAYOUT_PHASE_DC > dPhaseFractionData( 1, 1, numPhases, numDofs ); + StackArray< real64, 4, numPhases *numComps, multifluid::LAYOUT_PHASE_COMP > phaseComponentFractionData( 1, 1, numPhases, numComps ); + StackArray< real64, 5, numPhases *numComps *numDofs, multifluid::LAYOUT_PHASE_COMP_DC > dPhaseComponentFractionData( 1, 1, numPhases, numComps, numDofs ); + + auto phaseFraction = phaseFractionData[0][0]; + auto dPhaseFraction = dPhaseFractionData[0][0]; + auto phaseComponentFraction = phaseComponentFractionData[0][0]; + auto dPhaseComponentFraction = dPhaseComponentFractionData[0][0]; auto componentProperties = m_fluid->createKernelWrapper(); auto flashKernelWrapper = m_flash->createKernelWrapper(); @@ -160,10 +165,16 @@ class ImmiscibleWaterFlashModelTestFixture : public ::testing::TestWithParam< F stackArray2d< real64, (numPhases-1)*numComps > kValues( numPhases-1, numComps ); LvArray::forValuesInSlice( kValues.toSlice(), []( real64 & v ){ v = 0.0; } ); - stackArray1d< real64, numPhases > phaseFraction( numPhases ); - stackArray2d< real64, numPhases *numDofs > dPhaseFraction( numPhases, numDofs ); - stackArray2d< real64, numPhases *numComps > phaseComponentFraction( numPhases, numComps ); - stackArray3d< real64, numPhases *numComps *numDofs > dPhaseComponentFraction( numPhases, numComps, numDofs ); + StackArray< real64, 3, numPhases, multifluid::LAYOUT_PHASE > phaseFractionData( 1, 1, numPhases ); + StackArray< real64, 4, numPhases *numDofs, multifluid::LAYOUT_PHASE_DC > dPhaseFractionData( 1, 1, numPhases, numDofs ); + StackArray< real64, 4, numPhases *numComps, multifluid::LAYOUT_PHASE_COMP > phaseComponentFractionData( 1, 1, numPhases, numComps ); + StackArray< real64, 5, numPhases *numComps *numDofs, multifluid::LAYOUT_PHASE_COMP_DC > dPhaseComponentFractionData( 1, 1, numPhases, numComps, numDofs ); + + auto phaseFraction = phaseFractionData[0][0]; + auto dPhaseFraction = dPhaseFractionData[0][0]; + auto phaseComponentFraction = phaseComponentFractionData[0][0]; + auto dPhaseComponentFraction = dPhaseComponentFractionData[0][0]; + stackArray1d< real64, numValues > derivatives( numValues ); auto componentProperties = m_fluid->createKernelWrapper(); @@ -191,10 +202,15 @@ class ImmiscibleWaterFlashModelTestFixture : public ::testing::TestWithParam< F }; auto const evaluateFlash = [&]( real64 const p, real64 const t, auto const & zmf, auto & values ){ - stackArray1d< real64, numPhases > displacedPhaseFraction( numPhases ); - stackArray2d< real64, numPhases *numDofs > displacedPhaseFractionDerivs( numPhases, numDofs ); - stackArray2d< real64, numPhases *numComps > displacedPhaseComponentFraction( numPhases, numComps ); - stackArray3d< real64, numPhases *numComps *numDofs > displacedPhaseComponentFractionDerivs( numPhases, numComps, numDofs ); + StackArray< real64, 3, numPhases, multifluid::LAYOUT_PHASE > displacedPhaseFractionData( 1, 1, numPhases ); + StackArray< real64, 4, numPhases *numDofs, multifluid::LAYOUT_PHASE_DC > displacedPhaseFractionDerivsData( 1, 1, numPhases, numDofs ); + StackArray< real64, 4, numPhases *numComps, multifluid::LAYOUT_PHASE_COMP > displacedPhaseComponentFractionData( 1, 1, numPhases, numComps ); + StackArray< real64, 5, numPhases *numComps *numDofs, multifluid::LAYOUT_PHASE_COMP_DC > displacedPhaseComponentFractionDerivsData( 1, 1, numPhases, numComps, numDofs ); + + auto displacedPhaseFraction = displacedPhaseFractionData[0][0]; + auto displacedPhaseFractionDerivs = displacedPhaseFractionDerivsData[0][0]; + auto displacedPhaseComponentFraction = displacedPhaseComponentFractionData[0][0]; + auto displacedPhaseComponentFractionDerivs = displacedPhaseComponentFractionDerivsData[0][0]; flashKernelWrapper.compute( componentProperties, p, From 97d0ef10bd485482d81acf3f78b1c179cbf2ed33 Mon Sep 17 00:00:00 2001 From: dkachuma Date: Mon, 26 Aug 2024 14:37:54 -0500 Subject: [PATCH 5/8] Resolve conflicts --- .../compositional/models/ImmiscibleWaterFlashModel.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/coreComponents/constitutive/fluid/multifluid/compositional/models/ImmiscibleWaterFlashModel.cpp b/src/coreComponents/constitutive/fluid/multifluid/compositional/models/ImmiscibleWaterFlashModel.cpp index 007924f41a4..9ffa7d2f418 100644 --- a/src/coreComponents/constitutive/fluid/multifluid/compositional/models/ImmiscibleWaterFlashModel.cpp +++ b/src/coreComponents/constitutive/fluid/multifluid/compositional/models/ImmiscibleWaterFlashModel.cpp @@ -80,15 +80,14 @@ ImmiscibleWaterFlashModelUpdate::ImmiscibleWaterFlashModelUpdate( liquidIndex, vapourIndex, liquidEos, - vapourEos ), + vapourEos, + componentCriticalVolume ), m_numComponents( numComponents ), m_liquidIndex( liquidIndex ), m_vapourIndex( vapourIndex ), m_aquoesIndex( aqueousIndex ), m_waterComponentIndex( waterComponentIndex ) -{ - GEOS_UNUSED_VAR( componentCriticalVolume ); -} +{} std::unique_ptr< ModelParameters > ImmiscibleWaterFlashModel::createParameters( std::unique_ptr< ModelParameters > parameters ) From 86bb1d6e49882cef5171e458ae4c91c08ca29420 Mon Sep 17 00:00:00 2001 From: dkachuma Date: Tue, 27 Aug 2024 11:12:41 -0500 Subject: [PATCH 6/8] Fix unit test --- .../unitTests/testImmiscibleWaterFlashModel.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/coreComponents/constitutive/unitTests/testImmiscibleWaterFlashModel.cpp b/src/coreComponents/constitutive/unitTests/testImmiscibleWaterFlashModel.cpp index f4a72c7cdee..a5597d89959 100644 --- a/src/coreComponents/constitutive/unitTests/testImmiscibleWaterFlashModel.cpp +++ b/src/coreComponents/constitutive/unitTests/testImmiscibleWaterFlashModel.cpp @@ -248,6 +248,7 @@ class ImmiscibleWaterFlashModelTestFixture : public ::testing::TestWithParam< F [&]( real64 const t, auto & values ) { evaluateFlash( pressure, t, composition.toSliceConst(), values ); } ); + // -- Composition derivatives derivative real64 const dz = 1.0e-7; for( integer const ic : FluidData< numComps >::testComponents ) @@ -261,7 +262,10 @@ class ImmiscibleWaterFlashModelTestFixture : public ::testing::TestWithParam< F { zmf[jc] = composition[jc]; } - zmf[ic] += z; + if( -z < zmf[ic] ) + { + zmf[ic] += z; + } evaluateFlash( pressure, temperature, zmf.toSliceConst(), values ); } ); } From fa2aff165c795433e0e90aecf858f29452099e25 Mon Sep 17 00:00:00 2001 From: dkachuma Date: Tue, 27 Aug 2024 12:13:42 -0500 Subject: [PATCH 7/8] Fix unit test --- .../unitTests/testImmiscibleWaterFlashModel.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/coreComponents/constitutive/unitTests/testImmiscibleWaterFlashModel.cpp b/src/coreComponents/constitutive/unitTests/testImmiscibleWaterFlashModel.cpp index a5597d89959..e9da727ec8a 100644 --- a/src/coreComponents/constitutive/unitTests/testImmiscibleWaterFlashModel.cpp +++ b/src/coreComponents/constitutive/unitTests/testImmiscibleWaterFlashModel.cpp @@ -250,9 +250,19 @@ class ImmiscibleWaterFlashModelTestFixture : public ::testing::TestWithParam< F } ); // -- Composition derivatives derivative - real64 const dz = 1.0e-7; + real64 const dz = 1.0e-12; for( integer const ic : FluidData< numComps >::testComponents ) { + real64 sumZ = 0.0; + for( integer jc = 0; jc < numComps; ++jc ) + { + sumZ += composition[jc]; + } + sumZ -= composition[ic]; + if( sumZ < absTol ) + { + continue; + } concatDerivatives( Deriv::dC+ic, derivatives, dPhaseFraction, dPhaseComponentFraction ); geos::testing::internal::testNumericalDerivative< numValues >( 0.0, dz, derivatives, @@ -262,10 +272,7 @@ class ImmiscibleWaterFlashModelTestFixture : public ::testing::TestWithParam< F { zmf[jc] = composition[jc]; } - if( -z < zmf[ic] ) - { - zmf[ic] += z; - } + zmf[ic] += z; evaluateFlash( pressure, temperature, zmf.toSliceConst(), values ); } ); } From 5094fc9bb6b31439adb24428b99532c3a593aaa8 Mon Sep 17 00:00:00 2001 From: dkachuma Date: Tue, 27 Aug 2024 13:02:31 -0500 Subject: [PATCH 8/8] Fix unit test --- .../constitutive/unitTests/testImmiscibleWaterFlashModel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/coreComponents/constitutive/unitTests/testImmiscibleWaterFlashModel.cpp b/src/coreComponents/constitutive/unitTests/testImmiscibleWaterFlashModel.cpp index e9da727ec8a..7149906eb24 100644 --- a/src/coreComponents/constitutive/unitTests/testImmiscibleWaterFlashModel.cpp +++ b/src/coreComponents/constitutive/unitTests/testImmiscibleWaterFlashModel.cpp @@ -250,7 +250,7 @@ class ImmiscibleWaterFlashModelTestFixture : public ::testing::TestWithParam< F } ); // -- Composition derivatives derivative - real64 const dz = 1.0e-12; + real64 const dz = 1.0e-7; for( integer const ic : FluidData< numComps >::testComponents ) { real64 sumZ = 0.0;