diff --git a/src/coreComponents/physicsSolvers/contact/SolidMechanicsEmbeddedFractures.cpp b/src/coreComponents/physicsSolvers/contact/SolidMechanicsEmbeddedFractures.cpp index c1345d2a8be..90f33a650e0 100644 --- a/src/coreComponents/physicsSolvers/contact/SolidMechanicsEmbeddedFractures.cpp +++ b/src/coreComponents/physicsSolvers/contact/SolidMechanicsEmbeddedFractures.cpp @@ -64,34 +64,22 @@ SolidMechanicsEmbeddedFractures::~SolidMechanicsEmbeddedFractures() void SolidMechanicsEmbeddedFractures::postInputInitialization() { - ContactSolverBase::postInputInitialization(); + SolidMechanicsLagrangianFEM::postInputInitialization(); + + LinearSolverParameters & linParams = m_linearSolverParameters.get(); if( m_useStaticCondensation ) { - // configure AMG - LinearSolverParameters & linearSolverParameters = m_linearSolverParameters.get(); - linearSolverParameters.dofsPerNode = 3; - linearSolverParameters.isSymmetric = true; - linearSolverParameters.amg.separateComponents = true; + linParams.dofsPerNode = 3; + linParams.isSymmetric = true; + linParams.amg.separateComponents = true; } else { - setMGRStrategy(); + linParams.mgr.strategy = LinearSolverParameters::MGR::StrategyType::solidMechanicsEmbeddedFractures; } } -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 2b1bf5ab491..669d9ce541b 100644 --- a/src/coreComponents/physicsSolvers/contact/SolidMechanicsEmbeddedFractures.hpp +++ b/src/coreComponents/physicsSolvers/contact/SolidMechanicsEmbeddedFractures.hpp @@ -127,8 +127,6 @@ 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 72d54cd552a..bdb83a14ed6 100644 --- a/src/coreComponents/physicsSolvers/contact/SolidMechanicsLagrangeContact.cpp +++ b/src/coreComponents/physicsSolvers/contact/SolidMechanicsLagrangeContact.cpp @@ -73,27 +73,12 @@ 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.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(); + 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; } void SolidMechanicsLagrangeContact::registerDataOnMesh( Group & meshBodies ) diff --git a/src/coreComponents/physicsSolvers/contact/SolidMechanicsLagrangeContact.hpp b/src/coreComponents/physicsSolvers/contact/SolidMechanicsLagrangeContact.hpp index 3bf43c69a30..1e7483cd6c3 100644 --- a/src/coreComponents/physicsSolvers/contact/SolidMechanicsLagrangeContact.hpp +++ b/src/coreComponents/physicsSolvers/contact/SolidMechanicsLagrangeContact.hpp @@ -31,6 +31,7 @@ class NumericalMethodsManager; class SolidMechanicsLagrangeContact : public ContactSolverBase { public: + SolidMechanicsLagrangeContact( const string & name, Group * const parent ); @@ -178,10 +179,6 @@ 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 58ba100e0ea..5853f513231 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/CompositionalMultiphaseReservoirAndWells.cpp +++ b/src/coreComponents/physicsSolvers/multiphysics/CompositionalMultiphaseReservoirAndWells.cpp @@ -75,23 +75,16 @@ void CompositionalMultiphaseReservoirAndWells<>:: setMGRStrategy() { - LinearSolverParameters & linearSolverParameters = m_linearSolverParameters.get(); - - if( linearSolverParameters.preconditionerType != LinearSolverParameters::PreconditionerType::mgr ) - return; - - if( dynamic_cast< CompositionalMultiphaseHybridFVM * >( flowSolver() ) ) + if( flowSolver()->getLinearSolverParameters().mgr.strategy == LinearSolverParameters::MGR::StrategyType::compositionalMultiphaseHybridFVM ) { // add Reservoir - linearSolverParameters.mgr.strategy = LinearSolverParameters::MGR::StrategyType::compositionalMultiphaseReservoirHybridFVM; + m_linearSolverParameters.get().mgr.strategy = LinearSolverParameters::MGR::StrategyType::compositionalMultiphaseReservoirHybridFVM; } else { // add Reservoir - linearSolverParameters.mgr.strategy = LinearSolverParameters::MGR::StrategyType::compositionalMultiphaseReservoirFVM; + m_linearSolverParameters.get().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<> @@ -99,23 +92,16 @@ 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( dynamic_cast< CompositionalMultiphaseHybridFVM * >( flowSolver() ) ) + if( flowSolver()->getLinearSolverParameters().mgr.strategy == LinearSolverParameters::MGR::StrategyType::compositionalMultiphaseHybridFVM ) { GEOS_ERROR( "The poromechanics MGR strategy for hybrid FVM is not implemented" ); } else { // add Reservoir - linearSolverParameters.mgr.strategy = LinearSolverParameters::MGR::StrategyType::multiphasePoromechanicsReservoirFVM; + m_linearSolverParameters.get().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 > @@ -137,6 +123,15 @@ 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 a4f290c9a69..4904148cef4 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/CompositionalMultiphaseReservoirAndWells.hpp +++ b/src/coreComponents/physicsSolvers/multiphysics/CompositionalMultiphaseReservoirAndWells.hpp @@ -94,12 +94,14 @@ class CompositionalMultiphaseReservoirAndWells : public CoupledReservoirAndWells virtual void initializePreSubGroups() override; - virtual void setMGRStrategy() override; + virtual void initializePostInitialConditionsPreSubGroups() 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 a726c5c3dc6..fabc8286286 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/CoupledReservoirAndWellsBase.hpp +++ b/src/coreComponents/physicsSolvers/multiphysics/CoupledReservoirAndWellsBase.hpp @@ -201,18 +201,10 @@ 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 )) { - GEOS_ERROR( GEOS_FMT( "{}: well perforations validation failed, bad perforations found", this->getName())); + return; } } - virtual void - postInputInitialization() override - { - Base::postInputInitialization(); - - setMGRStrategy(); - } - virtual void implicitStepSetup( real64 const & time_n, real64 const & dt, @@ -306,12 +298,6 @@ 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 b20841da49a..dfb47daebbe 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/HydrofractureSolver.cpp +++ b/src/coreComponents/physicsSolvers/multiphysics/HydrofractureSolver.cpp @@ -80,22 +80,13 @@ 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; -} - -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(); + 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 > @@ -166,8 +157,6 @@ 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 cabe685c918..952415312d7 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/HydrofractureSolver.hpp +++ b/src/coreComponents/physicsSolvers/multiphysics/HydrofractureSolver.hpp @@ -212,7 +212,6 @@ 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 f610bcb91aa..1f4f06d0db3 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanics.cpp +++ b/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanics.cpp @@ -45,15 +45,19 @@ 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 {} = {}", @@ -272,28 +276,11 @@ 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 ) { - linearSolverParameters.mgr.strategy = LinearSolverParameters::MGR::StrategyType::thermalMultiphasePoromechanics; - } - else - { - linearSolverParameters.mgr.strategy = LinearSolverParameters::MGR::StrategyType::multiphasePoromechanics; + this->m_linearSolverParameters.get().mgr.strategy = LinearSolverParameters::MGR::StrategyType::thermalMultiphasePoromechanics; } - 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 c17f0bf07e9..578df76e3cf 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanics.hpp +++ b/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanics.hpp @@ -109,11 +109,7 @@ 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: @@ -135,6 +131,7 @@ 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 7c1e3641461..6411c8f190e 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanics.cpp +++ b/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanics.cpp @@ -45,15 +45,19 @@ 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 {} = {}", @@ -110,33 +114,18 @@ 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 ) { - linearSolverParameters.mgr.strategy = LinearSolverParameters::MGR::StrategyType::thermalSinglePhasePoromechanics; + this->m_linearSolverParameters.get().mgr.strategy = LinearSolverParameters::MGR::StrategyType::thermalSinglePhasePoromechanics; } else { if( this->flowSolver()->getLinearSolverParameters().mgr.strategy == LinearSolverParameters::MGR::StrategyType::singlePhaseHybridFVM ) { - linearSolverParameters.mgr.strategy = LinearSolverParameters::MGR::StrategyType::hybridSinglePhasePoromechanics; - } - else - { - linearSolverParameters.mgr.strategy = LinearSolverParameters::MGR::StrategyType::singlePhasePoromechanics; + this->m_linearSolverParameters.get().mgr.strategy = LinearSolverParameters::MGR::StrategyType::hybridSinglePhasePoromechanics; } } - 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 a7dbea41a98..ed8cf47b964 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanics.hpp +++ b/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanics.hpp @@ -132,12 +132,6 @@ 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 1de7a592d6e..7f5f69c81a5 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsConformingFractures.cpp +++ b/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsConformingFractures.cpp @@ -43,21 +43,12 @@ template< typename FLOW_SOLVER > SinglePhasePoromechanicsConformingFractures< FLOW_SOLVER >::SinglePhasePoromechanicsConformingFractures( const string & name, Group * const parent ) : Base( name, parent ) -{} - -template<> -void SinglePhasePoromechanicsConformingFractures<>::setMGRStrategy() { - 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(); + 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; } template< typename FLOW_SOLVER > diff --git a/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsConformingFractures.hpp b/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsConformingFractures.hpp index 7176e5f1bee..a522d389b86 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsConformingFractures.hpp +++ b/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsConformingFractures.hpp @@ -103,12 +103,6 @@ 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: @@ -182,6 +176,7 @@ 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 f99daf989c6..d2c1c2ddecb 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsEmbeddedFractures.cpp +++ b/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsEmbeddedFractures.cpp @@ -40,25 +40,17 @@ 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 4146fa9720c..1094ae5f678 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsEmbeddedFractures.hpp +++ b/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsEmbeddedFractures.hpp @@ -105,8 +105,6 @@ 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 f7ad78a74a7..34932b61aba 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/SinglePhaseReservoirAndWells.cpp +++ b/src/coreComponents/physicsSolvers/multiphysics/SinglePhaseReservoirAndWells.cpp @@ -68,47 +68,33 @@ 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 - linearSolverParameters.mgr.strategy = LinearSolverParameters::MGR::StrategyType::singlePhaseReservoirHybridFVM; + m_linearSolverParameters.get().mgr.strategy = LinearSolverParameters::MGR::StrategyType::singlePhaseReservoirHybridFVM; } else { // add Reservoir - linearSolverParameters.mgr.strategy = LinearSolverParameters::MGR::StrategyType::singlePhaseReservoirFVM; + m_linearSolverParameters.get().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<> +template< typename POROMECHANICS_SOLVER > void -SinglePhaseReservoirAndWells< SinglePhasePoromechanics<> >:: +SinglePhaseReservoirAndWells< POROMECHANICS_SOLVER >:: 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_ERROR( "The poromechanics MGR strategy for hybrid FVM is not implemented" ); + GEOS_LOG_RANK_0( "The poromechanics MGR strategy for hybrid FVM is not implemented" ); } else { // add Reservoir - linearSolverParameters.mgr.strategy = LinearSolverParameters::MGR::StrategyType::singlePhasePoromechanicsReservoirFVM; + m_linearSolverParameters.get().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 > @@ -121,6 +107,15 @@ 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 c88b9926471..3ad673bbb21 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/SinglePhaseReservoirAndWells.hpp +++ b/src/coreComponents/physicsSolvers/multiphysics/SinglePhaseReservoirAndWells.hpp @@ -110,16 +110,14 @@ class SinglePhaseReservoirAndWells : public CoupledReservoirAndWellsBase< RESERV virtual void initializePreSubGroups() 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())); - } + virtual void initializePostInitialConditionsPreSubGroups() override; 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 ab3d6ba3282..1c1c5cf9785 100644 --- a/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsLagrangianFEM.cpp +++ b/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsLagrangianFEM.cpp @@ -130,7 +130,6 @@ void SolidMechanicsLagrangianFEM::postInputInitialization() { SolverBase::postInputInitialization(); - // configure AMG LinearSolverParameters & linParams = m_linearSolverParameters.get(); linParams.isSymmetric = true; linParams.dofsPerNode = 3;