diff --git a/src/coreComponents/physicsSolvers/contact/SolidMechanicsEmbeddedFractures.cpp b/src/coreComponents/physicsSolvers/contact/SolidMechanicsEmbeddedFractures.cpp index 90f33a650e0..c1345d2a8be 100644 --- a/src/coreComponents/physicsSolvers/contact/SolidMechanicsEmbeddedFractures.cpp +++ b/src/coreComponents/physicsSolvers/contact/SolidMechanicsEmbeddedFractures.cpp @@ -64,22 +64,34 @@ SolidMechanicsEmbeddedFractures::~SolidMechanicsEmbeddedFractures() void SolidMechanicsEmbeddedFractures::postInputInitialization() { - SolidMechanicsLagrangianFEM::postInputInitialization(); - - LinearSolverParameters & linParams = m_linearSolverParameters.get(); + ContactSolverBase::postInputInitialization(); if( m_useStaticCondensation ) { - linParams.dofsPerNode = 3; - linParams.isSymmetric = true; - linParams.amg.separateComponents = true; + // configure AMG + LinearSolverParameters & linearSolverParameters = m_linearSolverParameters.get(); + linearSolverParameters.dofsPerNode = 3; + linearSolverParameters.isSymmetric = true; + linearSolverParameters.amg.separateComponents = true; } else { - linParams.mgr.strategy = LinearSolverParameters::MGR::StrategyType::solidMechanicsEmbeddedFractures; + setMGRStrategy(); } } +void SolidMechanicsEmbeddedFractures::setMGRStrategy() +{ + LinearSolverParameters & linearSolverParameters = m_linearSolverParameters.get(); + + if( linearSolverParameters.preconditionerType != LinearSolverParameters::PreconditionerType::mgr ) + return; + + linearSolverParameters.mgr.strategy = LinearSolverParameters::MGR::StrategyType::solidMechanicsEmbeddedFractures; + GEOS_LOG_LEVEL_RANK_0( 1, GEOS_FMT( "{}: MGR strategy set to {}", getName(), + EnumStrings< LinearSolverParameters::MGR::StrategyType >::toString( linearSolverParameters.mgr.strategy ))); +} + void SolidMechanicsEmbeddedFractures::registerDataOnMesh( dataRepository::Group & meshBodies ) { ContactSolverBase::registerDataOnMesh( meshBodies ); diff --git a/src/coreComponents/physicsSolvers/contact/SolidMechanicsEmbeddedFractures.hpp b/src/coreComponents/physicsSolvers/contact/SolidMechanicsEmbeddedFractures.hpp index 669d9ce541b..2b1bf5ab491 100644 --- a/src/coreComponents/physicsSolvers/contact/SolidMechanicsEmbeddedFractures.hpp +++ b/src/coreComponents/physicsSolvers/contact/SolidMechanicsEmbeddedFractures.hpp @@ -127,6 +127,8 @@ class SolidMechanicsEmbeddedFractures : public ContactSolverBase virtual void postInputInitialization() override final; + void setMGRStrategy(); + private: void updateJump( DofManager const & dofManager, diff --git a/src/coreComponents/physicsSolvers/contact/SolidMechanicsLagrangeContact.cpp b/src/coreComponents/physicsSolvers/contact/SolidMechanicsLagrangeContact.cpp index bdb83a14ed6..72d54cd552a 100644 --- a/src/coreComponents/physicsSolvers/contact/SolidMechanicsLagrangeContact.cpp +++ b/src/coreComponents/physicsSolvers/contact/SolidMechanicsLagrangeContact.cpp @@ -73,12 +73,27 @@ SolidMechanicsLagrangeContact::SolidMechanicsLagrangeContact( const string & nam setDescription( "It be used to increase the scale of the stabilization entries. A value < 1.0 results in larger entries in the stabilization matrix." ); addLogLevel< logInfo::Configuration >(); +} + +void SolidMechanicsLagrangeContact::postInputInitialization() +{ + ContactSolverBase::postInputInitialization(); + + setMGRStrategy(); +} + +void SolidMechanicsLagrangeContact::setMGRStrategy() +{ + LinearSolverParameters & linearSolverParameters = m_linearSolverParameters.get(); + + if( linearSolverParameters.preconditionerType != LinearSolverParameters::PreconditionerType::mgr ) + return; - LinearSolverParameters & linSolParams = m_linearSolverParameters.get(); - linSolParams.mgr.strategy = LinearSolverParameters::MGR::StrategyType::lagrangianContactMechanics; - linSolParams.mgr.separateComponents = true; - linSolParams.mgr.displacementFieldName = solidMechanics::totalDisplacement::key(); - linSolParams.dofsPerNode = 3; + linearSolverParameters.mgr.strategy = LinearSolverParameters::MGR::StrategyType::lagrangianContactMechanics; + GEOS_LOG_LEVEL_RANK_0( 1, GEOS_FMT( "{}: MGR strategy set to {}", getName(), + EnumStrings< LinearSolverParameters::MGR::StrategyType >::toString( linearSolverParameters.mgr.strategy ))); + linearSolverParameters.mgr.separateComponents = true; + linearSolverParameters.mgr.displacementFieldName = solidMechanics::totalDisplacement::key(); } void SolidMechanicsLagrangeContact::registerDataOnMesh( Group & meshBodies ) diff --git a/src/coreComponents/physicsSolvers/contact/SolidMechanicsLagrangeContact.hpp b/src/coreComponents/physicsSolvers/contact/SolidMechanicsLagrangeContact.hpp index 1e7483cd6c3..3bf43c69a30 100644 --- a/src/coreComponents/physicsSolvers/contact/SolidMechanicsLagrangeContact.hpp +++ b/src/coreComponents/physicsSolvers/contact/SolidMechanicsLagrangeContact.hpp @@ -31,7 +31,6 @@ class NumericalMethodsManager; class SolidMechanicsLagrangeContact : public ContactSolverBase { public: - SolidMechanicsLagrangeContact( const string & name, Group * const parent ); @@ -179,6 +178,10 @@ class SolidMechanicsLagrangeContact : public ContactSolverBase DofManager const & dofManager, arrayView1d< real64 const > const & localRhs ); + virtual void postInputInitialization() override final; + + void setMGRStrategy(); + private: string m_stabilizationName; diff --git a/src/coreComponents/physicsSolvers/multiphysics/CompositionalMultiphaseReservoirAndWells.cpp b/src/coreComponents/physicsSolvers/multiphysics/CompositionalMultiphaseReservoirAndWells.cpp index 5853f513231..58ba100e0ea 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/CompositionalMultiphaseReservoirAndWells.cpp +++ b/src/coreComponents/physicsSolvers/multiphysics/CompositionalMultiphaseReservoirAndWells.cpp @@ -75,16 +75,23 @@ void CompositionalMultiphaseReservoirAndWells<>:: setMGRStrategy() { - if( flowSolver()->getLinearSolverParameters().mgr.strategy == LinearSolverParameters::MGR::StrategyType::compositionalMultiphaseHybridFVM ) + LinearSolverParameters & linearSolverParameters = m_linearSolverParameters.get(); + + if( linearSolverParameters.preconditionerType != LinearSolverParameters::PreconditionerType::mgr ) + return; + + if( dynamic_cast< CompositionalMultiphaseHybridFVM * >( flowSolver() ) ) { // add Reservoir - m_linearSolverParameters.get().mgr.strategy = LinearSolverParameters::MGR::StrategyType::compositionalMultiphaseReservoirHybridFVM; + linearSolverParameters.mgr.strategy = LinearSolverParameters::MGR::StrategyType::compositionalMultiphaseReservoirHybridFVM; } else { // add Reservoir - m_linearSolverParameters.get().mgr.strategy = LinearSolverParameters::MGR::StrategyType::compositionalMultiphaseReservoirFVM; + linearSolverParameters.mgr.strategy = LinearSolverParameters::MGR::StrategyType::compositionalMultiphaseReservoirFVM; } + GEOS_LOG_LEVEL_RANK_0( 1, GEOS_FMT( "{}: MGR strategy set to {}", getName(), + EnumStrings< LinearSolverParameters::MGR::StrategyType >::toString( linearSolverParameters.mgr.strategy ))); } template<> @@ -92,16 +99,23 @@ void CompositionalMultiphaseReservoirAndWells< MultiphasePoromechanics<> >:: setMGRStrategy() { + LinearSolverParameters & linearSolverParameters = m_linearSolverParameters.get(); + + if( linearSolverParameters.preconditionerType != LinearSolverParameters::PreconditionerType::mgr ) + return; + // flow solver here is indeed flow solver, not poromechanics solver - if( flowSolver()->getLinearSolverParameters().mgr.strategy == LinearSolverParameters::MGR::StrategyType::compositionalMultiphaseHybridFVM ) + if( dynamic_cast< CompositionalMultiphaseHybridFVM * >( flowSolver() ) ) { GEOS_ERROR( "The poromechanics MGR strategy for hybrid FVM is not implemented" ); } else { // add Reservoir - m_linearSolverParameters.get().mgr.strategy = LinearSolverParameters::MGR::StrategyType::multiphasePoromechanicsReservoirFVM; + linearSolverParameters.mgr.strategy = LinearSolverParameters::MGR::StrategyType::multiphasePoromechanicsReservoirFVM; } + GEOS_LOG_LEVEL_RANK_0( 1, GEOS_FMT( "{}: MGR strategy set to {}", getName(), + EnumStrings< LinearSolverParameters::MGR::StrategyType >::toString( linearSolverParameters.mgr.strategy ))); } template< typename RESERVOIR_SOLVER > @@ -123,15 +137,6 @@ initializePreSubGroups() InputError ); } -template< typename RESERVOIR_SOLVER > -void -CompositionalMultiphaseReservoirAndWells< RESERVOIR_SOLVER >:: -initializePostInitialConditionsPreSubGroups() -{ - Base::initializePostInitialConditionsPreSubGroups(); - setMGRStrategy(); -} - template< typename RESERVOIR_SOLVER > void CompositionalMultiphaseReservoirAndWells< RESERVOIR_SOLVER >:: diff --git a/src/coreComponents/physicsSolvers/multiphysics/CompositionalMultiphaseReservoirAndWells.hpp b/src/coreComponents/physicsSolvers/multiphysics/CompositionalMultiphaseReservoirAndWells.hpp index 4904148cef4..a4f290c9a69 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/CompositionalMultiphaseReservoirAndWells.hpp +++ b/src/coreComponents/physicsSolvers/multiphysics/CompositionalMultiphaseReservoirAndWells.hpp @@ -94,14 +94,12 @@ class CompositionalMultiphaseReservoirAndWells : public CoupledReservoirAndWells virtual void initializePreSubGroups() override; - virtual void initializePostInitialConditionsPreSubGroups() override; + virtual void setMGRStrategy() override; private: CompositionalMultiphaseBase * flowSolver() const; - void setMGRStrategy(); - }; } /* namespace geos */ diff --git a/src/coreComponents/physicsSolvers/multiphysics/CoupledReservoirAndWellsBase.hpp b/src/coreComponents/physicsSolvers/multiphysics/CoupledReservoirAndWellsBase.hpp index fabc8286286..a726c5c3dc6 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/CoupledReservoirAndWellsBase.hpp +++ b/src/coreComponents/physicsSolvers/multiphysics/CoupledReservoirAndWellsBase.hpp @@ -201,10 +201,18 @@ class CoupledReservoirAndWellsBase : public CoupledSolver< RESERVOIR_SOLVER, WEL // Validate well perforations: Ensure that each perforation is in a region targeted by the solver if( !validateWellPerforations( domain )) { - return; + GEOS_ERROR( GEOS_FMT( "{}: well perforations validation failed, bad perforations found", this->getName())); } } + virtual void + postInputInitialization() override + { + Base::postInputInitialization(); + + setMGRStrategy(); + } + virtual void implicitStepSetup( real64 const & time_n, real64 const & dt, @@ -298,6 +306,12 @@ class CoupledReservoirAndWellsBase : public CoupledSolver< RESERVOIR_SOLVER, WEL DofManager const & dofManager, SparsityPatternView< globalIndex > const & pattern ) const = 0; + virtual void setMGRStrategy() + { + if( this->m_linearSolverParameters.get().preconditionerType == LinearSolverParameters::PreconditionerType::mgr ) + GEOS_ERROR( GEOS_FMT( "{}: MGR strategy is not implemented for {}", this->getName(), this->getCatalogName())); + } + /// Flag to determine whether the well transmissibility needs to be computed bool m_isWellTransmissibilityComputed; diff --git a/src/coreComponents/physicsSolvers/multiphysics/HydrofractureSolver.cpp b/src/coreComponents/physicsSolvers/multiphysics/HydrofractureSolver.cpp index dfb47daebbe..b20841da49a 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/HydrofractureSolver.cpp +++ b/src/coreComponents/physicsSolvers/multiphysics/HydrofractureSolver.cpp @@ -80,13 +80,22 @@ HydrofractureSolver< POROMECHANICS_SOLVER >::HydrofractureSolver( const string & setDescription( "Flag to determine whether or not to apply lagging update for the fracture stencil weights. " ); m_numResolves[0] = 0; +} - // This may need to be different depending on whether poroelasticity is on or not. - m_linearSolverParameters.get().mgr.strategy = LinearSolverParameters::MGR::StrategyType::hydrofracture; - m_linearSolverParameters.get().mgr.separateComponents = false; - m_linearSolverParameters.get().mgr.displacementFieldName = solidMechanics::totalDisplacement::key(); - m_linearSolverParameters.get().dofsPerNode = 3; +template< typename POROMECHANICS_SOLVER > +void HydrofractureSolver< POROMECHANICS_SOLVER >::setMGRStrategy() +{ + LinearSolverParameters & linearSolverParameters = this->m_linearSolverParameters.get(); + if( linearSolverParameters.preconditionerType != LinearSolverParameters::PreconditionerType::mgr ) + return; + + // This may need to be different depending on whether poroelasticity is on or not. + linearSolverParameters.mgr.strategy = LinearSolverParameters::MGR::StrategyType::hydrofracture; + GEOS_LOG_LEVEL_RANK_0( 1, GEOS_FMT( "{}: MGR strategy set to {}", this->getName(), + EnumStrings< LinearSolverParameters::MGR::StrategyType >::toString( linearSolverParameters.mgr.strategy ))); + linearSolverParameters.mgr.separateComponents = false; + linearSolverParameters.mgr.displacementFieldName = solidMechanics::totalDisplacement::key(); } template< typename POROMECHANICS_SOLVER > @@ -157,6 +166,8 @@ void HydrofractureSolver< POROMECHANICS_SOLVER >::postInputInitialization() { Base::postInputInitialization(); + setMGRStrategy(); + static const std::set< integer > binaryOptions = { 0, 1 }; GEOS_ERROR_IF( binaryOptions.count( m_isMatrixPoroelastic ) == 0, viewKeyStruct::isMatrixPoroelasticString() << " option can be either 0 (false) or 1 (true)" ); diff --git a/src/coreComponents/physicsSolvers/multiphysics/HydrofractureSolver.hpp b/src/coreComponents/physicsSolvers/multiphysics/HydrofractureSolver.hpp index 952415312d7..cabe685c918 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/HydrofractureSolver.hpp +++ b/src/coreComponents/physicsSolvers/multiphysics/HydrofractureSolver.hpp @@ -212,6 +212,7 @@ class HydrofractureSolver : public POROMECHANICS_SOLVER DofManager const & dofManager, CRSMatrix< real64, globalIndex > & localMatrix ); + virtual void setMGRStrategy() override; private: diff --git a/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanics.cpp b/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanics.cpp index 1f4f06d0db3..f610bcb91aa 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanics.cpp +++ b/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanics.cpp @@ -45,19 +45,15 @@ template< typename FLOW_SOLVER, typename MECHANICS_SOLVER > MultiphasePoromechanics< FLOW_SOLVER, MECHANICS_SOLVER >::MultiphasePoromechanics( const string & name, Group * const parent ) : Base( name, parent ) -{ - LinearSolverParameters & linearSolverParameters = this->m_linearSolverParameters.get(); - linearSolverParameters.mgr.strategy = LinearSolverParameters::MGR::StrategyType::multiphasePoromechanics; - linearSolverParameters.mgr.separateComponents = true; - linearSolverParameters.mgr.displacementFieldName = solidMechanics::totalDisplacement::key(); - linearSolverParameters.dofsPerNode = 3; -} +{} template< typename FLOW_SOLVER, typename MECHANICS_SOLVER > void MultiphasePoromechanics< FLOW_SOLVER, MECHANICS_SOLVER >::postInputInitialization() { Base::postInputInitialization(); + setMGRStrategy(); + GEOS_ERROR_IF( this->flowSolver()->getCatalogName() == "CompositionalMultiphaseReservoir" && this->getNonlinearSolverParameters().couplingType() != NonlinearSolverParameters::CouplingType::Sequential, GEOS_FMT( "{}: {} solver is only designed to work for {} = {}", @@ -276,11 +272,28 @@ void MultiphasePoromechanics< FLOW_SOLVER, MECHANICS_SOLVER >::initializePostIni getCatalogName(), this->getDataContext(), poromechanicsTargetRegionNames[i], this->flowSolver()->getDataContext() ), InputError ); } +} + +template<> +void MultiphasePoromechanics<>::setMGRStrategy() +{ + LinearSolverParameters & linearSolverParameters = this->m_linearSolverParameters.get(); + + if( linearSolverParameters.preconditionerType != LinearSolverParameters::PreconditionerType::mgr ) + return; if( this->m_isThermal ) { - this->m_linearSolverParameters.get().mgr.strategy = LinearSolverParameters::MGR::StrategyType::thermalMultiphasePoromechanics; + linearSolverParameters.mgr.strategy = LinearSolverParameters::MGR::StrategyType::thermalMultiphasePoromechanics; + } + else + { + linearSolverParameters.mgr.strategy = LinearSolverParameters::MGR::StrategyType::multiphasePoromechanics; } + GEOS_LOG_LEVEL_RANK_0( 1, GEOS_FMT( "{}: MGR strategy set to {}", getName(), + EnumStrings< LinearSolverParameters::MGR::StrategyType >::toString( linearSolverParameters.mgr.strategy ))); + linearSolverParameters.mgr.separateComponents = true; + linearSolverParameters.mgr.displacementFieldName = solidMechanics::totalDisplacement::key(); } template< typename FLOW_SOLVER, typename MECHANICS_SOLVER > diff --git a/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanics.hpp b/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanics.hpp index 578df76e3cf..c17f0bf07e9 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanics.hpp +++ b/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanics.hpp @@ -109,7 +109,11 @@ class MultiphasePoromechanics : public PoromechanicsSolver< FLOW_SOLVER, MECHANI virtual void initializePostInitialConditionsPreSubGroups() override; - + virtual void setMGRStrategy() + { + if( this->m_linearSolverParameters.get().preconditionerType == LinearSolverParameters::PreconditionerType::mgr ) + GEOS_ERROR( GEOS_FMT( "{}: MGR strategy is not implemented for {}", this->getName(), this->getCatalogName())); + } private: @@ -131,7 +135,6 @@ class MultiphasePoromechanics : public PoromechanicsSolver< FLOW_SOLVER, MECHANI real64 const dt, PARAMS && ... params ); - }; template< typename FLOW_SOLVER, typename MECHANICS_SOLVER > diff --git a/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanics.cpp b/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanics.cpp index 6411c8f190e..7c1e3641461 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanics.cpp +++ b/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanics.cpp @@ -45,19 +45,15 @@ template< typename FLOW_SOLVER, typename MECHANICS_SOLVER > SinglePhasePoromechanics< FLOW_SOLVER, MECHANICS_SOLVER >::SinglePhasePoromechanics( const string & name, Group * const parent ) : Base( name, parent ) -{ - LinearSolverParameters & linearSolverParameters = this->m_linearSolverParameters.get(); - linearSolverParameters.mgr.strategy = LinearSolverParameters::MGR::StrategyType::singlePhasePoromechanics; - linearSolverParameters.mgr.separateComponents = true; - linearSolverParameters.mgr.displacementFieldName = solidMechanics::totalDisplacement::key(); - linearSolverParameters.dofsPerNode = 3; -} +{} template< typename FLOW_SOLVER, typename MECHANICS_SOLVER > void SinglePhasePoromechanics< FLOW_SOLVER, MECHANICS_SOLVER >::postInputInitialization() { Base::postInputInitialization(); + setMGRStrategy(); + GEOS_ERROR_IF( this->flowSolver()->getCatalogName() == "SinglePhaseReservoir" && this->getNonlinearSolverParameters().couplingType() != NonlinearSolverParameters::CouplingType::Sequential, GEOS_FMT( "{}: {} solver is only designed to work for {} = {}", @@ -114,18 +110,33 @@ void SinglePhasePoromechanics< FLOW_SOLVER, MECHANICS_SOLVER >::initializePostIn getCatalogName(), this->getDataContext(), poromechanicsTargetRegionNames[i], this->flowSolver()->getDataContext() ), InputError ); } +} + +template<> +void SinglePhasePoromechanics<>::setMGRStrategy() +{ + LinearSolverParameters & linearSolverParameters = this->m_linearSolverParameters.get(); + + if( linearSolverParameters.preconditionerType != LinearSolverParameters::PreconditionerType::mgr ) + return; if( this->m_isThermal ) { - this->m_linearSolverParameters.get().mgr.strategy = LinearSolverParameters::MGR::StrategyType::thermalSinglePhasePoromechanics; + linearSolverParameters.mgr.strategy = LinearSolverParameters::MGR::StrategyType::thermalSinglePhasePoromechanics; } else { if( this->flowSolver()->getLinearSolverParameters().mgr.strategy == LinearSolverParameters::MGR::StrategyType::singlePhaseHybridFVM ) { - this->m_linearSolverParameters.get().mgr.strategy = LinearSolverParameters::MGR::StrategyType::hybridSinglePhasePoromechanics; + linearSolverParameters.mgr.strategy = LinearSolverParameters::MGR::StrategyType::hybridSinglePhasePoromechanics; + } + else + { + linearSolverParameters.mgr.strategy = LinearSolverParameters::MGR::StrategyType::singlePhasePoromechanics; } } + linearSolverParameters.mgr.separateComponents = true; + linearSolverParameters.mgr.displacementFieldName = solidMechanics::totalDisplacement::key(); } template< typename FLOW_SOLVER, typename MECHANICS_SOLVER > diff --git a/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanics.hpp b/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanics.hpp index ed8cf47b964..a7dbea41a98 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanics.hpp +++ b/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanics.hpp @@ -132,6 +132,12 @@ class SinglePhasePoromechanics : public PoromechanicsSolver< FLOW_SOLVER, MECHAN real64 const dt, PARAMS && ... params ); + virtual void setMGRStrategy() + { + if( this->m_linearSolverParameters.get().preconditionerType == LinearSolverParameters::PreconditionerType::mgr ) + GEOS_ERROR( GEOS_FMT( "{}: MGR strategy is not implemented for {}", this->getName(), this->getCatalogName())); + } + private: /** diff --git a/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsConformingFractures.cpp b/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsConformingFractures.cpp index 7f5f69c81a5..1de7a592d6e 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsConformingFractures.cpp +++ b/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsConformingFractures.cpp @@ -43,12 +43,21 @@ template< typename FLOW_SOLVER > SinglePhasePoromechanicsConformingFractures< FLOW_SOLVER >::SinglePhasePoromechanicsConformingFractures( const string & name, Group * const parent ) : Base( name, parent ) +{} + +template<> +void SinglePhasePoromechanicsConformingFractures<>::setMGRStrategy() { - LinearSolverParameters & params = this->m_linearSolverParameters.get(); - params.mgr.strategy = LinearSolverParameters::MGR::StrategyType::singlePhasePoromechanicsConformingFractures; - params.mgr.separateComponents = false; - params.mgr.displacementFieldName = solidMechanics::totalDisplacement::key(); - params.dofsPerNode = 3; + LinearSolverParameters & linearSolverParameters = this->m_linearSolverParameters.get(); + + if( linearSolverParameters.preconditionerType != LinearSolverParameters::PreconditionerType::mgr ) + return; + + linearSolverParameters.mgr.strategy = LinearSolverParameters::MGR::StrategyType::singlePhasePoromechanicsConformingFractures; + GEOS_LOG_LEVEL_RANK_0( 1, GEOS_FMT( "{}: MGR strategy set to {}", getName(), + EnumStrings< LinearSolverParameters::MGR::StrategyType >::toString( linearSolverParameters.mgr.strategy ))); + linearSolverParameters.mgr.separateComponents = false; + linearSolverParameters.mgr.displacementFieldName = solidMechanics::totalDisplacement::key(); } template< typename FLOW_SOLVER > diff --git a/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsConformingFractures.hpp b/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsConformingFractures.hpp index a522d389b86..7176e5f1bee 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsConformingFractures.hpp +++ b/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsConformingFractures.hpp @@ -103,6 +103,12 @@ class SinglePhasePoromechanicsConformingFractures : public SinglePhasePoromechan virtual void updateState( DomainPartition & domain ) override final; + virtual void setMGRStrategy() override + { + if( this->m_linearSolverParameters.get().preconditionerType == LinearSolverParameters::PreconditionerType::mgr ) + GEOS_ERROR( GEOS_FMT( "{}: MGR strategy is not implemented for {}", this->getName(), this->getCatalogName())); + } + /**@}*/ private: @@ -176,7 +182,6 @@ class SinglePhasePoromechanicsConformingFractures : public SinglePhasePoromechan */ void updateHydraulicApertureAndFracturePermeability( DomainPartition & domain ); - std::unique_ptr< CRSMatrix< real64, localIndex > > & getRefDerivativeFluxResidual_dAperture() { return m_derivativeFluxResidual_dAperture; diff --git a/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsEmbeddedFractures.cpp b/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsEmbeddedFractures.cpp index d2c1c2ddecb..f99daf989c6 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsEmbeddedFractures.cpp +++ b/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsEmbeddedFractures.cpp @@ -40,17 +40,25 @@ using namespace fields; SinglePhasePoromechanicsEmbeddedFractures::SinglePhasePoromechanicsEmbeddedFractures( const std::string & name, Group * const parent ): SinglePhasePoromechanics( name, parent ) -{ - LinearSolverParameters & params = m_linearSolverParameters.get(); - params.mgr.strategy = LinearSolverParameters::MGR::StrategyType::singlePhasePoromechanicsEmbeddedFractures; - params.mgr.separateComponents = false; - params.mgr.displacementFieldName = solidMechanics::totalDisplacement::key(); - params.dofsPerNode = 3; -} +{} SinglePhasePoromechanicsEmbeddedFractures::~SinglePhasePoromechanicsEmbeddedFractures() {} +void SinglePhasePoromechanicsEmbeddedFractures::setMGRStrategy() +{ + LinearSolverParameters & linearSolverParameters = m_linearSolverParameters.get(); + + if( linearSolverParameters.preconditionerType != LinearSolverParameters::PreconditionerType::mgr ) + return; + + linearSolverParameters.mgr.strategy = LinearSolverParameters::MGR::StrategyType::singlePhasePoromechanicsEmbeddedFractures; + GEOS_LOG_LEVEL_RANK_0( 1, GEOS_FMT( "{}: MGR strategy set to {}", getName(), + EnumStrings< LinearSolverParameters::MGR::StrategyType >::toString( linearSolverParameters.mgr.strategy ))); + linearSolverParameters.mgr.separateComponents = false; + linearSolverParameters.mgr.displacementFieldName = solidMechanics::totalDisplacement::key(); +} + void SinglePhasePoromechanicsEmbeddedFractures::postInputInitialization() { Base::postInputInitialization(); diff --git a/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsEmbeddedFractures.hpp b/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsEmbeddedFractures.hpp index 1094ae5f678..4146fa9720c 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsEmbeddedFractures.hpp +++ b/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsEmbeddedFractures.hpp @@ -105,6 +105,8 @@ class SinglePhasePoromechanicsEmbeddedFractures : public SinglePhasePoromechanic virtual void initializePostInitialConditionsPreSubGroups() override final; + virtual void setMGRStrategy() override; + private: template< typename CONSTITUTIVE_BASE, diff --git a/src/coreComponents/physicsSolvers/multiphysics/SinglePhaseReservoirAndWells.cpp b/src/coreComponents/physicsSolvers/multiphysics/SinglePhaseReservoirAndWells.cpp index 34932b61aba..f7ad78a74a7 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/SinglePhaseReservoirAndWells.cpp +++ b/src/coreComponents/physicsSolvers/multiphysics/SinglePhaseReservoirAndWells.cpp @@ -68,33 +68,47 @@ void SinglePhaseReservoirAndWells<>:: setMGRStrategy() { + LinearSolverParameters & linearSolverParameters = m_linearSolverParameters.get(); + + if( linearSolverParameters.preconditionerType != LinearSolverParameters::PreconditionerType::mgr ) + return; + if( flowSolver()->getLinearSolverParameters().mgr.strategy == LinearSolverParameters::MGR::StrategyType::singlePhaseHybridFVM ) { // add Reservoir - m_linearSolverParameters.get().mgr.strategy = LinearSolverParameters::MGR::StrategyType::singlePhaseReservoirHybridFVM; + linearSolverParameters.mgr.strategy = LinearSolverParameters::MGR::StrategyType::singlePhaseReservoirHybridFVM; } else { // add Reservoir - m_linearSolverParameters.get().mgr.strategy = LinearSolverParameters::MGR::StrategyType::singlePhaseReservoirFVM; + linearSolverParameters.mgr.strategy = LinearSolverParameters::MGR::StrategyType::singlePhaseReservoirFVM; } + GEOS_LOG_LEVEL_RANK_0( 1, GEOS_FMT( "{}: MGR strategy set to {}", getName(), + EnumStrings< LinearSolverParameters::MGR::StrategyType >::toString( linearSolverParameters.mgr.strategy ))); } -template< typename POROMECHANICS_SOLVER > +template<> void -SinglePhaseReservoirAndWells< POROMECHANICS_SOLVER >:: +SinglePhaseReservoirAndWells< SinglePhasePoromechanics<> >:: setMGRStrategy() { + LinearSolverParameters & linearSolverParameters = m_linearSolverParameters.get(); + + if( linearSolverParameters.preconditionerType != LinearSolverParameters::PreconditionerType::mgr ) + return; + // flow solver here is indeed flow solver, not poromechanics solver if( flowSolver()->getLinearSolverParameters().mgr.strategy == LinearSolverParameters::MGR::StrategyType::singlePhaseHybridFVM ) { - GEOS_LOG_RANK_0( "The poromechanics MGR strategy for hybrid FVM is not implemented" ); + GEOS_ERROR( "The poromechanics MGR strategy for hybrid FVM is not implemented" ); } else { // add Reservoir - m_linearSolverParameters.get().mgr.strategy = LinearSolverParameters::MGR::StrategyType::singlePhasePoromechanicsReservoirFVM; + linearSolverParameters.mgr.strategy = LinearSolverParameters::MGR::StrategyType::singlePhasePoromechanicsReservoirFVM; } + GEOS_LOG_LEVEL_RANK_0( 1, GEOS_FMT( "{}: MGR strategy set to {}", this->getName(), + EnumStrings< LinearSolverParameters::MGR::StrategyType >::toString( linearSolverParameters.mgr.strategy ))); } template< typename RESERVOIR_SOLVER > @@ -107,15 +121,6 @@ initializePreSubGroups() Base::wellSolver()->setFlowSolverName( flowSolver->getName() ); } -template< typename RESERVOIR_SOLVER > -void -SinglePhaseReservoirAndWells< RESERVOIR_SOLVER >:: -initializePostInitialConditionsPreSubGroups() -{ - Base::initializePostInitialConditionsPreSubGroups(); - setMGRStrategy(); -} - template< typename RESERVOIR_SOLVER > void SinglePhaseReservoirAndWells< RESERVOIR_SOLVER >:: diff --git a/src/coreComponents/physicsSolvers/multiphysics/SinglePhaseReservoirAndWells.hpp b/src/coreComponents/physicsSolvers/multiphysics/SinglePhaseReservoirAndWells.hpp index 3ad673bbb21..c88b9926471 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/SinglePhaseReservoirAndWells.hpp +++ b/src/coreComponents/physicsSolvers/multiphysics/SinglePhaseReservoirAndWells.hpp @@ -110,14 +110,16 @@ class SinglePhaseReservoirAndWells : public CoupledReservoirAndWellsBase< RESERV virtual void initializePreSubGroups() override; - virtual void initializePostInitialConditionsPreSubGroups() override; + virtual void setMGRStrategy() override + { + if( this->m_linearSolverParameters.get().preconditionerType == LinearSolverParameters::PreconditionerType::mgr ) + GEOS_ERROR( GEOS_FMT( "{}: MGR strategy is not implemented for {}", this->getName(), this->getCatalogName())); + } private: SinglePhaseBase * flowSolver() const; - void setMGRStrategy(); - }; } /* namespace geos */ diff --git a/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsLagrangianFEM.cpp b/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsLagrangianFEM.cpp index 1c1c5cf9785..ab3d6ba3282 100644 --- a/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsLagrangianFEM.cpp +++ b/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsLagrangianFEM.cpp @@ -130,6 +130,7 @@ void SolidMechanicsLagrangianFEM::postInputInitialization() { SolverBase::postInputInitialization(); + // configure AMG LinearSolverParameters & linParams = m_linearSolverParameters.get(); linParams.isSymmetric = true; linParams.dofsPerNode = 3;