From 220fa5226bc048bddd59b04130e17993261b15dc Mon Sep 17 00:00:00 2001 From: Pavel Tomin Date: Wed, 2 Oct 2024 18:05:25 -0500 Subject: [PATCH 01/19] keep well variables constant during poromech init --- .../fluidFlow/CompositionalMultiphaseBase.cpp | 18 +++++++-------- .../fluidFlow/CompositionalMultiphaseBase.hpp | 14 +++++------ .../fluidFlow/CompositionalMultiphaseFVM.cpp | 2 +- .../fluidFlow/FlowSolverBase.cpp | 2 +- .../fluidFlow/FlowSolverBase.hpp | 8 +++---- .../fluidFlow/SinglePhaseBase.cpp | 18 +++++++-------- .../fluidFlow/SinglePhaseBase.hpp | 14 +++++------ .../fluidFlow/SinglePhaseFVM.cpp | 2 +- .../fluidFlow/SinglePhaseHybridFVM.cpp | 2 +- .../wells/CompositionalMultiphaseWell.cpp | 2 +- .../fluidFlow/wells/SinglePhaseWell.cpp | 2 +- .../fluidFlow/wells/WellSolverBase.cpp | 23 +++++++++++-------- .../fluidFlow/wells/WellSolverBase.hpp | 11 +++++++++ .../CoupledReservoirAndWellsBase.hpp | 7 ++++-- .../multiphysics/PoromechanicsSolver.hpp | 2 +- 15 files changed, 72 insertions(+), 55 deletions(-) diff --git a/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseBase.cpp b/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseBase.cpp index a8d6f99ecec..6c14e9e034c 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseBase.cpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseBase.cpp @@ -1450,13 +1450,13 @@ void CompositionalMultiphaseBase::applyBoundaryConditions( real64 const time_n, { GEOS_MARK_FUNCTION; - if( m_keepFlowVariablesConstantDuringInitStep ) + if( m_keepVariablesConstantDuringInitStep ) { // this function is going to force the current flow state to be constant during the time step // this is used when the poromechanics solver is performing the stress initialization // TODO: in the future, a dedicated poromechanics kernel should eliminate the flow vars to construct a reduced system // which will remove the need for this brittle passing aroung of flag - keepFlowVariablesConstantDuringInitStep( time_n, dt, dofManager, domain, localMatrix.toViewConstSizes(), localRhs.toView() ); + keepVariablesConstantDuringInitStep( time_n, dt, dofManager, domain, localMatrix.toViewConstSizes(), localRhs.toView() ); } else { @@ -1958,12 +1958,12 @@ void CompositionalMultiphaseBase::applyDirichletBC( real64 const time_n, } ); } -void CompositionalMultiphaseBase::keepFlowVariablesConstantDuringInitStep( real64 const time, - real64 const dt, - DofManager const & dofManager, - DomainPartition & domain, - CRSMatrixView< real64, globalIndex const > const & localMatrix, - arrayView1d< real64 > const & localRhs ) const +void CompositionalMultiphaseBase::keepVariablesConstantDuringInitStep( real64 const time, + real64 const dt, + DofManager const & dofManager, + DomainPartition & domain, + CRSMatrixView< real64, globalIndex const > const & localMatrix, + arrayView1d< real64 > const & localRhs ) const { GEOS_MARK_FUNCTION; @@ -2447,7 +2447,7 @@ void CompositionalMultiphaseBase::implicitStepComplete( real64 const & time, // Step 3: save the converged solid state string const & solidName = subRegion.getReference< string >( viewKeyStruct::solidNamesString() ); CoupledSolidBase const & porousMaterial = getConstitutiveModel< CoupledSolidBase >( subRegion, solidName ); - if( m_keepFlowVariablesConstantDuringInitStep ) + if( m_keepVariablesConstantDuringInitStep ) { porousMaterial.ignoreConvergedState(); // newPorosity <- porosity_n } diff --git a/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseBase.hpp b/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseBase.hpp index 55dcb3460b6..cfd06428707 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseBase.hpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseBase.hpp @@ -345,15 +345,15 @@ class CompositionalMultiphaseBase : public FlowSolverBase * @param[in] domain the domain * @param[in] localMatrix local system matrix * @param[in] localRhs local system right-hand side vector - * @detail This function is meant to be called when the flag m_keepFlowVariablesConstantDuringInitStep is on + * @detail This function is meant to be called when the flag m_keepVariablesConstantDuringInitStep is on * The main use case is the initialization step in coupled problems during which we solve an elastic problem for a fixed pressure */ - void keepFlowVariablesConstantDuringInitStep( real64 const time, - real64 const dt, - DofManager const & dofManager, - DomainPartition & domain, - CRSMatrixView< real64, globalIndex const > const & localMatrix, - arrayView1d< real64 > const & localRhs ) const; + void keepVariablesConstantDuringInitStep( real64 const time, + real64 const dt, + DofManager const & dofManager, + DomainPartition & domain, + CRSMatrixView< real64, globalIndex const > const & localMatrix, + arrayView1d< real64 > const & localRhs ) const; /** diff --git a/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseFVM.cpp b/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseFVM.cpp index 7e65c07d4aa..b806071fcc8 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseFVM.cpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseFVM.cpp @@ -773,7 +773,7 @@ void CompositionalMultiphaseFVM::applyBoundaryConditions( real64 time_n, { GEOS_MARK_FUNCTION; CompositionalMultiphaseBase::applyBoundaryConditions( time_n, dt, domain, dofManager, localMatrix, localRhs ); - if( !m_keepFlowVariablesConstantDuringInitStep ) + if( !m_keepVariablesConstantDuringInitStep ) { applyFaceDirichletBC( time_n, dt, dofManager, domain, localMatrix, localRhs ); } diff --git a/src/coreComponents/physicsSolvers/fluidFlow/FlowSolverBase.cpp b/src/coreComponents/physicsSolvers/fluidFlow/FlowSolverBase.cpp index 5c54deae9b5..c5cd7edb0ec 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/FlowSolverBase.cpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/FlowSolverBase.cpp @@ -91,7 +91,7 @@ FlowSolverBase::FlowSolverBase( string const & name, SolverBase( name, parent ), m_numDofPerCell( 0 ), m_isThermal( 0 ), - m_keepFlowVariablesConstantDuringInitStep( 0 ), + m_keepVariablesConstantDuringInitStep( 0 ), m_isFixedStressPoromechanicsUpdate( false ), m_isJumpStabilized( false ), m_isLaggingFractureStencilWeightsUpdate( 0 ) diff --git a/src/coreComponents/physicsSolvers/fluidFlow/FlowSolverBase.hpp b/src/coreComponents/physicsSolvers/fluidFlow/FlowSolverBase.hpp index 883661f25a0..64b2403f12d 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/FlowSolverBase.hpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/FlowSolverBase.hpp @@ -150,11 +150,11 @@ class FlowSolverBase : public SolverBase /** * @brief Utility function to keep the flow variables during a time step (used in poromechanics simulations) - * @param[in] keepFlowVariablesConstantDuringInitStep flag to tell the solver to freeze its primary variables during a time step + * @param[in] keepVariablesConstantDuringInitStep flag to tell the solver to freeze its primary variables during a time step * @detail This function is meant to be called by a specific task before/after the initialization step */ - void setKeepFlowVariablesConstantDuringInitStep( bool const keepFlowVariablesConstantDuringInitStep ) - { m_keepFlowVariablesConstantDuringInitStep = keepFlowVariablesConstantDuringInitStep; } + void setKeepVariablesConstantDuringInitStep( bool const keepVariablesConstantDuringInitStep ) + { m_keepVariablesConstantDuringInitStep = keepVariablesConstantDuringInitStep; } virtual bool checkSequentialSolutionIncrements( DomainPartition & domain ) const override; @@ -206,7 +206,7 @@ class FlowSolverBase : public SolverBase real64 m_inputTemperature; /// flag to freeze the initial state during initialization in coupled problems - integer m_keepFlowVariablesConstantDuringInitStep; + integer m_keepVariablesConstantDuringInitStep; /// enable the fixed stress poromechanics update of porosity bool m_isFixedStressPoromechanicsUpdate; diff --git a/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseBase.cpp b/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseBase.cpp index 05dbc006843..4751a8d5f0e 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseBase.cpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseBase.cpp @@ -763,7 +763,7 @@ void SinglePhaseBase::implicitStepComplete( real64 const & time, CoupledSolidBase const & porousSolid = getConstitutiveModel< CoupledSolidBase >( subRegion, subRegion.template getReference< string >( viewKeyStruct::solidNamesString() ) ); - if( m_keepFlowVariablesConstantDuringInitStep ) + if( m_keepVariablesConstantDuringInitStep ) { porousSolid.ignoreConvergedState(); // newPorosity <- porosity_n } @@ -877,13 +877,13 @@ void SinglePhaseBase::applyBoundaryConditions( real64 time_n, { GEOS_MARK_FUNCTION; - if( m_keepFlowVariablesConstantDuringInitStep ) + if( m_keepVariablesConstantDuringInitStep ) { // this function is going to force the current flow state to be constant during the time step // this is used when the poromechanics solver is performing the stress initialization // TODO: in the future, a dedicated poromechanics kernel should eliminate the flow vars to construct a reduced system // which will remove the need for this brittle passing aroung of flag - keepFlowVariablesConstantDuringInitStep( time_n, dt, dofManager, domain, localMatrix.toViewConstSizes(), localRhs.toView() ); + keepVariablesConstantDuringInitStep( time_n, dt, dofManager, domain, localMatrix.toViewConstSizes(), localRhs.toView() ); } else { @@ -1184,12 +1184,12 @@ void SinglePhaseBase::applySourceFluxBC( real64 const time_n, } ); } -void SinglePhaseBase::keepFlowVariablesConstantDuringInitStep( real64 const time, - real64 const dt, - DofManager const & dofManager, - DomainPartition & domain, - CRSMatrixView< real64, globalIndex const > const & localMatrix, - arrayView1d< real64 > const & localRhs ) const +void SinglePhaseBase::keepVariablesConstantDuringInitStep( real64 const time, + real64 const dt, + DofManager const & dofManager, + DomainPartition & domain, + CRSMatrixView< real64, globalIndex const > const & localMatrix, + arrayView1d< real64 > const & localRhs ) const { GEOS_MARK_FUNCTION; diff --git a/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseBase.hpp b/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseBase.hpp index 59ad25124b4..88c22dbed18 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseBase.hpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseBase.hpp @@ -356,15 +356,15 @@ class SinglePhaseBase : public FlowSolverBase * @param[in] domain the domain * @param[in] localMatrix local system matrix * @param[in] localRhs local system right-hand side vector - * @detail This function is meant to be called when the flag m_keepFlowVariablesConstantDuringInitStep is on + * @detail This function is meant to be called when the flag m_keepVariablesConstantDuringInitStep is on * The main use case is the initialization step in coupled problems during which we solve an elastic problem for a fixed pressure */ - void keepFlowVariablesConstantDuringInitStep( real64 const time, - real64 const dt, - DofManager const & dofManager, - DomainPartition & domain, - CRSMatrixView< real64, globalIndex const > const & localMatrix, - arrayView1d< real64 > const & localRhs ) const; + void keepVariablesConstantDuringInitStep( real64 const time, + real64 const dt, + DofManager const & dofManager, + DomainPartition & domain, + CRSMatrixView< real64, globalIndex const > const & localMatrix, + arrayView1d< real64 > const & localRhs ) const; protected: diff --git a/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseFVM.cpp b/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseFVM.cpp index d76de134fd8..ecf357789d5 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseFVM.cpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseFVM.cpp @@ -656,7 +656,7 @@ SinglePhaseFVM< BASE >::applyBoundaryConditions( real64 const time_n, GEOS_MARK_FUNCTION; BASE::applyBoundaryConditions( time_n, dt, domain, dofManager, localMatrix, localRhs ); - if( !BASE::m_keepFlowVariablesConstantDuringInitStep ) + if( !BASE::m_keepVariablesConstantDuringInitStep ) { applyFaceDirichletBC( time_n, dt, dofManager, domain, localMatrix, localRhs ); } diff --git a/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseHybridFVM.cpp b/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseHybridFVM.cpp index 6cbabf723f7..5742f30088a 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseHybridFVM.cpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseHybridFVM.cpp @@ -336,7 +336,7 @@ void SinglePhaseHybridFVM::applyBoundaryConditions( real64 const time_n, GEOS_MARK_FUNCTION; SinglePhaseBase::applyBoundaryConditions( time_n, dt, domain, dofManager, localMatrix, localRhs ); - if( !m_keepFlowVariablesConstantDuringInitStep ) + if( !m_keepVariablesConstantDuringInitStep ) { applyFaceDirichletBC( time_n, dt, dofManager, domain, localMatrix, localRhs ); } diff --git a/src/coreComponents/physicsSolvers/fluidFlow/wells/CompositionalMultiphaseWell.cpp b/src/coreComponents/physicsSolvers/fluidFlow/wells/CompositionalMultiphaseWell.cpp index 2ad8b918fd7..01e9adf375d 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/wells/CompositionalMultiphaseWell.cpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/wells/CompositionalMultiphaseWell.cpp @@ -1711,7 +1711,7 @@ void CompositionalMultiphaseWell::shutDownWell( real64 const time_n, // if the well is open, we don't have to do anything, so we just return WellControls const & wellControls = getWellControls( subRegion ); - if( wellControls.isWellOpen( time_n + dt ) ) + if( wellControls.isWellOpen( time_n + dt ) && !m_keepVariablesConstantDuringInitStep ) { return; } diff --git a/src/coreComponents/physicsSolvers/fluidFlow/wells/SinglePhaseWell.cpp b/src/coreComponents/physicsSolvers/fluidFlow/wells/SinglePhaseWell.cpp index 59c73f57eb9..f021485a427 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/wells/SinglePhaseWell.cpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/wells/SinglePhaseWell.cpp @@ -617,7 +617,7 @@ void SinglePhaseWell::shutDownWell( real64 const time_n, // if the well is open, we don't have to do anything, so we just return WellControls const & wellControls = getWellControls( subRegion ); - if( wellControls.isWellOpen( time_n + dt ) ) + if( wellControls.isWellOpen( time_n + dt ) && !m_keepVariablesConstantDuringInitStep ) { return; } diff --git a/src/coreComponents/physicsSolvers/fluidFlow/wells/WellSolverBase.cpp b/src/coreComponents/physicsSolvers/fluidFlow/wells/WellSolverBase.cpp index e600b55eb35..6fa7023a70b 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/wells/WellSolverBase.cpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/wells/WellSolverBase.cpp @@ -198,20 +198,23 @@ void WellSolverBase::assembleSystem( real64 const time, CRSMatrixView< real64, globalIndex const > const & localMatrix, arrayView1d< real64 > const & localRhs ) { - // assemble the accumulation term in the mass balance equations - assembleAccumulationTerms( domain, dofManager, localMatrix, localRhs ); + if( !m_keepVariablesConstantDuringInitStep ) + { + // assemble the accumulation term in the mass balance equations + assembleAccumulationTerms( domain, dofManager, localMatrix, localRhs ); - // then assemble the flux terms in the mass balance equations - assembleFluxTerms( dt, domain, dofManager, localMatrix, localRhs ); + // then assemble the flux terms in the mass balance equations + assembleFluxTerms( dt, domain, dofManager, localMatrix, localRhs ); - // then assemble the volume balance equations - assembleVolumeBalanceTerms( domain, dofManager, localMatrix, localRhs ); + // then assemble the volume balance equations + assembleVolumeBalanceTerms( domain, dofManager, localMatrix, localRhs ); - // then assemble the pressure relations between well elements - assemblePressureRelations( time, dt, domain, dofManager, localMatrix, localRhs ); + // then assemble the pressure relations between well elements + assemblePressureRelations( time, dt, domain, dofManager, localMatrix, localRhs ); - // then compute the perforation rates (later assembled by the coupled solver) - computePerforationRates( domain ); + // then compute the perforation rates (later assembled by the coupled solver) + computePerforationRates( domain ); + } // then apply a special treatment to the wells that are shut shutDownWell( time, dt, domain, dofManager, localMatrix, localRhs ); diff --git a/src/coreComponents/physicsSolvers/fluidFlow/wells/WellSolverBase.hpp b/src/coreComponents/physicsSolvers/fluidFlow/wells/WellSolverBase.hpp index 1397512189e..a125a1cc015 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/wells/WellSolverBase.hpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/wells/WellSolverBase.hpp @@ -271,6 +271,14 @@ class WellSolverBase : public SolverBase */ virtual void computePerforationRates( DomainPartition & domain ) = 0; + /** + * @brief Utility function to keep the well variables during a time step (used in poromechanics simulations) + * @param[in] keepVariablesConstantDuringInitStep flag to tell the solver to freeze its primary variables during a time step + * @detail This function is meant to be called by a specific task before/after the initialization step + */ + void setKeepVariablesConstantDuringInitStep( bool const keepVariablesConstantDuringInitStep ) + { m_keepVariablesConstantDuringInitStep = keepVariablesConstantDuringInitStep; } + struct viewKeyStruct : SolverBase::viewKeyStruct { static constexpr char const * fluidNamesString() { return "fluidNames"; } @@ -328,6 +336,9 @@ class WellSolverBase : public SolverBase integer m_writeCSV; string const m_ratesOutputDir; + /// flag to freeze the initial state during initialization in coupled problems + integer m_keepVariablesConstantDuringInitStep; + }; } diff --git a/src/coreComponents/physicsSolvers/multiphysics/CoupledReservoirAndWellsBase.hpp b/src/coreComponents/physicsSolvers/multiphysics/CoupledReservoirAndWellsBase.hpp index af10776cdf4..dd5f0552009 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/CoupledReservoirAndWellsBase.hpp +++ b/src/coreComponents/physicsSolvers/multiphysics/CoupledReservoirAndWellsBase.hpp @@ -254,8 +254,11 @@ class CoupledReservoirAndWellsBase : public CoupledSolver< RESERVOIR_SOLVER, WEL void enableFixedStressPoromechanicsUpdate() { reservoirSolver()->enableFixedStressPoromechanicsUpdate(); } - void setKeepFlowVariablesConstantDuringInitStep( bool const keepFlowVariablesConstantDuringInitStep ) - { reservoirSolver()->setKeepFlowVariablesConstantDuringInitStep( keepFlowVariablesConstantDuringInitStep ); } + void setKeepVariablesConstantDuringInitStep( bool const keepVariablesConstantDuringInitStep ) + { + reservoirSolver()->setKeepVariablesConstantDuringInitStep( keepVariablesConstantDuringInitStep ); + wellSolver()->setKeepVariablesConstantDuringInitStep( keepVariablesConstantDuringInitStep ); + } virtual void saveSequentialIterationState( DomainPartition & domain ) override { reservoirSolver()->saveSequentialIterationState( domain ); } diff --git a/src/coreComponents/physicsSolvers/multiphysics/PoromechanicsSolver.hpp b/src/coreComponents/physicsSolvers/multiphysics/PoromechanicsSolver.hpp index b2fd6d4a603..28cfb5ddef6 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/PoromechanicsSolver.hpp +++ b/src/coreComponents/physicsSolvers/multiphysics/PoromechanicsSolver.hpp @@ -239,7 +239,7 @@ class PoromechanicsSolver : public CoupledSolver< FLOW_SOLVER, MECHANICS_SOLVER real64 const & dt, DomainPartition & domain ) override { - flowSolver()->setKeepFlowVariablesConstantDuringInitStep( m_performStressInitialization ); + flowSolver()->setKeepVariablesConstantDuringInitStep( m_performStressInitialization ); if( this->m_stabilizationType == stabilization::StabilizationType::Global || this->m_stabilizationType == stabilization::StabilizationType::Local ) { From fc9b41a930aed2a1d446fa95a4287d502dedd08f Mon Sep 17 00:00:00 2001 From: Pavel Tomin Date: Thu, 3 Oct 2024 18:00:58 -0500 Subject: [PATCH 02/19] cleanup setMGRStrategy a bit --- ...mpositionalMultiphaseReservoirAndWells.cpp | 29 +++++++++--------- ...mpositionalMultiphaseReservoirAndWells.hpp | 4 +-- .../CoupledReservoirAndWellsBase.hpp | 6 ++++ .../multiphysics/MultiphasePoromechanics.cpp | 29 ++++++++++++------ .../multiphysics/MultiphasePoromechanics.hpp | 7 +++-- .../multiphysics/SinglePhasePoromechanics.cpp | 30 +++++++++++++------ .../multiphysics/SinglePhasePoromechanics.hpp | 6 ++++ ...ePhasePoromechanicsConformingFractures.cpp | 18 +++++++---- ...ePhasePoromechanicsConformingFractures.hpp | 3 +- ...glePhasePoromechanicsEmbeddedFractures.cpp | 21 ++++++++----- ...glePhasePoromechanicsEmbeddedFractures.hpp | 2 ++ .../SinglePhaseReservoirAndWells.cpp | 25 ++++++++-------- .../SinglePhaseReservoirAndWells.hpp | 4 +-- 13 files changed, 119 insertions(+), 65 deletions(-) diff --git a/src/coreComponents/physicsSolvers/multiphysics/CompositionalMultiphaseReservoirAndWells.cpp b/src/coreComponents/physicsSolvers/multiphysics/CompositionalMultiphaseReservoirAndWells.cpp index c01984e2908..d55e50dcf78 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/CompositionalMultiphaseReservoirAndWells.cpp +++ b/src/coreComponents/physicsSolvers/multiphysics/CompositionalMultiphaseReservoirAndWells.cpp @@ -71,15 +71,20 @@ 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; } } @@ -88,15 +93,20 @@ 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_LOG_RANK_0( "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; } } @@ -119,15 +129,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 af10776cdf4..2dcc64d147e 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/CoupledReservoirAndWellsBase.hpp +++ b/src/coreComponents/physicsSolvers/multiphysics/CoupledReservoirAndWellsBase.hpp @@ -295,6 +295,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/MultiphasePoromechanics.cpp b/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanics.cpp index 476ebc35a94..c8037a38f8c 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanics.cpp +++ b/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanics.cpp @@ -44,14 +44,7 @@ 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() @@ -276,10 +269,28 @@ void MultiphasePoromechanics< FLOW_SOLVER, MECHANICS_SOLVER >::initializePostIni InputError ); } + setMGRStrategy(); +} + +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; + } + linearSolverParameters.mgr.separateComponents = true; + linearSolverParameters.mgr.displacementFieldName = solidMechanics::totalDisplacement::key(); + linearSolverParameters.dofsPerNode = 3; } template< typename FLOW_SOLVER, typename MECHANICS_SOLVER > diff --git a/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanics.hpp b/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanics.hpp index faba8e1b6b0..e6ed20f780c 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanics.hpp +++ b/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanics.hpp @@ -108,7 +108,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: @@ -130,7 +134,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 a8899c78569..bd243f1816a 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanics.cpp +++ b/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanics.cpp @@ -45,13 +45,7 @@ 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() @@ -115,17 +109,35 @@ void SinglePhasePoromechanics< FLOW_SOLVER, MECHANICS_SOLVER >::initializePostIn InputError ); } + setMGRStrategy(); +} + +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(); + linearSolverParameters.dofsPerNode = 3; } 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..68adace742f 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 32f5980986e..f8e47f35608 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsConformingFractures.cpp +++ b/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsConformingFractures.cpp @@ -42,12 +42,20 @@ 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; + linearSolverParameters.mgr.separateComponents = false; + linearSolverParameters.mgr.displacementFieldName = solidMechanics::totalDisplacement::key(); + linearSolverParameters.dofsPerNode = 3; } template< typename FLOW_SOLVER > diff --git a/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsConformingFractures.hpp b/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsConformingFractures.hpp index a522d389b86..13a58bcfd97 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsConformingFractures.hpp +++ b/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsConformingFractures.hpp @@ -103,6 +103,8 @@ class SinglePhasePoromechanicsConformingFractures : public SinglePhasePoromechan virtual void updateState( DomainPartition & domain ) override final; + virtual void setMGRStrategy() override; + /**@}*/ private: @@ -176,7 +178,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..8fb9953296b 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsEmbeddedFractures.cpp +++ b/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsEmbeddedFractures.cpp @@ -40,17 +40,24 @@ 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; + linearSolverParameters.mgr.separateComponents = false; + linearSolverParameters.mgr.displacementFieldName = solidMechanics::totalDisplacement::key(); + linearSolverParameters.dofsPerNode = 3; +} + 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..23ae07f5720 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/SinglePhaseReservoirAndWells.cpp +++ b/src/coreComponents/physicsSolvers/multiphysics/SinglePhaseReservoirAndWells.cpp @@ -68,15 +68,20 @@ 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; } } @@ -85,6 +90,11 @@ void 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 ) { @@ -93,7 +103,7 @@ setMGRStrategy() else { // add Reservoir - m_linearSolverParameters.get().mgr.strategy = LinearSolverParameters::MGR::StrategyType::singlePhasePoromechanicsReservoirFVM; + linearSolverParameters.mgr.strategy = LinearSolverParameters::MGR::StrategyType::singlePhasePoromechanicsReservoirFVM; } } @@ -107,15 +117,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..152c47461dc 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/SinglePhaseReservoirAndWells.hpp +++ b/src/coreComponents/physicsSolvers/multiphysics/SinglePhaseReservoirAndWells.hpp @@ -110,14 +110,12 @@ class SinglePhaseReservoirAndWells : public CoupledReservoirAndWellsBase< RESERV virtual void initializePreSubGroups() override; - virtual void initializePostInitialConditionsPreSubGroups() override; + virtual void setMGRStrategy() override; private: SinglePhaseBase * flowSolver() const; - void setMGRStrategy(); - }; } /* namespace geos */ From ff67658b68835cc8a9366d777f6d39d0d0b55cfa Mon Sep 17 00:00:00 2001 From: Pavel Tomin Date: Fri, 4 Oct 2024 10:15:32 -0500 Subject: [PATCH 03/19] missing setMGRStrategy and add log messages --- .../CompositionalMultiphaseReservoirAndWells.cpp | 6 +++++- .../multiphysics/CoupledReservoirAndWellsBase.hpp | 6 ++++-- .../physicsSolvers/multiphysics/MultiphasePoromechanics.cpp | 2 ++ .../physicsSolvers/multiphysics/MultiphasePoromechanics.hpp | 2 +- .../multiphysics/SinglePhasePoromechanics.hpp | 2 +- .../SinglePhasePoromechanicsConformingFractures.cpp | 2 ++ .../SinglePhasePoromechanicsEmbeddedFractures.cpp | 2 ++ .../multiphysics/SinglePhaseReservoirAndWells.cpp | 6 +++++- 8 files changed, 22 insertions(+), 6 deletions(-) diff --git a/src/coreComponents/physicsSolvers/multiphysics/CompositionalMultiphaseReservoirAndWells.cpp b/src/coreComponents/physicsSolvers/multiphysics/CompositionalMultiphaseReservoirAndWells.cpp index d55e50dcf78..c212c5dceb6 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/CompositionalMultiphaseReservoirAndWells.cpp +++ b/src/coreComponents/physicsSolvers/multiphysics/CompositionalMultiphaseReservoirAndWells.cpp @@ -86,6 +86,8 @@ setMGRStrategy() // add Reservoir 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<> @@ -101,13 +103,15 @@ setMGRStrategy() // flow solver here is indeed flow solver, not poromechanics solver if( dynamic_cast< CompositionalMultiphaseHybridFVM * >( flowSolver() ) ) { - 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 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 > diff --git a/src/coreComponents/physicsSolvers/multiphysics/CoupledReservoirAndWellsBase.hpp b/src/coreComponents/physicsSolvers/multiphysics/CoupledReservoirAndWellsBase.hpp index 2dcc64d147e..fd368af9135 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/CoupledReservoirAndWellsBase.hpp +++ b/src/coreComponents/physicsSolvers/multiphysics/CoupledReservoirAndWellsBase.hpp @@ -196,12 +196,14 @@ class CoupledReservoirAndWellsBase : public CoupledSolver< RESERVOIR_SOLVER, WEL { Base::initializePostInitialConditionsPreSubGroups( ); + setMGRStrategy(); + DomainPartition & domain = this->template getGroupByPath< DomainPartition >( "/Problem/domain" ); // 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())); } } @@ -298,7 +300,7 @@ class CoupledReservoirAndWellsBase : public CoupledSolver< RESERVOIR_SOLVER, WEL 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())); + 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 diff --git a/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanics.cpp b/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanics.cpp index c8037a38f8c..99a34ea1756 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanics.cpp +++ b/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanics.cpp @@ -288,6 +288,8 @@ void MultiphasePoromechanics<>::setMGRStrategy() { 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(); linearSolverParameters.dofsPerNode = 3; diff --git a/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanics.hpp b/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanics.hpp index e6ed20f780c..de8e3e3986c 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanics.hpp +++ b/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanics.hpp @@ -111,7 +111,7 @@ class MultiphasePoromechanics : public PoromechanicsSolver< FLOW_SOLVER, MECHANI 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())); + GEOS_ERROR( GEOS_FMT( "{}: MGR strategy is not implemented for {}", this->getName(), this->getCatalogName())); } private: diff --git a/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanics.hpp b/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanics.hpp index 68adace742f..a7dbea41a98 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanics.hpp +++ b/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanics.hpp @@ -135,7 +135,7 @@ class SinglePhasePoromechanics : public PoromechanicsSolver< FLOW_SOLVER, MECHAN 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())); + 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 f8e47f35608..193bab2c640 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsConformingFractures.cpp +++ b/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsConformingFractures.cpp @@ -53,6 +53,8 @@ void SinglePhasePoromechanicsConformingFractures<>::setMGRStrategy() 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.dofsPerNode = 3; diff --git a/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsEmbeddedFractures.cpp b/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsEmbeddedFractures.cpp index 8fb9953296b..8678ca8c10c 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsEmbeddedFractures.cpp +++ b/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsEmbeddedFractures.cpp @@ -53,6 +53,8 @@ void SinglePhasePoromechanicsEmbeddedFractures::setMGRStrategy() 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(); linearSolverParameters.dofsPerNode = 3; diff --git a/src/coreComponents/physicsSolvers/multiphysics/SinglePhaseReservoirAndWells.cpp b/src/coreComponents/physicsSolvers/multiphysics/SinglePhaseReservoirAndWells.cpp index 23ae07f5720..3b047139f65 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/SinglePhaseReservoirAndWells.cpp +++ b/src/coreComponents/physicsSolvers/multiphysics/SinglePhaseReservoirAndWells.cpp @@ -83,6 +83,8 @@ setMGRStrategy() // add Reservoir 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 > @@ -98,13 +100,15 @@ setMGRStrategy() // 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 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 > From 3a2e268ce0ea14b02c2a27af302e5ce53209d362 Mon Sep 17 00:00:00 2001 From: Pavel Tomin Date: Fri, 4 Oct 2024 12:47:16 -0500 Subject: [PATCH 04/19] final pass --- .../SolidMechanicsEmbeddedFractures.cpp | 25 +++++++++++++----- .../SolidMechanicsEmbeddedFractures.hpp | 2 ++ .../contact/SolidMechanicsLagrangeContact.cpp | 26 +++++++++++++++---- .../contact/SolidMechanicsLagrangeContact.hpp | 5 +++- .../CoupledReservoirAndWellsBase.hpp | 9 +++++-- .../multiphysics/HydrofractureSolver.cpp | 21 +++++++++++---- .../multiphysics/HydrofractureSolver.hpp | 1 + .../multiphysics/MultiphasePoromechanics.cpp | 5 ++-- .../multiphysics/SinglePhasePoromechanics.cpp | 5 ++-- ...ePhasePoromechanicsConformingFractures.cpp | 1 - ...glePhasePoromechanicsEmbeddedFractures.cpp | 1 - .../SolidMechanicsLagrangianFEM.cpp | 1 + 12 files changed, 75 insertions(+), 27 deletions(-) diff --git a/src/coreComponents/physicsSolvers/contact/SolidMechanicsEmbeddedFractures.cpp b/src/coreComponents/physicsSolvers/contact/SolidMechanicsEmbeddedFractures.cpp index 90f33a650e0..ccfa1a970f2 100644 --- a/src/coreComponents/physicsSolvers/contact/SolidMechanicsEmbeddedFractures.cpp +++ b/src/coreComponents/physicsSolvers/contact/SolidMechanicsEmbeddedFractures.cpp @@ -64,22 +64,35 @@ SolidMechanicsEmbeddedFractures::~SolidMechanicsEmbeddedFractures() void SolidMechanicsEmbeddedFractures::postInputInitialization() { - SolidMechanicsLagrangianFEM::postInputInitialization(); + ContactSolverBase::postInputInitialization(); - LinearSolverParameters & linParams = m_linearSolverParameters.get(); + LinearSolverParameters & linearSolverParameters = m_linearSolverParameters.get(); if( m_useStaticCondensation ) { - linParams.dofsPerNode = 3; - linParams.isSymmetric = true; - linParams.amg.separateComponents = true; + // configure AMG + 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 2b66ae59da0..7ddb0516dd4 100644 --- a/src/coreComponents/physicsSolvers/contact/SolidMechanicsLagrangeContact.cpp +++ b/src/coreComponents/physicsSolvers/contact/SolidMechanicsLagrangeContact.cpp @@ -71,11 +71,27 @@ SolidMechanicsLagrangeContact::SolidMechanicsLagrangeContact( const string & nam setApplyDefaultValue( 1.0 ). setDescription( "It be used to increase the scale of the stabilization entries. A value < 1.0 results in larger entries in the stabilization matrix." ); - 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::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(); } 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/CoupledReservoirAndWellsBase.hpp b/src/coreComponents/physicsSolvers/multiphysics/CoupledReservoirAndWellsBase.hpp index fd368af9135..78f3134f54d 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/CoupledReservoirAndWellsBase.hpp +++ b/src/coreComponents/physicsSolvers/multiphysics/CoupledReservoirAndWellsBase.hpp @@ -196,8 +196,6 @@ class CoupledReservoirAndWellsBase : public CoupledSolver< RESERVOIR_SOLVER, WEL { Base::initializePostInitialConditionsPreSubGroups( ); - setMGRStrategy(); - DomainPartition & domain = this->template getGroupByPath< DomainPartition >( "/Problem/domain" ); // Validate well perforations: Ensure that each perforation is in a region targeted by the solver @@ -207,6 +205,13 @@ class CoupledReservoirAndWellsBase : public CoupledSolver< RESERVOIR_SOLVER, WEL } } + void postInputInitialization() + { + Base::postInputInitialization(); + + setMGRStrategy(); + } + virtual void implicitStepSetup( real64 const & time_n, real64 const & dt, diff --git a/src/coreComponents/physicsSolvers/multiphysics/HydrofractureSolver.cpp b/src/coreComponents/physicsSolvers/multiphysics/HydrofractureSolver.cpp index 301eb93de28..a6aaedea293 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/HydrofractureSolver.cpp +++ b/src/coreComponents/physicsSolvers/multiphysics/HydrofractureSolver.cpp @@ -76,13 +76,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 > @@ -153,6 +162,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 fd850f65b5f..4c022dc0e42 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/HydrofractureSolver.hpp +++ b/src/coreComponents/physicsSolvers/multiphysics/HydrofractureSolver.hpp @@ -211,6 +211,7 @@ class HydrofractureSolver : public POROMECHANICS_SOLVER DofManager const & dofManager, CRSMatrix< real64, globalIndex > & localMatrix ); + void setMGRStrategy(); private: diff --git a/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanics.cpp b/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanics.cpp index 99a34ea1756..a7ea8d28e08 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanics.cpp +++ b/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanics.cpp @@ -51,6 +51,8 @@ void MultiphasePoromechanics< FLOW_SOLVER, MECHANICS_SOLVER >::postInputInitiali { 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 {} = {}", @@ -268,8 +270,6 @@ void MultiphasePoromechanics< FLOW_SOLVER, MECHANICS_SOLVER >::initializePostIni getCatalogName(), this->getDataContext(), poromechanicsTargetRegionNames[i], this->flowSolver()->getDataContext() ), InputError ); } - - setMGRStrategy(); } template<> @@ -292,7 +292,6 @@ void MultiphasePoromechanics<>::setMGRStrategy() EnumStrings< LinearSolverParameters::MGR::StrategyType >::toString( linearSolverParameters.mgr.strategy ))); linearSolverParameters.mgr.separateComponents = true; linearSolverParameters.mgr.displacementFieldName = solidMechanics::totalDisplacement::key(); - linearSolverParameters.dofsPerNode = 3; } template< typename FLOW_SOLVER, typename MECHANICS_SOLVER > diff --git a/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanics.cpp b/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanics.cpp index bd243f1816a..5a7cd77dc56 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanics.cpp +++ b/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanics.cpp @@ -52,6 +52,8 @@ void SinglePhasePoromechanics< FLOW_SOLVER, MECHANICS_SOLVER >::postInputInitial { 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 {} = {}", @@ -108,8 +110,6 @@ void SinglePhasePoromechanics< FLOW_SOLVER, MECHANICS_SOLVER >::initializePostIn getCatalogName(), this->getDataContext(), poromechanicsTargetRegionNames[i], this->flowSolver()->getDataContext() ), InputError ); } - - setMGRStrategy(); } template<> @@ -137,7 +137,6 @@ void SinglePhasePoromechanics<>::setMGRStrategy() } linearSolverParameters.mgr.separateComponents = true; linearSolverParameters.mgr.displacementFieldName = solidMechanics::totalDisplacement::key(); - linearSolverParameters.dofsPerNode = 3; } template< typename FLOW_SOLVER, typename MECHANICS_SOLVER > diff --git a/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsConformingFractures.cpp b/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsConformingFractures.cpp index 193bab2c640..2cad8e3af99 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsConformingFractures.cpp +++ b/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsConformingFractures.cpp @@ -57,7 +57,6 @@ void SinglePhasePoromechanicsConformingFractures<>::setMGRStrategy() EnumStrings< LinearSolverParameters::MGR::StrategyType >::toString( linearSolverParameters.mgr.strategy ))); linearSolverParameters.mgr.separateComponents = false; linearSolverParameters.mgr.displacementFieldName = solidMechanics::totalDisplacement::key(); - linearSolverParameters.dofsPerNode = 3; } template< typename FLOW_SOLVER > diff --git a/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsEmbeddedFractures.cpp b/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsEmbeddedFractures.cpp index 8678ca8c10c..f99daf989c6 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsEmbeddedFractures.cpp +++ b/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsEmbeddedFractures.cpp @@ -57,7 +57,6 @@ void SinglePhasePoromechanicsEmbeddedFractures::setMGRStrategy() EnumStrings< LinearSolverParameters::MGR::StrategyType >::toString( linearSolverParameters.mgr.strategy ))); linearSolverParameters.mgr.separateComponents = false; linearSolverParameters.mgr.displacementFieldName = solidMechanics::totalDisplacement::key(); - linearSolverParameters.dofsPerNode = 3; } void SinglePhasePoromechanicsEmbeddedFractures::postInputInitialization() diff --git a/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsLagrangianFEM.cpp b/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsLagrangianFEM.cpp index 5794878d59e..d99eb6e257e 100644 --- a/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsLagrangianFEM.cpp +++ b/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsLagrangianFEM.cpp @@ -131,6 +131,7 @@ void SolidMechanicsLagrangianFEM::postInputInitialization() { SolverBase::postInputInitialization(); + // configure AMG LinearSolverParameters & linParams = m_linearSolverParameters.get(); linParams.isSymmetric = true; linParams.dofsPerNode = 3; From 06cbc1852436f7d1ff57f42420d3c6c81ab4d42c Mon Sep 17 00:00:00 2001 From: Pavel Tomin Date: Fri, 4 Oct 2024 16:55:58 -0500 Subject: [PATCH 05/19] enable fim mode --- .../multiphysics/MultiphasePoromechanics.cpp | 80 +++++++++++++++++-- .../multiphysics/SinglePhasePoromechanics.cpp | 75 +++++++++++++++-- .../SinglePhaseReservoirAndWells.cpp | 4 +- 3 files changed, 143 insertions(+), 16 deletions(-) diff --git a/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanics.cpp b/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanics.cpp index a7ea8d28e08..e7ccaebe378 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanics.cpp +++ b/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanics.cpp @@ -23,6 +23,7 @@ #include "constitutive/fluid/multifluid/MultiFluidBase.hpp" #include "constitutive/solid/PorousSolid.hpp" +#include "physicsSolvers/fluidFlow/CompositionalMultiphaseHybridFVM.hpp" #include "physicsSolvers/fluidFlow/FlowSolverBaseFields.hpp" #include "physicsSolvers/multiphysics/poromechanicsKernels/MultiphasePoromechanics.hpp" #include "physicsSolvers/multiphysics/poromechanicsKernels/ThermalMultiphasePoromechanics.hpp" @@ -52,13 +53,6 @@ void MultiphasePoromechanics< FLOW_SOLVER, MECHANICS_SOLVER >::postInputInitiali 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 {} = {}", - this->getDataContext(), catalogName(), NonlinearSolverParameters::viewKeysStruct::couplingTypeString(), - EnumStrings< NonlinearSolverParameters::CouplingType >::toString( NonlinearSolverParameters::CouplingType::Sequential ) - )); } template< typename FLOW_SOLVER, typename MECHANICS_SOLVER > @@ -80,6 +74,46 @@ void MultiphasePoromechanics< FLOW_SOLVER, MECHANICS_SOLVER >::assembleSystem( r { GEOS_MARK_FUNCTION; + // Steps 1 and 2: compute element-based terms (mechanics and local flow terms) + assembleElementBasedTerms( time, + dt, + domain, + dofManager, + localMatrix, + localRhs ); + + // step 3: compute the fluxes (face-based contributions) + + if( m_stabilizationType == StabilizationType::Global || + m_stabilizationType == StabilizationType::Local ) + { + this->flowSolver()->assembleStabilizedFluxTerms( dt, + domain, + dofManager, + localMatrix, + localRhs ); + } + else + { + this->flowSolver()->assembleFluxTerms( dt, + domain, + dofManager, + localMatrix, + localRhs ); + } +} + +template<> +void MultiphasePoromechanics< CompositionalMultiphaseReservoirAndWells<>, SolidMechanicsLagrangianFEM >::assembleSystem( real64 const time, + real64 const dt, + DomainPartition & domain, + DofManager const & dofManager, + CRSMatrixView< real64, globalIndex const > const & localMatrix, + arrayView1d< real64 > const & localRhs ) +{ + GEOS_MARK_FUNCTION; + + // Steps 1 and 2: compute element-based terms (mechanics and local flow terms) assembleElementBasedTerms( time, dt, domain, @@ -106,6 +140,11 @@ void MultiphasePoromechanics< FLOW_SOLVER, MECHANICS_SOLVER >::assembleSystem( r localMatrix, localRhs ); } + + // step 4: assemble well contributions + + this->flowSolver()->wellSolver()->assembleSystem(time, dt, domain, dofManager, localMatrix, localRhs); + this->flowSolver()->assembleCouplingTerms( time, dt, domain, dofManager, localMatrix, localRhs ); } template< typename FLOW_SOLVER, typename MECHANICS_SOLVER > @@ -294,6 +333,33 @@ void MultiphasePoromechanics<>::setMGRStrategy() linearSolverParameters.mgr.displacementFieldName = solidMechanics::totalDisplacement::key(); } +template<> +void MultiphasePoromechanics, SolidMechanicsLagrangianFEM>::setMGRStrategy() +{ + // same as 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() ) ) + { + GEOS_ERROR( "The poromechanics MGR strategy for hybrid FVM is not implemented" ); + } + else + { + // add Reservoir + 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 ))); + // TODO check if needed + //linearSolverParameters.mgr.separateComponents = true; + //linearSolverParameters.mgr.displacementFieldName = solidMechanics::totalDisplacement::key(); +} + template< typename FLOW_SOLVER, typename MECHANICS_SOLVER > void MultiphasePoromechanics< FLOW_SOLVER, MECHANICS_SOLVER >::updateBulkDensity( ElementSubRegionBase & subRegion ) { diff --git a/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanics.cpp b/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanics.cpp index 5a7cd77dc56..55397e80824 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanics.cpp +++ b/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanics.cpp @@ -53,13 +53,6 @@ void SinglePhasePoromechanics< FLOW_SOLVER, MECHANICS_SOLVER >::postInputInitial 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 {} = {}", - this->getName(), catalogName(), NonlinearSolverParameters::viewKeysStruct::couplingTypeString(), - EnumStrings< NonlinearSolverParameters::CouplingType >::toString( NonlinearSolverParameters::CouplingType::Sequential ) - )); } template< typename FLOW_SOLVER, typename MECHANICS_SOLVER > @@ -139,6 +132,33 @@ void SinglePhasePoromechanics<>::setMGRStrategy() linearSolverParameters.mgr.displacementFieldName = solidMechanics::totalDisplacement::key(); } +template<> +void SinglePhasePoromechanics, SolidMechanicsLagrangianFEM>::setMGRStrategy() +{ + // same as 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_ERROR( "The poromechanics MGR strategy for hybrid FVM is not implemented" ); + } + else + { + // add Reservoir + 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 ))); + // TODO check if needed + //linearSolverParameters.mgr.separateComponents = true; + //linearSolverParameters.mgr.displacementFieldName = solidMechanics::totalDisplacement::key(); +} + template< typename FLOW_SOLVER, typename MECHANICS_SOLVER > void SinglePhasePoromechanics< FLOW_SOLVER, MECHANICS_SOLVER >::assembleSystem( real64 const time_n, real64 const dt, @@ -174,7 +194,48 @@ void SinglePhasePoromechanics< FLOW_SOLVER, MECHANICS_SOLVER >::assembleSystem( localMatrix, localRhs ); } +} + +template<> +void SinglePhasePoromechanics< SinglePhaseReservoirAndWells<>, SolidMechanicsLagrangianFEM >::assembleSystem( real64 const time_n, + real64 const dt, + DomainPartition & domain, + DofManager const & dofManager, + CRSMatrixView< real64, globalIndex const > const & localMatrix, + arrayView1d< real64 > const & localRhs ) +{ + GEOS_MARK_FUNCTION; + + // Steps 1 and 2: compute element-based terms (mechanics and local flow terms) + assembleElementBasedTerms( time_n, + dt, + domain, + dofManager, + localMatrix, + localRhs ); + + // Step 3: compute the fluxes (face-based contributions) + if( m_stabilizationType == StabilizationType::Global || m_stabilizationType == StabilizationType::Local ) + { + this->flowSolver()->assembleStabilizedFluxTerms( dt, + domain, + dofManager, + localMatrix, + localRhs ); + } + else + { + this->flowSolver()->assembleFluxTerms( dt, + domain, + dofManager, + localMatrix, + localRhs ); + } + + // step 4: assemble well contributions + this->flowSolver()->wellSolver()->assembleSystem(time_n, dt, domain, dofManager, localMatrix, localRhs); + this->flowSolver()->assembleCouplingTerms( time_n, dt, domain, dofManager, localMatrix, localRhs ); } template< typename FLOW_SOLVER, typename MECHANICS_SOLVER > diff --git a/src/coreComponents/physicsSolvers/multiphysics/SinglePhaseReservoirAndWells.cpp b/src/coreComponents/physicsSolvers/multiphysics/SinglePhaseReservoirAndWells.cpp index 3b047139f65..f7ad78a74a7 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/SinglePhaseReservoirAndWells.cpp +++ b/src/coreComponents/physicsSolvers/multiphysics/SinglePhaseReservoirAndWells.cpp @@ -87,9 +87,9 @@ setMGRStrategy() 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(); From 74aef74bd5c8c01e7c299689eb013d2ea25b6b1f Mon Sep 17 00:00:00 2001 From: Pavel Tomin Date: Fri, 4 Oct 2024 17:01:46 -0500 Subject: [PATCH 06/19] clarify --- .../multiphysics/SinglePhaseReservoirAndWells.cpp | 4 ++-- .../multiphysics/SinglePhaseReservoirAndWells.hpp | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/coreComponents/physicsSolvers/multiphysics/SinglePhaseReservoirAndWells.cpp b/src/coreComponents/physicsSolvers/multiphysics/SinglePhaseReservoirAndWells.cpp index 3b047139f65..f7ad78a74a7 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/SinglePhaseReservoirAndWells.cpp +++ b/src/coreComponents/physicsSolvers/multiphysics/SinglePhaseReservoirAndWells.cpp @@ -87,9 +87,9 @@ setMGRStrategy() 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(); diff --git a/src/coreComponents/physicsSolvers/multiphysics/SinglePhaseReservoirAndWells.hpp b/src/coreComponents/physicsSolvers/multiphysics/SinglePhaseReservoirAndWells.hpp index 152c47461dc..c88b9926471 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/SinglePhaseReservoirAndWells.hpp +++ b/src/coreComponents/physicsSolvers/multiphysics/SinglePhaseReservoirAndWells.hpp @@ -110,7 +110,11 @@ class SinglePhaseReservoirAndWells : public CoupledReservoirAndWellsBase< RESERV virtual void initializePreSubGroups() override; - virtual void setMGRStrategy() 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: From bff53145eea61630b7e885489964b081c1b4669e Mon Sep 17 00:00:00 2001 From: Pavel Tomin Date: Fri, 4 Oct 2024 17:21:23 -0500 Subject: [PATCH 07/19] Update SolidMechanicsEmbeddedFractures.cpp --- .../physicsSolvers/contact/SolidMechanicsEmbeddedFractures.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/coreComponents/physicsSolvers/contact/SolidMechanicsEmbeddedFractures.cpp b/src/coreComponents/physicsSolvers/contact/SolidMechanicsEmbeddedFractures.cpp index ccfa1a970f2..c1345d2a8be 100644 --- a/src/coreComponents/physicsSolvers/contact/SolidMechanicsEmbeddedFractures.cpp +++ b/src/coreComponents/physicsSolvers/contact/SolidMechanicsEmbeddedFractures.cpp @@ -66,11 +66,10 @@ void SolidMechanicsEmbeddedFractures::postInputInitialization() { ContactSolverBase::postInputInitialization(); - LinearSolverParameters & linearSolverParameters = m_linearSolverParameters.get(); - if( m_useStaticCondensation ) { // configure AMG + LinearSolverParameters & linearSolverParameters = m_linearSolverParameters.get(); linearSolverParameters.dofsPerNode = 3; linearSolverParameters.isSymmetric = true; linearSolverParameters.amg.separateComponents = true; From cb874dc7069d701d27b86ad8c9bbe0a0ae5da7c3 Mon Sep 17 00:00:00 2001 From: Pavel Tomin Date: Fri, 4 Oct 2024 17:22:24 -0500 Subject: [PATCH 08/19] code style --- .../multiphysics/MultiphasePoromechanics.cpp | 14 +++++++------- .../multiphysics/SinglePhasePoromechanics.cpp | 14 +++++++------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanics.cpp b/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanics.cpp index e7ccaebe378..4cf41400b03 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanics.cpp +++ b/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanics.cpp @@ -105,11 +105,11 @@ void MultiphasePoromechanics< FLOW_SOLVER, MECHANICS_SOLVER >::assembleSystem( r template<> void MultiphasePoromechanics< CompositionalMultiphaseReservoirAndWells<>, SolidMechanicsLagrangianFEM >::assembleSystem( real64 const time, - real64 const dt, - DomainPartition & domain, - DofManager const & dofManager, - CRSMatrixView< real64, globalIndex const > const & localMatrix, - arrayView1d< real64 > const & localRhs ) + real64 const dt, + DomainPartition & domain, + DofManager const & dofManager, + CRSMatrixView< real64, globalIndex const > const & localMatrix, + arrayView1d< real64 > const & localRhs ) { GEOS_MARK_FUNCTION; @@ -143,7 +143,7 @@ void MultiphasePoromechanics< CompositionalMultiphaseReservoirAndWells<>, SolidM // step 4: assemble well contributions - this->flowSolver()->wellSolver()->assembleSystem(time, dt, domain, dofManager, localMatrix, localRhs); + this->flowSolver()->wellSolver()->assembleSystem( time, dt, domain, dofManager, localMatrix, localRhs ); this->flowSolver()->assembleCouplingTerms( time, dt, domain, dofManager, localMatrix, localRhs ); } @@ -334,7 +334,7 @@ void MultiphasePoromechanics<>::setMGRStrategy() } template<> -void MultiphasePoromechanics, SolidMechanicsLagrangianFEM>::setMGRStrategy() +void MultiphasePoromechanics< CompositionalMultiphaseReservoirAndWells<>, SolidMechanicsLagrangianFEM >::setMGRStrategy() { // same as CompositionalMultiphaseReservoirAndWells< MultiphasePoromechanics<> >::setMGRStrategy diff --git a/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanics.cpp b/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanics.cpp index 55397e80824..8c45d78c210 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanics.cpp +++ b/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanics.cpp @@ -133,7 +133,7 @@ void SinglePhasePoromechanics<>::setMGRStrategy() } template<> -void SinglePhasePoromechanics, SolidMechanicsLagrangianFEM>::setMGRStrategy() +void SinglePhasePoromechanics< SinglePhaseReservoirAndWells<>, SolidMechanicsLagrangianFEM >::setMGRStrategy() { // same as SinglePhaseReservoirAndWells< SinglePhasePoromechanics<> >::setMGRStrategy @@ -198,11 +198,11 @@ void SinglePhasePoromechanics< FLOW_SOLVER, MECHANICS_SOLVER >::assembleSystem( template<> void SinglePhasePoromechanics< SinglePhaseReservoirAndWells<>, SolidMechanicsLagrangianFEM >::assembleSystem( real64 const time_n, - real64 const dt, - DomainPartition & domain, - DofManager const & dofManager, - CRSMatrixView< real64, globalIndex const > const & localMatrix, - arrayView1d< real64 > const & localRhs ) + real64 const dt, + DomainPartition & domain, + DofManager const & dofManager, + CRSMatrixView< real64, globalIndex const > const & localMatrix, + arrayView1d< real64 > const & localRhs ) { GEOS_MARK_FUNCTION; @@ -234,7 +234,7 @@ void SinglePhasePoromechanics< SinglePhaseReservoirAndWells<>, SolidMechanicsLag // step 4: assemble well contributions - this->flowSolver()->wellSolver()->assembleSystem(time_n, dt, domain, dofManager, localMatrix, localRhs); + this->flowSolver()->wellSolver()->assembleSystem( time_n, dt, domain, dofManager, localMatrix, localRhs ); this->flowSolver()->assembleCouplingTerms( time_n, dt, domain, dofManager, localMatrix, localRhs ); } From d10f4d2b765c53088d13a800e31f80ef03637d06 Mon Sep 17 00:00:00 2001 From: Pavel Tomin Date: Mon, 14 Oct 2024 16:47:22 -0500 Subject: [PATCH 09/19] Update WellSolverBase.cpp From 1c67dc67c3186399d2a92bec979ad4eb30c1df0b Mon Sep 17 00:00:00 2001 From: Pavel Tomin Date: Mon, 28 Oct 2024 14:19:53 -0500 Subject: [PATCH 10/19] bug fix --- .../physicsSolvers/fluidFlow/wells/WellSolverBase.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/coreComponents/physicsSolvers/fluidFlow/wells/WellSolverBase.cpp b/src/coreComponents/physicsSolvers/fluidFlow/wells/WellSolverBase.cpp index f24f0dfde49..833c331268c 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/wells/WellSolverBase.cpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/wells/WellSolverBase.cpp @@ -41,7 +41,8 @@ WellSolverBase::WellSolverBase( string const & name, : SolverBase( name, parent ), m_numDofPerWellElement( 0 ), m_numDofPerResElement( 0 ), - m_ratesOutputDir( joinPath( OutputBase::getOutputDirectory(), name + "_rates" ) ) + m_ratesOutputDir( joinPath( OutputBase::getOutputDirectory(), name + "_rates" ) ), + m_keepVariablesConstantDuringInitStep( 0 ) { this->getWrapper< string >( viewKeyStruct::discretizationString() ). setInputFlag( InputFlags::FALSE ); From ab6763dcf7a4af8cc73d8bf056cfdd9133b8b767 Mon Sep 17 00:00:00 2001 From: Pavel Tomin Date: Mon, 28 Oct 2024 19:19:11 -0500 Subject: [PATCH 11/19] build fix --- .../SinglePhasePoromechanicsConformingFractures.hpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsConformingFractures.hpp b/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsConformingFractures.hpp index 13a58bcfd97..7176e5f1bee 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsConformingFractures.hpp +++ b/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsConformingFractures.hpp @@ -103,7 +103,11 @@ class SinglePhasePoromechanicsConformingFractures : public SinglePhasePoromechan virtual void updateState( DomainPartition & domain ) override final; - virtual void setMGRStrategy() 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())); + } /**@}*/ From db683d13ed0dce86ac29584a6db7f220b6ede9e7 Mon Sep 17 00:00:00 2001 From: Pavel Tomin Date: Mon, 28 Oct 2024 20:49:42 -0500 Subject: [PATCH 12/19] build fix --- .../multiphysics/CoupledReservoirAndWellsBase.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/coreComponents/physicsSolvers/multiphysics/CoupledReservoirAndWellsBase.hpp b/src/coreComponents/physicsSolvers/multiphysics/CoupledReservoirAndWellsBase.hpp index 88340c85983..90908cc8318 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/CoupledReservoirAndWellsBase.hpp +++ b/src/coreComponents/physicsSolvers/multiphysics/CoupledReservoirAndWellsBase.hpp @@ -205,7 +205,7 @@ class CoupledReservoirAndWellsBase : public CoupledSolver< RESERVOIR_SOLVER, WEL } } - void postInputInitialization() + virtual void postInputInitialization() override { Base::postInputInitialization(); From a5b1931a8cbb2c60351e1ab188c6c4cef8211f7b Mon Sep 17 00:00:00 2001 From: Pavel Tomin Date: Mon, 28 Oct 2024 20:51:36 -0500 Subject: [PATCH 13/19] Update CoupledReservoirAndWellsBase.hpp --- .../multiphysics/CoupledReservoirAndWellsBase.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/coreComponents/physicsSolvers/multiphysics/CoupledReservoirAndWellsBase.hpp b/src/coreComponents/physicsSolvers/multiphysics/CoupledReservoirAndWellsBase.hpp index 88340c85983..a726c5c3dc6 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/CoupledReservoirAndWellsBase.hpp +++ b/src/coreComponents/physicsSolvers/multiphysics/CoupledReservoirAndWellsBase.hpp @@ -205,7 +205,8 @@ class CoupledReservoirAndWellsBase : public CoupledSolver< RESERVOIR_SOLVER, WEL } } - void postInputInitialization() + virtual void + postInputInitialization() override { Base::postInputInitialization(); From 5cb58fbd519cafc231951eb1cf227e7e80268d6f Mon Sep 17 00:00:00 2001 From: Pavel Tomin Date: Mon, 28 Oct 2024 20:53:03 -0500 Subject: [PATCH 14/19] Update SinglePhasePoromechanicsConformingFractures.hpp --- .../SinglePhasePoromechanicsConformingFractures.hpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsConformingFractures.hpp b/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsConformingFractures.hpp index 13a58bcfd97..7176e5f1bee 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsConformingFractures.hpp +++ b/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsConformingFractures.hpp @@ -103,7 +103,11 @@ class SinglePhasePoromechanicsConformingFractures : public SinglePhasePoromechan virtual void updateState( DomainPartition & domain ) override final; - virtual void setMGRStrategy() 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())); + } /**@}*/ From 20a5f9224afbcb28d5210dbaa2d87cc2c70c32ef Mon Sep 17 00:00:00 2001 From: Pavel Tomin Date: Tue, 29 Oct 2024 09:28:31 -0500 Subject: [PATCH 15/19] build fix --- .../physicsSolvers/multiphysics/HydrofractureSolver.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/coreComponents/physicsSolvers/multiphysics/HydrofractureSolver.hpp b/src/coreComponents/physicsSolvers/multiphysics/HydrofractureSolver.hpp index d77d0f2f321..cabe685c918 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/HydrofractureSolver.hpp +++ b/src/coreComponents/physicsSolvers/multiphysics/HydrofractureSolver.hpp @@ -212,7 +212,7 @@ class HydrofractureSolver : public POROMECHANICS_SOLVER DofManager const & dofManager, CRSMatrix< real64, globalIndex > & localMatrix ); - void setMGRStrategy(); + virtual void setMGRStrategy() override; private: From 20d1650d7fd0a36fcc61dec9458df1c648b588d0 Mon Sep 17 00:00:00 2001 From: Pavel Tomin Date: Wed, 6 Nov 2024 15:47:30 -0600 Subject: [PATCH 16/19] Revert "Merge remote-tracking branch 'origin/pt/set-mgr-strategy' into pt/enable-fim" This reverts commit 8cc05d37327bcf3956e6b2a7dc62fdaa9f294046, reversing changes made to db683d13ed0dce86ac29584a6db7f220b6ede9e7. --- .../multiphysics/CoupledReservoirAndWellsBase.hpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/coreComponents/physicsSolvers/multiphysics/CoupledReservoirAndWellsBase.hpp b/src/coreComponents/physicsSolvers/multiphysics/CoupledReservoirAndWellsBase.hpp index 9971229646d..b8a6fc5a098 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/CoupledReservoirAndWellsBase.hpp +++ b/src/coreComponents/physicsSolvers/multiphysics/CoupledReservoirAndWellsBase.hpp @@ -205,8 +205,7 @@ class CoupledReservoirAndWellsBase : public CoupledSolver< RESERVOIR_SOLVER, WEL } } - virtual void - postInputInitialization() override + virtual void postInputInitialization() override { Base::postInputInitialization(); From 1b1a986eec5b8baed862fca59219a8be1ed1daad Mon Sep 17 00:00:00 2001 From: Pavel Tomin Date: Wed, 6 Nov 2024 15:51:47 -0600 Subject: [PATCH 17/19] Revert "Revert "Merge remote-tracking branch 'origin/pt/set-mgr-strategy' into pt/enable-fim"" This reverts commit 20d1650d7fd0a36fcc61dec9458df1c648b588d0. --- .../multiphysics/CoupledReservoirAndWellsBase.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/coreComponents/physicsSolvers/multiphysics/CoupledReservoirAndWellsBase.hpp b/src/coreComponents/physicsSolvers/multiphysics/CoupledReservoirAndWellsBase.hpp index b8a6fc5a098..9971229646d 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/CoupledReservoirAndWellsBase.hpp +++ b/src/coreComponents/physicsSolvers/multiphysics/CoupledReservoirAndWellsBase.hpp @@ -205,7 +205,8 @@ class CoupledReservoirAndWellsBase : public CoupledSolver< RESERVOIR_SOLVER, WEL } } - virtual void postInputInitialization() override + virtual void + postInputInitialization() override { Base::postInputInitialization(); From 5b6ac85ebd6d57287996cb5be20bdb4c7b9a120e Mon Sep 17 00:00:00 2001 From: Pavel Tomin Date: Thu, 14 Nov 2024 17:35:48 -0600 Subject: [PATCH 18/19] code style and missing changes --- ...ompositionalMultiphaseReservoirAndWells.cpp | 4 ++-- .../multiphysics/MultiphasePoromechanics.cpp | 2 +- .../multiphysics/SinglePhasePoromechanics.cpp | 4 ++-- .../SinglePhaseReservoirAndWells.cpp | 18 +++++++++++------- 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/src/coreComponents/physicsSolvers/multiphysics/CompositionalMultiphaseReservoirAndWells.cpp b/src/coreComponents/physicsSolvers/multiphysics/CompositionalMultiphaseReservoirAndWells.cpp index a4e8d5ec45f..235405222a7 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/CompositionalMultiphaseReservoirAndWells.cpp +++ b/src/coreComponents/physicsSolvers/multiphysics/CompositionalMultiphaseReservoirAndWells.cpp @@ -90,7 +90,7 @@ setMGRStrategy() if( isThermal() ) { GEOS_ERROR( GEOS_FMT( "{}: MGR strategy is not implemented for thermal {}/{}", - this->getName(), this->getCatalogName(), this->flowSolver()->getCatalogName())); + this->getName(), this->getCatalogName(), this->flowSolver()->getCatalogName())); } else { @@ -128,7 +128,7 @@ setMGRStrategy() if( dynamic_cast< CompositionalMultiphaseHybridFVM * >( this->flowSolver() ) ) { GEOS_ERROR( GEOS_FMT( "{}: MGR strategy is not implemented for {}/{}", - this->getName(), this->getCatalogName(), this->flowSolver()->getCatalogName() ) ); + this->getName(), this->getCatalogName(), this->flowSolver()->getCatalogName() ) ); } else { diff --git a/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanics.cpp b/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanics.cpp index 48dfb32d703..dc23176a276 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanics.cpp +++ b/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanics.cpp @@ -258,7 +258,7 @@ void MultiphasePoromechanics<>::setMGRStrategy() if( dynamic_cast< CompositionalMultiphaseHybridFVM * >( this->flowSolver() ) ) { GEOS_ERROR( GEOS_FMT( "{}: MGR strategy is not implemented for {}/{}", - this->getName(), this->getCatalogName(), this->flowSolver()->getCatalogName())); + this->getName(), this->getCatalogName(), this->flowSolver()->getCatalogName())); } else { diff --git a/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanics.cpp b/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanics.cpp index ba798d6ab3b..5a2748804d6 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanics.cpp +++ b/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanics.cpp @@ -129,14 +129,14 @@ void SinglePhasePoromechanics<>::setMGRStrategy() if( this->m_isThermal ) { GEOS_ERROR( GEOS_FMT( "{}: MGR strategy is not implemented for thermal {}/{}", - this->getName(), this->getCatalogName(), this->flowSolver()->getCatalogName() )); + this->getName(), this->getCatalogName(), this->flowSolver()->getCatalogName() )); } else { linearSolverParameters.mgr.strategy = LinearSolverParameters::MGR::StrategyType::hybridSinglePhasePoromechanics; } } - else + else { if( this->m_isThermal ) { diff --git a/src/coreComponents/physicsSolvers/multiphysics/SinglePhaseReservoirAndWells.cpp b/src/coreComponents/physicsSolvers/multiphysics/SinglePhaseReservoirAndWells.cpp index 9325d77c6b6..688dcdd1e40 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/SinglePhaseReservoirAndWells.cpp +++ b/src/coreComponents/physicsSolvers/multiphysics/SinglePhaseReservoirAndWells.cpp @@ -24,6 +24,7 @@ #include "mesh/PerforationFields.hpp" #include "physicsSolvers/KernelLaunchSelectors.hpp" #include "physicsSolvers/fluidFlow/SinglePhaseFVM.hpp" +#include "physicsSolvers/fluidFlow/SinglePhaseHybridFVM.hpp" #include "physicsSolvers/fluidFlow/wells/SinglePhaseWellFields.hpp" #include "physicsSolvers/fluidFlow/wells/WellControls.hpp" #include "physicsSolvers/fluidFlow/wells/kernels/SinglePhaseWellKernels.hpp" @@ -74,14 +75,15 @@ setMGRStrategy() if( linearSolverParameters.preconditionerType != LinearSolverParameters::PreconditionerType::mgr ) return; - if( flowSolver()->getLinearSolverParameters().mgr.strategy == LinearSolverParameters::MGR::StrategyType::singlePhaseHybridFVM ) + linearSolverParameters.mgr.separateComponents = true; + linearSolverParameters.dofsPerNode = 3; + + if( dynamic_cast< SinglePhaseHybridFVM * >( this->flowSolver() ) ) { - // add Reservoir linearSolverParameters.mgr.strategy = LinearSolverParameters::MGR::StrategyType::singlePhaseReservoirHybridFVM; } else { - // add Reservoir linearSolverParameters.mgr.strategy = LinearSolverParameters::MGR::StrategyType::singlePhaseReservoirFVM; } GEOS_LOG_LEVEL_RANK_0( 1, GEOS_FMT( "{}: MGR strategy set to {}", getName(), @@ -98,14 +100,16 @@ setMGRStrategy() 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 ) + linearSolverParameters.mgr.separateComponents = true; + linearSolverParameters.dofsPerNode = 3; + + if( dynamic_cast< SinglePhaseHybridFVM * >( this->flowSolver() ) ) { - GEOS_ERROR( "The poromechanics MGR strategy for hybrid FVM is not implemented" ); + GEOS_ERROR( GEOS_FMT( "{}: MGR strategy is not implemented for poromechanics {}/{}", + this->getName(), this->getCatalogName(), this->flowSolver()->getCatalogName())); } else { - // add Reservoir linearSolverParameters.mgr.strategy = LinearSolverParameters::MGR::StrategyType::singlePhasePoromechanicsReservoirFVM; } GEOS_LOG_LEVEL_RANK_0( 1, GEOS_FMT( "{}: MGR strategy set to {}", this->getName(), From 5a1e05c33dd1994931837977b42f4b38cb953954 Mon Sep 17 00:00:00 2001 From: Pavel Tomin Date: Thu, 14 Nov 2024 17:42:35 -0600 Subject: [PATCH 19/19] sync --- .../multiphysics/MultiphasePoromechanics.cpp | 13 ++++++------- .../multiphysics/SinglePhasePoromechanics.cpp | 13 ++++++------- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanics.cpp b/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanics.cpp index c4de6c9d349..d4025b4a31c 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanics.cpp +++ b/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanics.cpp @@ -324,21 +324,20 @@ void MultiphasePoromechanics< CompositionalMultiphaseReservoirAndWells<>, SolidM if( linearSolverParameters.preconditionerType != LinearSolverParameters::PreconditionerType::mgr ) return; - // flow solver here is indeed flow solver, not poromechanics solver - if( dynamic_cast< CompositionalMultiphaseHybridFVM * >( flowSolver() ) ) + linearSolverParameters.mgr.separateComponents = true; + linearSolverParameters.dofsPerNode = 3; + + if( dynamic_cast< CompositionalMultiphaseHybridFVM * >( this->flowSolver() ) ) { - GEOS_ERROR( "The poromechanics MGR strategy for hybrid FVM is not implemented" ); + GEOS_ERROR( GEOS_FMT( "{}: MGR strategy is not implemented for {}/{}", + this->getName(), this->getCatalogName(), this->flowSolver()->getCatalogName() ) ); } else { - // add Reservoir 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 ))); - // TODO check if needed - //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.cpp b/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanics.cpp index 07d2e04f4dc..66635dab8a6 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanics.cpp +++ b/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanics.cpp @@ -154,21 +154,20 @@ void SinglePhasePoromechanics< SinglePhaseReservoirAndWells<>, SolidMechanicsLag 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 ) + linearSolverParameters.mgr.separateComponents = true; + linearSolverParameters.dofsPerNode = 3; + + if( dynamic_cast< SinglePhaseHybridFVM * >( this->flowSolver() ) ) { - GEOS_ERROR( "The poromechanics MGR strategy for hybrid FVM is not implemented" ); + GEOS_ERROR( GEOS_FMT( "{}: MGR strategy is not implemented for poromechanics {}/{}", + this->getName(), this->getCatalogName(), this->flowSolver()->getCatalogName())); } else { - // add Reservoir 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 ))); - // TODO check if needed - //linearSolverParameters.mgr.separateComponents = true; - //linearSolverParameters.mgr.displacementFieldName = solidMechanics::totalDisplacement::key(); } template< typename FLOW_SOLVER, typename MECHANICS_SOLVER >