diff --git a/src/coreComponents/constitutive/fluid/multifluid/MultiFluidFields.hpp b/src/coreComponents/constitutive/fluid/multifluid/MultiFluidFields.hpp index bc47e09d759..c241ec6a981 100644 --- a/src/coreComponents/constitutive/fluid/multifluid/MultiFluidFields.hpp +++ b/src/coreComponents/constitutive/fluid/multifluid/MultiFluidFields.hpp @@ -207,6 +207,14 @@ DECLARE_FIELD( dTotalDensity, NO_WRITE, "Derivative of total density with respect to pressure, temperature, and global component fractions" ); +DECLARE_FIELD( kValues, + "kValues", + array4dLayoutPhaseComp, + 0, + NOPLOT, + WRITE_AND_READ, + "Phase equilibrium ratios" ); + } } diff --git a/src/coreComponents/constitutive/fluid/multifluid/compositional/CompositionalMultiphaseFluid.cpp b/src/coreComponents/constitutive/fluid/multifluid/compositional/CompositionalMultiphaseFluid.cpp index 493c92db612..10546245b8c 100644 --- a/src/coreComponents/constitutive/fluid/multifluid/compositional/CompositionalMultiphaseFluid.cpp +++ b/src/coreComponents/constitutive/fluid/multifluid/compositional/CompositionalMultiphaseFluid.cpp @@ -27,20 +27,6 @@ namespace geos { -namespace fields -{ -namespace multifluid -{ -DECLARE_FIELD( kValues, - "kValues", - array4dLayoutPhaseComp, - 0, - NOPLOT, - WRITE_AND_READ, - "Phase equilibrium ratios" ); -} -} - namespace constitutive { diff --git a/src/coreComponents/constitutiveDrivers/fluid/multiFluid/PVTDriver.cpp b/src/coreComponents/constitutiveDrivers/fluid/multiFluid/PVTDriver.cpp index 56cece6e149..822b0340e2e 100644 --- a/src/coreComponents/constitutiveDrivers/fluid/multiFluid/PVTDriver.cpp +++ b/src/coreComponents/constitutiveDrivers/fluid/multiFluid/PVTDriver.cpp @@ -110,7 +110,7 @@ void PVTDriver::postInputInitialization() // get number of phases and components - constitutive::MultiFluidBase & baseFluid = getFluid(); + MultiFluidBase & baseFluid = getFluid(); m_numPhases = baseFluid.numFluidPhases(); m_numComponents = baseFluid.numFluidComponents(); @@ -185,7 +185,7 @@ bool PVTDriver::execute( real64 const GEOS_UNUSED_PARAM( time_n ), // get the fluid out of the constitutive manager. // for the moment it is of type MultiFluidBase. - constitutive::MultiFluidBase & baseFluid = getFluid(); + MultiFluidBase & baseFluid = getFluid(); // depending on logLevel, print some useful info @@ -361,7 +361,7 @@ void PVTDriver::compareWithBaseline() file.close(); } -constitutive::MultiFluidBase & +MultiFluidBase & PVTDriver::getFluid() { ConstitutiveManager & constitutiveManager = this->getGroupByPath< ConstitutiveManager >( "/Problem/domain/Constitutive" ); diff --git a/src/coreComponents/constitutiveDrivers/fluid/multiFluid/reactive/ReactiveFluidDriver.cpp b/src/coreComponents/constitutiveDrivers/fluid/multiFluid/reactive/ReactiveFluidDriver.cpp index 1d0259bcd5c..666480455e3 100644 --- a/src/coreComponents/constitutiveDrivers/fluid/multiFluid/reactive/ReactiveFluidDriver.cpp +++ b/src/coreComponents/constitutiveDrivers/fluid/multiFluid/reactive/ReactiveFluidDriver.cpp @@ -222,7 +222,7 @@ void ReactiveFluidDriver::runTest( FLUID_TYPE & fluid, arrayView2d< real64 > con } TableFunction const * waterDensityTable = - constitutive::PVTProps::PureWaterProperties::makeSaturationDensityTable( "helpTable", FunctionManager::getInstance() ); + PVTProps::PureWaterProperties::makeSaturationDensityTable( "helpTable", FunctionManager::getInstance() ); TableFunction::KernelWrapper waterDensityTableWrapper = waterDensityTable->createKernelWrapper(); @@ -242,7 +242,7 @@ void ReactiveFluidDriver::runTest( FLUID_TYPE & fluid, arrayView2d< real64 > con // convert molarity to molefraction real64 const input[2] = { table( n, PRES ), table( n, TEMP ) }; real64 const conversionFactor = - constitutive::PVTProps::PureWaterProperties::MOLECULAR_WEIGHT / waterDensityTableWrapper.compute( input ) * 1e3; + PVTProps::PureWaterProperties::MOLECULAR_WEIGHT / waterDensityTableWrapper.compute( input ) * 1e3; for( int i = 0; i < numPrimarySpecies; ++i ) { composition[0][i] = primarySpeciesTotalConcentration[0][i] * conversionFactor; diff --git a/src/coreComponents/constitutiveDrivers/relativePermeability/RelpermDriver.cpp b/src/coreComponents/constitutiveDrivers/relativePermeability/RelpermDriver.cpp index 06085a50861..2fc424845e7 100644 --- a/src/coreComponents/constitutiveDrivers/relativePermeability/RelpermDriver.cpp +++ b/src/coreComponents/constitutiveDrivers/relativePermeability/RelpermDriver.cpp @@ -89,10 +89,10 @@ void RelpermDriver::outputResults() void RelpermDriver::postInputInitialization() { - constitutive::ConstitutiveManager - & constitutiveManager = this->getGroupByPath< constitutive::ConstitutiveManager >( "/Problem/domain/Constitutive" ); - constitutive::RelativePermeabilityBase - & baseRelperm = constitutiveManager.getGroup< constitutive::RelativePermeabilityBase >( m_relpermName ); + ConstitutiveManager + & constitutiveManager = this->getGroupByPath< ConstitutiveManager >( "/Problem/domain/Constitutive" ); + RelativePermeabilityBase + & baseRelperm = constitutiveManager.getGroup< RelativePermeabilityBase >( m_relpermName ); m_numPhases = baseRelperm.numFluidPhases(); @@ -112,10 +112,10 @@ bool RelpermDriver::execute( const geos::real64 GEOS_UNUSED_PARAM( time_n ), GEOS_THROW_IF( MpiWrapper::commRank() > 0, "RelpermDriver should only be run in serial", std::runtime_error ); - constitutive::ConstitutiveManager - & constitutiveManager = this->getGroupByPath< constitutive::ConstitutiveManager >( "/Problem/domain/Constitutive" ); - constitutive::RelativePermeabilityBase - & baseRelperm = constitutiveManager.getGroup< constitutive::RelativePermeabilityBase >( m_relpermName ); + ConstitutiveManager + & constitutiveManager = this->getGroupByPath< ConstitutiveManager >( "/Problem/domain/Constitutive" ); + RelativePermeabilityBase + & baseRelperm = constitutiveManager.getGroup< RelativePermeabilityBase >( m_relpermName ); if( getLogLevel() > 0 ) { @@ -165,12 +165,12 @@ bool RelpermDriver::execute( const geos::real64 GEOS_UNUSED_PARAM( time_n ), template< typename RELPERM_TYPE > void RelpermDriver::resizeTables() { - constitutive::ConstitutiveManager - & constitutiveManager = this->getGroupByPath< constitutive::ConstitutiveManager >( "/Problem/domain/Constitutive" ); - constitutive::RelativePermeabilityBase - & baseRelperm = constitutiveManager.getGroup< constitutive::RelativePermeabilityBase >( m_relpermName ); + ConstitutiveManager + & constitutiveManager = this->getGroupByPath< ConstitutiveManager >( "/Problem/domain/Constitutive" ); + RelativePermeabilityBase + & baseRelperm = constitutiveManager.getGroup< RelativePermeabilityBase >( m_relpermName ); - using PT = constitutive::RelativePermeabilityBase::PhaseType; + using PT = RelativePermeabilityBase::PhaseType; integer const ipWater = baseRelperm.getPhaseOrder()[PT::WATER]; integer const ipOil = baseRelperm.getPhaseOrder()[PT::OIL]; integer const ipGas = baseRelperm.getPhaseOrder()[PT::GAS]; @@ -246,7 +246,7 @@ void RelpermDriver::resizeTables() template< typename RELPERM_TYPE > -std::enable_if_t< std::is_same< constitutive::TableRelativePermeabilityHysteresis, RELPERM_TYPE >::value, void > +std::enable_if_t< std::is_same< TableRelativePermeabilityHysteresis, RELPERM_TYPE >::value, void > RelpermDriver::resizeTable() { if( m_numPhases > 2 ) @@ -261,7 +261,7 @@ RelpermDriver::resizeTable() } template< typename RELPERM_TYPE > -std::enable_if_t< !std::is_same< constitutive::TableRelativePermeabilityHysteresis, RELPERM_TYPE >::value, void > +std::enable_if_t< !std::is_same< TableRelativePermeabilityHysteresis, RELPERM_TYPE >::value, void > RelpermDriver::resizeTable() { if( m_numPhases > 2 ) diff --git a/src/coreComponents/fieldSpecification/FieldSpecificationManager.cpp b/src/coreComponents/fieldSpecification/FieldSpecificationManager.cpp index 94bbe9ea443..f48add8aa41 100644 --- a/src/coreComponents/fieldSpecification/FieldSpecificationManager.cpp +++ b/src/coreComponents/fieldSpecification/FieldSpecificationManager.cpp @@ -24,7 +24,7 @@ namespace geos FieldSpecificationManager * FieldSpecificationManager::m_instance = nullptr; using namespace dataRepository; -using namespace constitutive; + FieldSpecificationManager::FieldSpecificationManager( string const & name, Group * const parent ): Group( name, parent ) { @@ -97,14 +97,14 @@ void FieldSpecificationManager::validateBoundaryConditions( MeshLevel & mesh ) c // Step 2: apply the boundary condition - fs.apply< dataRepository::Group >( mesh, - [&]( FieldSpecificationBase const &, - string const & setName, - SortedArrayView< localIndex const > const & targetSet, - Group & targetGroup, - string const fieldName ) + fs.apply< Group >( mesh, + [&]( FieldSpecificationBase const &, + string const & setName, + SortedArrayView< localIndex const > const & targetSet, + Group & targetGroup, + string const fieldName ) { - dataRepository::InputFlags const flag = fs.getWrapper< string >( FieldSpecificationBase::viewKeyStruct::fieldNameString() ).getInputFlag(); + InputFlags const flag = fs.getWrapper< string >( FieldSpecificationBase::viewKeyStruct::fieldNameString() ).getInputFlag(); // 2.a) If we enter this loop, we know that the set has been created // Fracture/fault sets are created later and the "apply" call silently ignores them @@ -219,12 +219,12 @@ void FieldSpecificationManager::applyInitialConditions( MeshLevel & mesh ) const { if( fs.initialCondition() ) { - fs.apply< dataRepository::Group >( mesh, - [&]( FieldSpecificationBase const & bc, - string const &, - SortedArrayView< localIndex const > const & targetSet, - Group & targetGroup, - string const fieldName ) + fs.apply< Group >( mesh, + [&]( FieldSpecificationBase const & bc, + string const &, + SortedArrayView< localIndex const > const & targetSet, + Group & targetGroup, + string const fieldName ) { bc.applyFieldValue< FieldSpecificationEqual >( targetSet, 0.0, targetGroup, fieldName ); } ); diff --git a/src/coreComponents/fileIO/silo/SiloFile.cpp b/src/coreComponents/fileIO/silo/SiloFile.cpp index 7c5b6b1fa17..2ee7ab3ee36 100644 --- a/src/coreComponents/fileIO/silo/SiloFile.cpp +++ b/src/coreComponents/fileIO/silo/SiloFile.cpp @@ -235,12 +235,9 @@ template<> int GetTensorRank< string >() return DB_VARTYPE_SCALAR; } - - } - using namespace constitutive; using namespace dataRepository; @@ -264,7 +261,7 @@ SiloFile::SiloFile(): m_writeFaceMesh( 0 ), m_writeCellElementMesh( 1 ), m_writeFaceElementMesh( 1 ), - m_plotLevel( dataRepository::PlotLevel::LEVEL_1 ), + m_plotLevel( PlotLevel::LEVEL_1 ), m_requireFieldRegistrationCheck( true ), m_ghostFlags( true ) { @@ -1223,7 +1220,7 @@ void SiloFile::writeElementRegionSilo( ElementRegionBase const & elemRegion, { // TODO: This is a hack. conduit::Node conduitNode; - dataRepository::Group fakeGroup( elemRegion.getName(), conduitNode ); + Group fakeGroup( elemRegion.getName(), conduitNode ); localIndex numElems = 0; std::vector< std::map< string, WrapperBase const * > > viewPointers; @@ -1454,12 +1451,12 @@ void SiloFile::writeElementMesh( ElementRegionBase const & elementRegion, } ); string_array - regionSolidMaterialList = elementRegion.getConstitutiveNames< constitutive::SolidBase >(); + regionSolidMaterialList = elementRegion.getConstitutiveNames< SolidBase >(); localIndex const numSolids = regionSolidMaterialList.size(); - string_array regionFluidMaterialList = elementRegion.getConstitutiveNames< constitutive::SingleFluidBase >(); - string_array regionMultiPhaseFluidList = elementRegion.getConstitutiveNames< constitutive::MultiFluidBase >(); + string_array regionFluidMaterialList = elementRegion.getConstitutiveNames< SingleFluidBase >(); + string_array regionMultiPhaseFluidList = elementRegion.getConstitutiveNames< MultiFluidBase >(); for( string const & matName : regionMultiPhaseFluidList ) { @@ -1468,12 +1465,12 @@ void SiloFile::writeElementMesh( ElementRegionBase const & elementRegion, localIndex const numFluids = regionFluidMaterialList.size(); string_array - fractureContactMaterialList = elementRegion.getConstitutiveNames< constitutive::FrictionBase >(); + fractureContactMaterialList = elementRegion.getConstitutiveNames< FrictionBase >(); localIndex const numContacts = fractureContactMaterialList.size(); string_array - nullModelMaterialList = elementRegion.getConstitutiveNames< constitutive::NullModel >(); + nullModelMaterialList = elementRegion.getConstitutiveNames< NullModel >(); localIndex const numNullModels = nullModelMaterialList.size(); @@ -2010,7 +2007,7 @@ int getTensorRankOfArray( ArrayView< TYPE const, NDIM, USD > const & field ) template< typename OUTPUTTYPE > void SiloFile::writeWrappersToSilo( string const & meshname, - const dataRepository::Group::wrapperMap & wrappers, + const Group::wrapperMap & wrappers, int const centering, int const cycleNum, real64 const problemTime, @@ -2034,13 +2031,13 @@ void SiloFile::writeWrappersToSilo( string const & meshname, // TODO This is wrong. problem with uniqueness if( typeID==typeid(array1d< real64 >) ) { - auto const & wrapperT = dynamic_cast< dataRepository::Wrapper< array1d< real64 > > const & >( *wrapper ); + auto const & wrapperT = dynamic_cast< Wrapper< array1d< real64 > > const & >( *wrapper ); this->writeDataField< real64 >( meshname.c_str(), fieldName, wrapperT.reference(), centering, cycleNum, problemTime, multiRoot ); } if( typeID==typeid(array2d< real64 >) ) { - auto const & wrapperT = dynamic_cast< dataRepository::Wrapper< array2d< real64 > > const & >( *wrapper ); + auto const & wrapperT = dynamic_cast< Wrapper< array2d< real64 > > const & >( *wrapper ); arrayView2d< real64 const > const & array = wrapperT.reference(); this->writeDataField< real64 >( meshname.c_str(), @@ -2056,7 +2053,7 @@ void SiloFile::writeWrappersToSilo( string const & meshname, } if( typeID==typeid(array2d< real64, RAJA::PERM_JI >) ) { - auto const & wrapperT = dynamic_cast< dataRepository::Wrapper< array2d< real64, RAJA::PERM_JI > > const & >( *wrapper ); + auto const & wrapperT = dynamic_cast< Wrapper< array2d< real64, RAJA::PERM_JI > > const & >( *wrapper ); arrayView2d< real64 const, LvArray::typeManipulation::getStrideOneDimension( RAJA::PERM_JI {} ) > const & array = wrapperT.reference(); @@ -2072,25 +2069,25 @@ void SiloFile::writeWrappersToSilo( string const & meshname, } if( typeID==typeid(array3d< real64 >) ) { - auto const & wrapperT = dynamic_cast< dataRepository::Wrapper< array3d< real64 > > const & >( *wrapper ); + auto const & wrapperT = dynamic_cast< Wrapper< array3d< real64 > > const & >( *wrapper ); this->writeDataField< real64 >( meshname.c_str(), fieldName, wrapperT.reference(), centering, cycleNum, problemTime, multiRoot ); } if( typeID==typeid(integer_array) ) { - auto const & wrapperT = dynamic_cast< dataRepository::Wrapper< integer_array > const & >( *wrapper ); + auto const & wrapperT = dynamic_cast< Wrapper< integer_array > const & >( *wrapper ); this->writeDataField< integer >( meshname.c_str(), fieldName, wrapperT.reference(), centering, cycleNum, problemTime, multiRoot ); } if( typeID==typeid(localIndex_array) ) { - auto const & wrapperT = dynamic_cast< dataRepository::Wrapper< localIndex_array > const & >( *wrapper ); + auto const & wrapperT = dynamic_cast< Wrapper< localIndex_array > const & >( *wrapper ); this->writeDataField< localIndex >( meshname.c_str(), fieldName, wrapperT.reference(), centering, cycleNum, problemTime, multiRoot ); } if( typeID==typeid(globalIndex_array) ) { - auto const & wrapperT = dynamic_cast< dataRepository::Wrapper< globalIndex_array > const & >( *wrapper ); + auto const & wrapperT = dynamic_cast< Wrapper< globalIndex_array > const & >( *wrapper ); this->writeDataField< globalIndex >( meshname.c_str(), fieldName, wrapperT.reference(), centering, cycleNum, problemTime, multiRoot ); } @@ -3195,7 +3192,7 @@ int SiloFile::getMeshType( string const & meshName ) const return meshType; } -bool SiloFile::isFieldPlotEnabled( dataRepository::WrapperBase const & wrapper ) const +bool SiloFile::isFieldPlotEnabled( WrapperBase const & wrapper ) const { return outputUtilities::isFieldPlotEnabled( wrapper.getPlotLevel(), m_plotLevel, diff --git a/src/coreComponents/mainInterface/ProblemManager.cpp b/src/coreComponents/mainInterface/ProblemManager.cpp index 890f550c752..5017972f7b8 100644 --- a/src/coreComponents/mainInterface/ProblemManager.cpp +++ b/src/coreComponents/mainInterface/ProblemManager.cpp @@ -61,7 +61,7 @@ using namespace dataRepository; using namespace constitutive; ProblemManager::ProblemManager( conduit::Node & root ): - dataRepository::Group( dataRepository::keys::ProblemManager, root ), + Group( keys::ProblemManager, root ), m_physicsSolverManager( nullptr ), m_eventManager( nullptr ), m_functionManager( nullptr ), @@ -960,7 +960,7 @@ map< std::tuple< string, string, string, string >, localIndex > ProblemManager:: finiteElement::FiniteElementBase & fe = subRegion.template registerWrapper< finiteElement::FiniteElementBase >( discretizationName, std::move( newFE ) ). - setRestartFlags( dataRepository::RestartFlags::NO_WRITE ).reference(); + setRestartFlags( RestartFlags::NO_WRITE ).reference(); subRegion.excludeWrappersFromPacking( { discretizationName } ); finiteElement::FiniteElementDispatchHandler< ALL_FE_TYPES >::dispatch3D( fe, diff --git a/src/coreComponents/mesh/CellElementSubRegion.cpp b/src/coreComponents/mesh/CellElementSubRegion.cpp index d324b6189c0..ebc636874e3 100644 --- a/src/coreComponents/mesh/CellElementSubRegion.cpp +++ b/src/coreComponents/mesh/CellElementSubRegion.cpp @@ -23,7 +23,6 @@ namespace geos { using namespace dataRepository; -using namespace constitutive; CellElementSubRegion::CellElementSubRegion( string const & name, Group * const parent ): ElementSubRegionBase( name, parent ) diff --git a/src/coreComponents/mesh/ParticleSubRegion.cpp b/src/coreComponents/mesh/ParticleSubRegion.cpp index ea30521dc70..10eb4efef38 100644 --- a/src/coreComponents/mesh/ParticleSubRegion.cpp +++ b/src/coreComponents/mesh/ParticleSubRegion.cpp @@ -22,7 +22,6 @@ namespace geos { using namespace dataRepository; -using namespace constitutive; ParticleSubRegion::ParticleSubRegion( string const & name, Group * const parent ): ParticleSubRegionBase( name, parent ) diff --git a/src/coreComponents/mesh/ParticleSubRegionBase.cpp b/src/coreComponents/mesh/ParticleSubRegionBase.cpp index 829f1f4a376..6ee20d9bc2b 100644 --- a/src/coreComponents/mesh/ParticleSubRegionBase.cpp +++ b/src/coreComponents/mesh/ParticleSubRegionBase.cpp @@ -24,7 +24,6 @@ namespace geos { using namespace dataRepository; -using namespace constitutive; ParticleSubRegionBase::ParticleSubRegionBase( string const & name, Group * const parent ): ObjectManagerBase( name, parent ), diff --git a/src/coreComponents/physicsSolvers/PhysicsSolverBase.hpp b/src/coreComponents/physicsSolvers/PhysicsSolverBase.hpp index 95a87f1a87f..c033d251647 100644 --- a/src/coreComponents/physicsSolvers/PhysicsSolverBase.hpp +++ b/src/coreComponents/physicsSolvers/PhysicsSolverBase.hpp @@ -23,6 +23,7 @@ #include "codingUtilities/traits.hpp" #include "common/DataTypes.hpp" #include "dataRepository/ExecutableGroup.hpp" +#include "dataRepository/RestartFlags.hpp" #include "linearAlgebra/interfaces/InterfaceTypes.hpp" #include "linearAlgebra/utilities/LinearSolverResult.hpp" #include "linearAlgebra/DofManager.hpp" @@ -951,6 +952,16 @@ class PhysicsSolverBase : public ExecutableGroup template< typename CONSTITUTIVE_BASE_TYPE > static string getConstitutiveName( ParticleSubRegionBase const & subRegion ); // particle overload + /** + * @brief Register wrapper with given name and store constitutive model name on the subregion + * + * @tparam CONSTITUTIVE_BASE_TYPE the base type of the constitutive model. + * @param subRegion the subregion on which the constitutive model is registered + * @param name the name of the constitutive model of type CONSTITUTIVE_BASE_TYPE registered on the subregion. + */ + template< typename CONSTITUTIVE_BASE_TYPE > + void setConstitutiveName( ElementSubRegionBase & subRegion, string const & name ) const; + /** * @brief This function sets constitutive name fields on an * ElementSubRegionBase, and calls the base function it overrides. @@ -990,6 +1001,29 @@ class PhysicsSolverBase : public ExecutableGroup return constitutiveModels.getGroup< BASETYPE >( key ); } + /** + * @brief Get the Constitutive Model object + * @tparam BASETYPE the base type of the constitutive model. + * @param subRegion the element subregion on which the constitutive model is registered. + * @return the constitutive model of type @p CONSTITUTIVE_TYPE registered on the @p subRegion. + */ + template< typename CONSTITUTIVE_TYPE > + static CONSTITUTIVE_TYPE const & getConstitutiveModel( ElementSubRegionBase const & subRegion ) + { + return getConstitutiveModel< CONSTITUTIVE_TYPE >( subRegion, getConstitutiveName< CONSTITUTIVE_TYPE >( subRegion ) ); + } + + /** + * @brief Get the Constitutive Model object + * @tparam CONSTITUTIVE_TYPE the base type of the constitutive model. + * @param subRegion the element subregion on which the constitutive model is registered. + * @return the constitutive model of type @p CONSTITUTIVE_TYPE registered on the @p subRegion. + */ + template< typename CONSTITUTIVE_TYPE > + static CONSTITUTIVE_TYPE & getConstitutiveModel( ElementSubRegionBase & subRegion ) + { + return getConstitutiveModel< CONSTITUTIVE_TYPE >( subRegion, getConstitutiveName< CONSTITUTIVE_TYPE >( subRegion ) ); + } /// Courant–Friedrichs–Lewy factor for the timestep @@ -1100,6 +1134,7 @@ string PhysicsSolverBase::getConstitutiveName( ElementSubRegionBase const & subR GEOS_ERROR_IF( !validName.empty(), "A valid constitutive model was already found." ); validName = model.getName(); } ); + return validName; } @@ -1117,6 +1152,18 @@ string PhysicsSolverBase::getConstitutiveName( ParticleSubRegionBase const & sub return validName; } +template< typename CONSTITUTIVE_BASE_TYPE > +void PhysicsSolverBase::setConstitutiveName( ElementSubRegionBase & subRegion, string const & name ) const +{ + string & constitutiveName = subRegion.registerWrapper< string >( name ). + setPlotLevel( dataRepository::PlotLevel::NOPLOT ). + setRestartFlags( dataRepository::RestartFlags::NO_WRITE ). + setSizedFromParent( 0 ). + reference(); + constitutiveName = getConstitutiveName< CONSTITUTIVE_BASE_TYPE >( subRegion ); + GEOS_ERROR_IF( constitutiveName.empty(), GEOS_FMT( "{}: {} not found on subregion {}", + getDataContext(), typeid(CONSTITUTIVE_BASE_TYPE).name(), subRegion.getDataContext() ) ); +} } // namespace geos diff --git a/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseBase.cpp b/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseBase.cpp index c13be912619..674bd61c7f5 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseBase.cpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseBase.cpp @@ -61,6 +61,7 @@ namespace geos using namespace dataRepository; using namespace constitutive; +using namespace fields; CompositionalMultiphaseBase::CompositionalMultiphaseBase( const string & name, Group * const parent ) @@ -228,8 +229,6 @@ void CompositionalMultiphaseBase::postInputInitialization() void CompositionalMultiphaseBase::registerDataOnMesh( Group & meshBodies ) { - using namespace fields::flow; - FlowSolverBase::registerDataOnMesh( meshBodies ); DomainPartition const & domain = this->getGroupByPath< DomainPartition >( "/Problem/domain" ); @@ -250,22 +249,19 @@ void CompositionalMultiphaseBase::registerDataOnMesh( Group & meshBodies ) } // If at least one region has a capillary pressure model, consider it enabled for all - string const capPresName = getConstitutiveName< CapillaryPressureBase >( subRegion ); - if( !capPresName.empty() ) + if( !getConstitutiveName< CapillaryPressureBase >( subRegion ).empty() ) { m_hasCapPressure = true; } // If at least one region has a diffusion model, consider it enabled for all - string const diffusionName = getConstitutiveName< DiffusionBase >( subRegion ); - if( !diffusionName.empty() ) + if( !getConstitutiveName< DiffusionBase >( subRegion ).empty() ) { m_hasDiffusion = true; } // If at least one region has a dispersion model, consider it enabled for all - string const dispersionName = getConstitutiveName< DispersionBase >( subRegion ); - if( !dispersionName.empty() ) + if( !getConstitutiveName< DispersionBase >( subRegion ).empty() ) { GEOS_ERROR( "Dispersion is not supported yet, please remove this model from this XML file" ); m_hasDispersion = true; @@ -274,20 +270,7 @@ void CompositionalMultiphaseBase::registerDataOnMesh( Group & meshBodies ) } ); } ); - // 1. Set key dimensions of the problem - // Check needed to avoid errors when running in schema generation mode. - if( !m_referenceFluidModelName.empty() ) - { - MultiFluidBase const & referenceFluid = cm.getConstitutiveRelation< MultiFluidBase >( m_referenceFluidModelName ); - m_numPhases = referenceFluid.numFluidPhases(); - m_numComponents = referenceFluid.numFluidComponents(); - m_isThermal = referenceFluid.isThermal(); - } - - // n_c components + one pressure ( + one temperature if needed ) - m_numDofPerCell = m_isThermal ? m_numComponents + 2 : m_numComponents + 1; - - // 2. Register and resize all fields as necessary + // check consistency between subregions forDiscretizationOnMeshTargets( meshBodies, [&]( string const &, MeshLevel & mesh, arrayView1d< string const > const & regionNames ) @@ -298,16 +281,7 @@ void CompositionalMultiphaseBase::registerDataOnMesh( Group & meshBodies ) { if( m_hasCapPressure ) { - subRegion.registerWrapper< string >( viewKeyStruct::capPressureNamesString() ). - setPlotLevel( PlotLevel::NOPLOT ). - setRestartFlags( RestartFlags::NO_WRITE ). - setSizedFromParent( 0 ). - setDescription( "Name of the capillary pressure constitutive model to use" ). - reference(); - - string & capPresName = subRegion.getReference< string >( viewKeyStruct::capPressureNamesString() ); - capPresName = getConstitutiveName< CapillaryPressureBase >( subRegion ); - GEOS_THROW_IF( capPresName.empty(), + GEOS_THROW_IF( getConstitutiveName< CapillaryPressureBase >( subRegion ).empty(), GEOS_FMT( "{}: Capillary pressure model not found on subregion {}", getDataContext(), subRegion.getDataContext() ), InputError ); @@ -315,82 +289,92 @@ void CompositionalMultiphaseBase::registerDataOnMesh( Group & meshBodies ) if( m_hasDiffusion ) { - subRegion.registerWrapper< string >( viewKeyStruct::diffusionNamesString() ). - setPlotLevel( PlotLevel::NOPLOT ). - setRestartFlags( RestartFlags::NO_WRITE ). - setSizedFromParent( 0 ). - setDescription( "Name of the diffusion constitutive model to use" ); - - string & diffusionName = subRegion.getReference< string >( viewKeyStruct::diffusionNamesString() ); - diffusionName = getConstitutiveName< DiffusionBase >( subRegion ); - GEOS_THROW_IF( diffusionName.empty(), - GEOS_FMT( "Diffusion model not found on subregion {}", subRegion.getName() ), + GEOS_THROW_IF( getConstitutiveName< DiffusionBase >( subRegion ).empty(), + GEOS_FMT( "{}: Diffusion model not found on subregion {}", + getDataContext(), subRegion.getDataContext() ), InputError ); } if( m_hasDispersion ) { - subRegion.registerWrapper< string >( viewKeyStruct::dispersionNamesString() ). - setPlotLevel( PlotLevel::NOPLOT ). - setRestartFlags( RestartFlags::NO_WRITE ). - setSizedFromParent( 0 ). - setDescription( "Name of the dispersion constitutive model to use" ); - - string & dispersionName = subRegion.getReference< string >( viewKeyStruct::dispersionNamesString() ); - dispersionName = getConstitutiveName< DispersionBase >( subRegion ); - GEOS_THROW_IF( dispersionName.empty(), - GEOS_FMT( "Dispersion model not found on subregion {}", subRegion.getName() ), + GEOS_THROW_IF( getConstitutiveName< DispersionBase >( subRegion ).empty(), + GEOS_FMT( "{}: Dispersion model not found on subregion {}", + getDataContext(), subRegion.getDataContext() ), InputError ); } + } ); + } ); + + // 1. Set key dimensions of the problem + // Check needed to avoid errors when running in schema generation mode. + if( !m_referenceFluidModelName.empty() ) + { + MultiFluidBase const & referenceFluid = cm.getConstitutiveRelation< MultiFluidBase >( m_referenceFluidModelName ); + m_numPhases = referenceFluid.numFluidPhases(); + m_numComponents = referenceFluid.numFluidComponents(); + m_isThermal = referenceFluid.isThermal(); + } + // n_c components + one pressure ( + one temperature if needed ) + m_numDofPerCell = m_isThermal ? m_numComponents + 2 : m_numComponents + 1; + + // 2. Register and resize all fields as necessary + forDiscretizationOnMeshTargets( meshBodies, [&]( string const &, + MeshLevel & mesh, + arrayView1d< string const > const & regionNames ) + { + mesh.getElemManager().forElementSubRegions( regionNames, + [&]( localIndex const, + ElementSubRegionBase & subRegion ) + { string const & fluidName = subRegion.getReference< string >( viewKeyStruct::fluidNamesString() ); MultiFluidBase const & fluid = getConstitutiveModel< MultiFluidBase >( subRegion, fluidName ); - subRegion.registerField< pressureScalingFactor >( getName() ); - subRegion.registerField< temperatureScalingFactor >( getName() ); - subRegion.registerField< globalCompDensityScalingFactor >( getName() ); + subRegion.registerField< flow::pressureScalingFactor >( getName() ); + subRegion.registerField< flow::temperatureScalingFactor >( getName() ); + subRegion.registerField< flow::globalCompDensityScalingFactor >( getName() ); // The resizing of the arrays needs to happen here, before the call to initializePreSubGroups, // to make sure that the dimensions are properly set before the timeHistoryOutput starts its initialization. - subRegion.registerField< globalCompDensity >( getName() ). + subRegion.registerField< flow::globalCompDensity >( getName() ). setDimLabels( 1, fluid.componentNames() ). reference().resizeDimension< 1 >( m_numComponents ); - subRegion.registerField< globalCompDensity_n >( getName() ). + subRegion.registerField< flow::globalCompDensity_n >( getName() ). reference().resizeDimension< 1 >( m_numComponents ); if( m_isFixedStressPoromechanicsUpdate ) { - subRegion.registerField< globalCompDensity_k >( getName() ). + subRegion.registerField< flow::globalCompDensity_k >( getName() ). setDimLabels( 1, fluid.componentNames() ). reference().resizeDimension< 1 >( m_numComponents ); } - subRegion.registerField< globalCompFraction >( getName() ). + subRegion.registerField< flow::globalCompFraction >( getName() ). setDimLabels( 1, fluid.componentNames() ). reference().resizeDimension< 1 >( m_numComponents ); - subRegion.registerField< dGlobalCompFraction_dGlobalCompDensity >( getName() ). + subRegion.registerField< flow::dGlobalCompFraction_dGlobalCompDensity >( getName() ). reference().resizeDimension< 1, 2 >( m_numComponents, m_numComponents ); - subRegion.registerField< phaseVolumeFraction >( getName() ). + subRegion.registerField< flow::phaseVolumeFraction >( getName() ). setDimLabels( 1, fluid.phaseNames() ). reference().resizeDimension< 1 >( m_numPhases ); - subRegion.registerField< dPhaseVolumeFraction >( getName() ). + subRegion.registerField< flow::dPhaseVolumeFraction >( getName() ). reference().resizeDimension< 1, 2 >( m_numPhases, m_numComponents + 2 ); // dP, dT, dC - subRegion.registerField< phaseMobility >( getName() ). + subRegion.registerField< flow::phaseMobility >( getName() ). setDimLabels( 1, fluid.phaseNames() ). reference().resizeDimension< 1 >( m_numPhases ); - subRegion.registerField< dPhaseMobility >( getName() ). + subRegion.registerField< flow::dPhaseMobility >( getName() ). reference().resizeDimension< 1, 2 >( m_numPhases, m_numComponents + 2 ); // dP, dT, dC // needed for time step selector - subRegion.registerField< phaseVolumeFraction_n >( getName() ). + subRegion.registerField< flow::phaseVolumeFraction_n >( getName() ). reference().resizeDimension< 1 >( m_numPhases ); - subRegion.registerField< compAmount >( getName() ). + subRegion.registerField< flow::compAmount >( getName() ). setDimLabels( 1, fluid.componentNames() ). reference().resizeDimension< 1 >( m_numComponents ); - subRegion.registerField< compAmount_n >( getName() ). + subRegion.registerField< flow::compAmount_n >( getName() ). setDimLabels( 1, fluid.componentNames() ). reference().resizeDimension< 1 >( m_numComponents ); @@ -402,9 +386,8 @@ void CompositionalMultiphaseBase::registerDataOnMesh( Group & meshBodies ) MultiFluidBase const & fluid0 = cm.getConstitutiveRelation< MultiFluidBase >( m_referenceFluidModelName ); // TODO: add conditional registration later, this is only needed when there is a face-based Dirichlet BC - faceManager.registerField< facePressure >( getName() ); - faceManager.registerField< faceTemperature >( getName() ); - faceManager.registerField< faceGlobalCompFraction >( getName() ). + faceManager.registerField< flow::faceTemperature >( getName() ); + faceManager.registerField< flow::faceGlobalCompFraction >( getName() ). setDimLabels( 1, fluid0.componentNames() ). reference().resizeDimension< 1 >( m_numComponents ); } @@ -413,41 +396,28 @@ void CompositionalMultiphaseBase::registerDataOnMesh( Group & meshBodies ) void CompositionalMultiphaseBase::setConstitutiveNames( ElementSubRegionBase & subRegion ) const { - string & fluidName = subRegion.getReference< string >( viewKeyStruct::fluidNamesString() ); - fluidName = getConstitutiveName< MultiFluidBase >( subRegion ); - GEOS_THROW_IF( fluidName.empty(), - GEOS_FMT( "{}: multiphase fluid model not found on subregion {}", - getDataContext(), subRegion.getDataContext() ), - InputError ); - - string & relPermName = subRegion.registerWrapper< string >( viewKeyStruct::relPermNamesString() ). - setPlotLevel( PlotLevel::NOPLOT ). - setRestartFlags( RestartFlags::NO_WRITE ). - setSizedFromParent( 0 ). - setDescription( "Name of the relative permeability constitutive model to use" ). - reference(); - - relPermName = getConstitutiveName< RelativePermeabilityBase >( subRegion ); - - GEOS_THROW_IF( relPermName.empty(), - GEOS_FMT( "{}: Relative permeability model not found on subregion {}", - getDataContext(), subRegion.getDataContext() ), - InputError ); + setConstitutiveName< MultiFluidBase >( subRegion, viewKeyStruct::fluidNamesString() ); + + setConstitutiveName< RelativePermeabilityBase >( subRegion, viewKeyStruct::relPermNamesString() ); + + if( !getConstitutiveName< CapillaryPressureBase >( subRegion ).empty() ) + { + setConstitutiveName< CapillaryPressureBase >( subRegion, viewKeyStruct::capPressureNamesString() ); + } + + if( !getConstitutiveName< DiffusionBase >( subRegion ).empty() ) + { + setConstitutiveName< DiffusionBase >( subRegion, viewKeyStruct::diffusionNamesString() ); + } + + if( !getConstitutiveName< DispersionBase >( subRegion ).empty() ) + { + setConstitutiveName< DispersionBase >( subRegion, viewKeyStruct::dispersionNamesString() ); + } if( m_isThermal ) { - string & thermalConductivityName = subRegion.registerWrapper< string >( viewKeyStruct::thermalConductivityNamesString() ). - setPlotLevel( PlotLevel::NOPLOT ). - setRestartFlags( RestartFlags::NO_WRITE ). - setSizedFromParent( 0 ). - setDescription( "Name of the thermal conductivity constitutive model to use" ). - reference(); - - thermalConductivityName = getConstitutiveName< MultiPhaseThermalConductivityBase >( subRegion ); - GEOS_THROW_IF( thermalConductivityName.empty(), - GEOS_FMT( "{}: Thermal conductivity model not found on subregion {}", - getDataContext(), subRegion.getDataContext() ), - InputError ); + setConstitutiveName< MultiPhaseThermalConductivityBase >( subRegion, viewKeyStruct::thermalConductivityNamesString() ); } } @@ -544,7 +514,7 @@ void CompositionalMultiphaseBase::initializePreSubGroups() [&]( localIndex const, ElementSubRegionBase & subRegion ) { - arrayView1d< real64 > const temp = subRegion.getField< fields::flow::temperature >(); + arrayView1d< real64 > const temp = subRegion.getField< flow::temperature >(); temp.setValues< parallelHostPolicy >( m_inputTemperature ); } ); } ); @@ -570,7 +540,6 @@ void CompositionalMultiphaseBase::validateConstitutiveModels( DomainPartition co [&]( localIndex const, ElementSubRegionBase const & subRegion ) { - string const & fluidName = subRegion.getReference< string >( viewKeyStruct::fluidNamesString() ); MultiFluidBase const & fluid = getConstitutiveModel< MultiFluidBase >( subRegion, fluidName ); compareMultiphaseModels( fluid, referenceFluid ); @@ -654,10 +623,10 @@ void CompositionalMultiphaseBase::updateFluidModel( ObjectManagerBase & dataGrou { GEOS_MARK_FUNCTION; - arrayView1d< real64 const > const pres = dataGroup.getField< fields::flow::pressure >(); - arrayView1d< real64 const > const temp = dataGroup.getField< fields::flow::temperature >(); + arrayView1d< real64 const > const pres = dataGroup.getField< flow::pressure >(); + arrayView1d< real64 const > const temp = dataGroup.getField< flow::temperature >(); arrayView2d< real64 const, compflow::USD_COMP > const compFrac = - dataGroup.getField< fields::flow::globalCompFraction >(); + dataGroup.getField< flow::globalCompFraction >(); string const & fluidName = dataGroup.getReference< string >( viewKeyStruct::fluidNamesString() ); MultiFluidBase & fluid = getConstitutiveModel< MultiFluidBase >( dataGroup, fluidName ); @@ -683,7 +652,7 @@ void CompositionalMultiphaseBase::updateRelPermModel( ObjectManagerBase & dataGr GEOS_MARK_FUNCTION; arrayView2d< real64 const, compflow::USD_PHASE > const phaseVolFrac = - dataGroup.getField< fields::flow::phaseVolumeFraction >(); + dataGroup.getField< flow::phaseVolumeFraction >(); string const & relPermName = dataGroup.getReference< string >( viewKeyStruct::relPermNamesString() ); RelativePermeabilityBase & relPerm = getConstitutiveModel< RelativePermeabilityBase >( dataGroup, relPermName ); @@ -707,7 +676,7 @@ void CompositionalMultiphaseBase::updateCapPressureModel( ObjectManagerBase & da if( m_hasCapPressure ) { arrayView2d< real64 const, compflow::USD_PHASE > const phaseVolFrac = - dataGroup.getField< fields::flow::phaseVolumeFraction >(); + dataGroup.getField< flow::phaseVolumeFraction >(); string const & cappresName = dataGroup.getReference< string >( viewKeyStruct::capPressureNamesString() ); CapillaryPressureBase & capPressure = getConstitutiveModel< CapillaryPressureBase >( dataGroup, cappresName ); @@ -733,8 +702,8 @@ void CompositionalMultiphaseBase::updateCompAmount( ElementSubRegionBase & subRe CoupledSolidBase const & porousMaterial = getConstitutiveModel< CoupledSolidBase >( subRegion, solidName ); arrayView2d< real64 const > const porosity = porousMaterial.getPorosity(); arrayView1d< real64 const > const volume = subRegion.getElementVolume(); - arrayView2d< real64 const, compflow::USD_COMP > const compDens = subRegion.getField< fields::flow::globalCompDensity >(); - arrayView2d< real64, compflow::USD_COMP > const compAmount = subRegion.getField< fields::flow::compAmount >(); + arrayView2d< real64 const, compflow::USD_COMP > const compDens = subRegion.getField< flow::globalCompDensity >(); + arrayView2d< real64, compflow::USD_COMP > const compAmount = subRegion.getField< flow::compAmount >(); integer const numComp = m_numComponents; @@ -756,13 +725,13 @@ void CompositionalMultiphaseBase::updateEnergy( ElementSubRegionBase & subRegion arrayView2d< real64 const > const porosity = porousMaterial.getPorosity(); arrayView2d< real64 const > rockInternalEnergy = porousMaterial.getInternalEnergy(); arrayView1d< real64 const > const volume = subRegion.getElementVolume(); - arrayView2d< real64 const, compflow::USD_PHASE > const phaseVolFrac = subRegion.getField< fields::flow::phaseVolumeFraction >(); - string const & fluidName = getConstitutiveName< MultiFluidBase >( subRegion ); + arrayView2d< real64 const, compflow::USD_PHASE > const phaseVolFrac = subRegion.getField< flow::phaseVolumeFraction >(); + string const & fluidName = subRegion.getReference< string >( viewKeyStruct::fluidNamesString() ); MultiFluidBase & fluid = subRegion.getConstitutiveModel< MultiFluidBase >( fluidName ); - arrayView3d< real64 const, multifluid::USD_PHASE > const phaseDens = fluid.phaseDensity(); - arrayView3d< real64 const, multifluid::USD_PHASE > const phaseInternalEnergy = fluid.phaseInternalEnergy(); + arrayView3d< real64 const, constitutive::multifluid::USD_PHASE > const phaseDens = fluid.phaseDensity(); + arrayView3d< real64 const, constitutive::multifluid::USD_PHASE > const phaseInternalEnergy = fluid.phaseInternalEnergy(); - arrayView1d< real64 > const energy = subRegion.getField< fields::flow::energy >(); + arrayView1d< real64 > const energy = subRegion.getField< flow::energy >(); integer const numPhases = m_numPhases; @@ -778,7 +747,7 @@ void CompositionalMultiphaseBase::updateEnergy( ElementSubRegionBase & subRegion void CompositionalMultiphaseBase::updateSolidInternalEnergyModel( ObjectManagerBase & dataGroup ) const { - arrayView1d< real64 const > const temp = dataGroup.getField< fields::flow::temperature >(); + arrayView1d< real64 const > const temp = dataGroup.getField< flow::temperature >(); string const & solidInternalEnergyName = dataGroup.getReference< string >( viewKeyStruct::solidInternalEnergyNamesString() ); SolidInternalEnergy & solidInternalEnergy = getConstitutiveModel< SolidInternalEnergy >( dataGroup, solidInternalEnergyName ); @@ -830,11 +799,11 @@ void CompositionalMultiphaseBase::initializeFluidState( MeshLevel & mesh, // in order to initialize the primary solution variables string const & fluidName = subRegion.template getReference< string >( viewKeyStruct::fluidNamesString() ); MultiFluidBase const & fluid = getConstitutiveModel< MultiFluidBase >( subRegion, fluidName ); - arrayView2d< real64 const, multifluid::USD_FLUID > const totalDens = fluid.totalDensity(); + arrayView2d< real64 const, constitutive::multifluid::USD_FLUID > const totalDens = fluid.totalDensity(); arrayView2d< real64 const, compflow::USD_COMP > const compFrac = - subRegion.getField< fields::flow::globalCompFraction >(); + subRegion.getField< flow::globalCompFraction >(); arrayView2d< real64, compflow::USD_COMP > const compDens = - subRegion.getField< fields::flow::globalCompDensity >(); + subRegion.getField< flow::globalCompDensity >(); forAll< parallelDevicePolicy<> >( subRegion.size(), [=] GEOS_HOST_DEVICE ( localIndex const ei ) { @@ -871,7 +840,7 @@ void CompositionalMultiphaseBase::initializeFluidState( MeshLevel & mesh, // initialized phase volume fraction arrayView2d< real64 const, compflow::USD_PHASE > const phaseVolFrac = - subRegion.template getField< fields::flow::phaseVolumeFraction >(); + subRegion.template getField< flow::phaseVolumeFraction >(); // Initialize/update the relative permeability model using the initial phase volume fraction // Note: @@ -920,7 +889,7 @@ void CompositionalMultiphaseBase::initializeFluidState( MeshLevel & mesh, { string const & diffusionName = subRegion.template getReference< string >( viewKeyStruct::diffusionNamesString() ); DiffusionBase const & diffusionMaterial = getConstitutiveModel< DiffusionBase >( subRegion, diffusionName ); - arrayView1d< real64 const > const temperature = subRegion.template getField< fields::flow::temperature >(); + arrayView1d< real64 const > const temperature = subRegion.template getField< flow::temperature >(); diffusionMaterial.initializeTemperatureState( temperature ); } if( m_hasDispersion ) @@ -948,7 +917,7 @@ void CompositionalMultiphaseBase::initializeThermalState( MeshLevel & mesh, arra // initialized phase volume fraction arrayView2d< real64 const, compflow::USD_PHASE > const phaseVolFrac = - subRegion.template getField< fields::flow::phaseVolumeFraction >(); + subRegion.template getField< flow::phaseVolumeFraction >(); string const & thermalConductivityName = subRegion.template getReference< string >( viewKeyStruct::thermalConductivityNamesString()); MultiPhaseThermalConductivityBase const & conductivityMaterial = @@ -1092,6 +1061,7 @@ void CompositionalMultiphaseBase::computeHydrostaticEquilibrium( DomainPartition { return; // the region is not in target, there is nothing to do } + string const & fluidName = subRegion.getReference< string >( viewKeyStruct::fluidNamesString() ); MultiFluidBase & fluid = getConstitutiveModel< MultiFluidBase >( subRegion, fluidName ); @@ -1176,10 +1146,10 @@ void CompositionalMultiphaseBase::computeHydrostaticEquilibrium( DomainPartition arrayView2d< real64 const > const elemCenter = subRegion.getReference< array2d< real64 > >( ElementSubRegionBase::viewKeyStruct::elementCenterString() ); - arrayView1d< real64 > const pres = subRegion.getReference< array1d< real64 > >( fields::flow::pressure::key() ); - arrayView1d< real64 > const temp = subRegion.getReference< array1d< real64 > >( fields::flow::temperature::key() ); + arrayView1d< real64 > const pres = subRegion.getReference< array1d< real64 > >( flow::pressure::key() ); + arrayView1d< real64 > const temp = subRegion.getReference< array1d< real64 > >( flow::temperature::key() ); arrayView2d< real64, compflow::USD_COMP > const compFrac = - subRegion.getReference< array2d< real64, compflow::LAYOUT_COMP > >( fields::flow::globalCompFraction::key() ); + subRegion.getReference< array2d< real64, compflow::LAYOUT_COMP > >( flow::globalCompFraction::key() ); arrayView1d< TableFunction::KernelWrapper const > compFracTableWrappersViewConst = compFracTableWrappers.toViewConst(); @@ -1228,7 +1198,7 @@ void CompositionalMultiphaseBase::initializePostInitialConditionsPreSubGroups() arrayView1d< string const > const & regionNames ) { FieldIdentifiers fieldsToBeSync; - fieldsToBeSync.addElementFields( { fields::flow::globalCompDensity::key() }, + fieldsToBeSync.addElementFields( { flow::globalCompDensity::key() }, regionNames ); CommunicationTools::getInstance().synchronizeFields( fieldsToBeSync, mesh, domain.getNeighbors(), false ); @@ -1275,9 +1245,9 @@ CompositionalMultiphaseBase::implicitStepSetup( real64 const & GEOS_UNUSED_PARAM // after the update, save the new saturation arrayView2d< real64 const, compflow::USD_PHASE > const phaseVolFrac = - subRegion.template getField< fields::flow::phaseVolumeFraction >(); + subRegion.template getField< flow::phaseVolumeFraction >(); arrayView2d< real64, compflow::USD_PHASE > const phaseVolFrac_n = - subRegion.template getField< fields::flow::phaseVolumeFraction_n >(); + subRegion.template getField< flow::phaseVolumeFraction_n >(); phaseVolFrac_n.setValues< parallelDevicePolicy<> >( phaseVolFrac ); } ); @@ -1607,7 +1577,7 @@ bool CompositionalMultiphaseBase::validateDirichletBC( DomainPartition & domain, // 1. Check pressure Dirichlet BCs fsManager.apply< ElementSubRegionBase >( time, mesh, - fields::flow::pressure::key(), + flow::pressure::key(), [&]( FieldSpecificationBase const &, string const & setName, SortedArrayView< localIndex const > const &, @@ -1623,7 +1593,7 @@ bool CompositionalMultiphaseBase::validateDirichletBC( DomainPartition & domain, { bcConsistent = false; GEOS_WARNING( BCMessage::pressureConflict( regionName, subRegionName, setName, - fields::flow::pressure::key() ) ); + flow::pressure::key() ) ); } subRegionSetMap[setName].setNumComp( m_numComponents ); } ); @@ -1633,7 +1603,7 @@ bool CompositionalMultiphaseBase::validateDirichletBC( DomainPartition & domain, { fsManager.apply< ElementSubRegionBase >( time, mesh, - fields::flow::temperature::key(), + flow::temperature::key(), [&]( FieldSpecificationBase const &, string const & setName, SortedArrayView< localIndex const > const &, @@ -1649,7 +1619,7 @@ bool CompositionalMultiphaseBase::validateDirichletBC( DomainPartition & domain, { bcConsistent = false; GEOS_WARNING( BCMessage::temperatureConflict( regionName, subRegionName, setName, - fields::flow::temperature::key() ) ); + flow::temperature::key() ) ); } tempSubRegionSetMap.insert( setName ); } ); @@ -1658,7 +1628,7 @@ bool CompositionalMultiphaseBase::validateDirichletBC( DomainPartition & domain, // 3. Check composition BC (global component fraction) fsManager.apply< ElementSubRegionBase >( time, mesh, - fields::flow::globalCompFraction::key(), + flow::globalCompFraction::key(), [&] ( FieldSpecificationBase const & fs, string const & setName, SortedArrayView< localIndex const > const &, @@ -1675,7 +1645,7 @@ bool CompositionalMultiphaseBase::validateDirichletBC( DomainPartition & domain, { bcConsistent = false; GEOS_WARNING( BCMessage::missingPressure( regionName, subRegionName, setName, - fields::flow::pressure::key() ) ); + flow::pressure::key() ) ); } if( m_isThermal ) { @@ -1684,14 +1654,14 @@ bool CompositionalMultiphaseBase::validateDirichletBC( DomainPartition & domain, { bcConsistent = false; GEOS_WARNING( BCMessage::missingTemperature( regionName, subRegionName, setName, - fields::flow::temperature::key() ) ); + flow::temperature::key() ) ); } } if( comp < 0 || comp >= m_numComponents ) { bcConsistent = false; GEOS_WARNING( BCMessage::invalidComponentIndex( comp, fs.getName(), - fields::flow::globalCompFraction::key() ) ); + flow::globalCompFraction::key() ) ); return; // can't check next part with invalid component id } @@ -1704,7 +1674,7 @@ bool CompositionalMultiphaseBase::validateDirichletBC( DomainPartition & domain, arrayView1d< string const > componentNames = bc.getComponentNames(); GEOS_WARNING( BCMessage::conflictingComposition( comp, componentNames[comp], regionName, subRegionName, setName, - fields::flow::globalCompFraction::key() ) ); + flow::globalCompFraction::key() ) ); } ); } compMask.set( comp ); @@ -1730,7 +1700,7 @@ bool CompositionalMultiphaseBase::validateDirichletBC( DomainPartition & domain, bcConsistent = false; GEOS_WARNING( BCMessage::notAppliedOnRegion( ic, componentNames[ic], regionEntry.first, subRegionEntry.first, setEntry.first, - fields::flow::globalCompFraction::key() ) ); + flow::globalCompFraction::key() ) ); } } } ); @@ -1767,15 +1737,15 @@ void CompositionalMultiphaseBase::applyDirichletBC( real64 const time_n, // 1. Apply pressure Dirichlet BCs, store in a separate field applyFieldValue< ElementSubRegionBase >( time_n, dt, mesh, bcLogMessage, - fields::flow::pressure::key(), fields::flow::bcPressure::key() ); + flow::pressure::key(), flow::bcPressure::key() ); // 2. Apply composition BC (global component fraction) and store them for constitutive call applyFieldValue< ElementSubRegionBase >( time_n, dt, mesh, bcLogMessage, - fields::flow::globalCompFraction::key(), fields::flow::globalCompFraction::key() ); + flow::globalCompFraction::key(), flow::globalCompFraction::key() ); // 3. Apply temperature Dirichlet BCs, store in a separate field if( m_isThermal ) { applyFieldValue< ElementSubRegionBase >( time_n, dt, mesh, bcLogMessage, - fields::flow::temperature::key(), fields::flow::bcTemperature::key() ); + flow::temperature::key(), flow::bcTemperature::key() ); } globalIndex const rankOffset = dofManager.rankOffset(); @@ -1784,7 +1754,7 @@ void CompositionalMultiphaseBase::applyDirichletBC( real64 const time_n, // 4. Call constitutive update, back-calculate target global component densities and apply to the system fsManager.apply< ElementSubRegionBase >( time_n + dt, mesh, - fields::flow::pressure::key(), + flow::pressure::key(), [&] ( FieldSpecificationBase const &, string const &, SortedArrayView< localIndex const > const & targetSet, @@ -1796,14 +1766,14 @@ void CompositionalMultiphaseBase::applyDirichletBC( real64 const time_n, // in the isothermal case, we use the reservoir temperature to enforce the boundary condition // in the thermal case, the validation function guarantees that temperature has been provided - string const temperatureKey = m_isThermal ? fields::flow::bcTemperature::key() : fields::flow::temperature::key(); + string const temperatureKey = m_isThermal ? flow::bcTemperature::key() : flow::temperature::key(); arrayView1d< real64 const > const bcPres = - subRegion.getReference< array1d< real64 > >( fields::flow::bcPressure::key() ); + subRegion.getReference< array1d< real64 > >( flow::bcPressure::key() ); arrayView1d< real64 const > const bcTemp = subRegion.getReference< array1d< real64 > >( temperatureKey ); arrayView2d< real64 const, compflow::USD_COMP > const compFrac = - subRegion.getReference< array2d< real64, compflow::LAYOUT_COMP > >( fields::flow::globalCompFraction::key() ); + subRegion.getReference< array2d< real64, compflow::LAYOUT_COMP > >( flow::globalCompFraction::key() ); constitutiveUpdatePassThru( fluid, [&] ( auto & castedFluid ) { @@ -1825,10 +1795,10 @@ void CompositionalMultiphaseBase::applyDirichletBC( real64 const time_n, arrayView1d< globalIndex const > const dofNumber = subRegion.getReference< array1d< globalIndex > >( dofKey ); arrayView1d< real64 const > const pres = - subRegion.getReference< array1d< real64 > >( fields::flow::pressure::key() ); + subRegion.getReference< array1d< real64 > >( flow::pressure::key() ); arrayView2d< real64 const, compflow::USD_COMP > const compDens = - subRegion.getReference< array2d< real64, compflow::LAYOUT_COMP > >( fields::flow::globalCompDensity::key() ); - arrayView2d< real64 const, multifluid::USD_FLUID > const totalDens = fluid.totalDensity(); + subRegion.getReference< array2d< real64, compflow::LAYOUT_COMP > >( flow::globalCompDensity::key() ); + arrayView2d< real64 const, constitutive::multifluid::USD_FLUID > const totalDens = fluid.totalDensity(); integer const numComp = m_numComponents; forAll< parallelDevicePolicy<> >( targetSet.size(), [=] GEOS_HOST_DEVICE ( localIndex const a ) @@ -1871,7 +1841,7 @@ void CompositionalMultiphaseBase::applyDirichletBC( real64 const time_n, { fsManager.apply< ElementSubRegionBase >( time_n + dt, mesh, - fields::flow::temperature::key(), + flow::temperature::key(), [&] ( FieldSpecificationBase const &, string const &, SortedArrayView< localIndex const > const & targetSet, @@ -1883,9 +1853,9 @@ void CompositionalMultiphaseBase::applyDirichletBC( real64 const time_n, arrayView1d< globalIndex const > const dofNumber = subRegion.getReference< array1d< globalIndex > >( dofKey ); arrayView1d< real64 const > const bcTemp = - subRegion.getReference< array1d< real64 > >( fields::flow::bcTemperature::key() ); + subRegion.getReference< array1d< real64 > >( flow::bcTemperature::key() ); arrayView1d< real64 const > const temp = - subRegion.getReference< array1d< real64 > >( fields::flow::temperature::key() ); + subRegion.getReference< array1d< real64 > >( flow::temperature::key() ); integer const numComp = m_numComponents; forAll< parallelDevicePolicy<> >( targetSet.size(), [=] GEOS_HOST_DEVICE ( localIndex const a ) @@ -1939,9 +1909,9 @@ void CompositionalMultiphaseBase::keepVariablesConstantDuringInitStep( real64 co arrayView1d< integer const > const ghostRank = subRegion.ghostRank(); arrayView1d< globalIndex const > const dofNumber = subRegion.getReference< array1d< globalIndex > >( dofKey ); - arrayView1d< real64 const > const pres = subRegion.getField< fields::flow::pressure >(); - arrayView1d< real64 const > const temp = subRegion.getField< fields::flow::temperature >(); - arrayView2d< real64 const, compflow::USD_COMP > const compDens = subRegion.getField< fields::flow::globalCompDensity >(); + arrayView1d< real64 const > const pres = subRegion.getField< flow::pressure >(); + arrayView1d< real64 const > const temp = subRegion.getField< flow::temperature >(); + arrayView2d< real64 const, compflow::USD_COMP > const compDens = subRegion.getField< flow::globalCompDensity >(); integer const numComp = m_numComponents; integer const isThermal = m_isThermal; @@ -2020,7 +1990,7 @@ void CompositionalMultiphaseBase::chopNegativeDensities( ElementSubRegionBase & arrayView1d< integer const > const ghostRank = subRegion.ghostRank(); arrayView2d< real64, compflow::USD_COMP > const compDens = - subRegion.getField< fields::flow::globalCompDensity >(); + subRegion.getField< flow::globalCompDensity >(); forAll< parallelDevicePolicy<> >( subRegion.size(), [=] GEOS_HOST_DEVICE ( localIndex const ei ) { @@ -2066,18 +2036,18 @@ real64 CompositionalMultiphaseBase::setNextDtBasedOnStateChange( real64 const & { arrayView1d< integer const > const ghostRank = subRegion.ghostRank(); - arrayView1d< real64 const > const pres = subRegion.getField< fields::flow::pressure >(); - arrayView1d< real64 const > const pres_n = subRegion.getField< fields::flow::pressure_n >(); - arrayView1d< real64 const > const temp = subRegion.getField< fields::flow::temperature >(); - arrayView1d< real64 const > const temp_n = subRegion.getField< fields::flow::temperature_n >(); + arrayView1d< real64 const > const pres = subRegion.getField< flow::pressure >(); + arrayView1d< real64 const > const pres_n = subRegion.getField< flow::pressure_n >(); + arrayView1d< real64 const > const temp = subRegion.getField< flow::temperature >(); + arrayView1d< real64 const > const temp_n = subRegion.getField< flow::temperature_n >(); arrayView2d< real64 const, compflow::USD_PHASE > const phaseVolFrac = - subRegion.getField< fields::flow::phaseVolumeFraction >(); + subRegion.getField< flow::phaseVolumeFraction >(); arrayView2d< real64 const, compflow::USD_PHASE > const phaseVolFrac_n = - subRegion.getField< fields::flow::phaseVolumeFraction_n >(); + subRegion.getField< flow::phaseVolumeFraction_n >(); arrayView2d< real64 const, compflow::USD_COMP > const compDens = - subRegion.getField< fields::flow::globalCompDensity >(); + subRegion.getField< flow::globalCompDensity >(); arrayView2d< real64, compflow::USD_COMP > const compDens_n = - subRegion.getField< fields::flow::globalCompDensity_n >(); + subRegion.getField< flow::globalCompDensity_n >(); RAJA::ReduceMax< parallelDeviceReduce, real64 > subRegionMaxPresChange( 0.0 ); RAJA::ReduceMax< parallelDeviceReduce, real64 > subRegionMaxTempChange( 0.0 ); @@ -2176,23 +2146,23 @@ void CompositionalMultiphaseBase::resetStateToBeginningOfStep( DomainPartition & auto & subRegion ) { arrayView1d< real64 > const & pres = - subRegion.template getField< fields::flow::pressure >(); + subRegion.template getField< flow::pressure >(); arrayView1d< real64 const > const & pres_n = - subRegion.template getField< fields::flow::pressure_n >(); + subRegion.template getField< flow::pressure_n >(); pres.setValues< parallelDevicePolicy<> >( pres_n ); arrayView2d< real64, compflow::USD_COMP > const & compDens = - subRegion.template getField< fields::flow::globalCompDensity >(); + subRegion.template getField< flow::globalCompDensity >(); arrayView2d< real64 const, compflow::USD_COMP > const & compDens_n = - subRegion.template getField< fields::flow::globalCompDensity_n >(); + subRegion.template getField< flow::globalCompDensity_n >(); compDens.setValues< parallelDevicePolicy<> >( compDens_n ); if( m_isThermal ) { arrayView1d< real64 > const & temp = - subRegion.template getField< fields::flow::temperature >(); + subRegion.template getField< flow::temperature >(); arrayView1d< real64 const > const & temp_n = - subRegion.template getField< fields::flow::temperature_n >(); + subRegion.template getField< flow::temperature_n >(); temp.setValues< parallelDevicePolicy<> >( temp_n ); } @@ -2228,9 +2198,9 @@ void CompositionalMultiphaseBase::implicitStepComplete( real64 const & time, ElementSubRegionBase & subRegion ) { // update deltaPressure - arrayView1d< real64 const > const pres = subRegion.getField< fields::flow::pressure >(); - arrayView1d< real64 const > const initPres = subRegion.getField< fields::flow::initialPressure >(); - arrayView1d< real64 > const deltaPres = subRegion.getField< fields::flow::deltaPressure >(); + arrayView1d< real64 const > const pres = subRegion.getField< flow::pressure >(); + arrayView1d< real64 const > const initPres = subRegion.getField< flow::initialPressure >(); + arrayView1d< real64 > const deltaPres = subRegion.getField< flow::deltaPressure >(); isothermalCompositionalMultiphaseBaseKernels::StatisticsKernel:: saveDeltaPressure< parallelDevicePolicy<> >( subRegion.size(), pres, initPres, deltaPres ); @@ -2253,7 +2223,7 @@ void CompositionalMultiphaseBase::implicitStepComplete( real64 const & time, // Step 4: save converged state for the relperm model to handle hysteresis arrayView2d< real64 const, compflow::USD_PHASE > const phaseVolFrac = - subRegion.getField< fields::flow::phaseVolumeFraction >(); + subRegion.getField< flow::phaseVolumeFraction >(); string const & relPermName = subRegion.getReference< string >( viewKeyStruct::relPermNamesString() ); RelativePermeabilityBase const & relPermMaterial = getConstitutiveModel< RelativePermeabilityBase >( subRegion, relPermName ); @@ -2288,12 +2258,12 @@ void CompositionalMultiphaseBase::implicitStepComplete( real64 const & time, thermalConductivityMaterial.saveConvergedRockFluidState( porosity, phaseVolFrac ); } - // Step 7: if the diffusion and/or dispersion is/are supported, update the two models explicity + // Step 7: if the diffusion and/or dispersion is/are supported, update the two models explicitly if( m_hasDiffusion ) { string const & diffusionName = subRegion.getReference< string >( viewKeyStruct::diffusionNamesString() ); DiffusionBase const & diffusionMaterial = getConstitutiveModel< DiffusionBase >( subRegion, diffusionName ); - arrayView1d< real64 const > const temperature = subRegion.template getField< fields::flow::temperature >(); + arrayView1d< real64 const > const temperature = subRegion.template getField< flow::temperature >(); diffusionMaterial.saveConvergedTemperatureState( temperature ); } if( m_hasDispersion ) @@ -2313,21 +2283,21 @@ void CompositionalMultiphaseBase::saveConvergedState( ElementSubRegionBase & sub FlowSolverBase::saveConvergedState( subRegion ); arrayView2d< real64 const, compflow::USD_COMP > const & compDens = - subRegion.template getField< fields::flow::globalCompDensity >(); + subRegion.template getField< flow::globalCompDensity >(); arrayView2d< real64, compflow::USD_COMP > const & compDens_n = - subRegion.template getField< fields::flow::globalCompDensity_n >(); + subRegion.template getField< flow::globalCompDensity_n >(); compDens_n.setValues< parallelDevicePolicy<> >( compDens ); arrayView2d< real64 const, compflow::USD_COMP > const & compAmount = - subRegion.template getField< fields::flow::compAmount >(); + subRegion.template getField< flow::compAmount >(); arrayView2d< real64, compflow::USD_COMP > const & compAmount_n = - subRegion.template getField< fields::flow::compAmount_n >(); + subRegion.template getField< flow::compAmount_n >(); compAmount_n.setValues< parallelDevicePolicy<> >( compAmount ); if( m_isFixedStressPoromechanicsUpdate ) { arrayView2d< real64, compflow::USD_COMP > const & compDens_k = - subRegion.template getField< fields::flow::globalCompDensity_k >(); + subRegion.template getField< flow::globalCompDensity_k >(); compDens_k.setValues< parallelDevicePolicy<> >( compDens ); } } @@ -2350,9 +2320,9 @@ void CompositionalMultiphaseBase::saveSequentialIterationState( DomainPartition arrayView1d< integer const > const ghostRank = subRegion.ghostRank(); arrayView2d< real64 const, compflow::USD_COMP > - const compDens = subRegion.getField< fields::flow::globalCompDensity >(); + const compDens = subRegion.getField< flow::globalCompDensity >(); arrayView2d< real64, compflow::USD_COMP > - const compDens_k = subRegion.getField< fields::flow::globalCompDensity_k >(); + const compDens_k = subRegion.getField< flow::globalCompDensity_k >(); RAJA::ReduceMax< parallelDeviceReduce, real64 > subRegionMaxCompDensChange( 0.0 ); diff --git a/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseFVM.cpp b/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseFVM.cpp index 67ee8bf2f9a..e3626c4b05b 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseFVM.cpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseFVM.cpp @@ -61,6 +61,7 @@ namespace geos using namespace dataRepository; using namespace constitutive; +using namespace fields; using namespace compositionalMultiphaseUtilities; // for ScalingType CompositionalMultiphaseFVM::CompositionalMultiphaseFVM( const string & name, @@ -129,8 +130,6 @@ void CompositionalMultiphaseFVM::postInputInitialization() void CompositionalMultiphaseFVM::registerDataOnMesh( Group & meshBodies ) { - using namespace fields::flow; - CompositionalMultiphaseBase::registerDataOnMesh( meshBodies ); if( m_targetFlowCFL > 0 ) @@ -149,10 +148,10 @@ void CompositionalMultiphaseFVM::registerDataForCFL( Group & meshBodies ) [&]( localIndex const, ElementSubRegionBase & subRegion ) { - subRegion.registerField< fields::flow::phaseOutflux >( getName()).reference().resizeDimension< 1 >( m_numPhases ); - subRegion.registerField< fields::flow::componentOutflux >( getName()).reference().resizeDimension< 1 >( m_numComponents ); - subRegion.registerField< fields::flow::phaseCFLNumber >( getName()); - subRegion.registerField< fields::flow::componentCFLNumber >( getName()); + subRegion.registerField< flow::phaseOutflux >( getName()).reference().resizeDimension< 1 >( m_numPhases ); + subRegion.registerField< flow::componentOutflux >( getName()).reference().resizeDimension< 1 >( m_numComponents ); + subRegion.registerField< flow::phaseCFLNumber >( getName()); + subRegion.registerField< flow::componentCFLNumber >( getName()); } ); } ); } @@ -557,12 +556,12 @@ real64 CompositionalMultiphaseFVM::scalingForSystemSolution( DomainPartition & d ElementSubRegionBase & subRegion ) { arrayView1d< globalIndex const > const localToGlobalMap = subRegion.localToGlobalMap(); - arrayView1d< real64 const > const pressure = subRegion.getField< fields::flow::pressure >(); - arrayView1d< real64 const > const temperature = subRegion.getField< fields::flow::temperature >(); - arrayView2d< real64 const, compflow::USD_COMP > const compDens = subRegion.getField< fields::flow::globalCompDensity >(); - arrayView1d< real64 > pressureScalingFactor = subRegion.getField< fields::flow::pressureScalingFactor >(); - arrayView1d< real64 > temperatureScalingFactor = subRegion.getField< fields::flow::temperatureScalingFactor >(); - arrayView1d< real64 > compDensScalingFactor = subRegion.getField< fields::flow::globalCompDensityScalingFactor >(); + arrayView1d< real64 const > const pressure = subRegion.getField< flow::pressure >(); + arrayView1d< real64 const > const temperature = subRegion.getField< flow::temperature >(); + arrayView2d< real64 const, compflow::USD_COMP > const compDens = subRegion.getField< flow::globalCompDensity >(); + arrayView1d< real64 > pressureScalingFactor = subRegion.getField< flow::pressureScalingFactor >(); + arrayView1d< real64 > temperatureScalingFactor = subRegion.getField< flow::temperatureScalingFactor >(); + arrayView1d< real64 > compDensScalingFactor = subRegion.getField< flow::globalCompDensityScalingFactor >(); const integer temperatureOffset = m_numComponents+1; @@ -700,14 +699,14 @@ bool CompositionalMultiphaseFVM::checkSystemSolution( DomainPartition & domain, ElementSubRegionBase & subRegion ) { arrayView1d< real64 const > const pressure = - subRegion.getField< fields::flow::pressure >(); + subRegion.getField< flow::pressure >(); arrayView1d< real64 const > const temperature = - subRegion.getField< fields::flow::temperature >(); + subRegion.getField< flow::temperature >(); arrayView2d< real64 const, compflow::USD_COMP > const compDens = - subRegion.getField< fields::flow::globalCompDensity >(); - arrayView1d< real64 > pressureScalingFactor = subRegion.getField< fields::flow::pressureScalingFactor >(); - arrayView1d< real64 > temperatureScalingFactor = subRegion.getField< fields::flow::temperatureScalingFactor >(); - arrayView1d< real64 > compDensScalingFactor = subRegion.getField< fields::flow::globalCompDensityScalingFactor >(); + subRegion.getField< flow::globalCompDensity >(); + arrayView1d< real64 > pressureScalingFactor = subRegion.getField< flow::pressureScalingFactor >(); + arrayView1d< real64 > temperatureScalingFactor = subRegion.getField< flow::temperatureScalingFactor >(); + arrayView1d< real64 > compDensScalingFactor = subRegion.getField< flow::globalCompDensityScalingFactor >(); // check that pressure and component densities are non-negative // for thermal, check that temperature is above 273.15 K const integer temperatureOffset = m_numComponents+1; @@ -796,15 +795,15 @@ void CompositionalMultiphaseFVM::applySystemSolution( DofManager const & dofMana { dofManager.addVectorToField( localSolution, viewKeyStruct::elemDofFieldString(), - fields::flow::pressure::key(), - fields::flow::pressureScalingFactor::key(), + flow::pressure::key(), + flow::pressureScalingFactor::key(), pressureMask ); } else { dofManager.addVectorToField( localSolution, viewKeyStruct::elemDofFieldString(), - fields::flow::pressure::key(), + flow::pressure::key(), scalingFactor, pressureMask ); } @@ -813,15 +812,15 @@ void CompositionalMultiphaseFVM::applySystemSolution( DofManager const & dofMana { dofManager.addVectorToField( localSolution, viewKeyStruct::elemDofFieldString(), - fields::flow::globalCompDensity::key(), - fields::flow::globalCompDensityScalingFactor::key(), + flow::globalCompDensity::key(), + flow::globalCompDensityScalingFactor::key(), componentMask ); } else { dofManager.addVectorToField( localSolution, viewKeyStruct::elemDofFieldString(), - fields::flow::globalCompDensity::key(), + flow::globalCompDensity::key(), scalingFactor, componentMask ); } @@ -833,15 +832,15 @@ void CompositionalMultiphaseFVM::applySystemSolution( DofManager const & dofMana { dofManager.addVectorToField( localSolution, viewKeyStruct::elemDofFieldString(), - fields::flow::temperature::key(), - fields::flow::temperatureScalingFactor::key(), + flow::temperature::key(), + flow::temperatureScalingFactor::key(), temperatureMask ); } else { dofManager.addVectorToField( localSolution, viewKeyStruct::elemDofFieldString(), - fields::flow::temperature::key(), + flow::temperature::key(), scalingFactor, temperatureMask ); } @@ -858,10 +857,10 @@ void CompositionalMultiphaseFVM::applySystemSolution( DofManager const & dofMana MeshLevel & mesh, arrayView1d< string const > const & regionNames ) { - std::vector< string > fields{ fields::flow::pressure::key(), fields::flow::globalCompDensity::key() }; + std::vector< string > fields{ flow::pressure::key(), flow::globalCompDensity::key() }; if( m_isThermal ) { - fields.emplace_back( fields::flow::temperature::key() ); + fields.emplace_back( flow::temperature::key() ); } FieldIdentifiers fieldsToBeSync; fieldsToBeSync.addElementFields( fields, regionNames ); @@ -939,7 +938,7 @@ bool CompositionalMultiphaseFVM::validateFaceDirichletBC( DomainPartition & doma // 1. Check pressure Dirichlet BCs fsManager.apply< FaceManager >( time, mesh, - fields::flow::pressure::key(), + flow::pressure::key(), [&]( FieldSpecificationBase const &, string const & setName, SortedArrayView< localIndex const > const &, @@ -958,7 +957,7 @@ bool CompositionalMultiphaseFVM::validateFaceDirichletBC( DomainPartition & doma // 2. Check temperature Dirichlet BCs (we always require a temperature for face-based BCs) fsManager.apply< FaceManager >( time, mesh, - fields::flow::temperature::key(), + flow::temperature::key(), [&]( FieldSpecificationBase const &, string const & setName, SortedArrayView< localIndex const > const &, @@ -984,7 +983,7 @@ bool CompositionalMultiphaseFVM::validateFaceDirichletBC( DomainPartition & doma // 3. Check composition BC (global component fraction) fsManager.apply< FaceManager >( time, mesh, - fields::flow::globalCompFraction::key(), + flow::globalCompFraction::key(), [&] ( FieldSpecificationBase const & fs, string const & setName, SortedArrayView< localIndex const > const &, @@ -1086,18 +1085,18 @@ void CompositionalMultiphaseFVM::applyFaceDirichletBC( real64 const time_n, // Take BCs defined for "pressure" field and apply values to "facePressure" applyFieldValue< FaceManager >( time_n, dt, mesh, faceBcLogMessage, - fields::flow::pressure::key(), fields::flow::facePressure::key() ); + flow::pressure::key(), flow::facePressure::key() ); // Take BCs defined for "globalCompFraction" field and apply values to "faceGlobalCompFraction" applyFieldValue< FaceManager >( time_n, dt, mesh, faceBcLogMessage, - fields::flow::globalCompFraction::key(), fields::flow::faceGlobalCompFraction::key() ); + flow::globalCompFraction::key(), flow::faceGlobalCompFraction::key() ); // Take BCs defined for "temperature" field and apply values to "faceTemperature" applyFieldValue< FaceManager >( time_n, dt, mesh, faceBcLogMessage, - fields::flow::temperature::key(), fields::flow::faceTemperature::key() ); + flow::temperature::key(), flow::faceTemperature::key() ); // Then launch the face Dirichlet kernel fsManager.apply< FaceManager >( time_n + dt, mesh, - fields::flow::pressure::key(), // we have required that pressure is always present + flow::pressure::key(), // we have required that pressure is always present [&] ( FieldSpecificationBase const &, string const & setName, SortedArrayView< localIndex const > const &, @@ -1240,12 +1239,12 @@ void CompositionalMultiphaseFVM::applyAquiferBC( real64 const time, aquiferWaterPhaseDens, aquiferWaterPhaseCompFrac, compFlowAccessors.get( fields::ghostRank{} ), - compFlowAccessors.get( fields::flow::pressure{} ), - compFlowAccessors.get( fields::flow::pressure_n{} ), - compFlowAccessors.get( fields::flow::gravityCoefficient{} ), - compFlowAccessors.get( fields::flow::phaseVolumeFraction{} ), - compFlowAccessors.get( fields::flow::dPhaseVolumeFraction{} ), - compFlowAccessors.get( fields::flow::dGlobalCompFraction_dGlobalCompDensity{} ), + compFlowAccessors.get( flow::pressure{} ), + compFlowAccessors.get( flow::pressure_n{} ), + compFlowAccessors.get( flow::gravityCoefficient{} ), + compFlowAccessors.get( flow::phaseVolumeFraction{} ), + compFlowAccessors.get( flow::dPhaseVolumeFraction{} ), + compFlowAccessors.get( flow::dGlobalCompFraction_dGlobalCompDensity{} ), multiFluidAccessors.get( fields::multifluid::phaseDensity{} ), multiFluidAccessors.get( fields::multifluid::dPhaseDensity{} ), multiFluidAccessors.get( fields::multifluid::phaseCompFraction{} ), @@ -1380,9 +1379,9 @@ void CompositionalMultiphaseFVM::computeCFLNumbers( geos::DomainPartition & doma ElementSubRegionBase & subRegion ) { arrayView2d< real64, compflow::USD_PHASE > const & phaseOutflux = - subRegion.getField< fields::flow::phaseOutflux >(); + subRegion.getField< flow::phaseOutflux >(); arrayView2d< real64, compflow::USD_COMP > const & compOutflux = - subRegion.getField< fields::flow::componentOutflux >(); + subRegion.getField< flow::componentOutflux >(); phaseOutflux.zero(); compOutflux.zero(); } ); @@ -1404,11 +1403,11 @@ void CompositionalMultiphaseFVM::computeCFLNumbers( geos::DomainPartition & doma // TODO: find a way to compile with this modifiable accessors in CompFlowAccessors, and remove them from here ElementRegionManager::ElementViewAccessor< arrayView2d< real64, compflow::USD_PHASE > > const phaseOutfluxAccessor = mesh.getElemManager().constructViewAccessor< array2d< real64, compflow::LAYOUT_PHASE >, - arrayView2d< real64, compflow::USD_PHASE > >( fields::flow::phaseOutflux::key() ); + arrayView2d< real64, compflow::USD_PHASE > >( flow::phaseOutflux::key() ); ElementRegionManager::ElementViewAccessor< arrayView2d< real64, compflow::USD_COMP > > const compOutfluxAccessor = mesh.getElemManager().constructViewAccessor< array2d< real64, compflow::LAYOUT_COMP >, - arrayView2d< real64, compflow::USD_COMP > >( fields::flow::componentOutflux::key() ); + arrayView2d< real64, compflow::USD_COMP > >( flow::componentOutflux::key() ); fluxApprox.forAllStencils( mesh, [&] ( auto & stencil ) @@ -1422,11 +1421,11 @@ void CompositionalMultiphaseFVM::computeCFLNumbers( geos::DomainPartition & doma m_gravityDensityScheme == GravityDensityScheme::PhasePresence, dt, stencilWrapper, - compFlowAccessors.get( fields::flow::pressure{} ), - compFlowAccessors.get( fields::flow::gravityCoefficient{} ), - compFlowAccessors.get( fields::flow::phaseVolumeFraction{} ), - permeabilityAccessors.get( fields::permeability::permeability{} ), - permeabilityAccessors.get( fields::permeability::dPerm_dPressure{} ), + compFlowAccessors.get( flow::pressure{} ), + compFlowAccessors.get( flow::gravityCoefficient{} ), + compFlowAccessors.get( flow::phaseVolumeFraction{} ), + permeabilityAccessors.get( permeability::permeability{} ), + permeabilityAccessors.get( permeability::dPerm_dPressure{} ), relPermAccessors.get( fields::relperm::phaseRelPerm{} ), multiFluidAccessors.get( fields::multifluid::phaseViscosity{} ), multiFluidAccessors.get( fields::multifluid::phaseDensity{} ), @@ -1450,32 +1449,32 @@ void CompositionalMultiphaseFVM::computeCFLNumbers( geos::DomainPartition & doma ElementSubRegionBase & subRegion ) { arrayView2d< real64 const, compflow::USD_PHASE > const & phaseOutflux = - subRegion.getField< fields::flow::phaseOutflux >(); + subRegion.getField< flow::phaseOutflux >(); arrayView2d< real64 const, compflow::USD_COMP > const & compOutflux = - subRegion.getField< fields::flow::componentOutflux >(); + subRegion.getField< flow::componentOutflux >(); - arrayView1d< real64 > const & phaseCFLNumber = subRegion.getField< fields::flow::phaseCFLNumber >(); - arrayView1d< real64 > const & compCFLNumber = subRegion.getField< fields::flow::componentCFLNumber >(); + arrayView1d< real64 > const & phaseCFLNumber = subRegion.getField< flow::phaseCFLNumber >(); + arrayView1d< real64 > const & compCFLNumber = subRegion.getField< flow::componentCFLNumber >(); arrayView1d< real64 const > const & volume = subRegion.getElementVolume(); arrayView2d< real64 const, compflow::USD_COMP > const & compDens = - subRegion.getField< fields::flow::globalCompDensity >(); + subRegion.getField< flow::globalCompDensity >(); arrayView2d< real64 const, compflow::USD_COMP > const compFrac = - subRegion.getField< fields::flow::globalCompFraction >(); + subRegion.getField< flow::globalCompFraction >(); arrayView2d< real64, compflow::USD_PHASE > const phaseVolFrac = - subRegion.getField< fields::flow::phaseVolumeFraction >(); + subRegion.getField< flow::phaseVolumeFraction >(); Group const & constitutiveModels = subRegion.getGroup( ElementSubRegionBase::groupKeyStruct::constitutiveModelsString() ); string const & fluidName = subRegion.getReference< string >( CompositionalMultiphaseBase::viewKeyStruct::fluidNamesString() ); MultiFluidBase const & fluid = constitutiveModels.getGroup< MultiFluidBase >( fluidName ); - arrayView3d< real64 const, multifluid::USD_PHASE > const & phaseVisc = fluid.phaseViscosity(); + arrayView3d< real64 const, constitutive::multifluid::USD_PHASE > const & phaseVisc = fluid.phaseViscosity(); string const & relpermName = subRegion.getReference< string >( CompositionalMultiphaseBase::viewKeyStruct::relPermNamesString() ); RelativePermeabilityBase const & relperm = constitutiveModels.getGroup< RelativePermeabilityBase >( relpermName ); - arrayView3d< real64 const, relperm::USD_RELPERM > const & phaseRelPerm = relperm.phaseRelPerm(); - arrayView4d< real64 const, relperm::USD_RELPERM_DS > const & dPhaseRelPerm_dPhaseVolFrac = relperm.dPhaseRelPerm_dPhaseVolFraction(); + arrayView3d< real64 const, constitutive::relperm::USD_RELPERM > const & phaseRelPerm = relperm.phaseRelPerm(); + arrayView4d< real64 const, constitutive::relperm::USD_RELPERM_DS > const & dPhaseRelPerm_dPhaseVolFrac = relperm.dPhaseRelPerm_dPhaseVolFraction(); string const & solidName = subRegion.getReference< string >( CompositionalMultiphaseBase::viewKeyStruct::solidNamesString() ); CoupledSolidBase const & solid = constitutiveModels.getGroup< CoupledSolidBase >( solidName ); diff --git a/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseHybridFVM.cpp b/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseHybridFVM.cpp index 53415a507cd..f05147dcf4a 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseHybridFVM.cpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseHybridFVM.cpp @@ -43,6 +43,7 @@ namespace geos using namespace dataRepository; using namespace constitutive; +using namespace fields; using namespace isothermalCompositionalMultiphaseBaseKernels; using namespace compositionalMultiphaseHybridFVMKernels; using namespace mimeticInnerProduct; @@ -57,8 +58,6 @@ CompositionalMultiphaseHybridFVM::CompositionalMultiphaseHybridFVM( const std::s void CompositionalMultiphaseHybridFVM::registerDataOnMesh( Group & meshBodies ) { - GEOS_MARK_FUNCTION; - // 1) Register the elem-centered data CompositionalMultiphaseBase::registerDataOnMesh( meshBodies ); @@ -71,10 +70,10 @@ void CompositionalMultiphaseHybridFVM::registerDataOnMesh( Group & meshBodies ) // primary variables: face pressure changes - faceManager.registerField< fields::flow::facePressure_n >( getName() ); + faceManager.registerField< flow::facePressure_n >( getName() ); // auxiliary data for the buoyancy coefficient - faceManager.registerField< fields::flow::mimGravityCoefficient >( getName() ); + faceManager.registerField< flow::mimGravityCoefficient >( getName() ); } ); } @@ -136,7 +135,7 @@ void CompositionalMultiphaseHybridFVM::initializePostInitialConditionsPreSubGrou // check that multipliers are stricly larger than 0, which would work with SinglePhaseFVM, but not with SinglePhaseHybridFVM. // To deal with a 0 multiplier, we would just have to skip the corresponding face in the FluxKernel - arrayView1d< real64 const > const & transMultiplier = faceManager.getField< fields::flow::transMultiplier >(); + arrayView1d< real64 const > const & transMultiplier = faceManager.getField< flow::transMultiplier >(); RAJA::ReduceMin< parallelDeviceReduce, real64 > minVal( 1.0 ); forAll< parallelDevicePolicy<> >( faceManager.size(), [=] GEOS_HOST_DEVICE ( localIndex const iface ) @@ -179,10 +178,10 @@ void CompositionalMultiphaseHybridFVM::precomputeData( MeshLevel & mesh, arrayVi // face data arrayView1d< real64 const > const & transMultiplier = - faceManager.getField< fields::flow::transMultiplier >(); + faceManager.getField< flow::transMultiplier >(); arrayView1d< real64 > const mimFaceGravCoef = - faceManager.getField< fields::flow::mimGravityCoefficient >(); + faceManager.getField< flow::mimGravityCoefficient >(); ArrayOfArraysView< localIndex const > const & faceToNodes = faceManager.nodeList().toViewConst(); @@ -193,11 +192,11 @@ void CompositionalMultiphaseHybridFVM::precomputeData( MeshLevel & mesh, arrayVi { arrayView2d< real64 const > const & elemCenter = subRegion.template getReference< array2d< real64 > >( CellElementSubRegion::viewKeyStruct::elementCenterString() ); - string & permModelName = subRegion.getReference< string >( viewKeyStruct::permeabilityNamesString() ); + string const & permModelName = subRegion.getReference< string >( viewKeyStruct::permeabilityNamesString() ); arrayView3d< real64 const > const & elemPerm = getConstitutiveModel< PermeabilityBase >( subRegion, permModelName ).permeability(); arrayView1d< real64 const > const elemGravCoef = - subRegion.template getReference< array1d< real64 > >( fields::flow::gravityCoefficient::key() ); + subRegion.template getReference< array1d< real64 > >( flow::gravityCoefficient::key() ); arrayView1d< real64 const > const & elemVolume = subRegion.getElementVolume(); arrayView2d< localIndex const > const & elemToFaces = subRegion.faceList(); @@ -244,9 +243,9 @@ void CompositionalMultiphaseHybridFVM::implicitStepSetup( real64 const & time_n, FaceManager & faceManager = mesh.getFaceManager(); arrayView1d< real64 > const & facePres_n = - faceManager.getField< fields::flow::facePressure_n >(); + faceManager.getField< flow::facePressure_n >(); arrayView1d< real64 const > const & facePres = - faceManager.getField< fields::flow::facePressure >(); + faceManager.getField< flow::facePressure >(); facePres_n.setValues< parallelDevicePolicy<> >( facePres ); } ); @@ -339,17 +338,17 @@ void CompositionalMultiphaseHybridFVM::assembleFluxTerms( real64 const dt, // get the face-centered pressures arrayView1d< real64 const > const & facePres = - faceManager.getField< fields::flow::facePressure >(); + faceManager.getField< flow::facePressure >(); // get the face-centered depth arrayView1d< real64 const > const & faceGravCoef = - faceManager.getField< fields::flow::gravityCoefficient >(); + faceManager.getField< flow::gravityCoefficient >(); arrayView1d< real64 const > const & mimFaceGravCoef = - faceManager.getField< fields::flow::mimGravityCoefficient >(); + faceManager.getField< flow::mimGravityCoefficient >(); // get the face-centered transMultiplier arrayView1d< real64 const > const & transMultiplier = - faceManager.getField< fields::flow::transMultiplier >(); + faceManager.getField< flow::transMultiplier >(); // get the face-to-nodes connectivity for the transmissibility calculation ArrayOfArraysView< localIndex const > const & faceToNodes = faceManager.nodeList().toViewConst(); @@ -396,9 +395,9 @@ void CompositionalMultiphaseHybridFVM::assembleFluxTerms( real64 const dt, faceGravCoef, mimFaceGravCoef, transMultiplier, - compFlowAccessors.get( fields::flow::phaseMobility{} ), - compFlowAccessors.get( fields::flow::dPhaseMobility{} ), - compFlowAccessors.get( fields::flow::dGlobalCompFraction_dGlobalCompDensity{} ), + compFlowAccessors.get( flow::phaseMobility{} ), + compFlowAccessors.get( flow::dPhaseMobility{} ), + compFlowAccessors.get( flow::dGlobalCompFraction_dGlobalCompDensity{} ), multiFluidAccessors.get( fields::multifluid::phaseDensity{} ), multiFluidAccessors.get( fields::multifluid::dPhaseDensity{} ), multiFluidAccessors.get( fields::multifluid::phaseMassDensity{} ), @@ -447,10 +446,10 @@ real64 CompositionalMultiphaseHybridFVM::scalingForSystemSolution( DomainPartiti mesh.getElemManager().forElementSubRegions< ElementSubRegionBase >( regionNames, [&]( localIndex const, ElementSubRegionBase & subRegion ) { - arrayView1d< real64 const > const pressure = subRegion.getField< fields::flow::pressure >(); - arrayView2d< real64 const, compflow::USD_COMP > const compDens = subRegion.getField< fields::flow::globalCompDensity >(); - arrayView1d< real64 > pressureScalingFactor = subRegion.getField< fields::flow::pressureScalingFactor >(); - arrayView1d< real64 > compDensScalingFactor = subRegion.getField< fields::flow::globalCompDensityScalingFactor >(); + arrayView1d< real64 const > const pressure = subRegion.getField< flow::pressure >(); + arrayView2d< real64 const, compflow::USD_COMP > const compDens = subRegion.getField< flow::globalCompDensity >(); + arrayView1d< real64 > pressureScalingFactor = subRegion.getField< flow::pressureScalingFactor >(); + arrayView1d< real64 > compDensScalingFactor = subRegion.getField< flow::globalCompDensityScalingFactor >(); auto const subRegionData = isothermalCompositionalMultiphaseBaseKernels:: SolutionScalingKernelFactory:: @@ -480,7 +479,7 @@ real64 CompositionalMultiphaseHybridFVM::scalingForSystemSolution( DomainPartiti faceManager.getReference< array1d< globalIndex > >( faceDofKey ); arrayView1d< integer const > const & faceGhostRank = faceManager.ghostRank(); arrayView1d< real64 const > const & facePressure = - faceManager.getField< fields::flow::facePressure >(); + faceManager.getField< flow::facePressure >(); globalIndex const rankOffset = dofManager.rankOffset(); RAJA::ReduceMin< parallelDeviceReduce, real64 > minFaceVal( 1.0 ); @@ -529,12 +528,12 @@ bool CompositionalMultiphaseHybridFVM::checkSystemSolution( DomainPartition & do ElementSubRegionBase & subRegion ) { arrayView1d< real64 const > const pressure = - subRegion.getField< fields::flow::pressure >(); + subRegion.getField< flow::pressure >(); arrayView2d< real64 const, compflow::USD_COMP > const compDens = - subRegion.getField< fields::flow::globalCompDensity >(); - arrayView1d< real64 > pressureScalingFactor = subRegion.getField< fields::flow::pressureScalingFactor >(); - arrayView1d< real64 > temperatureScalingFactor = subRegion.getField< fields::flow::temperatureScalingFactor >(); - arrayView1d< real64 > compDensScalingFactor = subRegion.getField< fields::flow::globalCompDensityScalingFactor >(); + subRegion.getField< flow::globalCompDensity >(); + arrayView1d< real64 > pressureScalingFactor = subRegion.getField< flow::pressureScalingFactor >(); + arrayView1d< real64 > temperatureScalingFactor = subRegion.getField< flow::temperatureScalingFactor >(); + arrayView1d< real64 > compDensScalingFactor = subRegion.getField< flow::globalCompDensityScalingFactor >(); // check that pressure and component densities are non-negative auto const subRegionData = isothermalCompositionalMultiphaseBaseKernels:: @@ -747,13 +746,13 @@ void CompositionalMultiphaseHybridFVM::applySystemSolution( DofManager const & d dofManager.addVectorToField( localSolution, viewKeyStruct::elemDofFieldString(), - fields::flow::pressure::key(), + flow::pressure::key(), scalingFactor, pressureMask ); dofManager.addVectorToField( localSolution, viewKeyStruct::elemDofFieldString(), - fields::flow::globalCompDensity::key(), + flow::globalCompDensity::key(), scalingFactor, ~pressureMask ); @@ -768,7 +767,7 @@ void CompositionalMultiphaseHybridFVM::applySystemSolution( DofManager const & d dofManager.addVectorToField( localSolution, viewKeyStruct::faceDofFieldString(), - fields::flow::facePressure::key(), + flow::facePressure::key(), scalingFactor ); // 3. synchronize @@ -779,11 +778,11 @@ void CompositionalMultiphaseHybridFVM::applySystemSolution( DofManager const & d FieldIdentifiers fieldsToBeSync; { - fieldsToBeSync.addElementFields( { fields::flow::pressure::key(), - fields::flow::globalCompDensity::key() }, + fieldsToBeSync.addElementFields( { flow::pressure::key(), + flow::globalCompDensity::key() }, regionNames ); - fieldsToBeSync.addFields( FieldLocation::Face, { fields::flow::facePressure::key() } ); + fieldsToBeSync.addFields( FieldLocation::Face, { flow::facePressure::key() } ); }; CommunicationTools::getInstance().synchronizeFields( fieldsToBeSync, @@ -809,9 +808,9 @@ void CompositionalMultiphaseHybridFVM::resetStateToBeginningOfStep( DomainPartit FaceManager & faceManager = mesh.getFaceManager(); arrayView1d< real64 const > const & facePres_n = - faceManager.getField< fields::flow::facePressure_n >(); + faceManager.getField< flow::facePressure_n >(); arrayView1d< real64 > const & facePres = - faceManager.getField< fields::flow::facePressure >(); + faceManager.getField< flow::facePressure >(); facePres.setValues< parallelDevicePolicy<> >( facePres_n ); } ); } diff --git a/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseStatistics.cpp b/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseStatistics.cpp index 842c333bafe..fddad1f29f4 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseStatistics.cpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseStatistics.cpp @@ -38,6 +38,7 @@ namespace geos { using namespace constitutive; +using namespace fields; using namespace dataRepository; CompositionalMultiphaseStatistics::CompositionalMultiphaseStatistics( const string & name, @@ -259,11 +260,11 @@ void CompositionalMultiphaseStatistics::computeRegionStatistics( real64 const ti arrayView1d< integer const > const elemGhostRank = subRegion.ghostRank(); arrayView1d< real64 const > const volume = subRegion.getElementVolume(); - arrayView1d< real64 const > const pres = subRegion.getField< fields::flow::pressure >(); - arrayView1d< real64 const > const temp = subRegion.getField< fields::flow::temperature >(); + arrayView1d< real64 const > const pres = subRegion.getField< flow::pressure >(); + arrayView1d< real64 const > const temp = subRegion.getField< flow::temperature >(); arrayView2d< real64 const, compflow::USD_PHASE > const phaseVolFrac = - subRegion.getField< fields::flow::phaseVolumeFraction >(); - arrayView1d< real64 const > const deltaPres = subRegion.getField< fields::flow::deltaPressure >(); + subRegion.getField< flow::phaseVolumeFraction >(); + arrayView1d< real64 const > const deltaPres = subRegion.getField< flow::deltaPressure >(); Group const & constitutiveModels = subRegion.getGroup( ElementSubRegionBase::groupKeyStruct::constitutiveModelsString() ); diff --git a/src/coreComponents/physicsSolvers/fluidFlow/FlowSolverBase.cpp b/src/coreComponents/physicsSolvers/fluidFlow/FlowSolverBase.cpp index fe3bad87c88..9ea13eb134b 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/FlowSolverBase.cpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/FlowSolverBase.cpp @@ -40,6 +40,7 @@ namespace geos using namespace dataRepository; using namespace constitutive; +using namespace fields; template< typename POROUSWRAPPER_TYPE > void updatePorosityAndPermeabilityFromPressureAndTemperature( POROUSWRAPPER_TYPE porousWrapper, @@ -143,33 +144,32 @@ void FlowSolverBase::registerDataOnMesh( Group & meshBodies ) [&]( localIndex const, ElementSubRegionBase & subRegion ) { - subRegion.registerField< fields::flow::deltaVolume >( getName() ); - subRegion.registerField< fields::flow::gravityCoefficient >( getName() ). - setApplyDefaultValue( 0.0 ); - subRegion.registerField< fields::flow::netToGross >( getName() ); - - subRegion.registerField< fields::flow::pressure >( getName() ); - subRegion.registerField< fields::flow::pressure_n >( getName() ); - subRegion.registerField< fields::flow::initialPressure >( getName() ); - subRegion.registerField< fields::flow::deltaPressure >( getName() ); // for reporting/stats purposes - subRegion.registerField< fields::flow::bcPressure >( getName() ); // needed for the application of boundary conditions + subRegion.registerField< flow::deltaVolume >( getName() ); + subRegion.registerField< flow::gravityCoefficient >( getName() ); + subRegion.registerField< flow::netToGross >( getName() ); + + subRegion.registerField< flow::pressure >( getName() ); + subRegion.registerField< flow::pressure_n >( getName() ); + subRegion.registerField< flow::initialPressure >( getName() ); + subRegion.registerField< flow::deltaPressure >( getName() ); // for reporting/stats purposes + subRegion.registerField< flow::bcPressure >( getName() ); // needed for the application of boundary conditions if( m_isFixedStressPoromechanicsUpdate ) { - subRegion.registerField< fields::flow::pressure_k >( getName() ); // needed for the fixed-stress porosity update + subRegion.registerField< flow::pressure_k >( getName() ); // needed for the fixed-stress porosity update } - subRegion.registerField< fields::flow::temperature >( getName() ); - subRegion.registerField< fields::flow::temperature_n >( getName() ); - subRegion.registerField< fields::flow::initialTemperature >( getName() ); - subRegion.registerField< fields::flow::bcTemperature >( getName() ); // needed for the application of boundary conditions + subRegion.registerField< flow::temperature >( getName() ); + subRegion.registerField< flow::temperature_n >( getName() ); + subRegion.registerField< flow::initialTemperature >( getName() ); + subRegion.registerField< flow::bcTemperature >( getName() ); // needed for the application of boundary conditions if( m_isFixedStressPoromechanicsUpdate ) { - subRegion.registerField< fields::flow::temperature_k >( getName() ); // needed for the fixed-stress porosity update + subRegion.registerField< flow::temperature_k >( getName() ); // needed for the fixed-stress porosity update } if( m_isThermal ) { - subRegion.registerField< fields::flow::energy >( getName() ); - subRegion.registerField< fields::flow::energy_n >( getName() ); + subRegion.registerField< flow::energy >( getName() ); + subRegion.registerField< flow::energy_n >( getName() ); } } ); @@ -180,20 +180,20 @@ void FlowSolverBase::registerDataOnMesh( Group & meshBodies ) { SurfaceElementRegion & faceRegion = dynamicCast< SurfaceElementRegion & >( region ); - subRegion.registerField< fields::flow::gravityCoefficient >( getName() ); - - subRegion.registerField< fields::flow::aperture0 >( getName() ). + subRegion.registerField< flow::aperture0 >( getName() ). setApplyDefaultValue( faceRegion.getDefaultAperture() ); - subRegion.registerField< fields::flow::hydraulicAperture >( getName() ). + subRegion.registerField< flow::hydraulicAperture >( getName() ). setApplyDefaultValue( faceRegion.getDefaultAperture() ); } ); FaceManager & faceManager = mesh.getFaceManager(); - faceManager.registerField< fields::flow::gravityCoefficient >( getName() ). - setApplyDefaultValue( 0.0 ); - faceManager.registerField< fields::flow::transMultiplier >( getName() ); + { + faceManager.registerField< flow::facePressure >( getName() ); + faceManager.registerField< flow::gravityCoefficient >( getName() ); + faceManager.registerField< flow::transMultiplier >( getName() ); + } } ); @@ -207,36 +207,36 @@ void FlowSolverBase::registerDataOnMesh( Group & meshBodies ) { FluxApproximationBase & fluxApprox = fvManager.getFluxApproximation( m_discretizationName ); - fluxApprox.addFieldName( fields::flow::pressure::key() ); - fluxApprox.setCoeffName( fields::permeability::permeability::key() ); + fluxApprox.addFieldName( flow::pressure::key() ); + fluxApprox.setCoeffName( permeability::permeability::key() ); if( m_isThermal ) { - fluxApprox.addFieldName( fields::flow::temperature::key() ); + fluxApprox.addFieldName( flow::temperature::key() ); } } } void FlowSolverBase::saveConvergedState( ElementSubRegionBase & subRegion ) const { - arrayView1d< real64 const > const pres = subRegion.template getField< fields::flow::pressure >(); - arrayView1d< real64 > const pres_n = subRegion.template getField< fields::flow::pressure_n >(); + arrayView1d< real64 const > const pres = subRegion.template getField< flow::pressure >(); + arrayView1d< real64 > const pres_n = subRegion.template getField< flow::pressure_n >(); pres_n.setValues< parallelDevicePolicy<> >( pres ); - arrayView1d< real64 const > const temp = subRegion.template getField< fields::flow::temperature >(); - arrayView1d< real64 > const temp_n = subRegion.template getField< fields::flow::temperature_n >(); + arrayView1d< real64 const > const temp = subRegion.template getField< flow::temperature >(); + arrayView1d< real64 > const temp_n = subRegion.template getField< flow::temperature_n >(); temp_n.setValues< parallelDevicePolicy<> >( temp ); if( m_isThermal ) { - arrayView1d< real64 const > const energy = subRegion.template getField< fields::flow::energy >(); - arrayView1d< real64 > const energy_n = subRegion.template getField< fields::flow::energy_n >(); + arrayView1d< real64 const > const energy = subRegion.template getField< flow::energy >(); + arrayView1d< real64 > const energy_n = subRegion.template getField< flow::energy_n >(); energy_n.setValues< parallelDevicePolicy<> >( energy ); } if( m_isFixedStressPoromechanicsUpdate ) { - arrayView1d< real64 > const pres_k = subRegion.template getField< fields::flow::pressure_k >(); - arrayView1d< real64 > const temp_k = subRegion.template getField< fields::flow::temperature_k >(); + arrayView1d< real64 > const pres_k = subRegion.template getField< flow::pressure_k >(); + arrayView1d< real64 > const temp_k = subRegion.template getField< flow::temperature_k >(); pres_k.setValues< parallelDevicePolicy<> >( pres ); temp_k.setValues< parallelDevicePolicy<> >( temp ); } @@ -258,10 +258,10 @@ void FlowSolverBase::saveSequentialIterationState( DomainPartition & domain ) { arrayView1d< integer const > const ghostRank = subRegion.ghostRank(); - arrayView1d< real64 const > const pres = subRegion.getField< fields::flow::pressure >(); - arrayView1d< real64 > const pres_k = subRegion.getField< fields::flow::pressure_k >(); - arrayView1d< real64 const > const temp = subRegion.getField< fields::flow::temperature >(); - arrayView1d< real64 > const temp_k = subRegion.getField< fields::flow::temperature_k >(); + arrayView1d< real64 const > const pres = subRegion.getField< flow::pressure >(); + arrayView1d< real64 > const pres_k = subRegion.getField< flow::pressure_k >(); + arrayView1d< real64 const > const temp = subRegion.getField< flow::temperature >(); + arrayView1d< real64 > const temp_k = subRegion.getField< flow::temperature_k >(); RAJA::ReduceMax< parallelDeviceReduce, real64 > subRegionMaxPresChange( 0.0 ); RAJA::ReduceMax< parallelDeviceReduce, real64 > subRegionMaxTempChange( 0.0 ); @@ -291,45 +291,13 @@ void FlowSolverBase::setConstitutiveNamesCallSuper( ElementSubRegionBase & subRe { PhysicsSolverBase::setConstitutiveNamesCallSuper( subRegion ); - subRegion.registerWrapper< string >( viewKeyStruct::fluidNamesString() ). - setPlotLevel( PlotLevel::NOPLOT ). - setRestartFlags( RestartFlags::NO_WRITE ). - setSizedFromParent( 0 ); - - subRegion.registerWrapper< string >( viewKeyStruct::solidNamesString() ). - setPlotLevel( PlotLevel::NOPLOT ). - setRestartFlags( RestartFlags::NO_WRITE ). - setSizedFromParent( 0 ); - - string & solidName = subRegion.getReference< string >( viewKeyStruct::solidNamesString() ); - solidName = getConstitutiveName< CoupledSolidBase >( subRegion ); - GEOS_ERROR_IF( solidName.empty(), GEOS_FMT( "{}: Solid model not found on subregion {}", - getDataContext(), subRegion.getName() ) ); - - subRegion.registerWrapper< string >( viewKeyStruct::permeabilityNamesString() ). - setPlotLevel( PlotLevel::NOPLOT ). - setRestartFlags( RestartFlags::NO_WRITE ). - setSizedFromParent( 0 ); + setConstitutiveName< CoupledSolidBase >( subRegion, viewKeyStruct::solidNamesString()); - string & permName = subRegion.getReference< string >( viewKeyStruct::permeabilityNamesString() ); - permName = getConstitutiveName< PermeabilityBase >( subRegion ); - GEOS_ERROR_IF( permName.empty(), GEOS_FMT( "{}: Permeability model not found on subregion {}", - getDataContext(), subRegion.getName() ) ); + setConstitutiveName< PermeabilityBase >( subRegion, viewKeyStruct::permeabilityNamesString()); if( m_isThermal ) { - string & solidInternalEnergyName = subRegion.registerWrapper< string >( viewKeyStruct::solidInternalEnergyNamesString() ). - setPlotLevel( PlotLevel::NOPLOT ). - setRestartFlags( RestartFlags::NO_WRITE ). - setSizedFromParent( 0 ). - setDescription( "Name of the solid internal energy constitutive model to use" ). - reference(); - - solidInternalEnergyName = getConstitutiveName< SolidInternalEnergy >( subRegion ); - GEOS_THROW_IF( solidInternalEnergyName.empty(), - GEOS_FMT( "{}: Solid internal energy model not found on subregion {}", - getDataContext(), subRegion.getName() ), - InputError ); + setConstitutiveName< SolidInternalEnergy >( subRegion, viewKeyStruct::solidInternalEnergyNamesString()); } } @@ -460,7 +428,7 @@ void FlowSolverBase::initializePostInitialConditionsPreSubGroups() precomputeData( mesh, regionNames ); FieldIdentifiers fieldsToBeSync; - fieldsToBeSync.addElementFields( { fields::flow::pressure::key(), fields::flow::temperature::key() }, + fieldsToBeSync.addElementFields( { flow::pressure::key(), flow::temperature::key() }, regionNames ); CommunicationTools::getInstance().synchronizeFields( fieldsToBeSync, mesh, domain.getNeighbors(), false ); @@ -479,7 +447,7 @@ void FlowSolverBase::precomputeData( MeshLevel & mesh, arrayView2d< real64 const > const elemCenter = subRegion.getElementCenter(); arrayView1d< real64 > const gravityCoef = - subRegion.getField< fields::flow::gravityCoefficient >(); + subRegion.getField< flow::gravityCoefficient >(); forAll< parallelHostPolicy >( subRegion.size(), [=] ( localIndex const ei ) { @@ -491,7 +459,7 @@ void FlowSolverBase::precomputeData( MeshLevel & mesh, arrayView2d< real64 const > const faceCenter = faceManager.faceCenter(); arrayView1d< real64 > const gravityCoef = - faceManager.getField< fields::flow::gravityCoefficient >(); + faceManager.getField< flow::gravityCoefficient >(); forAll< parallelHostPolicy >( faceManager.size(), [=] ( localIndex const kf ) { @@ -545,7 +513,7 @@ void FlowSolverBase::initializePorosityAndPermeability( MeshLevel & mesh, arrayV getConstitutiveModel< CoupledSolidBase >( subRegion, subRegion.template getReference< string >( viewKeyStruct::solidNamesString() ) ); PermeabilityBase const & permeability = getConstitutiveModel< PermeabilityBase >( subRegion, subRegion.template getReference< string >( viewKeyStruct::permeabilityNamesString() ) ); - arrayView1d< real64 const > const netToGross = subRegion.template getField< fields::flow::netToGross >(); + arrayView1d< real64 const > const netToGross = subRegion.template getField< flow::netToGross >(); porousSolid.scaleReferencePorosity( netToGross ); permeability.scaleHorizontalPermeability( netToGross ); @@ -573,7 +541,7 @@ void FlowSolverBase::initializeHydraulicAperture( MeshLevel & mesh, const arrayV SurfaceElementRegion & region ) { region.forElementSubRegions< SurfaceElementSubRegion >( [&]( SurfaceElementSubRegion & subRegion ) - { subRegion.getWrapper< real64_array >( fields::flow::hydraulicAperture::key()).setApplyDefaultValue( region.getDefaultAperture()); } ); + { subRegion.getWrapper< real64_array >( flow::hydraulicAperture::key()).setApplyDefaultValue( region.getDefaultAperture()); } ); } ); } @@ -582,10 +550,10 @@ void FlowSolverBase::saveInitialPressureAndTemperature( MeshLevel & mesh, const mesh.getElemManager().forElementSubRegions( regionNames, [&]( localIndex const, ElementSubRegionBase & subRegion ) { - arrayView1d< real64 const > const pres = subRegion.getField< fields::flow::pressure >(); - arrayView1d< real64 > const initPres = subRegion.getField< fields::flow::initialPressure >(); - arrayView1d< real64 const > const temp = subRegion.getField< fields::flow::temperature >(); - arrayView1d< real64 > const initTemp = subRegion.template getField< fields::flow::initialTemperature >(); + arrayView1d< real64 const > const pres = subRegion.getField< flow::pressure >(); + arrayView1d< real64 > const initPres = subRegion.getField< flow::initialPressure >(); + arrayView1d< real64 const > const temp = subRegion.getField< flow::temperature >(); + arrayView1d< real64 > const initTemp = subRegion.template getField< flow::initialTemperature >(); initPres.setValues< parallelDevicePolicy<> >( pres ); initTemp.setValues< parallelDevicePolicy<> >( temp ); } ); @@ -595,11 +563,11 @@ void FlowSolverBase::updatePorosityAndPermeability( CellElementSubRegion & subRe { GEOS_MARK_FUNCTION; - arrayView1d< real64 const > const & pressure = subRegion.getField< fields::flow::pressure >(); - arrayView1d< real64 const > const & pressure_n = subRegion.getField< fields::flow::pressure_n >(); + arrayView1d< real64 const > const & pressure = subRegion.getField< flow::pressure >(); + arrayView1d< real64 const > const & pressure_n = subRegion.getField< flow::pressure_n >(); - arrayView1d< real64 const > const & temperature = subRegion.getField< fields::flow::temperature >(); - arrayView1d< real64 const > const & temperature_n = subRegion.getField< fields::flow::temperature_n >(); + arrayView1d< real64 const > const & temperature = subRegion.getField< flow::temperature >(); + arrayView1d< real64 const > const & temperature_n = subRegion.getField< flow::temperature_n >(); string const & solidName = subRegion.getReference< string >( viewKeyStruct::solidNamesString() ); CoupledSolidBase & porousSolid = subRegion.template getConstitutiveModel< CoupledSolidBase >( solidName ); @@ -609,8 +577,8 @@ void FlowSolverBase::updatePorosityAndPermeability( CellElementSubRegion & subRe typename TYPEOFREF( castedPorousSolid ) ::KernelWrapper porousWrapper = castedPorousSolid.createKernelUpdates(); if( m_isFixedStressPoromechanicsUpdate ) { - arrayView1d< real64 const > const & pressure_k = subRegion.getField< fields::flow::pressure_k >(); - arrayView1d< real64 const > const & temperature_k = subRegion.getField< fields::flow::temperature_k >(); + arrayView1d< real64 const > const & pressure_k = subRegion.getField< flow::pressure_k >(); + arrayView1d< real64 const > const & temperature_k = subRegion.getField< flow::temperature_k >(); updatePorosityAndPermeabilityFromPressureAndTemperature( porousWrapper, subRegion, pressure, pressure_k, pressure_n, temperature, temperature_k, temperature_n ); } else @@ -624,10 +592,10 @@ void FlowSolverBase::updatePorosityAndPermeability( SurfaceElementSubRegion & su { GEOS_MARK_FUNCTION; - arrayView1d< real64 const > const & pressure = subRegion.getField< fields::flow::pressure >(); + arrayView1d< real64 const > const & pressure = subRegion.getField< flow::pressure >(); - arrayView1d< real64 const > const newHydraulicAperture = subRegion.getField< fields::flow::hydraulicAperture >(); - arrayView1d< real64 const > const oldHydraulicAperture = subRegion.getField< fields::flow::aperture0 >(); + arrayView1d< real64 const > const newHydraulicAperture = subRegion.getField< flow::hydraulicAperture >(); + arrayView1d< real64 const > const oldHydraulicAperture = subRegion.getField< flow::aperture0 >(); string const & solidName = subRegion.getReference< string >( viewKeyStruct::solidNamesString() ); CoupledSolidBase & porousSolid = subRegion.getConstitutiveModel< CoupledSolidBase >( solidName ); @@ -795,16 +763,16 @@ void FlowSolverBase::saveAquiferConvergedState( real64 const & time, AquiferBoundaryCondition::KernelWrapper aquiferBCWrapper = bc.createKernelWrapper(); ElementRegionManager::ElementViewAccessor< arrayView1d< real64 const > > pressure = - elemManager.constructFieldAccessor< fields::flow::pressure >(); - pressure.setName( getName() + "/accessors/" + fields::flow::pressure::key() ); + elemManager.constructFieldAccessor< flow::pressure >(); + pressure.setName( getName() + "/accessors/" + flow::pressure::key() ); ElementRegionManager::ElementViewAccessor< arrayView1d< real64 const > > pressure_n = - elemManager.constructFieldAccessor< fields::flow::pressure_n >(); - pressure_n.setName( getName() + "/accessors/" + fields::flow::pressure_n::key() ); + elemManager.constructFieldAccessor< flow::pressure_n >(); + pressure_n.setName( getName() + "/accessors/" + flow::pressure_n::key() ); ElementRegionManager::ElementViewAccessor< arrayView1d< real64 const > > gravCoef = - elemManager.constructFieldAccessor< fields::flow::gravityCoefficient >(); - gravCoef.setName( getName() + "/accessors/" + fields::flow::gravityCoefficient::key() ); + elemManager.constructFieldAccessor< flow::gravityCoefficient >(); + gravCoef.setName( getName() + "/accessors/" + flow::gravityCoefficient::key() ); real64 const targetSetSumFluxes = sumAquiferFluxes( stencil, aquiferBCWrapper, @@ -893,8 +861,8 @@ void FlowSolverBase::prepareStencilWeights( DomainPartition & domain ) const FluxApproximationBase const & fluxApprox = fvManager.getFluxApproximation( getDiscretizationName() ); ElementRegionManager::ElementViewAccessor< arrayView1d< real64 const > > hydraulicAperture = m_isLaggingFractureStencilWeightsUpdate ? - mesh.getElemManager().constructViewAccessor< array1d< real64 >, arrayView1d< real64 const > >( fields::flow::aperture0::key() ) : - mesh.getElemManager().constructViewAccessor< array1d< real64 >, arrayView1d< real64 const > >( fields::flow::hydraulicAperture::key() ); + mesh.getElemManager().constructViewAccessor< array1d< real64 >, arrayView1d< real64 const > >( flow::aperture0::key() ) : + mesh.getElemManager().constructViewAccessor< array1d< real64 >, arrayView1d< real64 const > >( flow::hydraulicAperture::key() ); fluxApprox.forStencils< SurfaceElementStencil, FaceElementToCellStencil, EmbeddedSurfaceToCellStencil >( mesh, [&]( auto & stencil ) { @@ -917,7 +885,7 @@ void FlowSolverBase::updateStencilWeights( DomainPartition & domain ) const FiniteVolumeManager const & fvManager = numericalMethodManager.getFiniteVolumeManager(); FluxApproximationBase const & fluxApprox = fvManager.getFluxApproximation( getDiscretizationName() ); ElementRegionManager::ElementViewAccessor< arrayView1d< real64 const > > hydraulicAperture = - mesh.getElemManager().constructViewAccessor< array1d< real64 >, arrayView1d< real64 const > >( fields::flow::hydraulicAperture::key() ); + mesh.getElemManager().constructViewAccessor< array1d< real64 >, arrayView1d< real64 const > >( flow::hydraulicAperture::key() ); fluxApprox.forStencils< SurfaceElementStencil, FaceElementToCellStencil, EmbeddedSurfaceToCellStencil >( mesh, [&]( auto & stencil ) { diff --git a/src/coreComponents/physicsSolvers/fluidFlow/FlowSolverBaseFields.hpp b/src/coreComponents/physicsSolvers/fluidFlow/FlowSolverBaseFields.hpp index ddb20e7bf5c..ebf0075c5da 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/FlowSolverBaseFields.hpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/FlowSolverBaseFields.hpp @@ -241,22 +241,6 @@ DECLARE_FIELD( temperatureScalingFactor, NO_WRITE, "Scaling factors for temperature" ); -DECLARE_FIELD( mass, - "mass", - array1d< real64 >, - 0, - LEVEL_0, - WRITE_AND_READ, - "Mass" ); - -DECLARE_FIELD( mass_n, - "mass_n", - array1d< real64 >, - 0, - NOPLOT, - WRITE_AND_READ, - "Mass at the previous converged time step" ); - DECLARE_FIELD( energy, "energy", array1d< real64 >, diff --git a/src/coreComponents/physicsSolvers/fluidFlow/ReactiveCompositionalMultiphaseOBL.cpp b/src/coreComponents/physicsSolvers/fluidFlow/ReactiveCompositionalMultiphaseOBL.cpp index 4670d6425a4..c53059dcba0 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/ReactiveCompositionalMultiphaseOBL.cpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/ReactiveCompositionalMultiphaseOBL.cpp @@ -40,6 +40,7 @@ namespace geos using namespace dataRepository; using namespace constitutive; +using namespace fields; using namespace reactiveCompositionalMultiphaseOBLKernels; namespace @@ -161,7 +162,7 @@ void ReactiveCompositionalMultiphaseOBL::implicitStepComplete( real64 const & ti // for output purposes (visualization, etc) we update the last component fraction integer const numComp = m_numComponents; arrayView2d< real64, compflow::USD_COMP > const compFrac = - subRegion.getField< fields::flow::globalCompFraction >(); + subRegion.getField< flow::globalCompFraction >(); forAll< parallelDevicePolicy<> >( subRegion.size(), [=] GEOS_HOST_DEVICE ( localIndex const ei ) { @@ -222,7 +223,6 @@ void ReactiveCompositionalMultiphaseOBL::postInputInitialization() void ReactiveCompositionalMultiphaseOBL::registerDataOnMesh( Group & meshBodies ) { - using namespace fields::flow; // 1. Call base class method FlowSolverBase::registerDataOnMesh( meshBodies ); @@ -237,62 +237,45 @@ void ReactiveCompositionalMultiphaseOBL::registerDataOnMesh( Group & meshBodies { string const solverName = getName(); - subRegion.registerField< pressure >( solverName ); - subRegion.registerField< initialPressure >( solverName ); - subRegion.registerField< pressure_n >( solverName ); - subRegion.registerField< bcPressure >( solverName ); - - subRegion.registerField< temperature >( solverName ); - subRegion.registerField< bcTemperature >( solverName ); - - subRegion.registerField< OBLOperatorValues >( solverName ). + subRegion.registerField< flow::OBLOperatorValues >( solverName ). reference().resizeDimension< 1 >( m_numOBLOperators ); - subRegion.registerField< OBLOperatorValues_n >( solverName ). + subRegion.registerField< flow::OBLOperatorValues_n >( solverName ). reference().resizeDimension< 1 >( m_numOBLOperators ); - subRegion.registerField< OBLOperatorDerivatives >( solverName ). + subRegion.registerField< flow::OBLOperatorDerivatives >( solverName ). reference().resizeDimension< 1, 2 >( m_numOBLOperators, m_numDofPerCell ); - // we need to register this fiels in any case (if energy balance is enabled or not) - // to be able to pass the view to OBLOperatorsKernel - subRegion.registerField< temperature_n >( solverName ); - // The resizing of the arrays needs to happen here, before the call to initializePreSubGroups, // to make sure that the dimensions are properly set before the timeHistoryOutput starts its initialization. - subRegion.registerField< globalCompFraction >( solverName ). + subRegion.registerField< flow::globalCompFraction >( solverName ). setDimLabels( 1, m_componentNames ). reference().resizeDimension< 1 >( m_numComponents ); - subRegion.registerField< bcGlobalCompFraction >( solverName ). + subRegion.registerField< flow::bcGlobalCompFraction >( solverName ). reference().resizeDimension< 1 >( m_numComponents ); // we need to register this fiels in any case (if there is a single component or not) // to be able to pass the view to OBLOperatorsKernel - subRegion.registerField< globalCompFraction_n >( solverName ). + subRegion.registerField< flow::globalCompFraction_n >( solverName ). reference().resizeDimension< 1 >( m_numComponents ); // in principle, referencePorosity could be used directly from solid model, // but was duplicated to remove dependency on solid - subRegion.registerField< referencePorosity >( solverName ); + subRegion.registerField< flow::referencePorosity >( solverName ); // referencePoreVolume and referenceRockVolume are introduced for the sake of performance: // this way the multiplication of constant arrays (e.g., referencePorosity and volume) every Newton step is avoided - subRegion.registerField< referencePoreVolume >( solverName ); - subRegion.registerField< referenceRockVolume >( solverName ); + subRegion.registerField< flow::referencePoreVolume >( solverName ); + subRegion.registerField< flow::referenceRockVolume >( solverName ); // thermal rock properties (again, register in any case) // it is not possible to use specificHeatCapacity from solid model here, because specificHeatCapacity includes several quantities, // which are split in OBL framework: constant rock volume and, // hidden inside operator - therefore variable - rock compressibility and rock energy - subRegion.registerField< rockVolumetricHeatCapacity >( solverName ); - subRegion.registerField< rockThermalConductivity >( solverName ); - subRegion.registerField< rockKineticRateFactor >( solverName ); + subRegion.registerField< flow::rockVolumetricHeatCapacity >( solverName ); + subRegion.registerField< flow::rockThermalConductivity >( solverName ); + subRegion.registerField< flow::rockKineticRateFactor >( solverName ); } ); - FaceManager & faceManager = mesh.getFaceManager(); - { - faceManager.registerField< facePressure >( getName() ); - } - } ); } @@ -321,13 +304,13 @@ real64 ReactiveCompositionalMultiphaseOBL::calculateResidualNorm( real64 const & arrayView1d< globalIndex const > dofNumber = subRegion.getReference< array1d< globalIndex > >( dofKey ); arrayView1d< integer const > const & elemGhostRank = subRegion.ghostRank(); - arrayView1d< real64 const > const & refPoreVolume = subRegion.getField< fields::flow::referencePoreVolume >(); + arrayView1d< real64 const > const & refPoreVolume = subRegion.getField< flow::referencePoreVolume >(); real64 subRegionResidualNorm = 0.0; if( m_useDARTSL2Norm ) { - arrayView2d< real64 const, compflow::USD_OBL_VAL > const OBLVals = subRegion.getField< fields::flow::OBLOperatorValues >(); + arrayView2d< real64 const, compflow::USD_OBL_VAL > const OBLVals = subRegion.getField< flow::OBLOperatorValues >(); ResidualDARTSL2NormKernel::launch< parallelDevicePolicy<> >( localRhs, rankOffset, @@ -344,7 +327,7 @@ real64 ReactiveCompositionalMultiphaseOBL::calculateResidualNorm( real64 const & } else { - arrayView2d< real64 const, compflow::USD_OBL_VAL > const OBLVals_n = subRegion.getField< fields::flow::OBLOperatorValues_n >(); + arrayView2d< real64 const, compflow::USD_OBL_VAL > const OBLVals_n = subRegion.getField< flow::OBLOperatorValues_n >(); ResidualNormKernel::launch< parallelDevicePolicy<> >( localRhs, rankOffset, @@ -462,11 +445,11 @@ bool ReactiveCompositionalMultiphaseOBL::checkSystemSolution( DomainPartition & arrayView1d< integer const > const & elemGhostRank = subRegion.ghostRank(); arrayView1d< real64 const > const & pres = - subRegion.getReference< array1d< real64 > >( fields::flow::pressure::key() ); + subRegion.getReference< array1d< real64 > >( flow::pressure::key() ); arrayView2d< real64 const, compflow::USD_COMP > const & compFrac = - subRegion.getField< fields::flow::globalCompFraction >(); + subRegion.getField< flow::globalCompFraction >(); arrayView1d< real64 const > const & temp = - subRegion.getReference< array1d< real64 > >( fields::flow::temperature::key() ); + subRegion.getReference< array1d< real64 > >( flow::temperature::key() ); localIndex const subRegionSolutionCheck = SolutionCheckKernel::launch< parallelDevicePolicy<> >( localSolution, @@ -501,7 +484,7 @@ void ReactiveCompositionalMultiphaseOBL::applySystemSolution( DofManager const & dofManager.addVectorToField( localSolution, viewKeyStruct::elemDofFieldString(), - fields::flow::pressure::key(), + flow::pressure::key(), scalingFactor, pressureMask ); @@ -511,7 +494,7 @@ void ReactiveCompositionalMultiphaseOBL::applySystemSolution( DofManager const & dofManager.addVectorToField( localSolution, viewKeyStruct::elemDofFieldString(), - fields::flow::globalCompFraction::key(), + flow::globalCompFraction::key(), scalingFactor, compFracMask ); } @@ -521,7 +504,7 @@ void ReactiveCompositionalMultiphaseOBL::applySystemSolution( DofManager const & DofManager::CompMask temperatureMask( m_numDofPerCell, m_numDofPerCell - 1, m_numDofPerCell ); dofManager.addVectorToField( localSolution, viewKeyStruct::elemDofFieldString(), - fields::flow::temperature::key(), + flow::temperature::key(), scalingFactor, temperatureMask ); } @@ -536,14 +519,14 @@ void ReactiveCompositionalMultiphaseOBL::applySystemSolution( DofManager const & arrayView1d< string const > const & regionNames ) { FieldIdentifiers fieldsToBeSync; - fieldsToBeSync.addElementFields( { fields::flow::pressure::key() }, regionNames ); + fieldsToBeSync.addElementFields( { flow::pressure::key() }, regionNames ); if( m_numComponents > 1 ) { - fieldsToBeSync.addElementFields( { fields::flow::globalCompFraction::key() }, regionNames ); + fieldsToBeSync.addElementFields( { flow::globalCompFraction::key() }, regionNames ); } if( m_enableEnergyBalance ) { - fieldsToBeSync.addElementFields( { fields::flow::temperature::key() }, regionNames ); + fieldsToBeSync.addElementFields( { flow::temperature::key() }, regionNames ); } CommunicationTools::getInstance().synchronizeFields( fieldsToBeSync, mesh, domain.getNeighbors(), true ); } ); @@ -563,8 +546,8 @@ void ReactiveCompositionalMultiphaseOBL::initializePostInitialConditionsPreSubGr { FieldIdentifiers fieldsToBeSync; - fieldsToBeSync.addElementFields( { fields::flow::pressure::key() }, regionNames ); - fieldsToBeSync.addElementFields( { fields::flow::globalCompFraction::key() }, regionNames ); + fieldsToBeSync.addElementFields( { flow::pressure::key() }, regionNames ); + fieldsToBeSync.addElementFields( { flow::globalCompFraction::key() }, regionNames ); CommunicationTools::getInstance().synchronizeFields( fieldsToBeSync, mesh, domain.getNeighbors(), false ); @@ -577,9 +560,9 @@ void ReactiveCompositionalMultiphaseOBL::initializePostInitialConditionsPreSubGr arrayView1d< integer const > const elemGhostRank = subRegion.ghostRank(); arrayView1d< real64 const > const volume = subRegion.getElementVolume(); arrayView1d< real64 const > const refPorosity = solid.getReferencePorosity(); - arrayView1d< real64 > const referenceRockVolume = subRegion.getField< fields::flow::referenceRockVolume >(); - arrayView1d< real64 > const referencePoreVolume = subRegion.getField< fields::flow::referencePoreVolume >(); - arrayView1d< real64 > const referencePorosity = subRegion.getField< fields::flow::referencePorosity >(); + arrayView1d< real64 > const referenceRockVolume = subRegion.getField< flow::referenceRockVolume >(); + arrayView1d< real64 > const referencePoreVolume = subRegion.getField< flow::referencePoreVolume >(); + arrayView1d< real64 > const referencePorosity = subRegion.getField< flow::referencePorosity >(); forAll< parallelDevicePolicy<> >( subRegion.size(), [=] GEOS_HOST_DEVICE ( localIndex const ei ) { @@ -612,27 +595,27 @@ ReactiveCompositionalMultiphaseOBL::implicitStepSetup( real64 const & GEOS_UNUSE ElementSubRegionBase & subRegion ) { arrayView1d< real64 > const & pres_n = - subRegion.template getField< fields::flow::pressure_n >(); + subRegion.template getField< flow::pressure_n >(); arrayView1d< real64 const > const & pres = - subRegion.template getField< fields::flow::pressure >(); + subRegion.template getField< flow::pressure >(); pres_n.setValues< parallelDevicePolicy<> >( pres ); // for single component problems (e.g., geothermal), global component fraction is not a primary variable if( m_numComponents > 1 ) { arrayView2d< real64, compflow::USD_COMP > const & compFrac_n = - subRegion.template getField< fields::flow::globalCompFraction_n >(); + subRegion.template getField< flow::globalCompFraction_n >(); arrayView2d< real64 const, compflow::USD_COMP > const & compFrac = - subRegion.template getField< fields::flow::globalCompFraction >(); + subRegion.template getField< flow::globalCompFraction >(); compFrac_n.setValues< parallelDevicePolicy<> >( compFrac ); } if( m_enableEnergyBalance ) { arrayView1d< real64 > const & temp_n = - subRegion.template getField< fields::flow::temperature_n >(); + subRegion.template getField< flow::temperature_n >(); arrayView1d< real64 const > const & temp = - subRegion.template getField< fields::flow::temperature >(); + subRegion.template getField< flow::temperature >(); temp_n.setValues< parallelDevicePolicy<> >( temp ); } @@ -640,9 +623,9 @@ ReactiveCompositionalMultiphaseOBL::implicitStepSetup( real64 const & GEOS_UNUSE updateOBLOperators( subRegion ); arrayView2d< real64 const, compflow::USD_OBL_VAL > const OBLOperatorValues = - subRegion.getField< fields::flow::OBLOperatorValues >(); + subRegion.getField< flow::OBLOperatorValues >(); arrayView2d< real64, compflow::USD_OBL_VAL > const OBLOperatorValues_n = - subRegion.getField< fields::flow::OBLOperatorValues_n >(); + subRegion.getField< flow::OBLOperatorValues_n >(); OBLOperatorValues_n.setValues< parallelDevicePolicy<> >( OBLOperatorValues ); } ); @@ -936,7 +919,7 @@ bool ReactiveCompositionalMultiphaseOBL::validateDirichletBC( DomainPartition & // 1. Check pressure Dirichlet BCs fsManager.apply< ElementSubRegionBase >( time, mesh, - fields::flow::pressure::key(), + flow::pressure::key(), [&]( FieldSpecificationBase const &, string const & setName, SortedArrayView< localIndex const > const &, @@ -952,7 +935,7 @@ bool ReactiveCompositionalMultiphaseOBL::validateDirichletBC( DomainPartition & { bcConsistent = false; GEOS_WARNING( BCMessage::pressureConflict( regionName, subRegionName, setName, - fields::flow::pressure::key() ) ); + flow::pressure::key() ) ); } subRegionSetMap[setName].setNumComp( numCompWithEnergy ); } ); @@ -960,7 +943,7 @@ bool ReactiveCompositionalMultiphaseOBL::validateDirichletBC( DomainPartition & // 2. Check composition BC (global component fraction) fsManager.apply< ElementSubRegionBase >( time, mesh, - fields::flow::globalCompFraction::key(), + flow::globalCompFraction::key(), [&] ( FieldSpecificationBase const & fs, string const & setName, SortedArrayView< localIndex const > const &, @@ -977,13 +960,13 @@ bool ReactiveCompositionalMultiphaseOBL::validateDirichletBC( DomainPartition & { bcConsistent = false; GEOS_WARNING( BCMessage::missingPressure( regionName, subRegionName, setName, - fields::flow::pressure::key() ) ); + flow::pressure::key() ) ); } if( comp < 0 || comp >= numComp ) { bcConsistent = false; GEOS_WARNING( BCMessage::invalidComponentIndex( comp, fs.getName(), - fields::flow::globalCompFraction::key() ) ); + flow::globalCompFraction::key() ) ); return; // can't check next part with invalid component id } @@ -996,7 +979,7 @@ bool ReactiveCompositionalMultiphaseOBL::validateDirichletBC( DomainPartition & arrayView1d< string const > componentNames = bc.getComponentNames(); GEOS_WARNING( BCMessage::conflictingComposition( comp, componentNames[comp], regionName, subRegionName, setName, - fields::flow::globalCompFraction::key() ) ); + flow::globalCompFraction::key() ) ); } ); } compMask.set( comp ); @@ -1007,7 +990,7 @@ bool ReactiveCompositionalMultiphaseOBL::validateDirichletBC( DomainPartition & // 3. Check temperature Dirichlet BCs fsManager.apply< ElementSubRegionBase >( time, mesh, - fields::flow::temperature::key(), + flow::temperature::key(), [&]( FieldSpecificationBase const &, string const & setName, SortedArrayView< localIndex const > const &, @@ -1023,7 +1006,7 @@ bool ReactiveCompositionalMultiphaseOBL::validateDirichletBC( DomainPartition & { bcConsistent = false; GEOS_WARNING( BCMessage::pressureConflict( regionName, subRegionName, setName, - fields::flow::pressure::key() ) ); + flow::pressure::key() ) ); } ComponentMask< MAX_NC > & compMask = subRegionSetMap[setName]; @@ -1032,7 +1015,7 @@ bool ReactiveCompositionalMultiphaseOBL::validateDirichletBC( DomainPartition & { bcConsistent = false; GEOS_WARNING( BCMessage::temperatureConflict( regionName, subRegionName, setName, - fields::flow::temperature::key() )); + flow::temperature::key() )); } compMask.set( numComp ); } ); @@ -1056,7 +1039,7 @@ bool ReactiveCompositionalMultiphaseOBL::validateDirichletBC( DomainPartition & bcConsistent = false; GEOS_WARNING( BCMessage::notAppliedOnRegion( ic, componentNames[ic], regionEntry.first, subRegionEntry.first, setEntry.first, - fields::flow::globalCompFraction::key() ) ); + flow::globalCompFraction::key() ) ); } } } ); @@ -1093,7 +1076,7 @@ void ReactiveCompositionalMultiphaseOBL::applyDirichletBC( real64 const time, // 1. Apply pressure Dirichlet BCs, store in a separate field fsManager.apply< ElementSubRegionBase >( time + dt, mesh, - fields::flow::pressure::key(), + flow::pressure::key(), [&]( FieldSpecificationBase const & fs, string const & setName, SortedArrayView< localIndex const > const & targetSet, @@ -1111,13 +1094,13 @@ void ReactiveCompositionalMultiphaseOBL::applyDirichletBC( real64 const time, fs.applyFieldValue< FieldSpecificationEqual, parallelDevicePolicy<> >( targetSet, time + dt, subRegion, - fields::flow::bcPressure::key() ); + flow::bcPressure::key() ); } ); // 2. Apply composition BC (global component fraction), store in a separate field fsManager.apply< ElementSubRegionBase >( time + dt, mesh, - fields::flow::globalCompFraction::key(), + flow::globalCompFraction::key(), [&] ( FieldSpecificationBase const & fs, string const &, SortedArrayView< localIndex const > const & targetSet, @@ -1127,13 +1110,13 @@ void ReactiveCompositionalMultiphaseOBL::applyDirichletBC( real64 const time, fs.applyFieldValue< FieldSpecificationEqual, parallelDevicePolicy<> >( targetSet, time + dt, subRegion, - fields::flow::bcGlobalCompFraction::key() ); + flow::bcGlobalCompFraction::key() ); } ); // 3. Apply temperature Dirichlet BCs, store in a separate field fsManager.apply< ElementSubRegionBase >( time + dt, mesh, - fields::flow::temperature::key(), + flow::temperature::key(), [&]( FieldSpecificationBase const & fs, string const & setName, SortedArrayView< localIndex const > const & targetSet, @@ -1151,7 +1134,7 @@ void ReactiveCompositionalMultiphaseOBL::applyDirichletBC( real64 const time, fs.applyFieldValue< FieldSpecificationEqual, parallelDevicePolicy<> >( targetSet, time + dt, subRegion, - fields::flow::bcTemperature::key() ); + flow::bcTemperature::key() ); } ); globalIndex const rankOffset = dofManager.rankOffset(); @@ -1161,20 +1144,20 @@ void ReactiveCompositionalMultiphaseOBL::applyDirichletBC( real64 const time, // 3. Apply to the system fsManager.apply< ElementSubRegionBase >( time + dt, mesh, - fields::flow::pressure::key(), + flow::pressure::key(), [&] ( FieldSpecificationBase const &, string const &, SortedArrayView< localIndex const > const & targetSet, ElementSubRegionBase & subRegion, string const & ) { - arrayView1d< real64 const > const bcPres = subRegion.getField< fields::flow::bcPressure >(); - arrayView2d< real64 const, compflow::USD_COMP > const bcCompFrac = subRegion.getField< fields::flow::bcGlobalCompFraction >(); - arrayView1d< real64 const > const bcTemp = subRegion.getField< fields::flow::bcTemperature >(); + arrayView1d< real64 const > const bcPres = subRegion.getField< flow::bcPressure >(); + arrayView2d< real64 const, compflow::USD_COMP > const bcCompFrac = subRegion.getField< flow::bcGlobalCompFraction >(); + arrayView1d< real64 const > const bcTemp = subRegion.getField< flow::bcTemperature >(); - arrayView1d< real64 const > const pres = subRegion.getField< fields::flow::pressure >(); - arrayView2d< real64 const, compflow::USD_COMP > const compFrac = subRegion.getField< fields::flow::globalCompFraction >(); - arrayView1d< real64 const > const temp = subRegion.getField< fields::flow::temperature >(); + arrayView1d< real64 const > const pres = subRegion.getField< flow::pressure >(); + arrayView2d< real64 const, compflow::USD_COMP > const compFrac = subRegion.getField< flow::globalCompFraction >(); + arrayView1d< real64 const > const temp = subRegion.getField< flow::temperature >(); arrayView1d< integer const > const ghostRank = subRegion.ghostRank(); arrayView1d< globalIndex const > const dofNumber = subRegion.getReference< array1d< globalIndex > >( dofKey ); @@ -1246,7 +1229,7 @@ void ReactiveCompositionalMultiphaseOBL::chopPrimaryVariables( DomainPartition & ElementSubRegionBase & subRegion ) { arrayView2d< real64, compflow::USD_COMP > const compFrac = - subRegion.template getField< fields::flow::globalCompFraction >(); + subRegion.template getField< flow::globalCompFraction >(); forAll< parallelDevicePolicy<> >( subRegion.size(), [=] GEOS_HOST_DEVICE ( localIndex const ei ) { @@ -1309,27 +1292,27 @@ void ReactiveCompositionalMultiphaseOBL::resetStateToBeginningOfStep( DomainPart auto & subRegion ) { arrayView1d< real64 const > const & pres_n = - subRegion.template getField< fields::flow::pressure_n >(); + subRegion.template getField< flow::pressure_n >(); arrayView1d< real64 > const & pres = - subRegion.template getField< fields::flow::pressure >(); + subRegion.template getField< flow::pressure >(); pres.setValues< parallelDevicePolicy<> >( pres_n ); // for single component problems (e.g., geothermal), global component fraction is not a primary variable if( m_numComponents > 1 ) { arrayView2d< real64 const, compflow::USD_COMP > const & compFrac_n = - subRegion.template getField< fields::flow::globalCompFraction_n >(); + subRegion.template getField< flow::globalCompFraction_n >(); arrayView2d< real64, compflow::USD_COMP > const & compFrac = - subRegion.template getField< fields::flow::globalCompFraction >(); + subRegion.template getField< flow::globalCompFraction >(); compFrac.setValues< parallelDevicePolicy<> >( compFrac_n ); } if( m_enableEnergyBalance ) { arrayView1d< real64 const > const & temp_n = - subRegion.template getField< fields::flow::temperature_n >(); + subRegion.template getField< flow::temperature_n >(); arrayView1d< real64 > const & temp = - subRegion.template getField< fields::flow::temperature >(); + subRegion.template getField< flow::temperature >(); temp.setValues< parallelDevicePolicy<> >( temp_n ); } diff --git a/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseBase.cpp b/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseBase.cpp index 94f3d46a640..ae687f930b4 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseBase.cpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseBase.cpp @@ -54,6 +54,7 @@ namespace geos using namespace dataRepository; using namespace constitutive; +using namespace fields; using namespace singlePhaseBaseKernels; SinglePhaseBase::SinglePhaseBase( const string & name, @@ -76,8 +77,6 @@ SinglePhaseBase::SinglePhaseBase( const string & name, void SinglePhaseBase::registerDataOnMesh( Group & meshBodies ) { - using namespace fields::flow; - FlowSolverBase::registerDataOnMesh( meshBodies ); m_numDofPerCell = m_isThermal ? 2 : 1; @@ -93,15 +92,15 @@ void SinglePhaseBase::registerDataOnMesh( Group & meshBodies ) [&]( localIndex const, ElementSubRegionBase & subRegion ) { - subRegion.registerField< mobility >( getName() ); - subRegion.registerField< dMobility_dPressure >( getName() ); + subRegion.registerField< flow::mobility >( getName() ); + subRegion.registerField< flow::dMobility_dPressure >( getName() ); - subRegion.registerField< fields::flow::mass >( getName() ); - subRegion.registerField< fields::flow::mass_n >( getName() ); + subRegion.registerField< flow::mass >( getName() ); + subRegion.registerField< flow::mass_n >( getName() ); if( m_isThermal ) { - subRegion.registerField< dMobility_dTemperature >( getName() ); + subRegion.registerField< flow::dMobility_dTemperature >( getName() ); } } ); @@ -109,16 +108,14 @@ void SinglePhaseBase::registerDataOnMesh( Group & meshBodies ) [&]( localIndex const, SurfaceElementSubRegion & subRegion ) { - subRegion.registerField< fields::flow::massCreated >( getName() ); + subRegion.registerField< flow::massCreated >( getName() ); } ); FaceManager & faceManager = mesh.getFaceManager(); { - faceManager.registerField< facePressure >( getName() ); - if( m_isThermal ) { - faceManager.registerField< faceTemperature >( getName() ); + faceManager.registerField< flow::faceTemperature >( getName() ); } } } ); @@ -131,25 +128,11 @@ void SinglePhaseBase::setConstitutiveNamesCallSuper( ElementSubRegionBase & subR void SinglePhaseBase::setConstitutiveNames( ElementSubRegionBase & subRegion ) const { - string & fluidName = subRegion.getReference< string >( viewKeyStruct::fluidNamesString() ); - fluidName = getConstitutiveName< SingleFluidBase >( subRegion ); - GEOS_ERROR_IF( fluidName.empty(), GEOS_FMT( "{}: Fluid model not found on subregion {}", - getDataContext(), subRegion.getName() ) ); + setConstitutiveName< SingleFluidBase >( subRegion, viewKeyStruct::fluidNamesString()); if( m_isThermal ) { - string & thermalConductivityName = subRegion.registerWrapper< string >( viewKeyStruct::thermalConductivityNamesString() ). - setPlotLevel( PlotLevel::NOPLOT ). - setRestartFlags( RestartFlags::NO_WRITE ). - setSizedFromParent( 0 ). - setDescription( "Name of the thermal conductivity constitutive model to use" ). - reference(); - - thermalConductivityName = getConstitutiveName< SinglePhaseThermalConductivityBase >( subRegion ); - GEOS_THROW_IF( thermalConductivityName.empty(), - GEOS_FMT( "{}: Thermal conductivity model not found on subregion {}", - getDataContext(), subRegion.getName() ), - InputError ); + setConstitutiveName< SinglePhaseThermalConductivityBase >( subRegion, viewKeyStruct::thermalConductivityNamesString()); } } @@ -177,12 +160,6 @@ void SinglePhaseBase::validateConstitutiveModels( DomainPartition & domain ) con ElementSubRegionBase & subRegion ) { string & fluidName = subRegion.getReference< string >( viewKeyStruct::fluidNamesString() ); - fluidName = getConstitutiveName< SingleFluidBase >( subRegion ); - GEOS_THROW_IF( fluidName.empty(), - GEOS_FMT( "SingleFluidBase {}: Fluid model not found on subregion {}", - getDataContext(), subRegion.getName() ), - InputError ); - SingleFluidBase const & fluid = getConstitutiveModel< SingleFluidBase >( subRegion, fluidName ); constitutiveUpdatePassThru( fluid, [&] ( auto & castedFluid ) @@ -238,7 +215,7 @@ void SinglePhaseBase::initializePreSubGroups() [&]( localIndex const, ElementSubRegionBase & subRegion ) { - arrayView1d< real64 > const temp = subRegion.getField< fields::flow::temperature >(); + arrayView1d< real64 > const temp = subRegion.getField< flow::temperature >(); temp.setValues< parallelHostPolicy >( m_inputTemperature ); } ); } ); @@ -251,8 +228,8 @@ void SinglePhaseBase::updateFluidModel( ObjectManagerBase & dataGroup ) const { GEOS_MARK_FUNCTION; - arrayView1d< real64 const > const pres = dataGroup.getField< fields::flow::pressure >(); - arrayView1d< real64 const > const temp = dataGroup.getField< fields::flow::temperature >(); + arrayView1d< real64 const > const pres = dataGroup.getField< flow::pressure >(); + arrayView1d< real64 const > const temp = dataGroup.getField< flow::temperature >(); SingleFluidBase & fluid = getConstitutiveModel< SingleFluidBase >( dataGroup, dataGroup.getReference< string >( viewKeyStruct::fluidNamesString() ) ); @@ -268,8 +245,8 @@ void SinglePhaseBase::updateMass( ElementSubRegionBase & subRegion ) const { GEOS_MARK_FUNCTION; - arrayView1d< real64 > const mass = subRegion.getField< fields::flow::mass >(); - arrayView1d< real64 > const mass_n = subRegion.getField< fields::flow::mass_n >(); + arrayView1d< real64 > const mass = subRegion.getField< flow::mass >(); + arrayView1d< real64 > const mass_n = subRegion.getField< flow::mass_n >(); CoupledSolidBase const & porousSolid = getConstitutiveModel< CoupledSolidBase >( subRegion, subRegion.template getReference< string >( viewKeyStruct::solidNamesString() ) ); @@ -277,7 +254,7 @@ void SinglePhaseBase::updateMass( ElementSubRegionBase & subRegion ) const arrayView2d< real64 const > const porosity_n = porousSolid.getPorosity_n(); arrayView1d< real64 const > const volume = subRegion.getElementVolume(); - arrayView1d< real64 > const deltaVolume = subRegion.getField< fields::flow::deltaVolume >(); + arrayView1d< real64 > const deltaVolume = subRegion.getField< flow::deltaVolume >(); SingleFluidBase & fluid = getConstitutiveModel< SingleFluidBase >( subRegion, subRegion.getReference< string >( viewKeyStruct::fluidNamesString() ) ); @@ -296,7 +273,7 @@ void SinglePhaseBase::updateEnergy( ElementSubRegionBase & subRegion ) const { GEOS_MARK_FUNCTION; - arrayView1d< real64 > const energy = subRegion.getField< fields::flow::energy >(); + arrayView1d< real64 > const energy = subRegion.getField< flow::energy >(); CoupledSolidBase const & porousSolid = getConstitutiveModel< CoupledSolidBase >( subRegion, subRegion.template getReference< string >( viewKeyStruct::solidNamesString() ) ); @@ -304,7 +281,7 @@ void SinglePhaseBase::updateEnergy( ElementSubRegionBase & subRegion ) const arrayView2d< real64 const > const rockInternalEnergy = porousSolid.getInternalEnergy(); arrayView1d< real64 const > const volume = subRegion.getElementVolume(); - arrayView1d< real64 > const deltaVolume = subRegion.getField< fields::flow::deltaVolume >(); + arrayView1d< real64 > const deltaVolume = subRegion.getField< flow::deltaVolume >(); SingleFluidBase & fluid = getConstitutiveModel< SingleFluidBase >( subRegion, subRegion.getReference< string >( viewKeyStruct::fluidNamesString() ) ); @@ -320,7 +297,7 @@ void SinglePhaseBase::updateEnergy( ElementSubRegionBase & subRegion ) const void SinglePhaseBase::updateSolidInternalEnergyModel( ObjectManagerBase & dataGroup ) const { - arrayView1d< real64 const > const temperature = dataGroup.getField< fields::flow::temperature >(); + arrayView1d< real64 const > const temperature = dataGroup.getField< flow::temperature >(); string const & solidInternalEnergyName = dataGroup.getReference< string >( viewKeyStruct::solidInternalEnergyNamesString() ); SolidInternalEnergy & solidInternalEnergy = getConstitutiveModel< SolidInternalEnergy >( dataGroup, solidInternalEnergyName ); @@ -336,7 +313,7 @@ void SinglePhaseBase::updateThermalConductivity( ElementSubRegionBase & subRegio SinglePhaseThermalConductivityBase const & conductivityMaterial = getConstitutiveModel< SinglePhaseThermalConductivityBase >( subRegion, thermalConductivityName ); - arrayView1d< real64 const > const & temperature = subRegion.template getField< fields::flow::temperature >(); + arrayView1d< real64 const > const & temperature = subRegion.template getField< flow::temperature >(); conductivityMaterial.updateFromTemperature( temperature ); } @@ -354,8 +331,8 @@ void SinglePhaseBase::updateMobility( ObjectManagerBase & dataGroup ) const // output - arrayView1d< real64 > const mob = dataGroup.getField< fields::flow::mobility >(); - arrayView1d< real64 > const dMob_dPres = dataGroup.getField< fields::flow::dMobility_dPressure >(); + arrayView1d< real64 > const mob = dataGroup.getField< flow::mobility >(); + arrayView1d< real64 > const dMob_dPres = dataGroup.getField< flow::dMobility_dPressure >(); // input @@ -366,7 +343,7 @@ void SinglePhaseBase::updateMobility( ObjectManagerBase & dataGroup ) const if( m_isThermal ) { arrayView1d< real64 > const dMob_dTemp = - dataGroup.getField< fields::flow::dMobility_dTemperature >(); + dataGroup.getField< flow::dMobility_dTemperature >(); ThermalFluidPropViews thermalFluidProps = getThermalFluidProperties( fluid ); @@ -401,7 +378,7 @@ void SinglePhaseBase::initializePostInitialConditionsPreSubGroups() DomainPartition & domain = this->getGroupByPath< DomainPartition >( "/Problem/domain" ); - FlowSolverBase::initializeState( domain ); + initializeState( domain ); } void SinglePhaseBase::computeHydrostaticEquilibrium( DomainPartition & domain ) @@ -561,7 +538,7 @@ void SinglePhaseBase::computeHydrostaticEquilibrium( DomainPartition & domain ) // Step 4: assign pressure as a function of elevation // TODO: this last step should probably be delayed to wait for the creation of FaceElements arrayView2d< real64 const > const elemCenter = subRegion.getElementCenter(); - arrayView1d< real64 > const pres = subRegion.getField< fields::flow::pressure >(); + arrayView1d< real64 > const pres = subRegion.getField< flow::pressure >(); RAJA::ReduceMin< parallelDeviceReduce, real64 > minPressure( LvArray::NumericLimits< real64 >::max ); @@ -635,7 +612,7 @@ void SinglePhaseBase::implicitStepSetup( real64 const & GEOS_UNUSED_PARAM( time_ { saveConvergedState( subRegion ); - arrayView1d< real64 > const & dVol = subRegion.template getField< fields::flow::deltaVolume >(); + arrayView1d< real64 > const & dVol = subRegion.template getField< flow::deltaVolume >(); dVol.zero(); // This should fix NaN density in newly created fracture elements @@ -654,8 +631,8 @@ void SinglePhaseBase::implicitStepSetup( real64 const & GEOS_UNUSED_PARAM( time_ mesh.getElemManager().forElementSubRegions< SurfaceElementSubRegion >( regionNames, [&]( localIndex const, SurfaceElementSubRegion & subRegion ) { - arrayView1d< real64 const > const aper = subRegion.getField< fields::flow::hydraulicAperture >(); - arrayView1d< real64 > const aper0 = subRegion.getField< fields::flow::aperture0 >(); + arrayView1d< real64 const > const aper = subRegion.getField< flow::hydraulicAperture >(); + arrayView1d< real64 > const aper0 = subRegion.getField< flow::aperture0 >(); aper0.setValues< parallelDevicePolicy<> >( aper ); // Needed coz faceElems don't exist when initializing. @@ -694,13 +671,13 @@ void SinglePhaseBase::implicitStepComplete( real64 const & time, ElementSubRegionBase & subRegion ) { // update deltaPressure - arrayView1d< real64 const > const pres = subRegion.getField< fields::flow::pressure >(); - arrayView1d< real64 const > const initPres = subRegion.getField< fields::flow::initialPressure >(); - arrayView1d< real64 > const deltaPres = subRegion.getField< fields::flow::deltaPressure >(); + arrayView1d< real64 const > const pres = subRegion.getField< flow::pressure >(); + arrayView1d< real64 const > const initPres = subRegion.getField< flow::initialPressure >(); + arrayView1d< real64 > const deltaPres = subRegion.getField< flow::deltaPressure >(); singlePhaseBaseKernels::StatisticsKernel:: saveDeltaPressure( subRegion.size(), pres, initPres, deltaPres ); - arrayView1d< real64 > const dVol = subRegion.getField< fields::flow::deltaVolume >(); + arrayView1d< real64 > const dVol = subRegion.getField< flow::deltaVolume >(); arrayView1d< real64 > const vol = subRegion.getReference< array1d< real64 > >( CellElementSubRegion::viewKeyStruct::elementVolumeString() ); forAll< parallelDevicePolicy<> >( subRegion.size(), [=] GEOS_HOST_DEVICE ( localIndex const ei ) @@ -741,7 +718,7 @@ void SinglePhaseBase::implicitStepComplete( real64 const & time, { arrayView1d< integer const > const elemGhostRank = subRegion.ghostRank(); arrayView1d< real64 const > const volume = subRegion.getElementVolume(); - arrayView1d< real64 > const creationMass = subRegion.getField< fields::flow::massCreated >(); + arrayView1d< real64 > const creationMass = subRegion.getField< flow::massCreated >(); SingleFluidBase const & fluid = getConstitutiveModel< SingleFluidBase >( subRegion, subRegion.template getReference< string >( viewKeyStruct::fluidNamesString() ) ); @@ -929,12 +906,12 @@ void SinglePhaseBase::applyDirichletBC( real64 const time_n, arrayView1d< string const > const & ) { applyAndSpecifyFieldValue( time_n, dt, mesh, rankOffset, dofKey, isFirstNonlinearIteration, - 0, fields::flow::pressure::key(), fields::flow::bcPressure::key(), + 0, flow::pressure::key(), flow::bcPressure::key(), localMatrix, localRhs ); if( m_isThermal ) { applyAndSpecifyFieldValue( time_n, dt, mesh, rankOffset, dofKey, isFirstNonlinearIteration, - 1, fields::flow::temperature::key(), fields::flow::bcTemperature::key(), + 1, flow::temperature::key(), flow::bcTemperature::key(), localMatrix, localRhs ); } } ); @@ -1160,8 +1137,8 @@ void SinglePhaseBase::keepVariablesConstantDuringInitStep( real64 const time, arrayView1d< integer const > const ghostRank = subRegion.ghostRank(); arrayView1d< globalIndex const > const dofNumber = subRegion.getReference< array1d< globalIndex > >( dofKey ); - arrayView1d< real64 const > const pres = subRegion.getField< fields::flow::pressure >(); - arrayView1d< real64 const > const temp = subRegion.getField< fields::flow::temperature >(); + arrayView1d< real64 const > const pres = subRegion.getField< flow::pressure >(); + arrayView1d< real64 const > const temp = subRegion.getField< flow::temperature >(); integer const isThermal = m_isThermal; forAll< parallelDevicePolicy<> >( subRegion.size(), [=] GEOS_HOST_DEVICE ( localIndex const ei ) @@ -1233,14 +1210,14 @@ void SinglePhaseBase::resetStateToBeginningOfStep( DomainPartition & domain ) mesh.getElemManager().forElementSubRegions< CellElementSubRegion, SurfaceElementSubRegion >( regionNames, [&]( localIndex const, auto & subRegion ) { - arrayView1d< real64 > const pres = subRegion.template getField< fields::flow::pressure >(); - arrayView1d< real64 const > const pres_n = subRegion.template getField< fields::flow::pressure_n >(); + arrayView1d< real64 > const pres = subRegion.template getField< flow::pressure >(); + arrayView1d< real64 const > const pres_n = subRegion.template getField< flow::pressure_n >(); pres.setValues< parallelDevicePolicy<> >( pres_n ); if( m_isThermal ) { - arrayView1d< real64 > const temp = subRegion.template getField< fields::flow::temperature >(); - arrayView1d< real64 const > const temp_n = subRegion.template getField< fields::flow::temperature_n >(); + arrayView1d< real64 > const temp = subRegion.template getField< flow::temperature >(); + arrayView1d< real64 const > const temp_n = subRegion.template getField< flow::temperature_n >(); temp.setValues< parallelDevicePolicy<> >( temp_n ); } @@ -1318,7 +1295,7 @@ bool SinglePhaseBase::checkSystemSolution( DomainPartition & domain, globalIndex const rankOffset = dofManager.rankOffset(); arrayView1d< globalIndex const > const dofNumber = subRegion.getReference< array1d< globalIndex > >( dofKey ); arrayView1d< integer const > const ghostRank = subRegion.ghostRank(); - arrayView1d< real64 const > const pres = subRegion.getField< fields::flow::pressure >(); + arrayView1d< real64 const > const pres = subRegion.getField< flow::pressure >(); auto const statistics = singlePhaseBaseKernels::SolutionCheckKernel:: @@ -1342,8 +1319,8 @@ void SinglePhaseBase::saveConvergedState( ElementSubRegionBase & subRegion ) con { FlowSolverBase::saveConvergedState( subRegion ); - arrayView1d< real64 const > const mass = subRegion.template getField< fields::flow::mass >(); - arrayView1d< real64 > const mass_n = subRegion.template getField< fields::flow::mass_n >(); + arrayView1d< real64 const > const mass = subRegion.template getField< flow::mass >(); + arrayView1d< real64 > const mass_n = subRegion.template getField< flow::mass_n >(); mass_n.setValues< parallelDevicePolicy<> >( mass ); } diff --git a/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseBaseFields.hpp b/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseBaseFields.hpp index b68848e634f..587363704d6 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseBaseFields.hpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseBaseFields.hpp @@ -33,6 +33,22 @@ namespace fields namespace flow { +DECLARE_FIELD( mass, + "mass", + array1d< real64 >, + 0, + LEVEL_0, + WRITE_AND_READ, + "Mass" ); + +DECLARE_FIELD( mass_n, + "mass_n", + array1d< real64 >, + 0, + NOPLOT, + WRITE_AND_READ, + "Mass at the previous converged time step" ); + DECLARE_FIELD( mobility, "mobility", array1d< real64 >, diff --git a/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseFVM.cpp b/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseFVM.cpp index 5da5846273c..3ede308ba56 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseFVM.cpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseFVM.cpp @@ -54,6 +54,7 @@ namespace geos using namespace dataRepository; using namespace constitutive; +using namespace fields; using namespace singlePhaseBaseKernels; using namespace singlePhaseFVMKernels; @@ -247,13 +248,13 @@ void SinglePhaseFVM< BASE >::applySystemSolution( DofManager const & dofManager, dofManager.addVectorToField( localSolution, BASE::viewKeyStruct::elemDofFieldString(), - fields::flow::pressure::key(), + flow::pressure::key(), scalingFactor, pressureMask ); dofManager.addVectorToField( localSolution, BASE::viewKeyStruct::elemDofFieldString(), - fields::flow::temperature::key(), + flow::temperature::key(), scalingFactor, temperatureMask ); } @@ -261,7 +262,7 @@ void SinglePhaseFVM< BASE >::applySystemSolution( DofManager const & dofManager, { dofManager.addVectorToField( localSolution, BASE::viewKeyStruct::elemDofFieldString(), - fields::flow::pressure::key(), + flow::pressure::key(), scalingFactor ); } @@ -269,11 +270,11 @@ void SinglePhaseFVM< BASE >::applySystemSolution( DofManager const & dofManager, MeshLevel & mesh, arrayView1d< string const > const & regionNames ) { - std::vector< string > fields{ fields::flow::pressure::key() }; + std::vector< string > fields{ flow::pressure::key() }; if( m_isThermal ) { - fields.emplace_back( fields::flow::temperature::key() ); + fields.emplace_back( flow::temperature::key() ); } FieldIdentifiers fieldsToBeSync; @@ -417,16 +418,16 @@ void SinglePhaseFVM< SinglePhaseProppantBase >::assembleFluxTerms( real64 const dofManager.rankOffset(), elemDofNumber.toNestedViewConst(), flowAccessors.get< fields::ghostRank >(), - flowAccessors.get< fields::flow::pressure >(), - flowAccessors.get< fields::flow::gravityCoefficient >(), - fluidAccessors.get< fields::singlefluid::density >(), - fluidAccessors.get< fields::singlefluid::dDensity_dPressure >(), - flowAccessors.get< fields::flow::mobility >(), - flowAccessors.get< fields::flow::dMobility_dPressure >(), - permAccessors.get< fields::permeability::permeability >(), - permAccessors.get< fields::permeability::dPerm_dPressure >(), - permAccessors.get< fields::permeability::dPerm_dDispJump >(), - permAccessors.get< fields::permeability::permeabilityMultiplier >(), + flowAccessors.get< flow::pressure >(), + flowAccessors.get< flow::gravityCoefficient >(), + fluidAccessors.get< singlefluid::density >(), + fluidAccessors.get< singlefluid::dDensity_dPressure >(), + flowAccessors.get< flow::mobility >(), + flowAccessors.get< flow::dMobility_dPressure >(), + permAccessors.get< permeability::permeability >(), + permAccessors.get< permeability::dPerm_dPressure >(), + permAccessors.get< permeability::dPerm_dDispJump >(), + permAccessors.get< permeability::permeabilityMultiplier >(), this->gravityVector(), localMatrix, localRhs ); @@ -685,7 +686,7 @@ void SinglePhaseFVM< BASE >::applyFaceDirichletBC( real64 const time_n, // Take BCs defined for "pressure" field and apply values to "facePressure" fsManager.apply< FaceManager >( time_n + dt, mesh, - fields::flow::pressure::key(), + flow::pressure::key(), [&] ( FieldSpecificationBase const & fs, string const & setName, SortedArrayView< localIndex const > const & targetSet, @@ -713,13 +714,13 @@ void SinglePhaseFVM< BASE >::applyFaceDirichletBC( real64 const time_n, parallelDevicePolicy<> >( targetSet, time_n + dt, targetGroup, - fields::flow::facePressure::key() ); + flow::facePressure::key() ); } ); // Take BCs defined for "temperature" field and apply values to "faceTemperature" fsManager.apply< FaceManager >( time_n + dt, mesh, - fields::flow::temperature::key(), + flow::temperature::key(), [&] ( FieldSpecificationBase const & fs, string const & setName, SortedArrayView< localIndex const > const & targetSet, @@ -747,7 +748,7 @@ void SinglePhaseFVM< BASE >::applyFaceDirichletBC( real64 const time_n, parallelDevicePolicy<> >( targetSet, time_n + dt, targetGroup, - fields::flow::faceTemperature::key() ); + flow::faceTemperature::key() ); } ); @@ -788,7 +789,7 @@ void SinglePhaseFVM< BASE >::applyFaceDirichletBC( real64 const time_n, // Take BCs defined for "pressure" field and apply values to "facePressure" fsManager.apply< FaceManager >( time_n + dt, mesh, - fields::flow::pressure::key(), + flow::pressure::key(), [&] ( FieldSpecificationBase const & fs, string const & setName, SortedArrayView< localIndex const > const & targetSet, @@ -815,7 +816,7 @@ void SinglePhaseFVM< BASE >::applyFaceDirichletBC( real64 const time_n, parallelDevicePolicy<> >( targetSet, time_n + dt, targetGroup, - fields::flow::facePressure::key() ); + flow::facePressure::key() ); // TODO: currently we just use model from the first cell in this stencil @@ -914,11 +915,11 @@ void SinglePhaseFVM<>::applyAquiferBC( real64 const time, flowAccessors.get< fields::ghostRank >(), aquiferBCWrapper, aquiferDens, - flowAccessors.get< fields::flow::pressure >(), - flowAccessors.get< fields::flow::pressure_n >(), - flowAccessors.get< fields::flow::gravityCoefficient >(), - fluidAccessors.get< fields::singlefluid::density >(), - fluidAccessors.get< fields::singlefluid::dDensity_dPressure >(), + flowAccessors.get< flow::pressure >(), + flowAccessors.get< flow::pressure_n >(), + flowAccessors.get< flow::gravityCoefficient >(), + fluidAccessors.get< singlefluid::density >(), + fluidAccessors.get< singlefluid::dDensity_dPressure >(), time, dt, localMatrix.toViewConstSizes(), diff --git a/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseHybridFVM.cpp b/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseHybridFVM.cpp index 5884b6fc416..abf0b1b6930 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseHybridFVM.cpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseHybridFVM.cpp @@ -43,6 +43,7 @@ namespace geos using namespace dataRepository; using namespace constitutive; +using namespace fields; using namespace singlePhaseHybridFVMKernels; using namespace mimeticInnerProduct; @@ -61,34 +62,29 @@ SinglePhaseHybridFVM::SinglePhaseHybridFVM( const string & name, void SinglePhaseHybridFVM::registerDataOnMesh( Group & meshBodies ) { - using namespace fields::flow; - - // 1) Register the cell-centered data SinglePhaseBase::registerDataOnMesh( meshBodies ); - // pressureGradient is specific for HybridFVM forDiscretizationOnMeshTargets( meshBodies, [&] ( string const &, MeshLevel & mesh, arrayView1d< string const > const & regionNames ) { + // 1) Register the cell-centered data ElementRegionManager & elemManager = mesh.getElemManager(); elemManager.forElementSubRegions< ElementSubRegionBase >( regionNames, [&]( localIndex const, ElementSubRegionBase & subRegion ) { - subRegion.registerField< pressureGradient >( getName() ). + // pressureGradient is specific for HybridFVM + subRegion.registerField< flow::pressureGradient >( getName() ). reference().resizeDimension< 1 >( 3 ); } ); - } ); - - // 2) Register the face data - meshBodies.forSubGroups< MeshBody >( [&] ( MeshBody & meshBody ) - { - MeshLevel & meshLevel = meshBody.getBaseDiscretization(); - FaceManager & faceManager = meshLevel.getFaceManager(); - // primary variables: face pressures at the previous converged time step - faceManager.registerField< fields::flow::facePressure_n >( getName() ); + // 2) Register the face data + FaceManager & faceManager = mesh.getFaceManager(); + { + // primary variables: face pressures at the previous converged time step + faceManager.registerField< flow::facePressure_n >( getName() ); + } } ); } @@ -135,7 +131,7 @@ void SinglePhaseHybridFVM::initializePostInitialConditionsPreSubGroups() // check that multipliers are stricly larger than 0, which would work with SinglePhaseFVM, but not with SinglePhaseHybridFVM. // To deal with a 0 multiplier, we would just have to skip the corresponding face in the FluxKernel - arrayView1d< real64 const > const transMultiplier = faceManager.getField< fields::flow::transMultiplier >(); + arrayView1d< real64 const > const transMultiplier = faceManager.getField< flow::transMultiplier >(); RAJA::ReduceMin< parallelDeviceReduce, real64 > minVal( 1.0 ); forAll< parallelDevicePolicy<> >( faceManager.size(), [=] GEOS_HOST_DEVICE ( localIndex const iface ) @@ -176,9 +172,9 @@ void SinglePhaseHybridFVM::implicitStepSetup( real64 const & time_n, // get the face-based pressures arrayView1d< real64 const > const & facePres = - faceManager.getField< fields::flow::facePressure >(); + faceManager.getField< flow::facePressure >(); arrayView1d< real64 > const & facePres_n = - faceManager.getField< fields::flow::facePressure_n >(); + faceManager.getField< flow::facePressure_n >(); facePres_n.setValues< parallelDevicePolicy<> >( facePres ); } ); } @@ -200,17 +196,17 @@ void SinglePhaseHybridFVM::setupDofs( DomainPartition const & GEOS_UNUSED_PARAM( DofManager::Connector::Face ); // setup the connectivity of face fields - dofManager.addField( fields::flow::facePressure::key(), + dofManager.addField( flow::facePressure::key(), FieldLocation::Face, 1, getMeshTargets() ); - dofManager.addCoupling( fields::flow::facePressure::key(), - fields::flow::facePressure::key(), + dofManager.addCoupling( flow::facePressure::key(), + flow::facePressure::key(), DofManager::Connector::Elem ); // setup coupling between pressure and face pressure - dofManager.addCoupling( fields::flow::facePressure::key(), + dofManager.addCoupling( flow::facePressure::key(), viewKeyStruct::elemDofFieldString(), DofManager::Connector::Elem ); } @@ -229,7 +225,7 @@ void SinglePhaseHybridFVM::assembleFluxTerms( real64 const dt, MimeticInnerProductBase const & mimeticInnerProductBase = hmDiscretization.getReference< MimeticInnerProductBase >( HybridMimeticDiscretization::viewKeyStruct::innerProductString() ); - string const faceDofKey = dofManager.getKey( fields::flow::facePressure::key() ); + string const faceDofKey = dofManager.getKey( flow::facePressure::key() ); string const elemDofKey = dofManager.getKey( viewKeyStruct::elemDofFieldString() ); // tolerance for transmissibility calculation @@ -347,7 +343,7 @@ void SinglePhaseHybridFVM::applyFaceDirichletBC( real64 const time_n, FieldSpecificationManager & fsManager = FieldSpecificationManager::getInstance(); - string const faceDofKey = dofManager.getKey( fields::flow::facePressure::key() ); + string const faceDofKey = dofManager.getKey( flow::facePressure::key() ); this->forDiscretizationOnMeshTargets( domain.getMeshBodies(), [&] ( string const &, MeshLevel & mesh, @@ -356,7 +352,7 @@ void SinglePhaseHybridFVM::applyFaceDirichletBC( real64 const time_n, FaceManager & faceManager = mesh.getFaceManager(); arrayView1d< real64 const > const presFace = - faceManager.getField< fields::flow::facePressure >(); + faceManager.getField< flow::facePressure >(); arrayView1d< globalIndex const > const faceDofNumber = faceManager.getReference< array1d< globalIndex > >( faceDofKey ); arrayView1d< integer const > const faceGhostRank = faceManager.ghostRank(); @@ -367,7 +363,7 @@ void SinglePhaseHybridFVM::applyFaceDirichletBC( real64 const time_n, // this is done this way for consistency with the standard TPFA scheme, which works in the same fashion fsManager.apply< FaceManager >( time_n + dt, mesh, - fields::flow::pressure::key(), + flow::pressure::key(), [&] ( FieldSpecificationBase const & fs, string const & setName, SortedArrayView< localIndex const > const & targetSet, @@ -391,7 +387,7 @@ void SinglePhaseHybridFVM::applyFaceDirichletBC( real64 const time_n, parallelDevicePolicy<> >( targetSet, time_n + dt, targetGroup, - fields::flow::facePressure::key() ); + flow::facePressure::key() ); // 2. second, modify the residual/jacobian matrix as needed to impose the boundary conditions forAll< parallelDevicePolicy<> >( targetSet.size(), [=] GEOS_HOST_DEVICE ( localIndex const a ) @@ -461,7 +457,7 @@ real64 SinglePhaseHybridFVM::calculateResidualNorm( real64 const & GEOS_UNUSED_P globalIndex const rankOffset = dofManager.rankOffset(); string const elemDofKey = dofManager.getKey( viewKeyStruct::elemDofFieldString() ); - string const faceDofKey = dofManager.getKey( fields::flow::facePressure::key() ); + string const faceDofKey = dofManager.getKey( flow::facePressure::key() ); forDiscretizationOnMeshTargets( domain.getMeshBodies(), [&] ( string const &, MeshLevel const & mesh, @@ -591,14 +587,14 @@ void SinglePhaseHybridFVM::applySystemSolution( DofManager const & dofManager, dofManager.addVectorToField( localSolution, viewKeyStruct::elemDofFieldString(), - fields::flow::pressure::key(), + flow::pressure::key(), scalingFactor ); // 2. apply the face-based update dofManager.addVectorToField( localSolution, - fields::flow::facePressure::key(), - fields::flow::facePressure::key(), + flow::facePressure::key(), + flow::facePressure::key(), scalingFactor ); // 3. synchronize @@ -608,8 +604,8 @@ void SinglePhaseHybridFVM::applySystemSolution( DofManager const & dofManager, { FieldIdentifiers fieldsToBeSync; - fieldsToBeSync.addElementFields( { fields::flow::pressure::key() }, regionNames ); - fieldsToBeSync.addFields( FieldLocation::Face, { fields::flow::facePressure::key() } ); + fieldsToBeSync.addElementFields( { flow::pressure::key() }, regionNames ); + fieldsToBeSync.addFields( FieldLocation::Face, { flow::facePressure::key() } ); CommunicationTools::getInstance().synchronizeFields( fieldsToBeSync, mesh, domain.getNeighbors(), true ); } ); @@ -630,9 +626,9 @@ void SinglePhaseHybridFVM::resetStateToBeginningOfStep( DomainPartition & domain // get the face pressure update arrayView1d< real64 > const & facePres = - faceManager.getField< fields::flow::facePressure >(); + faceManager.getField< flow::facePressure >(); arrayView1d< real64 const > const & facePres_n = - faceManager.getField< fields::flow::facePressure_n >(); + faceManager.getField< flow::facePressure_n >(); facePres.setValues< parallelDevicePolicy<> >( facePres_n ); } ); } diff --git a/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseProppantBase.cpp b/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseProppantBase.cpp index d5273602f58..a28f980b3e7 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseProppantBase.cpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseProppantBase.cpp @@ -34,8 +34,7 @@ namespace geos { using namespace constitutive; - -using constitutive::SlurryFluidBase; +using namespace fields; template< typename POROUSWRAPPER_TYPE > void execute3( POROUSWRAPPER_TYPE porousWrapper, @@ -66,30 +65,7 @@ SinglePhaseProppantBase::~SinglePhaseProppantBase() void SinglePhaseProppantBase::setConstitutiveNames( ElementSubRegionBase & subRegion ) const { - string & fluidMaterialName = subRegion.getReference< string >( viewKeyStruct::fluidNamesString() ); - fluidMaterialName = PhysicsSolverBase::getConstitutiveName< SlurryFluidBase >( subRegion ); - GEOS_ERROR_IF( fluidMaterialName.empty(), GEOS_FMT( "{}: Fluid model not found on subregion {}", - getDataContext(), subRegion.getName() ) ); -} - -void SinglePhaseProppantBase::validateConstitutiveModels( DomainPartition & domain ) const -{ - // Validate fluid models in regions - forDiscretizationOnMeshTargets( domain.getMeshBodies(), [&]( string const &, - MeshLevel & mesh, - arrayView1d< string const > const & regionNames ) - { - mesh.getElemManager().forElementSubRegions( regionNames, [&]( localIndex const, - ElementSubRegionBase & subRegion ) - { - string & fluidName = subRegion.getReference< string >( viewKeyStruct::fluidNamesString() ); - fluidName = getConstitutiveName< SlurryFluidBase >( subRegion ); - GEOS_THROW_IF( fluidName.empty(), - GEOS_FMT( "{}: Fluid model not found on subregion {}", - getDataContext(), subRegion.getName() ), - InputError ); - } ); - } ); + setConstitutiveName< SlurryFluidBase >( subRegion, viewKeyStruct::fluidNamesString() ); } SinglePhaseBase::FluidPropViews SinglePhaseProppantBase::getFluidProperties( constitutive::ConstitutiveBase const & fluid ) const @@ -99,19 +75,19 @@ SinglePhaseBase::FluidPropViews SinglePhaseProppantBase::getFluidProperties( con slurryFluid.dDensity_dPressure(), slurryFluid.viscosity(), slurryFluid.dViscosity_dPressure(), - slurryFluid.getField< fields::singlefluid::density >().getDefaultValue(), - slurryFluid.getField< fields::singlefluid::viscosity >().getDefaultValue() }; + slurryFluid.getField< singlefluid::density >().getDefaultValue(), + slurryFluid.getField< singlefluid::viscosity >().getDefaultValue() }; } void SinglePhaseProppantBase::updateFluidModel( ObjectManagerBase & dataGroup ) const { GEOS_MARK_FUNCTION; - arrayView1d< real64 const > const pres = dataGroup.getField< fields::flow::pressure >(); - arrayView1d< real64 const > const proppantConcentration = dataGroup.getField< fields::proppant::proppantConcentration >(); - arrayView2d< real64 const > const componentConcentration = dataGroup.getField< fields::proppant::componentConcentration >(); - arrayView2d< real64 const > const cellBasedFlux = dataGroup.getField< fields::proppant::cellBasedFlux >(); - arrayView1d< integer const > const isProppantBoundaryElement = dataGroup.getField< fields::proppant::isProppantBoundary >(); + arrayView1d< real64 const > const pres = dataGroup.getField< flow::pressure >(); + arrayView1d< real64 const > const proppantConcentration = dataGroup.getField< proppant::proppantConcentration >(); + arrayView2d< real64 const > const componentConcentration = dataGroup.getField< proppant::componentConcentration >(); + arrayView2d< real64 const > const cellBasedFlux = dataGroup.getField< proppant::cellBasedFlux >(); + arrayView1d< integer const > const isProppantBoundaryElement = dataGroup.getField< proppant::isProppantBoundary >(); string const & fluidName = dataGroup.getReference< string >( viewKeyStruct::fluidNamesString() ); SlurryFluidBase & fluid = getConstitutiveModel< SlurryFluidBase >( dataGroup, fluidName ); @@ -133,10 +109,10 @@ void SinglePhaseProppantBase::updatePorosityAndPermeability( SurfaceElementSubRe { GEOS_MARK_FUNCTION; - arrayView1d< real64 const > const proppantPackVolumeFraction = subRegion.getField< fields::proppant::proppantPackVolumeFraction >(); + arrayView1d< real64 const > const proppantPackVolumeFraction = subRegion.getField< proppant::proppantPackVolumeFraction >(); - arrayView1d< real64 const > const newHydraulicAperture = subRegion.getField< fields::flow::hydraulicAperture >(); - arrayView1d< real64 const > const oldHydraulicAperture = subRegion.getField< fields::flow::aperture0 >(); + arrayView1d< real64 const > const newHydraulicAperture = subRegion.getField< flow::hydraulicAperture >(); + arrayView1d< real64 const > const oldHydraulicAperture = subRegion.getField< flow::aperture0 >(); string const & solidName = subRegion.getReference< string >( viewKeyStruct::solidNamesString() ); CoupledSolidBase & porousSolid = subRegion.template getConstitutiveModel< CoupledSolidBase >( solidName ); diff --git a/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseProppantBase.hpp b/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseProppantBase.hpp index f8d2e5c9a0b..d7a5ba384b1 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseProppantBase.hpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseProppantBase.hpp @@ -61,7 +61,8 @@ class SinglePhaseProppantBase : public SinglePhaseBase protected: - virtual void validateConstitutiveModels( DomainPartition & domain ) const override; + // this is needed to avoid calling SinglePhaseBase::validateConstitutiveModels + virtual void validateConstitutiveModels( DomainPartition & domain ) const override { GEOS_UNUSED_VAR( domain ); } virtual FluidPropViews getFluidProperties( constitutive::ConstitutiveBase const & fluid ) const override; diff --git a/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseStatistics.cpp b/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseStatistics.cpp index b92701b6ee1..fe29e7000e2 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseStatistics.cpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseStatistics.cpp @@ -35,6 +35,7 @@ namespace geos { using namespace constitutive; +using namespace fields; using namespace dataRepository; SinglePhaseStatistics::SinglePhaseStatistics( const string & name, @@ -134,9 +135,9 @@ void SinglePhaseStatistics::computeRegionStatistics( real64 const time, arrayView1d< integer const > const elemGhostRank = subRegion.ghostRank(); arrayView1d< real64 const > const volume = subRegion.getElementVolume(); - arrayView1d< real64 const > const pres = subRegion.getField< fields::flow::pressure >(); - arrayView1d< real64 const > const deltaPres = subRegion.getField< fields::flow::deltaPressure >(); - arrayView1d< real64 const > const temp = subRegion.getField< fields::flow::temperature >(); + arrayView1d< real64 const > const pres = subRegion.getField< flow::pressure >(); + arrayView1d< real64 const > const deltaPres = subRegion.getField< flow::deltaPressure >(); + arrayView1d< real64 const > const temp = subRegion.getField< flow::temperature >(); string const & solidName = subRegion.getReference< string >( SinglePhaseBase::viewKeyStruct::solidNamesString() ); Group const & constitutiveModels = subRegion.getGroup( ElementSubRegionBase::groupKeyStruct::constitutiveModelsString() ); diff --git a/src/coreComponents/physicsSolvers/fluidFlow/StencilDataCollection.cpp b/src/coreComponents/physicsSolvers/fluidFlow/StencilDataCollection.cpp index 11e6637c29a..33c9508320d 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/StencilDataCollection.cpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/StencilDataCollection.cpp @@ -33,7 +33,7 @@ namespace geos using namespace constitutive; using namespace dataRepository; - +using namespace fields; StencilDataCollection::StencilDataCollection( const string & name, Group * const parent ): @@ -146,7 +146,7 @@ class StencilDataCollection::Kernel using ElementViewConst = ElementRegionManager::ElementViewConst< VIEWTYPE >; using PermeabilityAccessors = StencilMaterialAccessors< PermeabilityBase, - fields::permeability::permeability >; + permeability::permeability >; /** @@ -204,7 +204,7 @@ StencilDataCollection::gatherConnectionData( STENCILWRAPPER_T const & stencilWra typename Kernel::PermeabilityAccessors accessor( elemManager, m_solver->getName() ); Kernel::launch< parallelDevicePolicy<> >( kernelData.toView(), stencilWrapper, - accessor.get< fields::permeability::permeability >() ); + accessor.get< permeability::permeability >() ); return kernelData; } diff --git a/src/coreComponents/physicsSolvers/fluidFlow/kernels/compositional/AquiferBCKernel.cpp b/src/coreComponents/physicsSolvers/fluidFlow/kernels/compositional/AquiferBCKernel.cpp index 9d107531c46..bb9d50f29b8 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/kernels/compositional/AquiferBCKernel.cpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/kernels/compositional/AquiferBCKernel.cpp @@ -23,11 +23,12 @@ namespace geos { -using namespace constitutive; namespace isothermalCompositionalMultiphaseFVMKernels { +using namespace constitutive; + /******************************** AquiferBCKernel ********************************/ template< integer NC > diff --git a/src/coreComponents/physicsSolvers/fluidFlow/kernels/compositional/CFLKernel.cpp b/src/coreComponents/physicsSolvers/fluidFlow/kernels/compositional/CFLKernel.cpp index ab2b2838d7b..7807d6009d7 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/kernels/compositional/CFLKernel.cpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/kernels/compositional/CFLKernel.cpp @@ -26,11 +26,12 @@ namespace geos { -using namespace constitutive; namespace isothermalCompositionalMultiphaseFVMKernels { +using namespace constitutive; + /******************************** CFLFluxKernel ********************************/ template< integer NC > diff --git a/src/coreComponents/physicsSolvers/fluidFlow/kernels/compositional/CompositionalMultiphaseHybridFVMKernels.cpp b/src/coreComponents/physicsSolvers/fluidFlow/kernels/compositional/CompositionalMultiphaseHybridFVMKernels.cpp index e5ac3d7e7b8..8f23c7eab8a 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/kernels/compositional/CompositionalMultiphaseHybridFVMKernels.cpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/kernels/compositional/CompositionalMultiphaseHybridFVMKernels.cpp @@ -29,11 +29,12 @@ namespace geos { -using namespace constitutive; namespace compositionalMultiphaseHybridFVMKernels { +using namespace constitutive; + /******************************** UpwindingHelper ********************************/ template< integer NC, integer NP > diff --git a/src/coreComponents/physicsSolvers/fluidFlow/kernels/compositional/FluxComputeKernelBase.cpp b/src/coreComponents/physicsSolvers/fluidFlow/kernels/compositional/FluxComputeKernelBase.cpp index a5a01550c52..ec04f8d835d 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/kernels/compositional/FluxComputeKernelBase.cpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/kernels/compositional/FluxComputeKernelBase.cpp @@ -27,7 +27,7 @@ namespace geos { -using namespace constitutive; +using namespace fields; namespace isothermalCompositionalMultiphaseFVMKernels { @@ -48,13 +48,13 @@ FluxComputeKernelBase::FluxComputeKernelBase( integer const numPhases, m_dt( dt ), m_dofNumber( dofNumberAccessor.toNestedViewConst() ), m_ghostRank( compFlowAccessors.get( fields::ghostRank {} ) ), - m_gravCoef( compFlowAccessors.get( fields::flow::gravityCoefficient {} ) ), - m_pres( compFlowAccessors.get( fields::flow::pressure {} ) ), - m_phaseVolFrac( compFlowAccessors.get( fields::flow::phaseVolumeFraction {} ) ), - m_dPhaseVolFrac( compFlowAccessors.get( fields::flow::dPhaseVolumeFraction {} ) ), - m_dCompFrac_dCompDens( compFlowAccessors.get( fields::flow::dGlobalCompFraction_dGlobalCompDensity {} ) ), - m_phaseCompFrac( multiFluidAccessors.get( fields::multifluid::phaseCompFraction {} ) ), - m_dPhaseCompFrac( multiFluidAccessors.get( fields::multifluid::dPhaseCompFraction {} ) ), + m_gravCoef( compFlowAccessors.get( flow::gravityCoefficient {} ) ), + m_pres( compFlowAccessors.get( flow::pressure {} ) ), + m_phaseVolFrac( compFlowAccessors.get( flow::phaseVolumeFraction {} ) ), + m_dPhaseVolFrac( compFlowAccessors.get( flow::dPhaseVolumeFraction {} ) ), + m_dCompFrac_dCompDens( compFlowAccessors.get( flow::dGlobalCompFraction_dGlobalCompDensity {} ) ), + m_phaseCompFrac( multiFluidAccessors.get( multifluid::phaseCompFraction {} ) ), + m_dPhaseCompFrac( multiFluidAccessors.get( multifluid::dPhaseCompFraction {} ) ), m_localMatrix( localMatrix ), m_localRhs( localRhs ), m_kernelFlags( kernelFlags ) diff --git a/src/coreComponents/physicsSolvers/fluidFlow/kernels/singlePhase/AccumulationKernels.hpp b/src/coreComponents/physicsSolvers/fluidFlow/kernels/singlePhase/AccumulationKernels.hpp index c2e2845ff74..b8822b18cfa 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/kernels/singlePhase/AccumulationKernels.hpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/kernels/singlePhase/AccumulationKernels.hpp @@ -25,6 +25,7 @@ #include "constitutive/fluid/singlefluid/SingleFluidBase.hpp" #include "constitutive/solid/CoupledSolidBase.hpp" #include "physicsSolvers/fluidFlow/FlowSolverBaseFields.hpp" +#include "physicsSolvers/fluidFlow/SinglePhaseBaseFields.hpp" #include "codingUtilities/Utilities.hpp" namespace geos diff --git a/src/coreComponents/physicsSolvers/fluidFlow/proppantTransport/ProppantTransport.cpp b/src/coreComponents/physicsSolvers/fluidFlow/proppantTransport/ProppantTransport.cpp index 798286fc9e0..47709ce2b2f 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/proppantTransport/ProppantTransport.cpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/proppantTransport/ProppantTransport.cpp @@ -47,6 +47,7 @@ namespace geos using namespace dataRepository; using namespace constitutive; +using namespace fields; using namespace proppantTransportKernels; ProppantTransport::ProppantTransport( const string & name, @@ -90,8 +91,6 @@ void ProppantTransport::postInputInitialization() void ProppantTransport::registerDataOnMesh( Group & meshBodies ) { - using namespace fields::proppant; - FlowSolverBase::registerDataOnMesh( meshBodies ); forDiscretizationOnMeshTargets( meshBodies, [&]( string const &, @@ -99,42 +98,28 @@ void ProppantTransport::registerDataOnMesh( Group & meshBodies ) arrayView1d< string const > const & regionNames ) { - mesh.getElemManager().forElementSubRegions< CellElementSubRegion >( regionNames, + mesh.getElemManager().forElementSubRegions< ElementSubRegionBase >( regionNames, [&]( localIndex const, - CellElementSubRegion & subRegion ) + ElementSubRegionBase & subRegion ) { - subRegion.registerField< proppantConcentration >( getName() ); - subRegion.registerField< proppantConcentration_n >( getName() ); - subRegion.registerField< componentConcentration >( getName() ); - subRegion.registerField< componentConcentration_n >( getName() ); - subRegion.registerField< bcComponentConcentration >( getName() ); - subRegion.registerField< cellBasedFlux >( getName() ). + subRegion.registerField< proppant::proppantConcentration >( getName() ); + subRegion.registerField< proppant::proppantConcentration_n >( getName() ); + subRegion.registerField< proppant::componentConcentration >( getName() ); + subRegion.registerField< proppant::componentConcentration_n >( getName() ); + subRegion.registerField< proppant::bcComponentConcentration >( getName() ); + subRegion.registerField< proppant::cellBasedFlux >( getName() ). reference().resizeDimension< 1 >( 3 ); - subRegion.registerField< isProppantBoundary >( getName() ); - - setConstitutiveNames( subRegion ); + subRegion.registerField< proppant::isProppantBoundary >( getName() ); } ); mesh.getElemManager().forElementSubRegions< FaceElementSubRegion >( regionNames, [&]( localIndex const, FaceElementSubRegion & subRegion ) { - subRegion.registerField< proppantConcentration >( getName() ); - subRegion.registerField< proppantConcentration_n >( getName() ); - subRegion.registerField< componentConcentration >( getName() ); - subRegion.registerField< componentConcentration_n >( getName() ); - subRegion.registerField< bcComponentConcentration >( getName() ); - subRegion.registerField< componentDensity_n >( getName() ); - subRegion.registerField< cellBasedFlux >( getName() ). - reference().resizeDimension< 1 >( 3 ); - - subRegion.registerField< isProppantBoundary >( getName() ); - subRegion.registerField< isProppantMobile >( getName() ); - subRegion.registerField< proppantPackVolumeFraction >( getName() ); - subRegion.registerField< proppantExcessPackVolume >( getName() ); - subRegion.registerField< proppantLiftFlux >( getName() ); - - setConstitutiveNames( subRegion ); - + subRegion.registerField< proppant::componentDensity_n >( getName() ); + subRegion.registerField< proppant::isProppantMobile >( getName() ); + subRegion.registerField< proppant::proppantPackVolumeFraction >( getName() ); + subRegion.registerField< proppant::proppantExcessPackVolume >( getName() ); + subRegion.registerField< proppant::proppantLiftFlux >( getName() ); } ); } ); } @@ -142,21 +127,9 @@ void ProppantTransport::registerDataOnMesh( Group & meshBodies ) void ProppantTransport::setConstitutiveNames( ElementSubRegionBase & subRegion ) const { - string & fluidName = subRegion.getReference< string >( viewKeyStruct::fluidNamesString() ); - fluidName = getConstitutiveName< SlurryFluidBase >( subRegion ); - GEOS_THROW_IF( fluidName.empty(), - GEOS_FMT( "{}: Fluid model not found on subregion {}", - getDataContext(), subRegion.getName() ), - InputError ); - - subRegion.registerWrapper< string >( viewKeyStruct::proppantNamesString() ); - string & proppantName = subRegion.getReference< string >( viewKeyStruct::proppantNamesString() ); - proppantName = getConstitutiveName< ParticleFluidBase >( subRegion ); - GEOS_THROW_IF( proppantName.empty(), - GEOS_FMT( "{}: Proppant model not found on subregion {}", - getDataContext(), subRegion.getName() ), - InputError ); + setConstitutiveName< SlurryFluidBase >( subRegion, viewKeyStruct::fluidNamesString()); + setConstitutiveName< ParticleFluidBase >( subRegion, viewKeyStruct::proppantNamesString()); } @@ -192,8 +165,8 @@ void ProppantTransport::initializePreSubGroups() CellElementSubRegion & subRegion ) { - subRegion.getField< fields::proppant::componentConcentration >().resizeDimension< 1 >( m_numComponents ); - subRegion.getField< fields::proppant::componentConcentration_n >().resizeDimension< 1 >( m_numComponents ); + subRegion.getField< proppant::componentConcentration >().resizeDimension< 1 >( m_numComponents ); + subRegion.getField< proppant::componentConcentration_n >().resizeDimension< 1 >( m_numComponents ); } ); } } ); @@ -206,10 +179,10 @@ void ProppantTransport::resizeFractureFields( MeshLevel & mesh, arrayView1d< str mesh.getElemManager().forElementSubRegions< FaceElementSubRegion >( regionNames, [&]( localIndex const, FaceElementSubRegion & subRegion ) { - subRegion.getField< fields::proppant::componentConcentration >().resizeDimension< 1 >( m_numComponents ); - subRegion.getField< fields::proppant::componentConcentration_n >().resizeDimension< 1 >( m_numComponents ); - subRegion.getField< fields::proppant::componentDensity_n >().resizeDimension< 1 >( m_numComponents ); - subRegion.getField< fields::proppant::bcComponentConcentration >().resizeDimension< 1 >( m_numComponents ); + subRegion.getField< proppant::componentConcentration >().resizeDimension< 1 >( m_numComponents ); + subRegion.getField< proppant::componentConcentration_n >().resizeDimension< 1 >( m_numComponents ); + subRegion.getField< proppant::componentDensity_n >().resizeDimension< 1 >( m_numComponents ); + subRegion.getField< proppant::bcComponentConcentration >().resizeDimension< 1 >( m_numComponents ); } ); } } @@ -218,9 +191,9 @@ void ProppantTransport::updateFluidModel( ObjectManagerBase & dataGroup ) { GEOS_MARK_FUNCTION; - arrayView1d< real64 const > const pres = dataGroup.getField< fields::flow::pressure >(); + arrayView1d< real64 const > const pres = dataGroup.getField< flow::pressure >(); - arrayView2d< real64 const > const componentConc = dataGroup.getField< fields::proppant::componentConcentration >(); + arrayView2d< real64 const > const componentConc = dataGroup.getField< proppant::componentConcentration >(); SlurryFluidBase & fluid = getConstitutiveModel< SlurryFluidBase >( dataGroup, dataGroup.getReference< string >( viewKeyStruct::fluidNamesString() ) ); @@ -237,9 +210,9 @@ void ProppantTransport::updateComponentDensity( ObjectManagerBase & dataGroup ) { GEOS_MARK_FUNCTION; - arrayView1d< real64 const > const pres = dataGroup.getField< fields::flow::pressure >(); + arrayView1d< real64 const > const pres = dataGroup.getField< flow::pressure >(); - arrayView2d< real64 const > const componentConc = dataGroup.getField< fields::proppant::componentConcentration >(); + arrayView2d< real64 const > const componentConc = dataGroup.getField< proppant::componentConcentration >(); SlurryFluidBase & fluid = getConstitutiveModel< SlurryFluidBase >( dataGroup, dataGroup.getReference< string >( viewKeyStruct::fluidNamesString() ) ); @@ -257,7 +230,7 @@ void ProppantTransport::updateProppantModel( ObjectManagerBase & dataGroup ) { GEOS_MARK_FUNCTION; - arrayView1d< real64 const > const proppantConc = dataGroup.getField< fields::proppant::proppantConcentration >(); + arrayView1d< real64 const > const proppantConc = dataGroup.getField< proppant::proppantConcentration >(); SlurryFluidBase const & fluid = getConstitutiveModel< SlurryFluidBase >( dataGroup, dataGroup.getReference< string >( viewKeyStruct::fluidNamesString() ) ); @@ -288,9 +261,9 @@ void ProppantTransport::updateProppantMobility( ObjectManagerBase & dataGroup ) { GEOS_MARK_FUNCTION; - arrayView1d< real64 const > const conc = dataGroup.getField< fields::proppant::proppantConcentration >(); - arrayView1d< real64 const > const aperture = dataGroup.getReference< array1d< real64 > >( fields::elementAperture::key() ); - arrayView1d< integer > const isProppantMobile = dataGroup.getField< fields::proppant::isProppantMobile >(); + arrayView1d< real64 const > const conc = dataGroup.getField< proppant::proppantConcentration >(); + arrayView1d< real64 const > const aperture = dataGroup.getReference< array1d< real64 > >( elementAperture::key() ); + arrayView1d< integer > const isProppantMobile = dataGroup.getField< proppant::isProppantMobile >(); real64 const minAperture = m_minAperture; real64 const maxProppantConcentration = m_maxProppantConcentration; @@ -328,8 +301,8 @@ void ProppantTransport::initializePostInitialConditionsPreSubGroups() { FieldIdentifiers fieldsToBeSync; - fieldsToBeSync.addElementFields( { fields::proppant::proppantConcentration::key(), - fields::proppant::componentConcentration::key() }, + fieldsToBeSync.addElementFields( { proppant::proppantConcentration::key(), + proppant::componentConcentration::key() }, regionNames ); CommunicationTools::getInstance().synchronizeFields( fieldsToBeSync, mesh, domain.getNeighbors(), true ); @@ -343,7 +316,7 @@ void ProppantTransport::initializePostInitialConditionsPreSubGroups() SlurryFluidBase const & fluid = getConstitutiveModel< SlurryFluidBase >( subRegion, subRegion.getReference< string >( viewKeyStruct::fluidNamesString() ) ); arrayView3d< real64 const > const componentDens = fluid.componentDensity(); - arrayView2d< real64 > const componentDens_n = subRegion.getField< fields::proppant::componentDensity_n >(); + arrayView2d< real64 > const componentDens_n = subRegion.getField< proppant::componentDensity_n >(); forAll< parallelDevicePolicy<> >( subRegion.size(), [=] GEOS_HOST_DEVICE ( localIndex const ei ) { for( localIndex c = 0; c < numComponents; ++c ) @@ -384,10 +357,10 @@ void ProppantTransport::preStepUpdate( real64 const & time, SlurryFluidBase const & fluid = getConstitutiveModel< SlurryFluidBase >( subRegion, subRegion.getReference< string >( viewKeyStruct::fluidNamesString() ) ); arrayView3d< real64 const > const componentDens = fluid.componentDensity(); - arrayView2d< real64 > const componentDens_n = subRegion.getField< fields::proppant::componentDensity_n >(); + arrayView2d< real64 > const componentDens_n = subRegion.getField< proppant::componentDensity_n >(); - arrayView1d< real64 > const excessPackVolume = subRegion.getField< fields::proppant::proppantExcessPackVolume >(); - arrayView2d< real64 > const cellBasedFlux = subRegion.getField< fields::proppant::cellBasedFlux >(); + arrayView1d< real64 > const excessPackVolume = subRegion.getField< proppant::proppantExcessPackVolume >(); + arrayView2d< real64 > const cellBasedFlux = subRegion.getField< proppant::cellBasedFlux >(); forAll< parallelDevicePolicy<> >( subRegion.size(), [=] GEOS_HOST_DEVICE ( localIndex const ei ) { @@ -426,8 +399,8 @@ void ProppantTransport::postStepUpdate( real64 const & time_n, mesh.getElemManager().forElementSubRegions( regionNames, [&]( localIndex const, ElementSubRegionBase & subRegion ) { - arrayView1d< real64 > const & packVolFrac = subRegion.getField< fields::proppant::proppantPackVolumeFraction >(); - arrayView1d< real64 > const & proppantConc = subRegion.getField< fields::proppant::proppantConcentration >(); + arrayView1d< real64 > const & packVolFrac = subRegion.getField< proppant::proppantPackVolumeFraction >(); + arrayView1d< real64 > const & proppantConc = subRegion.getField< proppant::proppantConcentration >(); forAll< parallelDevicePolicy<> >( subRegion.size(), [=] GEOS_HOST_DEVICE ( localIndex const ei ) { @@ -458,12 +431,12 @@ void ProppantTransport::implicitStepSetup( real64 const & GEOS_UNUSED_PARAM( tim mesh.getElemManager().forElementSubRegions( regionNames, [&]( localIndex const, ElementSubRegionBase & subRegion ) { - arrayView1d< real64 const > const proppantConc = subRegion.getField< fields::proppant::proppantConcentration >(); - arrayView1d< real64 > const proppantConc_n = subRegion.getField< fields::proppant::proppantConcentration_n >(); + arrayView1d< real64 const > const proppantConc = subRegion.getField< proppant::proppantConcentration >(); + arrayView1d< real64 > const proppantConc_n = subRegion.getField< proppant::proppantConcentration_n >(); proppantConc_n.setValues< parallelDevicePolicy<> >( proppantConc ); - arrayView2d< real64 const > const componentConc = subRegion.getField< fields::proppant::componentConcentration >(); - arrayView2d< real64 > const componentConc_n = subRegion.getField< fields::proppant::componentConcentration_n >(); + arrayView2d< real64 const > const componentConc = subRegion.getField< proppant::componentConcentration >(); + arrayView2d< real64 > const componentConc_n = subRegion.getField< proppant::componentConcentration_n >(); componentConc_n.setValues< parallelDevicePolicy<> >( componentConc ); } ); } ); @@ -483,7 +456,7 @@ void ProppantTransport::implicitStepComplete( real64 const & GEOS_UNUSED_PARAM( ElementSubRegionBase & subRegion ) { arrayView1d< real64 > const proppantLiftFlux = - subRegion.getField< fields::proppant::proppantLiftFlux >(); + subRegion.getField< proppant::proppantLiftFlux >(); proppantLiftFlux.zero(); } ); } ); @@ -498,13 +471,13 @@ void ProppantTransport::setupDofs( DomainPartition const & GEOS_UNUSED_PARAM( do getName(), meshTarget.first.first.c_str(), meshTarget.first.second.c_str(), meshTarget.second )); } - dofManager.addField( fields::proppant::proppantConcentration::key(), + dofManager.addField( proppant::proppantConcentration::key(), FieldLocation::Elem, m_numDofPerCell, getMeshTargets() ); - dofManager.addCoupling( fields::proppant::proppantConcentration::key(), - fields::proppant::proppantConcentration::key(), + dofManager.addCoupling( proppant::proppantConcentration::key(), + proppant::proppantConcentration::key(), DofManager::Connector::Face ); } @@ -539,7 +512,7 @@ void ProppantTransport::assembleAccumulationTerms( real64 const dt, { GEOS_MARK_FUNCTION; - string const dofKey = dofManager.getKey( fields::proppant::proppantConcentration::key() ); + string const dofKey = dofManager.getKey( proppant::proppantConcentration::key() ); forDiscretizationOnMeshTargets( domain.getMeshBodies(), [&]( string const &, MeshLevel const & mesh, @@ -553,11 +526,11 @@ void ProppantTransport::assembleAccumulationTerms( real64 const dt, arrayView1d< integer const > const & elemGhostRank = subRegion.ghostRank(); arrayView1d< real64 const > const & volume = subRegion.getElementVolume(); - arrayView2d< real64 const > const componentDens_n = subRegion.getField< fields::proppant::componentDensity_n >(); - arrayView1d< real64 const > const proppantConc = subRegion.getField< fields::proppant::proppantConcentration >(); - arrayView1d< real64 const > const proppantConc_n = subRegion.getField< fields::proppant::proppantConcentration_n >(); - arrayView1d< real64 const > const proppantPackVolFrac = subRegion.getField< fields::proppant::proppantPackVolumeFraction >(); - arrayView1d< real64 const > const proppantLiftFlux = subRegion.getField< fields::proppant::proppantLiftFlux >(); + arrayView2d< real64 const > const componentDens_n = subRegion.getField< proppant::componentDensity_n >(); + arrayView1d< real64 const > const proppantConc = subRegion.getField< proppant::proppantConcentration >(); + arrayView1d< real64 const > const proppantConc_n = subRegion.getField< proppant::proppantConcentration_n >(); + arrayView1d< real64 const > const proppantPackVolFrac = subRegion.getField< proppant::proppantPackVolumeFraction >(); + arrayView1d< real64 const > const proppantLiftFlux = subRegion.getField< proppant::proppantLiftFlux >(); SlurryFluidBase const & fluid = getConstitutiveModel< SlurryFluidBase >( subRegion, subRegion.getReference< string >( viewKeyStruct::fluidNamesString() ) ); @@ -612,7 +585,7 @@ void ProppantTransport::assembleFluxTerms( real64 const dt, FluxApproximationBase const & fluxApprox = fvManager.getFluxApproximation( m_discretizationName ); - string const dofKey = dofManager.getKey( fields::proppant::proppantConcentration::key() ); + string const dofKey = dofManager.getKey( proppant::proppantConcentration::key() ); ElementRegionManager::ElementViewAccessor< arrayView1d< globalIndex const > > dofNumberAccessor = elemManager.constructViewAccessor< array1d< globalIndex >, arrayView1d< globalIndex const > >( dofKey ); @@ -634,33 +607,33 @@ void ProppantTransport::assembleFluxTerms( real64 const dt, downVector, dofNumberAccessor.toNestedViewConst(), flowAccessors.get< fields::ghostRank >(), - flowAccessors.get< fields::flow::pressure >(), - flowAccessors.get< fields::proppant::proppantConcentration >(), - slurryFluidAccessors.get< fields::slurryfluid::componentDensity >(), - slurryFluidAccessors.get< fields::slurryfluid::dComponentDensity_dPressure >(), - slurryFluidAccessors.get< fields::slurryfluid::dComponentDensity_dComponentConcentration >(), - flowAccessors.get< fields::flow::gravityCoefficient >(), - slurryFluidAccessors.get< fields::singlefluid::density >(), - slurryFluidAccessors.get< fields::singlefluid::dDensity_dPressure >(), - slurryFluidAccessors.get< fields::slurryfluid::dDensity_dProppantConcentration >(), - slurryFluidAccessors.get< fields::slurryfluid::dDensity_dComponentConcentration >(), - slurryFluidAccessors.get< fields::singlefluid::viscosity >(), - slurryFluidAccessors.get< fields::singlefluid::dViscosity_dPressure >(), - slurryFluidAccessors.get< fields::slurryfluid::dViscosity_dProppantConcentration >(), - slurryFluidAccessors.get< fields::slurryfluid::dViscosity_dComponentConcentration >(), - slurryFluidAccessors.get< fields::slurryfluid::fluidDensity >(), - slurryFluidAccessors.get< fields::slurryfluid::dFluidDensity_dPressure >(), - slurryFluidAccessors.get< fields::slurryfluid::dFluidDensity_dComponentConcentration >(), - particleFluidAccessors.get< fields::particlefluid::settlingFactor >(), - particleFluidAccessors.get< fields::particlefluid::dSettlingFactor_dPressure >(), - particleFluidAccessors.get< fields::particlefluid::dSettlingFactor_dProppantConcentration >(), - particleFluidAccessors.get< fields::particlefluid::dSettlingFactor_dComponentConcentration >(), - particleFluidAccessors.get< fields::particlefluid::collisionFactor >(), - particleFluidAccessors.get< fields::particlefluid::dCollisionFactor_dProppantConcentration >(), - flowAccessors.get< fields::proppant::isProppantMobile >(), - permAccessors.get< fields::permeability::permeability >(), - permAccessors.get< fields::permeability::permeabilityMultiplier >(), - flowAccessors.get< fields::elementAperture >(), + flowAccessors.get< flow::pressure >(), + flowAccessors.get< proppant::proppantConcentration >(), + slurryFluidAccessors.get< slurryfluid::componentDensity >(), + slurryFluidAccessors.get< slurryfluid::dComponentDensity_dPressure >(), + slurryFluidAccessors.get< slurryfluid::dComponentDensity_dComponentConcentration >(), + flowAccessors.get< flow::gravityCoefficient >(), + slurryFluidAccessors.get< singlefluid::density >(), + slurryFluidAccessors.get< singlefluid::dDensity_dPressure >(), + slurryFluidAccessors.get< slurryfluid::dDensity_dProppantConcentration >(), + slurryFluidAccessors.get< slurryfluid::dDensity_dComponentConcentration >(), + slurryFluidAccessors.get< singlefluid::viscosity >(), + slurryFluidAccessors.get< singlefluid::dViscosity_dPressure >(), + slurryFluidAccessors.get< slurryfluid::dViscosity_dProppantConcentration >(), + slurryFluidAccessors.get< slurryfluid::dViscosity_dComponentConcentration >(), + slurryFluidAccessors.get< slurryfluid::fluidDensity >(), + slurryFluidAccessors.get< slurryfluid::dFluidDensity_dPressure >(), + slurryFluidAccessors.get< slurryfluid::dFluidDensity_dComponentConcentration >(), + particleFluidAccessors.get< particlefluid::settlingFactor >(), + particleFluidAccessors.get< particlefluid::dSettlingFactor_dPressure >(), + particleFluidAccessors.get< particlefluid::dSettlingFactor_dProppantConcentration >(), + particleFluidAccessors.get< particlefluid::dSettlingFactor_dComponentConcentration >(), + particleFluidAccessors.get< particlefluid::collisionFactor >(), + particleFluidAccessors.get< particlefluid::dCollisionFactor_dProppantConcentration >(), + flowAccessors.get< proppant::isProppantMobile >(), + permAccessors.get< permeability::permeability >(), + permAccessors.get< permeability::permeabilityMultiplier >(), + flowAccessors.get< elementAperture >(), localMatrix, localRhs ); } ); @@ -677,7 +650,7 @@ void ProppantTransport::applyBoundaryConditions( real64 const time_n, GEOS_MARK_FUNCTION; FieldSpecificationManager & fsManager = FieldSpecificationManager::getInstance(); - string const dofKey = dofManager.getKey( fields::proppant::proppantConcentration::key() ); + string const dofKey = dofManager.getKey( proppant::proppantConcentration::key() ); globalIndex const rankOffset = dofManager.rankOffset(); forDiscretizationOnMeshTargets( domain.getMeshBodies(), [&]( string const &, @@ -688,7 +661,7 @@ void ProppantTransport::applyBoundaryConditions( real64 const time_n, fsManager.apply< ElementSubRegionBase >( time_n + dt, mesh, - fields::proppant::proppantConcentration::key(), + proppant::proppantConcentration::key(), [&]( FieldSpecificationBase const & fs, string const &, SortedArrayView< localIndex const > const & lset, @@ -699,7 +672,7 @@ void ProppantTransport::applyBoundaryConditions( real64 const time_n, dofNumber = subRegion.getReference< array1d< globalIndex > >( dofKey ); arrayView1d< real64 const > const - proppantConc = subRegion.getReference< array1d< real64 > >( fields::proppant::proppantConcentration::key() ); + proppantConc = subRegion.getReference< array1d< real64 > >( proppant::proppantConcentration::key() ); fs.applyBoundaryConditionToSystem< FieldSpecificationEqual, parallelDevicePolicy<> >( lset, @@ -719,7 +692,7 @@ void ProppantTransport::applyBoundaryConditions( real64 const time_n, fsManager.apply< ElementSubRegionBase >( time_n + dt, mesh, - fields::proppant::proppantConcentration::key(), + proppant::proppantConcentration::key(), [&]( FieldSpecificationBase const &, string const & setName, SortedArrayView< localIndex const > const &, @@ -737,7 +710,7 @@ void ProppantTransport::applyBoundaryConditions( real64 const time_n, fsManager.apply< ElementSubRegionBase >( time_n + dt, mesh, - fields::proppant::componentConcentration::key(), + proppant::componentConcentration::key(), [&] ( FieldSpecificationBase const & fs, string const & setName, SortedArrayView< localIndex const > const & targetSet, @@ -757,7 +730,7 @@ void ProppantTransport::applyBoundaryConditions( real64 const time_n, fs.applyFieldValue< FieldSpecificationEqual >( targetSet, time_n + dt, subRegion, - fields::proppant::bcComponentConcentration::key() ); + proppant::bcComponentConcentration::key() ); } ); @@ -781,7 +754,7 @@ void ProppantTransport::applyBoundaryConditions( real64 const time_n, fsManager.apply< ElementSubRegionBase >( time_n + dt, mesh, - fields::proppant::proppantConcentration::key(), + proppant::proppantConcentration::key(), [&] ( FieldSpecificationBase const &, string const &, SortedArrayView< localIndex const > const & targetSet, @@ -793,9 +766,9 @@ void ProppantTransport::applyBoundaryConditions( real64 const time_n, arrayView1d< globalIndex const > const dofNumber = subRegion.getReference< array1d< globalIndex > >( dofKey ); arrayView2d< real64 const > const compConc = - subRegion.getReference< array2d< real64 > >( fields::proppant::componentConcentration::key() ); + subRegion.getReference< array2d< real64 > >( proppant::componentConcentration::key() ); arrayView2d< real64 const > const bcCompConc = - subRegion.getReference< array2d< real64 > >( fields::proppant::bcComponentConcentration::key() ); + subRegion.getReference< array2d< real64 > >( proppant::bcComponentConcentration::key() ); forAll< parallelDevicePolicy<> >( targetSet.size(), [=] GEOS_HOST_DEVICE ( localIndex const a ) { @@ -838,7 +811,7 @@ ProppantTransport::calculateResidualNorm( real64 const & GEOS_UNUSED_PARAM( time physicsSolverBaseKernels::NormType const normType = getNonlinearSolverParameters().normType(); localIndex const rankOffset = dofManager.rankOffset(); - string const dofKey = dofManager.getKey( fields::proppant::proppantConcentration::key() ); + string const dofKey = dofManager.getKey( proppant::proppantConcentration::key() ); forDiscretizationOnMeshTargets( domain.getMeshBodies(), [&]( string const &, MeshLevel const & mesh, @@ -910,8 +883,8 @@ void ProppantTransport::applySystemSolution( DofManager const & dofManager, { GEOS_UNUSED_VAR( dt ); dofManager.addVectorToField( localSolution, - fields::proppant::proppantConcentration::key(), - fields::proppant::proppantConcentration::key(), + proppant::proppantConcentration::key(), + proppant::proppantConcentration::key(), scalingFactor, { m_numDofPerCell, 0, 1 } ); @@ -919,8 +892,8 @@ void ProppantTransport::applySystemSolution( DofManager const & dofManager, if( m_numDofPerCell > 1 ) { dofManager.addVectorToField( localSolution, - fields::proppant::proppantConcentration::key(), - fields::proppant::componentConcentration::key(), + proppant::proppantConcentration::key(), + proppant::componentConcentration::key(), scalingFactor, { m_numDofPerCell, 1, m_numDofPerCell } ); } @@ -932,8 +905,8 @@ void ProppantTransport::applySystemSolution( DofManager const & dofManager, { FieldIdentifiers fieldsToBeSync; - fieldsToBeSync.addElementFields( { fields::proppant::proppantConcentration::key(), - fields::proppant::componentConcentration::key() }, + fieldsToBeSync.addElementFields( { proppant::proppantConcentration::key(), + proppant::componentConcentration::key() }, regionNames ); CommunicationTools::getInstance().synchronizeFields( fieldsToBeSync, mesh, domain.getNeighbors(), true ); @@ -959,12 +932,12 @@ void ProppantTransport::resetStateToBeginningOfStep( DomainPartition & domain ) [&]( localIndex const, ElementSubRegionBase & subRegion ) { - arrayView1d< real64 > const & proppantConc = subRegion.getField< fields::proppant::proppantConcentration >(); - arrayView1d< real64 const > const & proppantConc_n = subRegion.getField< fields::proppant::proppantConcentration_n >(); + arrayView1d< real64 > const & proppantConc = subRegion.getField< proppant::proppantConcentration >(); + arrayView1d< real64 const > const & proppantConc_n = subRegion.getField< proppant::proppantConcentration_n >(); proppantConc.setValues< parallelDevicePolicy<> >( proppantConc_n ); - arrayView2d< real64 > const & componentConc = subRegion.getField< fields::proppant::componentConcentration >(); - arrayView2d< real64 const > const & componentConc_n = subRegion.getField< fields::proppant::componentConcentration_n >(); + arrayView2d< real64 > const & componentConc = subRegion.getField< proppant::componentConcentration >(); + arrayView2d< real64 const > const & componentConc_n = subRegion.getField< proppant::componentConcentration_n >(); componentConc.setValues< parallelDevicePolicy<> >( componentConc_n ); updateState( subRegion ); @@ -996,7 +969,7 @@ void ProppantTransport::updateCellBasedFlux( real64 const GEOS_UNUSED_PARAM( tim FluxApproximationBase const & fluxApprox = fvManager.getFluxApproximation( m_discretizationName ); ElementRegionManager::ElementViewAccessor< arrayView2d< real64 > > const & cellBasedFluxAccessor = - elemManager.constructViewAccessor< array2d< real64 >, arrayView2d< real64 > >( fields::proppant::cellBasedFlux::key() ); + elemManager.constructViewAccessor< array2d< real64 >, arrayView2d< real64 > >( proppant::cellBasedFlux::key() ); typename FluxKernel::CellBasedFluxFlowAccessors flowAccessors( elemManager, getName() ); typename FluxKernel::CellBasedFluxSlurryFluidAccessors slurryFluidAccessors( elemManager, getName() ); @@ -1008,18 +981,18 @@ void ProppantTransport::updateCellBasedFlux( real64 const GEOS_UNUSED_PARAM( tim FluxKernel::launchCellBasedFluxCalculation( stencilWrapper, downVector, - flowAccessors.get< fields::flow::pressure >(), - flowAccessors.get< fields::flow::gravityCoefficient >(), - slurryFluidAccessors.get< fields::singlefluid::density >(), - slurryFluidAccessors.get< fields::singlefluid::viscosity >(), - permAccessors.get< fields::permeability::permeability >(), - permAccessors.get< fields::permeability::permeabilityMultiplier >(), - flowAccessors.get< fields::elementAperture >(), + flowAccessors.get< flow::pressure >(), + flowAccessors.get< flow::gravityCoefficient >(), + slurryFluidAccessors.get< singlefluid::density >(), + slurryFluidAccessors.get< singlefluid::viscosity >(), + permAccessors.get< permeability::permeability >(), + permAccessors.get< permeability::permeabilityMultiplier >(), + flowAccessors.get< elementAperture >(), cellBasedFluxAccessor.toNestedView() ); } ); FieldIdentifiers fieldsToBeSync; - fieldsToBeSync.addElementFields( { fields::proppant::cellBasedFlux::key() }, regionNames ); + fieldsToBeSync.addElementFields( { proppant::cellBasedFlux::key() }, regionNames ); CommunicationTools::getInstance().synchronizeFields( fieldsToBeSync, mesh, domain.getNeighbors(), true ); } ); @@ -1048,16 +1021,16 @@ void ProppantTransport::updateProppantPackVolume( real64 const GEOS_UNUSED_PARAM // For data modified through an accessor, we must create the view accessor // every time in order to ensure the data gets properly touched on device ElementRegionManager::ElementViewAccessor< arrayView1d< real64 > > const proppantConc = - elemManager.constructViewAccessor< array1d< real64 >, arrayView1d< real64 > >( fields::proppant::proppantConcentration::key() ); + elemManager.constructViewAccessor< array1d< real64 >, arrayView1d< real64 > >( proppant::proppantConcentration::key() ); ElementRegionManager::ElementViewAccessor< arrayView1d< real64 > > const proppantPackVolFrac = - elemManager.constructViewAccessor< array1d< real64 >, arrayView1d< real64 > >( fields::proppant::proppantPackVolumeFraction::key() ); + elemManager.constructViewAccessor< array1d< real64 >, arrayView1d< real64 > >( proppant::proppantPackVolumeFraction::key() ); ElementRegionManager::ElementViewAccessor< arrayView1d< real64 > > const proppantExcessPackVolume = - elemManager.constructViewAccessor< array1d< real64 >, arrayView1d< real64 > >( fields::proppant::proppantExcessPackVolume::key() ); + elemManager.constructViewAccessor< array1d< real64 >, arrayView1d< real64 > >( proppant::proppantExcessPackVolume::key() ); ElementRegionManager::ElementViewAccessor< arrayView1d< real64 > > const proppantLiftFlux = - elemManager.constructViewAccessor< array1d< real64 >, arrayView1d< real64 > >( fields::proppant::proppantLiftFlux::key() ); + elemManager.constructViewAccessor< array1d< real64 >, arrayView1d< real64 > >( proppant::proppantLiftFlux::key() ); ElementRegionManager::ElementViewAccessor< arrayView1d< real64 const > > const - aperture = elemManager.constructArrayViewAccessor< real64, 1 >( fields::elementAperture::key() ); + aperture = elemManager.constructArrayViewAccessor< real64, 1 >( elementAperture::key() ); typename ProppantPackVolumeKernel::FlowAccessors flowAccessors( elemManager, getName() ); typename ProppantPackVolumeKernel::SlurryFluidAccessors slurryFluidAccessors( elemManager, getName() ); @@ -1073,16 +1046,16 @@ void ProppantTransport::updateProppantPackVolume( real64 const GEOS_UNUSED_PARAM downVector, m_criticalShieldsNumber, m_frictionCoefficient, - particleFluidAccessors.get< fields::particlefluid::settlingFactor >(), - slurryFluidAccessors.get< fields::singlefluid::density >(), - slurryFluidAccessors.get< fields::slurryfluid::fluidDensity >(), - slurryFluidAccessors.get< fields::slurryfluid::fluidViscosity >(), - flowAccessors.get< fields::proppant::isProppantMobile >(), - flowAccessors.get< fields::proppant::isProppantBoundary >(), + particleFluidAccessors.get< particlefluid::settlingFactor >(), + slurryFluidAccessors.get< singlefluid::density >(), + slurryFluidAccessors.get< slurryfluid::fluidDensity >(), + slurryFluidAccessors.get< slurryfluid::fluidViscosity >(), + flowAccessors.get< proppant::isProppantMobile >(), + flowAccessors.get< proppant::isProppantBoundary >(), flowAccessors.get< fields::elementAperture >(), flowAccessors.get< fields::elementVolume >(), flowAccessors.get< fields::ghostRank >(), - flowAccessors.get< fields::proppant::cellBasedFlux >(), + flowAccessors.get< proppant::cellBasedFlux >(), proppantConc.toNestedView(), proppantPackVolFrac.toNestedView(), proppantExcessPackVolume.toNestedView(), @@ -1091,10 +1064,10 @@ void ProppantTransport::updateProppantPackVolume( real64 const GEOS_UNUSED_PARAM { FieldIdentifiers fieldsToBeSync; - fieldsToBeSync.addElementFields( { fields::proppant::proppantConcentration::key(), - fields::proppant::proppantPackVolumeFraction::key(), - fields::proppant::proppantExcessPackVolume::key(), - fields::proppant::proppantLiftFlux::key() }, + fieldsToBeSync.addElementFields( { proppant::proppantConcentration::key(), + proppant::proppantPackVolumeFraction::key(), + proppant::proppantExcessPackVolume::key(), + proppant::proppantLiftFlux::key() }, regionNames ); CommunicationTools::getInstance().synchronizeFields( fieldsToBeSync, mesh, domain.getNeighbors(), true ); @@ -1113,7 +1086,7 @@ void ProppantTransport::updateProppantPackVolume( real64 const GEOS_UNUSED_PARAM ProppantPackVolumeKernel::launchProppantPackVolumeUpdate( stencil, downVector, m_maxProppantConcentration, - flowAccessors.get< fields::proppant::isProppantMobile >(), + flowAccessors.get< proppant::isProppantMobile >(), proppantExcessPackVolume.toNestedViewConst(), proppantConc.toNestedView(), proppantPackVolFrac.toNestedView() ); @@ -1122,8 +1095,8 @@ void ProppantTransport::updateProppantPackVolume( real64 const GEOS_UNUSED_PARAM { FieldIdentifiers fieldsToBeSync; - fieldsToBeSync.addElementFields( { fields::proppant::proppantConcentration::key(), - fields::proppant::proppantPackVolumeFraction::key() }, + fieldsToBeSync.addElementFields( { proppant::proppantConcentration::key(), + proppant::proppantPackVolumeFraction::key() }, regionNames ); CommunicationTools::getInstance().synchronizeFields( fieldsToBeSync, mesh, domain.getNeighbors(), true ); diff --git a/src/coreComponents/physicsSolvers/fluidFlow/wells/CompositionalMultiphaseWell.cpp b/src/coreComponents/physicsSolvers/fluidFlow/wells/CompositionalMultiphaseWell.cpp index e33e4ec0b17..7726ef2f760 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/wells/CompositionalMultiphaseWell.cpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/wells/CompositionalMultiphaseWell.cpp @@ -60,6 +60,7 @@ namespace geos using namespace dataRepository; using namespace constitutive; +using namespace fields; CompositionalMultiphaseWell::CompositionalMultiphaseWell( const string & name, Group * const parent ) @@ -167,9 +168,10 @@ void CompositionalMultiphaseWell::registerDataOnMesh( Group & meshBodies ) m_numPhases = fluid0.numFluidPhases(); m_numComponents = fluid0.numFluidComponents(); } - m_numDofPerWellElement = isThermal() ? m_numComponents + 3 : m_numComponents + 2; // 1 pressure + NC compositions + 1 connectionRate + - // temp if thermal - m_numDofPerResElement = isThermal() ? m_numComponents + 2 : m_numComponents + 1; // 1 pressure + NC compositions + temp if thermal + // 1 pressure + NC compositions + 1 connectionRate + temp if thermal + m_numDofPerWellElement = isThermal() ? m_numComponents + 3 : m_numComponents + 2; + // 1 pressure + NC compositions + temp if thermal + m_numDofPerResElement = isThermal() ? m_numComponents + 2 : m_numComponents + 1; // loop over the wells forDiscretizationOnMeshTargets( meshBodies, [&] ( string const &, @@ -184,54 +186,52 @@ void CompositionalMultiphaseWell::registerDataOnMesh( Group & meshBodies ) WellElementSubRegion & subRegion ) { string const & fluidName = getConstitutiveName< MultiFluidBase >( subRegion ); - GEOS_ERROR_IF( fluidName.empty(), GEOS_FMT( "{}: Fluid model not found on subregion {}", - getDataContext(), subRegion.getName() ) ); - MultiFluidBase const & fluid = subRegion.getConstitutiveModel< MultiFluidBase >( fluidName ); // The resizing of the arrays needs to happen here, before the call to initializePreSubGroups, // to make sure that the dimensions are properly set before the timeHistoryOutput starts its initialization. - subRegion.registerField< fields::well::globalCompDensity >( getName() ). + subRegion.registerField< well::globalCompDensity >( getName() ). reference().resizeDimension< 1 >( m_numComponents ); - subRegion.registerField< fields::well::globalCompDensity_n >( getName() ). + subRegion.registerField< well::globalCompDensity_n >( getName() ). reference().resizeDimension< 1 >( m_numComponents ); - subRegion.registerField< fields::well::mixtureConnectionRate >( getName() ); - subRegion.registerField< fields::well::mixtureConnectionRate_n >( getName() ); + subRegion.registerField< well::mixtureConnectionRate >( getName() ); + subRegion.registerField< well::mixtureConnectionRate_n >( getName() ); - subRegion.registerField< fields::well::globalCompFraction >( getName() ). + subRegion.registerField< well::globalCompFraction >( getName() ). setDimLabels( 1, fluid.componentNames() ). reference().resizeDimension< 1 >( m_numComponents ); - subRegion.registerField< fields::well::dGlobalCompFraction_dGlobalCompDensity >( getName() ). + subRegion.registerField< well::dGlobalCompFraction_dGlobalCompDensity >( getName() ). reference().resizeDimension< 1, 2 >( m_numComponents, m_numComponents ); - subRegion.registerField< fields::well::phaseVolumeFraction >( getName() ). + subRegion.registerField< well::phaseVolumeFraction >( getName() ). setDimLabels( 1, fluid.phaseNames() ). reference().resizeDimension< 1 >( m_numPhases ); - subRegion.registerField< fields::well::dPhaseVolumeFraction >( getName() ). + subRegion.registerField< well::dPhaseVolumeFraction >( getName() ). reference().resizeDimension< 1, 2 >( m_numPhases, m_numComponents + 2 ); // dP, dT, dC - subRegion.registerField< fields::well::totalMassDensity >( getName() ); - subRegion.registerField< fields::well::dTotalMassDensity >( getName() ). + subRegion.registerField< well::totalMassDensity >( getName() ); + subRegion.registerField< well::dTotalMassDensity >( getName() ). reference().resizeDimension< 1 >( m_numComponents +2 ); // dP, dT, dC - subRegion.registerField< fields::well::phaseVolumeFraction_n >( getName() ). + subRegion.registerField< well::phaseVolumeFraction_n >( getName() ). reference().resizeDimension< 1 >( m_numPhases ); - subRegion.registerField< fields::well::pressureScalingFactor >( getName() ); - subRegion.registerField< fields::well::temperatureScalingFactor >( getName() ); - subRegion.registerField< fields::well::globalCompDensityScalingFactor >( getName() ); + subRegion.registerField< well::pressureScalingFactor >( getName() ); + subRegion.registerField< well::temperatureScalingFactor >( getName() ); + subRegion.registerField< well::globalCompDensityScalingFactor >( getName() ); PerforationData & perforationData = *subRegion.getPerforationData(); - perforationData.registerField< fields::well::compPerforationRate >( getName() ). + perforationData.registerField< well::compPerforationRate >( getName() ). reference().resizeDimension< 1 >( m_numComponents ); - perforationData.registerField< fields::well::dCompPerforationRate >( getName() ).reference().resizeDimension< 1, 2, 3 >( 2, m_numComponents, m_numComponents+ 2 ); + perforationData.registerField< well::dCompPerforationRate >( getName() ). + reference().resizeDimension< 1, 2, 3 >( 2, m_numComponents, m_numComponents+ 2 ); if( fluid.isThermal() ) { - perforationData.registerField< fields::well::energyPerforationFlux >( getName() ); - perforationData.registerField< fields::well::dEnergyPerforationFlux >( getName() ). + perforationData.registerField< well::energyPerforationFlux >( getName() ); + perforationData.registerField< well::dEnergyPerforationFlux >( getName() ). reference().resizeDimension< 1, 2 >( 2, m_numComponents+2 ); } @@ -242,7 +242,6 @@ void CompositionalMultiphaseWell::registerDataOnMesh( Group & meshBodies ) setSizedFromParent( 0 ). reference().resizeDimension< 0 >( m_numComponents + 2 ); // dP, dT, dC - wellControls.registerWrapper< array1d< real64 > >( viewKeyStruct::currentPhaseVolRateString() ). setSizedFromParent( 0 ). reference().resizeDimension< 0 >( m_numPhases ); @@ -287,28 +286,9 @@ void CompositionalMultiphaseWell::registerDataOnMesh( Group & meshBodies ) void CompositionalMultiphaseWell::setConstitutiveNames( ElementSubRegionBase & subRegion ) const { + setConstitutiveName< MultiFluidBase >( subRegion, viewKeyStruct::fluidNamesString() ); - string & fluidName = subRegion.getReference< string >( viewKeyStruct::fluidNamesString() ); - fluidName = getConstitutiveName< MultiFluidBase >( subRegion ); - GEOS_THROW_IF( fluidName.empty(), - GEOS_FMT( "{}: Fluid model not found on subregion {}", - getDataContext(), subRegion.getName() ), - InputError ); - - string & relPermName = subRegion.registerWrapper< string >( viewKeyStruct::relPermNamesString() ). - setPlotLevel( PlotLevel::NOPLOT ). - setRestartFlags( RestartFlags::NO_WRITE ). - setSizedFromParent( 0 ). - setDescription( "Name of the relative permeability constitutive model to use" ). - reference(); - - relPermName = getConstitutiveName< RelativePermeabilityBase >( subRegion ); - - GEOS_THROW_IF( relPermName.empty(), - GEOS_FMT( "{}: Relative permeability model not found on subregion {}", - getDataContext(), subRegion.getName() ), - InputError ); - + setConstitutiveName< RelativePermeabilityBase >( subRegion, viewKeyStruct::relPermNamesString() ); } namespace { @@ -525,13 +505,6 @@ void CompositionalMultiphaseWell::initializePostSubGroups() mesh.getElemManager().forElementSubRegions< WellElementSubRegion >( regionNames, [&]( localIndex const, WellElementSubRegion & subRegion ) { - string & relPermName = subRegion.getReference< string >( viewKeyStruct::relPermNamesString() ); - relPermName = getConstitutiveName< RelativePermeabilityBase >( subRegion ); - GEOS_THROW_IF( relPermName.empty(), - GEOS_FMT( "{}: Relative permeability not found on subregion {}", - getDataContext(), subRegion.getName() ), - InputError ); - validateInjectionStreams( subRegion ); } ); } ); @@ -578,23 +551,22 @@ void CompositionalMultiphaseWell::updateBHPForConstraint( WellElementSubRegion & { return; } - using Deriv = multifluid::DerivativeOffset; + using Deriv = constitutive::multifluid::DerivativeOffset; integer const numComp = m_numComponents; localIndex const iwelemRef = subRegion.getTopWellElementIndex(); - string & fluidName = subRegion.getReference< string >( viewKeyStruct::fluidNamesString() ); - fluidName = getConstitutiveName< MultiFluidBase >( subRegion ); + string const & fluidName = subRegion.getReference< string >( viewKeyStruct::fluidNamesString() ); MultiFluidBase const & fluid = subRegion.getConstitutiveModel< MultiFluidBase >( fluidName ); - integer isThermal = fluid.isThermal(); + integer const isThermal = fluid.isThermal(); // subRegion data - arrayView1d< real64 const > const & pres = subRegion.getField< fields::well::pressure >(); + arrayView1d< real64 const > const & pres = subRegion.getField< well::pressure >(); - arrayView1d< real64 > const & totalMassDens = subRegion.getField< fields::well::totalMassDensity >(); - arrayView2d< real64, compflow::USD_FLUID_DC > const & dTotalMassDens = subRegion.getField< fields::well::dTotalMassDensity >(); + arrayView1d< real64 > const & totalMassDens = subRegion.getField< well::totalMassDensity >(); + arrayView2d< real64, compflow::USD_FLUID_DC > const & dTotalMassDens = subRegion.getField< well::dTotalMassDensity >(); - arrayView1d< real64 const > const wellElemGravCoef = subRegion.getField< fields::well::gravityCoefficient >(); + arrayView1d< real64 const > const wellElemGravCoef = subRegion.getField< well::gravityCoefficient >(); // control data @@ -662,26 +634,26 @@ void CompositionalMultiphaseWell::updateVolRatesForConstraint( WellElementSubReg // subRegion data - arrayView1d< real64 const > const & pres = subRegion.getField< fields::well::pressure >(); - arrayView1d< real64 const > const & temp = subRegion.getField< fields::well::temperature >(); - arrayView1d< real64 const > const & connRate = subRegion.getField< fields::well::mixtureConnectionRate >(); + arrayView1d< real64 const > const & pres = subRegion.getField< well::pressure >(); + arrayView1d< real64 const > const & temp = subRegion.getField< well::temperature >(); + arrayView1d< real64 const > const & connRate = subRegion.getField< well::mixtureConnectionRate >(); - arrayView2d< real64 const, compflow::USD_COMP > const & compFrac = subRegion.getField< fields::well::globalCompFraction >(); - arrayView3d< real64 const, compflow::USD_COMP_DC > const & dCompFrac_dCompDens = subRegion.getField< fields::well::dGlobalCompFraction_dGlobalCompDensity >(); + arrayView2d< real64 const, compflow::USD_COMP > const & compFrac = subRegion.getField< well::globalCompFraction >(); + arrayView3d< real64 const, compflow::USD_COMP_DC > const & dCompFrac_dCompDens = subRegion.getField< well::dGlobalCompFraction_dGlobalCompDensity >(); // fluid data string const & fluidName = subRegion.getReference< string >( viewKeyStruct::fluidNamesString() ); MultiFluidBase & fluid = subRegion.getConstitutiveModel< MultiFluidBase >( fluidName ); - integer isThermal = fluid.isThermal(); - arrayView3d< real64 const, multifluid::USD_PHASE > const & phaseFrac = fluid.phaseFraction(); - arrayView4d< real64 const, multifluid::USD_PHASE_DC > const & dPhaseFrac = fluid.dPhaseFraction(); + integer const isThermal = fluid.isThermal(); + arrayView3d< real64 const, constitutive::multifluid::USD_PHASE > const & phaseFrac = fluid.phaseFraction(); + arrayView4d< real64 const, constitutive::multifluid::USD_PHASE_DC > const & dPhaseFrac = fluid.dPhaseFraction(); - arrayView2d< real64 const, multifluid::USD_FLUID > const & totalDens = fluid.totalDensity(); - arrayView3d< real64 const, multifluid::USD_FLUID_DC > const & dTotalDens = fluid.dTotalDensity(); + arrayView2d< real64 const, constitutive::multifluid::USD_FLUID > const & totalDens = fluid.totalDensity(); + arrayView3d< real64 const, constitutive::multifluid::USD_FLUID_DC > const & dTotalDens = fluid.dTotalDensity(); - arrayView3d< real64 const, multifluid::USD_PHASE > const & phaseDens = fluid.phaseDensity(); - arrayView4d< real64 const, multifluid::USD_PHASE_DC > const & dPhaseDens = fluid.dPhaseDensity(); + arrayView3d< real64 const, constitutive::multifluid::USD_PHASE > const & phaseDens = fluid.phaseDensity(); + arrayView4d< real64 const, constitutive::multifluid::USD_PHASE_DC > const & dPhaseDens = fluid.dPhaseDensity(); // control data @@ -748,7 +720,7 @@ void CompositionalMultiphaseWell::updateVolRatesForConstraint( WellElementSubReg &massDensity] ( localIndex const ) { GEOS_UNUSED_VAR( massUnit ); - using Deriv = multifluid::DerivativeOffset; + using Deriv = constitutive::multifluid::DerivativeOffset; stackArray1d< real64, maxNumComp > work( numComp ); // Step 1: evaluate the phase and total density in the reference element @@ -866,9 +838,9 @@ void CompositionalMultiphaseWell::updateVolRatesForConstraint( WellElementSubReg void CompositionalMultiphaseWell::updateFluidModel( WellElementSubRegion & subRegion ) { GEOS_MARK_FUNCTION; - arrayView1d< real64 const > const & pres = subRegion.getField< fields::well::pressure >(); - arrayView1d< real64 const > const & temp = subRegion.getField< fields::well::temperature >(); - arrayView2d< real64 const, compflow::USD_COMP > const & compFrac = subRegion.getField< fields::well::globalCompFraction >(); + arrayView1d< real64 const > const & pres = subRegion.getField< well::pressure >(); + arrayView1d< real64 const > const & temp = subRegion.getField< well::temperature >(); + arrayView2d< real64 const, compflow::USD_COMP > const & compFrac = subRegion.getField< well::globalCompFraction >(); string const & fluidName = subRegion.getReference< string >( viewKeyStruct::fluidNamesString() ); MultiFluidBase & fluid = subRegion.getConstitutiveModel< MultiFluidBase >( fluidName ); @@ -1013,21 +985,21 @@ void CompositionalMultiphaseWell::initializeWells( DomainPartition & domain, rea PerforationData const & perforationData = *subRegion.getPerforationData(); // get well primary variables on well elements - arrayView1d< real64 > const & wellElemPressure = subRegion.getField< fields::well::pressure >(); - arrayView1d< real64 > const & wellElemTemp = subRegion.getField< fields::well::temperature >(); - arrayView2d< real64, compflow::USD_COMP > const & wellElemCompDens = subRegion.getField< fields::well::globalCompDensity >(); - arrayView1d< real64 > const & connRate = subRegion.getField< fields::well::mixtureConnectionRate >(); + arrayView1d< real64 > const & wellElemPressure = subRegion.getField< well::pressure >(); + arrayView1d< real64 > const & wellElemTemp = subRegion.getField< well::temperature >(); + arrayView2d< real64, compflow::USD_COMP > const & wellElemCompDens = subRegion.getField< well::globalCompDensity >(); + arrayView1d< real64 > const & connRate = subRegion.getField< well::mixtureConnectionRate >(); // get the info stored on well elements - arrayView2d< real64, compflow::USD_COMP > const & wellElemCompFrac = subRegion.getField< fields::well::globalCompFraction >(); - arrayView1d< real64 const > const & wellElemGravCoef = subRegion.getField< fields::well::gravityCoefficient >(); + arrayView2d< real64, compflow::USD_COMP > const & wellElemCompFrac = subRegion.getField< well::globalCompFraction >(); + arrayView1d< real64 const > const & wellElemGravCoef = subRegion.getField< well::gravityCoefficient >(); // get the element region, subregion, index - arrayView1d< localIndex const > const resElementRegion = perforationData.getField< fields::perforation::reservoirElementRegion >(); - arrayView1d< localIndex const > const resElementSubRegion = perforationData.getField< fields::perforation::reservoirElementSubRegion >(); - arrayView1d< localIndex const > const resElementIndex = perforationData.getField< fields::perforation::reservoirElementIndex >(); + arrayView1d< localIndex const > const resElementRegion = perforationData.getField< perforation::reservoirElementRegion >(); + arrayView1d< localIndex const > const resElementSubRegion = perforationData.getField< perforation::reservoirElementSubRegion >(); + arrayView1d< localIndex const > const resElementIndex = perforationData.getField< perforation::reservoirElementIndex >(); - arrayView1d< real64 const > const & perfGravCoef = perforationData.getField< fields::well::gravityCoefficient >(); + arrayView1d< real64 const > const & perfGravCoef = perforationData.getField< well::gravityCoefficient >(); // 1) Loop over all perforations to compute an average mixture density and component fraction // 2) Initialize the reference pressure @@ -1041,10 +1013,10 @@ void CompositionalMultiphaseWell::initializeWells( DomainPartition & domain, rea perforationData.getNumPerforationsGlobal(), wellControls, 0.0, // initialization done at t = 0 - resCompFlowAccessors.get( fields::flow::pressure{} ), - resCompFlowAccessors.get( fields::flow::temperature{} ), - resCompFlowAccessors.get( fields::flow::globalCompDensity{} ), - resCompFlowAccessors.get( fields::flow::phaseVolumeFraction{} ), + resCompFlowAccessors.get( flow::pressure{} ), + resCompFlowAccessors.get( flow::temperature{} ), + resCompFlowAccessors.get( flow::globalCompDensity{} ), + resCompFlowAccessors.get( flow::phaseVolumeFraction{} ), resMultiFluidAccessors.get( fields::multifluid::phaseMassDensity{} ), resElementRegion, resElementSubRegion, @@ -1058,8 +1030,8 @@ void CompositionalMultiphaseWell::initializeWells( DomainPartition & domain, rea // get well secondary variables on well elements string const & fluidName = subRegion.getReference< string >( viewKeyStruct::fluidNamesString() ); MultiFluidBase & fluid = getConstitutiveModel< MultiFluidBase >( subRegion, fluidName ); - arrayView3d< real64 const, multifluid::USD_PHASE > const & wellElemPhaseDens = fluid.phaseDensity(); - arrayView2d< real64 const, multifluid::USD_FLUID > const & wellElemTotalDens = fluid.totalDensity(); + arrayView3d< real64 const, constitutive::multifluid::USD_PHASE > const & wellElemPhaseDens = fluid.phaseDensity(); + arrayView2d< real64 const, constitutive::multifluid::USD_FLUID > const & wellElemTotalDens = fluid.totalDensity(); // 4) Back calculate component densities constitutive::constitutiveUpdatePassThru( fluid, [&] ( auto & castedFluid ) @@ -1129,7 +1101,7 @@ void CompositionalMultiphaseWell::assembleFluxTerms( real64 const & time, { string const & fluidName = subRegion.getReference< string >( viewKeyStruct::fluidNamesString()); MultiFluidBase const & fluid = getConstitutiveModel< MultiFluidBase >( subRegion, fluidName ); - int numComponents = fluid.numFluidComponents(); + int const numComponents = fluid.numFluidComponents(); if( isThermal() ) { @@ -1192,8 +1164,8 @@ void CompositionalMultiphaseWell::assembleAccumulationTerms( real64 const & time { string const & fluidName = subRegion.getReference< string >( viewKeyStruct::fluidNamesString()); MultiFluidBase const & fluid = getConstitutiveModel< MultiFluidBase >( subRegion, fluidName ); - int numPhases = fluid.numFluidPhases(); - int numComponents = fluid.numFluidComponents(); + int const numPhases = fluid.numFluidPhases(); + int const numComponents = fluid.numFluidComponents(); WellControls const & wellControls = getWellControls( subRegion ); if( wellControls.isWellOpen( time+ dt ) && !m_keepVariablesConstantDuringInitStep ) { @@ -1414,12 +1386,12 @@ CompositionalMultiphaseWell::scalingForSystemSolution( DomainPartition & domain, [&]( localIndex const, ElementSubRegionBase & subRegion ) { - arrayView1d< real64 const > const pressure = subRegion.getField< fields::well::pressure >(); - arrayView1d< real64 const > const temperature = subRegion.getField< fields::well::temperature >(); - arrayView2d< real64 const, compflow::USD_COMP > const compDens = subRegion.getField< fields::well::globalCompDensity >(); - arrayView1d< real64 > pressureScalingFactor = subRegion.getField< fields::well::pressureScalingFactor >(); - arrayView1d< real64 > temperatureScalingFactor = subRegion.getField< fields::well::temperatureScalingFactor >(); - arrayView1d< real64 > compDensScalingFactor = subRegion.getField< fields::well::globalCompDensityScalingFactor >(); + arrayView1d< real64 const > const pressure = subRegion.getField< well::pressure >(); + arrayView1d< real64 const > const temperature = subRegion.getField< well::temperature >(); + arrayView2d< real64 const, compflow::USD_COMP > const compDens = subRegion.getField< well::globalCompDensity >(); + arrayView1d< real64 > pressureScalingFactor = subRegion.getField< well::pressureScalingFactor >(); + arrayView1d< real64 > temperatureScalingFactor = subRegion.getField< well::temperatureScalingFactor >(); + arrayView1d< real64 > compDensScalingFactor = subRegion.getField< well::globalCompDensityScalingFactor >(); const integer temperatureOffset = m_numComponents+2; auto const subRegionData = m_isThermal @@ -1525,11 +1497,11 @@ CompositionalMultiphaseWell::checkSystemSolution( DomainPartition & domain, WellElementSubRegion & subRegion ) { arrayView1d< real64 const > const pressure = - subRegion.getField< fields::well::pressure >(); + subRegion.getField< well::pressure >(); arrayView2d< real64 const, compflow::USD_COMP > const compDens = - subRegion.getField< fields::well::globalCompDensity >(); - arrayView1d< real64 > pressureScalingFactor = subRegion.getField< fields::well::pressureScalingFactor >(); - arrayView1d< real64 > compDensScalingFactor = subRegion.getField< fields::well::globalCompDensityScalingFactor >(); + subRegion.getField< well::globalCompDensity >(); + arrayView1d< real64 > pressureScalingFactor = subRegion.getField< well::pressureScalingFactor >(); + arrayView1d< real64 > compDensScalingFactor = subRegion.getField< well::globalCompDensityScalingFactor >(); auto const subRegionData = compositionalMultiphaseWellKernels:: @@ -1575,14 +1547,14 @@ CompositionalMultiphaseWell::checkSystemSolution( DomainPartition & domain, integer const m_allowNegativePressure( false ); compositionalMultiphaseUtilities::ScalingType const m_scalingType( compositionalMultiphaseUtilities::ScalingType::Global ); arrayView1d< real64 const > const pressure = - subRegion.getField< fields::well::pressure >(); + subRegion.getField< well::pressure >(); arrayView1d< real64 const > const temperature = - subRegion.getField< fields::well::temperature >(); + subRegion.getField< well::temperature >(); arrayView2d< real64 const, compflow::USD_COMP > const compDens = - subRegion.getField< fields::well::globalCompDensity >(); - arrayView1d< real64 > pressureScalingFactor = subRegion.getField< fields::well::pressureScalingFactor >(); - arrayView1d< real64 > temperatureScalingFactor = subRegion.getField< fields::well::temperatureScalingFactor >(); - arrayView1d< real64 > compDensScalingFactor = subRegion.getField< fields::well::globalCompDensityScalingFactor >(); + subRegion.getField< well::globalCompDensity >(); + arrayView1d< real64 > pressureScalingFactor = subRegion.getField< well::pressureScalingFactor >(); + arrayView1d< real64 > temperatureScalingFactor = subRegion.getField< well::temperatureScalingFactor >(); + arrayView1d< real64 > compDensScalingFactor = subRegion.getField< well::globalCompDensityScalingFactor >(); // check that pressure and component densities are non-negative // for thermal, check that temperature is above 273.15 K @@ -1682,7 +1654,7 @@ void CompositionalMultiphaseWell::computePerforationRates( real64 const & time_n string const & fluidName = subRegion.getReference< string >( viewKeyStruct::fluidNamesString() ); MultiFluidBase const & fluid = getConstitutiveModel< MultiFluidBase >( subRegion, fluidName ); - bool isThermal = fluid.isThermal(); + bool const isThermal = fluid.isThermal(); if( isThermal ) { @@ -1713,7 +1685,7 @@ void CompositionalMultiphaseWell::computePerforationRates( real64 const & time_n else { // Zero completion flow rate - arrayView2d< real64 > const compPerfRate = perforationData->getField< fields::well::compPerforationRate >(); + arrayView2d< real64 > const compPerfRate = perforationData->getField< well::compPerforationRate >(); for( integer iperf=0; iperfsize(); iperf++ ) { for( integer ic = 0; ic < m_numComponents; ++ic ) @@ -1745,19 +1717,19 @@ CompositionalMultiphaseWell::applySystemSolution( DofManager const & dofManager, // update all the fields using the global damping coefficients dofManager.addVectorToField( localSolution, wellElementDofName(), - fields::well::pressure::key(), + well::pressure::key(), scalingFactor, pressureMask ); dofManager.addVectorToField( localSolution, wellElementDofName(), - fields::well::globalCompDensity::key(), + well::globalCompDensity::key(), scalingFactor, componentMask ); dofManager.addVectorToField( localSolution, wellElementDofName(), - fields::well::mixtureConnectionRate::key(), + well::mixtureConnectionRate::key(), scalingFactor, connRateMask ); @@ -1767,7 +1739,7 @@ CompositionalMultiphaseWell::applySystemSolution( DofManager const & dofManager, dofManager.addVectorToField( localSolution, wellElementDofName(), - fields::well::temperature::key(), + well::temperature::key(), scalingFactor, temperatureMask ); @@ -1787,17 +1759,17 @@ CompositionalMultiphaseWell::applySystemSolution( DofManager const & dofManager, FieldIdentifiers fieldsToBeSync; if( isThermal() ) { - fieldsToBeSync.addElementFields( { fields::well::pressure::key(), - fields::well::globalCompDensity::key(), - fields::well::mixtureConnectionRate::key(), - fields::well::temperature::key() }, + fieldsToBeSync.addElementFields( { well::pressure::key(), + well::globalCompDensity::key(), + well::mixtureConnectionRate::key(), + well::temperature::key() }, regionNames ); } else { - fieldsToBeSync.addElementFields( { fields::well::pressure::key(), - fields::well::globalCompDensity::key(), - fields::well::mixtureConnectionRate::key() }, + fieldsToBeSync.addElementFields( { well::pressure::key(), + well::globalCompDensity::key(), + well::mixtureConnectionRate::key() }, regionNames ); } CommunicationTools::getInstance().synchronizeFields( fieldsToBeSync, @@ -1827,7 +1799,7 @@ void CompositionalMultiphaseWell::chopNegativeDensities( DomainPartition & domai arrayView1d< integer const > const & wellElemGhostRank = subRegion.ghostRank(); arrayView2d< real64, compflow::USD_COMP > const & wellElemCompDens = - subRegion.getField< fields::well::globalCompDensity >(); + subRegion.getField< well::globalCompDensity >(); forAll< parallelDevicePolicy<> >( subRegion.size(), [=] GEOS_HOST_DEVICE ( localIndex const iwelem ) { @@ -1865,30 +1837,30 @@ void CompositionalMultiphaseWell::resetStateToBeginningOfStep( DomainPartition & { // get a reference to the primary variables on well elements arrayView1d< real64 > const & wellElemPressure = - subRegion.getField< fields::well::pressure >(); + subRegion.getField< well::pressure >(); arrayView1d< real64 const > const & wellElemPressure_n = - subRegion.getField< fields::well::pressure_n >(); + subRegion.getField< well::pressure_n >(); wellElemPressure.setValues< parallelDevicePolicy<> >( wellElemPressure_n ); if( isThermal() ) { // get a reference to the primary variables on well elements arrayView1d< real64 > const & wellElemTemperature = - subRegion.getField< fields::well::temperature >(); + subRegion.getField< well::temperature >(); arrayView1d< real64 const > const & wellElemTemperature_n = - subRegion.getField< fields::well::temperature_n >(); + subRegion.getField< well::temperature_n >(); wellElemTemperature.setValues< parallelDevicePolicy<> >( wellElemTemperature_n ); } arrayView2d< real64, compflow::USD_COMP > const & wellElemGlobalCompDensity = - subRegion.getField< fields::well::globalCompDensity >(); + subRegion.getField< well::globalCompDensity >(); arrayView2d< real64 const, compflow::USD_COMP > const & wellElemGlobalCompDensity_n = - subRegion.getField< fields::well::globalCompDensity_n >(); + subRegion.getField< well::globalCompDensity_n >(); wellElemGlobalCompDensity.setValues< parallelDevicePolicy<> >( wellElemGlobalCompDensity_n ); arrayView1d< real64 > const & connRate = - subRegion.getField< fields::well::mixtureConnectionRate >(); + subRegion.getField< well::mixtureConnectionRate >(); arrayView1d< real64 const > const & connRate_n = - subRegion.getField< fields::well::mixtureConnectionRate_n >(); + subRegion.getField< well::mixtureConnectionRate_n >(); connRate.setValues< parallelDevicePolicy<> >( connRate_n ); updateSubRegionState( subRegion ); @@ -1923,25 +1895,25 @@ void CompositionalMultiphaseWell::assemblePressureRelations( real64 const & time { string const & fluidName = subRegion.getReference< string >( viewKeyStruct::fluidNamesString() ); MultiFluidBase const & fluid = getConstitutiveModel< MultiFluidBase >( subRegion, fluidName ); - bool isThermal = fluid.isThermal(); + bool const isThermal = fluid.isThermal(); // get the degrees of freedom, depth info, next welem index string const wellDofKey = dofManager.getKey( wellElementDofName() ); arrayView1d< globalIndex const > const & wellElemDofNumber = subRegion.getReference< array1d< globalIndex > >( wellDofKey ); arrayView1d< real64 const > const & wellElemGravCoef = - subRegion.getField< fields::well::gravityCoefficient >(); + subRegion.getField< well::gravityCoefficient >(); arrayView1d< localIndex const > const & nextWellElemIndex = subRegion.getReference< array1d< localIndex > >( WellElementSubRegion::viewKeyStruct::nextWellElementIndexString() ); // get primary variables on well elements arrayView1d< real64 const > const & wellElemPres = - subRegion.getField< fields::well::pressure >(); + subRegion.getField< well::pressure >(); // get total mass density on well elements (for potential calculations) arrayView1d< real64 const > const & wellElemTotalMassDens = - subRegion.getField< fields::well::totalMassDensity >(); + subRegion.getField< well::totalMassDensity >(); arrayView2d< real64 const, compflow::USD_FLUID_DC > const & dWellElemTotalMassDens = - subRegion.getField< fields::well::dTotalMassDensity >(); + subRegion.getField< well::dTotalMassDensity >(); bool controlHasSwitched = false; isothermalCompositionalMultiphaseBaseKernels:: @@ -2026,38 +1998,38 @@ void CompositionalMultiphaseWell::implicitStepSetup( real64 const & time_n, // get a reference to the primary variables on well elements arrayView1d< real64 const > const & wellElemPressure = - subRegion.getField< fields::well::pressure >(); + subRegion.getField< well::pressure >(); arrayView2d< real64 const, compflow::USD_COMP > const & wellElemGlobalCompDensity = - subRegion.getField< fields::well::globalCompDensity >(); + subRegion.getField< well::globalCompDensity >(); arrayView1d< real64 const > const & wellElemTemperature = - subRegion.getField< fields::well::temperature >(); + subRegion.getField< well::temperature >(); arrayView1d< real64 > const & wellElemPressure_n = - subRegion.getField< fields::well::pressure_n >(); + subRegion.getField< well::pressure_n >(); wellElemPressure_n.setValues< parallelDevicePolicy<> >( wellElemPressure ); if( isThermal() ) { arrayView1d< real64 > const & wellElemTemperature_n = - subRegion.getField< fields::well::temperature_n >(); + subRegion.getField< well::temperature_n >(); wellElemTemperature_n.setValues< parallelDevicePolicy<> >( wellElemTemperature ); } arrayView2d< real64, compflow::USD_COMP > const & wellElemGlobalCompDensity_n = - subRegion.getField< fields::well::globalCompDensity_n >(); + subRegion.getField< well::globalCompDensity_n >(); wellElemGlobalCompDensity_n.setValues< parallelDevicePolicy<> >( wellElemGlobalCompDensity ); arrayView1d< real64 const > const & connRate = - subRegion.getField< fields::well::mixtureConnectionRate >(); + subRegion.getField< well::mixtureConnectionRate >(); arrayView1d< real64 > const & connRate_n = - subRegion.getField< fields::well::mixtureConnectionRate_n >(); + subRegion.getField< well::mixtureConnectionRate_n >(); connRate_n.setValues< parallelDevicePolicy<> >( connRate ); arrayView2d< real64 const, compflow::USD_PHASE > const wellElemPhaseVolFrac = - subRegion.getField< fields::well::phaseVolumeFraction >(); + subRegion.getField< well::phaseVolumeFraction >(); arrayView2d< real64, compflow::USD_PHASE > const wellElemPhaseVolFrac_n = - subRegion.getField< fields::well::phaseVolumeFraction_n >(); + subRegion.getField< well::phaseVolumeFraction_n >(); wellElemPhaseVolFrac_n.setValues< parallelDevicePolicy<> >( wellElemPhaseVolFrac ); string const & fluidName = subRegion.getReference< string >( viewKeyStruct::fluidNamesString() ); @@ -2141,7 +2113,7 @@ void CompositionalMultiphaseWell::printRates( real64 const & time_n, // subRegion data arrayView1d< real64 const > const & connRate = - subRegion.getField< fields::well::mixtureConnectionRate >(); + subRegion.getField< well::mixtureConnectionRate >(); integer const useSurfaceConditions = wellControls.useSurfaceConditions(); diff --git a/src/coreComponents/physicsSolvers/fluidFlow/wells/SinglePhaseWell.cpp b/src/coreComponents/physicsSolvers/fluidFlow/wells/SinglePhaseWell.cpp index 75797a3490c..ce6ffda0f7e 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/wells/SinglePhaseWell.cpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/wells/SinglePhaseWell.cpp @@ -45,6 +45,7 @@ namespace geos using namespace dataRepository; using namespace constitutive; +using namespace fields; using namespace singlePhaseWellKernels; SinglePhaseWell::SinglePhaseWell( const string & name, @@ -78,17 +79,12 @@ void SinglePhaseWell::registerDataOnMesh( Group & meshBodies ) [&]( localIndex const, WellElementSubRegion & subRegion ) { - string & fluidName = subRegion.getReference< string >( viewKeyStruct::fluidNamesString() ); - fluidName = getConstitutiveName< SingleFluidBase >( subRegion ); - GEOS_ERROR_IF( fluidName.empty(), GEOS_FMT( "{}: Fluid model not found on subregion {}", - getDataContext(), subRegion.getName() ) ); - - subRegion.registerField< fields::well::connectionRate_n >( getName() ); - subRegion.registerField< fields::well::connectionRate >( getName() ); + subRegion.registerField< well::connectionRate_n >( getName() ); + subRegion.registerField< well::connectionRate >( getName() ); PerforationData & perforationData = *subRegion.getPerforationData(); - perforationData.registerField< fields::well::perforationRate >( getName() ); - perforationData.registerField< fields::well::dPerforationRate_dPres >( getName() ). + perforationData.registerField< well::perforationRate >( getName() ); + perforationData.registerField< well::dPerforationRate_dPres >( getName() ). reference().resizeDimension< 1 >( 2 ); WellControls & wellControls = getWellControls( subRegion ); @@ -115,6 +111,11 @@ void SinglePhaseWell::registerDataOnMesh( Group & meshBodies ) } ); } +void SinglePhaseWell::setConstitutiveNames( ElementSubRegionBase & subRegion ) const +{ + setConstitutiveName< SingleFluidBase >( subRegion, viewKeyStruct::fluidNamesString() ); +} + string SinglePhaseWell::resElementDofName() const { return SinglePhaseBase::viewKeyStruct::elemDofFieldString(); @@ -159,10 +160,10 @@ void SinglePhaseWell::updateBHPForConstraint( WellElementSubRegion & subRegion ) // subRegion data arrayView1d< real64 const > const pres = - subRegion.getField< fields::well::pressure >(); + subRegion.getField< well::pressure >(); arrayView1d< real64 const > const wellElemGravCoef = - subRegion.getField< fields::well::gravityCoefficient >(); + subRegion.getField< well::gravityCoefficient >(); // fluid data string const & fluidName = subRegion.getReference< string >( viewKeyStruct::fluidNamesString() ); @@ -219,9 +220,9 @@ void SinglePhaseWell::updateVolRateForConstraint( WellElementSubRegion & subRegi // subRegion data arrayView1d< real64 const > const pres = - subRegion.getField< fields::well::pressure >(); + subRegion.getField< well::pressure >(); arrayView1d< real64 const > const & connRate = - subRegion.getField< fields::well::connectionRate >(); + subRegion.getField< well::connectionRate >(); // fluid data @@ -305,8 +306,8 @@ void SinglePhaseWell::updateFluidModel( WellElementSubRegion & subRegion ) const { GEOS_MARK_FUNCTION; - arrayView1d< real64 const > const pres = subRegion.getField< fields::well::pressure >(); - arrayView1d< real64 const > const temp = subRegion.getField< fields::well::temperature >(); + arrayView1d< real64 const > const pres = subRegion.getField< well::pressure >(); + arrayView1d< real64 const > const temp = subRegion.getField< well::temperature >(); string const & fluidName = subRegion.getReference< string >( viewKeyStruct::fluidNamesString() ); SingleFluidBase & fluid = subRegion.getConstitutiveModel< SingleFluidBase >( fluidName ); @@ -362,24 +363,24 @@ void SinglePhaseWell::initializeWells( DomainPartition & domain, real64 const & // get the info stored on well elements arrayView1d< real64 const > const wellElemGravCoef = - subRegion.getField< fields::well::gravityCoefficient >(); + subRegion.getField< well::gravityCoefficient >(); // get well primary variables on well elements arrayView1d< real64 > const wellElemPressure = - subRegion.getField< fields::well::pressure >(); + subRegion.getField< well::pressure >(); arrayView1d< real64 > const connRate = - subRegion.getField< fields::well::connectionRate >(); + subRegion.getField< well::connectionRate >(); // get the element region, subregion, index arrayView1d< localIndex const > const resElementRegion = - perforationData.getField< fields::perforation::reservoirElementRegion >(); + perforationData.getField< perforation::reservoirElementRegion >(); arrayView1d< localIndex const > const resElementSubRegion = - perforationData.getField< fields::perforation::reservoirElementSubRegion >(); + perforationData.getField< perforation::reservoirElementSubRegion >(); arrayView1d< localIndex const > const resElementIndex = - perforationData.getField< fields::perforation::reservoirElementIndex >(); + perforationData.getField< perforation::reservoirElementIndex >(); arrayView1d< real64 const > const & perfGravCoef = - perforationData.getField< fields::well::gravityCoefficient >(); + perforationData.getField< well::gravityCoefficient >(); // TODO: change the way we access the flowSolver here SinglePhaseBase const & flowSolver = getParent().getGroup< SinglePhaseBase >( getFlowSolverName() ); @@ -395,8 +396,8 @@ void SinglePhaseWell::initializeWells( DomainPartition & domain, real64 const & perforationData.getNumPerforationsGlobal(), wellControls, 0.0, // initialization done at t = 0 - resSinglePhaseFlowAccessors.get( fields::flow::pressure{} ), - resSingleFluidAccessors.get( fields::singlefluid::density{} ), + resSinglePhaseFlowAccessors.get( flow::pressure{} ), + resSingleFluidAccessors.get( singlefluid::density{} ), resElementRegion, resElementSubRegion, resElementIndex, @@ -457,7 +458,7 @@ void SinglePhaseWell::assembleFluxTerms( real64 const & time_n, // get a reference to the primary variables on well elements arrayView1d< real64 const > const connRate = - subRegion.getField< fields::well::connectionRate >(); + subRegion.getField< well::connectionRate >(); FluxKernel::launch( subRegion.size(), dofManager.rankOffset(), @@ -501,13 +502,13 @@ void SinglePhaseWell::assemblePressureRelations( real64 const & time_n, arrayView1d< globalIndex const > const & wellElemDofNumber = subRegion.getReference< array1d< globalIndex > >( wellDofKey ); arrayView1d< real64 const > const & wellElemGravCoef = - subRegion.getField< fields::well::gravityCoefficient >(); + subRegion.getField< well::gravityCoefficient >(); arrayView1d< localIndex const > const & nextWellElemIndex = subRegion.getReference< array1d< localIndex > >( WellElementSubRegion::viewKeyStruct::nextWellElementIndexString() ); // get primary variables on well elements arrayView1d< real64 const > const & wellElemPressure = - subRegion.getField< fields::well::pressure >(); + subRegion.getField< well::pressure >(); // get well constitutive data string const & fluidName = subRegion.getReference< string >( viewKeyStruct::fluidNamesString() ); @@ -639,11 +640,11 @@ void SinglePhaseWell::computePerforationRates( real64 const & time_n, // get the degrees of freedom and depth arrayView1d< real64 const > const wellElemGravCoef = - subRegion.getField< fields::well::gravityCoefficient >(); + subRegion.getField< well::gravityCoefficient >(); // get well primary variables on well elements arrayView1d< real64 const > const wellElemPressure = - subRegion.getField< fields::well::pressure >(); + subRegion.getField< well::pressure >(); // get well constitutive data string const & fluidName = subRegion.getReference< string >( viewKeyStruct::fluidNamesString() ); @@ -654,31 +655,31 @@ void SinglePhaseWell::computePerforationRates( real64 const & time_n, // get well variables on perforations arrayView1d< real64 const > const perfGravCoef = - perforationData->getField< fields::well::gravityCoefficient >(); + perforationData->getField< well::gravityCoefficient >(); arrayView1d< localIndex const > const perfWellElemIndex = - perforationData->getField< fields::perforation::wellElementIndex >(); + perforationData->getField< perforation::wellElementIndex >(); arrayView1d< real64 const > const perfTransmissibility = - perforationData->getField< fields::perforation::wellTransmissibility >(); + perforationData->getField< perforation::wellTransmissibility >(); arrayView1d< real64 > const perfRate = - perforationData->getField< fields::well::perforationRate >(); + perforationData->getField< well::perforationRate >(); arrayView2d< real64 > const dPerfRate_dPres = - perforationData->getField< fields::well::dPerforationRate_dPres >(); + perforationData->getField< well::dPerforationRate_dPres >(); // get the element region, subregion, index arrayView1d< localIndex const > const resElementRegion = - perforationData->getField< fields::perforation::reservoirElementRegion >(); + perforationData->getField< perforation::reservoirElementRegion >(); arrayView1d< localIndex const > const resElementSubRegion = - perforationData->getField< fields::perforation::reservoirElementSubRegion >(); + perforationData->getField< perforation::reservoirElementSubRegion >(); arrayView1d< localIndex const > const resElementIndex = - perforationData->getField< fields::perforation::reservoirElementIndex >(); + perforationData->getField< perforation::reservoirElementIndex >(); PerforationKernel::launch( perforationData->size(), - resSinglePhaseFlowAccessors.get( fields::flow::pressure{} ), - resSingleFluidAccessors.get( fields::singlefluid::density{} ), - resSingleFluidAccessors.get( fields::singlefluid::dDensity_dPressure{} ), - resSingleFluidAccessors.get( fields::singlefluid::viscosity{} ), - resSingleFluidAccessors.get( fields::singlefluid::dViscosity_dPressure{} ), + resSinglePhaseFlowAccessors.get( flow::pressure{} ), + resSingleFluidAccessors.get( singlefluid::density{} ), + resSingleFluidAccessors.get( singlefluid::dDensity_dPressure{} ), + resSingleFluidAccessors.get( singlefluid::viscosity{} ), + resSingleFluidAccessors.get( singlefluid::dViscosity_dPressure{} ), wellElemGravCoef, wellElemPressure, wellElemDensity, @@ -797,7 +798,7 @@ bool SinglePhaseWell::checkSystemSolution( DomainPartition & domain, // get a reference to the primary variables on well elements arrayView1d< real64 const > const & pres = - subRegion.getField< fields::well::pressure >(); + subRegion.getField< well::pressure >(); auto const statistics = singlePhaseBaseKernels::SolutionCheckKernel:: @@ -827,13 +828,13 @@ SinglePhaseWell::applySystemSolution( DofManager const & dofManager, GEOS_UNUSED_VAR( dt ); dofManager.addVectorToField( localSolution, wellElementDofName(), - fields::well::pressure::key(), + well::pressure::key(), scalingFactor, { m_numDofPerWellElement, 0, 1 } ); dofManager.addVectorToField( localSolution, wellElementDofName(), - fields::well::connectionRate::key(), + well::connectionRate::key(), scalingFactor, { m_numDofPerWellElement, 1, m_numDofPerWellElement } ); @@ -843,8 +844,8 @@ SinglePhaseWell::applySystemSolution( DofManager const & dofManager, { FieldIdentifiers fieldsToBeSync; - fieldsToBeSync.addElementFields( { fields::well::pressure::key(), - fields::well::connectionRate::key() }, + fieldsToBeSync.addElementFields( { well::pressure::key(), + well::connectionRate::key() }, regionNames ); CommunicationTools::getInstance().synchronizeFields( fieldsToBeSync, @@ -870,15 +871,15 @@ void SinglePhaseWell::resetStateToBeginningOfStep( DomainPartition & domain ) { // get a reference to the primary variables on well elements arrayView1d< real64 > const & wellElemPressure = - subRegion.getField< fields::well::pressure >(); + subRegion.getField< well::pressure >(); arrayView1d< real64 const > const & wellElemPressure_n = - subRegion.getField< fields::well::pressure_n >(); + subRegion.getField< well::pressure_n >(); wellElemPressure.setValues< parallelDevicePolicy<> >( wellElemPressure_n ); arrayView1d< real64 > const & connRate = - subRegion.getField< fields::well::connectionRate >(); + subRegion.getField< well::connectionRate >(); arrayView1d< real64 const > const & connRate_n = - subRegion.getField< fields::well::connectionRate_n >(); + subRegion.getField< well::connectionRate_n >(); connRate.setValues< parallelDevicePolicy<> >( connRate_n ); updateSubRegionState( subRegion ); @@ -904,12 +905,12 @@ void SinglePhaseWell::implicitStepSetup( real64 const & time, [&]( localIndex const, WellElementSubRegion & subRegion ) { - arrayView1d< real64 const > const wellElemPressure = subRegion.getField< fields::well::pressure >(); - arrayView1d< real64 > const wellElemPressure_n = subRegion.getField< fields::well::pressure_n >(); + arrayView1d< real64 const > const wellElemPressure = subRegion.getField< well::pressure >(); + arrayView1d< real64 > const wellElemPressure_n = subRegion.getField< well::pressure_n >(); wellElemPressure_n.setValues< parallelDevicePolicy<> >( wellElemPressure ); - arrayView1d< real64 const > const connRate = subRegion.getField< fields::well::connectionRate >(); - arrayView1d< real64 > const connRate_n = subRegion.getField< fields::well::connectionRate_n >(); + arrayView1d< real64 const > const connRate = subRegion.getField< well::connectionRate >(); + arrayView1d< real64 > const connRate_n = subRegion.getField< well::connectionRate_n >(); connRate_n.setValues< parallelDevicePolicy<> >( connRate ); SingleFluidBase const & fluid = @@ -962,7 +963,7 @@ void SinglePhaseWell::printRates( real64 const & time_n, // subRegion data arrayView1d< real64 const > const & connRate = - subRegion.getField< fields::well::connectionRate >(); + subRegion.getField< well::connectionRate >(); // control data diff --git a/src/coreComponents/physicsSolvers/fluidFlow/wells/SinglePhaseWell.hpp b/src/coreComponents/physicsSolvers/fluidFlow/wells/SinglePhaseWell.hpp index a27be685524..db5dad07d80 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/wells/SinglePhaseWell.hpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/wells/SinglePhaseWell.hpp @@ -249,6 +249,8 @@ class SinglePhaseWell : public WellSolverBase private: + virtual void setConstitutiveNames( ElementSubRegionBase & subRegion ) const override; + /** * @brief Initialize all the primary and secondary variables in all the wells * @param domain the domain containing the well manager to access individual wells diff --git a/src/coreComponents/physicsSolvers/fluidFlow/wells/WellSolverBase.cpp b/src/coreComponents/physicsSolvers/fluidFlow/wells/WellSolverBase.cpp index 1b7ed01bb4e..e60c2244243 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/wells/WellSolverBase.cpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/wells/WellSolverBase.cpp @@ -28,14 +28,13 @@ #include "physicsSolvers/fluidFlow/wells/WellControls.hpp" #include "physicsSolvers/fluidFlow/wells/WellSolverBaseFields.hpp" #include "physicsSolvers/fluidFlow/wells/LogLevelsInfo.hpp" -#include "physicsSolvers/fluidFlow/wells/kernels/ThermalCompositionalMultiphaseWellKernels.hpp" #include "fileIO/Outputs/OutputBase.hpp" namespace geos { using namespace dataRepository; -using namespace constitutive; +using namespace fields; WellSolverBase::WellSolverBase( string const & name, Group * const parent ) @@ -69,7 +68,7 @@ Group *WellSolverBase::createChild( string const & childKey, string const & chil { const auto childTypes = { keys::wellControls }; GEOS_ERROR_IF( childKey != keys::wellControls, - PhysicsSolverBase::CatalogInterface::unknownTypeError( childKey, getDataContext(), childTypes ) ); + CatalogInterface::unknownTypeError( childKey, getDataContext(), childTypes ) ); return ®isterGroup< WellControls >( childName ); } @@ -116,24 +115,19 @@ void WellSolverBase::registerDataOnMesh( Group & meshBodies ) [&]( localIndex const, WellElementSubRegion & subRegion ) { - subRegion.registerField< fields::well::pressure >( getName() ); - subRegion.registerField< fields::well::pressure_n >( getName() ); + subRegion.registerField< well::pressure >( getName() ); + subRegion.registerField< well::pressure_n >( getName() ); - subRegion.registerField< fields::well::temperature >( getName() ); + subRegion.registerField< well::temperature >( getName() ); if( isThermal() ) { - subRegion.registerField< fields::well::temperature_n >( getName() ); + subRegion.registerField< well::temperature_n >( getName() ); } - subRegion.registerField< fields::well::gravityCoefficient >( getName() ); - - subRegion.registerWrapper< string >( viewKeyStruct::fluidNamesString() ). - setPlotLevel( PlotLevel::NOPLOT ). - setRestartFlags( RestartFlags::NO_WRITE ). - setSizedFromParent( 0 ); + subRegion.registerField< well::gravityCoefficient >( getName() ); PerforationData * const perforationData = subRegion.getPerforationData(); - perforationData->registerField< fields::well::gravityCoefficient >( getName() ); + perforationData->registerField< well::gravityCoefficient >( getName() ); } ); } ); } @@ -155,15 +149,6 @@ void WellSolverBase::initializePostSubGroups() } ); } -void WellSolverBase::setConstitutiveNamesCallSuper( ElementSubRegionBase & subRegion ) const -{ - PhysicsSolverBase::setConstitutiveNamesCallSuper( subRegion ); - subRegion.registerWrapper< string >( viewKeyStruct::fluidNamesString() ). - setPlotLevel( PlotLevel::NOPLOT ). - setRestartFlags( RestartFlags::NO_WRITE ). - setSizedFromParent( 0 ); -} - void WellSolverBase::setupDofs( DomainPartition const & domain, DofManager & dofManager ) const { @@ -275,10 +260,10 @@ void WellSolverBase::precomputeData( DomainPartition & domain ) real64 const refElev = wellControls.getReferenceElevation(); arrayView2d< real64 const > const wellElemLocation = subRegion.getElementCenter(); - arrayView1d< real64 > const wellElemGravCoef = subRegion.getField< fields::well::gravityCoefficient >(); + arrayView1d< real64 > const wellElemGravCoef = subRegion.getField< well::gravityCoefficient >(); - arrayView2d< real64 const > const perfLocation = perforationData.getField< fields::perforation::location >(); - arrayView1d< real64 > const perfGravCoef = perforationData.getField< fields::well::gravityCoefficient >(); + arrayView2d< real64 const > const perfLocation = perforationData.getField< perforation::location >(); + arrayView1d< real64 > const perfGravCoef = perforationData.getField< well::gravityCoefficient >(); forAll< serialPolicy >( perforationData.size(), [=]( localIndex const iperf ) { diff --git a/src/coreComponents/physicsSolvers/fluidFlow/wells/WellSolverBase.hpp b/src/coreComponents/physicsSolvers/fluidFlow/wells/WellSolverBase.hpp index a02af416759..c649921a49a 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/wells/WellSolverBase.hpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/wells/WellSolverBase.hpp @@ -277,8 +277,6 @@ class WellSolverBase : public PhysicsSolverBase */ void precomputeData( DomainPartition & domain ); - virtual void setConstitutiveNamesCallSuper( ElementSubRegionBase & subRegion ) const override; - protected: diff --git a/src/coreComponents/physicsSolvers/fluidFlow/wells/kernels/CompositionalMultiphaseWellKernels.cpp b/src/coreComponents/physicsSolvers/fluidFlow/wells/kernels/CompositionalMultiphaseWellKernels.cpp index 01fb94d2e72..ff9a7ebcd09 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/wells/kernels/CompositionalMultiphaseWellKernels.cpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/wells/kernels/CompositionalMultiphaseWellKernels.cpp @@ -26,10 +26,11 @@ namespace geos { -using namespace constitutive; namespace compositionalMultiphaseWellKernels { +using namespace constitutive; + /******************************** ControlEquationHelper ********************************/ GEOS_HOST_DEVICE diff --git a/src/coreComponents/physicsSolvers/inducedSeismicity/ExplicitQDRateAndState.cpp b/src/coreComponents/physicsSolvers/inducedSeismicity/ExplicitQDRateAndState.cpp index 3c21d1b6ec8..4b89f923487 100644 --- a/src/coreComponents/physicsSolvers/inducedSeismicity/ExplicitQDRateAndState.cpp +++ b/src/coreComponents/physicsSolvers/inducedSeismicity/ExplicitQDRateAndState.cpp @@ -138,8 +138,8 @@ void ExplicitQDRateAndState::stepRateStateODEInitialSubstage( real64 const dt, D SurfaceElementSubRegion & subRegion ) { - string const & fricitonLawName = subRegion.template getReference< string >( viewKeyStruct::frictionLawNameString() ); - RateAndStateFriction const & frictionLaw = getConstitutiveModel< RateAndStateFriction >( subRegion, fricitonLawName ); + string const & frictionLawName = subRegion.template getReference< string >( viewKeyStruct::frictionLawNameString() ); + RateAndStateFriction const & frictionLaw = getConstitutiveModel< RateAndStateFriction >( subRegion, frictionLawName ); rateAndStateKernels::EmbeddedRungeKuttaKernel rkKernel( subRegion, frictionLaw, m_butcherTable ); arrayView3d< real64 > const rkStageRates = subRegion.getField< rateAndState::rungeKuttaStageRates >(); @@ -179,8 +179,8 @@ void ExplicitQDRateAndState::stepRateStateODESubstage( integer const stageIndex, SurfaceElementSubRegion & subRegion ) { - string const & fricitonLawName = subRegion.template getReference< string >( viewKeyStruct::frictionLawNameString() ); - RateAndStateFriction const & frictionLaw = getConstitutiveModel< RateAndStateFriction >( subRegion, fricitonLawName ); + string const & frictionLawName = subRegion.template getReference< string >( viewKeyStruct::frictionLawNameString() ); + RateAndStateFriction const & frictionLaw = getConstitutiveModel< RateAndStateFriction >( subRegion, frictionLawName ); rateAndStateKernels::EmbeddedRungeKuttaKernel rkKernel( subRegion, frictionLaw, m_butcherTable ); arrayView3d< real64 > const rkStageRates = subRegion.getField< rateAndState::rungeKuttaStageRates >(); @@ -205,8 +205,8 @@ void ExplicitQDRateAndState::stepRateStateODEAndComputeError( real64 const dt, D SurfaceElementSubRegion & subRegion ) { - string const & fricitonLawName = subRegion.template getReference< string >( viewKeyStruct::frictionLawNameString() ); - RateAndStateFriction const & frictionLaw = getConstitutiveModel< RateAndStateFriction >( subRegion, fricitonLawName ); + string const & frictionLawName = subRegion.template getReference< string >( viewKeyStruct::frictionLawNameString() ); + RateAndStateFriction const & frictionLaw = getConstitutiveModel< RateAndStateFriction >( subRegion, frictionLawName ); rateAndStateKernels::EmbeddedRungeKuttaKernel rkKernel( subRegion, frictionLaw, m_butcherTable ); arrayView3d< real64 > const rkStageRates = subRegion.getField< rateAndState::rungeKuttaStageRates >(); if( m_butcherTable.FSAL ) diff --git a/src/coreComponents/physicsSolvers/inducedSeismicity/ImplicitQDRateAndState.cpp b/src/coreComponents/physicsSolvers/inducedSeismicity/ImplicitQDRateAndState.cpp index 3d8ae4ec756..8da46c26784 100644 --- a/src/coreComponents/physicsSolvers/inducedSeismicity/ImplicitQDRateAndState.cpp +++ b/src/coreComponents/physicsSolvers/inducedSeismicity/ImplicitQDRateAndState.cpp @@ -31,7 +31,6 @@ namespace geos using namespace dataRepository; using namespace fields; -using namespace constitutive; ImplicitQDRateAndState::ImplicitQDRateAndState( const string & name, Group * const parent ): diff --git a/src/coreComponents/physicsSolvers/inducedSeismicity/QDRateAndStateBase.cpp b/src/coreComponents/physicsSolvers/inducedSeismicity/QDRateAndStateBase.cpp index 42f8cfc38f2..893a26bae1e 100644 --- a/src/coreComponents/physicsSolvers/inducedSeismicity/QDRateAndStateBase.cpp +++ b/src/coreComponents/physicsSolvers/inducedSeismicity/QDRateAndStateBase.cpp @@ -104,9 +104,9 @@ void QDRateAndStateBase::enforceRateAndVelocityConsistency( SurfaceElementSubReg real64 const shearImpedance = m_shearImpedance; string const & frictionaLawName = subRegion.getReference< string >( viewKeyStruct::frictionLawNameString() ); - constitutive::RateAndStateFriction const & frictionLaw = subRegion.getConstitutiveModel< constitutive::RateAndStateFriction >( frictionaLawName ); + RateAndStateFriction const & frictionLaw = subRegion.getConstitutiveModel< RateAndStateFriction >( frictionaLawName ); - constitutive::RateAndStateFriction::KernelWrapper frictionLawKernelWrapper = frictionLaw.createKernelUpdates(); + RateAndStateFriction::KernelWrapper frictionLawKernelWrapper = frictionLaw.createKernelUpdates(); RAJA::ReduceMax< parallelDeviceReduce, int > negativeSlipRate( 0 ); RAJA::ReduceMax< parallelDeviceReduce, int > bothNonZero( 0 ); diff --git a/src/coreComponents/physicsSolvers/inducedSeismicity/QuasiDynamicEarthQuake.cpp b/src/coreComponents/physicsSolvers/inducedSeismicity/QuasiDynamicEarthQuake.cpp index 8211012b626..0bc93285056 100644 --- a/src/coreComponents/physicsSolvers/inducedSeismicity/QuasiDynamicEarthQuake.cpp +++ b/src/coreComponents/physicsSolvers/inducedSeismicity/QuasiDynamicEarthQuake.cpp @@ -33,7 +33,6 @@ namespace geos using namespace dataRepository; using namespace fields; -using namespace constitutive; using namespace rateAndStateKernels; template< typename RSSOLVER_TYPE > diff --git a/src/coreComponents/physicsSolvers/inducedSeismicity/SeismicityRate.cpp b/src/coreComponents/physicsSolvers/inducedSeismicity/SeismicityRate.cpp index 8409180dfba..d92b8ef7b8f 100644 --- a/src/coreComponents/physicsSolvers/inducedSeismicity/SeismicityRate.cpp +++ b/src/coreComponents/physicsSolvers/inducedSeismicity/SeismicityRate.cpp @@ -173,7 +173,7 @@ void SeismicityRate::updateFaultTraction( ElementSubRegionBase & subRegion ) con string const & porousSolidModelName = subRegion.getReference< string >( FlowSolverBase::viewKeyStruct::solidNamesString() ); CoupledSolidBase & porousSolid = getConstitutiveModel< CoupledSolidBase >( subRegion, porousSolidModelName ); - constitutive::ConstitutivePassThru< CoupledSolidBase >::execute( porousSolid, [&] ( auto & castedPorousSolid ) + ConstitutivePassThru< CoupledSolidBase >::execute( porousSolid, [&] ( auto & castedPorousSolid ) { // Initialize biotCoefficient as const arrayView before passing it through the lambda cast arrayView1d< real64 const > const biotCoefficient = castedPorousSolid.getBiotCoefficient(); diff --git a/src/coreComponents/physicsSolvers/multiphysics/CompositionalMultiphaseReservoirAndWells.cpp b/src/coreComponents/physicsSolvers/multiphysics/CompositionalMultiphaseReservoirAndWells.cpp index afa810d945a..d6201a48cc0 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/CompositionalMultiphaseReservoirAndWells.cpp +++ b/src/coreComponents/physicsSolvers/multiphysics/CompositionalMultiphaseReservoirAndWells.cpp @@ -41,6 +41,7 @@ namespace geos using namespace dataRepository; using namespace constitutive; +using namespace fields; template< typename RESERVOIR_SOLVER > CompositionalMultiphaseReservoirAndWells< RESERVOIR_SOLVER >:: @@ -201,15 +202,15 @@ addCouplingSparsityPattern( DomainPartition const & domain, // get the well element indices corresponding to each perforation arrayView1d< localIndex const > const & perfWellElemIndex = - perforationData->getField< fields::perforation::wellElementIndex >(); + perforationData->getField< perforation::wellElementIndex >(); // get the element region, subregion, index arrayView1d< localIndex const > const & resElementRegion = - perforationData->getField< fields::perforation::reservoirElementRegion >(); + perforationData->getField< perforation::reservoirElementRegion >(); arrayView1d< localIndex const > const & resElementSubRegion = - perforationData->getField< fields::perforation::reservoirElementSubRegion >(); + perforationData->getField< perforation::reservoirElementSubRegion >(); arrayView1d< localIndex const > const & resElementIndex = - perforationData->getField< fields::perforation::reservoirElementIndex >(); + perforationData->getField< perforation::reservoirElementIndex >(); // Insert the entries corresponding to reservoir-well perforations // This will fill J_WR, and J_RW diff --git a/src/coreComponents/physicsSolvers/multiphysics/CoupledReservoirAndWellsBase.cpp b/src/coreComponents/physicsSolvers/multiphysics/CoupledReservoirAndWellsBase.cpp index 631a5ee6cd3..7f22a052724 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/CoupledReservoirAndWellsBase.cpp +++ b/src/coreComponents/physicsSolvers/multiphysics/CoupledReservoirAndWellsBase.cpp @@ -23,6 +23,8 @@ namespace geos { +using namespace fields; + namespace coupledReservoirAndWellsInternal { @@ -64,15 +66,15 @@ addCouplingNumNonzeros( PhysicsSolverBase const * const solver, // get the well element indices corresponding to each perforation arrayView1d< localIndex const > const & perfWellElemIndex = - perforationData->getField< fields::perforation::wellElementIndex >(); + perforationData->getField< perforation::wellElementIndex >(); // get the element region, subregion, index arrayView1d< localIndex const > const & resElementRegion = - perforationData->getField< fields::perforation::reservoirElementRegion >(); + perforationData->getField< perforation::reservoirElementRegion >(); arrayView1d< localIndex const > const & resElementSubRegion = - perforationData->getField< fields::perforation::reservoirElementSubRegion >(); + perforationData->getField< perforation::reservoirElementSubRegion >(); arrayView1d< localIndex const > const & resElementIndex = - perforationData->getField< fields::perforation::reservoirElementIndex >(); + perforationData->getField< perforation::reservoirElementIndex >(); // Loop over perforations and increase row lengths for reservoir and well elements accordingly forAll< serialPolicy >( perforationData->size(), [=] ( localIndex const iperf ) @@ -131,7 +133,7 @@ bool validateWellPerforations( PhysicsSolverBase const * const reservoirSolver, WellControls const & wellControls = wellSolver->getWellControls( subRegion ); arrayView1d< localIndex const > const & resElementRegion = - perforationData->getField< fields::perforation::reservoirElementRegion >(); + perforationData->getField< perforation::reservoirElementRegion >(); // Loop over perforations and check the reservoir region to which each perforation is connected to // If the name of the region is not in the list of targetted regions, then we have a "bad" connection. diff --git a/src/coreComponents/physicsSolvers/multiphysics/FlowProppantTransportSolver.cpp b/src/coreComponents/physicsSolvers/multiphysics/FlowProppantTransportSolver.cpp index fe329e26569..a57a0790354 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/FlowProppantTransportSolver.cpp +++ b/src/coreComponents/physicsSolvers/multiphysics/FlowProppantTransportSolver.cpp @@ -28,7 +28,6 @@ namespace geos { using namespace dataRepository; -using namespace constitutive; FlowProppantTransportSolver::FlowProppantTransportSolver( const string & name, Group * const parent ): diff --git a/src/coreComponents/physicsSolvers/multiphysics/HydrofractureSolver.cpp b/src/coreComponents/physicsSolvers/multiphysics/HydrofractureSolver.cpp index 3175f518666..36f6370a580 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/HydrofractureSolver.cpp +++ b/src/coreComponents/physicsSolvers/multiphysics/HydrofractureSolver.cpp @@ -1013,9 +1013,9 @@ void HydrofractureSolver< POROMECHANICS_SOLVER >::initializeNewFractureFields( D arrayView2d< real64 const > faceNormal = faceManager.faceNormal(); solidMechanics::arrayView2dLayoutIncrDisplacement const incrementalDisplacement = - nodeManager.getField< fields::solidMechanics::incrementalDisplacement >(); + nodeManager.getField< solidMechanics::incrementalDisplacement >(); solidMechanics::arrayView2dLayoutTotalDisplacement const totalDisplacement = - nodeManager.getField< fields::solidMechanics::totalDisplacement >(); + nodeManager.getField< solidMechanics::totalDisplacement >(); elemManager.forElementRegions< SurfaceElementRegion >( regionNames, [=] ( localIndex const, @@ -1030,12 +1030,12 @@ void HydrofractureSolver< POROMECHANICS_SOLVER >::initializeNewFractureFields( D arrayView2d< localIndex const > const faceMap = subRegion.faceList().toViewConst(); - arrayView1d< real64 > const fluidPressure_n = subRegion.getField< fields::flow::pressure_n >(); - arrayView1d< real64 > const fluidPressure = subRegion.getField< fields::flow::pressure >(); + arrayView1d< real64 > const fluidPressure_n = subRegion.getField< flow::pressure_n >(); + arrayView1d< real64 > const fluidPressure = subRegion.getField< flow::pressure >(); string const & fluidName = subRegion.getReference< string >( FlowSolverBase::viewKeyStruct::fluidNamesString() ); SingleFluidBase const & fluid = subRegion.getConstitutiveModel< SingleFluidBase >( fluidName ); real64 const defaultDensity = fluid.defaultDensity(); - arrayView1d< real64 > const massCreated = subRegion.getField< fields::flow::massCreated >(); + arrayView1d< real64 > const massCreated = subRegion.getField< flow::massCreated >(); arrayView1d< real64 > const aperture = subRegion.getField< fields::elementAperture >(); diff --git a/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanics.cpp b/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanics.cpp index 9d5ab47cd8e..cba712b5885 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanics.cpp +++ b/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanics.cpp @@ -344,11 +344,11 @@ template< typename FLOW_SOLVER, typename MECHANICS_SOLVER > void MultiphasePoromechanics< FLOW_SOLVER, MECHANICS_SOLVER >::updateBulkDensity( ElementSubRegionBase & subRegion ) { // get the fluid model (to access fluid density) - string const fluidName = subRegion.getReference< string >( FlowSolverBase::viewKeyStruct::fluidNamesString() ); + string const & fluidName = subRegion.getReference< string >( FlowSolverBase::viewKeyStruct::fluidNamesString() ); MultiFluidBase const & fluid = this->template getConstitutiveModel< MultiFluidBase >( subRegion, fluidName ); // get the solid model (to access porosity and solid density) - string const solidName = subRegion.getReference< string >( Base::viewKeyStruct::porousMaterialNamesString() ); + string const & solidName = subRegion.getReference< string >( Base::viewKeyStruct::porousMaterialNamesString() ); CoupledSolidBase const & solid = this->template getConstitutiveModel< CoupledSolidBase >( subRegion, solidName ); // update the bulk density diff --git a/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanicsConformingFractures.cpp b/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanicsConformingFractures.cpp index 5036b3bdb40..cb6ab28ee79 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanicsConformingFractures.cpp +++ b/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanicsConformingFractures.cpp @@ -568,6 +568,8 @@ assembleFluidMassResidualDerivativeWrtDisplacement( MeshLevel const & mesh, { GEOS_MARK_FUNCTION; + using namespace contact; + integer const numComp = this->flowSolver()->numFluidComponents(); FaceManager const & faceManager = mesh.getFaceManager(); @@ -599,7 +601,7 @@ assembleFluidMassResidualDerivativeWrtDisplacement( MeshLevel const & mesh, [&]( localIndex const, FaceElementSubRegion const & subRegion ) { - arrayView2d< real64 const, compflow::USD_COMP > const compDens = subRegion.getField< fields::flow::globalCompDensity >(); + arrayView2d< real64 const, compflow::USD_COMP > const compDens = subRegion.getField< flow::globalCompDensity >(); arrayView1d< globalIndex const > const & flowDofNumber = subRegion.getReference< array1d< globalIndex > >( flowDofKey ); @@ -622,7 +624,7 @@ assembleFluidMassResidualDerivativeWrtDisplacement( MeshLevel const & mesh, stackArray2d< real64, 2*3*m_maxFaceNodes * MultiFluidBase::MAX_NUM_COMPONENTS > dRdU( MultiFluidBase::MAX_NUM_COMPONENTS, 2*3*m_maxFaceNodes ); - bool const isFractureOpen = ( fractureState[kfe] == contact::FractureState::Open ); + bool const isFractureOpen = ( fractureState[kfe] == FractureState::Open ); // Accumulation derivative if( isFractureOpen ) @@ -691,7 +693,7 @@ assembleFluidMassResidualDerivativeWrtDisplacement( MeshLevel const & mesh, real64 const dR_dAper = values[kfe1]; localIndex const kfe2 = columns[kfe1]; - bool const isOpen = ( fractureState[kfe2] == contact::FractureState::Open ); + bool const isOpen = ( fractureState[kfe2] == FractureState::Open ); skipAssembly &= !isOpen; for( localIndex kf = 0; kf < 2; ++kf ) @@ -784,7 +786,7 @@ void MultiphasePoromechanicsConformingFractures< FLOW_SOLVER >::updateHydraulicA arrayView1d< real64 > const hydraulicAperture = subRegion.getField< flow::hydraulicAperture >(); arrayView1d< real64 > const deltaVolume = subRegion.getField< flow::deltaVolume >(); - string const porousSolidName = subRegion.getReference< string >( FlowSolverBase::viewKeyStruct::solidNamesString() ); + string const & porousSolidName = subRegion.getReference< string >( FlowSolverBase::viewKeyStruct::solidNamesString() ); CoupledSolidBase & porousSolid = subRegion.getConstitutiveModel< CoupledSolidBase >( porousSolidName ); string const & hydraulicApertureRelationName = subRegion.template getReference< string >( viewKeyStruct::hydraulicApertureRelationNameString() ); diff --git a/src/coreComponents/physicsSolvers/multiphysics/OneWayCoupledFractureFlowContactMechanics.cpp b/src/coreComponents/physicsSolvers/multiphysics/OneWayCoupledFractureFlowContactMechanics.cpp index 73075a7736d..23cfe2cc0ef 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/OneWayCoupledFractureFlowContactMechanics.cpp +++ b/src/coreComponents/physicsSolvers/multiphysics/OneWayCoupledFractureFlowContactMechanics.cpp @@ -25,7 +25,9 @@ namespace geos { + using namespace dataRepository; +using namespace fields; template< typename FLOW_SOLVER > OneWayCoupledFractureFlowContactMechanics< FLOW_SOLVER >::OneWayCoupledFractureFlowContactMechanics( const string & name, @@ -64,8 +66,8 @@ real64 OneWayCoupledFractureFlowContactMechanics< FLOW_SOLVER >::sequentiallyCou [&]( localIndex const, SurfaceElementSubRegion & subRegion ) { - arrayView2d< real64 > const traction = subRegion.getField< fields::contact::traction >(); - arrayView1d< real64 > const pressure = subRegion.getField< fields::flow::pressure >(); + arrayView2d< real64 > const traction = subRegion.getField< contact::traction >(); + arrayView1d< real64 > const pressure = subRegion.getField< flow::pressure >(); forAll< parallelDevicePolicy<> >( subRegion.size(), [=] GEOS_HOST_DEVICE ( localIndex const k ) { diff --git a/src/coreComponents/physicsSolvers/multiphysics/PoromechanicsInitialization.hpp b/src/coreComponents/physicsSolvers/multiphysics/PoromechanicsInitialization.hpp index 60e8535a2b7..9a6d06ed454 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/PoromechanicsInitialization.hpp +++ b/src/coreComponents/physicsSolvers/multiphysics/PoromechanicsInitialization.hpp @@ -91,8 +91,6 @@ class PoromechanicsInitialization : public TaskBase void postInputInitialization() override; -// void registerDataOnMesh( Group & meshBodies ) override; - /// Name of the poromechanics solver string m_poromechanicsSolverName; diff --git a/src/coreComponents/physicsSolvers/multiphysics/PoromechanicsSolver.hpp b/src/coreComponents/physicsSolvers/multiphysics/PoromechanicsSolver.hpp index 9db368c00b7..2a3b0c1f9ae 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/PoromechanicsSolver.hpp +++ b/src/coreComponents/physicsSolvers/multiphysics/PoromechanicsSolver.hpp @@ -122,19 +122,20 @@ class PoromechanicsSolver : public CoupledSolver< FLOW_SOLVER, MECHANICS_SOLVER virtual void setConstitutiveNamesCallSuper( ElementSubRegionBase & subRegion ) const override final { + Base::setConstitutiveNamesCallSuper( subRegion ); + + this->template setConstitutiveName< constitutive::CoupledSolidBase >( subRegion, + viewKeyStruct::porousMaterialNamesString() ); + + // This is needed by the way the surface generator currently does things. + this->template setConstitutiveName< constitutive::PorosityBase >( subRegion, + constitutive::CoupledSolidBase::viewKeyStruct::porosityModelNameString() ); + if( dynamic_cast< SurfaceElementSubRegion * >( &subRegion ) ) { - subRegion.registerWrapper< string >( viewKeyStruct::hydraulicApertureRelationNameString() ). - setPlotLevel( dataRepository::PlotLevel::NOPLOT ). - setRestartFlags( dataRepository::RestartFlags::NO_WRITE ). - setSizedFromParent( 0 ); - - string & hydraulicApertureModelName = subRegion.getReference< string >( viewKeyStruct::hydraulicApertureRelationNameString() ); - hydraulicApertureModelName = PhysicsSolverBase::getConstitutiveName< constitutive::HydraulicApertureBase >( subRegion ); - GEOS_ERROR_IF( hydraulicApertureModelName.empty(), GEOS_FMT( "{}: HydraulicApertureBase model not found on subregion {}", - this->getDataContext(), subRegion.getDataContext() ) ); + this->template setConstitutiveName< constitutive::HydraulicApertureBase >( subRegion, + viewKeyStruct::hydraulicApertureRelationNameString() ); } - } virtual void initializePreSubGroups() override @@ -157,24 +158,12 @@ class PoromechanicsSolver : public CoupledSolver< FLOW_SOLVER, MECHANICS_SOLVER [&]( localIndex const, ElementSubRegionBase & subRegion ) { - string & porousName = subRegion.getReference< string >( viewKeyStruct::porousMaterialNamesString() ); - porousName = this->template getConstitutiveName< constitutive::CoupledSolidBase >( subRegion ); - GEOS_THROW_IF( porousName.empty(), - GEOS_FMT( "{} {} : Solid model not found on subregion {}", - this->getCatalogName(), this->getDataContext().toString(), subRegion.getName() ), - InputError ); - - string & porosityModelName = subRegion.getReference< string >( constitutive::CoupledSolidBase::viewKeyStruct::porosityModelNameString() ); - porosityModelName = this->template getConstitutiveName< constitutive::PorosityBase >( subRegion ); - GEOS_THROW_IF( porosityModelName.empty(), - GEOS_FMT( "{} {} : Porosity model not found on subregion {}", - this->getCatalogName(), this->getDataContext().toString(), subRegion.getName() ), - InputError ); - if( subRegion.hasField< fields::poromechanics::bulkDensity >() ) { // get the solid model to know the number of quadrature points and resize the bulk density - constitutive::CoupledSolidBase const & solid = this->template getConstitutiveModel< constitutive::CoupledSolidBase >( subRegion, porousName ); + constitutive::CoupledSolidBase const & solid = + this->template getConstitutiveModel< constitutive::CoupledSolidBase >( subRegion, + subRegion.getReference< string >( viewKeyStruct::porousMaterialNamesString() ) ); subRegion.getField< fields::poromechanics::bulkDensity >().resizeDimension< 1 >( solid.getDensity().size( 1 ) ); } } ); @@ -183,7 +172,7 @@ class PoromechanicsSolver : public CoupledSolver< FLOW_SOLVER, MECHANICS_SOLVER virtual void registerDataOnMesh( dataRepository::Group & meshBodies ) override { - PhysicsSolverBase::registerDataOnMesh( meshBodies ); + Base::registerDataOnMesh( meshBodies ); if( this->getNonlinearSolverParameters().m_couplingType == NonlinearSolverParameters::CouplingType::Sequential ) { @@ -198,9 +187,9 @@ class PoromechanicsSolver : public CoupledSolver< FLOW_SOLVER, MECHANICS_SOLVER flowSolver()->enableJumpStabilization(); } - PhysicsSolverBase::forDiscretizationOnMeshTargets( meshBodies, [&] ( string const &, - MeshLevel & mesh, - arrayView1d< string const > const & regionNames ) + this->template forDiscretizationOnMeshTargets( meshBodies, [&] ( string const &, + MeshLevel & mesh, + arrayView1d< string const > const & regionNames ) { ElementRegionManager & elemManager = mesh.getElemManager(); @@ -208,17 +197,6 @@ class PoromechanicsSolver : public CoupledSolver< FLOW_SOLVER, MECHANICS_SOLVER [&]( localIndex const, ElementSubRegionBase & subRegion ) { - subRegion.registerWrapper< string >( viewKeyStruct::porousMaterialNamesString() ). - setPlotLevel( dataRepository::PlotLevel::NOPLOT ). - setRestartFlags( dataRepository::RestartFlags::NO_WRITE ). - setSizedFromParent( 0 ); - - // This is needed by the way the surface generator currently does things. - subRegion.registerWrapper< string >( constitutive::CoupledSolidBase::viewKeyStruct::porosityModelNameString() ). - setPlotLevel( dataRepository::PlotLevel::NOPLOT ). - setRestartFlags( dataRepository::RestartFlags::NO_WRITE ). - setSizedFromParent( 0 ); - if( this->getNonlinearSolverParameters().m_couplingType == NonlinearSolverParameters::CouplingType::Sequential ) { // register the bulk density for use in the solid mechanics solver @@ -364,8 +342,9 @@ class PoromechanicsSolver : public CoupledSolver< FLOW_SOLVER, MECHANICS_SOLVER arrayView1d< integer > const macroElementIndex = subRegion.getField< fields::flow::macroElementIndex >(); arrayView1d< real64 > const elementStabConstant = subRegion.getField< fields::flow::elementStabConstant >(); - geos::constitutive::CoupledSolidBase const & porousSolid = - this->template getConstitutiveModel< geos::constitutive::CoupledSolidBase >( subRegion, subRegion.getReference< string >( viewKeyStruct::porousMaterialNamesString() ) ); + constitutive::CoupledSolidBase const & porousSolid = + this->template getConstitutiveModel< constitutive::CoupledSolidBase >( subRegion, + subRegion.getReference< string >( viewKeyStruct::porousMaterialNamesString() ) ); arrayView1d< real64 const > const bulkModulus = porousSolid.getBulkModulus(); arrayView1d< real64 const > const shearModulus = porousSolid.getShearModulus(); @@ -414,7 +393,7 @@ class PoromechanicsSolver : public CoupledSolver< FLOW_SOLVER, MECHANICS_SOLVER string const dofKey = dofManager.getKey( fields::solidMechanics::totalDisplacement::key() ); arrayView1d< globalIndex const > const & dofNumber = nodeManager.getReference< globalIndex_array >( dofKey ); - real64 const gravityVectorData[3] = LVARRAY_TENSOROPS_INIT_LOCAL_3( PhysicsSolverBase::gravityVector() ); + real64 const gravityVectorData[3] = LVARRAY_TENSOROPS_INIT_LOCAL_3( this->gravityVector() ); KERNEL_WRAPPER kernelWrapper( dofNumber, dofManager.rankOffset(), @@ -440,15 +419,17 @@ class PoromechanicsSolver : public CoupledSolver< FLOW_SOLVER, MECHANICS_SOLVER array1d< real64 > & averageMeanTotalStressIncrement ) { averageMeanTotalStressIncrement.resize( 0 ); - PhysicsSolverBase::forDiscretizationOnMeshTargets( domain.getMeshBodies(), [&]( string const &, - MeshLevel & mesh, - arrayView1d< string const > const & regionNames ) { + this->template forDiscretizationOnMeshTargets( domain.getMeshBodies(), [&]( string const &, + MeshLevel & mesh, + arrayView1d< string const > const & regionNames ) { mesh.getElemManager().forElementSubRegions< CellElementSubRegion >( regionNames, [&]( localIndex const, - auto & subRegion ) { + auto & subRegion ) + { // get the solid model (to access stress increment) - string const solidName = subRegion.template getReference< string >( "porousMaterialNames" ); - constitutive::CoupledSolidBase & solid = PhysicsSolverBase::getConstitutiveModel< constitutive::CoupledSolidBase >( - subRegion, solidName ); + string const & solidName = + subRegion.template getReference< string >( viewKeyStruct::porousMaterialNamesString() ); + constitutive::CoupledSolidBase & solid = + this->template getConstitutiveModel< constitutive::CoupledSolidBase >( subRegion, solidName ); arrayView1d< const real64 > const & averageMeanTotalStressIncrement_k = solid.getAverageMeanTotalStressIncrement_k(); for( localIndex k = 0; k < localIndex( averageMeanTotalStressIncrement_k.size()); k++ ) @@ -463,15 +444,15 @@ class PoromechanicsSolver : public CoupledSolver< FLOW_SOLVER, MECHANICS_SOLVER array1d< real64 > & averageMeanTotalStressIncrement ) { integer i = 0; - PhysicsSolverBase::forDiscretizationOnMeshTargets( domain.getMeshBodies(), [&]( string const &, - MeshLevel & mesh, - arrayView1d< string const > const & regionNames ) { + this->template forDiscretizationOnMeshTargets( domain.getMeshBodies(), [&]( string const &, + MeshLevel & mesh, + arrayView1d< string const > const & regionNames ) { mesh.getElemManager().forElementSubRegions< CellElementSubRegion >( regionNames, [&]( localIndex const, auto & subRegion ) { // get the solid model (to access stress increment) - string const solidName = subRegion.template getReference< string >( "porousMaterialNames" ); - constitutive::CoupledSolidBase & solid = PhysicsSolverBase::getConstitutiveModel< constitutive::CoupledSolidBase >( - subRegion, solidName ); + string const & solidName = subRegion.template getReference< string >( viewKeyStruct::porousMaterialNamesString() ); + constitutive::CoupledSolidBase & solid = + this->template getConstitutiveModel< constitutive::CoupledSolidBase >( subRegion, solidName ); auto & porosityModel = dynamic_cast< constitutive::BiotPorosity const & >( solid.getBasePorosityModel()); arrayView1d< real64 > const & averageMeanTotalStressIncrement_k = solid.getAverageMeanTotalStressIncrement_k(); for( localIndex k = 0; k < localIndex( averageMeanTotalStressIncrement_k.size()); k++ ) @@ -622,8 +603,9 @@ class PoromechanicsSolver : public CoupledSolver< FLOW_SOLVER, MECHANICS_SOLVER auto & subRegion ) { // get the solid model (to access stress increment) - string const solidName = subRegion.template getReference< string >( viewKeyStruct::porousMaterialNamesString() ); - constitutive::CoupledSolidBase & solid = this->template getConstitutiveModel< constitutive::CoupledSolidBase >( subRegion, solidName ); + string const & solidName = subRegion.template getReference< string >( viewKeyStruct::porousMaterialNamesString() ); + constitutive::CoupledSolidBase & solid = + this->template getConstitutiveModel< constitutive::CoupledSolidBase >( subRegion, solidName ); arrayView2d< real64 const > const meanTotalStressIncrement_k = solid.getMeanTotalStressIncrement_k(); arrayView1d< real64 > const averageMeanTotalStressIncrement_k = solid.getAverageMeanTotalStressIncrement_k(); diff --git a/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanics.cpp b/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanics.cpp index 71ee23e8275..5ed8189fef1 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanics.cpp +++ b/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanics.cpp @@ -378,11 +378,11 @@ template< typename FLOW_SOLVER, typename MECHANICS_SOLVER > void SinglePhasePoromechanics< FLOW_SOLVER, MECHANICS_SOLVER >::updateBulkDensity( ElementSubRegionBase & subRegion ) { // get the fluid model (to access fluid density) - string const fluidName = subRegion.getReference< string >( FlowSolverBase::viewKeyStruct::fluidNamesString() ); + string const & fluidName = subRegion.getReference< string >( FlowSolverBase::viewKeyStruct::fluidNamesString() ); SingleFluidBase const & fluid = this->template getConstitutiveModel< SingleFluidBase >( subRegion, fluidName ); // get the solid model (to access porosity and solid density) - string const solidName = subRegion.getReference< string >( viewKeyStruct::porousMaterialNamesString() ); + string const & solidName = subRegion.getReference< string >( viewKeyStruct::porousMaterialNamesString() ); CoupledSolidBase const & solid = this->template getConstitutiveModel< CoupledSolidBase >( subRegion, solidName ); // update the bulk density diff --git a/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsConformingFractures.cpp b/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsConformingFractures.cpp index f08022d623d..2aa9e35a7f2 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsConformingFractures.cpp +++ b/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsConformingFractures.cpp @@ -564,6 +564,8 @@ assembleFluidMassResidualDerivativeWrtDisplacement( MeshLevel const & mesh, { GEOS_MARK_FUNCTION; + using namespace contact; + FaceManager const & faceManager = mesh.getFaceManager(); NodeManager const & nodeManager = mesh.getNodeManager(); EdgeManager const & edgeManager = mesh.getEdgeManager(); @@ -621,7 +623,7 @@ assembleFluidMassResidualDerivativeWrtDisplacement( MeshLevel const & mesh, stackArray1d< real64, 2*3*m_maxFaceNodes > dRdU( 2*3*m_maxFaceNodes ); - bool const isFractureOpen = ( fractureState[kfe] == contact::FractureState::Open ); + bool const isFractureOpen = ( fractureState[kfe] == FractureState::Open ); // Accumulation derivative if( isFractureOpen ) @@ -682,7 +684,7 @@ assembleFluidMassResidualDerivativeWrtDisplacement( MeshLevel const & mesh, real64 const dR_dAper = values[kfe1]; localIndex const kfe2 = columns[kfe1]; - bool const isOpen = ( fractureState[kfe2] == contact::FractureState::Open ); + bool const isOpen = ( fractureState[kfe2] == FractureState::Open ); skipAssembly &= !isOpen; for( localIndex kf=0; kf<2; ++kf ) @@ -771,7 +773,7 @@ void SinglePhasePoromechanicsConformingFractures< FLOW_SOLVER >::updateHydraulic arrayView1d< real64 > const hydraulicAperture = subRegion.getField< flow::hydraulicAperture >(); arrayView1d< real64 > const deltaVolume = subRegion.getField< flow::deltaVolume >(); - string const porousSolidName = subRegion.getReference< string >( FlowSolverBase::viewKeyStruct::solidNamesString() ); + string const & porousSolidName = subRegion.getReference< string >( FlowSolverBase::viewKeyStruct::solidNamesString() ); CoupledSolidBase & porousSolid = subRegion.getConstitutiveModel< CoupledSolidBase >( porousSolidName ); string const & hydraulicApertureRelationName = subRegion.template getReference< string >( viewKeyStruct::hydraulicApertureRelationNameString() ); diff --git a/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsEmbeddedFractures.cpp b/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsEmbeddedFractures.cpp index d0bb8efb6aa..fb49b79bc2f 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsEmbeddedFractures.cpp +++ b/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsEmbeddedFractures.cpp @@ -500,7 +500,7 @@ void SinglePhasePoromechanicsEmbeddedFractures::updateState( DomainPartition & d string const & hydraulicApertureRelationName = subRegion.template getReference< string >( viewKeyStruct::hydraulicApertureRelationNameString() ); HydraulicApertureBase const & hydraulicApertureModel = this->template getConstitutiveModel< HydraulicApertureBase >( subRegion, hydraulicApertureRelationName ); - string const porousSolidName = subRegion.template getReference< string >( FlowSolverBase::viewKeyStruct::solidNamesString() ); + string const & porousSolidName = subRegion.template getReference< string >( FlowSolverBase::viewKeyStruct::solidNamesString() ); CoupledSolidBase & porousSolid = subRegion.template getConstitutiveModel< CoupledSolidBase >( porousSolidName ); constitutive::ConstitutivePassThru< CompressibleSolidBase >::execute( porousSolid, [=, &subRegion, &hydraulicApertureModel] ( auto & castedPorousSolid ) diff --git a/src/coreComponents/physicsSolvers/multiphysics/SinglePhaseReservoirAndWells.cpp b/src/coreComponents/physicsSolvers/multiphysics/SinglePhaseReservoirAndWells.cpp index f83652d7455..73a2048efc0 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/SinglePhaseReservoirAndWells.cpp +++ b/src/coreComponents/physicsSolvers/multiphysics/SinglePhaseReservoirAndWells.cpp @@ -35,7 +35,7 @@ namespace geos { using namespace dataRepository; -using namespace constitutive; +using namespace fields; template< typename RESERVOIR_SOLVER > SinglePhaseReservoirAndWells< RESERVOIR_SOLVER >:: @@ -167,15 +167,15 @@ addCouplingSparsityPattern( DomainPartition const & domain, // get the well element indices corresponding to each perforation arrayView1d< localIndex const > const & perfWellElemIndex = - perforationData->getField< fields::perforation::wellElementIndex >(); + perforationData->getField< perforation::wellElementIndex >(); // get the element region, subregion, index arrayView1d< localIndex const > const & resElementRegion = - perforationData->getField< fields::perforation::reservoirElementRegion >(); + perforationData->getField< perforation::reservoirElementRegion >(); arrayView1d< localIndex const > const & resElementSubRegion = - perforationData->getField< fields::perforation::reservoirElementSubRegion >(); + perforationData->getField< perforation::reservoirElementSubRegion >(); arrayView1d< localIndex const > const & resElementIndex = - perforationData->getField< fields::perforation::reservoirElementIndex >(); + perforationData->getField< perforation::reservoirElementIndex >(); // Insert the entries corresponding to reservoir-well perforations // This will fill J_WR, and J_RW @@ -276,20 +276,20 @@ assembleCouplingTerms( real64 const time_n, // get well variables on perforations arrayView1d< real64 const > const perfRate = - perforationData->getField< fields::well::perforationRate >(); + perforationData->getField< well::perforationRate >(); arrayView2d< real64 const > const dPerfRate_dPres = - perforationData->getField< fields::well::dPerforationRate_dPres >(); + perforationData->getField< well::dPerforationRate_dPres >(); arrayView1d< localIndex const > const perfWellElemIndex = - perforationData->getField< fields::perforation::wellElementIndex >(); + perforationData->getField< perforation::wellElementIndex >(); // get the element region, subregion, index arrayView1d< localIndex const > const resElementRegion = - perforationData->getField< fields::perforation::reservoirElementRegion >(); + perforationData->getField< perforation::reservoirElementRegion >(); arrayView1d< localIndex const > const resElementSubRegion = - perforationData->getField< fields::perforation::reservoirElementSubRegion >(); + perforationData->getField< perforation::reservoirElementSubRegion >(); arrayView1d< localIndex const > const resElementIndex = - perforationData->getField< fields::perforation::reservoirElementIndex >(); + perforationData->getField< perforation::reservoirElementIndex >(); // loop over the perforations and add the rates to the residual and jacobian forAll< parallelDevicePolicy<> >( perforationData->size(), [=] GEOS_HOST_DEVICE ( localIndex const iperf ) diff --git a/src/coreComponents/physicsSolvers/multiphysics/poromechanicsKernels/MultiphasePoromechanics_impl.hpp b/src/coreComponents/physicsSolvers/multiphysics/poromechanicsKernels/MultiphasePoromechanics_impl.hpp index b5f2621b165..bf572f367db 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/poromechanicsKernels/MultiphasePoromechanics_impl.hpp +++ b/src/coreComponents/physicsSolvers/multiphysics/poromechanicsKernels/MultiphasePoromechanics_impl.hpp @@ -90,7 +90,7 @@ MultiphasePoromechanics( NodeManager const & nodeManager, // extract fluid constitutive data views { - string const fluidModelName = elementSubRegion.template getReference< string >( fluidModelKey ); + string const & fluidModelName = elementSubRegion.template getReference< string >( fluidModelKey ); constitutive::MultiFluidBase const & fluid = elementSubRegion.template getConstitutiveModel< constitutive::MultiFluidBase >( fluidModelName ); diff --git a/src/coreComponents/physicsSolvers/multiphysics/poromechanicsKernels/ThermalMultiphasePoromechanics_impl.hpp b/src/coreComponents/physicsSolvers/multiphysics/poromechanicsKernels/ThermalMultiphasePoromechanics_impl.hpp index 98e5a37075f..ca508207009 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/poromechanicsKernels/ThermalMultiphasePoromechanics_impl.hpp +++ b/src/coreComponents/physicsSolvers/multiphysics/poromechanicsKernels/ThermalMultiphasePoromechanics_impl.hpp @@ -83,7 +83,7 @@ ThermalMultiphasePoromechanics( NodeManager const & nodeManager, { // extract fluid constitutive data views { - string const fluidModelName = elementSubRegion.template getReference< string >( fluidModelKey ); + string const & fluidModelName = elementSubRegion.template getReference< string >( fluidModelKey ); constitutive::MultiFluidBase const & fluid = elementSubRegion.template getConstitutiveModel< constitutive::MultiFluidBase >( fluidModelName ); diff --git a/src/coreComponents/physicsSolvers/simplePDE/PhaseFieldDamageFEM.cpp b/src/coreComponents/physicsSolvers/simplePDE/PhaseFieldDamageFEM.cpp index 72d275cd39e..ac2c7fbf62e 100644 --- a/src/coreComponents/physicsSolvers/simplePDE/PhaseFieldDamageFEM.cpp +++ b/src/coreComponents/physicsSolvers/simplePDE/PhaseFieldDamageFEM.cpp @@ -111,16 +111,8 @@ void PhaseFieldDamageFEM::registerDataOnMesh( Group & meshBodies ) setDescription( "field variable representing the diffusion coefficient" ); - subRegion.registerWrapper< string >( viewKeyStruct::solidModelNamesString() ). - setPlotLevel( PlotLevel::NOPLOT ). - setRestartFlags( RestartFlags::NO_WRITE ). - setSizedFromParent( 0 ); - - string & solidMaterialName = subRegion.getReference< string >( viewKeyStruct::solidModelNamesString() ); - solidMaterialName = PhysicsSolverBase::getConstitutiveName< SolidBase >( subRegion ); - GEOS_ERROR_IF( solidMaterialName.empty(), GEOS_FMT( "{}: SolidBase model not found on subregion {}", - getDataContext(), subRegion.getName() ) ); - + // TODO this should be in setConstitutiveNames + setConstitutiveName< SolidBase >( subRegion, viewKeyStruct::solidModelNamesString() ); } ); } ); } diff --git a/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsLagrangianFEM.cpp b/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsLagrangianFEM.cpp index 3622a33879b..46b3eeefda5 100644 --- a/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsLagrangianFEM.cpp +++ b/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsLagrangianFEM.cpp @@ -149,6 +149,8 @@ SolidMechanicsLagrangianFEM::~SolidMechanicsLagrangianFEM() void SolidMechanicsLagrangianFEM::registerDataOnMesh( Group & meshBodies ) { + PhysicsSolverBase::registerDataOnMesh( meshBodies ); + string const voightLabels[6] = { "XX", "YY", "ZZ", "YZ", "XZ", "XY" }; forDiscretizationOnMeshTargets( meshBodies, [&] ( string const &, @@ -160,11 +162,8 @@ void SolidMechanicsLagrangianFEM::registerDataOnMesh( Group & meshBodies ) [&]( localIndex const, ElementSubRegionBase & subRegion ) { - setConstitutiveNamesCallSuper( subRegion ); - subRegion.registerField< solidMechanics::strain >( getName() ).setDimLabels( 1, voightLabels ).reference().resizeDimension< 1 >( 6 ); subRegion.registerField< solidMechanics::plasticStrain >( getName() ).setDimLabels( 1, voightLabels ).reference().resizeDimension< 1 >( 6 ); - } ); NodeManager & nodes = meshLevel.getNodeManager(); @@ -235,16 +234,10 @@ void SolidMechanicsLagrangianFEM::setConstitutiveNamesCallSuper( ElementSubRegio { PhysicsSolverBase::setConstitutiveNamesCallSuper( subRegion ); - subRegion.registerWrapper< string >( viewKeyStruct::solidMaterialNamesString() ). - setPlotLevel( PlotLevel::NOPLOT ). - setRestartFlags( RestartFlags::NO_WRITE ). - setSizedFromParent( 0 ); - - string & solidMaterialName = subRegion.getReference< string >( viewKeyStruct::solidMaterialNamesString() ); - solidMaterialName = PhysicsSolverBase::getConstitutiveName< SolidBase >( subRegion ); - GEOS_ERROR_IF( solidMaterialName.empty(), GEOS_FMT( "{}: SolidBase model not found on subregion {}", - getDataContext(), subRegion.getDataContext() ) ); - + if( dynamic_cast< CellElementSubRegion * >( &subRegion ) ) + { + setConstitutiveName< SolidBase >( subRegion, viewKeyStruct::solidMaterialNamesString() ); + } } void SolidMechanicsLagrangianFEM::initializePreSubGroups() @@ -252,24 +245,7 @@ void SolidMechanicsLagrangianFEM::initializePreSubGroups() PhysicsSolverBase::initializePreSubGroups(); DomainPartition & domain = this->getGroupByPath< DomainPartition >( "/Problem/domain" ); - - - forDiscretizationOnMeshTargets( domain.getMeshBodies(), [&] ( string const &, - MeshLevel & meshLevel, - arrayView1d< string const > const & regionNames ) - { - ElementRegionManager & elementRegionManager = meshLevel.getElemManager(); - elementRegionManager.forElementSubRegions< CellElementSubRegion >( regionNames, - [&]( localIndex const, - CellElementSubRegion & subRegion ) - { - string & solidMaterialName = subRegion.getReference< string >( viewKeyStruct::solidMaterialNamesString() ); - solidMaterialName = PhysicsSolverBase::getConstitutiveName< SolidBase >( subRegion ); - } ); - } ); - NumericalMethodsManager const & numericalMethodManager = domain.getNumericalMethodManager(); - FiniteElementDiscretizationManager const & feDiscretizationManager = numericalMethodManager.getFiniteElementDiscretizationManager(); diff --git a/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsLagrangianSSLE.cpp b/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsLagrangianSSLE.cpp index cf1e138d21b..b6a9ede30c5 100644 --- a/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsLagrangianSSLE.cpp +++ b/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsLagrangianSSLE.cpp @@ -22,8 +22,6 @@ namespace geos { -using namespace constitutive; - SolidMechanicsLagrangianSSLE::SolidMechanicsLagrangianSSLE( string const & name, Group * const parent ): SolidMechanicsLagrangianFEM( name, parent ) diff --git a/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsMPM.cpp b/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsMPM.cpp index ac93eec252e..86228c8d248 100644 --- a/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsMPM.cpp +++ b/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsMPM.cpp @@ -53,6 +53,7 @@ namespace geos using namespace dataRepository; using namespace constitutive; +using namespace fields; SolidMechanicsMPM::SolidMechanicsMPM( const string & name, Group * const parent ): @@ -325,8 +326,6 @@ SolidMechanicsMPM::~SolidMechanicsMPM() void SolidMechanicsMPM::registerDataOnMesh( Group & meshBodies ) { - using namespace fields::mpm; - ExecutableGroup::registerDataOnMesh( meshBodies ); forDiscretizationOnMeshTargets( meshBodies, [&] ( string const & meshBodyName, @@ -369,23 +368,23 @@ void SolidMechanicsMPM::registerDataOnMesh( Group & meshBodies ) string const voightLabels[6] = { "XX", "YY", "ZZ", "YZ", "XZ", "XY" }; // Single-indexed fields (scalars) - subRegion.registerField< isBad >( getName() ); - subRegion.registerField< particleMass >( getName() ); - subRegion.registerField< particleInitialVolume >( getName() ); - subRegion.registerField< particleDensity >( getName() ); - subRegion.registerField< particleOverlap >( getName() ); + subRegion.registerField< mpm::isBad >( getName() ); + subRegion.registerField< mpm::particleMass >( getName() ); + subRegion.registerField< mpm::particleInitialVolume >( getName() ); + subRegion.registerField< mpm::particleDensity >( getName() ); + subRegion.registerField< mpm::particleOverlap >( getName() ); // Double-indexed fields (vectors and symmetric tensors stored in Voigt notation) - subRegion.registerField< particleStress >( getName() ).setDimLabels( 1, voightLabels ).reference().resizeDimension< 1 >( 6 ); - subRegion.registerField< particleDamageGradient >( getName() ).reference().resizeDimension< 1 >( 3 ); - subRegion.registerField< particleReferencePosition >( getName() ).reference().resizeDimension< 1 >( 3 ); + subRegion.registerField< mpm::particleStress >( getName() ).setDimLabels( 1, voightLabels ).reference().resizeDimension< 1 >( 6 ); + subRegion.registerField< mpm::particleDamageGradient >( getName() ).reference().resizeDimension< 1 >( 3 ); + subRegion.registerField< mpm::particleReferencePosition >( getName() ).reference().resizeDimension< 1 >( 3 ); // Triple-indexed fields (vectors of vectors, non-symmetric tensors) - subRegion.registerField< particleInitialRVectors >( getName() ).reference().resizeDimension< 1, 2 >( 3, 3 ); - subRegion.registerField< particleDeformationGradient >( getName() ).reference().resizeDimension< 1, 2 >( 3, 3 ); - subRegion.registerField< particleFDot >( getName() ).reference().resizeDimension< 1, 2 >( 3, 3 ); - subRegion.registerField< particleVelocityGradient >( getName() ).reference().resizeDimension< 1, 2 >( 3, 3 ); - subRegion.registerField< particleSphF >( getName() ).reference().resizeDimension< 1, 2 >( 3, 3 ); + subRegion.registerField< mpm::particleInitialRVectors >( getName() ).reference().resizeDimension< 1, 2 >( 3, 3 ); + subRegion.registerField< mpm::particleDeformationGradient >( getName() ).reference().resizeDimension< 1, 2 >( 3, 3 ); + subRegion.registerField< mpm::particleFDot >( getName() ).reference().resizeDimension< 1, 2 >( 3, 3 ); + subRegion.registerField< mpm::particleVelocityGradient >( getName() ).reference().resizeDimension< 1, 2 >( 3, 3 ); + subRegion.registerField< mpm::particleSphF >( getName() ).reference().resizeDimension< 1, 2 >( 3, 3 ); } ); } else // Background grid field registration @@ -487,8 +486,9 @@ void SolidMechanicsMPM::initializePreSubGroups() particleManager.forParticleSubRegions< ParticleSubRegion >( regionNames, [&]( localIndex const, ParticleSubRegion & subRegion ) { + // TODO this is already done in setConstitutiveName string & solidMaterialName = subRegion.getReference< string >( viewKeyStruct::solidMaterialNamesString() ); - solidMaterialName = PhysicsSolverBase::getConstitutiveName< SolidBase >( subRegion ); + solidMaterialName = getConstitutiveName< SolidBase >( subRegion ); } ); } } ); @@ -784,17 +784,17 @@ void SolidMechanicsMPM::initialize( NodeManager & nodeManager, SolidBase & constitutiveRelation = getConstitutiveModel< SolidBase >( subRegion, solidMaterialName ); arrayView2d< real64 const > const particlePosition = subRegion.getParticleCenter(); arrayView2d< real64 const > const constitutiveDensity = constitutiveRelation.getDensity(); - arrayView1d< real64 > const particleDensity = subRegion.getField< fields::mpm::particleDensity >(); + arrayView1d< real64 > const particleDensity = subRegion.getField< mpm::particleDensity >(); arrayView1d< real64 const > const particleVolume = subRegion.getParticleVolume(); arrayView3d< real64 const > const particleRVectors = subRegion.getParticleRVectors(); - arrayView1d< real64 > const particleMass = subRegion.getField< fields::mpm::particleMass >(); - arrayView3d< real64 > const particleDeformationGradient = subRegion.getField< fields::mpm::particleDeformationGradient >(); - arrayView3d< real64 > const particleFDot = subRegion.getField< fields::mpm::particleFDot >(); - arrayView3d< real64 > const particleVelocityGradient = subRegion.getField< fields::mpm::particleVelocityGradient >(); - arrayView1d< real64 > const particleInitialVolume = subRegion.getField< fields::mpm::particleInitialVolume >(); - arrayView3d< real64 > const particleInitialRVectors = subRegion.getField< fields::mpm::particleInitialRVectors >(); - arrayView3d< real64 > const particleSphF = subRegion.getField< fields::mpm::particleSphF >(); - arrayView2d< real64 > const particleReferencePosition = subRegion.getField< fields::mpm::particleReferencePosition >(); + arrayView1d< real64 > const particleMass = subRegion.getField< mpm::particleMass >(); + arrayView3d< real64 > const particleDeformationGradient = subRegion.getField< mpm::particleDeformationGradient >(); + arrayView3d< real64 > const particleFDot = subRegion.getField< mpm::particleFDot >(); + arrayView3d< real64 > const particleVelocityGradient = subRegion.getField< mpm::particleVelocityGradient >(); + arrayView1d< real64 > const particleInitialVolume = subRegion.getField< mpm::particleInitialVolume >(); + arrayView3d< real64 > const particleInitialRVectors = subRegion.getField< mpm::particleInitialRVectors >(); + arrayView3d< real64 > const particleSphF = subRegion.getField< mpm::particleSphF >(); + arrayView2d< real64 > const particleReferencePosition = subRegion.getField< mpm::particleReferencePosition >(); // Set reference position, volume and R-vectors for( int p=0; p const particleVolume = subRegion.getParticleVolume(); arrayView1d< int const > const particleGroup = subRegion.getParticleGroup(); - arrayView2d< real64 const > const particleDamageGradient = subRegion.getField< fields::mpm::particleDamageGradient >(); + arrayView2d< real64 const > const particleDamageGradient = subRegion.getField< mpm::particleDamageGradient >(); // Get views to mapping arrays int const numberOfVerticesPerParticle = subRegion.numberOfVerticesPerParticle(); @@ -1979,7 +1979,7 @@ void SolidMechanicsMPM::setParticlesConstitutiveNames( ParticleSubRegionBase & s setSizedFromParent( 0 ); string & solidMaterialName = subRegion.getReference< string >( viewKeyStruct::solidMaterialNamesString() ); - solidMaterialName = PhysicsSolverBase::getConstitutiveName< SolidBase >( subRegion ); + solidMaterialName = getConstitutiveName< SolidBase >( subRegion ); GEOS_ERROR_IF( solidMaterialName.empty(), GEOS_FMT( "SolidBase model not found on subregion {}", subRegion.getName() ) ); } @@ -2455,7 +2455,7 @@ void SolidMechanicsMPM::computeDamageFieldGradient( ParticleManager & particleMa // Get particle position and damage field gradient arrayView2d< real64 const > const particlePosition = subRegion.getParticleCenter(); - arrayView2d< real64 > const particleDamageGradient = subRegion.getField< fields::mpm::particleDamageGradient >(); + arrayView2d< real64 > const particleDamageGradient = subRegion.getField< mpm::particleDamageGradient >(); // Loop over neighbors SortedArrayView< localIndex const > const activeParticleIndices = subRegion.activeParticleIndices(); @@ -2543,7 +2543,7 @@ void SolidMechanicsMPM::projectDamageFieldGradientToGrid( ParticleManager & part particleManager.forParticleSubRegions( [&]( ParticleSubRegion & subRegion ) { // Get particle fields - arrayView2d< real64 const > const particleDamageGradient = subRegion.getField< fields::mpm::particleDamageGradient >(); + arrayView2d< real64 const > const particleDamageGradient = subRegion.getField< mpm::particleDamageGradient >(); // Get nodes this particle maps to arrayView2d< localIndex const > const mappedNodes = m_mappedNodes[subRegionIndex]; @@ -2579,9 +2579,9 @@ void SolidMechanicsMPM::updateDeformationGradient( real64 dt, particleManager.forParticleSubRegions( [&]( ParticleSubRegion & subRegion ) { // Get fields - arrayView3d< real64 > const particleDeformationGradient = subRegion.getField< fields::mpm::particleDeformationGradient >(); - arrayView3d< real64 > const particleFDot = subRegion.getField< fields::mpm::particleFDot >(); - arrayView3d< real64 const > const particleVelocityGradient = subRegion.getField< fields::mpm::particleVelocityGradient >(); + arrayView3d< real64 > const particleDeformationGradient = subRegion.getField< mpm::particleDeformationGradient >(); + arrayView3d< real64 > const particleFDot = subRegion.getField< mpm::particleFDot >(); + arrayView3d< real64 const > const particleVelocityGradient = subRegion.getField< mpm::particleVelocityGradient >(); // Update F SortedArrayView< localIndex const > const activeParticleIndices = subRegion.activeParticleIndices(); @@ -2631,10 +2631,10 @@ void SolidMechanicsMPM::updateStress( real64 dt, SolidBase & solid = getConstitutiveModel< SolidBase >( subRegion, solidMaterialName ); // Get particle kinematic fields that are fed into constitutive model - arrayView3d< real64 const > const particleDeformationGradient = subRegion.getField< fields::mpm::particleDeformationGradient >(); - arrayView3d< real64 const > const particleFDot = subRegion.getField< fields::mpm::particleFDot >(); - arrayView3d< real64 const > const particleVelocityGradient = subRegion.getField< fields::mpm::particleVelocityGradient >(); - arrayView2d< real64 > const particleStress = subRegion.getField< fields::mpm::particleStress >(); + arrayView3d< real64 const > const particleDeformationGradient = subRegion.getField< mpm::particleDeformationGradient >(); + arrayView3d< real64 const > const particleFDot = subRegion.getField< mpm::particleFDot >(); + arrayView3d< real64 const > const particleVelocityGradient = subRegion.getField< mpm::particleVelocityGradient >(); + arrayView2d< real64 > const particleStress = subRegion.getField< mpm::particleStress >(); // Call constitutive model ConstitutivePassThruMPM< SolidBase >::execute( solid, [&] ( auto & castedSolid ) @@ -2660,13 +2660,13 @@ void SolidMechanicsMPM::particleKinematicUpdate( ParticleManager & particleManag // Get particle fields arrayView1d< globalIndex const > const particleID = subRegion.getParticleID(); arrayView1d< real64 > const particleVolume = subRegion.getParticleVolume(); - arrayView1d< int > const isBad = subRegion.getField< fields::mpm::isBad >(); - arrayView1d< real64 const > const particleInitialVolume = subRegion.getField< fields::mpm::particleInitialVolume >(); - arrayView1d< real64 > const particleDensity = subRegion.getField< fields::mpm::particleDensity >(); - arrayView1d< real64 const > const particleMass = subRegion.getField< fields::mpm::particleMass >(); + arrayView1d< int > const isBad = subRegion.getField< mpm::isBad >(); + arrayView1d< real64 const > const particleInitialVolume = subRegion.getField< mpm::particleInitialVolume >(); + arrayView1d< real64 > const particleDensity = subRegion.getField< mpm::particleDensity >(); + arrayView1d< real64 const > const particleMass = subRegion.getField< mpm::particleMass >(); arrayView3d< real64 > const particleRVectors = subRegion.getParticleRVectors(); - arrayView3d< real64 const > const particleInitialRVectors = subRegion.getField< fields::mpm::particleInitialRVectors >(); - arrayView3d< real64 const > const particleDeformationGradient = subRegion.getField< fields::mpm::particleDeformationGradient >(); + arrayView3d< real64 const > const particleInitialRVectors = subRegion.getField< mpm::particleInitialRVectors >(); + arrayView3d< real64 const > const particleDeformationGradient = subRegion.getField< mpm::particleDeformationGradient >(); // Update volume and r-vectors SortedArrayView< localIndex const > const activeParticleIndices = subRegion.activeParticleIndices(); @@ -2709,10 +2709,10 @@ void SolidMechanicsMPM::computeAndWriteBoxAverage( const real64 dt, particleManager.forParticleSubRegions( [&]( ParticleSubRegion & subRegion ) { // Get fields - arrayView1d< real64 > const particleMass = subRegion.getField< fields::mpm::particleMass >(); + arrayView1d< real64 > const particleMass = subRegion.getField< mpm::particleMass >(); arrayView1d< real64 > const particleVolume = subRegion.getParticleVolume(); - arrayView1d< real64 > const particleInitialVolume = subRegion.getField< fields::mpm::particleInitialVolume >(); - arrayView2d< real64 > const particleStress = subRegion.getField< fields::mpm::particleStress >(); + arrayView1d< real64 > const particleInitialVolume = subRegion.getField< mpm::particleInitialVolume >(); + arrayView2d< real64 > const particleStress = subRegion.getField< mpm::particleStress >(); arrayView1d< real64 > const particleDamage = subRegion.getParticleDamage(); // Accumulate values @@ -2873,13 +2873,13 @@ void SolidMechanicsMPM::particleToGrid( ParticleManager & particleManager, // Particle fields arrayView2d< real64 const > const particlePosition = subRegion.getParticleCenter(); arrayView2d< real64 const > const particleVelocity = subRegion.getParticleVelocity(); - arrayView1d< real64 const > const particleMass = subRegion.getField< fields::mpm::particleMass >(); + arrayView1d< real64 const > const particleMass = subRegion.getField< mpm::particleMass >(); arrayView1d< real64 const > const particleVolume = subRegion.getParticleVolume(); arrayView1d< int const > const particleGroup = subRegion.getParticleGroup(); arrayView1d< int const > const particleSurfaceFlag = subRegion.getParticleSurfaceFlag(); - arrayView2d< real64 const > const particleStress = subRegion.getField< fields::mpm::particleStress >(); - arrayView2d< real64 const > const particleDamageGradient = subRegion.getField< fields::mpm::particleDamageGradient >(); + arrayView2d< real64 const > const particleStress = subRegion.getField< mpm::particleStress >(); + arrayView2d< real64 const > const particleDamageGradient = subRegion.getField< mpm::particleDamageGradient >(); arrayView1d< real64 const > const particleDamage = subRegion.getParticleDamage(); // Grid fields @@ -3142,8 +3142,8 @@ void SolidMechanicsMPM::gridToParticle( real64 dt, arrayView1d< int const > const particleGroup = subRegion.getParticleGroup(); // Registered by MPM solver - arrayView3d< real64 > const particleVelocityGradient = subRegion.getField< fields::mpm::particleVelocityGradient >(); - arrayView2d< real64 const > const particleDamageGradient = subRegion.getField< fields::mpm::particleDamageGradient >(); + arrayView3d< real64 > const particleVelocityGradient = subRegion.getField< mpm::particleVelocityGradient >(); + arrayView2d< real64 const > const particleDamageGradient = subRegion.getField< mpm::particleDamageGradient >(); // Get views to mapping arrays int const numberOfVerticesPerParticle = subRegion.numberOfVerticesPerParticle(); @@ -3254,7 +3254,7 @@ real64 SolidMechanicsMPM::getStableTimeStep( ParticleManager & particleManager ) // For the time being we restrict our attention to elastic isotropic solids. //TODO: Have all constitutive models automatically calculate a wave speed. ElasticIsotropic & constitutiveRelation = getConstitutiveModel< ElasticIsotropic >( subRegion, solidMaterialName ); - arrayView1d< real64 const > const rho = subRegion.getField< fields::mpm::particleDensity >(); + arrayView1d< real64 const > const rho = subRegion.getField< mpm::particleDensity >(); arrayView1d< real64 const > const shearModulus = constitutiveRelation.shearModulus(); arrayView1d< real64 const > const bulkModulus = constitutiveRelation.bulkModulus(); SortedArrayView< localIndex const > const activeParticleIndices = subRegion.activeParticleIndices(); @@ -3286,7 +3286,7 @@ void SolidMechanicsMPM::deleteBadParticles( ParticleManager & particleManager ) } ); // Get relevant particle arrays - arrayView1d< int > const isBad = subRegion.getField< fields::mpm::isBad >(); + arrayView1d< int > const isBad = subRegion.getField< mpm::isBad >(); // Initialize the set of particles to delete std::set< localIndex > indicesToErase; @@ -3372,7 +3372,7 @@ void SolidMechanicsMPM::computeSurfaceFlags( ParticleManager & particleManager ) // Get particle position and surface flags arrayView2d< real64 const > const particlePosition = subRegion.getParticleCenter(); - arrayView1d< int > const particleSurfaceFlag = subRegion.getField< fields::mpm::particleSurfaceFlag >(); + arrayView1d< int > const particleSurfaceFlag = subRegion.getField< mpm::particleSurfaceFlag >(); // Loop over neighbors SortedArrayView< localIndex const > const activeParticleIndices = subRegion.activeParticleIndices(); @@ -3447,8 +3447,8 @@ void SolidMechanicsMPM::computeSphF( ParticleManager & particleManager ) // Get particle position and sphF arrayView2d< real64 const > const particlePosition = subRegion.getParticleCenter(); - arrayView2d< real64 > const particleReferencePosition = subRegion.getField< fields::mpm::particleReferencePosition >(); - arrayView3d< real64 > const particleSphF = subRegion.getField< fields::mpm::particleSphF >(); + arrayView2d< real64 > const particleReferencePosition = subRegion.getField< mpm::particleReferencePosition >(); + arrayView3d< real64 > const particleSphF = subRegion.getField< mpm::particleSphF >(); // Loop over neighbors SortedArrayView< localIndex const > const activeParticleIndices = subRegion.activeParticleIndices(); @@ -3525,13 +3525,13 @@ void SolidMechanicsMPM::computeSphF( ParticleManager & particleManager ) // // If we're at a surface, induce corrective deformation normal to the surface // particleManager.forParticleSubRegions( [&]( ParticleSubRegion & subRegion ) // { -// arrayView1d< real64 > const particleOverlap = subRegion.getField< fields::mpm::particleOverlap >(); +// arrayView1d< real64 > const particleOverlap = subRegion.getField< mpm::particleOverlap >(); // particleOverlap.zero(); -// arrayView2d< real64 const > const particleDamageGradient = subRegion.getField< fields::mpm::particleDamageGradient >(); -// arrayView3d< real64 > const particleVelocityGradient = subRegion.getField< fields::mpm::particleVelocityGradient >(); +// arrayView2d< real64 const > const particleDamageGradient = subRegion.getField< mpm::particleDamageGradient >(); +// arrayView3d< real64 > const particleVelocityGradient = subRegion.getField< mpm::particleVelocityGradient >(); // particleVelocityGradient.zero(); -// arrayView3d< real64 const > const particleDeformationGradient = subRegion.getField< fields::mpm::particleDeformationGradient >(); -// arrayView3d< real64 const > const particleSphF = subRegion.getField< fields::mpm::particleSphF >(); +// arrayView3d< real64 const > const particleDeformationGradient = subRegion.getField< mpm::particleDeformationGradient >(); +// arrayView3d< real64 const > const particleSphF = subRegion.getField< mpm::particleSphF >(); // SortedArrayView< localIndex const > const activeParticleIndices = subRegion.activeParticleIndices(); // forAll< serialPolicy >( activeParticleIndices.size(), [=] GEOS_HOST ( localIndex const pp ) @@ -3650,7 +3650,7 @@ void SolidMechanicsMPM::flagOutOfRangeParticles( ParticleManager & particleManag // Get particle fields SortedArrayView< localIndex const > const activeParticleIndices = subRegion.activeParticleIndices(); arrayView2d< real64 const > const particlePosition = subRegion.getParticleCenter(); - arrayView1d< int > const isBad = subRegion.getField< fields::mpm::isBad >(); + arrayView1d< int > const isBad = subRegion.getField< mpm::isBad >(); ParticleType particleType = subRegion.getParticleType(); // Define tolerance @@ -3729,8 +3729,8 @@ void SolidMechanicsMPM::computeRVectors( ParticleManager & particleManager ) { SortedArrayView< localIndex const > const activeParticleIndices = subRegion.activeParticleIndices(); arrayView3d< real64 > const particleRVectors = subRegion.getParticleRVectors(); - arrayView3d< real64 const > const particleInitialRVectors = subRegion.getField< fields::mpm::particleInitialRVectors >(); - arrayView3d< real64 const > const particleDeformationGradient = subRegion.getField< fields::mpm::particleDeformationGradient >(); + arrayView3d< real64 const > const particleInitialRVectors = subRegion.getField< mpm::particleInitialRVectors >(); + arrayView3d< real64 const > const particleDeformationGradient = subRegion.getField< mpm::particleDeformationGradient >(); forAll< serialPolicy >( activeParticleIndices.size(), [=] GEOS_HOST_DEVICE ( localIndex const pp ) { localIndex const p = activeParticleIndices[pp]; diff --git a/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsStatistics.cpp b/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsStatistics.cpp index 12f47f2b3e3..1fe4e5611b8 100644 --- a/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsStatistics.cpp +++ b/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsStatistics.cpp @@ -33,7 +33,6 @@ namespace geos { -using namespace constitutive; using namespace dataRepository; using namespace fields; diff --git a/src/coreComponents/physicsSolvers/solidMechanics/contact/ContactSolverBase.cpp b/src/coreComponents/physicsSolvers/solidMechanics/contact/ContactSolverBase.cpp index dd1e43a6f4c..5ab2edf2a8c 100644 --- a/src/coreComponents/physicsSolvers/solidMechanics/contact/ContactSolverBase.cpp +++ b/src/coreComponents/physicsSolvers/solidMechanics/contact/ContactSolverBase.cpp @@ -64,15 +64,13 @@ void ContactSolverBase::registerDataOnMesh( dataRepository::Group & meshBodies ) setFractureRegions( meshBodies ); + string const labels[3] = { "normal", "tangent1", "tangent2" }; + string const labelsTangent[2] = { "tangent1", "tangent2" }; + forFractureRegionOnMeshTargets( meshBodies, [&] ( SurfaceElementRegion & fractureRegion ) { - string const labels[3] = { "normal", "tangent1", "tangent2" }; - string const labelsTangent[2] = { "tangent1", "tangent2" }; - fractureRegion.forElementSubRegions< SurfaceElementSubRegion >( [&]( SurfaceElementSubRegion & subRegion ) { - setConstitutiveNamesCallSuper( subRegion ); - subRegion.registerField< contact::dispJump >( getName() ). setDimLabels( 1, labels ). reference().resizeDimension< 1 >( 3 ); @@ -136,7 +134,7 @@ void ContactSolverBase::computeFractureStateStatistics( MeshLevel const & mesh, globalIndex & numSlip, globalIndex & numOpen ) const { - using namespace fields::contact; + using namespace contact; ElementRegionManager const & elemManager = mesh.getElemManager(); @@ -254,15 +252,9 @@ void ContactSolverBase::setConstitutiveNamesCallSuper( ElementSubRegionBase & su } else if( dynamic_cast< SurfaceElementSubRegion * >( &subRegion ) ) { - subRegion.registerWrapper< string >( viewKeyStruct::frictionLawNameString() ). - setPlotLevel( PlotLevel::NOPLOT ). - setRestartFlags( RestartFlags::NO_WRITE ). - setSizedFromParent( 0 ); - - string & frictionLawName = subRegion.getReference< string >( viewKeyStruct::frictionLawNameString() ); - frictionLawName = PhysicsSolverBase::getConstitutiveName< FrictionBase >( subRegion ); - GEOS_ERROR_IF( frictionLawName.empty(), GEOS_FMT( "{}: FrictionBase model not found on subregion {}", - getDataContext(), subRegion.getDataContext() ) ); + PhysicsSolverBase::setConstitutiveNamesCallSuper( subRegion ); + + setConstitutiveName< FrictionBase >( subRegion, viewKeyStruct::frictionLawNameString()); } } diff --git a/src/coreComponents/physicsSolvers/solidMechanics/contact/SolidMechanicsAugmentedLagrangianContact.cpp b/src/coreComponents/physicsSolvers/solidMechanics/contact/SolidMechanicsAugmentedLagrangianContact.cpp index 58f96fbee28..eac36c47dfc 100644 --- a/src/coreComponents/physicsSolvers/solidMechanics/contact/SolidMechanicsAugmentedLagrangianContact.cpp +++ b/src/coreComponents/physicsSolvers/solidMechanics/contact/SolidMechanicsAugmentedLagrangianContact.cpp @@ -107,7 +107,6 @@ SolidMechanicsAugmentedLagrangianContact::~SolidMechanicsAugmentedLagrangianCont void SolidMechanicsAugmentedLagrangianContact::registerDataOnMesh( dataRepository::Group & meshBodies ) { - ContactSolverBase::registerDataOnMesh( meshBodies ); forDiscretizationOnMeshTargets( meshBodies, [&] ( string const &, @@ -133,31 +132,31 @@ void SolidMechanicsAugmentedLagrangianContact::registerDataOnMesh( dataRepositor reference().resizeDimension< 1 >( 3 ); // Register the rotation matrix - subRegion.registerField< contact::rotationMatrix >( this->getName() ). + subRegion.registerField< contact::rotationMatrix >( getName() ). reference().resizeDimension< 1, 2 >( 3, 3 ); // Register the penalty coefficients for the iterative procedure - subRegion.registerField< contact::iterativePenalty >( this->getName() ). + subRegion.registerField< contact::iterativePenalty >( getName() ). reference().resizeDimension< 1 >( 5 ); subRegion.registerWrapper< array1d< real64 > >( viewKeyStruct::normalTractionToleranceString() ). setPlotLevel( PlotLevel::NOPLOT ). - setRegisteringObjects( this->getName()). + setRegisteringObjects( getName()). setDescription( "An array that holds the normal traction tolerance." ); subRegion.registerWrapper< array1d< real64 > >( viewKeyStruct::normalDisplacementToleranceString() ). setPlotLevel( PlotLevel::NOPLOT ). - setRegisteringObjects( this->getName()). + setRegisteringObjects( getName()). setDescription( "An array that holds the normal displacement tolerance." ); subRegion.registerWrapper< array1d< real64 > >( viewKeyStruct::slidingToleranceString() ). setPlotLevel( PlotLevel::NOPLOT ). - setRegisteringObjects( this->getName()). + setRegisteringObjects( getName()). setDescription( "An array that holds the sliding tolerance." ); subRegion.registerWrapper< array2d< real64 > >( viewKeyStruct::dispJumpUpdPenaltyString() ). setPlotLevel( PlotLevel::NOPLOT ). - setRegisteringObjects( this->getName()). + setRegisteringObjects( getName()). setDescription( "An array that stores the displacement jumps used to update the penalty coefficients." ). reference().resizeDimension< 1 >( 3 ); @@ -424,12 +423,12 @@ void SolidMechanicsAugmentedLagrangianContact::assembleSystem( real64 const time real64 maxTraction = finiteElement:: interfaceBasedKernelApplication < parallelDevicePolicy< >, - constitutive::CoulombFriction >( mesh, - fractureRegionName, - faceElementList, - subRegionFE, - viewKeyStruct::frictionLawNameString(), - kernelFactory ); + CoulombFriction >( mesh, + fractureRegionName, + faceElementList, + subRegionFE, + viewKeyStruct::frictionLawNameString(), + kernelFactory ); GEOS_UNUSED_VAR( maxTraction ); @@ -448,12 +447,12 @@ void SolidMechanicsAugmentedLagrangianContact::assembleSystem( real64 const time real64 maxTraction = finiteElement:: interfaceBasedKernelApplication < parallelDevicePolicy< >, - constitutive::CoulombFriction >( mesh, - fractureRegionName, - faceElementList, - subRegionFE, - viewKeyStruct::frictionLawNameString(), - kernelFactory ); + CoulombFriction >( mesh, + fractureRegionName, + faceElementList, + subRegionFE, + viewKeyStruct::frictionLawNameString(), + kernelFactory ); GEOS_UNUSED_VAR( maxTraction ); } @@ -479,12 +478,12 @@ void SolidMechanicsAugmentedLagrangianContact::assembleSystem( real64 const time real64 maxTraction = finiteElement:: interfaceBasedKernelApplication < parallelDevicePolicy< >, - constitutive::CoulombFriction >( mesh, - fractureRegionName, - faceElementList, - subRegionFE, - viewKeyStruct::frictionLawNameString(), - kernelFactory ); + CoulombFriction >( mesh, + fractureRegionName, + faceElementList, + subRegionFE, + viewKeyStruct::frictionLawNameString(), + kernelFactory ); GEOS_UNUSED_VAR( maxTraction ); @@ -503,12 +502,12 @@ void SolidMechanicsAugmentedLagrangianContact::assembleSystem( real64 const time real64 maxTraction = finiteElement:: interfaceBasedKernelApplication < parallelDevicePolicy< >, - constitutive::CoulombFriction >( mesh, - fractureRegionName, - faceElementList, - subRegionFE, - viewKeyStruct::frictionLawNameString(), - kernelFactory ); + CoulombFriction >( mesh, + fractureRegionName, + faceElementList, + subRegionFE, + viewKeyStruct::frictionLawNameString(), + kernelFactory ); GEOS_UNUSED_VAR( maxTraction ); } @@ -545,7 +544,7 @@ void SolidMechanicsAugmentedLagrangianContact::assembleSystem( real64 const time real64 maxTraction = finiteElement:: regionBasedKernelApplication < parallelDevicePolicy< >, - constitutive::ElasticIsotropic, + ElasticIsotropic, CellElementSubRegion >( mesh, regionNames, getDiscretizationName(), @@ -770,12 +769,12 @@ void SolidMechanicsAugmentedLagrangianContact::applySystemSolution( DofManager c real64 maxTraction = finiteElement:: interfaceBasedKernelApplication < parallelDevicePolicy< >, - constitutive::NullModel >( mesh, - fractureRegionName, - faceElementList, - subRegionFE, - "", - kernelFactory ); + NullModel >( mesh, + fractureRegionName, + faceElementList, + subRegionFE, + "", + kernelFactory ); GEOS_UNUSED_VAR( maxTraction ); diff --git a/src/coreComponents/physicsSolvers/solidMechanics/contact/SolidMechanicsEmbeddedFractures.cpp b/src/coreComponents/physicsSolvers/solidMechanics/contact/SolidMechanicsEmbeddedFractures.cpp index b5f1ac23d62..a5d0ade51fe 100644 --- a/src/coreComponents/physicsSolvers/solidMechanics/contact/SolidMechanicsEmbeddedFractures.cpp +++ b/src/coreComponents/physicsSolvers/solidMechanics/contact/SolidMechanicsEmbeddedFractures.cpp @@ -112,7 +112,7 @@ void SolidMechanicsEmbeddedFractures::registerDataOnMesh( dataRepository::Group void SolidMechanicsEmbeddedFractures::initializePostInitialConditionsPreSubGroups() { - SolidMechanicsLagrangianFEM::initializePostInitialConditionsPreSubGroups(); + ContactSolverBase::initializePostInitialConditionsPreSubGroups(); updateState( this->getGroupByPath< DomainPartition >( "/Problem/domain" ) ); } diff --git a/src/coreComponents/physicsSolvers/solidMechanics/contact/SolidMechanicsLagrangeContact.cpp b/src/coreComponents/physicsSolvers/solidMechanics/contact/SolidMechanicsLagrangeContact.cpp index 9d5a7b1f025..3e66fc73242 100644 --- a/src/coreComponents/physicsSolvers/solidMechanics/contact/SolidMechanicsLagrangeContact.cpp +++ b/src/coreComponents/physicsSolvers/solidMechanics/contact/SolidMechanicsLagrangeContact.cpp @@ -104,38 +104,38 @@ void SolidMechanicsLagrangeContact::registerDataOnMesh( Group & meshBodies ) { fractureRegion.forElementSubRegions< SurfaceElementSubRegion >( [&]( SurfaceElementSubRegion & subRegion ) { + subRegion.registerField< contact::deltaTraction >( getName() ). + reference().resizeDimension< 1 >( 3 ); + subRegion.registerWrapper< array3d< real64 > >( viewKeyStruct::rotationMatrixString() ). setPlotLevel( PlotLevel::NOPLOT ). - setRegisteringObjects( this->getName()). + setRegisteringObjects( getName()). setDescription( "An array that holds the rotation matrices on the fracture." ). reference().resizeDimension< 1, 2 >( 3, 3 ); - subRegion.registerField< contact::deltaTraction >( getName() ). - reference().resizeDimension< 1 >( 3 ); - subRegion.registerWrapper< array1d< real64 > >( viewKeyStruct::normalTractionToleranceString() ). setPlotLevel( PlotLevel::NOPLOT ). - setRegisteringObjects( this->getName()). + setRegisteringObjects( getName()). setDescription( "An array that holds the normal traction tolerance." ); subRegion.registerWrapper< array1d< real64 > >( viewKeyStruct::normalDisplacementToleranceString() ). setPlotLevel( PlotLevel::NOPLOT ). - setRegisteringObjects( this->getName()). + setRegisteringObjects( getName()). setDescription( "An array that holds the normal displacement tolerance." ); subRegion.registerWrapper< array1d< real64 > >( viewKeyStruct::slidingToleranceString() ). setPlotLevel( PlotLevel::NOPLOT ). - setRegisteringObjects( this->getName()). + setRegisteringObjects( getName()). setDescription( "An array that holds the sliding tolerance." ); // Needed just because SurfaceGenerator initialize the field "pressure" (NEEDED!!!) // It is used in "TwoPointFluxApproximation.cpp", called by "SurfaceGenerator.cpp" subRegion.registerField< flow::pressure >( getName() ). setPlotLevel( PlotLevel::NOPLOT ). - setRegisteringObjects( this->getName()); + setRegisteringObjects( getName()); subRegion.registerField< flow::pressure_n >( getName() ). setPlotLevel( PlotLevel::NOPLOT ). - setRegisteringObjects( this->getName()); + setRegisteringObjects( getName()); } ); @@ -148,7 +148,7 @@ void SolidMechanicsLagrangeContact::registerDataOnMesh( Group & meshBodies ) faceManager.registerWrapper< array1d< real64 > >( viewKeyStruct::transMultiplierString() ). setApplyDefaultValue( 1.0 ). setPlotLevel( PlotLevel::LEVEL_0 ). - setRegisteringObjects( this->getName() ). + setRegisteringObjects( getName() ). setDescription( "An array that holds the permeability transmissibility multipliers" ); } ); @@ -446,7 +446,7 @@ void SolidMechanicsLagrangeContact::computeTolerances( DomainPartition & domain GEOS_LOG_LEVEL_INFO_RANK_0( logInfo::Configuration, GEOS_FMT( "{}: normal displacement tolerance = [{}, {}], sliding tolerance = [{}, {}], normal traction tolerance = [{}, {}]", - this->getName(), minNormalDisplacementTolerance, maxNormalDisplacementTolerance, + getName(), minNormalDisplacementTolerance, maxNormalDisplacementTolerance, minSlidingTolerance, maxSlidingTolerance, minNormalTractionTolerance, maxNormalTractionTolerance ) ); } @@ -2191,7 +2191,7 @@ bool SolidMechanicsLagrangeContact::resetConfigurationToDefault( DomainPartition { GEOS_MARK_FUNCTION; - using namespace fields::contact; + using namespace contact; forDiscretizationOnMeshTargets( domain.getMeshBodies(), [&] ( string const &, MeshLevel & mesh, @@ -2222,7 +2222,7 @@ bool SolidMechanicsLagrangeContact::updateConfiguration( DomainPartition & domai { GEOS_MARK_FUNCTION; - using namespace fields::contact; + using namespace contact; real64 changedArea = 0; real64 totalArea = 0; diff --git a/src/coreComponents/physicsSolvers/solidMechanics/contact/SolidMechanicsLagrangeContactBubbleStab.cpp b/src/coreComponents/physicsSolvers/solidMechanics/contact/SolidMechanicsLagrangeContactBubbleStab.cpp index de984732471..4455720b769 100644 --- a/src/coreComponents/physicsSolvers/solidMechanics/contact/SolidMechanicsLagrangeContactBubbleStab.cpp +++ b/src/coreComponents/physicsSolvers/solidMechanics/contact/SolidMechanicsLagrangeContactBubbleStab.cpp @@ -365,7 +365,7 @@ void SolidMechanicsLagrangeContactBubbleStab::assembleStabilization( real64 cons real64 maxTraction = finiteElement:: regionBasedKernelApplication < parallelDevicePolicy< >, - constitutive::ElasticIsotropic, + ElasticIsotropic, CellElementSubRegion >( mesh, regionNames, getDiscretizationName(), @@ -416,12 +416,12 @@ void SolidMechanicsLagrangeContactBubbleStab::assembleContact( real64 const dt, real64 maxTraction = finiteElement:: interfaceBasedKernelApplication < parallelDevicePolicy< >, - constitutive::FrictionBase >( mesh, - fractureRegionName, - faceElementList, - subRegionFE, - viewKeyStruct::frictionLawNameString(), - kernelFactory ); + FrictionBase >( mesh, + fractureRegionName, + faceElementList, + subRegionFE, + viewKeyStruct::frictionLawNameString(), + kernelFactory ); GEOS_UNUSED_VAR( maxTraction ); } ); @@ -587,12 +587,12 @@ void SolidMechanicsLagrangeContactBubbleStab::applySystemSolution( DofManager co real64 maxTraction = finiteElement:: interfaceBasedKernelApplication < parallelDevicePolicy< >, - constitutive::NullModel >( mesh, - fractureRegionName, - faceElementList, - subRegionFE, - "", - kernelFactory ); + NullModel >( mesh, + fractureRegionName, + faceElementList, + subRegionFE, + "", + kernelFactory ); GEOS_UNUSED_VAR( maxTraction ); diff --git a/src/coreComponents/physicsSolvers/solidMechanics/contact/SolidMechanicsPenaltyContact.cpp b/src/coreComponents/physicsSolvers/solidMechanics/contact/SolidMechanicsPenaltyContact.cpp index 04d82d10cb6..3c50e726e03 100644 --- a/src/coreComponents/physicsSolvers/solidMechanics/contact/SolidMechanicsPenaltyContact.cpp +++ b/src/coreComponents/physicsSolvers/solidMechanics/contact/SolidMechanicsPenaltyContact.cpp @@ -32,10 +32,8 @@ namespace geos { -using namespace constitutive; using namespace dataRepository; using namespace fields; -using namespace finiteElement; SolidMechanicsPenaltyContact::SolidMechanicsPenaltyContact( const string & name, Group * const parent ): diff --git a/src/coreComponents/unitTests/constitutiveTests/testCO2BrinePVTModels.cpp b/src/coreComponents/unitTests/constitutiveTests/testCO2BrinePVTModels.cpp index a686c917319..079619cfd8a 100644 --- a/src/coreComponents/unitTests/constitutiveTests/testCO2BrinePVTModels.cpp +++ b/src/coreComponents/unitTests/constitutiveTests/testCO2BrinePVTModels.cpp @@ -220,8 +220,7 @@ void testNumericalDerivatives( FLASH_WRAPPER const & flashModelWrapper, real64 const relTol, real64 const absTol = std::numeric_limits< real64 >::epsilon() ) { - using namespace multifluid; - using Deriv = multifluid::DerivativeOffset; + using Deriv = DerivativeOffset; integer constexpr numPhase = 2; integer constexpr numComp = 2;