GEOS
PhysicsSolverBase.hpp
Go to the documentation of this file.
1 /*
2  * ------------------------------------------------------------------------------------------------------------
3  * SPDX-License-Identifier: LGPL-2.1-only
4  *
5  * Copyright (c) 2016-2024 Lawrence Livermore National Security LLC
6  * Copyright (c) 2018-2024 Total, S.A
7  * Copyright (c) 2018-2024 The Board of Trustees of the Leland Stanford Junior University
8  * Copyright (c) 2023-2024 Chevron
9  * Copyright (c) 2019- GEOS/GEOSX Contributors
10  * All rights reserved
11  *
12  * See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details.
13  * ------------------------------------------------------------------------------------------------------------
14  */
15 
20 #ifndef GEOS_PHYSICSSOLVERS_PHYSICSSOLVERBASE_HPP_
21 #define GEOS_PHYSICSSOLVERS_PHYSICSSOLVERBASE_HPP_
22 
23 #include "codingUtilities/traits.hpp"
24 #include "common/DataTypes.hpp"
29 #include "mesh/MeshBody.hpp"
30 #include "physicsSolvers/NonlinearSolverParameters.hpp"
32 #include "physicsSolvers/SolverStatistics.hpp"
34 
35 #include <limits>
36 
37 namespace geos
38 {
39 
40 class DomainPartition;
41 
51 {
52 public:
53 
59  explicit PhysicsSolverBase( string const & name,
60  Group * const parent );
61 
66 
70  virtual ~PhysicsSolverBase() override;
71 
75  PhysicsSolverBase() = delete;
76 
80  PhysicsSolverBase( PhysicsSolverBase const & ) = delete;
81 
86 
91 
95  virtual string getCatalogName() const = 0;
96 
97 
102  virtual void registerDataOnMesh( Group & MeshBodies ) override;
103 
107  virtual void initialize_postMeshGeneration() override;
108 
113  void generateMeshTargetsFromTargetRegions( Group const & meshBodies );
114 
118  virtual void cleanup( real64 const time_n,
119  integer const cycleNumber,
120  integer const eventCounter,
121  real64 const eventProgress,
122  DomainPartition & domain ) override;
123 
127  virtual bool execute( real64 const time_n,
128  real64 const dt,
129  integer const cycleNumber,
130  integer const eventCounter,
131  real64 const eventProgress,
132  DomainPartition & domain ) override;
133 
139 
144  ParallelMatrix const & getSystemMatrix() const { return m_matrix; }
145 
151 
156  ParallelVector const & getSystemRhs() const { return m_rhs; }
157 
163 
168  ParallelVector const & getSystemSolution() const { return m_solution; }
169 
175 
180  DofManager const & getDofManager() const { return m_dofManager; }
181 
187 
193 
212  virtual real64 solverStep( real64 const & time_n,
213  real64 const & dt,
214  integer const cycleNumber,
215  DomainPartition & domain );
216 
223  virtual real64 setNextDt( real64 const & currentDt,
224  DomainPartition & domain );
225 
231  virtual real64 setNextDtBasedOnNewtonIter( real64 const & currentDt );
232 
239  virtual real64 setNextDtBasedOnStateChange( real64 const & currentDt,
240  DomainPartition & domain );
241 
248  virtual real64 setNextDtBasedOnCFL( real64 const & currentDt,
249  DomainPartition & domain );
250 
251 
252 
261  virtual real64 explicitStep( real64 const & time_n,
262  real64 const & dt,
263  integer const cycleNumber,
264  DomainPartition & domain );
265 
279  virtual real64 nonlinearImplicitStep( real64 const & time_n,
280  real64 const & dt,
281  integer const cycleNumber,
282  DomainPartition & domain );
283 
303  virtual bool
304  lineSearch( real64 const & time_n,
305  real64 const & dt,
306  integer const cycleNumber,
307  DomainPartition & domain,
308  DofManager const & dofManager,
309  CRSMatrixView< real64, globalIndex const > const & localMatrix,
310  ParallelVector & rhs,
311  ParallelVector & solution,
312  real64 const scaleFactor,
313  real64 & lastResidual );
314 
331  virtual bool
333  real64 const & dt,
334  integer const cycleNumber,
335  DomainPartition & domain,
336  DofManager const & dofManager,
337  CRSMatrixView< real64, globalIndex const > const & localMatrix,
338  ParallelVector & rhs,
339  ParallelVector & solution,
340  real64 const scaleFactor,
341  real64 & lastResidual,
342  real64 & residualNormT );
343 
358  virtual real64 linearImplicitStep( real64 const & time_n,
359  real64 const & dt,
360  integer const cycleNumber,
361  DomainPartition & domain );
362 
375  virtual void
376  implicitStepSetup( real64 const & time_n,
377  real64 const & dt,
378  DomainPartition & domain );
379 
385  virtual void
386  setupDofs( DomainPartition const & domain,
387  DofManager & dofManager ) const;
388 
401  virtual void
403  DofManager & dofManager,
404  CRSMatrix< real64, globalIndex > & localMatrix,
405  ParallelVector & rhs,
406  ParallelVector & solution,
407  bool const setSparsity = true );
408 
427  virtual void
428  assembleSystem( real64 const time,
429  real64 const dt,
430  DomainPartition & domain,
431  DofManager const & dofManager,
432  CRSMatrixView< real64, globalIndex const > const & localMatrix,
433  arrayView1d< real64 > const & localRhs );
434 
447  virtual void
449  real64 const dt,
450  DomainPartition & domain,
451  DofManager const & dofManager,
452  CRSMatrixView< real64, globalIndex const > const & localMatrix,
453  arrayView1d< real64 > const & localRhs );
454 
463  void
464  debugOutputSystem( real64 const & time,
465  integer const cycleNumber,
466  integer const nonlinearIteration,
467  ParallelMatrix const & matrix,
468  ParallelVector const & rhs ) const;
469 
477  void
479  integer const cycleNumber,
480  integer const nonlinearIteration,
481  ParallelVector const & solution ) const;
482 
495  virtual real64
497  real64 const & dt,
498  DomainPartition const & domain,
499  DofManager const & dofManager,
500  arrayView1d< real64 const > const & localRhs );
501 
515  virtual void
516  solveLinearSystem( DofManager const & dofManager,
517  ParallelMatrix & matrix,
518  ParallelVector & rhs,
519  ParallelVector & solution );
520 
533  virtual bool
535  DofManager const & dofManager,
536  arrayView1d< real64 const > const & localSolution,
537  real64 const scalingFactor );
538 
546  virtual real64
548  DofManager const & dofManager,
549  arrayView1d< real64 const > const & localSolution );
550 
572  virtual void
573  applySystemSolution( DofManager const & dofManager,
574  arrayView1d< real64 const > const & localSolution,
575  real64 const scalingFactor,
576  real64 const dt,
577  DomainPartition & domain );
578 
584  virtual bool updateConfiguration( DomainPartition & domain );
585 
590  virtual void outputConfigurationStatistics( DomainPartition const & domain ) const;
591 
597 
603  virtual bool resetConfigurationToDefault( DomainPartition & domain ) const;
604 
605 
610  virtual void updateState( DomainPartition & domain );
611 
623  virtual void
625 
639  virtual void
641  real64 const & dt,
642  DomainPartition & domain );
643 
644 
649  virtual real64 getTimestepRequest( real64 const ) override
650  {return m_nextDt;};
658  {return m_nextDt;};
659 
666  virtual Group * createChild( string const & childKey, string const & childName ) override;
667 
672 
678 
683  {
685  static constexpr char const * cflFactorString() { return "cflFactor"; }
686 
688  static constexpr char const * initialDtString() { return "initialDt"; }
689 
691  static constexpr char const * minDtIncreaseIntervalString() { return "minDtIncreaseInterval"; }
692 
694  static constexpr char const * maxStableDtString() { return "maxStableDt"; }
695 
697  static constexpr char const * discretizationString() { return "discretization"; }
698 
700  static constexpr char const * targetRegionsString() { return "targetRegions"; }
701 
703  static constexpr char const * meshTargetsString() { return "meshTargets"; }
704 
706  static constexpr char const * writeLinearSystemString() { return "writeLinearSystem"; }
707  };
708 
713  {
715  static constexpr char const * linearSolverParametersString() { return "LinearSolverParameters"; }
716 
718  static constexpr char const * nonlinearSolverParametersString() { return "NonlinearSolverParameters"; }
719 
721  static constexpr char const * solverStatisticsString() { return "SolverStatistics"; }
722  };
723 
729 
736 
741  void setSystemSetupTimestamp( Timestamp timestamp ) { m_systemSetupTimestamp = timestamp; }
742 
751  R1Tensor const gravityVector() const;
752 
758  virtual bool checkSequentialSolutionIncrements( DomainPartition & domain ) const;
759 
765 
771  {
772  return m_linearSolverParameters.get();
773  }
774 
780  {
781  return m_linearSolverParameters.get();
782  }
783 
789  {
791  }
792 
798  {
800  }
801 
805  virtual void
807  { /* empty here, overriden in CoupledSolver */ }
808 
814  localIndex targetRegionIndex( string const & regionName ) const;
815 
816 
817 
825  template< typename LAMBDA >
826  void forDiscretizationOnMeshTargets( Group const & meshBodies, LAMBDA && lambda ) const
827  {
828  for( auto const & target: m_meshTargets )
829  {
830  string const meshBodyName = target.first.first;
831  string const meshLevelName = target.first.second;
832  arrayView1d< string const > const & regionNames = target.second.toViewConst();
833  MeshBody const & meshBody = meshBodies.getGroup< MeshBody >( meshBodyName );
834 
835  MeshLevel const * meshLevelPtr = meshBody.getMeshLevels().getGroupPointer< MeshLevel >( meshLevelName );
836  if( meshLevelPtr==nullptr )
837  {
839  }
840  lambda( meshBodyName, *meshLevelPtr, regionNames );
841  }
842  }
843 
851  template< typename LAMBDA >
852  void forDiscretizationOnMeshTargets( Group & meshBodies, LAMBDA && lambda ) const
853  {
854  for( auto const & target: m_meshTargets )
855  {
856  string const meshBodyName = target.first.first;
857  string const meshLevelName = target.first.second;
858  arrayView1d< string const > const & regionNames = target.second.toViewConst();
859  MeshBody & meshBody = meshBodies.getGroup< MeshBody >( meshBodyName );
860 
861  MeshLevel * meshLevelPtr = meshBody.getMeshLevels().getGroupPointer< MeshLevel >( meshLevelName );
862  if( meshLevelPtr==nullptr )
863  {
865  }
866  lambda( meshBodyName, *meshLevelPtr, regionNames );
867  }
868  }
869 
875 
884  virtual bool registerCallback( void * func, const std::type_info & funcType ) final override;
885 
891 
897 
898 #if defined(GEOS_USE_PYGEOSX)
903  virtual PyTypeObject * getPythonType() const override;
904 #endif
905 
911  {
912  return m_meshTargets;
913  }
914 protected:
915 
941  real64 eisenstatWalker( real64 const newNewtonNorm,
942  real64 const oldNewtonNorm,
943  LinearSolverParameters::Krylov const & krylovParams );
944 
952  template< typename CONSTITUTIVE_BASE_TYPE >
953  static string getConstitutiveName( ElementSubRegionBase const & subRegion );
954 
962  template< typename CONSTITUTIVE_BASE_TYPE >
963  static string getConstitutiveName( ParticleSubRegionBase const & subRegion ); // particle overload
964 
971  virtual void setConstitutiveNamesCallSuper( ElementSubRegionBase & subRegion ) const { GEOS_UNUSED_VAR( subRegion ); }
972 
973 
982  template< typename BASETYPE = constitutive::ConstitutiveBase, typename LOOKUP_TYPE >
983  static BASETYPE const & getConstitutiveModel( dataRepository::Group const & dataGroup, LOOKUP_TYPE const & key )
984  {
986  return constitutiveModels.getGroup< BASETYPE >( key );
987  }
988 
997  template< typename BASETYPE = constitutive::ConstitutiveBase, typename LOOKUP_TYPE >
998  static BASETYPE & getConstitutiveModel( dataRepository::Group & dataGroup, LOOKUP_TYPE const & key )
999  {
1001  return constitutiveModels.getGroup< BASETYPE >( key );
1002  }
1003 
1004 
1005 
1008 
1011 
1014 
1017 
1020 
1023 
1026 
1029 
1032 
1035 
1037  std::unique_ptr< PreconditionerBase< LAInterface > > m_precond;
1038 
1041 
1044 
1047 
1050 
1053 
1056 
1059 
1061  std::map< std::string, std::chrono::system_clock::duration > m_timers;
1062 
1063 private:
1065  array1d< string > m_targetRegionNames;
1066 
1069 
1076  virtual void setConstitutiveNames( ElementSubRegionBase & subRegion ) const { GEOS_UNUSED_VAR( subRegion ); }
1077 
1086  bool solveNonlinearSystem( real64 const & time_n,
1087  real64 const & dt,
1088  integer const cycleNumber,
1089  DomainPartition & domain );
1090 
1097  void logEndOfCycleInformation( integer const cycleNumber,
1098  integer const numOfSubSteps,
1099  std::vector< real64 > const & subStepDt ) const;
1100 
1101 };
1102 
1103 template< typename CONSTITUTIVE_BASE_TYPE >
1105 {
1106  string validName;
1107  dataRepository::Group const & constitutiveModels = subRegion.getConstitutiveModels();
1108 
1109  constitutiveModels.forSubGroups< CONSTITUTIVE_BASE_TYPE >( [&]( dataRepository::Group const & model )
1110  {
1111  GEOS_ERROR_IF( !validName.empty(), "A valid constitutive model was already found." );
1112  validName = model.getName();
1113  } );
1114  return validName;
1115 }
1116 
1117 template< typename CONSTITUTIVE_BASE_TYPE >
1118 string PhysicsSolverBase::getConstitutiveName( ParticleSubRegionBase const & subRegion ) // particle overload
1119 {
1120  string validName;
1121  dataRepository::Group const & constitutiveModels = subRegion.getConstitutiveModels();
1122 
1123  constitutiveModels.forSubGroups< CONSTITUTIVE_BASE_TYPE >( [&]( dataRepository::Group const & model )
1124  {
1125  GEOS_ERROR_IF( !validName.empty(), "A valid constitutive model was already found." );
1126  validName = model.getName();
1127  } );
1128  return validName;
1129 }
1130 
1131 
1132 } // namespace geos
1133 
1134 
1135 #endif /* GEOS_PHYSICSSOLVERS_PHYSICSSOLVERBASE_HPP_ */
#define GEOS_UNUSED_VAR(...)
Mark an unused variable and silence compiler warnings.
Definition: GeosxMacros.hpp:84
#define GEOS_ERROR_IF(EXP, msg)
Conditionally raise a hard error and terminate the program.
Definition: Logger.hpp:142
The DoFManager is responsible for allocating global dofs, constructing sparsity patterns,...
Definition: DofManager.hpp:44
Partition of the decomposed physical domain. It also manages the connexion information to its neighbo...
dataRepository::Group const & getConstitutiveModels() const
Get the group in which the constitutive models of this subregion are registered.
Linear solver parameters with Group capabilities.
The class is used to manage mesh body.
Definition: MeshBody.hpp:36
Group & getMeshLevels()
Get the meshLevels group.
Definition: MeshBody.hpp:86
Class facilitating the representation of a multi-level discretization of a MeshBody.
Definition: MeshLevel.hpp:42
dataRepository::Group const & getConstitutiveModels() const
Get the group in which the constitutive models of this subregion are registered.
Base class for all physics solvers.
SolverStatistics const & getSolverStatistics() const
const accessor for the solver statistics.
void setSystemSetupTimestamp(Timestamp timestamp)
set the timestamp of the system setup
virtual void registerDataOnMesh(Group &MeshBodies) override
Register wrappers that contain data on the mesh objects.
PhysicsSolverBase(PhysicsSolverBase const &)=delete
Deleted copy constructor.
static BASETYPE const & getConstitutiveModel(dataRepository::Group const &dataGroup, LOOKUP_TYPE const &key)
Get the Constitutive Model object.
virtual string getCatalogName() const =0
DofManager & getDofManager()
Getter for degree-of-freedom manager.
SolverStatistics m_solverStatistics
Solver statistics.
real64 m_cflFactor
Courant–Friedrichs–Lewy factor for the timestep.
string m_discretizationName
name of the FV discretization object in the data repository
map< std::pair< string, string >, array1d< string > > const & getMeshTargets() const
accessor for m_meshTargets
string getDiscretizationName() const
return the name of the discretization object
ParallelVector const & getSystemRhs() const
Getter for system rhs vector.
ParallelMatrix m_matrix
System matrix.
std::map< std::string, std::chrono::system_clock::duration > m_timers
Timers for the aggregate profiling of the solver.
LinearSolverParameters & getLinearSolverParameters()
accessor for the linear solver parameters.
static BASETYPE & getConstitutiveModel(dataRepository::Group &dataGroup, LOOKUP_TYPE const &key)
Get the Constitutive Model object.
void forDiscretizationOnMeshTargets(Group const &meshBodies, LAMBDA &&lambda) const
Loop over the target discretization on all mesh targets and apply callback.
virtual bool checkSequentialSolutionIncrements(DomainPartition &domain) const
Check if the solution increments are ok to use.
PhysicsSolverBase(string const &name, Group *const parent)
Constructor for PhysicsSolverBase.
ParallelMatrix & getSystemMatrix()
Getter for system matrix.
static string getConstitutiveName(ElementSubRegionBase const &subRegion)
Get the Constitutive Name object.
integer m_numTimestepsSinceLastDtCut
Number of cycles since last timestep cut.
virtual void setConstitutiveNamesCallSuper(ElementSubRegionBase &subRegion) const
This function sets constitutive name fields on an ElementSubRegionBase, and calls the base function i...
ParallelVector & getSystemRhs()
Getter for system rhs vector.
virtual void cleanup(real64 const time_n, integer const cycleNumber, integer const eventCounter, real64 const eventProgress, DomainPartition &domain) override
Called as the code exits the main run loop.
std::unique_ptr< PreconditionerBase< LAInterface > > m_precond
Custom preconditioner for the "native" iterative solver.
Timestamp getMeshModificationTimestamp(DomainPartition &domain) const
getter for the timestamp of the mesh modification on the mesh levels
void forDiscretizationOnMeshTargets(Group &meshBodies, LAMBDA &&lambda) const
Loop over the target discretization on all mesh targets and apply callback.
localIndex targetRegionIndex(string const &regionName) const
Get position of a given region within solver's target region list.
ParallelMatrix const & getSystemMatrix() const
Getter for system rhs vector.
integer m_writeLinearSystem
flag for debug output of matrix, rhs, and solution
PhysicsSolverBase()=delete
Deleted constructor.
LinearSolverParameters const & getLinearSolverParameters() const
const accessor for the linear solver parameters.
LinearSolverResult m_linearSolverResult
Result of the last linear solve.
virtual ~PhysicsSolverBase() override
Destructor for PhysicsSolverBase.
CRSMatrix< real64, globalIndex > m_localMatrix
Local system matrix and rhs.
ParallelVector const & getSystemSolution() const
Getter for system solution vector.
virtual void synchronizeNonlinearSolverParameters()
syncronize the nonlinear solver parameters.
virtual bool registerCallback(void *func, const std::type_info &funcType) final override
function to set the value of m_assemblyCallback
SolverStatistics & getSolverStatistics()
accessor for the solver statistics.
virtual bool execute(real64 const time_n, real64 const dt, integer const cycleNumber, integer const eventCounter, real64 const eventProgress, DomainPartition &domain) override
Main extension point of executable targets.
virtual Group * createChild(string const &childKey, string const &childName) override
creates a child group of of this PhysicsSolverBase instantiation
virtual void saveSequentialIterationState(DomainPartition &domain)
Save the state of the solver for sequential iteration.
PhysicsSolverBase(PhysicsSolverBase &&)=default
Move constructor for PhysicsSolverBase.
real64 getTimestepRequest()
getter for the next timestep size
PhysicsSolverBase & operator=(PhysicsSolverBase const &)=delete
Deleted copy assignment operator.
static CatalogInterface::CatalogType & getCatalog()
Get the singleton catalog for PhysicsSolverBase.
PhysicsSolverBase & operator=(PhysicsSolverBase &&)=delete
Deleted move assignment operator.
NonlinearSolverParameters const & getNonlinearSolverParameters() const
const accessor for the nonlinear solver parameters.
DofManager m_dofManager
Data structure to handle degrees of freedom.
R1Tensor const gravityVector() const
return the value of the gravity vector specified in PhysicsSolverManager
virtual void initialize_postMeshGeneration() override
Initialization tasks after mesh generation is completed.
real64 m_maxStableDt
maximum stable time step
real64 eisenstatWalker(real64 const newNewtonNorm, real64 const oldNewtonNorm, LinearSolverParameters::Krylov const &krylovParams)
Eisenstat-Walker adaptive tolerance.
ParallelVector m_solution
System solution vector.
ParallelVector m_rhs
System right-hand side vector.
std::function< void(CRSMatrix< real64, globalIndex >, array1d< real64 >) > m_assemblyCallback
Callback function for assembly step.
CRSMatrixView< real64 const, globalIndex const > getLocalMatrix() const
Getter for local matrix.
Timestamp getSystemSetupTimestamp() const
getter for the timestamp of the system setup
ParallelVector & getSystemSolution()
Getter for system solution vector.
NonlinearSolverParameters & getNonlinearSolverParameters()
accessor for the nonlinear solver parameters.
Timestamp m_systemSetupTimestamp
Timestamp of the last call to setup system.
LinearSolverParametersInput m_linearSolverParameters
Linear solver parameters.
CRSMatrix< real64, globalIndex > & getLocalMatrix()
Getter for local matrix.
NonlinearSolverParameters m_nonlinearSolverParameters
Nonlinear solver parameters.
real64 m_nextDt
timestep of the next cycle
void generateMeshTargetsFromTargetRegions(Group const &meshBodies)
Generate mesh targets from target regions.
DofManager const & getDofManager() const
Getter for degree-of-freedom manager.
This class is used to log the solver statistics.
This class provides the base class/interface for the catalog value objects.
std::unordered_map< std::string, std::unique_ptr< CatalogInterface< BASETYPE, ARGS... > > > CatalogType
This is the type that will be used for the catalog. The catalog is actually instantiated in the BASET...
T * getGroupPointer(KEY const &key)
Return a pointer to a sub-group of the current Group.
Definition: Group.hpp:317
T & getGroup(KEY const &key)
Return a reference to a sub-group of the current Group.
Definition: Group.hpp:336
void forSubGroups(LAMBDA &&lambda)
Apply the given functor to subgroups that can be casted to one of specified types.
Definition: Group.hpp:518
Base template for ordered and unordered maps.
Definition: DataTypes.hpp:329
virtual void updateState(DomainPartition &domain)
Recompute all dependent quantities from primary variables (including constitutive models)
virtual void applySystemSolution(DofManager const &dofManager, arrayView1d< real64 const > const &localSolution, real64 const scalingFactor, real64 const dt, DomainPartition &domain)
Function to apply the solution vector to the state.
virtual bool lineSearch(real64 const &time_n, real64 const &dt, integer const cycleNumber, DomainPartition &domain, DofManager const &dofManager, CRSMatrixView< real64, globalIndex const > const &localMatrix, ParallelVector &rhs, ParallelVector &solution, real64 const scaleFactor, real64 &lastResidual)
Function to perform line search.
virtual real64 setNextDtBasedOnStateChange(real64 const &currentDt, DomainPartition &domain)
function to set the next dt based on state change
virtual void resetStateToBeginningOfStep(DomainPartition &domain)
reset state of physics back to the beginning of the step.
virtual void assembleSystem(real64 const time, real64 const dt, DomainPartition &domain, DofManager const &dofManager, CRSMatrixView< real64, globalIndex const > const &localMatrix, arrayView1d< real64 > const &localRhs)
function to assemble the linear system matrix and rhs
virtual bool resetConfigurationToDefault(DomainPartition &domain) const
resets the configuration to the default value.
virtual real64 linearImplicitStep(real64 const &time_n, real64 const &dt, integer const cycleNumber, DomainPartition &domain)
Function for a linear implicit integration step.
virtual bool updateConfiguration(DomainPartition &domain)
updates the configuration (if needed) based on the state after a converged Newton loop.
virtual void applyBoundaryConditions(real64 const time, real64 const dt, DomainPartition &domain, DofManager const &dofManager, CRSMatrixView< real64, globalIndex const > const &localMatrix, arrayView1d< real64 > const &localRhs)
apply boundary condition to system
virtual real64 nonlinearImplicitStep(real64 const &time_n, real64 const &dt, integer const cycleNumber, DomainPartition &domain)
Function for a nonlinear implicit integration step.
virtual real64 scalingForSystemSolution(DomainPartition &domain, DofManager const &dofManager, arrayView1d< real64 const > const &localSolution)
Function to determine if the solution vector should be scaled back in order to maintain a known const...
virtual void implicitStepSetup(real64 const &time_n, real64 const &dt, DomainPartition &domain)
function to perform setup for implicit timestep
void debugOutputSolution(real64 const &time, integer const cycleNumber, integer const nonlinearIteration, ParallelVector const &solution) const
Output the linear system solution for debug purposes.
virtual void setupSystem(DomainPartition &domain, DofManager &dofManager, CRSMatrix< real64, globalIndex > &localMatrix, ParallelVector &rhs, ParallelVector &solution, bool const setSparsity=true)
Set up the linear system (DOF indices and sparsity patterns)
virtual bool checkSystemSolution(DomainPartition &domain, DofManager const &dofManager, arrayView1d< real64 const > const &localSolution, real64 const scalingFactor)
Function to check system solution for physical consistency and constraint violation.
virtual real64 calculateResidualNorm(real64 const &time, real64 const &dt, DomainPartition const &domain, DofManager const &dofManager, arrayView1d< real64 const > const &localRhs)
calculate the norm of the global system residual
virtual real64 setNextDtBasedOnCFL(real64 const &currentDt, DomainPartition &domain)
function to set the next dt based on state change
virtual real64 solverStep(real64 const &time_n, real64 const &dt, integer const cycleNumber, DomainPartition &domain)
entry function to perform a solver step
virtual void setupDofs(DomainPartition const &domain, DofManager &dofManager) const
Populate degree-of-freedom manager with fields relevant to this solver.
virtual void implicitStepComplete(real64 const &time, real64 const &dt, DomainPartition &domain)
perform cleanup for implicit timestep
virtual real64 setNextDt(real64 const &currentDt, DomainPartition &domain)
function to set the next time step size
virtual void outputConfigurationStatistics(DomainPartition const &domain) const
virtual real64 setNextDtBasedOnNewtonIter(real64 const &currentDt)
function to set the next time step size based on Newton convergence
void debugOutputSystem(real64 const &time, integer const cycleNumber, integer const nonlinearIteration, ParallelMatrix const &matrix, ParallelVector const &rhs) const
Output the assembled linear system for debug purposes.
virtual void solveLinearSystem(DofManager const &dofManager, ParallelMatrix &matrix, ParallelVector &rhs, ParallelVector &solution)
function to apply a linear system solver to the assembled system.
virtual real64 getTimestepRequest(real64 const) override
getter for the next timestep size
virtual bool lineSearchWithParabolicInterpolation(real64 const &time_n, real64 const &dt, integer const cycleNumber, DomainPartition &domain, DofManager const &dofManager, CRSMatrixView< real64, globalIndex const > const &localMatrix, ParallelVector &rhs, ParallelVector &solution, real64 const scaleFactor, real64 &lastResidual, real64 &residualNormT)
Function to perform line search using a parabolic interpolation to find the scaling factor.
virtual void resetConfigurationToBeginningOfStep(DomainPartition &domain)
resets the configuration to the beginning of the time-step.
virtual real64 explicitStep(real64 const &time_n, real64 const &dt, integer const cycleNumber, DomainPartition &domain)
Entry function for an explicit time integration step.
ArrayView< T, 1 > arrayView1d
Alias for 1D array view.
Definition: DataTypes.hpp:180
unsigned long long int Timestamp
Timestamp type (used to perform actions such a sparsity pattern computation after mesh modifications)
Definition: DataTypes.hpp:127
LvArray::CRSMatrixView< T, COL_INDEX, localIndex const, LvArray::ChaiBuffer > CRSMatrixView
Alias for CRS Matrix View.
Definition: DataTypes.hpp:310
double real64
64-bit floating point type.
Definition: DataTypes.hpp:99
GEOS_LOCALINDEX_TYPE localIndex
Local index type (for indexing objects within an MPI partition).
Definition: DataTypes.hpp:85
std::int32_t integer
Signed integer type.
Definition: DataTypes.hpp:82
LvArray::CRSMatrix< T, COL_INDEX, localIndex, LvArray::ChaiBuffer > CRSMatrix
Alias for CRS Matrix class.
Definition: DataTypes.hpp:306
LAInterface::ParallelMatrix ParallelMatrix
Alias for ParallelMatrix.
Array< T, 1 > array1d
Alias for 1D array.
Definition: DataTypes.hpp:176
LAInterface::ParallelVector ParallelVector
Alias for ParallelVector.
Set of parameters for a linear solver or preconditioner.
Results/stats of a linear solve.
static constexpr char const * baseDiscretizationString()
Definition: MeshBody.hpp:217
Structure to hold scoped key names.
static constexpr char const * nonlinearSolverParametersString()
static constexpr char const * solverStatisticsString()
static constexpr char const * linearSolverParametersString()
Structure to hold scoped key names.
static constexpr char const * cflFactorString()
static constexpr char const * discretizationString()
static constexpr char const * writeLinearSystemString()
static constexpr char const * targetRegionsString()
static constexpr char const * maxStableDtString()
static constexpr char const * minDtIncreaseIntervalString()
static constexpr char const * initialDtString()
static constexpr char const * meshTargetsString()