OGS 6.2.1-499-g3b941532c.dirty.20191012113459
NumLib Namespace Reference

Detailed Description

The numerical algorithms used in OpenGeoSys

Namespaces

 anonymous_namespace{DOFTableUtil.cpp}
 
 anonymous_namespace{LocalToGlobalIndexMap.cpp}
 
 detail
 

Classes

class  BackwardDifferentiationFormula
 Backward differentiation formula. More...
 
class  BackwardEuler
 Backward Euler scheme. More...
 
class  ConvergenceCriterion
 
class  ConvergenceCriterionDeltaX
 
class  ConvergenceCriterionPerComponent
 
class  ConvergenceCriterionPerComponentDeltaX
 
class  ConvergenceCriterionPerComponentResidual
 
class  ConvergenceCriterionResidual
 
class  CrankNicolson
 Generalized Crank-Nicolson scheme. More...
 
class  EquationSystem
 
class  EvolutionaryPIDcontroller
 
class  ExtrapolatableElement
 
class  ExtrapolatableElementCollection
 
class  ExtrapolatableLocalAssemblerCollection
 
class  Extrapolator
 
struct  FeHEX20
 
struct  FeHEX8
 
struct  FeLINE2
 
struct  FeLINE3
 
struct  FePOINT1
 
struct  FePRISM15
 
struct  FePRISM6
 
struct  FePYRA13
 
struct  FePYRA5
 
struct  FeQUAD4
 
struct  FeQUAD8
 
struct  FeQUAD9
 
struct  FeTET10
 
struct  FeTET4
 
struct  FeTRI3
 
struct  FeTRI6
 
class  FixedTimeStepping
 Fixed time stepping algorithm. More...
 
class  ForwardEuler
 Forward Euler scheme. More...
 
struct  GaussLegendreIntegrationPolicy
 
struct  GaussLegendreIntegrationPolicy< MeshLib::Point >
 
struct  GaussLegendreIntegrationPolicy< MeshLib::Prism >
 
struct  GaussLegendreIntegrationPolicy< MeshLib::Prism15 >
 
struct  GaussLegendreIntegrationPolicy< MeshLib::Pyramid >
 
struct  GaussLegendreIntegrationPolicy< MeshLib::Pyramid13 >
 
struct  GaussLegendreIntegrationPolicy< MeshLib::Tet >
 
struct  GaussLegendreIntegrationPolicy< MeshLib::Tet10 >
 
struct  GaussLegendreIntegrationPolicy< MeshLib::Tri >
 
struct  GaussLegendreIntegrationPolicy< MeshLib::Tri6 >
 
struct  GlobalMatrixProvider
 
struct  GlobalVectorProvider
 
struct  IndexValueVector
 
class  IntegrationGaussLegendrePrism
 Gauss-Legendre quadrature rule for prisms. More...
 
class  IntegrationGaussLegendrePyramid
 Gauss-Legendre quadrature rule for pyramid. More...
 
class  IntegrationGaussLegendreRegular
 
class  IntegrationGaussLegendreTet
 Gauss-Legendre quadrature rule for tetrahedrals. More...
 
class  IntegrationGaussLegendreTri
 Gauss-Legendre quadrature rule for triangles. More...
 
class  IntegrationPoint
 
class  InternalMatrixStorage
 
class  ISpatialFunction
 Interface class for any functions of spatial coordinates $f(x,y,z)$. More...
 
class  IterationNumberBasedTimeStepping
 Iteration number based adaptive time stepping. More...
 
class  LocalLinearLeastSquaresExtrapolator
 
class  LocalToGlobalIndexMap
 
struct  LowerDim
 
struct  LowerDim< NumLib::ShapeHex20 >
 
struct  LowerDim< NumLib::ShapeLine3 >
 
struct  LowerDim< NumLib::ShapePrism15 >
 
struct  LowerDim< NumLib::ShapePyra13 >
 
struct  LowerDim< NumLib::ShapeQuad8 >
 
struct  LowerDim< NumLib::ShapeQuad9 >
 
struct  LowerDim< NumLib::ShapeTet10 >
 
struct  LowerDim< NumLib::ShapeTri6 >
 
class  MatrixProvider
 
class  MatrixSpecificationsProvider
 
class  MatrixTranslator
 
class  MatrixTranslator< ODESystemTag::FirstOrderImplicitQuasilinear >
 
class  MatrixTranslatorCrankNicolson
 
class  MatrixTranslatorCrankNicolson< ODESystemTag::FirstOrderImplicitQuasilinear >
 
class  MatrixTranslatorForwardEuler
 
class  MatrixTranslatorForwardEuler< ODESystemTag::FirstOrderImplicitQuasilinear >
 
class  MatrixTranslatorGeneral
 
class  MatrixTranslatorGeneral< ODESystemTag::FirstOrderImplicitQuasilinear >
 
class  MeshComponentMap
 Multidirectional mapping between mesh entities and degrees of freedom. More...
 
class  NamedFunction
 
class  NamedFunctionCaller
 Builds expression trees of named functions dynamically at runtime. More...
 
class  NamedFunctionProvider
 Interface used for providing named functions. More...
 
struct  NaturalCoordinates
 
struct  NaturalCoordinates< MeshLib::Hex >
 
struct  NaturalCoordinates< MeshLib::Hex20 >
 
struct  NaturalCoordinates< MeshLib::Line >
 
struct  NaturalCoordinates< MeshLib::Line3 >
 
struct  NaturalCoordinates< MeshLib::Prism >
 
struct  NaturalCoordinates< MeshLib::Prism15 >
 
struct  NaturalCoordinates< MeshLib::Pyramid >
 
struct  NaturalCoordinates< MeshLib::Pyramid13 >
 
struct  NaturalCoordinates< MeshLib::Quad >
 
struct  NaturalCoordinates< MeshLib::Quad8 >
 
struct  NaturalCoordinates< MeshLib::Quad9 >
 
struct  NaturalCoordinates< MeshLib::Tet >
 
struct  NaturalCoordinates< MeshLib::Tet10 >
 
struct  NaturalCoordinates< MeshLib::Tri >
 
struct  NaturalCoordinates< MeshLib::Tri6 >
 
struct  NaturalCoordinatesMapping
 
class  NewtonRaphson
 
struct  NewtonRaphsonSolverParameters
 
class  NonlinearSolver
 
class  NonlinearSolver< NonlinearSolverTag::Newton >
 
class  NonlinearSolver< NonlinearSolverTag::Picard >
 
class  NonlinearSolverBase
 
struct  NonlinearSolverStatus
 Status of the non-linear solver. More...
 
class  NonlinearSystem
 
class  NonlinearSystem< NonlinearSolverTag::Newton >
 
class  NonlinearSystem< NonlinearSolverTag::Picard >
 
class  ODESystem
 
class  ODESystem< ODESystemTag::FirstOrderImplicitQuasilinear, NonlinearSolverTag::Newton >
 
class  ODESystem< ODESystemTag::FirstOrderImplicitQuasilinear, NonlinearSolverTag::Picard >
 
struct  SerialExecutor
 
class  ShapeHex20
 
class  ShapeHex8
 
class  ShapeLine2
 
class  ShapeLine3
 
struct  ShapeMatrices
 Coordinates mapping matrices at particular location. More...
 
class  ShapePoint1
 Shape function for a point element in natural coordinates. More...
 
class  ShapePrism15
 
class  ShapePrism6
 
class  ShapePyra13
 
class  ShapePyra5
 
class  ShapeQuad4
 
class  ShapeQuad8
 
class  ShapeQuad9
 
class  ShapeTet10
 
class  ShapeTet4
 
class  ShapeTri3
 
class  ShapeTri6
 
class  SimpleMatrixVectorProvider
 
class  SpecificFunctionCaller
 
class  TemplateIsoparametric
 Template class for isoparametric elements. More...
 
class  TimeDiscretization
 
class  TimeDiscretizedODESystem
 
class  TimeDiscretizedODESystem< ODESystemTag::FirstOrderImplicitQuasilinear, NonlinearSolverTag::Newton >
 
class  TimeDiscretizedODESystem< ODESystemTag::FirstOrderImplicitQuasilinear, NonlinearSolverTag::Picard >
 
class  TimeDiscretizedODESystemBase
 
class  TimeStep
 Time step object. More...
 
class  TimeStepAlgorithm
 Interface of time stepping algorithms. More...
 
class  VectorProvider
 

Enumerations

enum  ComponentOrder { ComponentOrder::BY_COMPONENT, ComponentOrder::BY_LOCATION }
 Ordering of components in global matrix/vector. More...
 
enum  ShapeMatrixType {
  ShapeMatrixType::N, ShapeMatrixType::DNDR, ShapeMatrixType::N_J, ShapeMatrixType::DNDR_J,
  ShapeMatrixType::DNDX, ShapeMatrixType::ALL
}
 Shape matrix type to be calculated. More...
 
enum  IterationResult : char { IterationResult::SUCCESS, IterationResult::FAILURE, IterationResult::REPEAT_ITERATION }
 Status flags telling the NonlinearSolver if an iteration succeeded. More...
 
enum  NonlinearSolverTag : bool { NonlinearSolverTag::Picard, NonlinearSolverTag::Newton }
 Tag used to specify which nonlinear solver will be used. More...
 
enum  ODESystemTag : char { ODESystemTag::FirstOrderImplicitQuasilinear, ODESystemTag::NeumannBC }
 Tag used to specify the type of ODE. More...
 

Functions

GlobalSparsityPattern computeSparsityPattern (LocalToGlobalIndexMap const &dof_table, MeshLib::Mesh const &mesh)
 Computes a sparsity pattern for the given inputs. More...
 
double getNonGhostNodalValue (GlobalVector const &x, MeshLib::Mesh const &mesh, NumLib::LocalToGlobalIndexMap const &dof_table, std::size_t const node_id, std::size_t const global_component_id)
 
double getNodalValue (GlobalVector const &x, MeshLib::Mesh const &mesh, NumLib::LocalToGlobalIndexMap const &dof_table, std::size_t const node_id, std::size_t const global_component_id)
 
std::vector< GlobalIndexTypegetIndices (std::size_t const mesh_item_id, NumLib::LocalToGlobalIndexMap const &dof_table)
 
NumLib::LocalToGlobalIndexMap::RowColumnIndices getRowColumnIndices (std::size_t const id, NumLib::LocalToGlobalIndexMap const &dof_table, std::vector< GlobalIndexType > &indices)
 
double norm (GlobalVector const &x, unsigned const global_component, MathLib::VecNormType norm_type, LocalToGlobalIndexMap const &dof_table, MeshLib::Mesh const &mesh)
 
template<typename Functor >
void transformVariableFromGlobalVector (GlobalVector const &input_vector, int const variable_id, NumLib::LocalToGlobalIndexMap const &local_to_global_index_map, MeshLib::PropertyVector< double > &output_vector, Functor mapFunction)
 
void cleanupGlobalMatrixProviders ()
 
std::ostream & operator<< (std::ostream &os, LocalToGlobalIndexMap const &map)
 
template<typename LocalAssemblerCollection , typename IntegrationPointValuesMethod >
ExtrapolatableLocalAssemblerCollection< LocalAssemblerCollection > makeExtrapolatable (LocalAssemblerCollection const &local_assemblers, IntegrationPointValuesMethod integration_point_values_method)
 
template<class T_N , class T_DNDR , class T_J , class T_DNDX >
std::ostream & operator<< (std::ostream &os, const ShapeMatrices< T_N, T_DNDR, T_J, T_DNDX > &shape)
 
template<typename ShapeFunction , typename ShapeMatricesType >
NumLib::TemplateIsoparametric< ShapeFunction, ShapeMatricesType > createIsoparametricFiniteElement (MeshLib::Element const &e)
 
template<typename NodalValues , typename ShapeMatrix , typename... ScalarTypes>
void shapeFunctionInterpolate (const NodalValues &nodal_values, const ShapeMatrix &shape_matrix_N, double &interpolated_value, ScalarTypes &... interpolated_values)
 
template<typename LowerOrderShapeFunction , typename HigherOrderMeshElementType , int GlobalDim, typename EigenMatrixType >
void interpolateToHigherOrderNodes (MeshLib::Element const &element, bool const is_axially_symmetric, Eigen::MatrixBase< EigenMatrixType > const &node_values, MeshLib::PropertyVector< double > &interpolated_values_global_vector)
 
std::unique_ptr< ConvergenceCriterioncreateConvergenceCriterion (BaseLib::ConfigTree const &config)
 Creates a convergence criterion from the given configuration. More...
 
bool checkRelativeTolerance (const double reltol, const double numerator, const double denominator)
 
std::unique_ptr< ConvergenceCriterionDeltaXcreateConvergenceCriterionDeltaX (const BaseLib::ConfigTree &config)
 
std::unique_ptr< ConvergenceCriterionPerComponentDeltaXcreateConvergenceCriterionPerComponentDeltaX (const BaseLib::ConfigTree &config)
 
std::unique_ptr< ConvergenceCriterionPerComponentResidualcreateConvergenceCriterionPerComponentResidual (const BaseLib::ConfigTree &config)
 
std::unique_ptr< ConvergenceCriterionResidualcreateConvergenceCriterionResidual (const BaseLib::ConfigTree &config)
 
template<ODESystemTag ODETag>
std::unique_ptr< MatrixTranslator< ODETag > > createMatrixTranslator (TimeDiscretization const &timeDisc)
 
std::pair< std::unique_ptr< NonlinearSolverBase >, NonlinearSolverTagcreateNonlinearSolver (GlobalLinearSolver &linear_solver, BaseLib::ConfigTree const &config)
 
std::unique_ptr< TimeDiscretizationcreateTimeDiscretization (BaseLib::ConfigTree const &config)
 
std::unique_ptr< TimeStepAlgorithmcreateEvolutionaryPIDcontroller (BaseLib::ConfigTree const &config)
 
std::unique_ptr< TimeStepAlgorithmcreateFixedTimeStepping (BaseLib::ConfigTree const &config)
 
std::unique_ptr< TimeStepAlgorithmcreateIterationNumberBasedTimeStepping (BaseLib::ConfigTree const &config)
 
std::unique_ptr< TimeStepAlgorithmcreateTimeStepper (BaseLib::ConfigTree const &config)
 

Enumeration Type Documentation

◆ ComponentOrder

Ordering of components in global matrix/vector.

Enumerator
BY_COMPONENT 

Ordering data by component type.

BY_LOCATION 

Ordering data by spatial location.

Definition at line 25 of file MeshComponentMap.h.

26 {
27  BY_COMPONENT,
29 };
Ordering data by spatial location.
Ordering data by component type.

◆ ShapeMatrixType

Shape matrix type to be calculated.

Enumerator

calculates N

DNDR 

calculates dNdr

N_J 

calculates N, dNdr, J, and detJ

DNDR_J 

calculates dNdr, J, and detJ

DNDX 

calculates dNdr, J, detJ, invJ, and dNdx

ALL 

calculates all

Definition at line 25 of file ShapeMatrices.h.

26 {
27  N,
28  DNDR,
29  N_J,
30  DNDR_J,
31  DNDX,
32  ALL
33 };
calculates dNdr, J, detJ, invJ, and dNdx
calculates dNdr, J, and detJ
calculates N, dNdr, J, and detJ

Function Documentation

◆ checkRelativeTolerance()

bool NumLib::checkRelativeTolerance ( double const  reltol,
double const  numerator,
double const  denominator 
)

Returns if |numerator/denominator| < |reltol|. This method copes with the case that denominator = 0 by always adding epsilon to the denominator.

Definition at line 47 of file ConvergenceCriterion.cpp.

Referenced by NumLib::ConvergenceCriterionDeltaX::checkDeltaX(), NumLib::ConvergenceCriterionPerComponentDeltaX::checkDeltaX(), NumLib::ConvergenceCriterionResidual::checkResidual(), and NumLib::ConvergenceCriterionPerComponentResidual::checkResidual().

49 {
50  auto const eps = std::numeric_limits<double>::epsilon();
51  return std::abs(numerator) <
52  std::abs(reltol) * (std::abs(denominator) + eps);
53 }

◆ cleanupGlobalMatrixProviders()

void NumLib::cleanupGlobalMatrixProviders ( )

Definition at line 35 of file GlobalMatrixProviders.cpp.

Referenced by ApplicationsLib::LinearSolverLibrarySetup::~LinearSolverLibrarySetup().

36 {
37  globalSetupGlobalMatrixVectorProvider.reset();
38 }

◆ computeSparsityPattern()

GlobalSparsityPattern NumLib::computeSparsityPattern ( LocalToGlobalIndexMap const &  dof_table,
MeshLib::Mesh const &  mesh 
)

Computes a sparsity pattern for the given inputs.

Parameters
dof_tablemaps mesh nodes to global indices
meshmesh for which the two parameters above are defined
Returns
The computed sparsity pattern.

Definition at line 74 of file ComputeSparsityPattern.cpp.

References computeSparsityPatternNonPETSc().

Referenced by ProcessLib::Process::computeSparsityPattern(), ProcessLib::ThermoMechanics::ThermoMechanicsProcess< DisplacementDim >::constructDofTable(), ProcessLib::HydroMechanics::HydroMechanicsProcess< DisplacementDim >::constructDofTable(), ProcessLib::RichardsMechanics::RichardsMechanicsProcess< DisplacementDim >::constructDofTable(), ProcessLib::ThermoHydroMechanics::ThermoHydroMechanicsProcess< DisplacementDim >::constructDofTable(), ProcessLib::PhaseField::PhaseFieldProcess< DisplacementDim >::constructDofTable(), ProcessLib::ThermoMechanicalPhaseField::ThermoMechanicalPhaseFieldProcess< DisplacementDim >::constructDofTable(), and ProcessLib::Process::postIterationConcreteProcess().

76 {
77 #ifdef USE_PETSC
78  return computeSparsityPatternPETSc(dof_table, mesh);
79 #else
80  return computeSparsityPatternNonPETSc(dof_table, mesh);
81 #endif
82 }
GlobalSparsityPattern computeSparsityPatternNonPETSc(NumLib::LocalToGlobalIndexMap const &dof_table, MeshLib::Mesh const &mesh)

◆ createConvergenceCriterion()

std::unique_ptr< ConvergenceCriterion > NumLib::createConvergenceCriterion ( const BaseLib::ConfigTree config)

Creates a convergence criterion from the given configuration.

Input File Parameter:
prj__time_loop__processes__process__convergence_criterion__type

Definition at line 22 of file ConvergenceCriterion.cpp.

References createConvergenceCriterionDeltaX(), createConvergenceCriterionPerComponentDeltaX(), createConvergenceCriterionPerComponentResidual(), createConvergenceCriterionResidual(), OGS_FATAL, and BaseLib::ConfigTree::peekConfigParameter().

Referenced by ProcessLib::createPerProcessData(), and ProcessLib::createTimeLoop().

24 {
26  auto const type = config.peekConfigParameter<std::string>("type");
27 
28  if (type == "DeltaX") {
29  return createConvergenceCriterionDeltaX(config);
30  }
31  if (type == "Residual")
32  {
34  }
35  if (type == "PerComponentDeltaX")
36  {
38  }
39  if (type == "PerComponentResidual")
40  {
42  }
43 
44  OGS_FATAL("There is no convergence criterion of type `%s'.", type.c_str());
45 }
std::unique_ptr< ConvergenceCriterionPerComponentResidual > createConvergenceCriterionPerComponentResidual(const BaseLib::ConfigTree &config)
std::unique_ptr< ConvergenceCriterionResidual > createConvergenceCriterionResidual(const BaseLib::ConfigTree &config)
T peekConfigParameter(std::string const &param) const
std::unique_ptr< ConvergenceCriterionPerComponentDeltaX > createConvergenceCriterionPerComponentDeltaX(const BaseLib::ConfigTree &config)
#define OGS_FATAL(fmt,...)
Definition: Error.h:64
std::unique_ptr< ConvergenceCriterionDeltaX > createConvergenceCriterionDeltaX(const BaseLib::ConfigTree &config)

◆ createConvergenceCriterionDeltaX()

std::unique_ptr< ConvergenceCriterionDeltaX > NumLib::createConvergenceCriterionDeltaX ( const BaseLib::ConfigTree config)
Input File Parameter:
prj__time_loop__processes__process__convergence_criterion__type
Input File Parameter:
prj__time_loop__processes__process__convergence_criterion__DeltaX__abstol
Input File Parameter:
prj__time_loop__processes__process__convergence_criterion__DeltaX__reltol
Input File Parameter:
prj__time_loop__processes__process__convergence_criterion__DeltaX__norm_type

Definition at line 59 of file ConvergenceCriterionDeltaX.cpp.

References BaseLib::ConfigTree::checkConfigParameter(), MathLib::convertStringToVecNormType(), BaseLib::ConfigTree::getConfigParameter(), BaseLib::ConfigTree::getConfigParameterOptional(), MathLib::INVALID, and OGS_FATAL.

Referenced by createConvergenceCriterion().

61 {
63  config.checkConfigParameter("type", "DeltaX");
64 
66  auto abstol = config.getConfigParameterOptional<double>("abstol");
68  auto reltol = config.getConfigParameterOptional<double>("reltol");
69  auto const norm_type_str =
71  config.getConfigParameter<std::string>("norm_type");
72  auto const norm_type = MathLib::convertStringToVecNormType(norm_type_str);
73 
74  if (norm_type == MathLib::VecNormType::INVALID)
75  {
76  OGS_FATAL("Unknown vector norm type `%s'.", norm_type_str.c_str());
77  }
78 
79  return std::make_unique<ConvergenceCriterionDeltaX>(
80  std::move(abstol), std::move(reltol), norm_type);
81 }
T getConfigParameter(std::string const &param) const
void checkConfigParameter(std::string const &param, T const &value) const
boost::optional< T > getConfigParameterOptional(std::string const &param) const
#define OGS_FATAL(fmt,...)
Definition: Error.h:64
VecNormType convertStringToVecNormType(const std::string &str)
convert string to VecNormType
Definition: LinAlgEnums.cpp:29

◆ createConvergenceCriterionPerComponentDeltaX()

std::unique_ptr< ConvergenceCriterionPerComponentDeltaX > NumLib::createConvergenceCriterionPerComponentDeltaX ( const BaseLib::ConfigTree config)
Input File Parameter:
prj__time_loop__processes__process__convergence_criterion__type
Input File Parameter:
prj__time_loop__processes__process__convergence_criterion__PerComponentDeltaX__abstols
Input File Parameter:
prj__time_loop__processes__process__convergence_criterion__PerComponentDeltaX__reltols
Input File Parameter:
prj__time_loop__processes__process__convergence_criterion__PerComponentDeltaX__norm_type

Definition at line 94 of file ConvergenceCriterionPerComponentDeltaX.cpp.

References BaseLib::ConfigTree::checkConfigParameter(), MathLib::convertStringToVecNormType(), BaseLib::ConfigTree::getConfigParameter(), BaseLib::ConfigTree::getConfigParameterOptional(), MathLib::INVALID, and OGS_FATAL.

Referenced by createConvergenceCriterion().

95 {
97  config.checkConfigParameter("type", "PerComponentDeltaX");
98 
99  auto abstols =
101  config.getConfigParameterOptional<std::vector<double>>("abstols");
102  auto reltols =
104  config.getConfigParameterOptional<std::vector<double>>("reltols");
105  auto const norm_type_str =
107  config.getConfigParameter<std::string>("norm_type");
108 
109  if ((!abstols) && (!reltols))
110  {
111  OGS_FATAL(
112  "At least one of absolute or relative tolerance has to be "
113  "specified.");
114  }
115  if (!abstols) {
116  abstols = std::vector<double>(reltols->size());
117  } else if (!reltols) {
118  reltols = std::vector<double>(abstols->size());
119  }
120 
121  auto const norm_type = MathLib::convertStringToVecNormType(norm_type_str);
122 
123  if (norm_type == MathLib::VecNormType::INVALID)
124  {
125  OGS_FATAL("Unknown vector norm type `%s'.", norm_type_str.c_str());
126  }
127 
128  return std::make_unique<ConvergenceCriterionPerComponentDeltaX>(
129  std::move(*abstols), std::move(*reltols), norm_type);
130 }
T getConfigParameter(std::string const &param) const
void checkConfigParameter(std::string const &param, T const &value) const
boost::optional< T > getConfigParameterOptional(std::string const &param) const
#define OGS_FATAL(fmt,...)
Definition: Error.h:64
VecNormType convertStringToVecNormType(const std::string &str)
convert string to VecNormType
Definition: LinAlgEnums.cpp:29

◆ createConvergenceCriterionPerComponentResidual()

std::unique_ptr< ConvergenceCriterionPerComponentResidual > NumLib::createConvergenceCriterionPerComponentResidual ( const BaseLib::ConfigTree config)
Input File Parameter:
prj__time_loop__processes__process__convergence_criterion__type
Input File Parameter:
prj__time_loop__processes__process__convergence_criterion__PerComponentResidual__abstols
Input File Parameter:
prj__time_loop__processes__process__convergence_criterion__PerComponentResidual__reltols
Input File Parameter:
prj__time_loop__processes__process__convergence_criterion__PerComponentResidual__norm_type

Definition at line 130 of file ConvergenceCriterionPerComponentResidual.cpp.

References BaseLib::ConfigTree::checkConfigParameter(), MathLib::convertStringToVecNormType(), BaseLib::ConfigTree::getConfigParameter(), BaseLib::ConfigTree::getConfigParameterOptional(), MathLib::INVALID, and OGS_FATAL.

Referenced by createConvergenceCriterion().

132 {
134  config.checkConfigParameter("type", "PerComponentResidual");
135 
136  auto abstols =
138  config.getConfigParameterOptional<std::vector<double>>("abstols");
139  auto reltols =
141  config.getConfigParameterOptional<std::vector<double>>("reltols");
142  auto const norm_type_str =
144  config.getConfigParameter<std::string>("norm_type");
145 
146  if ((!abstols) && (!reltols))
147  {
148  OGS_FATAL(
149  "At least one of absolute or relative tolerance has to be "
150  "specified.");
151  }
152  if (!abstols) {
153  abstols = std::vector<double>(reltols->size());
154  } else if (!reltols) {
155  reltols = std::vector<double>(abstols->size());
156  }
157 
158  auto const norm_type = MathLib::convertStringToVecNormType(norm_type_str);
159 
160  if (norm_type == MathLib::VecNormType::INVALID)
161  {
162  OGS_FATAL("Unknown vector norm type `%s'.", norm_type_str.c_str());
163  }
164 
165  return std::make_unique<ConvergenceCriterionPerComponentResidual>(
166  std::move(*abstols), std::move(*reltols), norm_type);
167 }
T getConfigParameter(std::string const &param) const
void checkConfigParameter(std::string const &param, T const &value) const
boost::optional< T > getConfigParameterOptional(std::string const &param) const
#define OGS_FATAL(fmt,...)
Definition: Error.h:64
VecNormType convertStringToVecNormType(const std::string &str)
convert string to VecNormType
Definition: LinAlgEnums.cpp:29

◆ createConvergenceCriterionResidual()

std::unique_ptr< ConvergenceCriterionResidual > NumLib::createConvergenceCriterionResidual ( const BaseLib::ConfigTree config)
Input File Parameter:
prj__time_loop__processes__process__convergence_criterion__type
Input File Parameter:
prj__time_loop__processes__process__convergence_criterion__Residual__abstol
Input File Parameter:
prj__time_loop__processes__process__convergence_criterion__Residual__reltol
Input File Parameter:
prj__time_loop__processes__process__convergence_criterion__Residual__norm_type

Definition at line 94 of file ConvergenceCriterionResidual.cpp.

References BaseLib::ConfigTree::checkConfigParameter(), MathLib::convertStringToVecNormType(), BaseLib::ConfigTree::getConfigParameter(), BaseLib::ConfigTree::getConfigParameterOptional(), MathLib::INVALID, and OGS_FATAL.

Referenced by createConvergenceCriterion().

95 {
97  config.checkConfigParameter("type", "Residual");
98 
100  auto abstol = config.getConfigParameterOptional<double>("abstol");
102  auto reltol = config.getConfigParameterOptional<double>("reltol");
103  auto const norm_type_str =
105  config.getConfigParameter<std::string>("norm_type");
106  auto const norm_type = MathLib::convertStringToVecNormType(norm_type_str);
107 
108  if (norm_type == MathLib::VecNormType::INVALID)
109  {
110  OGS_FATAL("Unknown vector norm type `%s'.", norm_type_str.c_str());
111  }
112 
113  return std::make_unique<ConvergenceCriterionResidual>(
114  std::move(abstol), std::move(reltol), norm_type);
115 }
T getConfigParameter(std::string const &param) const
void checkConfigParameter(std::string const &param, T const &value) const
boost::optional< T > getConfigParameterOptional(std::string const &param) const
#define OGS_FATAL(fmt,...)
Definition: Error.h:64
VecNormType convertStringToVecNormType(const std::string &str)
convert string to VecNormType
Definition: LinAlgEnums.cpp:29

◆ createEvolutionaryPIDcontroller()

std::unique_ptr< TimeStepAlgorithm > NumLib::createEvolutionaryPIDcontroller ( BaseLib::ConfigTree const &  config)

Create an EvolutionaryPIDcontroller time stepper from the given configuration

Input File Parameter:
prj__time_loop__processes__process__time_stepping__type
Input File Parameter:
prj__time_loop__processes__process__time_stepping__EvolutionaryPIDcontroller__t_initial
Input File Parameter:
prj__time_loop__processes__process__time_stepping__EvolutionaryPIDcontroller__t_end
Input File Parameter:
prj__time_loop__processes__process__time_stepping__EvolutionaryPIDcontroller__dt_guess
Input File Parameter:
prj__time_loop__processes__process__time_stepping__EvolutionaryPIDcontroller__dt_min
Input File Parameter:
prj__time_loop__processes__process__time_stepping__EvolutionaryPIDcontroller__dt_max
Input File Parameter:
prj__time_loop__processes__process__time_stepping__EvolutionaryPIDcontroller__rel_dt_min
Input File Parameter:
prj__time_loop__processes__process__time_stepping__EvolutionaryPIDcontroller__rel_dt_max
Input File Parameter:
prj__time_loop__processes__process__time_stepping__EvolutionaryPIDcontroller__fixed_output_times
Input File Parameter:
prj__time_loop__processes__process__time_stepping__EvolutionaryPIDcontroller__tol

Definition at line 23 of file CreateEvolutionaryPIDcontroller.cpp.

References BaseLib::ConfigTree::checkConfigParameter(), BaseLib::ConfigTree::getConfigParameter(), and BaseLib::makeVectorUnique().

Referenced by createTimeStepper().

25 {
27  config.checkConfigParameter("type", "EvolutionaryPIDcontroller");
28 
30  auto const t0 = config.getConfigParameter<double>("t_initial");
32  auto const t_end = config.getConfigParameter<double>("t_end");
34  auto const h0 = config.getConfigParameter<double>("dt_guess");
35 
37  auto const h_min = config.getConfigParameter<double>("dt_min");
39  auto const h_max = config.getConfigParameter<double>("dt_max");
41  auto const rel_h_min = config.getConfigParameter<double>("rel_dt_min");
43  auto const rel_h_max = config.getConfigParameter<double>("rel_dt_max");
44 
45  auto fixed_output_times =
47  config.getConfigParameter<std::vector<double>>("fixed_output_times",
48  std::vector<double>{});
49  if (!fixed_output_times.empty())
50  {
51  // Remove possible duplicated elements and sort in descending order.
52  BaseLib::makeVectorUnique(fixed_output_times, std::greater<>());
53  }
54 
56  auto const tol = config.getConfigParameter<double>("tol");
57 
58  return std::make_unique<EvolutionaryPIDcontroller>(
59  t0, t_end, h0, h_min, h_max, rel_h_min, rel_h_max,
60  std::move(fixed_output_times), tol);
61 }
void makeVectorUnique(std::vector< T > &v)
Definition: Algorithm.h:194

◆ createFixedTimeStepping()

std::unique_ptr< TimeStepAlgorithm > NumLib::createFixedTimeStepping ( BaseLib::ConfigTree const &  config)

Create a FixedTimeStepping time stepper from the given configuration

Input File Parameter:
prj__time_loop__processes__process__time_stepping__type
Input File Parameter:
prj__time_loop__processes__process__time_stepping__FixedTimeStepping__t_initial
Input File Parameter:
prj__time_loop__processes__process__time_stepping__FixedTimeStepping__t_end
Input File Parameter:
prj__time_loop__processes__process__time_stepping__FixedTimeStepping__timesteps
Input File Parameter:
prj__time_loop__processes__process__time_stepping__FixedTimeStepping__timesteps__pair
Input File Parameter:
prj__time_loop__processes__process__time_stepping__FixedTimeStepping__timesteps__pair__repeat
Input File Parameter:
prj__time_loop__processes__process__time_stepping__FixedTimeStepping__timesteps__pair__delta_t

Definition at line 24 of file CreateFixedTimeStepping.cpp.

References BaseLib::ConfigTree::checkConfigParameter(), BaseLib::ConfigTree::getConfigParameter(), BaseLib::ConfigTree::getConfigSubtree(), BaseLib::ConfigTree::getConfigSubtreeList(), and OGS_FATAL.

Referenced by createTimeStepper().

26 {
28  config.checkConfigParameter("type", "FixedTimeStepping");
29 
31  auto const t_initial = config.getConfigParameter<double>("t_initial");
33  auto const t_end = config.getConfigParameter<double>("t_end");
35  auto const delta_ts = config.getConfigSubtree("timesteps");
36 
37  std::vector<double> timesteps;
38  double t_curr = t_initial;
39  double delta_t = 0.0;
40 
41  // TODO: consider adding call "listNonEmpty" to config tree
43  auto const range = delta_ts.getConfigSubtreeList("pair");
44  if (range.begin() == range.end())
45  {
46  OGS_FATAL("no timesteps have been given");
47  }
48  for (auto const pair : range)
49  {
51  auto const repeat = pair.getConfigParameter<std::size_t>("repeat");
53  delta_t = pair.getConfigParameter<double>("delta_t");
54 
55  if (repeat == 0)
56  {
57  OGS_FATAL("<repeat> is zero.");
58  }
59  if (delta_t <= 0.0)
60  {
61  OGS_FATAL("timestep <delta_t> is <= 0.0.");
62  }
63 
64  if (t_curr <= t_end)
65  {
66  auto const new_size = timesteps.size() + repeat;
67  try
68  {
69  timesteps.resize(new_size, delta_t);
70  }
71  catch (std::length_error const& e)
72  {
73  OGS_FATAL(
74  "Resize of the time steps vector failed for the requested "
75  "new size %u. Probably there is not enough memory (%g GiB "
76  "requested).\n"
77  "Thrown exception: %s",
78  new_size,
79  new_size * sizeof(double) / 1024. / 1024. / 1024.,
80  e.what());
81  }
82  catch (std::bad_alloc const& e)
83  {
84  OGS_FATAL(
85  "Resize of the time steps vector failed for the requested "
86  "new size %u. Probably there is not enough memory (%g GiB "
87  "requested).\n"
88  "Thrown exception: %s",
89  new_size, new_size * sizeof(double) / 1024. / 1024. / 1024.,
90  e.what());
91  }
92 
93  t_curr += repeat * delta_t;
94  }
95  }
96 
97  // append last delta_t until t_end is reached
98  if (t_curr <= t_end)
99  {
100  auto const repeat =
101  static_cast<std::size_t>(std::ceil((t_end - t_curr) / delta_t));
102  auto const new_size = timesteps.size() + repeat;
103  try
104  {
105  timesteps.resize(new_size, delta_t);
106  }
107  catch (std::length_error const& e)
108  {
109  OGS_FATAL(
110  "Resize of the time steps vector failed for the requested new "
111  "size %u. Probably there is not enough memory (%g GiB "
112  "requested).\n"
113  "Thrown exception: %s",
114  new_size,
115  new_size * sizeof(double) / 1024. / 1024. / 1024.,
116  e.what());
117  }
118  catch (std::bad_alloc const& e)
119  {
120  OGS_FATAL(
121  "Resize of the time steps vector failed for the requested new "
122  "size %u. Probably there is not enough memory (%g GiB "
123  "requested).\n"
124  "Thrown exception: %s",
125  new_size, new_size * sizeof(double) / 1024. / 1024. / 1024.,
126  e.what());
127  }
128  }
129 
130  return std::make_unique<FixedTimeStepping>(t_initial, t_end, timesteps);
131 }
#define OGS_FATAL(fmt,...)
Definition: Error.h:64

◆ createIsoparametricFiniteElement()

template<typename ShapeFunction , typename ShapeMatricesType >
NumLib::TemplateIsoparametric<ShapeFunction, ShapeMatricesType> NumLib::createIsoparametricFiniteElement ( MeshLib::Element const &  e)

◆ createIterationNumberBasedTimeStepping()

std::unique_ptr< TimeStepAlgorithm > NumLib::createIterationNumberBasedTimeStepping ( BaseLib::ConfigTree const &  config)

Create a IterationNumberBasedTimeStepping time stepper from the given configuration.

Input File Parameter:
prj__time_loop__processes__process__time_stepping__type
Input File Parameter:
prj__time_loop__processes__process__time_stepping__IterationNumberBasedTimeStepping__t_initial
Input File Parameter:
prj__time_loop__processes__process__time_stepping__IterationNumberBasedTimeStepping__t_end
Input File Parameter:
prj__time_loop__processes__process__time_stepping__IterationNumberBasedTimeStepping__initial_dt
Input File Parameter:
prj__time_loop__processes__process__time_stepping__IterationNumberBasedTimeStepping__minimum_dt
Input File Parameter:
prj__time_loop__processes__process__time_stepping__IterationNumberBasedTimeStepping__maximum_dt
Input File Parameter:
prj__time_loop__processes__process__time_stepping__IterationNumberBasedTimeStepping__number_iterations
Input File Parameter:
prj__time_loop__processes__process__time_stepping__IterationNumberBasedTimeStepping__multiplier

Definition at line 22 of file CreateIterationNumberBasedTimeStepping.cpp.

References BaseLib::ConfigTree::checkConfigParameter(), and BaseLib::ConfigTree::getConfigParameter().

Referenced by createTimeStepper().

24 {
26  config.checkConfigParameter("type", "IterationNumberBasedTimeStepping");
27 
29  auto const t_initial = config.getConfigParameter<double>("t_initial");
31  auto const t_end = config.getConfigParameter<double>("t_end");
33  auto const initial_dt = config.getConfigParameter<double>("initial_dt");
35  auto const minimum_dt = config.getConfigParameter<double>("minimum_dt");
37  auto const maximum_dt = config.getConfigParameter<double>("maximum_dt");
38 
39  auto number_iterations =
41  config.getConfigParameter<std::vector<int>>("number_iterations");
42  auto multiplier =
44  config.getConfigParameter<std::vector<double>>("multiplier");
45 
46  return std::make_unique<IterationNumberBasedTimeStepping>(
47  t_initial, t_end, minimum_dt, maximum_dt, initial_dt,
48  std::move(number_iterations), std::move(multiplier));
49 }

◆ createTimeDiscretization()

std::unique_ptr< TimeDiscretization > NumLib::createTimeDiscretization ( BaseLib::ConfigTree const &  config)
Input File Parameter:
prj__time_loop__processes__process__time_discretization__type
Input File Parameter:
prj__time_loop__processes__process__time_discretization__BackwardEuler
Input File Parameter:
prj__time_loop__processes__process__time_discretization__ForwardEuler
Input File Parameter:
prj__time_loop__processes__process__time_discretization__CrankNicolson
Input File Parameter:
prj__time_loop__processes__process__time_discretization__CrankNicolson__theta
Input File Parameter:
prj__time_loop__processes__process__time_discretization__BackwardDifferentiationFormula
Input File Parameter:
prj__time_loop__processes__process__time_discretization__BackwardDifferentiationFormula__order

Definition at line 17 of file TimeDiscretizationBuilder.cpp.

References BaseLib::ConfigTree::getConfigParameter(), and OGS_FATAL.

Referenced by ProcessLib::createPerProcessData().

19 {
21  auto const type = config.getConfigParameter<std::string>("type");
22 
24  if (type == "BackwardEuler")
25  {
26  return std::make_unique<BackwardEuler>();
27  }
29  if (type == "ForwardEuler")
30  {
31  return std::make_unique<ForwardEuler>();
32  }
34  if (type == "CrankNicolson")
35  {
37  auto const theta = config.getConfigParameter<double>("theta");
38  return std::make_unique<CrankNicolson>(theta);
39  }
41  if (type == "BackwardDifferentiationFormula")
42  {
44  auto const order = config.getConfigParameter<unsigned>("order");
45  return std::make_unique<BackwardDifferentiationFormula>(order);
46  }
47 
48  OGS_FATAL("Unrecognized time discretization type `%s'", type.c_str());
49 }
#define OGS_FATAL(fmt,...)
Definition: Error.h:64

◆ createTimeStepper()

std::unique_ptr< TimeStepAlgorithm > NumLib::createTimeStepper ( BaseLib::ConfigTree const &  config)
Input File Parameter:
prj__time_loop__processes__process__time_stepping__type
Input File Parameter:
prj__time_loop__processes__process__time_stepping__SingleStep

Definition at line 27 of file CreateTimeStepper.cpp.

References createEvolutionaryPIDcontroller(), createFixedTimeStepping(), createIterationNumberBasedTimeStepping(), BaseLib::ConfigTree::ignoreConfigParameter(), OGS_FATAL, and BaseLib::ConfigTree::peekConfigParameter().

Referenced by ProcessLib::createPerProcessData().

29 {
31  auto const type = config.peekConfigParameter<std::string>("type");
32 
33  if (type == "SingleStep")
34  {
36  config.ignoreConfigParameter("type");
37  return std::make_unique<NumLib::FixedTimeStepping>(0.0, 1.0, 1.0);
38  }
39  if (type == "FixedTimeStepping")
40  {
41  return NumLib::createFixedTimeStepping(config);
42  }
43  if (type == "EvolutionaryPIDcontroller")
44  {
46  }
47  if (type == "IterationNumberBasedTimeStepping")
48  {
50  }
51  OGS_FATAL(
52  "Unknown time stepping type: '%s'. The available types are: "
53  "\n\tSingleStep,"
54  "\n\tFixedTimeStepping,"
55  "\n\tEvolutionaryPIDcontroller,",
56  "\n\tIterationNumberBasedTimeStepping\n",
57  type.data());
58 }
std::unique_ptr< TimeStepAlgorithm > createEvolutionaryPIDcontroller(BaseLib::ConfigTree const &config)
std::unique_ptr< TimeStepAlgorithm > createIterationNumberBasedTimeStepping(BaseLib::ConfigTree const &config)
std::unique_ptr< TimeStepAlgorithm > createFixedTimeStepping(BaseLib::ConfigTree const &config)
#define OGS_FATAL(fmt,...)
Definition: Error.h:64

◆ getIndices()

std::vector< GlobalIndexType > NumLib::getIndices ( std::size_t const  mesh_item_id,
NumLib::LocalToGlobalIndexMap const &  dof_table 
)

Returns nodal indices for the item identified by mesh_item_id from the given dof_table.

Definition at line 124 of file DOFTableUtil.cpp.

References anonymous_namespace{Density100MPa.cpp}::c, NumLib::LocalToGlobalIndexMap::getNumberOfComponents(), and NumLib::LocalToGlobalIndexMap::size().

Referenced by ProcessLib::VectorMatrixAssembler::assemble(), ProcessLib::NeumannBoundaryConditionLocalAssembler< ShapeFunction, IntegrationMethod, GlobalDim >::assemble(), ProcessLib::RobinBoundaryConditionLocalAssembler< ShapeFunction, IntegrationMethod, GlobalDim >::assemble(), ProcessLib::PythonBoundaryConditionLocalAssembler< ShapeFunction, IntegrationMethod, GlobalDim >::assemble(), ProcessLib::VariableDependentNeumannBoundaryConditionLocalAssembler< ShapeFunction, IntegrationMethod, GlobalDim >::assemble(), ProcessLib::HCNonAdvectiveFreeComponentFlowBoundaryConditionLocalAssembler< ShapeFunction, IntegrationMethod, GlobalDim >::assemble(), ProcessLib::SourceTerms::Python::PythonSourceTermLocalAssembler< ShapeFunction, IntegrationMethod, GlobalDim >::assemble(), ProcessLib::NormalTractionBoundaryCondition::NormalTractionBoundaryConditionLocalAssembler< ShapeFunctionDisplacement, IntegrationMethod, GlobalDim >::assemble(), ProcessLib::VectorMatrixAssembler::assembleWithJacobian(), ProcessLib::PhaseField::PhaseFieldLocalAssembler< ShapeFunction, IntegrationMethod, DisplacementDim >::computeCrackIntegral(), ProcessLib::SmallDeformationNonlocal::SmallDeformationNonlocalLocalAssembler< ShapeFunction, IntegrationMethod, DisplacementDim >::computeCrackIntegral(), ProcessLib::PhaseField::PhaseFieldLocalAssembler< ShapeFunction, IntegrationMethod, DisplacementDim >::computeEnergy(), ProcessLib::LocalAssemblerInterface::computeSecondaryVariable(), ProcessLib::HT::StaggeredHTFEM< ShapeFunction, IntegrationMethod, GlobalDim >::getIntPtDarcyVelocity(), ProcessLib::RichardsComponentTransport::LocalAssemblerData< ShapeFunction, IntegrationMethod, GlobalDim >::getIntPtDarcyVelocity(), ProcessLib::TES::TESLocalAssembler< ShapeFunction_, IntegrationMethod_, GlobalDim >::getIntPtDarcyVelocity(), ProcessLib::ThermoHydroMechanics::ThermoHydroMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod, DisplacementDim >::getIntPtDarcyVelocity(), ProcessLib::LiquidFlow::LiquidFlowLocalAssembler< ShapeFunction, IntegrationMethod, GlobalDim >::getIntPtDarcyVelocity(), ProcessLib::RichardsMechanics::RichardsMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod, DisplacementDim >::getIntPtDarcyVelocity(), ProcessLib::GroundwaterFlow::LocalAssemblerData< ShapeFunction, IntegrationMethod, GlobalDim >::getIntPtDarcyVelocity(), ProcessLib::HT::MonolithicHTFEM< ShapeFunction, IntegrationMethod, GlobalDim >::getIntPtDarcyVelocity(), ProcessLib::RichardsFlow::LocalAssemblerData< ShapeFunction, IntegrationMethod, GlobalDim >::getIntPtDarcyVelocity(), ProcessLib::HydroMechanics::HydroMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod, DisplacementDim >::getIntPtDarcyVelocity(), ProcessLib::ComponentTransport::LocalAssemblerData< ShapeFunction, IntegrationMethod, GlobalDim >::getIntPtDarcyVelocity(), ProcessLib::RichardsComponentTransport::LocalAssemblerData< ShapeFunction, IntegrationMethod, GlobalDim >::getIntPtSaturation(), ProcessLib::LineSourceTermLocalAssembler< ShapeFunction, IntegrationMethod, GlobalDim >::integrate(), ProcessLib::VolumetricSourceTermLocalAssembler< ShapeFunction, IntegrationMethod, GlobalDim >::integrate(), ProcessLib::LocalAssemblerInterface::postNonLinearSolver(), ProcessLib::LocalAssemblerInterface::postTimestep(), ProcessLib::VectorMatrixAssembler::preAssemble(), ProcessLib::LocalAssemblerInterface::preTimestep(), ProcessLib::LocalAssemblerInterface::setInitialConditions(), and ProcessLib::SmallDeformation::writeMaterialForces().

127 {
128  assert(dof_table.size() > mesh_item_id);
129  std::vector<GlobalIndexType> indices;
130 
131  // Local matrices and vectors will always be ordered by component
132  // no matter what the order of the global matrix is.
133  for (int c = 0; c < dof_table.getNumberOfComponents(); ++c)
134  {
135  auto const& idcs = dof_table(mesh_item_id, c).rows;
136  indices.reserve(indices.size() + idcs.size());
137  indices.insert(indices.end(), idcs.begin(), idcs.end());
138  }
139 
140  return indices;
141 }

◆ getNodalValue()

double NumLib::getNodalValue ( GlobalVector const &  x,
MeshLib::Mesh const &  mesh,
NumLib::LocalToGlobalIndexMap const &  dof_table,
std::size_t const  node_id,
std::size_t const  global_component_id 
)

Returns the value for the given node_id and global_component_id from the vector x.

Definition at line 110 of file DOFTableUtil.cpp.

References NumLib::LocalToGlobalIndexMap::getGlobalIndex(), MeshLib::Mesh::getID(), MeshLib::Node, and NumLib::MeshComponentMap::nop.

Referenced by ProcessLib::GlobalVectorFromNamedFunction::call(), ProcessLib::TES::TESProcess::computeEquilibriumLoading(), ProcessLib::TES::TESProcess::computeRelativeHumidity(), and ProcessLib::TES::TESProcess::computeVapourPartialPressure().

114 {
115  MeshLib::Location const l{mesh.getID(), MeshLib::MeshItemType::Node,
116  node_id};
117 
118  auto const index = dof_table.getGlobalIndex(l, global_component_id);
119  assert (index != NumLib::MeshComponentMap::nop);
120 
121  return x.get(index);
122 }
static NUMLIB_EXPORT GlobalIndexType const nop

◆ getNonGhostNodalValue()

double NumLib::getNonGhostNodalValue ( GlobalVector const &  x,
MeshLib::Mesh const &  mesh,
NumLib::LocalToGlobalIndexMap const &  dof_table,
std::size_t const  node_id,
std::size_t const  global_component_id 
)

Returns the value for the given node_id and global_component_id from the vector x in case the node is not a ghost node. Else 0.0 is returned.

Definition at line 91 of file DOFTableUtil.cpp.

References NumLib::LocalToGlobalIndexMap::getGlobalIndex(), MeshLib::Mesh::getID(), MeshLib::Node, and NumLib::MeshComponentMap::nop.

Referenced by NumLib::anonymous_namespace{DOFTableUtil.cpp}::norm().

95 {
96  MeshLib::Location const l{mesh.getID(), MeshLib::MeshItemType::Node,
97  node_id};
98 
99  auto const index = dof_table.getGlobalIndex(l, global_component_id);
100  assert (index != NumLib::MeshComponentMap::nop);
101 
102  if (index < 0)
103  { // ghost node value
104  return 0.0;
105  }
106 
107  return x.get(index);
108 }
static NUMLIB_EXPORT GlobalIndexType const nop

◆ getRowColumnIndices()

LocalToGlobalIndexMap::RowColumnIndices NumLib::getRowColumnIndices ( std::size_t const  id,
NumLib::LocalToGlobalIndexMap const &  dof_table,
std::vector< GlobalIndexType > &  indices 
)

Returns row/column indices for the item identified by id from the given dof_table.

Definition at line 143 of file DOFTableUtil.cpp.

References anonymous_namespace{Density100MPa.cpp}::c, NumLib::LocalToGlobalIndexMap::getNumberOfComponents(), and NumLib::LocalToGlobalIndexMap::size().

Referenced by ProcessLib::GroundwaterFlow::GroundwaterFlowProcess::getFlux(), ProcessLib::HT::HTProcess::getFlux(), ProcessLib::ComponentTransport::ComponentTransportProcess::getFlux(), and ProcessLib::TES::TESProcess::postIterationConcreteProcess().

147 {
148  assert(dof_table.size() > id);
149  indices.clear();
150 
151  // Local matrices and vectors will always be ordered by component,
152  // no matter what the order of the global matrix is.
153  for (int c = 0; c < dof_table.getNumberOfComponents(); ++c)
154  {
155  auto const& idcs = dof_table(id, c).rows;
156  indices.reserve(indices.size() + idcs.size());
157  indices.insert(indices.end(), idcs.begin(), idcs.end());
158  }
159 
160  return NumLib::LocalToGlobalIndexMap::RowColumnIndices(indices, indices);
161 }
MathLib::RowColumnIndices< GlobalIndexType > RowColumnIndices

◆ interpolateToHigherOrderNodes()

template<typename LowerOrderShapeFunction , typename HigherOrderMeshElementType , int GlobalDim, typename EigenMatrixType >
void NumLib::interpolateToHigherOrderNodes ( MeshLib::Element const &  element,
bool const  is_axially_symmetric,
Eigen::MatrixBase< EigenMatrixType > const &  node_values,
MeshLib::PropertyVector< double > &  interpolated_values_global_vector 
)

Interpolates scalar node_values given in lower order element nodes (e.g. the base nodes) to higher order element's nodes (e.g. quadratic nodes) and writes the result into the global property vector.

The base nodes' values are copied. For each higher order node the shape matrices are evaluated for the lower order element (the base nodes), and used for the the scalar quantity interpolation.

Definition at line 101 of file Interpolation.h.

References MeshLib::Element::getNodeIndex(), MeshLib::Element::getNumberOfBaseNodes(), and MeshLib::Element::getNumberOfNodes().

Referenced by ProcessLib::ThermoHydroMechanics::ThermoHydroMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod, DisplacementDim >::computeSecondaryVariableConcrete(), ProcessLib::RichardsMechanics::RichardsMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod, DisplacementDim >::computeSecondaryVariableConcrete(), ProcessLib::HydroMechanics::HydroMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod, DisplacementDim >::computeSecondaryVariableConcrete(), and ProcessLib::LIE::HydroMechanics::HydroMechanicsLocalAssemblerMatrix< ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod, GlobalDim >::postTimestepConcreteWithBlockVectors().

105 {
106  assert(dynamic_cast<HigherOrderMeshElementType const*>(&element));
107  assert(node_values.cols() == 1); // Scalar quantity only.
108 
109  using SF = LowerOrderShapeFunction;
110  using ShapeMatricesType = ShapeMatrixPolicyType<SF, GlobalDim>;
111  using ShapeMatrices = typename ShapeMatricesType::ShapeMatrices;
112 
113  auto const fe =
114  NumLib::createIsoparametricFiniteElement<SF, ShapeMatricesType>(
115  element);
116  int const number_base_nodes = element.getNumberOfBaseNodes();
117  int const number_all_nodes = element.getNumberOfNodes();
118 
119  // Copy the values for linear nodes.
120  for (int n = 0; n < number_base_nodes; ++n)
121  {
122  std::size_t const global_index = element.getNodeIndex(n);
123  interpolated_values_global_vector[global_index] = node_values[n];
124  }
125 
126  // Shape matrices storage reused in the interpolation loop.
127  ShapeMatrices shape_matrices{SF::DIM, GlobalDim, SF::NPOINTS};
128 
129  // Interpolate values for higher order nodes.
130  for (int n = number_base_nodes; n < number_all_nodes; ++n)
131  {
132  // Evaluated at higher order nodes' coordinates.
133  fe.template computeShapeFunctions<ShapeMatrixType::N>(
134  NaturalCoordinates<HigherOrderMeshElementType>::coordinates[n]
135  .data(),
136  shape_matrices, GlobalDim, is_axially_symmetric);
137 
138  std::size_t const global_index = element.getNodeIndex(n);
139  interpolated_values_global_vector[global_index] =
140  shape_matrices.N * node_values;
141  }
142 }

◆ makeExtrapolatable()

template<typename LocalAssemblerCollection , typename IntegrationPointValuesMethod >
ExtrapolatableLocalAssemblerCollection<LocalAssemblerCollection> NumLib::makeExtrapolatable ( LocalAssemblerCollection const &  local_assemblers,
IntegrationPointValuesMethod  integration_point_values_method 
)

Creates an ExtrapolatableLocalAssemblerCollection, which can be used to provide information to an Extrapolator.

Definition at line 149 of file ExtrapolatableElementCollection.h.

Referenced by ProcessLib::makeExtrapolator().

151 {
152  return ExtrapolatableLocalAssemblerCollection<LocalAssemblerCollection>{
153  local_assemblers, integration_point_values_method};
154 }

◆ norm()

double NumLib::norm ( GlobalVector const &  x,
unsigned const  global_component,
MathLib::VecNormType  norm_type,
LocalToGlobalIndexMap const &  dof_table,
MeshLib::Mesh const &  mesh 
)

Computes the specified norm of the given global component of the given vector x.

Remarks
x is typically the solution vector of a monolithically coupled process with several primary variables.

Definition at line 163 of file DOFTableUtil.cpp.

References MathLib::INFINITY_N, MathLib::NORM1, NumLib::anonymous_namespace{DOFTableUtil.cpp}::norm1(), MathLib::NORM2, NumLib::anonymous_namespace{DOFTableUtil.cpp}::norm2(), NumLib::anonymous_namespace{DOFTableUtil.cpp}::normInfinity(), and OGS_FATAL.

Referenced by NumLib::ConvergenceCriterionPerComponentDeltaX::checkDeltaX(), NumLib::ConvergenceCriterionPerComponentResidual::checkDeltaX(), NumLib::ConvergenceCriterionPerComponentResidual::checkResidual(), NumLib::anonymous_namespace{DOFTableUtil.cpp}::norm1(), NumLib::anonymous_namespace{DOFTableUtil.cpp}::norm2(), and NumLib::anonymous_namespace{DOFTableUtil.cpp}::normInfinity().

166 {
167  switch (norm_type)
168  {
170  return norm1(x, global_component, dof_table, mesh);
172  return norm2(x, global_component, dof_table, mesh);
174  return normInfinity(x, global_component, dof_table, mesh);
175  default:
176  OGS_FATAL("An invalid norm type has been passed.");
177  }
178 }
double normInfinity(GlobalVector const &x, unsigned const global_component, LocalToGlobalIndexMap const &dof_table, MeshLib::Mesh const &mesh)
double norm1(GlobalVector const &x, unsigned const global_component, LocalToGlobalIndexMap const &dof_table, MeshLib::Mesh const &mesh)
double norm2(GlobalVector const &x, unsigned const global_component, LocalToGlobalIndexMap const &dof_table, MeshLib::Mesh const &mesh)
#define OGS_FATAL(fmt,...)
Definition: Error.h:64

◆ operator<<() [1/2]

template<class T_N , class T_DNDR , class T_J , class T_DNDX >
std::ostream& NumLib::operator<< ( std::ostream &  os,
const ShapeMatrices< T_N, T_DNDR, T_J, T_DNDX > &  shape 
)

Definition at line 127 of file ShapeMatrices-impl.h.

128 {
129  shape.write (os);
130  return os;
131 }

◆ operator<<() [2/2]

std::ostream& NumLib::operator<< ( std::ostream &  os,
LocalToGlobalIndexMap const &  map 
)

Definition at line 447 of file LocalToGlobalIndexMap.cpp.

References NumLib::LocalToGlobalIndexMap::_mesh_component_map, NumLib::LocalToGlobalIndexMap::_rows, anonymous_namespace{Density100MPa.cpp}::c, MathLib::LinAlg::copy(), NumLib::LocalToGlobalIndexMap::getNumberOfComponents(), and NumLib::LocalToGlobalIndexMap::size().

448 {
449  std::size_t const max_lines = 10;
450  std::size_t lines_printed = 0;
451 
452  os << "Rows of the local to global index map; " << map._rows.size()
453  << " rows\n";
454  for (std::size_t e=0; e<map.size(); ++e)
455  {
456  os << "== e " << e << " ==\n";
457  for (int c = 0; c < map.getNumberOfComponents(); ++c)
458  {
459  auto const& line = map._rows(e, c);
460 
461  os << "c" << c << " { ";
462  std::copy(line.cbegin(), line.cend(),
463  std::ostream_iterator<std::size_t>(os, " "));
464  os << " }\n";
465  }
466 
467  if (lines_printed++ > max_lines)
468  {
469  os << "...\n";
470  break;
471  }
472  }
473 
474  os << "Mesh component map:\n" << map._mesh_component_map;
475  return os;
476 }
void copy(MatrixOrVector const &x, MatrixOrVector &y)
Copies x to y.
Definition: LinAlg.h:37

◆ shapeFunctionInterpolate()

template<typename NodalValues , typename ShapeMatrix , typename... ScalarTypes>
void NumLib::shapeFunctionInterpolate ( const NodalValues &  nodal_values,
const ShapeMatrix &  shape_matrix_N,
double &  interpolated_value,
ScalarTypes &...  interpolated_values 
)

Interpolates variables given at element nodes according to the given shape matrix.

This function simply does the usual finite-element interpolation, i.e. multiplication of nodal values with the shape function.

Parameters
nodal_valuesvector of nodal values, ordered by component
shape_matrix_Nshape matrix of the point to which will be interpolated
interpolated_valueinterpolated value of the first d.o.f. (output parameter)
interpolated_valuesinterpolated value of further d.o.f. (output parameter)
Template Parameters
NodalValuestype of the container where nodal values are stored
ShapeMatrixtype of the shape matrix $N$.
ScalarValuesall of the types in this pack must currently be double.
Note
nodal_values have to be ordered by component and it is assumed that all passed d.o.f. are single-component and are interpolated using the same shape function.

Definition at line 74 of file Interpolation.h.

Referenced by ProcessLib::VariableDependentNeumannBoundaryConditionLocalAssembler< ShapeFunction, IntegrationMethod, GlobalDim >::assemble(), ProcessLib::HT::MonolithicHTFEM< ShapeFunction, IntegrationMethod, GlobalDim >::assemble(), ProcessLib::HCNonAdvectiveFreeComponentFlowBoundaryConditionLocalAssembler< ShapeFunction, IntegrationMethod, GlobalDim >::assemble(), ProcessLib::RichardsMechanics::RichardsMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod, DisplacementDim >::assemble(), ProcessLib::RichardsComponentTransport::LocalAssemblerData< ShapeFunction, IntegrationMethod, GlobalDim >::assemble(), ProcessLib::TwoPhaseFlowWithPP::TwoPhaseFlowWithPPLocalAssembler< ShapeFunction, IntegrationMethod, GlobalDim >::assemble(), ProcessLib::RichardsFlow::LocalAssemblerData< ShapeFunction, IntegrationMethod, GlobalDim >::assemble(), ProcessLib::ThermalTwoPhaseFlowWithPP::ThermalTwoPhaseFlowWithPPLocalAssembler< ShapeFunction, IntegrationMethod, GlobalDim >::assemble(), ProcessLib::TwoPhaseFlowWithPrho::TwoPhaseFlowWithPrhoLocalAssembler< ShapeFunction, IntegrationMethod, GlobalDim >::assemble(), ProcessLib::ComponentTransport::LocalAssemblerData< ShapeFunction, IntegrationMethod, GlobalDim >::assembleBlockMatrices(), ProcessLib::ComponentTransport::LocalAssemblerData< ShapeFunction, IntegrationMethod, GlobalDim >::assembleComponentTransportEquation(), ProcessLib::HT::StaggeredHTFEM< ShapeFunction, IntegrationMethod, GlobalDim >::assembleHeatTransportEquation(), ProcessLib::HT::StaggeredHTFEM< ShapeFunction, IntegrationMethod, GlobalDim >::assembleHydraulicEquation(), ProcessLib::ComponentTransport::LocalAssemblerData< ShapeFunction, IntegrationMethod, GlobalDim >::assembleHydraulicEquation(), ProcessLib::LiquidFlow::LiquidFlowLocalAssembler< ShapeFunction, IntegrationMethod, GlobalDim >::assembleMatrixAndVector(), ProcessLib::RichardsMechanics::RichardsMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod, DisplacementDim >::assembleWithJacobian(), ProcessLib::HydroMechanics::HydroMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod, DisplacementDim >::assembleWithJacobianForDeformationEquations(), ProcessLib::ComponentTransport::LocalAssemblerData< ShapeFunction, IntegrationMethod, GlobalDim >::calculateIntPtDarcyVelocity(), ProcessLib::LiquidFlow::LiquidFlowLocalAssembler< ShapeFunction, IntegrationMethod, GlobalDim >::computeDarcyVelocityLocal(), ProcessLib::RichardsMechanics::RichardsMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod, DisplacementDim >::computeSecondaryVariableConcrete(), ProcessLib::HT::HTFEM< ShapeFunction, IntegrationMethod, GlobalDim >::getFlux(), ProcessLib::ComponentTransport::LocalAssemblerData< ShapeFunction, IntegrationMethod, GlobalDim >::getFlux(), ProcessLib::RichardsComponentTransport::LocalAssemblerData< ShapeFunction, IntegrationMethod, GlobalDim >::getIntPtDarcyVelocity(), ProcessLib::TES::TESLocalAssembler< ShapeFunction_, IntegrationMethod_, GlobalDim >::getIntPtDarcyVelocity(), ProcessLib::RichardsMechanics::RichardsMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod, DisplacementDim >::getIntPtDarcyVelocity(), ProcessLib::RichardsFlow::LocalAssemblerData< ShapeFunction, IntegrationMethod, GlobalDim >::getIntPtDarcyVelocity(), ProcessLib::HT::HTFEM< ShapeFunction, IntegrationMethod, GlobalDim >::getIntPtDarcyVelocityLocal(), ProcessLib::RichardsComponentTransport::LocalAssemblerData< ShapeFunction, IntegrationMethod, GlobalDim >::getIntPtSaturation(), and ProcessLib::TES::TESLocalAssemblerInner< ProcessLib::detail::LocalAssemblerTraitsFixed >::preEachAssembleIntegrationPoint().

80 {
81  auto const num_nodal_dof = sizeof...(interpolated_values) + 1;
82  auto const num_nodes = shape_matrix_N.size();
83 
84  assert(num_nodes * num_nodal_dof ==
85  static_cast<std::size_t>(nodal_values.size()));
86  (void) num_nodal_dof; (void) num_nodes; // no warnings when not in debug build
87 
88  detail::shapeFunctionInterpolate<0>(nodal_values, shape_matrix_N, interpolated_value,
89  interpolated_values...);
90 }

◆ transformVariableFromGlobalVector()

template<typename Functor >
void NumLib::transformVariableFromGlobalVector ( GlobalVector const &  input_vector,
int const  variable_id,
NumLib::LocalToGlobalIndexMap const &  local_to_global_index_map,
MeshLib::PropertyVector< double > &  output_vector,
Functor  mapFunction 
)

Copies part of a global vector for the given variable into output_vector while applying a function to each value.

Attention
The output_vector is accessed through node id and component, therefore multiple meshes are not supported.

Definition at line 60 of file DOFTableUtil.h.

References MeshLib::PropertyVector< PROP_VAL_TYPE >::getComponent(), NumLib::LocalToGlobalIndexMap::getGlobalIndex(), MeshLib::MeshSubset::getMeshID(), NumLib::LocalToGlobalIndexMap::getMeshSubset(), NumLib::LocalToGlobalIndexMap::getNumberOfVariableComponents(), and MeshLib::Node.

Referenced by ProcessLib::SmallDeformation::SmallDeformationProcess< DisplacementDim >::assembleWithJacobianConcreteProcess(), ProcessLib::LIE::HydroMechanics::HydroMechanicsProcess< GlobalDim >::assembleWithJacobianConcreteProcess(), ProcessLib::ThermoMechanics::ThermoMechanicsProcess< DisplacementDim >::assembleWithJacobianConcreteProcess(), ProcessLib::HydroMechanics::HydroMechanicsProcess< DisplacementDim >::assembleWithJacobianConcreteProcess(), ProcessLib::RichardsMechanics::RichardsMechanicsProcess< DisplacementDim >::assembleWithJacobianConcreteProcess(), and ProcessLib::ThermoHydroMechanics::ThermoHydroMechanicsProcess< DisplacementDim >::assembleWithJacobianConcreteProcess().

64 {
65  MathLib::LinAlg::setLocalAccessibleVector(input_vector);
66 
67  std::fill(begin(output_vector), end(output_vector),
68  std::numeric_limits<double>::quiet_NaN());
69 
70  int const n_components =
71  local_to_global_index_map.getNumberOfVariableComponents(variable_id);
72  for (int component = 0; component < n_components; ++component)
73  {
74  auto const& mesh_subset =
75  local_to_global_index_map.getMeshSubset(variable_id, component);
76  auto const mesh_id = mesh_subset.getMeshID();
77  for (auto const& node : mesh_subset.getNodes())
78  {
79  auto const node_id = node->getID();
81  node_id);
82  output_vector.getComponent(node_id, component) = mapFunction(
83  input_vector[local_to_global_index_map.getGlobalIndex(
84  l, variable_id, component)]);
85  }
86  }
87 }
PROP_VAL_TYPE & getComponent(std::size_t tuple_index, int component)
Returns the value for the given component stored in the given tuple.