Skip to content

Commit

Permalink
feat: mgr strategy for lagrangeContactBubbleStabilization
Browse files Browse the repository at this point in the history
  • Loading branch information
CusiniM committed Dec 14, 2024
1 parent b5ea7ce commit 1855266
Show file tree
Hide file tree
Showing 7 changed files with 151 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@
lineSearchMaxCuts="2"
maxTimeStepCuts="1"/>
<LinearSolverParameters
solverType="direct"
preconditionerType="mgr"
solverType="gmres"
directParallel="0"
logLevel="0"/>
logLevel="1"/>
</SolidMechanicsLagrangeContactBubbleStab>

<SurfaceGenerator
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 @@ -128,6 +128,7 @@ if( ENABLE_HYPRE )
interfaces/hypre/mgrStrategies/HybridSinglePhasePoromechanics.hpp
interfaces/hypre/mgrStrategies/Hydrofracture.hpp
interfaces/hypre/mgrStrategies/LagrangianContactMechanics.hpp
interfaces/hypre/mgrStrategies/LagrangianContactMechanicsBubbleStabilization.hpp
interfaces/hypre/mgrStrategies/MultiphasePoromechanics.hpp
interfaces/hypre/mgrStrategies/SinglePhasePoromechanicsEmbeddedFractures.hpp
interfaces/hypre/mgrStrategies/SinglePhasePoromechanicsConformingFractures.hpp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include "linearAlgebra/interfaces/hypre/mgrStrategies/HybridSinglePhasePoromechanics.hpp"
#include "linearAlgebra/interfaces/hypre/mgrStrategies/Hydrofracture.hpp"
#include "linearAlgebra/interfaces/hypre/mgrStrategies/LagrangianContactMechanics.hpp"
#include "linearAlgebra/interfaces/hypre/mgrStrategies/LagrangianContactMechanicsBubbleStabilization.hpp"
#include "linearAlgebra/interfaces/hypre/mgrStrategies/MultiphasePoromechanics.hpp"
#include "linearAlgebra/interfaces/hypre/mgrStrategies/MultiphasePoromechanicsReservoirFVM.hpp"
#include "linearAlgebra/interfaces/hypre/mgrStrategies/ReactiveCompositionalMultiphaseOBL.hpp"
Expand Down Expand Up @@ -137,6 +138,11 @@ void hypre::mgr::createMGR( LinearSolverParameters const & params,
{
setStrategy< LagrangianContactMechanics >( params.mgr, numComponentsPerField, precond, mgrData );
break;
}
case LinearSolverParameters::MGR::StrategyType::lagrangianContactMechanicsBubbleStab:
{
setStrategy< LagrangianContactMechanicsBubbleStabilization >( params.mgr, numComponentsPerField, precond, mgrData );
break;
}
case LinearSolverParameters::MGR::StrategyType::multiphasePoromechanics:
{
Expand Down
26 changes: 26 additions & 0 deletions src/coreComponents/linearAlgebra/interfaces/hypre/HypreMGR.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,32 @@ class MGRStrategyBase
setDisplacementAMG( mgrData.mechSolver, separateComponents );
HYPRE_MGRSetFSolver( precond.ptr, mgrData.mechSolver.solve, mgrData.mechSolver.setup, mgrData.mechSolver.ptr );
}
/**
* @brief
*
* @param solver
*/
void setILUCoarseSolver( HyprePrecWrapper & solver )
{
/* (Required) Create ILU solver */
HYPRE_ILUCreate(&solver.ptr);

/* (Recommended) General solver options */
int const ilu_type = 0; /* 0, 1, 10, 11, 20, 21, 30, 31, 40, 41, 50 */
int const max_iter = 1;
double const tol = 0.0;
int const reordering = 0; /* 0: none, 1: RCM */
int const print_level = 0;
HYPRE_ILUSetType(solver.ptr, ilu_type);
HYPRE_ILUSetMaxIter(solver.ptr, max_iter);
HYPRE_ILUSetTol(solver.ptr, tol);
HYPRE_ILUSetLocalReordering(solver.ptr, reordering);
HYPRE_ILUSetPrintLevel(solver.ptr, print_level);

solver.setup = HYPRE_ILUSetup;
solver.solve = HYPRE_ILUSolve;
solver.destroy = HYPRE_ILUDestroy;
}

};

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
/*
* ------------------------------------------------------------------------------------------------------------
* 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 LagrangianContactMechanicsBubbleStabilization.hpp
*/

#ifndef GEOS_LINEARALGEBRA_INTERFACES_HYPREMGRLAGRANGIACONTACTMECHANICSBUBBLESTAB_HPP_
#define GEOS_LINEARALGEBRA_INTERFACES_HYPREMGRLAGRANGIACONTACTMECHANICSBUBBLESTAB_HPP_

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

namespace geos
{

namespace hypre
{

namespace mgr
{

/**
* @brief LagrangianContactMechanicsBubbleStabilization strategy
*
* Contact mechanics with face-centered lagrangian multipliers
*
* dofLabel: 0 = displacement, x-component
* dofLabel: 1 = displacement, y-component
* dofLabel: 2 = displacement, z-component
* dofLabel: 3 = displacement bubble function, x-component
* dofLabel: 4 = displacement bubble function, y-component
* dofLabel: 5 = displacement bubble function, z-component
* dofLabel: 6 = face-centered lagrange multiplier (tn)
* dofLabel: 7 = face-centered lagrange multiplier (tt1)
* dofLabel: 8 = face-centered lagrange multiplier (tt2)
*
* Ingredients:
* 1. F-points displacement (0,1,2), C-points (3,4,5)
* 2. F-points smoother: AMG, single V-cycle, separate displacemente components
* 3. C-points coarse-grid/Schur complement solver: boomer AMG
* 4. Global smoother: none
*
*/
class LagrangianContactMechanicsBubbleStabilization : public MGRStrategyBase< 1 >
{
public:

/**
* @brief Constructor.
*/
explicit LagrangianContactMechanicsBubbleStabilization( arrayView1d< int const > const & )
: MGRStrategyBase( 9 )
{
// Level 0: we keep all three displacement
m_labels[0] = { 6, 7, 8 };

setupLabels();

// Level 0
m_levelFRelaxType[0] = MGRFRelaxationType::amgVCycle;
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 MGR configuration parameters
* @param precond preconditioner wrapper
* @param mgrData auxiliary MGR data
*/
void setup( LinearSolverParameters::MGR const & mgrParams,
HyprePrecWrapper & precond,
HypreMGRData & mgrData )
{
setReduction( precond, mgrData );

// Configure the BoomerAMG solver used as F-relaxation for the first level
setMechanicsFSolver( precond, mgrData, mgrParams.separateComponents );

// Configure ILU) as a coarse solver
setILUCoarseSolver( mgrData.coarseSolver );
}
};

} // namespace mgr

} // namespace hypre

} // namespace geos

#endif /*GEOS_LINEARALGEBRA_INTERFACES_HYPREMGRLAGRANGIACONTACTMECHANICSBUBBLESTAB_HPP_*/
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ struct LinearSolverParameters
thermalMultiphasePoromechanics, ///< thermal multiphase poromechanics with finite volume compositional multiphase flow
hydrofracture, ///< hydrofracture
lagrangianContactMechanics, ///< Lagrangian contact mechanics
lagrangianContactMechanicsBubbleStab, ///< Lagrangian contact mechanics with bubble stabilization
solidMechanicsEmbeddedFractures ///< Embedded fractures mechanics
};

Expand Down Expand Up @@ -387,6 +388,7 @@ ENUM_STRINGS( LinearSolverParameters::MGR::StrategyType,
"thermalMultiphasePoromechanics",
"hydrofracture",
"lagrangianContactMechanics",
"lagrangianContactMechanicsBubbleStab",
"solidMechanicsEmbeddedFractures" );

/// Declare strings associated with enumeration values.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,11 @@ SolidMechanicsLagrangeContactBubbleStab::SolidMechanicsLagrangeContactBubbleStab
{
m_faceTypeToFiniteElements["Quadrilateral"] = std::make_unique< finiteElement::H1_QuadrilateralFace_Lagrange1_GaussLegendre2 >();
m_faceTypeToFiniteElements["Triangle"] = std::make_unique< finiteElement::H1_TriangleFace_Lagrange1_Gauss1 >();


LinearSolverParameters & linSolParams = m_linearSolverParameters.get();
linSolParams.mgr.strategy = LinearSolverParameters::MGR::StrategyType::lagrangianContactMechanicsBubbleStab;
linSolParams.mgr.separateComponents = true;
linSolParams.dofsPerNode = 3;
}

SolidMechanicsLagrangeContactBubbleStab::~SolidMechanicsLagrangeContactBubbleStab()
Expand Down Expand Up @@ -249,6 +253,8 @@ void SolidMechanicsLagrangeContactBubbleStab::setupSystem( DomainPartition & dom
solution.create( dofManager.numLocalDofs(), MPI_COMM_GEOS );

computeRotationMatrices( domain );

dofManager.printFieldInfo();
}

void SolidMechanicsLagrangeContactBubbleStab::computeRotationMatrices( DomainPartition & domain ) const
Expand Down

0 comments on commit 1855266

Please sign in to comment.