Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
13 changes: 10 additions & 3 deletions src/coreComponents/physicsSolvers/PhysicsSolverBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,11 @@ void PhysicsSolverBase::postInputInitialization()
m_writeStatisticsCSV == StatsOutputType::all );
getConvergenceStats().setCSVOutputRequest( m_writeStatisticsCSV == StatsOutputType::convergence ||
m_writeStatisticsCSV == StatsOutputType::all );
}

PhysicsSolverBase::~PhysicsSolverBase() = default;
LinearSolverParameters & linearSolverParameters = m_linearSolverParameters.get();
if( linearSolverParameters.preconditionerType == LinearSolverParameters::PreconditionerType::mgr )
setMGRStrategy();
}

void PhysicsSolverBase::initialize_postMeshGeneration()
{
Expand Down Expand Up @@ -1388,7 +1390,7 @@ void PhysicsSolverBase::solveLinearSystem( DofManager const & dofManager,

matrix.setDofManager( &dofManager );

GEOS_WARNING_IF( isDirectSolver && dofManager.numGlobalDofs() > 100000,
GEOS_WARNING_IF( logger::internal::rank == 0 && isDirectSolver && dofManager.numGlobalDofs() > 100000,
"Direct solver used for large system ( > 100,000 DOFs ). "
"This may lead to high memory consumption and long computation times. "
"Consider using an iterative solver for better performance." );
Expand Down Expand Up @@ -1696,6 +1698,11 @@ bool PhysicsSolverBase::detectOscillations() const
return f > oscillationFraction;
}

void PhysicsSolverBase::setMGRStrategy()
{
GEOS_ERROR( GEOS_FMT( "{}: MGR strategy is not implemented for {}", this->getName(), this->getCatalogName()));
}

#if defined(GEOS_USE_PYGEOSX)
PyTypeObject * PhysicsSolverBase::getPythonType() const
{ return python::getPySolverType(); }
Expand Down
10 changes: 5 additions & 5 deletions src/coreComponents/physicsSolvers/PhysicsSolverBase.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,6 @@ class PhysicsSolverBase : public ExecutableGroup
*/
PhysicsSolverBase( PhysicsSolverBase && ) = default;

/**
* @brief Destructor for PhysicsSolverBase
*/
virtual ~PhysicsSolverBase() override;

/**
* @brief Deleted constructor
*/
Expand Down Expand Up @@ -1005,6 +1000,11 @@ class PhysicsSolverBase : public ExecutableGroup

virtual void postInputInitialization() override;

/**
* @brief Set MGR strategy
*/
virtual void setMGRStrategy();

/**
* @brief Eisenstat-Walker adaptive tolerance
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,6 @@ void CompositionalMultiphaseFVM::initializePreSubGroups()
EnumStrings< ScalingType >::toString( ScalingType::Local )) );
}

m_linearSolverParameters.get().mgr.strategy = m_isThermal
? LinearSolverParameters::MGR::StrategyType::thermalCompositionalMultiphaseFVM
: LinearSolverParameters::MGR::StrategyType::compositionalMultiphaseFVM;

checkDiscretizationName();

DomainPartition & domain = this->getGroupByPath< DomainPartition >( "/Problem/domain" );
Expand All @@ -209,6 +205,13 @@ void CompositionalMultiphaseFVM::initializePreSubGroups()
getName(), EnumStrings< UpwindingScheme >::toString( UpwindingScheme::HU2PH )));
}

void CompositionalMultiphaseFVM::setMGRStrategy()
{
m_linearSolverParameters.get().mgr.strategy = m_isThermal
? LinearSolverParameters::MGR::StrategyType::thermalCompositionalMultiphaseFVM
: LinearSolverParameters::MGR::StrategyType::compositionalMultiphaseFVM;
}

void CompositionalMultiphaseFVM::setupDofs( DomainPartition const & domain,
DofManager & dofManager ) const
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,8 @@ class CompositionalMultiphaseFVM : public CompositionalMultiphaseBase

virtual void initializePreSubGroups() override;

virtual void setMGRStrategy() override;

real64 setNextDtBasedOnCFL( real64 const & currentDt,
DomainPartition & domain );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ CompositionalMultiphaseHybridFVM::CompositionalMultiphaseHybridFVM( const std::s
Group * const parent ):
CompositionalMultiphaseBase( name, parent ),
m_lengthTolerance( 0 )
{}

void CompositionalMultiphaseHybridFVM::setMGRStrategy()
{
m_linearSolverParameters.get().mgr.strategy = LinearSolverParameters::MGR::StrategyType::compositionalMultiphaseHybridFVM;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ class CompositionalMultiphaseHybridFVM : public CompositionalMultiphaseBase

struct viewKeyStruct : CompositionalMultiphaseBase::viewKeyStruct
{
static constexpr char const * faceDofFieldString() { return "faceCenteredVariables"; }
static constexpr char const *faceDofFieldString() { return "faceCenteredVariables"; }
};

virtual void initializePostInitialConditionsPreSubGroups() override;
Expand All @@ -170,6 +170,8 @@ class CompositionalMultiphaseHybridFVM : public CompositionalMultiphaseBase

protected:

virtual void setMGRStrategy() override;

/// precompute the minGravityCoefficient for the buoyancy term
void precomputeData( MeshLevel & mesh, string_array const & regionNames ) override;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,6 @@ ImmiscibleMultiphaseFlow::ImmiscibleMultiphaseFlow( const string & name,
setDescription( "Target (absolute) change in phase volume fraction in a time step" );
}

void ImmiscibleMultiphaseFlow::postInputInitialization()
{
FlowSolverBase::postInputInitialization();
}

void ImmiscibleMultiphaseFlow::registerDataOnMesh( Group & meshBodies )
{
FlowSolverBase::registerDataOnMesh( meshBodies );
Expand Down Expand Up @@ -185,8 +180,6 @@ void ImmiscibleMultiphaseFlow::setConstitutiveNames( ElementSubRegionBase & subR

void ImmiscibleMultiphaseFlow::initializePreSubGroups()
{
m_linearSolverParameters.get().mgr.strategy = LinearSolverParameters::MGR::StrategyType::immiscibleMultiphaseFVM;

FlowSolverBase::initializePreSubGroups();

DomainPartition & domain = this->getGroupByPath< DomainPartition >( "/Problem/domain" );
Expand All @@ -205,6 +198,10 @@ void ImmiscibleMultiphaseFlow::initializePreSubGroups()
} );
}

void ImmiscibleMultiphaseFlow::setMGRStrategy()
{
m_linearSolverParameters.get().mgr.strategy = LinearSolverParameters::MGR::StrategyType::immiscibleMultiphaseFVM;
}

void ImmiscibleMultiphaseFlow::updateFluidModel( ObjectManagerBase & dataGroup ) const
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,10 +233,11 @@ class ImmiscibleMultiphaseFlow : public FlowSolverBase
static constexpr char const * elemDofFieldString() { return "elemDofField"; }
};

protected:

private:
virtual void setMGRStrategy() override;

virtual void postInputInitialization() override;
private:

/**
* @brief Update all relevant fluid models using current values of pressure and phase volume fraction
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,10 @@ ReactiveCompositionalMultiphaseOBL::ReactiveCompositionalMultiphaseOBL( const st
setRTTypeName( rtTypes::CustomTypes::groupNameRefArray ).
setInputFlag( InputFlags::OPTIONAL ).
setDescription( "List of fluid phases" );
}

void ReactiveCompositionalMultiphaseOBL::setMGRStrategy()
{
m_linearSolverParameters.get().mgr.strategy = LinearSolverParameters::MGR::StrategyType::reactiveCompositionalMultiphaseOBL;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,9 @@ class ReactiveCompositionalMultiphaseOBL : public FlowSolverBase

virtual void initializePreSubGroups() override;

protected:

virtual void setMGRStrategy() override;

private:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,12 @@ SinglePhaseHybridFVM::SinglePhaseHybridFVM( const string & name,
SinglePhaseBase( name, parent ),
m_areaRelTol( 1e-8 )
{

// one cell-centered dof per cell
m_numDofPerCell = 1;
}

void SinglePhaseHybridFVM::setMGRStrategy()
{
m_linearSolverParameters.get().mgr.strategy = LinearSolverParameters::MGR::StrategyType::singlePhaseHybridFVM;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ class SinglePhaseHybridFVM : public SinglePhaseBase
SinglePhaseHybridFVM( const string & name,
Group * const parent );


/// deleted default constructor
SinglePhaseHybridFVM() = delete;

Expand All @@ -70,7 +69,9 @@ class SinglePhaseHybridFVM : public SinglePhaseBase
* @return string that contains the catalog name to generate a new NodeManager object through the object catalog.
*/
static string catalogName()
{ return "SinglePhaseHybridFVM"; }
{
return "SinglePhaseHybridFVM";
}
/**
* @copydoc PhysicsSolverBase::getCatalogName()
*/
Expand Down Expand Up @@ -185,6 +186,10 @@ class SinglePhaseHybridFVM : public SinglePhaseBase

virtual void initializePostInitialConditionsPreSubGroups() override;

protected:

virtual void setMGRStrategy() override;

private:

/// relative tolerance (redundant with FluxApproximationBase)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,6 @@ ProppantTransport::ProppantTransport( const string & name,
setDescription( "Flag that enables/disables proppant-packing update" );
}

void ProppantTransport::postInputInitialization()
{
FlowSolverBase::postInputInitialization();
}

void ProppantTransport::registerDataOnMesh( Group & meshBodies )
{
FlowSolverBase::registerDataOnMesh( meshBodies );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,10 +215,6 @@ class ProppantTransport : public FlowSolverBase
*/
void updateState( ObjectManagerBase & dataGroup );

protected:

virtual void postInputInitialization() override;

private:

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,10 @@ QuasiDynamicEarthQuake< RSSOLVER_TYPE >::QuasiDynamicEarthQuake( const string &
template< typename RSSOLVER_TYPE >
void QuasiDynamicEarthQuake< RSSOLVER_TYPE >::postInputInitialization()
{
PhysicsSolverBase::postInputInitialization();

// Initialize member stress solver as specified in XML input
m_stressSolver = &this->getParent().template getGroup< PhysicsSolverBase >( m_stressSolverName );

PhysicsSolverBase::postInputInitialization();
}

template< typename RSSOLVER_TYPE >
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ SeismicityRate::SeismicityRate( const string & name,

void SeismicityRate::postInputInitialization()
{
PhysicsSolverBase::postInputInitialization();

// Check orthogonality of user-specified faults
if( std::abs( LvArray::tensorOps::AiBi< 3 >( m_faultNormalDirection, m_faultShearDirection )) > 1e-8 )
{
Expand All @@ -87,8 +89,6 @@ void SeismicityRate::postInputInitialization()
{
m_stressSolver = &this->getParent().getGroup< PhysicsSolverBase >( m_stressSolverName );
}

PhysicsSolverBase::postInputInitialization();
}

SeismicityRate::~SeismicityRate()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,6 @@ setMGRStrategy()
{
LinearSolverParameters & linearSolverParameters = m_linearSolverParameters.get();

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

linearSolverParameters.mgr.separateComponents = true;
linearSolverParameters.dofsPerNode = 3;

Expand Down Expand Up @@ -118,9 +115,6 @@ setMGRStrategy()
{
LinearSolverParameters & linearSolverParameters = m_linearSolverParameters.get();

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

linearSolverParameters.mgr.separateComponents = true;
linearSolverParameters.dofsPerNode = 3;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,6 @@ class CoupledReservoirAndWellsBase : public CoupledSolver< RESERVOIR_SOLVER, WEL

// assume that reservoir solver discretization is the primary one
this->m_discretizationName = reservoirSolver()->getDiscretizationName();

setMGRStrategy();
}

virtual void
Expand Down Expand Up @@ -282,12 +280,6 @@ 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 @@ -721,7 +721,7 @@ class CoupledSolver : public PhysicsSolverBase
virtual void
postInputInitialization() override
{
setSubSolvers();
setSubSolvers(); // has to go first

PhysicsSolverBase::postInputInitialization();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,6 @@ void HydrofractureSolver< POROMECHANICS_SOLVER >::setMGRStrategy()
{
LinearSolverParameters & linearSolverParameters = this->m_linearSolverParameters.get();

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

linearSolverParameters.mgr.separateComponents = true;
linearSolverParameters.dofsPerNode = 3;

Expand Down Expand Up @@ -223,8 +220,6 @@ 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 @@ -176,9 +176,6 @@ void MultiphasePoromechanics<>::setMGRStrategy()
{
LinearSolverParameters & linearSolverParameters = this->m_linearSolverParameters.get();

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

linearSolverParameters.mgr.separateComponents = true;
linearSolverParameters.dofsPerNode = 3;

Expand Down Expand Up @@ -210,9 +207,6 @@ void MultiphasePoromechanics< CompositionalMultiphaseReservoirAndWells<>, SolidM

LinearSolverParameters & linearSolverParameters = m_linearSolverParameters.get();

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

linearSolverParameters.mgr.separateComponents = true;
linearSolverParameters.dofsPerNode = 3;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,7 @@ class MultiphasePoromechanics : public PoromechanicsSolver< FLOW_SOLVER, MECHANI

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()));
Base::setMGRStrategy();
}

/**
Expand Down
Loading
Loading