diff --git a/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseBase.cpp b/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseBase.cpp index 66c7967703..136260ea1b 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseBase.cpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseBase.cpp @@ -1349,6 +1349,15 @@ void CompositionalMultiphaseBase::assembleAccumulationAndVolumeBalanceTerms( Dom { GEOS_MARK_FUNCTION; + using namespace isothermalCompositionalMultiphaseBaseKernels; + + BitFlags< KernelFlags > kernelFlags; + if( m_useTotalMassEquation ) + kernelFlags.set( KernelFlags::TotalMassEquation ); + if( m_useSimpleAccumulation ) + kernelFlags.set( KernelFlags::SimpleAccumulation ); + + forDiscretizationOnMeshTargets( domain.getMeshBodies(), [&]( string const &, MeshLevel const & mesh, arrayView1d< string const > const & regionNames ) @@ -1371,7 +1380,7 @@ void CompositionalMultiphaseBase::assembleAccumulationAndVolumeBalanceTerms( Dom createAndLaunch< parallelDevicePolicy<> >( m_numComponents, m_numPhases, dofManager.rankOffset(), - m_useTotalMassEquation, + kernelFlags, dofKey, subRegion, fluid, @@ -1386,8 +1395,7 @@ void CompositionalMultiphaseBase::assembleAccumulationAndVolumeBalanceTerms( Dom createAndLaunch< parallelDevicePolicy<> >( m_numComponents, m_numPhases, dofManager.rankOffset(), - m_useTotalMassEquation, - m_useSimpleAccumulation, + kernelFlags, dofKey, subRegion, fluid, diff --git a/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseFVM.cpp b/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseFVM.cpp index 9a64efef23..ac0c8a15ad 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseFVM.cpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseFVM.cpp @@ -164,6 +164,20 @@ void CompositionalMultiphaseFVM::assembleFluxTerms( real64 const dt, { GEOS_MARK_FUNCTION; + using namespace isothermalCompositionalMultiphaseFVMKernels; + + BitFlags< KernelFlags > kernelFlags; + if( m_hasCapPressure ) + kernelFlags.set( KernelFlags::CapPressure ); + if( m_hasDiffusion ) + kernelFlags.set( KernelFlags::Diffusion ); + if( m_hasDispersion ) + kernelFlags.set( KernelFlags::Dispersion ); + if( m_useTotalMassEquation ) + kernelFlags.set( KernelFlags::TotalMassEquation ); + if( m_useNewGravity ) + kernelFlags.set( KernelFlags::NewGravity ); + forDiscretizationOnMeshTargets( domain.getMeshBodies(), [&]( string const &, MeshLevel const & mesh, arrayView1d< string const > const & ) @@ -172,6 +186,13 @@ void CompositionalMultiphaseFVM::assembleFluxTerms( real64 const dt, FiniteVolumeManager const & fvManager = numericalMethodManager.getFiniteVolumeManager(); FluxApproximationBase const & fluxApprox = fvManager.getFluxApproximation( m_discretizationName ); + auto const & upwindingParams = fluxApprox.upwindingParams(); + if( upwindingParams.upwindingScheme == UpwindingScheme::C1PPU && + isothermalCompositionalMultiphaseFVMKernelUtilities::epsC1PPU > 0 ) + kernelFlags.set( KernelFlags::C1PPU ); + else if( upwindingParams.upwindingScheme == UpwindingScheme::IHU ) + kernelFlags.set( KernelFlags::IHU ); + string const & elemDofKey = dofManager.getKey( viewKeyStruct::elemDofFieldString() ); fluxApprox.forAllStencils( mesh, [&] ( auto & stencil ) @@ -187,8 +208,7 @@ void CompositionalMultiphaseFVM::assembleFluxTerms( real64 const dt, m_numPhases, dofManager.rankOffset(), elemDofKey, - m_hasCapPressure, - m_useTotalMassEquation, + kernelFlags, getName(), mesh.getElemManager(), stencilWrapper, @@ -206,8 +226,7 @@ void CompositionalMultiphaseFVM::assembleFluxTerms( real64 const dt, m_numPhases, dofManager.rankOffset(), elemDofKey, - m_hasCapPressure, - m_useTotalMassEquation, + kernelFlags, getName(), mesh.getElemManager(), stencilWrapper, @@ -229,10 +248,7 @@ void CompositionalMultiphaseFVM::assembleFluxTerms( real64 const dt, m_numPhases, dofManager.rankOffset(), elemDofKey, - m_hasCapPressure, - m_useTotalMassEquation, - m_useNewGravity, - fluxApprox.upwindingParams(), + kernelFlags, getName(), mesh.getElemManager(), stencilWrapper, @@ -254,9 +270,7 @@ void CompositionalMultiphaseFVM::assembleFluxTerms( real64 const dt, m_numPhases, dofManager.rankOffset(), elemDofKey, - m_hasDiffusion, - m_hasDispersion, - m_useTotalMassEquation, + kernelFlags, getName(), mesh.getElemManager(), stencilWrapper, @@ -272,9 +286,7 @@ void CompositionalMultiphaseFVM::assembleFluxTerms( real64 const dt, m_numPhases, dofManager.rankOffset(), elemDofKey, - m_hasDiffusion, - m_hasDispersion, - m_useTotalMassEquation, + kernelFlags, getName(), mesh.getElemManager(), stencilWrapper, @@ -296,6 +308,14 @@ void CompositionalMultiphaseFVM::assembleStabilizedFluxTerms( real64 const dt, { GEOS_MARK_FUNCTION; + using namespace isothermalCompositionalMultiphaseFVMKernels; + + BitFlags< KernelFlags > kernelFlags; + if( m_hasCapPressure ) + kernelFlags.set( KernelFlags::CapPressure ); + if( m_useTotalMassEquation ) + kernelFlags.set( KernelFlags::TotalMassEquation ); + forDiscretizationOnMeshTargets( domain.getMeshBodies(), [&]( string const &, MeshLevel const & mesh, arrayView1d< string const > const & ) @@ -321,8 +341,7 @@ void CompositionalMultiphaseFVM::assembleStabilizedFluxTerms( real64 const dt, m_numPhases, dofManager.rankOffset(), elemDofKey, - m_hasCapPressure, - m_useTotalMassEquation, + kernelFlags, getName(), mesh.getElemManager(), stencilWrapper, @@ -1008,6 +1027,12 @@ void CompositionalMultiphaseFVM::applyFaceDirichletBC( real64 const time_n, GEOS_ERROR_IF( !bcConsistent, GEOS_FMT( "CompositionalMultiphaseBase {}: inconsistent boundary conditions", getDataContext() ) ); } + using namespace isothermalCompositionalMultiphaseFVMKernels; + + BitFlags< KernelFlags > kernelFlags; + if( m_useTotalMassEquation ) + kernelFlags.set( KernelFlags::TotalMassEquation ); + FieldSpecificationManager & fsManager = FieldSpecificationManager::getInstance(); NumericalMethodsManager const & numericalMethodManager = domain.getNumericalMethodManager(); @@ -1070,7 +1095,7 @@ void CompositionalMultiphaseFVM::applyFaceDirichletBC( real64 const time_n, createAndLaunch< parallelDevicePolicy<> >( m_numComponents, m_numPhases, dofManager.rankOffset(), - m_useTotalMassEquation, + kernelFlags, elemDofKey, getName(), faceManager, diff --git a/src/coreComponents/physicsSolvers/fluidFlow/kernels/compositional/AccumulationKernel.hpp b/src/coreComponents/physicsSolvers/fluidFlow/kernels/compositional/AccumulationKernel.hpp index c88ec50744..e283affcf4 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/kernels/compositional/AccumulationKernel.hpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/kernels/compositional/AccumulationKernel.hpp @@ -474,8 +474,7 @@ class AccumulationKernelFactory createAndLaunch( integer const numComps, integer const numPhases, globalIndex const rankOffset, - integer const useTotalMassEquation, - integer const useSimpleAccumulation, + BitFlags< KernelFlags > kernelFlags, string const dofKey, ElementSubRegionBase const & subRegion, constitutive::MultiFluidBase const & fluid, @@ -488,12 +487,6 @@ class AccumulationKernelFactory integer constexpr NUM_COMP = NC(); integer constexpr NUM_DOF = NC()+1; - BitFlags< KernelFlags > kernelFlags; - if( useTotalMassEquation ) - kernelFlags.set( KernelFlags::TotalMassEquation ); - if( useSimpleAccumulation ) - kernelFlags.set( KernelFlags::SimpleAccumulation ); - AccumulationKernel< NUM_COMP, NUM_DOF > kernel( numPhases, rankOffset, dofKey, subRegion, fluid, solid, localMatrix, localRhs, kernelFlags ); AccumulationKernel< NUM_COMP, NUM_DOF >::template launch< POLICY >( subRegion.size(), kernel ); diff --git a/src/coreComponents/physicsSolvers/fluidFlow/kernels/compositional/DiffusionDispersionFluxComputeKernel.hpp b/src/coreComponents/physicsSolvers/fluidFlow/kernels/compositional/DiffusionDispersionFluxComputeKernel.hpp index f4293d5f83..a078cb402d 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/kernels/compositional/DiffusionDispersionFluxComputeKernel.hpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/kernels/compositional/DiffusionDispersionFluxComputeKernel.hpp @@ -725,9 +725,7 @@ class DiffusionDispersionFluxComputeKernelFactory integer const numPhases, globalIndex const rankOffset, string const & dofKey, - integer const hasDiffusion, - integer const hasDispersion, - integer const useTotalMassEquation, + BitFlags< KernelFlags > kernelFlags, string const & solverName, ElementRegionManager const & elemManager, STENCILWRAPPER const & stencilWrapper, @@ -744,10 +742,6 @@ class DiffusionDispersionFluxComputeKernelFactory elemManager.constructArrayViewAccessor< globalIndex, 1 >( dofKey ); dofNumberAccessor.setName( solverName + "/accessors/" + dofKey ); - BitFlags< KernelFlags > kernelFlags; - if( useTotalMassEquation ) - kernelFlags.set( KernelFlags::TotalMassEquation ); - using kernelType = DiffusionDispersionFluxComputeKernel< NUM_COMP, NUM_DOF, STENCILWRAPPER >; typename kernelType::CompFlowAccessors compFlowAccessors( elemManager, solverName ); typename kernelType::MultiFluidAccessors multiFluidAccessors( elemManager, solverName ); @@ -760,7 +754,8 @@ class DiffusionDispersionFluxComputeKernelFactory diffusionAccessors, dispersionAccessors, porosityAccessors, dt, localMatrix, localRhs, kernelFlags ); kernelType::template launch< POLICY >( stencilWrapper.size(), - hasDiffusion, hasDispersion, + kernelFlags.isSet( KernelFlags::Diffusion ), + kernelFlags.isSet( KernelFlags::Dispersion ), kernel ); } ); } diff --git a/src/coreComponents/physicsSolvers/fluidFlow/kernels/compositional/DissipationFluxComputeKernel.hpp b/src/coreComponents/physicsSolvers/fluidFlow/kernels/compositional/DissipationFluxComputeKernel.hpp index 3d09e878fb..058fb13ca1 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/kernels/compositional/DissipationFluxComputeKernel.hpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/kernels/compositional/DissipationFluxComputeKernel.hpp @@ -349,8 +349,7 @@ class FluxComputeKernelFactory integer const numPhases, globalIndex const rankOffset, string const & dofKey, - integer const hasCapPressure, - integer const useTotalMassEquation, + BitFlags< isothermalCompositionalMultiphaseFVMKernels::KernelFlags > kernelFlags, string const & solverName, ElementRegionManager const & elemManager, STENCILWRAPPER const & stencilWrapper, @@ -374,12 +373,6 @@ class FluxComputeKernelFactory elemManager.constructArrayViewAccessor< globalIndex, 1 >( dofKey ); dofNumberAccessor.setName( solverName + "/accessors/" + dofKey ); - BitFlags< isothermalCompositionalMultiphaseFVMKernels::KernelFlags > kernelFlags; - if( hasCapPressure ) - kernelFlags.set( isothermalCompositionalMultiphaseFVMKernels::KernelFlags::CapPressure ); - if( useTotalMassEquation ) - kernelFlags.set( isothermalCompositionalMultiphaseFVMKernels::KernelFlags::TotalMassEquation ); - using KERNEL_TYPE = FluxComputeKernel< NUM_COMP, NUM_DOF, STENCILWRAPPER >; typename KERNEL_TYPE::CompFlowAccessors compFlowAccessors( elemManager, solverName ); typename KERNEL_TYPE::MultiFluidAccessors multiFluidAccessors( elemManager, solverName ); diff --git a/src/coreComponents/physicsSolvers/fluidFlow/kernels/compositional/FluxComputeKernel.hpp b/src/coreComponents/physicsSolvers/fluidFlow/kernels/compositional/FluxComputeKernel.hpp index 83af007a79..ec55ade8f2 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/kernels/compositional/FluxComputeKernel.hpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/kernels/compositional/FluxComputeKernel.hpp @@ -360,7 +360,7 @@ class FluxComputeKernel : public FluxComputeKernelBase k_up, seri[k_up], sesri[k_up], sei[k_up], potGrad, phaseFlux, dPhaseFlux_dP, dPhaseFlux_dC ); - } // loop over phases + } // loop over phases /// populate local flux vector and derivatives for( integer ic = 0; ic < numComp; ++ic ) @@ -527,10 +527,7 @@ class FluxComputeKernelFactory integer const numPhases, globalIndex const rankOffset, string const & dofKey, - integer const hasCapPressure, - integer const useTotalMassEquation, - integer const useNewGravity, - UpwindingParameters upwindingParams, + BitFlags< KernelFlags > kernelFlags, string const & solverName, ElementRegionManager const & elemManager, STENCILWRAPPER const & stencilWrapper, @@ -547,20 +544,6 @@ class FluxComputeKernelFactory elemManager.constructArrayViewAccessor< globalIndex, 1 >( dofKey ); dofNumberAccessor.setName( solverName + "/accessors/" + dofKey ); - BitFlags< KernelFlags > kernelFlags; - if( hasCapPressure ) - kernelFlags.set( KernelFlags::CapPressure ); - if( useTotalMassEquation ) - kernelFlags.set( KernelFlags::TotalMassEquation ); - if( useNewGravity ) - kernelFlags.set( KernelFlags::NewGravity ); - if( upwindingParams.upwindingScheme == UpwindingScheme::C1PPU && - isothermalCompositionalMultiphaseFVMKernelUtilities::epsC1PPU > 0 ) - kernelFlags.set( KernelFlags::C1PPU ); - else if( upwindingParams.upwindingScheme == UpwindingScheme::IHU ) - kernelFlags.set( KernelFlags::IHU ); - - using kernelType = FluxComputeKernel< NUM_COMP, NUM_DOF, STENCILWRAPPER >; typename kernelType::CompFlowAccessors compFlowAccessors( elemManager, solverName ); typename kernelType::MultiFluidAccessors multiFluidAccessors( elemManager, solverName ); diff --git a/src/coreComponents/physicsSolvers/fluidFlow/kernels/compositional/FluxComputeKernelBase.hpp b/src/coreComponents/physicsSolvers/fluidFlow/kernels/compositional/FluxComputeKernelBase.hpp index ff96044c99..d25700387a 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/kernels/compositional/FluxComputeKernelBase.hpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/kernels/compositional/FluxComputeKernelBase.hpp @@ -45,17 +45,19 @@ enum class KernelFlags { /// Flag to specify whether capillary pressure is used or not CapPressure = 1 << 0, // 1 + /// Flag to specify whether diffusion is used or not + Diffusion = 1 << 1, // 2 + /// Flag to specify whether dispersion is used or not + Dispersion = 1 << 2, // 4 /// Flag indicating whether total mass equation is formed or not - TotalMassEquation = 1 << 1, // 2 + TotalMassEquation = 1 << 3, // 8 /// Flag indicating whether new gravity treatment is used or not - NewGravity = 1 << 2, // 4 + NewGravity = 1 << 4, // 16 /// Flag indicating whether C1-PPU is used or not - C1PPU = 1 << 3, // 8 + C1PPU = 1 << 5, // 32 /// Flag indicating whether IHU is used or not - IHU = 1 << 4 // 16 + IHU = 1 << 6 // 64 /// Add more flags like that if needed: - // Flag6 = 1 << 5, // 32 - // Flag7 = 1 << 6, // 64 // Flag8 = 1 << 7 //128 }; diff --git a/src/coreComponents/physicsSolvers/fluidFlow/kernels/compositional/StabilizedFluxComputeKernel.hpp b/src/coreComponents/physicsSolvers/fluidFlow/kernels/compositional/StabilizedFluxComputeKernel.hpp index eb679f2942..52ff61a012 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/kernels/compositional/StabilizedFluxComputeKernel.hpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/kernels/compositional/StabilizedFluxComputeKernel.hpp @@ -327,8 +327,7 @@ class FluxComputeKernelFactory integer const numPhases, globalIndex const rankOffset, string const & dofKey, - integer const hasCapPressure, - integer const useTotalMassEquation, + BitFlags< isothermalCompositionalMultiphaseFVMKernels::KernelFlags > kernelFlags, string const & solverName, ElementRegionManager const & elemManager, STENCILWRAPPER const & stencilWrapper, @@ -346,12 +345,6 @@ class FluxComputeKernelFactory elemManager.constructArrayViewAccessor< globalIndex, 1 >( dofKey ); dofNumberAccessor.setName( solverName + "/accessors/" + dofKey ); - BitFlags< isothermalCompositionalMultiphaseFVMKernels::KernelFlags > kernelFlags; - if( hasCapPressure ) - kernelFlags.set( isothermalCompositionalMultiphaseFVMKernels::KernelFlags::CapPressure ); - if( useTotalMassEquation ) - kernelFlags.set( isothermalCompositionalMultiphaseFVMKernels::KernelFlags::TotalMassEquation ); - using KERNEL_TYPE = FluxComputeKernel< NUM_COMP, NUM_DOF, STENCILWRAPPER >; typename KERNEL_TYPE::CompFlowAccessors compFlowAccessors( elemManager, solverName ); typename KERNEL_TYPE::MultiFluidAccessors multiFluidAccessors( elemManager, solverName ); diff --git a/src/coreComponents/physicsSolvers/fluidFlow/kernels/compositional/ThermalAccumulationKernel.hpp b/src/coreComponents/physicsSolvers/fluidFlow/kernels/compositional/ThermalAccumulationKernel.hpp index 58d6aa12cf..e5839bd023 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/kernels/compositional/ThermalAccumulationKernel.hpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/kernels/compositional/ThermalAccumulationKernel.hpp @@ -311,7 +311,7 @@ class AccumulationKernelFactory createAndLaunch( localIndex const numComps, localIndex const numPhases, globalIndex const rankOffset, - integer const useTotalMassEquation, + BitFlags< isothermalCompositionalMultiphaseBaseKernels::KernelFlags > kernelFlags, string const dofKey, ElementSubRegionBase const & subRegion, constitutive::MultiFluidBase const & fluid, @@ -325,10 +325,6 @@ class AccumulationKernelFactory localIndex constexpr NUM_COMP = NC(); localIndex constexpr NUM_DOF = NC()+2; - BitFlags< isothermalCompositionalMultiphaseBaseKernels::KernelFlags > kernelFlags; - if( useTotalMassEquation ) - kernelFlags.set( isothermalCompositionalMultiphaseBaseKernels::KernelFlags::TotalMassEquation ); - AccumulationKernel< NUM_COMP, NUM_DOF > kernel( numPhases, rankOffset, dofKey, subRegion, fluid, solid, localMatrix, localRhs, kernelFlags ); AccumulationKernel< NUM_COMP, NUM_DOF >::template launch< POLICY >( subRegion.size(), kernel ); diff --git a/src/coreComponents/physicsSolvers/fluidFlow/kernels/compositional/ThermalDiffusionDispersionFluxComputeKernel.hpp b/src/coreComponents/physicsSolvers/fluidFlow/kernels/compositional/ThermalDiffusionDispersionFluxComputeKernel.hpp index 957d98bee4..c5f2d67951 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/kernels/compositional/ThermalDiffusionDispersionFluxComputeKernel.hpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/kernels/compositional/ThermalDiffusionDispersionFluxComputeKernel.hpp @@ -302,9 +302,7 @@ class DiffusionDispersionFluxComputeKernelFactory integer const numPhases, globalIndex const rankOffset, string const & dofKey, - integer const hasDiffusion, - integer const hasDispersion, - integer const useTotalMassEquation, + BitFlags< isothermalCompositionalMultiphaseFVMKernels::KernelFlags > kernelFlags, string const & solverName, ElementRegionManager const & elemManager, STENCILWRAPPER const & stencilWrapper, @@ -322,10 +320,6 @@ class DiffusionDispersionFluxComputeKernelFactory elemManager.constructArrayViewAccessor< globalIndex, 1 >( dofKey ); dofNumberAccessor.setName( solverName + "/accessors/" + dofKey ); - BitFlags< isothermalCompositionalMultiphaseFVMKernels::KernelFlags > kernelFlags; - if( useTotalMassEquation ) - kernelFlags.set( isothermalCompositionalMultiphaseFVMKernels::KernelFlags::TotalMassEquation ); - using kernelType = DiffusionDispersionFluxComputeKernel< NUM_COMP, NUM_DOF, STENCILWRAPPER >; typename kernelType::CompFlowAccessors compFlowAccessors( elemManager, solverName ); typename kernelType::MultiFluidAccessors multiFluidAccessors( elemManager, solverName ); @@ -338,7 +332,8 @@ class DiffusionDispersionFluxComputeKernelFactory diffusionAccessors, dispersionAccessors, porosityAccessors, dt, localMatrix, localRhs, kernelFlags ); kernelType::template launch< POLICY >( stencilWrapper.size(), - hasDiffusion, hasDispersion, + kernelFlags.isSet( isothermalCompositionalMultiphaseFVMKernels::KernelFlags::Diffusion ), + kernelFlags.isSet( isothermalCompositionalMultiphaseFVMKernels::KernelFlags::Dispersion ), kernel ); } ); } diff --git a/src/coreComponents/physicsSolvers/fluidFlow/kernels/compositional/ThermalDirichletFluxComputeKernel.hpp b/src/coreComponents/physicsSolvers/fluidFlow/kernels/compositional/ThermalDirichletFluxComputeKernel.hpp index 5df89fc5e3..009ab3ce63 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/kernels/compositional/ThermalDirichletFluxComputeKernel.hpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/kernels/compositional/ThermalDirichletFluxComputeKernel.hpp @@ -430,7 +430,7 @@ class DirichletFluxComputeKernelFactory createAndLaunch( integer const numComps, integer const numPhases, globalIndex const rankOffset, - integer const useTotalMassEquation, + BitFlags< isothermalCompositionalMultiphaseFVMKernels::KernelFlags > kernelFlags, string const & dofKey, string const & solverName, FaceManager const & faceManager, @@ -453,11 +453,6 @@ class DirichletFluxComputeKernelFactory elemManager.constructArrayViewAccessor< globalIndex, 1 >( dofKey ); dofNumberAccessor.setName( solverName + "/accessors/" + dofKey ); - // for now, we neglect capillary pressure in the kernel - BitFlags< isothermalCompositionalMultiphaseFVMKernels::KernelFlags > kernelFlags; - if( useTotalMassEquation ) - kernelFlags.set( isothermalCompositionalMultiphaseFVMKernels::KernelFlags::TotalMassEquation ); - using KernelType = DirichletFluxComputeKernel< NUM_COMP, NUM_DOF, typename FluidType::KernelWrapper >; typename KernelType::CompFlowAccessors compFlowAccessors( elemManager, solverName ); typename KernelType::ThermalCompFlowAccessors thermalCompFlowAccessors( elemManager, solverName ); diff --git a/src/coreComponents/physicsSolvers/fluidFlow/kernels/compositional/ThermalFluxComputeKernel.hpp b/src/coreComponents/physicsSolvers/fluidFlow/kernels/compositional/ThermalFluxComputeKernel.hpp index 519b1a538b..ccc07f66b8 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/kernels/compositional/ThermalFluxComputeKernel.hpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/kernels/compositional/ThermalFluxComputeKernel.hpp @@ -522,8 +522,7 @@ class FluxComputeKernelFactory integer const numPhases, globalIndex const rankOffset, string const & dofKey, - integer const hasCapPressure, - integer const useTotalMassEquation, + BitFlags< isothermalCompositionalMultiphaseFVMKernels::KernelFlags > kernelFlags, string const & solverName, ElementRegionManager const & elemManager, STENCILWRAPPER const & stencilWrapper, @@ -541,12 +540,6 @@ class FluxComputeKernelFactory elemManager.constructArrayViewAccessor< globalIndex, 1 >( dofKey ); dofNumberAccessor.setName( solverName + "/accessors/" + dofKey ); - BitFlags< isothermalCompositionalMultiphaseFVMKernels::KernelFlags > kernelFlags; - if( hasCapPressure ) - kernelFlags.set( isothermalCompositionalMultiphaseFVMKernels::KernelFlags::CapPressure ); - if( useTotalMassEquation ) - kernelFlags.set( isothermalCompositionalMultiphaseFVMKernels::KernelFlags::TotalMassEquation ); - using KernelType = FluxComputeKernel< NUM_COMP, NUM_DOF, STENCILWRAPPER >; typename KernelType::CompFlowAccessors compFlowAccessors( elemManager, solverName ); typename KernelType::ThermalCompFlowAccessors thermalCompFlowAccessors( elemManager, solverName ); diff --git a/src/coreComponents/physicsSolvers/fluidFlow/wells/CompositionalMultiphaseWell.cpp b/src/coreComponents/physicsSolvers/fluidFlow/wells/CompositionalMultiphaseWell.cpp index 1f13044d87..90f3a8677e 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/wells/CompositionalMultiphaseWell.cpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/wells/CompositionalMultiphaseWell.cpp @@ -1090,6 +1090,9 @@ void CompositionalMultiphaseWell::assembleFluxTerms( real64 const & time, { GEOS_MARK_FUNCTION; + BitFlags< isothermalCompositionalMultiphaseBaseKernels::KernelFlags > kernelFlags; + if( m_useTotalMassEquation ) + kernelFlags.set( isothermalCompositionalMultiphaseBaseKernels::KernelFlags::TotalMassEquation ); string const wellDofKey = dofManager.getKey( wellElementDofName()); forDiscretizationOnMeshTargets( domain.getMeshBodies(), [&]( string const &, @@ -1114,7 +1117,7 @@ void CompositionalMultiphaseWell::assembleFluxTerms( real64 const & time, createAndLaunch< parallelDevicePolicy<> >( numComponents, dt, dofManager.rankOffset(), - m_useTotalMassEquation, + kernelFlags, wellDofKey, well_controls, subRegion, @@ -1129,7 +1132,7 @@ void CompositionalMultiphaseWell::assembleFluxTerms( real64 const & time, createAndLaunch< parallelDevicePolicy<> >( numComponents, dt, dofManager.rankOffset(), - m_useTotalMassEquation, + kernelFlags, wellDofKey, well_controls, subRegion, @@ -1152,6 +1155,11 @@ void CompositionalMultiphaseWell::assembleAccumulationTerms( real64 const & time GEOS_MARK_FUNCTION; GEOS_UNUSED_VAR( time ); GEOS_UNUSED_VAR( dt ); + + BitFlags< isothermalCompositionalMultiphaseBaseKernels::KernelFlags > kernelFlags; + if( m_useTotalMassEquation ) + kernelFlags.set( isothermalCompositionalMultiphaseBaseKernels::KernelFlags::TotalMassEquation ); + string const wellDofKey = dofManager.getKey( wellElementDofName() ); forDiscretizationOnMeshTargets( domain.getMeshBodies(), [&]( string const &, MeshLevel & mesh, @@ -1177,7 +1185,7 @@ void CompositionalMultiphaseWell::assembleAccumulationTerms( real64 const & time numPhases, wellControls.isProducer(), dofManager.rankOffset(), - m_useTotalMassEquation, + kernelFlags, wellDofKey, subRegion, fluid, @@ -1192,7 +1200,7 @@ void CompositionalMultiphaseWell::assembleAccumulationTerms( real64 const & time numPhases, wellControls.isProducer(), dofManager.rankOffset(), - m_useTotalMassEquation, + kernelFlags, wellDofKey, subRegion, fluid, diff --git a/src/coreComponents/physicsSolvers/fluidFlow/wells/kernels/CompositionalMultiphaseWellKernels.hpp b/src/coreComponents/physicsSolvers/fluidFlow/wells/kernels/CompositionalMultiphaseWellKernels.hpp index 41d63148bf..aae86fcf48 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/wells/kernels/CompositionalMultiphaseWellKernels.hpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/wells/kernels/CompositionalMultiphaseWellKernels.hpp @@ -1331,7 +1331,7 @@ class ElementBasedAssemblyKernelFactory localIndex const numPhases, integer const isProducer, globalIndex const rankOffset, - integer const useTotalMassEquation, + BitFlags< isothermalCompositionalMultiphaseBaseKernels::KernelFlags > kernelFlags, string const dofKey, WellElementSubRegion const & subRegion, constitutive::MultiFluidBase const & fluid, @@ -1344,10 +1344,6 @@ class ElementBasedAssemblyKernelFactory integer constexpr istherm = IS_THERMAL(); - BitFlags< isothermalCompositionalMultiphaseBaseKernels::KernelFlags > kernelFlags; - if( useTotalMassEquation ) - kernelFlags.set( isothermalCompositionalMultiphaseBaseKernels::KernelFlags::TotalMassEquation ); - ElementBasedAssemblyKernel< NUM_COMP, istherm > kernel( numPhases, isProducer, rankOffset, dofKey, subRegion, fluid, localMatrix, localRhs, kernelFlags ); ElementBasedAssemblyKernel< NUM_COMP, istherm >::template @@ -1888,7 +1884,7 @@ class FaceBasedAssemblyKernelFactory createAndLaunch( integer const numComps, real64 const dt, globalIndex const rankOffset, - integer const useTotalMassEquation, + BitFlags< isothermalCompositionalMultiphaseBaseKernels::KernelFlags > kernelFlags, string const dofKey, WellControls const & wellControls, WellElementSubRegion const & subRegion, @@ -1899,14 +1895,7 @@ class FaceBasedAssemblyKernelFactory { integer constexpr NUM_COMP = NC(); - - BitFlags< isothermalCompositionalMultiphaseBaseKernels::KernelFlags > kernelFlags; - if( useTotalMassEquation ) - kernelFlags.set( isothermalCompositionalMultiphaseBaseKernels::KernelFlags::TotalMassEquation ); - using kernelType = FaceBasedAssemblyKernel< NUM_COMP, 0 >; - - kernelType kernel( dt, rankOffset, dofKey, wellControls, subRegion, localMatrix, localRhs, kernelFlags ); kernelType::template launch< POLICY >( subRegion.size(), kernel ); } ); diff --git a/src/coreComponents/physicsSolvers/fluidFlow/wells/kernels/ThermalCompositionalMultiphaseWellKernels.hpp b/src/coreComponents/physicsSolvers/fluidFlow/wells/kernels/ThermalCompositionalMultiphaseWellKernels.hpp index e7beb34752..6e225367a3 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/wells/kernels/ThermalCompositionalMultiphaseWellKernels.hpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/wells/kernels/ThermalCompositionalMultiphaseWellKernels.hpp @@ -638,7 +638,7 @@ class ElementBasedAssemblyKernelFactory localIndex const numPhases, integer const isProducer, globalIndex const rankOffset, - integer const useTotalMassEquation, + BitFlags< isothermalCompositionalMultiphaseBaseKernels::KernelFlags > kernelFlags, string const dofKey, WellElementSubRegion const & subRegion, MultiFluidBase const & fluid, @@ -650,11 +650,6 @@ class ElementBasedAssemblyKernelFactory { localIndex constexpr NUM_COMP = NC(); - - BitFlags< isothermalCompositionalMultiphaseBaseKernels::KernelFlags > kernelFlags; - if( useTotalMassEquation ) - kernelFlags.set( isothermalCompositionalMultiphaseBaseKernels::KernelFlags::TotalMassEquation ); - ElementBasedAssemblyKernel< NUM_COMP > kernel( numPhases, isProducer, rankOffset, dofKey, subRegion, fluid, localMatrix, localRhs, kernelFlags ); ElementBasedAssemblyKernel< NUM_COMP >::template @@ -1089,7 +1084,7 @@ class FaceBasedAssemblyKernelFactory createAndLaunch( integer const numComps, real64 const dt, globalIndex const rankOffset, - integer const useTotalMassEquation, + BitFlags< isothermalCompositionalMultiphaseBaseKernels::KernelFlags > kernelFlags, string const dofKey, WellControls const & wellControls, WellElementSubRegion const & subRegion, @@ -1101,15 +1096,7 @@ class FaceBasedAssemblyKernelFactory { integer constexpr NUM_COMP = NC(); - - BitFlags< isothermalCompositionalMultiphaseBaseKernels::KernelFlags > kernelFlags; - if( useTotalMassEquation ) - kernelFlags.set( isothermalCompositionalMultiphaseBaseKernels::KernelFlags::TotalMassEquation ); - - using kernelType = FaceBasedAssemblyKernel< NUM_COMP >; - - kernelType kernel( dt, rankOffset, dofKey, wellControls, subRegion, fluid, localMatrix, localRhs, kernelFlags ); kernelType::template launch< POLICY >( subRegion.size(), kernel ); } ); diff --git a/src/coreComponents/physicsSolvers/multiphysics/CompositionalMultiphaseReservoirAndWells.cpp b/src/coreComponents/physicsSolvers/multiphysics/CompositionalMultiphaseReservoirAndWells.cpp index ea2c6f34b3..afa810d945 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/CompositionalMultiphaseReservoirAndWells.cpp +++ b/src/coreComponents/physicsSolvers/multiphysics/CompositionalMultiphaseReservoirAndWells.cpp @@ -281,6 +281,10 @@ assembleCouplingTerms( real64 const time_n, this->getCatalogName(), this->getName() ), std::runtime_error ); + BitFlags< isothermalCompositionalMultiphaseBaseKernels::KernelFlags > kernelFlags; + if( Base::wellSolver()->useTotalMassEquation() ) + kernelFlags.set( isothermalCompositionalMultiphaseBaseKernels::KernelFlags::TotalMassEquation ); + this->template forDiscretizationOnMeshTargets( domain.getMeshBodies(), [&] ( string const &, MeshLevel const & mesh, arrayView1d< string const > const & regionNames ) @@ -322,7 +326,6 @@ assembleCouplingTerms( real64 const time_n, string const wellDofKey = dofManager.getKey( Base::wellSolver()->wellElementDofName() ); areWellsShut = 0; - integer useTotalMassEquation=Base::wellSolver()->useTotalMassEquation(); integer numCrossflowPerforations=0; if( isThermal ( ) ) { @@ -337,7 +340,7 @@ assembleCouplingTerms( real64 const time_n, resDofNumber, perforationData, fluid, - useTotalMassEquation, + kernelFlags, detectCrossflow, numCrossflowPerforations, localRhs, @@ -355,7 +358,7 @@ assembleCouplingTerms( real64 const time_n, resDofNumber, perforationData, fluid, - useTotalMassEquation, + kernelFlags, detectCrossflow, numCrossflowPerforations, localRhs, diff --git a/src/coreComponents/physicsSolvers/multiphysics/CoupledReservoirAndWellKernels.hpp b/src/coreComponents/physicsSolvers/multiphysics/CoupledReservoirAndWellKernels.hpp index 5fdb80fdf6..d1d7a13181 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/CoupledReservoirAndWellKernels.hpp +++ b/src/coreComponents/physicsSolvers/multiphysics/CoupledReservoirAndWellKernels.hpp @@ -306,7 +306,7 @@ class IsothermalCompositionalMultiPhaseFluxKernelFactory ElementRegionManager::ElementViewConst< arrayView1d< globalIndex const > > const resDofNumber, PerforationData const * const perforationData, MultiFluidBase const & fluid, - integer const & useTotalMassEquation, + BitFlags< isothermalCompositionalMultiphaseBaseKernels::KernelFlags > kernelFlags, bool const & detectCrossflow, integer & numCrossFlowPerforations, arrayView1d< real64 > const & localRhs, @@ -317,16 +317,9 @@ class IsothermalCompositionalMultiPhaseFluxKernelFactory { integer constexpr NUM_COMP = NC(); - - BitFlags< isothermalCompositionalMultiphaseBaseKernels::KernelFlags > kernelFlags; - if( useTotalMassEquation ) - kernelFlags.set( isothermalCompositionalMultiphaseBaseKernels::KernelFlags::TotalMassEquation ); - - using kernelType = IsothermalCompositionalMultiPhaseFluxKernel< NUM_COMP, 0 >; - - - kernelType kernel( dt, rankOffset, wellDofKey, subRegion, resDofNumber, perforationData, fluid, localRhs, localMatrix, detectCrossflow, numCrossFlowPerforations, kernelFlags ); + kernelType kernel( dt, rankOffset, wellDofKey, subRegion, resDofNumber, perforationData, + fluid, localRhs, localMatrix, detectCrossflow, numCrossFlowPerforations, kernelFlags ); kernelType::template launch< POLICY >( perforationData->size(), kernel ); } ); @@ -559,7 +552,7 @@ class ThermalCompositionalMultiPhaseFluxKernelFactory ElementRegionManager::ElementViewConst< arrayView1d< globalIndex const > > const resDofNumber, PerforationData const * const perforationData, MultiFluidBase const & fluid, - integer const & useTotalMassEquation, + BitFlags< isothermalCompositionalMultiphaseBaseKernels::KernelFlags > kernelFlags, bool const & detectCrossflow, integer & numCrossFlowPerforations, arrayView1d< real64 > const & localRhs, @@ -570,16 +563,9 @@ class ThermalCompositionalMultiPhaseFluxKernelFactory { integer constexpr NUM_COMP = NC(); - - BitFlags< isothermalCompositionalMultiphaseBaseKernels::KernelFlags > kernelFlags; - if( useTotalMassEquation ) - kernelFlags.set( isothermalCompositionalMultiphaseBaseKernels::KernelFlags::TotalMassEquation ); - - using kernelType = ThermalCompositionalMultiPhaseFluxKernel< NUM_COMP, 1 >; - - - kernelType kernel( dt, isProducer, rankOffset, wellDofKey, subRegion, resDofNumber, perforationData, fluid, localRhs, localMatrix, detectCrossflow, numCrossFlowPerforations, kernelFlags ); + kernelType kernel( dt, isProducer, rankOffset, wellDofKey, subRegion, resDofNumber, perforationData, + fluid, localRhs, localMatrix, detectCrossflow, numCrossFlowPerforations, kernelFlags ); kernelType::template launch< POLICY >( perforationData->size(), kernel ); } );