From 9bad82778db0cedebf49479d949fef99408343fe Mon Sep 17 00:00:00 2001 From: frankfeifan Date: Tue, 3 Feb 2026 13:39:26 -0800 Subject: [PATCH 1/2] added a mgr strategy for thermalSinglePhaseReservoirFVM --- .../linearAlgebra/CMakeLists.txt | 1 + .../interfaces/hypre/HypreMGR.cpp | 6 + .../ThermalSinglePhaseReservoirFVM.hpp | 104 ++++++++++++++++++ .../utilities/LinearSolverParameters.hpp | 2 + .../multiphysics/PoromechanicsSolver.hpp | 10 +- .../SinglePhaseReservoirAndWells.cpp | 9 +- 6 files changed, 126 insertions(+), 6 deletions(-) create mode 100644 src/coreComponents/linearAlgebra/interfaces/hypre/mgrStrategies/ThermalSinglePhaseReservoirFVM.hpp diff --git a/src/coreComponents/linearAlgebra/CMakeLists.txt b/src/coreComponents/linearAlgebra/CMakeLists.txt index 01452771db9..129eb29754a 100644 --- a/src/coreComponents/linearAlgebra/CMakeLists.txt +++ b/src/coreComponents/linearAlgebra/CMakeLists.txt @@ -175,6 +175,7 @@ if( ENABLE_HYPRE ) interfaces/hypre/mgrStrategies/ThermalCompositionalMultiphaseFVM.hpp interfaces/hypre/mgrStrategies/ThermalCompositionalMultiphaseReservoirFVM.hpp interfaces/hypre/mgrStrategies/ThermalMultiphasePoromechanics.hpp + interfaces/hypre/mgrStrategies/ThermalSinglePhaseReservoirFVM.hpp interfaces/hypre/mgrStrategies/ThermalSinglePhasePoromechanics.hpp ) list( APPEND linearAlgebra_sources interfaces/hypre/HypreExport.cpp diff --git a/src/coreComponents/linearAlgebra/interfaces/hypre/HypreMGR.cpp b/src/coreComponents/linearAlgebra/interfaces/hypre/HypreMGR.cpp index 6c24b749868..8897fbd1848 100644 --- a/src/coreComponents/linearAlgebra/interfaces/hypre/HypreMGR.cpp +++ b/src/coreComponents/linearAlgebra/interfaces/hypre/HypreMGR.cpp @@ -43,6 +43,7 @@ #include "linearAlgebra/interfaces/hypre/mgrStrategies/ThermalCompositionalMultiphaseFVM.hpp" #include "linearAlgebra/interfaces/hypre/mgrStrategies/ThermalCompositionalMultiphaseReservoirFVM.hpp" #include "linearAlgebra/interfaces/hypre/mgrStrategies/ThermalSinglePhasePoromechanics.hpp" +#include "linearAlgebra/interfaces/hypre/mgrStrategies/ThermalSinglePhaseReservoirFVM.hpp" #include "linearAlgebra/interfaces/hypre/mgrStrategies/ThermalMultiphasePoromechanics.hpp" #include "linearAlgebra/interfaces/hypre/mgrStrategies/SolidMechanicsEmbeddedFractures.hpp" @@ -196,6 +197,11 @@ void hypre::mgr::createMGR( LinearSolverParameters const & params, setStrategy< SinglePhaseReservoirFVM >( params.mgr, numComponentsPerField, precond, mgrData ); break; } + case LinearSolverParameters::MGR::StrategyType::thermalSinglePhaseReservoirFVM: + { + setStrategy< ThermalSinglePhaseReservoirFVM >( params.mgr, numComponentsPerField, precond, mgrData ); + break; + } case LinearSolverParameters::MGR::StrategyType::singlePhaseReservoirHybridFVM: { setStrategy< SinglePhaseReservoirHybridFVM >( params.mgr, numComponentsPerField, precond, mgrData ); diff --git a/src/coreComponents/linearAlgebra/interfaces/hypre/mgrStrategies/ThermalSinglePhaseReservoirFVM.hpp b/src/coreComponents/linearAlgebra/interfaces/hypre/mgrStrategies/ThermalSinglePhaseReservoirFVM.hpp new file mode 100644 index 00000000000..51376cb818f --- /dev/null +++ b/src/coreComponents/linearAlgebra/interfaces/hypre/mgrStrategies/ThermalSinglePhaseReservoirFVM.hpp @@ -0,0 +1,104 @@ +/* + * ------------------------------------------------------------------------------------------------------------ + * SPDX-License-Identifier: LGPL-2.1-only + * + * Copyright (c) 2016-2024 Lawrence Livermore National Security LLC + * Copyright (c) 2018-2024 TotalEnergies + * Copyright (c) 2018-2024 The Board of Trustees of the Leland Stanford Junior University + * Copyright (c) 2023-2024 Chevron + * Copyright (c) 2019- GEOS/GEOSX Contributors + * All rights reserved + * + * See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details. + * ------------------------------------------------------------------------------------------------------------ + */ + +/** + * @file ThermalSinglePhaseReservoirFVM.hpp + */ + +#ifndef GEOS_LINEARALGEBRA_INTERFACES_HYPREMGRTHERMALSINGLEPHASERESERVOIRFVM_HPP_ +#define GEOS_LINEARALGEBRA_INTERFACES_HYPREMGRTHERMALSINGLEPHASERESERVOIRFVM_HPP_ + +#include "linearAlgebra/interfaces/hypre/HypreMGR.hpp" + +namespace geos +{ + +namespace hypre +{ + +namespace mgr +{ + +/** + * @brief ThermalSinglePhaseReservoirFVM strategy. + * + * Labels description stored in point_marker_array + * dofLabel: 0 = reservoir pressure + * dofLabel: 1 = reservoir temperature + * dofLabel: 2 = well pressure + * dofLabel: 3 = well rate (numWellLabels = 2) + * dofLabel: 4 = well temperature + * + * Ingredients + * + * 1. F-points well vars, C-points cell-centered pressure + * 2. F-points smoother: jacobi (soon, direct solver) + * 3. C-points coarse-grid/Schur complement solver: BoomerAMG + */ +class ThermalSinglePhaseReservoirFVM : public MGRStrategyBase< 1 > +{ +public: + /** + * @brief Constructor. + */ + explicit ThermalSinglePhaseReservoirFVM( arrayView1d< int const > const & ) + : MGRStrategyBase( LvArray::integerConversion< HYPRE_Int >( 1 ) ) + { + // Level 0: eliminate the well variables, and just keep the cell-centered pressures + m_labels[0].push_back( 0 ); + m_labels[0].push_back( 1 ); + + setupLabels(); + + // Level 0 + m_levelFRelaxType[0] = MGRFRelaxationType::gsElimWInverse; + m_levelFRelaxIters[0] = 1; + m_levelInterpType[0] = MGRInterpolationType::blockJacobi; + m_levelRestrictType[0] = MGRRestrictionType::injection; + m_levelCoarseGridMethod[0] = MGRCoarseGridMethod::galerkin; + m_levelGlobalSmootherType[0] = MGRGlobalSmootherType::none; + } + + /** + * @brief Setup the MGR strategy. + * @param mgrParams parameters for the configuration of the MGR recipe + * @param precond preconditioner wrapper + * @param mgrData auxiliary MGR data + */ + void setup( LinearSolverParameters::MGR const & mgrParams, + HyprePrecWrapper & precond, + HypreMGRData & mgrData ) + { + // if the wells are shut, using Gaussian elimination as F-relaxation for the well block is an overkill + // in that case, we just use Jacobi + if( mgrParams.areWellsShut ) + { + m_levelFRelaxType[0] = MGRFRelaxationType::jacobi; + } + + setReduction( precond, mgrData ); + + // Configure the BoomerAMG solver used as mgr coarse solver for the pressure reduced system + setPressureTemperatureAMG( mgrData.coarseSolver ); + } +}; + +} // namespace mgr + +} // namespace hypre + +} // namespace geos + +#endif /*GEOS_LINEARALGEBRA_INTERFACES_HYPREMGRTHERMALSINGLEPHASERESERVOIRFVM_HPP_*/ diff --git a/src/coreComponents/linearAlgebra/utilities/LinearSolverParameters.hpp b/src/coreComponents/linearAlgebra/utilities/LinearSolverParameters.hpp index 9b491528ecb..502227c5400 100644 --- a/src/coreComponents/linearAlgebra/utilities/LinearSolverParameters.hpp +++ b/src/coreComponents/linearAlgebra/utilities/LinearSolverParameters.hpp @@ -296,6 +296,7 @@ struct LinearSolverParameters { invalid, ///< default value, to ensure solver sets something singlePhaseReservoirFVM, ///< finite volume single-phase flow with wells + thermalSinglePhaseReservoirFVM, ///< finite volume thermal single-phase flow with wells singlePhaseHybridFVM, ///< hybrid finite volume single-phase flow singlePhaseReservoirHybridFVM, ///< hybrid finite volume single-phase flow with wells singlePhasePoromechanics, ///< single phase poromechanics with finite volume single phase flow @@ -571,6 +572,7 @@ ENUM_STRINGS( LinearSolverParameters::Direct::RowPerm, ENUM_STRINGS( LinearSolverParameters::MGR::StrategyType, "invalid", "singlePhaseReservoirFVM", + "thermalSinglePhaseReservoirFVM", "singlePhaseHybridFVM", "singlePhaseReservoirHybridFVM", "singlePhasePoromechanics", diff --git a/src/coreComponents/physicsSolvers/multiphysics/PoromechanicsSolver.hpp b/src/coreComponents/physicsSolvers/multiphysics/PoromechanicsSolver.hpp index 9471da04798..9bfe046c7ec 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/PoromechanicsSolver.hpp +++ b/src/coreComponents/physicsSolvers/multiphysics/PoromechanicsSolver.hpp @@ -114,11 +114,6 @@ class PoromechanicsSolver : public CoupledSolver< FLOW_SOLVER, MECHANICS_SOLVER { Base::postInputInitialization(); - GEOS_THROW_IF( this->m_isThermal && !this->flowSolver()->isThermal(), - GEOS_FMT( "{} {}: The attribute `{}` of the flow solver must be thermal since the poromechanics solver is thermal", - this->getCatalogName(), this->getName(), this->flowSolver()->getName() ), - InputError ); - GEOS_THROW_IF( this->solidMechanicsSolver()->timeIntegrationOption() != SolidMechanicsLagrangianFEM::TimeIntegrationOption::QuasiStatic, GEOS_FMT( "{} {}: The attribute `{}` of solid mechanics solver `{}` must be `{}`", this->getCatalogName(), this->getName(), @@ -152,6 +147,11 @@ class PoromechanicsSolver : public CoupledSolver< FLOW_SOLVER, MECHANICS_SOLVER { Base::initializePreSubGroups(); + GEOS_THROW_IF( this->m_isThermal && !this->flowSolver()->isThermal(), + GEOS_FMT( "{} {}: The attribute `{}` of the flow solver must be thermal since the poromechanics solver is thermal", + this->getCatalogName(), this->getName(), this->flowSolver()->getName() ), + InputError ); + GEOS_THROW_IF( m_stabilizationType == stabilization::StabilizationType::Local, this->getWrapperDataContext( viewKeyStruct::stabilizationTypeString() ) << ": Local stabilization has been temporarily disabled", diff --git a/src/coreComponents/physicsSolvers/multiphysics/SinglePhaseReservoirAndWells.cpp b/src/coreComponents/physicsSolvers/multiphysics/SinglePhaseReservoirAndWells.cpp index 46cf3257088..b076ab9fb98 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/SinglePhaseReservoirAndWells.cpp +++ b/src/coreComponents/physicsSolvers/multiphysics/SinglePhaseReservoirAndWells.cpp @@ -84,7 +84,14 @@ setMGRStrategy() } else { - linearSolverParameters.mgr.strategy = LinearSolverParameters::MGR::StrategyType::singlePhaseReservoirFVM; + if( isThermal() ) + { + m_linearSolverParameters.get().mgr.strategy = LinearSolverParameters::MGR::StrategyType::thermalSinglePhaseReservoirFVM; + } + else + { + linearSolverParameters.mgr.strategy = LinearSolverParameters::MGR::StrategyType::singlePhaseReservoirFVM; + } } GEOS_LOG_LEVEL_RANK_0( logInfo::LinearSolver, GEOS_FMT( "{}: MGR strategy set to {}", getName(), From 23ce862529f7d63f5af3a43349bb74dfbf4904b8 Mon Sep 17 00:00:00 2001 From: frankfeifan Date: Tue, 3 Feb 2026 13:41:31 -0800 Subject: [PATCH 2/2] added a toy problem for FORGE circulation test --- ...voirThermoPoroElastic_Circulation_base.xml | 169 +++++++++++++ ...oirThermoPoroElastic_Circulation_debug.xml | 226 ++++++++++++++++++ .../poromechanics/pressureTable/pres.geos | 2 + .../poromechanics/pressureTable/xlin.geos | 1 + .../poromechanics/pressureTable/ylin.geos | 1 + .../poromechanics/pressureTable/zlin.geos | 2 + inputFiles/poromechanics/tempTable/temp.geos | 2 + inputFiles/poromechanics/tempTable/xlin.geos | 1 + inputFiles/poromechanics/tempTable/ylin.geos | 1 + inputFiles/poromechanics/tempTable/zlin.geos | 2 + 10 files changed, 407 insertions(+) create mode 100644 inputFiles/poromechanics/ReservoirThermoPoroElastic_Circulation_base.xml create mode 100644 inputFiles/poromechanics/ReservoirThermoPoroElastic_Circulation_debug.xml create mode 100644 inputFiles/poromechanics/pressureTable/pres.geos create mode 100644 inputFiles/poromechanics/pressureTable/xlin.geos create mode 100644 inputFiles/poromechanics/pressureTable/ylin.geos create mode 100644 inputFiles/poromechanics/pressureTable/zlin.geos create mode 100644 inputFiles/poromechanics/tempTable/temp.geos create mode 100644 inputFiles/poromechanics/tempTable/xlin.geos create mode 100644 inputFiles/poromechanics/tempTable/ylin.geos create mode 100644 inputFiles/poromechanics/tempTable/zlin.geos diff --git a/inputFiles/poromechanics/ReservoirThermoPoroElastic_Circulation_base.xml b/inputFiles/poromechanics/ReservoirThermoPoroElastic_Circulation_base.xml new file mode 100644 index 00000000000..32cd3bdf55d --- /dev/null +++ b/inputFiles/poromechanics/ReservoirThermoPoroElastic_Circulation_base.xml @@ -0,0 +1,169 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/inputFiles/poromechanics/ReservoirThermoPoroElastic_Circulation_debug.xml b/inputFiles/poromechanics/ReservoirThermoPoroElastic_Circulation_debug.xml new file mode 100644 index 00000000000..b2a0d65d59d --- /dev/null +++ b/inputFiles/poromechanics/ReservoirThermoPoroElastic_Circulation_debug.xml @@ -0,0 +1,226 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/inputFiles/poromechanics/pressureTable/pres.geos b/inputFiles/poromechanics/pressureTable/pres.geos new file mode 100644 index 00000000000..ce721f40d80 --- /dev/null +++ b/inputFiles/poromechanics/pressureTable/pres.geos @@ -0,0 +1,2 @@ +31.3575 +12.7185 \ No newline at end of file diff --git a/inputFiles/poromechanics/pressureTable/xlin.geos b/inputFiles/poromechanics/pressureTable/xlin.geos new file mode 100644 index 00000000000..171538eb0b0 --- /dev/null +++ b/inputFiles/poromechanics/pressureTable/xlin.geos @@ -0,0 +1 @@ +0.0 \ No newline at end of file diff --git a/inputFiles/poromechanics/pressureTable/ylin.geos b/inputFiles/poromechanics/pressureTable/ylin.geos new file mode 100644 index 00000000000..171538eb0b0 --- /dev/null +++ b/inputFiles/poromechanics/pressureTable/ylin.geos @@ -0,0 +1 @@ +0.0 \ No newline at end of file diff --git a/inputFiles/poromechanics/pressureTable/zlin.geos b/inputFiles/poromechanics/pressureTable/zlin.geos new file mode 100644 index 00000000000..8abd481bf72 --- /dev/null +++ b/inputFiles/poromechanics/pressureTable/zlin.geos @@ -0,0 +1,2 @@ +-400.0 +1500.0 \ No newline at end of file diff --git a/inputFiles/poromechanics/tempTable/temp.geos b/inputFiles/poromechanics/tempTable/temp.geos new file mode 100644 index 00000000000..31e72885c0f --- /dev/null +++ b/inputFiles/poromechanics/tempTable/temp.geos @@ -0,0 +1,2 @@ +221 +108 \ No newline at end of file diff --git a/inputFiles/poromechanics/tempTable/xlin.geos b/inputFiles/poromechanics/tempTable/xlin.geos new file mode 100644 index 00000000000..171538eb0b0 --- /dev/null +++ b/inputFiles/poromechanics/tempTable/xlin.geos @@ -0,0 +1 @@ +0.0 \ No newline at end of file diff --git a/inputFiles/poromechanics/tempTable/ylin.geos b/inputFiles/poromechanics/tempTable/ylin.geos new file mode 100644 index 00000000000..171538eb0b0 --- /dev/null +++ b/inputFiles/poromechanics/tempTable/ylin.geos @@ -0,0 +1 @@ +0.0 \ No newline at end of file diff --git a/inputFiles/poromechanics/tempTable/zlin.geos b/inputFiles/poromechanics/tempTable/zlin.geos new file mode 100644 index 00000000000..8abd481bf72 --- /dev/null +++ b/inputFiles/poromechanics/tempTable/zlin.geos @@ -0,0 +1,2 @@ +-400.0 +1500.0 \ No newline at end of file