Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Enable fully coupled mode for CompositionalMultiphaseReservoirPoromechanics and SinglePhaseReservoirPoromechanics #3388

Merged
merged 47 commits into from
Dec 14, 2024
Merged
Show file tree
Hide file tree
Changes from 38 commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
220fa52
keep well variables constant during poromech init
Oct 2, 2024
fc9b41a
cleanup setMGRStrategy a bit
Oct 3, 2024
ff67658
missing setMGRStrategy and add log messages
Oct 4, 2024
3a2e268
final pass
Oct 4, 2024
0606617
Merge branch 'pt/wells-seq-poromech-init' into pt/set-mgr-strategy
Oct 4, 2024
06cbc18
enable fim mode
Oct 4, 2024
74aef74
clarify
Oct 4, 2024
6c6a0dc
Merge branch 'pt/set-mgr-strategy' into pt/enable-fim
Oct 4, 2024
a71d594
Merge branch 'develop' into pt/wells-seq-poromech-init
paveltomin Oct 4, 2024
5d52aad
Merge branch 'pt/wells-seq-poromech-init' into pt/set-mgr-strategy
paveltomin Oct 4, 2024
735140f
Merge branch 'pt/set-mgr-strategy' into pt/enable-fim
paveltomin Oct 4, 2024
bff5314
Update SolidMechanicsEmbeddedFractures.cpp
paveltomin Oct 4, 2024
cb874dc
code style
Oct 4, 2024
1796039
Merge branch 'pt/enable-fim' of https://github.com/GEOS-DEV/GEOS into…
Oct 4, 2024
a0e8b5e
Merge branch 'pt/set-mgr-strategy' into pt/enable-fim
paveltomin Oct 4, 2024
d10f4d2
Update WellSolverBase.cpp
paveltomin Oct 14, 2024
a0f4c63
Merge branch 'develop' into pt/wells-seq-poromech-init
paveltomin Oct 15, 2024
77e93bf
Merge branch 'pt/wells-seq-poromech-init' into pt/set-mgr-strategy
paveltomin Oct 25, 2024
56db5f5
Merge branch 'develop' into pt/wells-seq-poromech-init
paveltomin Oct 25, 2024
87e589d
Merge branch 'pt/wells-seq-poromech-init' into pt/set-mgr-strategy
paveltomin Oct 25, 2024
8a66c77
Merge branch 'pt/set-mgr-strategy' into pt/enable-fim
paveltomin Oct 25, 2024
0f1efa0
Merge branch 'develop' into pt/wells-seq-poromech-init
paveltomin Oct 28, 2024
1c67dc6
bug fix
Oct 28, 2024
49166d4
Merge branch 'pt/wells-seq-poromech-init' into pt/set-mgr-strategy
paveltomin Oct 28, 2024
584ee5f
Merge branch 'pt/set-mgr-strategy' into pt/enable-fim
paveltomin Oct 28, 2024
ab6763d
build fix
Oct 29, 2024
db683d1
build fix
Oct 29, 2024
a5b1931
Update CoupledReservoirAndWellsBase.hpp
paveltomin Oct 29, 2024
5cb58fb
Update SinglePhasePoromechanicsConformingFractures.hpp
paveltomin Oct 29, 2024
8cc05d3
Merge remote-tracking branch 'origin/pt/set-mgr-strategy' into pt/ena…
Oct 29, 2024
20a5f92
build fix
Oct 29, 2024
b17760b
Merge branch 'pt/set-mgr-strategy' into pt/enable-fim
paveltomin Oct 29, 2024
62f0712
Merge remote-tracking branch 'origin/develop' into pt/enable-fim
Nov 6, 2024
2a0828e
Merge branch 'pt/enable-fim' of https://github.com/GEOS-DEV/GEOS into…
Nov 6, 2024
20d1650
Revert "Merge remote-tracking branch 'origin/pt/set-mgr-strategy' int…
Nov 6, 2024
1b1a986
Revert "Revert "Merge remote-tracking branch 'origin/pt/set-mgr-strat…
Nov 6, 2024
2e637ae
Merge remote-tracking branch 'origin/develop' into pt/set-mgr-strategy
Nov 6, 2024
c58d62b
Merge branch 'pt/set-mgr-strategy' into pt/enable-fim
paveltomin Nov 6, 2024
5398dcf
Merge branch 'develop' into pt/set-mgr-strategy
paveltomin Nov 7, 2024
1b70734
Merge branch 'pt/set-mgr-strategy' into pt/enable-fim
paveltomin Nov 7, 2024
a321039
Merge remote-tracking branch 'origin/develop' into pt/set-mgr-strategy
Nov 14, 2024
5b6ac85
code style and missing changes
Nov 14, 2024
91c5058
Merge branch 'pt/set-mgr-strategy' into pt/enable-fim
paveltomin Nov 14, 2024
5a1e05c
sync
Nov 14, 2024
e9e4fbb
Merge branch 'develop' into pt/set-mgr-strategy
paveltomin Nov 17, 2024
1818d62
Merge branch 'pt/set-mgr-strategy' into pt/enable-fim
paveltomin Nov 17, 2024
bccfa1e
Merge remote-tracking branch 'origin/develop' into pt/enable-fim
Dec 13, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -64,22 +64,34 @@ SolidMechanicsEmbeddedFractures::~SolidMechanicsEmbeddedFractures()

void SolidMechanicsEmbeddedFractures::postInputInitialization()
{
SolidMechanicsLagrangianFEM::postInputInitialization();

LinearSolverParameters & linParams = m_linearSolverParameters.get();
ContactSolverBase::postInputInitialization();

if( m_useStaticCondensation )
{
linParams.dofsPerNode = 3;
linParams.isSymmetric = true;
linParams.amg.separateComponents = true;
// configure AMG
LinearSolverParameters & linearSolverParameters = m_linearSolverParameters.get();
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 );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ class SolidMechanicsEmbeddedFractures : public ContactSolverBase

virtual void postInputInitialization() override final;

void setMGRStrategy();

private:

void updateJump( DofManager const & dofManager,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,27 @@ SolidMechanicsLagrangeContact::SolidMechanicsLagrangeContact( const string & nam
setDescription( "It be used to increase the scale of the stabilization entries. A value < 1.0 results in larger entries in the stabilization matrix." );

addLogLevel< logInfo::Configuration >();
}

void SolidMechanicsLagrangeContact::postInputInitialization()
{
ContactSolverBase::postInputInitialization();

setMGRStrategy();
}

void SolidMechanicsLagrangeContact::setMGRStrategy()
{
LinearSolverParameters & linearSolverParameters = m_linearSolverParameters.get();

if( linearSolverParameters.preconditionerType != LinearSolverParameters::PreconditionerType::mgr )
return;

LinearSolverParameters & linSolParams = m_linearSolverParameters.get();
linSolParams.mgr.strategy = LinearSolverParameters::MGR::StrategyType::lagrangianContactMechanics;
linSolParams.mgr.separateComponents = true;
linSolParams.mgr.displacementFieldName = solidMechanics::totalDisplacement::key();
linSolParams.dofsPerNode = 3;
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 )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ class NumericalMethodsManager;
class SolidMechanicsLagrangeContact : public ContactSolverBase
{
public:

SolidMechanicsLagrangeContact( const string & name,
Group * const parent );

Expand Down Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,15 @@ 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 if( isThermal() )
{
Expand All @@ -90,25 +95,34 @@ setMGRStrategy()
else
{
// add Reservoir
m_linearSolverParameters.get().mgr.strategy = LinearSolverParameters::MGR::StrategyType::compositionalMultiphaseReservoirFVM;
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<>
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_ERROR( "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;
}
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 >
Expand All @@ -130,15 +144,6 @@ initializePreSubGroups()
InputError );
}

template< typename RESERVOIR_SOLVER >
void
CompositionalMultiphaseReservoirAndWells< RESERVOIR_SOLVER >::
initializePostInitialConditionsPreSubGroups()
{
Base::initializePostInitialConditionsPreSubGroups();
setMGRStrategy();
}

template< typename RESERVOIR_SOLVER >
void
CompositionalMultiphaseReservoirAndWells< RESERVOIR_SOLVER >::
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,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 */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,10 +201,18 @@ class CoupledReservoirAndWellsBase : public CoupledSolver< RESERVOIR_SOLVER, WEL
// Validate well perforations: Ensure that each perforation is in a region targeted by the solver
if( !validateWellPerforations( domain ))
{
return;
GEOS_ERROR( GEOS_FMT( "{}: well perforations validation failed, bad perforations found", this->getName()));
}
}

virtual void
postInputInitialization() override
{
Base::postInputInitialization();

setMGRStrategy();
}

virtual void
implicitStepSetup( real64 const & time_n,
real64 const & dt,
Expand Down Expand Up @@ -298,6 +306,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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,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 >
Expand Down Expand Up @@ -157,6 +166,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)" );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ class HydrofractureSolver : public POROMECHANICS_SOLVER
DofManager const & dofManager,
CRSMatrix< real64, globalIndex > & localMatrix );

virtual void setMGRStrategy() override;

private:

Expand Down
Loading
Loading