Skip to content

Commit

Permalink
Merge branch 'develop' into feature/useStreakForRunner2
Browse files Browse the repository at this point in the history
  • Loading branch information
rrsettgast committed Jan 31, 2024
2 parents a0d23df + 3cdbde8 commit 9751403
Show file tree
Hide file tree
Showing 45 changed files with 1,780 additions and 997 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
targetRegions="{ region, wellRegion1, wellRegion2 }">
<NonlinearSolverParameters
maxTimeStepCuts="5"
newtonTol="1e-7"
newtonTol="1e-8"
newtonMaxIter="20"/>
<LinearSolverParameters
directParallel="0"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
newtonMaxIter="10"
maxNumConfigurationAttempts="10"/>
<LinearSolverParameters
solverType="direct"
directParallel="0"/>
</SinglePhasePoromechanicsConformingFractures>

Expand Down
2 changes: 1 addition & 1 deletion src/coreComponents/functions/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ if( ENABLE_MATHPRESSO )
endif()


set( dependencyList ${parallelDeps} codingUtilities dataRepository )
set( dependencyList ${parallelDeps} codingUtilities dataRepository fileIO )

if( ENABLE_MATHPRESSO )
list( APPEND dependencyList mathpresso )
Expand Down
3 changes: 2 additions & 1 deletion src/coreComponents/functions/TableFunction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "TableFunction.hpp"
#include "codingUtilities/Parsing.hpp"
#include "common/DataTypes.hpp"
#include "fileIO/Outputs/OutputBase.hpp"

#include <algorithm>

Expand Down Expand Up @@ -182,7 +183,7 @@ void TableFunction::checkCoord( real64 const coord, localIndex const dim ) const

void TableFunction::print( std::string const & filename ) const
{
std::ofstream os( filename + ".csv" );
std::ofstream os( joinPath( OutputBase::getOutputDirectory(), filename + ".csv" ) );

integer const numDimensions = LvArray::integerConversion< integer >( m_coordinates.size() );

Expand Down
1 change: 1 addition & 0 deletions src/coreComponents/linearAlgebra/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ if( ENABLE_HYPRE )
interfaces/hypre/mgrStrategies/LagrangianContactMechanics.hpp
interfaces/hypre/mgrStrategies/MultiphasePoromechanics.hpp
interfaces/hypre/mgrStrategies/SinglePhasePoromechanicsEmbeddedFractures.hpp
interfaces/hypre/mgrStrategies/SinglePhasePoromechanicsConformingFractures.hpp
interfaces/hypre/mgrStrategies/SinglePhasePoromechanicsReservoirFVM.hpp
interfaces/hypre/mgrStrategies/SinglePhaseReservoirFVM.hpp
interfaces/hypre/mgrStrategies/SinglePhaseReservoirHybridFVM.hpp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include "linearAlgebra/interfaces/hypre/mgrStrategies/SinglePhaseHybridFVM.hpp"
#include "linearAlgebra/interfaces/hypre/mgrStrategies/SinglePhasePoromechanics.hpp"
#include "linearAlgebra/interfaces/hypre/mgrStrategies/SinglePhasePoromechanicsEmbeddedFractures.hpp"
#include "linearAlgebra/interfaces/hypre/mgrStrategies/SinglePhasePoromechanicsConformingFractures.hpp"
#include "linearAlgebra/interfaces/hypre/mgrStrategies/SinglePhasePoromechanicsReservoirFVM.hpp"
#include "linearAlgebra/interfaces/hypre/mgrStrategies/SinglePhaseReservoirFVM.hpp"
#include "linearAlgebra/interfaces/hypre/mgrStrategies/SinglePhaseReservoirHybridFVM.hpp"
Expand Down Expand Up @@ -154,6 +155,11 @@ void hypre::mgr::createMGR( LinearSolverParameters const & params,
setStrategy< SinglePhasePoromechanicsEmbeddedFractures >( params.mgr, numComponentsPerField, precond, mgrData );
break;
}
case LinearSolverParameters::MGR::StrategyType::singlePhasePoromechanicsConformingFractures:
{
setStrategy< SinglePhasePoromechanicsConformingFractures >( params.mgr, numComponentsPerField, precond, mgrData );
break;
}
case LinearSolverParameters::MGR::StrategyType::singlePhasePoromechanicsReservoirFVM:
{
setStrategy< SinglePhasePoromechanicsReservoirFVM >( params.mgr, numComponentsPerField, precond, mgrData );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ void createHypreGMRES( LinearSolverParameters const & params,
GEOS_LAI_CHECK_ERROR( HYPRE_ParCSRGMRESSetTol( solver.ptr, params.krylov.relTolerance ) );

// Default for now
HYPRE_Int logLevel = (params.logLevel >= 3) ? 1 : 0;
HYPRE_Int logLevel = (params.logLevel >= 3) ? 2 : 0;

GEOS_LAI_CHECK_ERROR( HYPRE_ParCSRGMRESSetPrintLevel( solver.ptr, logLevel ) ); // print iteration info
GEOS_LAI_CHECK_ERROR( HYPRE_ParCSRGMRESSetLogging( solver.ptr, 1 ) ); /* needed to get run info later */
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
/*
* ------------------------------------------------------------------------------------------------------------
* SPDX-License-Identifier: LGPL-2.1-only
*
* Copyright (c) 2018-2020 Lawrence Livermore National Security LLC
* Copyright (c) 2018-2020 The Board of Trustees of the Leland Stanford Junior University
* Copyright (c) 2018-2020 TotalEnergies
* Copyright (c) 2019- GEOSX Contributors
* All rights reserved
*
* See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details.
* ------------------------------------------------------------------------------------------------------------
*/

/**
* @file SinglePhasePoromechanicsConformingFractures.hpp
*/

#ifndef GEOS_LINEARALGEBRA_INTERFACES_HYPREMGRSINGLEPHASEPOROMECHANICSCONFORMINGFRACTURES_HPP_
#define GEOS_LINEARALGEBRA_INTERFACES_HYPREMGRSINGLEPHASEPOROMECHANICSCONFORMINGFRACTURES_HPP_

#include "linearAlgebra/interfaces/hypre/HypreMGR.hpp"

#define BRANCH_MGR_FSOLVER

namespace geos
{

namespace hypre
{

namespace mgr
{

/**
* @brief SinglePhasePoromechanicsConformingFractures strategy.
*
* dofLabel: 0 = displacement, x-component
* dofLabel: 1 = displacement, y-component
* dofLabel: 2 = displacement, z-component
* dofLabel: 3 = pressure (cell elem + fracture elems)
* dofLabel: 4 = face-centered lagrange multiplier (tn)
* dofLabel: 5 = face-centered lagrange multiplier (tt1)
* dofLabel: 6 = face-centered lagrange multiplier (tt2)
*
* Ingredients:
* 1. Level 1: F-points displacement (4,5,6), C-points pressure (0,1,2,3)
* 2. Level 2: F-points displacement (0,1,2), C-points pressure (3)
* 2. F-points smoother: BoomerAMG, single V-cycle
* 3. C-points coarse-grid/Schur complement solver: BoomerAMG
* 4. Global smoother: none
*/
class SinglePhasePoromechanicsConformingFractures : public MGRStrategyBase< 2 >
{
public:

/**
* @brief Constructor.
*/
explicit SinglePhasePoromechanicsConformingFractures( arrayView1d< int const > const & )
: MGRStrategyBase( 7 )
{

// we keep u and p
m_labels[0].push_back( 0 );
m_labels[0].push_back( 1 );
m_labels[0].push_back( 2 );
m_labels[0].push_back( 3 );
// we keep p
m_labels[1].push_back( 3 );

setupLabels();

// Level 0
m_levelFRelaxType[0] = MGRFRelaxationType::none;
m_levelFRelaxIters[0] = 0;

m_levelGlobalSmootherType[0] = MGRGlobalSmootherType::ilu0;
m_levelGlobalSmootherIters[0] = 1;

m_levelInterpType[0] = MGRInterpolationType::blockJacobi;
m_levelRestrictType[0] = MGRRestrictionType::injection;
m_levelCoarseGridMethod[0] = MGRCoarseGridMethod::galerkin;

// Level 1
m_levelFRelaxType[1] = MGRFRelaxationType::amgVCycle;
m_levelFRelaxIters[1] = 1;
m_levelGlobalSmootherType[1] = MGRGlobalSmootherType::none;
m_levelInterpType[1] = MGRInterpolationType::jacobi;
m_levelRestrictType[1] = MGRRestrictionType::injection;
m_levelCoarseGridMethod[1] = MGRCoarseGridMethod::nonGalerkin;

}

/**
* @brief Setup the MGR strategy.
* @param precond preconditioner wrapper
* @param mgrData auxiliary MGR data
*/
void setup( LinearSolverParameters::MGR const &,
HyprePrecWrapper & precond,
HypreMGRData & mgrData )
{
setReduction( precond, mgrData );
GEOS_LAI_CHECK_ERROR( HYPRE_MGRSetPMaxElmts( precond.ptr, 0 ));

// Configure the BoomerAMG solver used as F-relaxation for the second level
GEOS_LAI_CHECK_ERROR( HYPRE_BoomerAMGCreate( &mgrData.mechSolver.ptr ) );
GEOS_LAI_CHECK_ERROR( HYPRE_BoomerAMGSetTol( mgrData.mechSolver.ptr, 0.0 ) );
GEOS_LAI_CHECK_ERROR( HYPRE_BoomerAMGSetMaxIter( mgrData.mechSolver.ptr, 1 ) );
GEOS_LAI_CHECK_ERROR( HYPRE_BoomerAMGSetMaxRowSum( mgrData.mechSolver.ptr, 1.0 ) );
GEOS_LAI_CHECK_ERROR( HYPRE_BoomerAMGSetStrongThreshold( mgrData.mechSolver.ptr, 0.6 ) );
GEOS_LAI_CHECK_ERROR( HYPRE_BoomerAMGSetPrintLevel( mgrData.mechSolver.ptr, 0 ) );
GEOS_LAI_CHECK_ERROR( HYPRE_BoomerAMGSetNumFunctions( mgrData.mechSolver.ptr, 3 ) );

#if GEOS_USE_HYPRE_DEVICE == GEOS_USE_HYPRE_CUDA || GEOS_USE_HYPRE_DEVICE == GEOS_USE_HYPRE_HIP
GEOS_LAI_CHECK_ERROR( HYPRE_BoomerAMGSetCoarsenType( mgrData.mechSolver.ptr, hypre::getAMGCoarseningType( LinearSolverParameters::AMG::CoarseningType::PMIS ) ) );
GEOS_LAI_CHECK_ERROR( HYPRE_BoomerAMGSetRelaxType( mgrData.mechSolver.ptr, hypre::getAMGRelaxationType( LinearSolverParameters::AMG::SmootherType::chebyshev ) ) );
GEOS_LAI_CHECK_ERROR( HYPRE_BoomerAMGSetNumSweeps( mgrData.mechSolver.ptr, 1 ) );
#else
GEOS_LAI_CHECK_ERROR( HYPRE_BoomerAMGSetRelaxOrder( mgrData.mechSolver.ptr, 1 ) );
#endif
GEOS_LAI_CHECK_ERROR( HYPRE_MGRSetFSolverAtLevel( 1, precond.ptr, mgrData.mechSolver.ptr ) );

// Configure the BoomerAMG solver used as mgr coarse solver for the pressure reduced system
setPressureAMG( mgrData.coarseSolver );
}
};

} // namespace mgr

} // namespace hypre

} // namespace geos

#endif /*GEOS_LINEARALGEBRA_INTERFACES_HYPREMGRSINGLEPHASEPOROMECHANICSCONFORMINGFRACTURES_HPP_*/
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,11 @@ namespace mgr
* dofLabel: 6 = pressure (cell elem + fracture elems)
*
* Ingredients:
* 1. F-points displacement (0,1,2), C-points pressure (3)
* 2. F-points smoother: AMG, single V-cycle, separate displacement components
* 3. C-points coarse-grid/Schur complement solver: boomer AMG
* 4. Global smoother: none
* 1. Level 1: F-points w (3,4,5), C-points pressure (0,1,2,6)
* 2. Level 2: F-points displacement (0,1,2), C-points pressure (6)
* 3. F-points smoother: BoomerAMG, single V-cycle
* 4. C-points coarse-grid/Schur complement solver: BoomerAMG
* 5. Global smoother: none
*/
class SinglePhasePoromechanicsEmbeddedFractures : public MGRStrategyBase< 2 >
{
Expand All @@ -57,56 +58,31 @@ class SinglePhasePoromechanicsEmbeddedFractures : public MGRStrategyBase< 2 >
explicit SinglePhasePoromechanicsEmbeddedFractures( arrayView1d< int const > const & )
: MGRStrategyBase( 7 )
{

/// IDEAL strategy but it seg faults
// // we keep u and p
// m_labels[0].push_back( 0 );
// m_labels[0].push_back( 1 );
// m_labels[0].push_back( 2 );
// m_labels[0].push_back( 6 );
// // we keep p
// m_labels[1].push_back( 6 );

// setupLabels();

// // Level 0
// m_levelFRelaxMethod[0] = MGRFRelaxationMethod::singleLevel;
// m_levelFRelaxType[0] = MGRFRelaxationType::gsElimWInverse; // gaussian elimination for the dispJump block
// m_levelInterpType[0] = MGRInterpolationType::blockJacobi;
// m_levelRestrictType[0] = MGRRestrictionType::injection;
// m_levelCoarseGridMethod[0] = MGRCoarseGridMethod::galerkin;

// // Level 1
// m_levelFRelaxMethod[1] = MGRFRelaxationMethod::amgVCycle;
// m_levelInterpType[1] = MGRInterpolationType::jacobi;
// m_levelRestrictType[1] = MGRRestrictionType::injection;
// m_levelCoarseGridMethod[1] = MGRCoarseGridMethod::nonGalerkin;

// we keep w and p
m_labels[0].push_back( 3 );
m_labels[0].push_back( 4 );
m_labels[0].push_back( 5 );
// we keep u and p
m_labels[0].push_back( 0 );
m_labels[0].push_back( 1 );
m_labels[0].push_back( 2 );
m_labels[0].push_back( 6 );
// we keep p
m_labels[1].push_back( 6 );

setupLabels();

// Level 0
m_levelFRelaxType[0] = MGRFRelaxationType::amgVCycle;
m_levelFRelaxType[0] = MGRFRelaxationType::gsElimWPivoting; // gaussian elimination for the dispJump block
m_levelFRelaxIters[0] = 1;
m_levelInterpType[0] = MGRInterpolationType::jacobi;
m_levelRestrictType[0] = MGRRestrictionType::injection;
m_levelCoarseGridMethod[0] = MGRCoarseGridMethod::nonGalerkin;
m_levelGlobalSmootherType[0] = MGRGlobalSmootherType::none;
m_levelInterpType[0] = MGRInterpolationType::blockJacobi;
m_levelRestrictType[0] = MGRRestrictionType::injection;
m_levelCoarseGridMethod[0] = MGRCoarseGridMethod::galerkin;

// Level 1
m_levelFRelaxType[1] = MGRFRelaxationType::gsElimWInverse;
m_levelFRelaxIters[1] = 1;
m_levelInterpType[1] = MGRInterpolationType::blockJacobi;
m_levelRestrictType[1] = MGRRestrictionType::injection;
m_levelCoarseGridMethod[1] = MGRCoarseGridMethod::galerkin;
m_levelFRelaxType[1] = MGRFRelaxationType::amgVCycle;
m_levelGlobalSmootherType[1] = MGRGlobalSmootherType::none;
m_levelInterpType[1] = MGRInterpolationType::jacobi;
m_levelRestrictType[1] = MGRRestrictionType::injection;
m_levelCoarseGridMethod[1] = MGRCoarseGridMethod::nonGalerkin;

}

/**
Expand All @@ -122,8 +98,23 @@ class SinglePhasePoromechanicsEmbeddedFractures : public MGRStrategyBase< 2 >

GEOS_LAI_CHECK_ERROR( HYPRE_MGRSetPMaxElmts( precond.ptr, 0 ));

// Configure the BoomerAMG solver used as F-relaxation for the first level
setMechanicsFSolver( precond, mgrData );
// Configure the BoomerAMG solver used as F-relaxation for the second level
GEOS_LAI_CHECK_ERROR( HYPRE_BoomerAMGCreate( &mgrData.mechSolver.ptr ) );
GEOS_LAI_CHECK_ERROR( HYPRE_BoomerAMGSetTol( mgrData.mechSolver.ptr, 0.0 ) );
GEOS_LAI_CHECK_ERROR( HYPRE_BoomerAMGSetMaxIter( mgrData.mechSolver.ptr, 1 ) );
GEOS_LAI_CHECK_ERROR( HYPRE_BoomerAMGSetMaxRowSum( mgrData.mechSolver.ptr, 1.0 ) );
GEOS_LAI_CHECK_ERROR( HYPRE_BoomerAMGSetStrongThreshold( mgrData.mechSolver.ptr, 0.6 ) );
GEOS_LAI_CHECK_ERROR( HYPRE_BoomerAMGSetPrintLevel( mgrData.mechSolver.ptr, 0 ) );
GEOS_LAI_CHECK_ERROR( HYPRE_BoomerAMGSetNumFunctions( mgrData.mechSolver.ptr, 3 ) );

#if GEOS_USE_HYPRE_DEVICE == GEOS_USE_HYPRE_CUDA || GEOS_USE_HYPRE_DEVICE == GEOS_USE_HYPRE_HIP
GEOS_LAI_CHECK_ERROR( HYPRE_BoomerAMGSetCoarsenType( mgrData.mechSolver.ptr, hypre::getAMGCoarseningType( LinearSolverParameters::AMG::CoarseningType::PMIS ) ) );
GEOS_LAI_CHECK_ERROR( HYPRE_BoomerAMGSetRelaxType( mgrData.mechSolver.ptr, hypre::getAMGRelaxationType( LinearSolverParameters::AMG::SmootherType::chebyshev ) ) );
GEOS_LAI_CHECK_ERROR( HYPRE_BoomerAMGSetNumSweeps( mgrData.mechSolver.ptr, 1 ) );
#else
GEOS_LAI_CHECK_ERROR( HYPRE_BoomerAMGSetRelaxOrder( mgrData.mechSolver.ptr, 1 ) );
#endif
GEOS_LAI_CHECK_ERROR( HYPRE_MGRSetFSolverAtLevel( 1, precond.ptr, mgrData.mechSolver.ptr ) );

// Configure the BoomerAMG solver used as mgr coarse solver for the pressure reduced system
setPressureAMG( mgrData.coarseSolver );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,27 +262,28 @@ struct LinearSolverParameters
*/
enum class StrategyType : integer
{
invalid, ///< default value, to ensure solver sets something
singlePhaseReservoirFVM, ///< finite volume 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
thermalSinglePhasePoromechanics, ///< thermal single phase poromechanics with finite volume single phase flow
hybridSinglePhasePoromechanics, ///< single phase poromechanics with hybrid finite volume single phase flow
singlePhasePoromechanicsEmbeddedFractures, ///< single phase poromechanics with finite volume single phase flow and embedded fractures
singlePhasePoromechanicsReservoirFVM, ///< single phase poromechanics with finite volume single phase flow with wells
compositionalMultiphaseFVM, ///< finite volume compositional multiphase flow
compositionalMultiphaseHybridFVM, ///< hybrid finite volume compositional multiphase flow
compositionalMultiphaseReservoirFVM, ///< finite volume compositional multiphase flow with wells
compositionalMultiphaseReservoirHybridFVM, ///< hybrid finite volume compositional multiphase flow with wells
reactiveCompositionalMultiphaseOBL, ///< finite volume reactive compositional flow with OBL
thermalCompositionalMultiphaseFVM, ///< finite volume thermal compositional multiphase flow
multiphasePoromechanics, ///< multiphase poromechanics with finite volume compositional multiphase flow
multiphasePoromechanicsReservoirFVM, ///< multiphase poromechanics with finite volume compositional multiphase flow with wells
thermalMultiphasePoromechanics, ///< thermal multiphase poromechanics with finite volume compositional multiphase flow
hydrofracture, ///< hydrofracture
lagrangianContactMechanics, ///< Lagrangian contact mechanics
solidMechanicsEmbeddedFractures ///< Embedded fractures mechanics
invalid, ///< default value, to ensure solver sets something
singlePhaseReservoirFVM, ///< finite volume 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
thermalSinglePhasePoromechanics, ///< thermal single phase poromechanics with finite volume single phase flow
hybridSinglePhasePoromechanics, ///< single phase poromechanics with hybrid finite volume single phase flow
singlePhasePoromechanicsEmbeddedFractures, ///< single phase poromechanics with FV embedded fractures
singlePhasePoromechanicsConformingFractures, ///< single phase poromechanics with FV conforming fractures
singlePhasePoromechanicsReservoirFVM, ///< single phase poromechanics with finite volume single phase flow with wells
compositionalMultiphaseFVM, ///< finite volume compositional multiphase flow
compositionalMultiphaseHybridFVM, ///< hybrid finite volume compositional multiphase flow
compositionalMultiphaseReservoirFVM, ///< finite volume compositional multiphase flow with wells
compositionalMultiphaseReservoirHybridFVM, ///< hybrid finite volume compositional multiphase flow with wells
reactiveCompositionalMultiphaseOBL, ///< finite volume reactive compositional flow with OBL
thermalCompositionalMultiphaseFVM, ///< finite volume thermal compositional multiphase flow
multiphasePoromechanics, ///< multiphase poromechanics with finite volume compositional multiphase flow
multiphasePoromechanicsReservoirFVM, ///< multiphase poromechanics with finite volume compositional multiphase flow with wells
thermalMultiphasePoromechanics, ///< thermal multiphase poromechanics with finite volume compositional multiphase flow
hydrofracture, ///< hydrofracture
lagrangianContactMechanics, ///< Lagrangian contact mechanics
solidMechanicsEmbeddedFractures ///< Embedded fractures mechanics
};

StrategyType strategy = StrategyType::invalid; ///< Predefined MGR solution strategy (solver specific)
Expand Down Expand Up @@ -361,6 +362,7 @@ ENUM_STRINGS( LinearSolverParameters::MGR::StrategyType,
"thermalSinglePhasePoromechanics",
"hybridSinglePhasePoromechanics",
"singlePhasePoromechanicsEmbeddedFractures",
"singlePhasePoromechanicsConformingFractures",
"singlePhasePoromechanicsReservoirFVM",
"compositionalMultiphaseFVM",
"compositionalMultiphaseHybridFVM",
Expand Down
Loading

0 comments on commit 9751403

Please sign in to comment.