diff --git a/.integrated_tests.yaml b/.integrated_tests.yaml index 89ea94460e..faf2510c6d 100644 --- a/.integrated_tests.yaml +++ b/.integrated_tests.yaml @@ -1,6 +1,6 @@ baselines: bucket: geosx - baseline: integratedTests/baseline_integratedTests-pr3194-6060-e5ba0ce + baseline: integratedTests/baseline_integratedTests-pr3213-6170-5c2c0bf allow_fail: all: '' diff --git a/BASELINE_NOTES.md b/BASELINE_NOTES.md index f2b0f19dec..311eef501c 100644 --- a/BASELINE_NOTES.md +++ b/BASELINE_NOTES.md @@ -6,6 +6,11 @@ This file is designed to track changes to the integrated test baselines. Any developer who updates the baseline ID in the .integrated_tests.yaml file is expected to create an entry in this file with the pull request number, date, and their justification for rebaselining. These notes should be in reverse-chronological order, and use the following time format: (YYYY-MM-DD). +PR #3213 (2024-07-12) +====================== +Added baselines for new tests on Dirichlet boundary conditions for multiphase flow. + + PR #3194 (2024-07-10) ====================== Use aperture table in poromechanics with conforming fractures. Rebaseline the corresponding cases. diff --git a/inputFiles/compositionalMultiphaseFlow/co2_flux_dirichlet.xml b/inputFiles/compositionalMultiphaseFlow/co2_flux_dirichlet.xml new file mode 100644 index 0000000000..00f64a5bab --- /dev/null +++ b/inputFiles/compositionalMultiphaseFlow/co2_flux_dirichlet.xml @@ -0,0 +1,227 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/inputFiles/compositionalMultiphaseFlow/compositionalMultiphaseFlow.ats b/inputFiles/compositionalMultiphaseFlow/compositionalMultiphaseFlow.ats index 319422346c..39689e8798 100644 --- a/inputFiles/compositionalMultiphaseFlow/compositionalMultiphaseFlow.ats +++ b/inputFiles/compositionalMultiphaseFlow/compositionalMultiphaseFlow.ats @@ -93,6 +93,14 @@ decks = [ restart_step=10, check_step=20, restartcheck_params=RestartcheckParameters(**restartcheck_params)), + TestDeck( + name="co2_flux_dirichlet", + description= + "Compositional co2-brine flow test (2D co2 injection, 2-phase co2-brine, Table 2-phase relperm curves, Dirichlet boundary)", + partitions=((1, 1, 1), (2, 1, 3)), + restart_step=23, + check_step=46, + restartcheck_params=RestartcheckParameters(**restartcheck_params)), TestDeck( name="deadoil_3ph_staircase_obl_3d", description= diff --git a/src/coreComponents/common/TypeDispatch.hpp b/src/coreComponents/common/TypeDispatch.hpp index 0a845210a2..0d4f1a8d76 100644 --- a/src/coreComponents/common/TypeDispatch.hpp +++ b/src/coreComponents/common/TypeDispatch.hpp @@ -154,6 +154,12 @@ using Increment = typename IncrementImpl< T, N >::type; } // namespace internal +/** + * @brief Generate a sequence of integers from @p Begin up to (and including) @p End. + */ +template< integer Begin, integer End > +using IntegerSequence = internal::Increment< camp::make_idx_seq_t< End - Begin + 1 >, Begin >; + /** * @brief Construct a list of types. */ @@ -190,10 +196,10 @@ using IntegralTypes = TypeList< integer, localIndex, globalIndex >; using RealTypes = TypeList< real32, real64 >; /** - * @brief Generate a list of types representing array dimensionalities from M up to (and including) @p N. + * @brief Generate a list of types representing array dimensionalities from @p M up to (and including) @p N. */ template< int M, int N > -using DimsRange = camp::as_list< internal::Increment< camp::make_idx_seq_t< N - M + 1 >, M > >; +using DimsRange = camp::as_list< IntegerSequence< M, N > >; /** * @brief Generate a list of types representing array dimensionality exactly @p N. diff --git a/src/coreComponents/constitutive/fluid/multifluid/CO2Brine/CO2BrineFluid.cpp b/src/coreComponents/constitutive/fluid/multifluid/CO2Brine/CO2BrineFluid.cpp index 9267c9a330..67454b13c5 100644 --- a/src/coreComponents/constitutive/fluid/multifluid/CO2Brine/CO2BrineFluid.cpp +++ b/src/coreComponents/constitutive/fluid/multifluid/CO2Brine/CO2BrineFluid.cpp @@ -115,14 +115,6 @@ 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() && - PHASE2::Enthalpy::catalogName() != PVTProps::NoOpPVTFunction::catalogName() ); -} - - template< typename PHASE1, typename PHASE2, typename FLASH > std::unique_ptr< ConstitutiveBase > CO2BrineFluid< PHASE1, PHASE2, FLASH >:: diff --git a/src/coreComponents/constitutive/fluid/multifluid/CO2Brine/CO2BrineFluid.hpp b/src/coreComponents/constitutive/fluid/multifluid/CO2Brine/CO2BrineFluid.hpp index 968adbf775..2eec3526e9 100644 --- a/src/coreComponents/constitutive/fluid/multifluid/CO2Brine/CO2BrineFluid.hpp +++ b/src/coreComponents/constitutive/fluid/multifluid/CO2Brine/CO2BrineFluid.hpp @@ -63,7 +63,19 @@ class CO2BrineFluid : public MultiFluidBase virtual string getCatalogName() const override { return catalogName(); } - virtual bool isThermal() const override; + static constexpr bool isThermalType() + { + return !( std::is_same_v< typename PHASE1::Enthalpy, PVTProps::NoOpPVTFunction > || + std::is_same_v< typename PHASE2::Enthalpy, PVTProps::NoOpPVTFunction > ); + } + + static constexpr integer min_n_components = 2; + static constexpr integer max_n_components = 2; + + virtual bool isThermal() const override + { + return isThermalType(); + } /** * @brief Kernel wrapper class for CO2BrineFluid. diff --git a/src/coreComponents/constitutive/fluid/multifluid/MultiFluidBase.hpp b/src/coreComponents/constitutive/fluid/multifluid/MultiFluidBase.hpp index 2e570e58da..825fac729a 100644 --- a/src/coreComponents/constitutive/fluid/multifluid/MultiFluidBase.hpp +++ b/src/coreComponents/constitutive/fluid/multifluid/MultiFluidBase.hpp @@ -57,6 +57,20 @@ class MultiFluidBase : public ConstitutiveBase */ static constexpr integer MAX_NUM_PHASES = MultiFluidConstants::MAX_NUM_PHASES; + /** + * @brief Minimum supported number of fluid components (species) for dispatch + * @note This is the mininum number of components that can be used for dispatch in a kernel launch specific for + * this fluid type. + */ + static constexpr integer min_n_components = 2; + + /** + * @brief Maximum supported number of fluid components (species) for dispatch + * @note This is the maxinum number of components that can be used for dispatch in a kernel launch specific for + * this fluid type. + */ + static constexpr integer max_n_components = 5; + /** * @return number of fluid components (species) in the model */ diff --git a/src/coreComponents/constitutive/fluid/multifluid/MultiFluidSelector.hpp b/src/coreComponents/constitutive/fluid/multifluid/MultiFluidSelector.hpp index 9934a77c5c..470720f361 100644 --- a/src/coreComponents/constitutive/fluid/multifluid/MultiFluidSelector.hpp +++ b/src/coreComponents/constitutive/fluid/multifluid/MultiFluidSelector.hpp @@ -24,7 +24,7 @@ #include "constitutive/fluid/multifluid/blackOil/BlackOilFluid.hpp" #include "constitutive/fluid/multifluid/CO2Brine/CO2BrineFluid.hpp" -#include "common/GeosxConfig.hpp" +#include "common/TypeDispatch.hpp" #ifdef GEOS_USE_PVTPackage #include "constitutive/fluid/multifluid/compositional/CompositionalMultiphaseFluidPVTPackage.hpp" #endif @@ -80,6 +80,64 @@ void constitutiveUpdatePassThru( MultiFluidBase & fluid, >::execute( fluid, std::forward< LAMBDA >( lambda ) ); } +namespace detail +{ +/** + * @brief Structure to execute a lambda on a fluid model depending on the number of components + * @tparam COMPONENT_LIST Type listing the components to expand over + */ +template< typename COMPONENT_LIST > +struct ComponentSelector; + +template< camp::idx_t ... Is > +struct ComponentSelector< camp::idx_seq< Is ... > > +{ + template< typename FluidType, typename LAMBDA > + static void execute( int numComps, FluidType & fluid, LAMBDA && lambda ) + { +// With gcc8, the fold expression below issues a spurious warning +// warning: suggest parentheses around '&&' within '||' [-Wparentheses] +// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94505 +#if (defined(__GNUC__) && (__GNUC__ < 10)) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wparentheses" +#endif + + bool const supported = ( ((numComps == Is) && (lambda( fluid, std::integral_constant< integer, Is >() ), true)) || ...); + +#if (defined(__GNUC__) && (__GNUC__ < 10)) +#pragma GCC diagnostic pop +#endif + GEOS_THROW_IF( !supported, + "Unsupported number of components: " << numComps << " for fluid " << FluidType::catalogName(), + InputError ); + } +}; + +} + +template< bool THERMAL = false, typename LAMBDA = NoOpFunc > +void constitutiveComponentUpdatePassThru( MultiFluidBase & fluidBase, + integer const numComps, + LAMBDA && lambda ) +{ + constitutiveUpdatePassThru( fluidBase, [&]( auto & fluid ) + { + using FluidType = TYPEOFREF( fluid ); + static_assert( FluidType::min_n_components <= FluidType::max_n_components ); + using Components = typename types::IntegerSequence< FluidType::min_n_components, FluidType::max_n_components >::type; + if constexpr (!THERMAL || FluidType::isThermalType()) + { + detail::ComponentSelector< Components >::execute( numComps, fluid, std::forward< LAMBDA >( lambda )); + } + else + { + GEOS_THROW( "Unsupported thermal call for fluid " << FluidType::catalogName(), + InputError ); + } + } ); +} + } // namespace constitutive } // namespace geos diff --git a/src/coreComponents/constitutive/fluid/multifluid/blackOil/BlackOilFluid.hpp b/src/coreComponents/constitutive/fluid/multifluid/blackOil/BlackOilFluid.hpp index 0527fe51d7..29ff379ea4 100644 --- a/src/coreComponents/constitutive/fluid/multifluid/blackOil/BlackOilFluid.hpp +++ b/src/coreComponents/constitutive/fluid/multifluid/blackOil/BlackOilFluid.hpp @@ -52,6 +52,11 @@ class BlackOilFluid : public BlackOilFluidBase virtual string getCatalogName() const override { return catalogName(); } + static constexpr bool isThermalType(){ return false; } + + static constexpr integer min_n_components = 3; + static constexpr integer max_n_components = 3; + /** * @brief Kernel wrapper class for BlackOilFluid * This kernel can be called on the GPU diff --git a/src/coreComponents/constitutive/fluid/multifluid/blackOil/BlackOilFluidBase.cpp b/src/coreComponents/constitutive/fluid/multifluid/blackOil/BlackOilFluidBase.cpp index 39b44a8112..e31fa7bb33 100644 --- a/src/coreComponents/constitutive/fluid/multifluid/blackOil/BlackOilFluidBase.cpp +++ b/src/coreComponents/constitutive/fluid/multifluid/blackOil/BlackOilFluidBase.cpp @@ -187,6 +187,13 @@ void BlackOilFluidBase::postInputInitialization() m_phaseOrder[m_phaseTypes[ip]] = ip; } + // Number of components should be at least equal to number of phases + GEOS_THROW_IF_LT_MSG( numFluidComponents(), numFluidPhases(), + GEOS_FMT( "{}: {} number of components ({}) must be at least number of phases ({})", + getFullName(), viewKeyStruct::componentNamesString(), + numFluidComponents(), numFluidPhases() ), + InputError ); + auto const checkInputSize = [&]( auto const & array, auto const & attribute ) { GEOS_THROW_IF_NE_MSG( array.size(), m_phaseNames.size(), diff --git a/src/coreComponents/constitutive/fluid/multifluid/blackOil/DeadOilFluid.cpp b/src/coreComponents/constitutive/fluid/multifluid/blackOil/DeadOilFluid.cpp index 6739765da1..390e756f5f 100644 --- a/src/coreComponents/constitutive/fluid/multifluid/blackOil/DeadOilFluid.cpp +++ b/src/coreComponents/constitutive/fluid/multifluid/blackOil/DeadOilFluid.cpp @@ -33,6 +33,16 @@ DeadOilFluid::DeadOilFluid( string const & name, BlackOilFluidBase( name, parent ) {} +void DeadOilFluid::postInputInitialization() +{ + BlackOilFluidBase::postInputInitialization(); + + integer const numComps = numFluidComponents(); + GEOS_THROW_IF( numComps != 2 && numComps != 3, + GEOS_FMT( "{}: this model only supports 2 or 3 components", getFullName() ), + InputError ); +} + void DeadOilFluid::readInputDataFromPVTFiles() { GEOS_THROW_IF_NE_MSG( m_tableFiles.size(), numFluidPhases(), diff --git a/src/coreComponents/constitutive/fluid/multifluid/blackOil/DeadOilFluid.hpp b/src/coreComponents/constitutive/fluid/multifluid/blackOil/DeadOilFluid.hpp index 9982eed41a..361f15aa34 100644 --- a/src/coreComponents/constitutive/fluid/multifluid/blackOil/DeadOilFluid.hpp +++ b/src/coreComponents/constitutive/fluid/multifluid/blackOil/DeadOilFluid.hpp @@ -38,6 +38,11 @@ class DeadOilFluid : public BlackOilFluidBase virtual string getCatalogName() const override { return catalogName(); } + static constexpr bool isThermalType(){ return false; } + + static constexpr integer min_n_components = 2; + static constexpr integer max_n_components = 3; + /** * @brief Kernel wrapper class for DeadOilFluid * This kernel can be called on the GPU @@ -131,6 +136,10 @@ class DeadOilFluid : public BlackOilFluidBase */ KernelWrapper createKernelWrapper(); +protected: + + virtual void postInputInitialization() override; + private: /** diff --git a/src/coreComponents/constitutive/fluid/multifluid/compositional/CompositionalMultiphaseFluid.hpp b/src/coreComponents/constitutive/fluid/multifluid/compositional/CompositionalMultiphaseFluid.hpp index 9646ba94ad..5e37c4ab47 100644 --- a/src/coreComponents/constitutive/fluid/multifluid/compositional/CompositionalMultiphaseFluid.hpp +++ b/src/coreComponents/constitutive/fluid/multifluid/compositional/CompositionalMultiphaseFluid.hpp @@ -68,6 +68,8 @@ class CompositionalMultiphaseFluid : public MultiFluidBase virtual string getCatalogName() const override { return catalogName(); } + static constexpr bool isThermalType(){ return false; } + // TODO: This method should be implemented if an incorrect extrapolation of the pressure and temperature is encountered in the kernel /** * @copydoc MultiFluidBase::checkTablesParameters( real64 pressure, real64 temperature ) diff --git a/src/coreComponents/constitutive/fluid/multifluid/compositional/CompositionalMultiphaseFluidPVTPackage.hpp b/src/coreComponents/constitutive/fluid/multifluid/compositional/CompositionalMultiphaseFluidPVTPackage.hpp index f520611604..85bb218a6f 100644 --- a/src/coreComponents/constitutive/fluid/multifluid/compositional/CompositionalMultiphaseFluidPVTPackage.hpp +++ b/src/coreComponents/constitutive/fluid/multifluid/compositional/CompositionalMultiphaseFluidPVTPackage.hpp @@ -46,6 +46,8 @@ class CompositionalMultiphaseFluidPVTPackage : public MultiFluidBase virtual string getCatalogName() const override { return catalogName(); } + static constexpr bool isThermalType(){ return false; } + // TODO: This method should be implemented if an incorrect extrapolation of the pressure and temperature is encountered in the kernel /** * @copydoc MultiFluidBase::checkTablesParameters( real64 pressure, real64 temperature ) diff --git a/src/coreComponents/constitutive/unitTests/CMakeLists.txt b/src/coreComponents/constitutive/unitTests/CMakeLists.txt index 09f808eeb2..a4d541ee37 100644 --- a/src/coreComponents/constitutive/unitTests/CMakeLists.txt +++ b/src/coreComponents/constitutive/unitTests/CMakeLists.txt @@ -9,6 +9,7 @@ set( gtest_geosx_tests testKValueInitialization.cpp testLohrenzBrayClarkViscosity.cpp testModifiedCamClay.cpp + testMultiFluidSelector.cpp testNegativeTwoPhaseFlash.cpp testNegativeTwoPhaseFlash9Comp.cpp testParticleFluidEnums.cpp diff --git a/src/coreComponents/constitutive/unitTests/testMultiFluidSelector.cpp b/src/coreComponents/constitutive/unitTests/testMultiFluidSelector.cpp new file mode 100644 index 0000000000..12d05d769b --- /dev/null +++ b/src/coreComponents/constitutive/unitTests/testMultiFluidSelector.cpp @@ -0,0 +1,158 @@ +/* + * ------------------------------------------------------------------------------------------------------------ + * SPDX-License-Identifier: LGPL-2.1-only + * + * Copyright (c) 2018-2020 Lawrence Livermore National Security LLC + * Copyright (c) 2018-2020 The Board of Trustees of the Leland Stanford Junior University + * Copyright (c) 2018-2020 TotalEnergies + * Copyright (c) 2019- 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/MultiFluidSelector.hpp" + +using namespace geos; +using namespace geos::testing; +using namespace geos::constitutive; + +template< typename FluidType > +class MultiFluidSelectorTest : public ::testing::Test +{ +public: + MultiFluidSelectorTest(): + m_node(), + m_parent( "parent", m_node ) + { + m_model = &m_parent.registerGroup< FluidType >( "fluid" ); + } + ~MultiFluidSelectorTest() override = default; + + MultiFluidBase & getFluid() const { return *m_model; } + +protected: + conduit::Node m_node; + dataRepository::Group m_parent; + FluidType * m_model{}; +}; + +using MultiFluidSelectorTestDeadOilFluid = MultiFluidSelectorTest< DeadOilFluid >; +using MultiFluidSelectorTestCO2BrinePhillipsThermalFluid = MultiFluidSelectorTest< CO2BrinePhillipsThermalFluid >; +using MultiFluidSelectorTestCompositionalTwoPhaseConstantViscosity = MultiFluidSelectorTest< CompositionalTwoPhaseConstantViscosity >; + +TEST_F( MultiFluidSelectorTestDeadOilFluid, testValidComponents ) +{ + bool isExecuted = false; + constitutiveComponentUpdatePassThru( getFluid(), 2, [&]( auto &, auto NC ) + { + integer constexpr numComps = NC(); + EXPECT_EQ( numComps, 2 ); + isExecuted = true; + } ); + EXPECT_TRUE( isExecuted ); + + isExecuted = false; + constitutiveComponentUpdatePassThru( getFluid(), 3, [&]( auto &, auto NC ) + { + integer constexpr numComps = NC(); + EXPECT_EQ( numComps, 3 ); + isExecuted = true; + } ); + EXPECT_TRUE( isExecuted ); +} + +TEST_F( MultiFluidSelectorTestDeadOilFluid, testInvalidComponents ) +{ + EXPECT_THROW( constitutiveComponentUpdatePassThru( getFluid(), 1, []( auto &, auto ) + { + FAIL(); // Shouldn't be called + } ), InputError ); + + EXPECT_THROW( constitutiveComponentUpdatePassThru( getFluid(), 4, []( auto &, auto ) + { + FAIL(); // Shouldn't be called + } ), InputError ); +} + +TEST_F( MultiFluidSelectorTestDeadOilFluid, testThermal ) +{ + EXPECT_THROW( constitutiveComponentUpdatePassThru< true >( getFluid(), 2, []( auto &, auto ) + { + FAIL(); // Shouldn't be called + } ), InputError ); +} + +TEST_F( MultiFluidSelectorTestCO2BrinePhillipsThermalFluid, testValidComponents ) +{ + bool isExecuted = false; + constitutiveComponentUpdatePassThru( getFluid(), 2, [&]( auto &, auto NC ) + { + integer constexpr numComps = NC(); + EXPECT_EQ( numComps, 2 ); + isExecuted = true; + } ); + EXPECT_TRUE( isExecuted ); +} + +TEST_F( MultiFluidSelectorTestCO2BrinePhillipsThermalFluid, testInvalidComponents ) +{ + EXPECT_THROW( constitutiveComponentUpdatePassThru( getFluid(), 1, []( auto &, auto ) + { + FAIL(); // Shouldn't be called + } ), InputError ); + + EXPECT_THROW( constitutiveComponentUpdatePassThru( getFluid(), 3, []( auto &, auto ) + { + FAIL(); // Shouldn't be called + } ), InputError ); +} + +TEST_F( MultiFluidSelectorTestCO2BrinePhillipsThermalFluid, testThermal ) +{ + bool isExecuted = false; + constitutiveComponentUpdatePassThru< true >( getFluid(), 2, [&]( auto &, auto ) + { + isExecuted = true; + } ); + EXPECT_TRUE( isExecuted ); +} + +TEST_F( MultiFluidSelectorTestCompositionalTwoPhaseConstantViscosity, testValidComponents ) +{ + for( integer nc = 2; nc <= 5; nc++ ) + { + bool isExecuted = false; + constitutiveComponentUpdatePassThru( getFluid(), nc, [&]( auto &, auto NC ) + { + integer constexpr numComps = NC(); + EXPECT_EQ( numComps, nc ); + isExecuted = true; + } ); + EXPECT_TRUE( isExecuted ); + } +} + +TEST_F( MultiFluidSelectorTestCompositionalTwoPhaseConstantViscosity, testInvalidComponents ) +{ + EXPECT_THROW( constitutiveComponentUpdatePassThru( getFluid(), 1, []( auto &, auto ) + { + FAIL(); // Shouldn't be called + } ), InputError ); + + EXPECT_THROW( constitutiveComponentUpdatePassThru( getFluid(), 6, []( auto &, auto ) + { + FAIL(); // Shouldn't be called + } ), InputError ); +} + +TEST_F( MultiFluidSelectorTestCompositionalTwoPhaseConstantViscosity, testThermal ) +{ + EXPECT_THROW( constitutiveComponentUpdatePassThru< true >( getFluid(), 2, [&]( auto &, auto ) + { + FAIL(); // Shouldn't be called + } ), InputError ); +} diff --git a/src/coreComponents/physicsSolvers/fluidFlow/IsothermalCompositionalMultiphaseFVMKernels.hpp b/src/coreComponents/physicsSolvers/fluidFlow/IsothermalCompositionalMultiphaseFVMKernels.hpp index 6e2ca6a3ed..e873db3665 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/IsothermalCompositionalMultiphaseFVMKernels.hpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/IsothermalCompositionalMultiphaseFVMKernels.hpp @@ -2125,36 +2125,33 @@ class DirichletFaceBasedAssemblyKernelFactory CRSMatrixView< real64, globalIndex const > const & localMatrix, arrayView1d< real64 > const & localRhs ) { - constitutive::constitutiveUpdatePassThru( fluidBase, [&]( auto & fluid ) + constitutive::constitutiveComponentUpdatePassThru( fluidBase, numComps, [&]( auto & fluid, auto NC ) { using FluidType = TYPEOFREF( fluid ); typename FluidType::KernelWrapper const fluidWrapper = fluid.createKernelWrapper(); - isothermalCompositionalMultiphaseBaseKernels::internal::kernelLaunchSelectorCompSwitch( numComps, [&]( auto NC ) - { - integer constexpr NUM_COMP = NC(); - integer constexpr NUM_DOF = NC() + 1; - - ElementRegionManager::ElementViewAccessor< arrayView1d< globalIndex const > > dofNumberAccessor = - elemManager.constructArrayViewAccessor< globalIndex, 1 >( dofKey ); - dofNumberAccessor.setName( solverName + "/accessors/" + dofKey ); - - // for now, we neglect capillary pressure in the kernel - BitFlags< FaceBasedAssemblyKernelFlags > kernelFlags; - if( useTotalMassEquation ) - kernelFlags.set( FaceBasedAssemblyKernelFlags::TotalMassEquation ); - - using kernelType = DirichletFaceBasedAssemblyKernel< NUM_COMP, NUM_DOF, typename FluidType::KernelWrapper >; - typename kernelType::CompFlowAccessors compFlowAccessors( elemManager, solverName ); - typename kernelType::MultiFluidAccessors multiFluidAccessors( elemManager, solverName ); - typename kernelType::CapPressureAccessors capPressureAccessors( elemManager, solverName ); - typename kernelType::PermeabilityAccessors permeabilityAccessors( elemManager, solverName ); - - kernelType kernel( numPhases, rankOffset, faceManager, stencilWrapper, fluidWrapper, - dofNumberAccessor, compFlowAccessors, multiFluidAccessors, capPressureAccessors, permeabilityAccessors, - dt, localMatrix, localRhs, kernelFlags ); - kernelType::template launch< POLICY >( stencilWrapper.size(), kernel ); - } ); + integer constexpr NUM_COMP = NC(); + integer constexpr NUM_DOF = NC() + 1; + + ElementRegionManager::ElementViewAccessor< arrayView1d< globalIndex const > > dofNumberAccessor = + elemManager.constructArrayViewAccessor< globalIndex, 1 >( dofKey ); + dofNumberAccessor.setName( solverName + "/accessors/" + dofKey ); + + // for now, we neglect capillary pressure in the kernel + BitFlags< FaceBasedAssemblyKernelFlags > kernelFlags; + if( useTotalMassEquation ) + kernelFlags.set( FaceBasedAssemblyKernelFlags::TotalMassEquation ); + + using kernelType = DirichletFaceBasedAssemblyKernel< NUM_COMP, NUM_DOF, typename FluidType::KernelWrapper >; + typename kernelType::CompFlowAccessors compFlowAccessors( elemManager, solverName ); + typename kernelType::MultiFluidAccessors multiFluidAccessors( elemManager, solverName ); + typename kernelType::CapPressureAccessors capPressureAccessors( elemManager, solverName ); + typename kernelType::PermeabilityAccessors permeabilityAccessors( elemManager, solverName ); + + kernelType kernel( numPhases, rankOffset, faceManager, stencilWrapper, fluidWrapper, + dofNumberAccessor, compFlowAccessors, multiFluidAccessors, capPressureAccessors, permeabilityAccessors, + dt, localMatrix, localRhs, kernelFlags ); + kernelType::template launch< POLICY >( stencilWrapper.size(), kernel ); } ); } }; diff --git a/src/coreComponents/physicsSolvers/fluidFlow/ThermalCompositionalMultiphaseFVMKernels.hpp b/src/coreComponents/physicsSolvers/fluidFlow/ThermalCompositionalMultiphaseFVMKernels.hpp index 1fc4920902..8b9de7e265 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/ThermalCompositionalMultiphaseFVMKernels.hpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/ThermalCompositionalMultiphaseFVMKernels.hpp @@ -1395,41 +1395,37 @@ class DirichletFaceBasedAssemblyKernelFactory CRSMatrixView< real64, globalIndex const > const & localMatrix, arrayView1d< real64 > const & localRhs ) { - constitutive::constitutiveUpdatePassThru( fluidBase, [&]( auto & fluid ) + constitutive::constitutiveComponentUpdatePassThru< true >( fluidBase, numComps, [&]( auto & fluid, auto NC ) { using FluidType = TYPEOFREF( fluid ); typename FluidType::KernelWrapper const fluidWrapper = fluid.createKernelWrapper(); - isothermalCompositionalMultiphaseBaseKernels:: - internal::kernelLaunchSelectorCompSwitch( numComps, [&]( auto NC ) - { - integer constexpr NUM_COMP = NC(); - integer constexpr NUM_DOF = NC() + 2; - - ElementRegionManager::ElementViewAccessor< arrayView1d< globalIndex const > > dofNumberAccessor = - elemManager.constructArrayViewAccessor< globalIndex, 1 >( dofKey ); - dofNumberAccessor.setName( solverName + "/accessors/" + dofKey ); - - // for now, we neglect capillary pressure in the kernel - BitFlags< isothermalCompositionalMultiphaseFVMKernels::FaceBasedAssemblyKernelFlags > kernelFlags; - if( useTotalMassEquation ) - kernelFlags.set( isothermalCompositionalMultiphaseFVMKernels::FaceBasedAssemblyKernelFlags::TotalMassEquation ); - - using KernelType = DirichletFaceBasedAssemblyKernel< NUM_COMP, NUM_DOF, typename FluidType::KernelWrapper >; - typename KernelType::CompFlowAccessors compFlowAccessors( elemManager, solverName ); - typename KernelType::ThermalCompFlowAccessors thermalCompFlowAccessors( elemManager, solverName ); - typename KernelType::MultiFluidAccessors multiFluidAccessors( elemManager, solverName ); - typename KernelType::ThermalMultiFluidAccessors thermalMultiFluidAccessors( elemManager, solverName ); - typename KernelType::CapPressureAccessors capPressureAccessors( elemManager, solverName ); - typename KernelType::PermeabilityAccessors permeabilityAccessors( elemManager, solverName ); - typename KernelType::ThermalConductivityAccessors thermalConductivityAccessors( elemManager, solverName ); - - KernelType kernel( numPhases, rankOffset, faceManager, stencilWrapper, fluidWrapper, - dofNumberAccessor, compFlowAccessors, thermalCompFlowAccessors, multiFluidAccessors, thermalMultiFluidAccessors, - capPressureAccessors, permeabilityAccessors, thermalConductivityAccessors, - dt, localMatrix, localRhs, kernelFlags ); - KernelType::template launch< POLICY >( stencilWrapper.size(), kernel ); - } ); + integer constexpr NUM_COMP = NC(); + integer constexpr NUM_DOF = NC() + 2; + + ElementRegionManager::ElementViewAccessor< arrayView1d< globalIndex const > > dofNumberAccessor = + elemManager.constructArrayViewAccessor< globalIndex, 1 >( dofKey ); + dofNumberAccessor.setName( solverName + "/accessors/" + dofKey ); + + // for now, we neglect capillary pressure in the kernel + BitFlags< isothermalCompositionalMultiphaseFVMKernels::FaceBasedAssemblyKernelFlags > kernelFlags; + if( useTotalMassEquation ) + kernelFlags.set( isothermalCompositionalMultiphaseFVMKernels::FaceBasedAssemblyKernelFlags::TotalMassEquation ); + + using KernelType = DirichletFaceBasedAssemblyKernel< NUM_COMP, NUM_DOF, typename FluidType::KernelWrapper >; + typename KernelType::CompFlowAccessors compFlowAccessors( elemManager, solverName ); + typename KernelType::ThermalCompFlowAccessors thermalCompFlowAccessors( elemManager, solverName ); + typename KernelType::MultiFluidAccessors multiFluidAccessors( elemManager, solverName ); + typename KernelType::ThermalMultiFluidAccessors thermalMultiFluidAccessors( elemManager, solverName ); + typename KernelType::CapPressureAccessors capPressureAccessors( elemManager, solverName ); + typename KernelType::PermeabilityAccessors permeabilityAccessors( elemManager, solverName ); + typename KernelType::ThermalConductivityAccessors thermalConductivityAccessors( elemManager, solverName ); + + KernelType kernel( numPhases, rankOffset, faceManager, stencilWrapper, fluidWrapper, + dofNumberAccessor, compFlowAccessors, thermalCompFlowAccessors, multiFluidAccessors, thermalMultiFluidAccessors, + capPressureAccessors, permeabilityAccessors, thermalConductivityAccessors, + dt, localMatrix, localRhs, kernelFlags ); + KernelType::template launch< POLICY >( stencilWrapper.size(), kernel ); } ); } };