OGS 6.2.0-555-gc9b84ea78.dirty.20190716144505
ProcessLib Namespace Reference

Detailed Description

File: DirichletBoundaryConditionAuxiliaryFunctions.cpp

Created on November 28, 2018, 11:26 AM

File: DirichletBoundaryConditionWithinTimeInterval.cpp

Created on November 26, 2018, 4:59 PM

File: DeactivatedSubdomain.cpp

Created on November 29, 2018, 10:50 AM

The code of this file is used to decouple the evaluation of matrix elements from the rest of OGS6, not all of OGS6 has to be recompiled every time a small change is done.

TODO in this implementation, the thermal properties of gas component directly use the properties of air, e.g. the specific heat capacity of gas component use the specific heat capacity of air, and since a constant specific heat capacity of air is assumed, the enthalpy of air is calculated based on a simplified model. Next, a strategy which can automatically(or from input file)switch between different gas components is required, and should be implemented as a material class, also different enthalpy models for different components are need to be implemented.

Namespaces

 ComponentTransport
 
 Deformation
 
 detail
 
 GroundwaterFlow
 
 HeatConduction
 
 HeatTransportBHE
 
 HT
 
 HydroMechanics
 
 LIE
 
 LinearBMatrix
 
 LiquidFlow
 
 NormalTractionBoundaryCondition
 
 PhaseField
 
 RichardsComponentTransport
 
 RichardsFlow
 
 RichardsMechanics
 
 SmallDeformation
 
 SmallDeformationNonlocal
 
 SourceTerms
 
 TES
 
 ThermalTwoPhaseFlowWithPP
 
 ThermoHydroMechanics
 
 ThermoMechanicalPhaseField
 
 ThermoMechanics
 
 TwoPhaseFlowWithPP
 
 TwoPhaseFlowWithPrho
 

Classes

class  AbstractJacobianAssembler
 Base class for Jacobian assemblers. More...
 
class  AnalyticalJacobianAssembler
 
class  BMatrixPolicyType
 
class  BoundaryCondition
 
class  BoundaryConditionCollection
 
struct  BoundaryConditionConfig
 
class  CachedSecondaryVariable
 
class  CentralDifferencesJacobianAssembler
 Assembles the Jacobian matrix using central differences. More...
 
class  CompareJacobiansJacobianAssembler
 
class  ConstraintDirichletBoundaryCondition
 
class  ConstraintDirichletBoundaryConditionLocalAssembler
 
class  ConstraintDirichletBoundaryConditionLocalAssemblerInterface
 
struct  CoupledSolutionsForStaggeredScheme
 
struct  DeactivatedSubdomain
 
struct  DeactivetedSubdomainMesh
 
class  DirichletBoundaryCondition
 
class  DirichletBoundaryConditionWithinTimeInterval
 
class  ExtrapolatorData
 
class  GenericNaturalBoundaryCondition
 
class  GenericNaturalBoundaryConditionLocalAssembler
 
class  GenericNaturalBoundaryConditionLocalAssemblerInterface
 
class  GlobalVectorFromNamedFunction
 
class  GMatrixPolicyType
 
struct  HCNonAdvectiveFreeComponentFlowBoundaryConditionData
 
class  HCNonAdvectiveFreeComponentFlowBoundaryConditionLocalAssembler
 
class  HMatrixPolicyType
 
struct  IntegrationPointData
 
struct  IntegrationPointMetaData
 
struct  IntegrationPointWriter
 
class  LocalAssemblerInterface
 
struct  LocalCoupledSolutions
 
class  LocalDataInitializer
 
struct  MethodNotOverriddenInDerivedClassException
 
class  NeumannBoundaryConditionLocalAssembler
 
class  NodalSourceTerm
 
class  Output
 
struct  Parameter
 
class  PhaseFieldIrreversibleDamageOracleBoundaryCondition
 
class  Process
 
struct  ProcessData
 
struct  ProcessOutput
 Holds information about which variables to write to output files. More...
 
class  ProcessVariable
 
class  PythonBoundaryCondition
 A boundary condition whose values are computed by a Python script. More...
 
struct  PythonBoundaryConditionData
 
class  PythonBoundaryConditionLocalAssembler
 
class  PythonBoundaryConditionPythonSideInterface
 
class  PythonBoundaryConditionPythonSideInterfaceTrampoline
 
struct  RobinBoundaryConditionData
 
class  RobinBoundaryConditionLocalAssembler
 
struct  SecondaryVariable
 Stores information about a specific secondary variable. More...
 
class  SecondaryVariableCollection
 Handles configuration of several secondary variables from the project file. More...
 
struct  SecondaryVariableContext
 
struct  SecondaryVariableFunctions
 
class  SourceTerm
 
class  SourceTermCollection
 
struct  SourceTermConfig
 
class  SurfaceFlux
 
struct  SurfaceFluxData
 
class  SurfaceFluxLocalAssembler
 
class  SurfaceFluxLocalAssemblerInterface
 
class  TESFEMReactionAdaptorCaOH2
 
class  TimeLoop
 Time loop capable of time-integrating several processes at once. More...
 
struct  TrafoIdentity
 
struct  TrafoLog
 
struct  TrafoScale
 
struct  TrafoTanh
 
struct  VariableDependentNeumannBoundaryConditionData
 
class  VariableDependentNeumannBoundaryConditionLocalAssembler
 
class  VectorMatrixAssembler
 
class  VolumetricSourceTerm
 
class  VolumetricSourceTermLocalAssembler
 
class  VolumetricSourceTermLocalAssemblerInterface
 

Typedefs

using HCNonAdvectiveFreeComponentFlowBoundaryCondition = GenericNaturalBoundaryCondition< HCNonAdvectiveFreeComponentFlowBoundaryConditionData, HCNonAdvectiveFreeComponentFlowBoundaryConditionLocalAssembler >
 
using NeumannBoundaryCondition = GenericNaturalBoundaryCondition< ParameterLib::Parameter< double > const &, NeumannBoundaryConditionLocalAssembler >
 
using RobinBoundaryCondition = GenericNaturalBoundaryCondition< RobinBoundaryConditionData, RobinBoundaryConditionLocalAssembler >
 
using VariableDependentNeumannBoundaryCondition = GenericNaturalBoundaryCondition< VariableDependentNeumannBoundaryConditionData, VariableDependentNeumannBoundaryConditionLocalAssembler >
 
template<typename ShpPol , unsigned NNodes, unsigned NodalDOF, unsigned Dim>
using LocalAssemblerTraits = detail::LocalAssemblerTraitsFixed< ShpPol, NNodes, NodalDOF, Dim >
 
using Trafo = ProcessLib::TrafoScale
 

Functions

std::unique_ptr< ConstraintDirichletBoundaryConditioncreateConstraintDirichletBoundaryCondition (BaseLib::ConfigTree const &config, MeshLib::Mesh const &bc_mesh, NumLib::LocalToGlobalIndexMap const &dof_table_bulk, int const variable_id, unsigned const integration_order, int const component_id, std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const &parameters, Process const &constraining_process)
 
std::unique_ptr< BoundaryConditioncreateBoundaryCondition (const BoundaryConditionConfig &config, const NumLib::LocalToGlobalIndexMap &dof_table, const MeshLib::Mesh &bulk_mesh, const int variable_id, const unsigned integration_order, const unsigned shapefunction_order, const std::vector< std::unique_ptr< ParameterLib::ParameterBase >> &parameters, const Process &process)
 
std::unique_ptr< DirichletBoundaryConditioncreateDirichletBoundaryCondition (BaseLib::ConfigTree const &config, MeshLib::Mesh const &bc_mesh, NumLib::LocalToGlobalIndexMap const &dof_table_bulk, int const variable_id, int const component_id, const std::vector< std::unique_ptr< ParameterLib::ParameterBase >> &parameters)
 
void checkParametersOfDirichletBoundaryCondition (MeshLib::Mesh const &bc_mesh, NumLib::LocalToGlobalIndexMap const &dof_table_bulk, int const variable_id, int const component_id)
 
void getEssentialBCValuesLocal (ParameterLib::Parameter< double > const &parameter, MeshLib::Mesh const &bc_mesh, std::vector< MeshLib::Node *> const &nodes_in_bc_mesh, NumLib::LocalToGlobalIndexMap const &dof_table_boundary, int const variable_id, int const component_id, const double t, GlobalVector const &, NumLib::IndexValueVector< GlobalIndexType > &bc_values)
 
std::unique_ptr< DirichletBoundaryConditionWithinTimeIntervalcreateDirichletBoundaryConditionWithinTimeInterval (BaseLib::ConfigTree const &config, MeshLib::Mesh const &bc_mesh, NumLib::LocalToGlobalIndexMap const &dof_table_bulk, int const variable_id, int const component_id, const std::vector< std::unique_ptr< ParameterLib::ParameterBase >> &parameters)
 
std::unique_ptr< HCNonAdvectiveFreeComponentFlowBoundaryConditioncreateHCNonAdvectiveFreeComponentFlowBoundaryCondition (BaseLib::ConfigTree const &config, MeshLib::Mesh const &bc_mesh, NumLib::LocalToGlobalIndexMap const &dof_table, int const variable_id, int const component_id, unsigned const integration_order, std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const &parameters, unsigned const global_dim, Process const &process, unsigned const shapefunction_order)
 
std::unique_ptr< NeumannBoundaryConditioncreateNeumannBoundaryCondition (BaseLib::ConfigTree const &config, MeshLib::Mesh const &bc_mesh, NumLib::LocalToGlobalIndexMap const &dof_table, int const variable_id, int const component_id, unsigned const integration_order, unsigned const shapefunction_order, unsigned const global_dim, std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const &parameters)
 
std::unique_ptr< PhaseFieldIrreversibleDamageOracleBoundaryConditioncreatePhaseFieldIrreversibleDamageOracleBoundaryCondition (BaseLib::ConfigTree const &config, NumLib::LocalToGlobalIndexMap const &dof_table, MeshLib::Mesh const &mesh, int const variable_id, int const component_id)
 
std::unique_ptr< PythonBoundaryConditioncreatePythonBoundaryCondition (BaseLib::ConfigTree const &config, MeshLib::Mesh const &boundary_mesh, NumLib::LocalToGlobalIndexMap const &dof_table, std::size_t bulk_mesh_id, int const variable_id, int const component_id, unsigned const integration_order, unsigned const shapefunction_order, unsigned const global_dim)
 Creates a new PythonBoundaryCondition object. More...
 
void pythonBindBoundaryCondition (pybind11::module &m)
 Creates Python bindings for the Python BC class. More...
 
std::unique_ptr< RobinBoundaryConditioncreateRobinBoundaryCondition (BaseLib::ConfigTree const &config, MeshLib::Mesh const &bc_mesh, NumLib::LocalToGlobalIndexMap const &dof_table, int const variable_id, int const component_id, unsigned const integration_order, unsigned const shapefunction_order, unsigned const global_dim, std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const &parameters)
 
std::unique_ptr< VariableDependentNeumannBoundaryConditioncreateVariableDependentNeumannBoundaryCondition (BaseLib::ConfigTree const &config, MeshLib::Mesh const &bc_mesh, NumLib::LocalToGlobalIndexMap const &dof_table, int const variable_id, int const component_id, unsigned const integration_order, unsigned const shapefunction_order, unsigned const global_dim, std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const &parameters)
 
std::unique_ptr< CentralDifferencesJacobianAssemblercreateCentralDifferencesJacobianAssembler (BaseLib::ConfigTree const &config)
 
std::unique_ptr< CompareJacobiansJacobianAssemblercreateCompareJacobiansJacobianAssembler (BaseLib::ConfigTree const &config)
 
std::vector< std::vector< double > > getPreviousLocalSolutions (const CoupledSolutionsForStaggeredScheme &cpl_xs, const std::vector< std::vector< GlobalIndexType >> &indices)
 
std::vector< std::vector< double > > getCurrentLocalSolutions (const CoupledSolutionsForStaggeredScheme &cpl_xs, const std::vector< std::vector< GlobalIndexType >> &indices)
 
std::unique_ptr< AbstractJacobianAssemblercreateJacobianAssembler (boost::optional< BaseLib::ConfigTree > const &config)
 
static std::unique_ptr< ProcessDatamakeProcessData (std::unique_ptr< NumLib::TimeStepAlgorithm > &&timestepper, NumLib::NonlinearSolverBase &nonlinear_solver, Process &process, std::unique_ptr< NumLib::TimeDiscretization > &&time_disc, std::unique_ptr< NumLib::ConvergenceCriterion > &&conv_crit)
 
std::vector< std::unique_ptr< ProcessData > > createPerProcessData (BaseLib::ConfigTree const &config, std::vector< std::unique_ptr< Process >> const &processes, std::map< std::string, std::unique_ptr< NumLib::NonlinearSolverBase >> const &nonlinear_solvers)
 
std::unique_ptr< TimeLoopcreateTimeLoop (BaseLib::ConfigTree const &config, std::string const &output_directory, std::vector< std::unique_ptr< Process >> const &processes, std::map< std::string, std::unique_ptr< NumLib::NonlinearSolverBase >> const &nonlinear_solvers, std::vector< std::unique_ptr< MeshLib::Mesh >> const &meshes, std::unique_ptr< ChemistryLib::PhreeqcIO > &phreeqc_io)
 Builds a TimeLoop from the given configuration. More...
 
std::unique_ptr< DeactivatedSubdomain const > createDeactivatedSubdomain (BaseLib::ConfigTree const &config, MeshLib::Mesh const &mesh)
 
std::vector< std::unique_ptr< DeactivatedSubdomain const > > createDeactivatedSubdomains (BaseLib::ConfigTree const &config, MeshLib::Mesh const &mesh)
 
template<int DisplacementDim, int NPOINTS, typename N_Type , typename HMatrixType >
void computeHMatrix (N_Type const &N, HMatrixType &H)
 Fills a H-matrix based on given shape function. More...
 
std::unique_ptr< OutputcreateOutput (const BaseLib::ConfigTree &config, std::string const &output_directory, std::vector< std::unique_ptr< MeshLib::Mesh >> const &meshes)
 
void createSecondaryVariables (BaseLib::ConfigTree const &config, SecondaryVariableCollection &secondary_variables, NumLib::NamedFunctionCaller &named_function_caller)
 
void addIntegrationPointWriter (MeshLib::Mesh &mesh, std::vector< std::unique_ptr< IntegrationPointWriter >> const &integration_point_writer)
 
IntegrationPointMetaData getIntegrationPointMetaData (MeshLib::Mesh const &mesh, std::string const &name)
 
void processOutputData (const double t, GlobalVector const &x, MeshLib::Mesh &mesh, NumLib::LocalToGlobalIndexMap const &dof_table, std::vector< std::reference_wrapper< ProcessVariable >> const &process_variables, SecondaryVariableCollection const &secondary_variables, bool const output_secondary_variable, std::vector< std::unique_ptr< IntegrationPointWriter >> const &integration_point_writer, ProcessOutput const &process_output)
 Prepare the output data, i.e. add the solution to vtu data structure. More...
 
void makeOutput (std::string const &file_name, MeshLib::Mesh const &mesh, bool const compress_output, int const data_mode)
 
template<typename LocalAssemblerCollection >
SecondaryVariableFunctions makeExtrapolator (const unsigned num_components, NumLib::Extrapolator &extrapolator, LocalAssemblerCollection const &local_assemblers, typename NumLib::ExtrapolatableLocalAssemblerCollection< LocalAssemblerCollection >::IntegrationPointValuesMethod integration_point_values_method)
 
std::unique_ptr< SourceTermcreateNodalSourceTerm (BaseLib::ConfigTree const &config, MeshLib::Mesh const &st_mesh, std::unique_ptr< NumLib::LocalToGlobalIndexMap > dof_table, std::size_t const source_term_mesh_id, const int variable_id, const int component_id, std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const &parameters)
 
std::unique_ptr< SourceTermcreateSourceTerm (const SourceTermConfig &config, const NumLib::LocalToGlobalIndexMap &dof_table_bulk, const MeshLib::Mesh &source_term_mesh, const int variable_id, const unsigned integration_order, const unsigned shapefunction_order, std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const &parameters)
 
std::unique_ptr< SourceTermcreateVolumetricSourceTerm (BaseLib::ConfigTree const &config, MeshLib::Mesh const &source_term_mesh, std::unique_ptr< NumLib::LocalToGlobalIndexMap > source_term_dof_table, std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const &parameters, unsigned const integration_order, unsigned const shapefunction_order)
 
std::unique_ptr< SourceTermcreatePythonSourceTerm (BaseLib::ConfigTree const &config, MeshLib::Mesh const &source_term_mesh, std::unique_ptr< NumLib::LocalToGlobalIndexMap > dof_table, std::size_t const bulk_mesh_id, int const variable_id, int const component_id, unsigned const integration_order, unsigned const shapefunction_order, unsigned const global_dim)
 
template<NumLib::ODESystemTag ODETag>
void setTimeDiscretizedODESystem (ProcessData &process_data, NumLib::ODESystem< ODETag, NumLib::NonlinearSolverTag::Picard > &ode_sys)
 
void setTimeDiscretizedODESystem (ProcessData &process_data)
 
std::vector< GlobalVector * > setInitialConditions (double const t0, std::vector< std::unique_ptr< ProcessData >> const &per_process_data)
 
NumLib::NonlinearSolverStatus solveOneTimeStepOneProcess (int const process_id, GlobalVector &x, std::size_t const timestep, double const t, double const delta_t, ProcessData const &process_data, Output &output_control)
 
template<template< typename, typename, unsigned > class LocalAssemblerImplementation, typename LocalAssemblerInterface , typename... ExtraCtorArgs>
void createLocalAssemblers (const unsigned dimension, std::vector< MeshLib::Element *> const &mesh_elements, NumLib::LocalToGlobalIndexMap const &dof_table, const unsigned shapefunction_order, std::vector< std::unique_ptr< LocalAssemblerInterface >> &local_assemblers, ExtraCtorArgs &&... extra_ctor_args)
 
template<typename ShapeFunction , typename ShapeMatricesType , typename IntegrationMethod , unsigned GlobalDim>
std::vector< typename ShapeMatricesType::ShapeMatrices, Eigen::aligned_allocator< typename ShapeMatricesType::ShapeMatrices > > initShapeMatrices (MeshLib::Element const &e, bool is_axially_symmetric, IntegrationMethod const &integration_method)
 
template<typename ShapeFunction , typename ShapeMatricesType >
double interpolateXCoordinate (MeshLib::Element const &e, typename ShapeMatricesType::ShapeMatrices::ShapeType const &N)
 
template<typename ShapeFunction , typename ShapeMatricesType >
std::array< double, 3 > interpolateCoordinates (MeshLib::Element const &e, typename ShapeMatricesType::ShapeMatrices::ShapeType const &N)
 
ProcessVariablefindProcessVariable (std::vector< ProcessVariable > const &variables, BaseLib::ConfigTree const &pv_config, std::string const &tag)
 
std::vector< std::reference_wrapper< ProcessVariable > > findProcessVariables (std::vector< ProcessVariable > const &variables, BaseLib::ConfigTree const &pv_config, std::initializer_list< std::string > tags)
 
std::vector< std::reference_wrapper< ProcessVariable > > findProcessVariables (std::vector< ProcessVariable > const &variables, BaseLib::ConfigTree const &pv_config, std::string const &tag)
 

Variables

const unsigned NUM_NODAL_DOF = 1
 
static std::string const nonlinear_fixed_dt_fails_info
 

Typedef Documentation

◆ HCNonAdvectiveFreeComponentFlowBoundaryCondition

◆ LocalAssemblerTraits

template<typename ShpPol , unsigned NNodes, unsigned NodalDOF, unsigned Dim>
using ProcessLib::LocalAssemblerTraits = typedef detail::LocalAssemblerTraitsFixed<ShpPol, NNodes, NodalDOF, Dim>

Definition at line 221 of file LocalAssemblerTraits.h.

◆ NeumannBoundaryCondition

◆ RobinBoundaryCondition

◆ Trafo

Definition at line 86 of file VariableTransformation.h.

◆ VariableDependentNeumannBoundaryCondition

Function Documentation

◆ addIntegrationPointWriter()

void ProcessLib::addIntegrationPointWriter ( MeshLib::Mesh mesh,
std::vector< std::unique_ptr< IntegrationPointWriter >> const &  integration_point_writer 
)

Add integration point data the the mesh's properties.

Adds all integration point data arrays given by the input vector and the corresponding meta data as VTK's field data. Integration point data stored as field data (contrary to point or cell data), as plain double arrays. The data is supplemented with information in JSON format, which is stored as array of characters.

Definition at line 91 of file IntegrationPointWriter.cpp.

References addIntegrationPointData(), and addIntegrationPointMetaData().

Referenced by processOutputData().

95 {
96  std::vector<IntegrationPointMetaData> meta_data;
97  for (auto const& ip_writer : integration_point_writer)
98  {
99  meta_data.push_back(addIntegrationPointData(mesh, *ip_writer));
100  }
101  if (!meta_data.empty())
102  {
103  addIntegrationPointMetaData(mesh, meta_data);
104  }
105 }
static ProcessLib::IntegrationPointMetaData addIntegrationPointData(MeshLib::Mesh &mesh, ProcessLib::IntegrationPointWriter const &writer)
static void addIntegrationPointMetaData(MeshLib::Mesh &mesh, std::vector< ProcessLib::IntegrationPointMetaData > const &meta_data)

◆ checkParametersOfDirichletBoundaryCondition()

void ProcessLib::checkParametersOfDirichletBoundaryCondition ( MeshLib::Mesh const &  bc_mesh,
NumLib::LocalToGlobalIndexMap const &  dof_table_bulk,
int const  variable_id,
int const  component_id 
)

Definition at line 24 of file DirichletBoundaryConditionAuxiliaryFunctions.cpp.

References MeshLib::Properties::existsPropertyVector(), MeshLib::Mesh::getName(), MeshLib::Mesh::getNodes(), NumLib::LocalToGlobalIndexMap::getNumberOfVariableComponents(), NumLib::LocalToGlobalIndexMap::getNumberOfVariables(), MeshLib::Mesh::getProperties(), and OGS_FATAL.

Referenced by ProcessLib::DirichletBoundaryConditionWithinTimeInterval::config(), and ProcessLib::DirichletBoundaryCondition::DirichletBoundaryCondition().

29 {
30  if (variable_id >=
31  static_cast<int>(dof_table_bulk.getNumberOfVariables()) ||
32  component_id >=
33  dof_table_bulk.getNumberOfVariableComponents(variable_id))
34  {
35  OGS_FATAL(
36  "Variable id or component id too high. Actual values: (%d, "
37  "%d), maximum values: (%d, %d).",
38  variable_id, component_id, dof_table_bulk.getNumberOfVariables(),
39  dof_table_bulk.getNumberOfVariableComponents(variable_id));
40  }
41 
42  if (!bc_mesh.getProperties().existsPropertyVector<std::size_t>(
43  "bulk_node_ids"))
44  {
45  OGS_FATAL(
46  "The required bulk node ids map does not exist in the boundary "
47  "mesh '%s'.",
48  bc_mesh.getName().c_str());
49  }
50 
51  DBUG(
52  "Found %d nodes for Dirichlet BCs for the variable %d and "
53  "component "
54  "%d",
55  bc_mesh.getNodes().size(), variable_id, component_id);
56 }
#define OGS_FATAL(fmt,...)
Definition: Error.h:63

◆ computeHMatrix()

template<int DisplacementDim, int NPOINTS, typename N_Type , typename HMatrixType >
void ProcessLib::computeHMatrix ( N_Type const &  N,
HMatrixType &  H 
)

Fills a H-matrix based on given shape function.

Definition at line 52 of file HMatrixUtils.h.

Referenced by ProcessLib::LIE::HydroMechanics::HydroMechanicsLocalAssemblerFracture< ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod, GlobalDim >::HydroMechanicsLocalAssemblerFracture(), and ProcessLib::LIE::SmallDeformation::SmallDeformationLocalAssemblerFracture< ShapeFunction, IntegrationMethod, DisplacementDim >::SmallDeformationLocalAssemblerFracture().

53 {
54  static_assert(1 < DisplacementDim && DisplacementDim <= 3,
55  "LinearHMatrix::computeHMatrix: DisplacementDim must be in "
56  "range (1,3].");
57 
58  H.setZero();
59 
60  for (unsigned j = 0; j < DisplacementDim; j++)
61  {
62  H.block(j, j * NPOINTS, 1, NPOINTS) = N;
63  }
64 }

◆ createBoundaryCondition()

std::unique_ptr< BoundaryCondition > ProcessLib::createBoundaryCondition ( const BoundaryConditionConfig config,
const NumLib::LocalToGlobalIndexMap dof_table,
const MeshLib::Mesh bulk_mesh,
const int  variable_id,
const unsigned  integration_order,
const unsigned  shapefunction_order,
const std::vector< std::unique_ptr< ParameterLib::ParameterBase >> &  parameters,
const Process process 
)
Input File Parameter:
prj__process_variables__process_variable__boundary_conditions__boundary_condition__type
Input File Parameter:
prj__process_variables__process_variable__boundary_conditions__boundary_condition__PhaseFieldIrreversibleDamageOracleBoundaryCondition

Definition at line 32 of file CreateBoundaryCondition.cpp.

References ProcessLib::BoundaryConditionConfig::boundary_mesh, ProcessLib::BoundaryConditionConfig::component_id, ProcessLib::BoundaryConditionConfig::config, createConstraintDirichletBoundaryCondition(), createDirichletBoundaryCondition(), createDirichletBoundaryConditionWithinTimeInterval(), createHCNonAdvectiveFreeComponentFlowBoundaryCondition(), createNeumannBoundaryCondition(), ProcessLib::NormalTractionBoundaryCondition::createNormalTractionBoundaryCondition(), createPhaseFieldIrreversibleDamageOracleBoundaryCondition(), createPythonBoundaryCondition(), createRobinBoundaryCondition(), createVariableDependentNeumannBoundaryCondition(), MeshLib::Mesh::getDimension(), MeshLib::Mesh::getID(), MeshLib::Mesh::isAxiallySymmetric(), OGS_FATAL, and BaseLib::ConfigTree::peekConfigParameter().

Referenced by ProcessLib::ProcessVariable::createBoundaryConditions().

39 {
40  // Surface mesh and bulk mesh must have equal axial symmetry flags!
41  if (config.boundary_mesh.isAxiallySymmetric() !=
42  bulk_mesh.isAxiallySymmetric())
43  {
44  OGS_FATAL(
45  "The boundary mesh %s axially symmetric but the bulk mesh %s. Both "
46  "must have an equal axial symmetry property.",
47  config.boundary_mesh.isAxiallySymmetric() ? "is" : "is not",
48  bulk_mesh.isAxiallySymmetric() ? "is" : "is not");
49  }
50 
52  auto const type = config.config.peekConfigParameter<std::string>("type");
53 
54  if (type == "Dirichlet")
55  {
57  config.config, config.boundary_mesh, dof_table, variable_id,
58  *config.component_id, parameters);
59  }
60  if (type == "DirichletWithinTimeInterval")
61  {
63  config.config, config.boundary_mesh, dof_table, variable_id,
64  *config.component_id, parameters);
65  }
66  if (type == "Neumann")
67  {
69  config.config, config.boundary_mesh, dof_table, variable_id,
70  *config.component_id, integration_order, shapefunction_order,
71  bulk_mesh.getDimension(), parameters);
72  }
73  if (type == "Robin")
74  {
76  config.config, config.boundary_mesh, dof_table, variable_id,
77  *config.component_id, integration_order, shapefunction_order,
78  bulk_mesh.getDimension(), parameters);
79  }
80  if (type == "VariableDependentNeumann")
81  {
83  config.config, config.boundary_mesh, dof_table, variable_id,
84  *config.component_id, integration_order, shapefunction_order,
85  bulk_mesh.getDimension(), parameters);
86  }
87 
88  if (type == "Python")
89  {
90 #ifdef OGS_USE_PYTHON
92  config.config, config.boundary_mesh, dof_table, bulk_mesh.getID(),
93  variable_id, *config.component_id, integration_order,
94  shapefunction_order, bulk_mesh.getDimension());
95 #else
96  OGS_FATAL("OpenGeoSys has not been built with Python support.");
97 #endif
98  }
99 
100  //
101  // Special boundary conditions
102  //
103  if (type == "ConstraintDirichlet")
104  {
106  config.config, config.boundary_mesh, dof_table, variable_id,
107  integration_order, *config.component_id, parameters, process);
108  }
109  if (type == "HCNonAdvectiveFreeComponentFlowBoundary")
110  {
112  config.config, config.boundary_mesh, dof_table, variable_id,
113  *config.component_id, integration_order, parameters,
114  bulk_mesh.getDimension(), process, shapefunction_order);
115  }
116  if (type == "NormalTraction")
117  {
120  config.config, config.boundary_mesh, dof_table, variable_id,
121  integration_order, shapefunction_order,
122  bulk_mesh.getDimension(), parameters);
123  }
124  if (type == "PhaseFieldIrreversibleDamageOracleBoundaryCondition")
125  {
126  return ProcessLib::
129  config.config, dof_table, bulk_mesh, variable_id,
130  *config.component_id);
131  }
132  OGS_FATAL("Unknown boundary condition type: `%s'.", type.c_str());
133 }
std::unique_ptr< ConstraintDirichletBoundaryCondition > createConstraintDirichletBoundaryCondition(BaseLib::ConfigTree const &config, MeshLib::Mesh const &bc_mesh, NumLib::LocalToGlobalIndexMap const &dof_table_bulk, int const variable_id, unsigned const integration_order, int const component_id, std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const &parameters, Process const &constraining_process)
std::unique_ptr< HCNonAdvectiveFreeComponentFlowBoundaryCondition > createHCNonAdvectiveFreeComponentFlowBoundaryCondition(BaseLib::ConfigTree const &config, MeshLib::Mesh const &bc_mesh, NumLib::LocalToGlobalIndexMap const &dof_table, int const variable_id, int const component_id, unsigned const integration_order, std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const &parameters, unsigned const global_dim, Process const &process, unsigned const shapefunction_order)
std::unique_ptr< PythonBoundaryCondition > createPythonBoundaryCondition(BaseLib::ConfigTree const &config, MeshLib::Mesh const &boundary_mesh, NumLib::LocalToGlobalIndexMap const &dof_table, std::size_t bulk_mesh_id, int const variable_id, int const component_id, unsigned const integration_order, unsigned const shapefunction_order, unsigned const global_dim)
Creates a new PythonBoundaryCondition object.
std::size_t getID() const
Get id of the mesh.
Definition: Mesh.h:123
std::unique_ptr< DirichletBoundaryConditionWithinTimeInterval > createDirichletBoundaryConditionWithinTimeInterval(BaseLib::ConfigTree const &config, MeshLib::Mesh const &bc_mesh, NumLib::LocalToGlobalIndexMap const &dof_table_bulk, int const variable_id, int const component_id, const std::vector< std::unique_ptr< ParameterLib::ParameterBase >> &parameters)
bool isAxiallySymmetric() const
Definition: Mesh.h:137
std::unique_ptr< DirichletBoundaryCondition > createDirichletBoundaryCondition(BaseLib::ConfigTree const &config, MeshLib::Mesh const &bc_mesh, NumLib::LocalToGlobalIndexMap const &dof_table_bulk, int const variable_id, int const component_id, const std::vector< std::unique_ptr< ParameterLib::ParameterBase >> &parameters)
std::unique_ptr< NormalTractionBoundaryCondition< NormalTractionBoundaryConditionLocalAssembler > > createNormalTractionBoundaryCondition(BaseLib::ConfigTree const &config, MeshLib::Mesh const &bc_mesh, NumLib::LocalToGlobalIndexMap const &dof_table, int const variable_id, unsigned const integration_order, unsigned const shapefunction_order, unsigned const global_dim, std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const &parameters)
unsigned getDimension() const
Returns the dimension of the mesh (determined by the maximum dimension over all elements).
Definition: Mesh.h:81
#define OGS_FATAL(fmt,...)
Definition: Error.h:63
std::unique_ptr< PhaseFieldIrreversibleDamageOracleBoundaryCondition > createPhaseFieldIrreversibleDamageOracleBoundaryCondition(BaseLib::ConfigTree const &config, NumLib::LocalToGlobalIndexMap const &dof_table, MeshLib::Mesh const &mesh, int const variable_id, int const component_id)
std::unique_ptr< RobinBoundaryCondition > createRobinBoundaryCondition(BaseLib::ConfigTree const &config, MeshLib::Mesh const &bc_mesh, NumLib::LocalToGlobalIndexMap const &dof_table, int const variable_id, int const component_id, unsigned const integration_order, unsigned const shapefunction_order, unsigned const global_dim, std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const &parameters)
std::unique_ptr< VariableDependentNeumannBoundaryCondition > createVariableDependentNeumannBoundaryCondition(BaseLib::ConfigTree const &config, MeshLib::Mesh const &bc_mesh, NumLib::LocalToGlobalIndexMap const &dof_table, int const variable_id, int const component_id, unsigned const integration_order, unsigned const shapefunction_order, unsigned const global_dim, std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const &parameters)
std::unique_ptr< NeumannBoundaryCondition > createNeumannBoundaryCondition(BaseLib::ConfigTree const &config, MeshLib::Mesh const &bc_mesh, NumLib::LocalToGlobalIndexMap const &dof_table, int const variable_id, int const component_id, unsigned const integration_order, unsigned const shapefunction_order, unsigned const global_dim, std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const &parameters)

◆ createCentralDifferencesJacobianAssembler()

std::unique_ptr< CentralDifferencesJacobianAssembler > ProcessLib::createCentralDifferencesJacobianAssembler ( BaseLib::ConfigTree const &  config)
Input File Parameter:
prj__processes__process__jacobian_assembler__type
Input File Parameter:
prj__processes__process__jacobian_assembler__CentralDifferences__relative_epsilons
Input File Parameter:
prj__processes__process__jacobian_assembler__CentralDifferences__component_magnitudes

Definition at line 133 of file CentralDifferencesJacobianAssembler.cpp.

References BaseLib::ConfigTree::checkConfigParameter(), BaseLib::ConfigTree::getConfigParameterOptional(), and OGS_FATAL.

Referenced by createJacobianAssembler().

134 {
136  config.checkConfigParameter("type", "CentralDifferences");
137 
138  // TODO make non-optional.
140  auto rel_eps = config.getConfigParameterOptional<std::vector<double>>(
141  "relative_epsilons");
143  auto comp_mag = config.getConfigParameterOptional<std::vector<double>>(
144  "component_magnitudes");
145 
146  if (!!rel_eps != !!comp_mag) {
147  OGS_FATAL(
148  "Either both or none of <relative_epsilons> and "
149  "<component_magnitudes> have to be specified.");
150  }
151 
152  std::vector<double> abs_eps;
153 
154  if (rel_eps) {
155  if (rel_eps->size() != comp_mag->size()) {
156  OGS_FATAL(
157  "The numbers of components of <relative_epsilons> and "
158  "<component_magnitudes> do not match.");
159  }
160 
161  abs_eps.resize(rel_eps->size());
162  for (std::size_t i=0; i<rel_eps->size(); ++i) {
163  abs_eps[i] = (*rel_eps)[i] * (*comp_mag)[i];
164  }
165  } else {
166  // By default 1e-8 is used as epsilon for all components.
167  // TODO: remove this default value.
168  abs_eps.emplace_back(1e-8);
169  }
170 
171  return std::make_unique<CentralDifferencesJacobianAssembler>(
172  std::move(abs_eps));
173 }
#define OGS_FATAL(fmt,...)
Definition: Error.h:63

◆ createCompareJacobiansJacobianAssembler()

std::unique_ptr< CompareJacobiansJacobianAssembler > ProcessLib::createCompareJacobiansJacobianAssembler ( BaseLib::ConfigTree const &  config)
Input File Parameter:
prj__processes__process__jacobian_assembler__type
Input File Parameter:
prj__processes__process__jacobian_assembler__CompareJacobians__jacobian_assembler
Input File Parameter:
prj__processes__process__jacobian_assembler__CompareJacobians__reference_jacobian_assembler
Input File Parameter:
prj__processes__process__jacobian_assembler__CompareJacobians__abs_tol
Input File Parameter:
prj__processes__process__jacobian_assembler__CompareJacobians__rel_tol
Input File Parameter:
prj__processes__process__jacobian_assembler__CompareJacobians__fail_on_error
Input File Parameter:
prj__processes__process__jacobian_assembler__CompareJacobians__log_file

Definition at line 397 of file CompareJacobiansJacobianAssembler.cpp.

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

Referenced by createJacobianAssembler().

398 {
399  // TODO doc script corner case: Parameter could occur at different
400  // locations.
402  config.checkConfigParameter("type", "CompareJacobians");
403 
404  auto asm1 =
406  createJacobianAssembler(config.getConfigSubtree("jacobian_assembler"));
407 
408  auto asm2 = createJacobianAssembler(
410  config.getConfigSubtree("reference_jacobian_assembler"));
411 
413  auto const abs_tol = config.getConfigParameter<double>("abs_tol");
415  auto const rel_tol = config.getConfigParameter<double>("rel_tol");
416 
418  auto const fail_on_error = config.getConfigParameter<bool>("fail_on_error");
419 
421  auto const log_file = config.getConfigParameter<std::string>("log_file");
422 
423  return std::make_unique<CompareJacobiansJacobianAssembler>(
424  std::move(asm1), std::move(asm2), abs_tol, rel_tol, fail_on_error,
425  log_file);
426 }
std::unique_ptr< AbstractJacobianAssembler > createJacobianAssembler(boost::optional< BaseLib::ConfigTree > const &config)

◆ createConstraintDirichletBoundaryCondition()

std::unique_ptr< ConstraintDirichletBoundaryCondition > ProcessLib::createConstraintDirichletBoundaryCondition ( BaseLib::ConfigTree const &  config,
MeshLib::Mesh const &  bc_mesh,
NumLib::LocalToGlobalIndexMap const &  dof_table_bulk,
int const  variable_id,
unsigned const  integration_order,
int const  component_id,
std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const &  parameters,
Process const &  constraining_process 
)

The function parses the config tree and creates a ConstraintDirichletBoundaryCondition.

Input File Parameter:
prj__process_variables__process_variable__boundary_conditions__boundary_condition__type
Input File Parameter:
prj__process_variables__process_variable__boundary_conditions__boundary_condition__ConstraintDirichletBoundaryCondition__constraint_type
Input File Parameter:
prj__process_variables__process_variable__boundary_conditions__boundary_condition__ConstraintDirichletBoundaryCondition__constraining_process_variable
Input File Parameter:
prj__process_variables__process_variable__boundary_conditions__boundary_condition__ConstraintDirichletBoundaryCondition__constraint_threshold
Input File Parameter:
prj__process_variables__process_variable__boundary_conditions__boundary_condition__ConstraintDirichletBoundaryCondition__constraint_direction
Input File Parameter:
prj__process_variables__process_variable__boundary_conditions__boundary_condition__ConstraintDirichletBoundaryCondition__parameter

Definition at line 227 of file ConstraintDirichletBoundaryCondition.cpp.

References BaseLib::ConfigTree::checkConfigParameter(), BaseLib::ConfigTree::getConfigParameter(), MeshLib::Mesh::getDimension(), ProcessLib::Process::getFlux(), ProcessLib::Process::getMesh(), MeshLib::Mesh::getNumberOfElements(), MeshLib::Mesh::getNumberOfNodes(), ProcessLib::Process::getProcessVariables(), ProcessLib::Process::isMonolithicSchemeUsed(), and OGS_FATAL.

Referenced by createBoundaryCondition().

233 {
234  DBUG("Constructing ConstraintDirichletBoundaryCondition from config.");
236  config.checkConfigParameter("type", "ConstraintDirichlet");
237 
238  auto const constraint_type =
240  config.getConfigParameter<std::string>("constraint_type");
241  if (constraint_type != "Flux")
242  {
243  OGS_FATAL("The constraint type is '%s', but has to be 'Flux'.",
244  constraint_type.c_str());
245  }
246 
247  // Todo (TF) Open question: How to specify which getFlux function should be
248  // used for the constraint calculation?
249  auto const constraining_process_variable =
251  config.getConfigParameter<std::string>("constraining_process_variable");
252 
253  if (!constraining_process.isMonolithicSchemeUsed())
254  {
255  OGS_FATAL(
256  "The constraint dirichlet boundary condition is implemented only "
257  "for monolithic implemented processes.");
258  }
259  const int process_id = 0;
260  auto process_variables =
261  constraining_process.getProcessVariables(process_id);
262  auto constraining_pv =
263  std::find_if(process_variables.cbegin(), process_variables.cend(),
264  [&constraining_process_variable](ProcessVariable const& pv) {
265  return pv.getName() == constraining_process_variable;
266  });
267  if (constraining_pv == std::end(process_variables))
268  {
269  auto const& constraining_process_variable_name =
270  process_variables[variable_id].get().getName();
271  OGS_FATAL(
272  "<constraining_process_variable> in process variable name '%s' at "
273  "geometry 'TODO' : The constraining process variable is set as "
274  "'%s', but this is not specified in the project file.",
275  constraining_process_variable_name.c_str(),
276  constraining_process_variable.c_str());
277  }
278 
279  auto const constraint_threshold =
281  config.getConfigParameter<double>("constraint_threshold");
282 
283  auto const constraint_direction_string =
285  config.getConfigParameter<std::string>("constraint_direction");
286  if (constraint_direction_string != "greater" &&
287  constraint_direction_string != "lower")
288  {
289  OGS_FATAL(
290  "The constraint direction is '%s', but has to be either 'greater' "
291  "or 'lower'.",
292  constraint_direction_string.c_str());
293  }
294  bool const lower = constraint_direction_string == "lower";
295 
296 
298  auto const param_name = config.getConfigParameter<std::string>("parameter");
299  DBUG("Using parameter %s", param_name.c_str());
300 
301  auto& param = ParameterLib::findParameter<double>(param_name, parameters, 1,
302  &bc_mesh);
303 
304  // In case of partitioned mesh the boundary could be empty, i.e. there is no
305  // boundary condition.
306 #ifdef USE_PETSC
307  // This can be extracted to createBoundaryCondition() but then the config
308  // parameters are not read and will cause an error.
309  // TODO (naumov): Add a function to ConfigTree for skipping the tags of the
310  // subtree and move the code up in createBoundaryCondition().
311  if (bc_mesh.getDimension() == 0 && bc_mesh.getNumberOfNodes() == 0 &&
312  bc_mesh.getNumberOfElements() == 0)
313  {
314  return nullptr;
315  }
316 #endif // USE_PETSC
317 
318  return std::make_unique<ConstraintDirichletBoundaryCondition>(
319  param, dof_table_bulk, variable_id, component_id, bc_mesh,
320  integration_order, constraining_process.getMesh(), constraint_threshold,
321  lower,
322  [&constraining_process](std::size_t const element_id,
323  MathLib::Point3d const& pnt, double const t,
324  GlobalVector const& x) {
325  return constraining_process.getFlux(element_id, pnt, t, x);
326  });
327 }
#define OGS_FATAL(fmt,...)
Definition: Error.h:63

◆ createDeactivatedSubdomain()

std::unique_ptr<DeactivatedSubdomain const> ProcessLib::createDeactivatedSubdomain ( BaseLib::ConfigTree const &  config,
MeshLib::Mesh const &  mesh 
)
Input File Parameter:
prj__process_variables__process_variable__deactivated_subdomains__deactivated_subdomain__time_interval
Input File Parameter:
prj__process_variables__process_variable__deactivated_subdomains__deactivated_subdomain__material_ids

Definition at line 54 of file DeactivatedSubdomain.cpp.

References MeshLib::cloneElements(), MeshLib::createMeshFromElementSelection(), BaseLib::createTimeInterval(), ProcessLib::DeactivatedSubdomain::deactivated_subdomain_meshes, BaseLib::ConfigTree::getConfigParameter(), MeshLib::Mesh::getElement(), MeshLib::Node::getElements(), MeshLib::Element::getNode(), MeshLib::Mesh::getNumberOfElements(), MeshLib::Mesh::getNumberOfNodes(), MeshLib::materialIDs(), OGS_FATAL, BaseLib::ConfigTree::peekConfigParameter(), and ProcessLib::DeactivatedSubdomain::time_interval.

Referenced by createDeactivatedSubdomains().

56 {
58  config.peekConfigParameter<std::string>("time_interval");
59  auto time_interval = BaseLib::createTimeInterval(config);
60 
61  std::vector<int> deactivated_subdomain_material_ids;
62  deactivated_subdomain_material_ids =
64  config.getConfigParameter<std::vector<int>>("material_ids",
65  std::vector<int>{});
66 
67  if (deactivated_subdomain_material_ids.empty())
68  {
69  OGS_FATAL(
70  "The material IDs of the deactivated subdomains are not given. The "
71  "program terminates now.");
72  }
73 
74  std::sort(deactivated_subdomain_material_ids.begin(),
75  deactivated_subdomain_material_ids.end());
76 
77  auto const* const material_ids = MeshLib::materialIDs(mesh);
78  if (material_ids == nullptr)
79  {
80  OGS_FATAL(
81  "The mesh doesn't contain materialIDs for subdomain deactivation. "
82  "The program terminates now.");
83  }
84 
85  std::vector<std::unique_ptr<DeactivetedSubdomainMesh>>
86  deactivated_subdomain_meshes;
87  deactivated_subdomain_meshes.reserve(
88  deactivated_subdomain_material_ids.size());
89 
90  for (auto const ids : deactivated_subdomain_material_ids)
91  {
92  std::vector<MeshLib::Element*> deactivated_elements;
93  std::vector<MeshLib::Node*> deactivated_nodes;
94 
95  // temporary vector to enhance node searching.
96  std::vector<bool> deactivation_flag_of_nodes(mesh.getNumberOfNodes(),
97  false);
98 
99  for (std::size_t i = 0; i < mesh.getNumberOfElements(); i++)
100  {
101  if (ids != (*material_ids)[i])
102  {
103  continue;
104  }
105 
106  auto* element = mesh.getElement(i);
107  deactivated_elements.push_back(
108  const_cast<MeshLib::Element*>(element));
109 
110  for (unsigned j = 0; j < element->getNumberOfNodes(); j++)
111  {
112  auto const* const node = element->getNode(j);
113  const auto& connected_elements = node->getElements();
114 
115  if (deactivation_flag_of_nodes[node->getID()])
116  {
117  continue;
118  }
119 
120  // Check whether this node is in an activated element.
121  if (std::find_if(
122  connected_elements.begin(),
123  connected_elements.end(),
124  [&](auto const* const connected_elem) -> bool {
125  return ids !=
126  (*material_ids)[connected_elem->getID()];
127  }) != connected_elements.end())
128  {
129  continue;
130  }
131 
132  deactivated_nodes.push_back(const_cast<MeshLib::Node*>(node));
133  deactivation_flag_of_nodes[node->getID()] = true;
134  }
135  }
136 
138  "deactivate_subdomain" + std::to_string(ids),
139  MeshLib::cloneElements(deactivated_elements));
140 
141  deactivated_subdomain_meshes.emplace_back(
142  std::make_unique<DeactivetedSubdomainMesh>(
143  std::move(bc_mesh), std::move(deactivated_nodes)));
144  }
145 
146  return std::make_unique<DeactivatedSubdomain const>(
147  std::move(time_interval),
148  std::move(deactivated_subdomain_material_ids),
149  std::move(deactivated_subdomain_meshes));
150 }
std::vector< MeshLib::Element * > cloneElements(std::vector< MeshLib::Element *> const &elements)
Clones a vector of elements using the Element::clone() function.
std::unique_ptr< MeshLib::Mesh > createMeshFromElementSelection(std::string mesh_name, std::vector< MeshLib::Element *> const &elements)
Definition: Mesh.cpp:413
std::unique_ptr< TimeInterval > createTimeInterval(BaseLib::ConfigTree const &config)
PropertyVector< int > const * materialIDs(Mesh const &mesh)
Definition: Mesh.cpp:403
#define OGS_FATAL(fmt,...)
Definition: Error.h:63

◆ createDeactivatedSubdomains()

std::vector< std::unique_ptr< DeactivatedSubdomain const > > ProcessLib::createDeactivatedSubdomains ( BaseLib::ConfigTree const &  config,
MeshLib::Mesh const &  mesh 
)
Input File Parameter:
prj__process_variables__process_variable__deactivated_subdomains
Input File Parameter:
prj__process_variables__process_variable__deactivated_subdomains__deactivated_subdomain

Definition at line 153 of file DeactivatedSubdomain.cpp.

References createDeactivatedSubdomain(), and BaseLib::ConfigTree::getConfigSubtreeOptional().

155 {
156  std::vector<std::unique_ptr<DeactivatedSubdomain const>>
157  deactivated_subdomains;
158  // Deactivated subdomains
159  if (auto subdomains_config =
161  config.getConfigSubtreeOptional("deactivated_subdomains"))
162  {
163  INFO("There are subdomains being deactivated.");
164 
165  for (
166  auto subdomain_config :
168  subdomains_config->getConfigSubtreeList("deactivated_subdomain"))
169  {
170  deactivated_subdomains.emplace_back(
171  createDeactivatedSubdomain(subdomain_config, mesh));
172  }
173  }
174  return deactivated_subdomains;
175 }
std::unique_ptr< DeactivatedSubdomain const > createDeactivatedSubdomain(BaseLib::ConfigTree const &config, MeshLib::Mesh const &mesh)

◆ createDirichletBoundaryCondition()

std::unique_ptr< DirichletBoundaryCondition > ProcessLib::createDirichletBoundaryCondition ( BaseLib::ConfigTree const &  config,
MeshLib::Mesh const &  bc_mesh,
NumLib::LocalToGlobalIndexMap const &  dof_table_bulk,
int const  variable_id,
int const  component_id,
const std::vector< std::unique_ptr< ParameterLib::ParameterBase >> &  parameters 
)
Input File Parameter:
prj__process_variables__process_variable__boundary_conditions__boundary_condition__type
Input File Parameter:
prj__process_variables__process_variable__boundary_conditions__boundary_condition__Dirichlet__parameter

Definition at line 57 of file DirichletBoundaryCondition.cpp.

References BaseLib::ConfigTree::checkConfigParameter(), BaseLib::ConfigTree::getConfigParameter(), MeshLib::Mesh::getDimension(), MeshLib::Mesh::getNumberOfElements(), and MeshLib::Mesh::getNumberOfNodes().

Referenced by createBoundaryCondition().

62 {
63  DBUG("Constructing DirichletBoundaryCondition from config.");
65  config.checkConfigParameter("type", "Dirichlet");
66 
68  auto const param_name = config.getConfigParameter<std::string>("parameter");
69  DBUG("Using parameter %s", param_name.c_str());
70 
71  auto& parameter = ParameterLib::findParameter<double>(
72  param_name, parameters, 1, &bc_mesh);
73 
74 // In case of partitioned mesh the boundary could be empty, i.e. there is no
75 // boundary condition.
76 #ifdef USE_PETSC
77  // This can be extracted to createBoundaryCondition() but then the config
78  // parameters are not read and will cause an error.
79  // TODO (naumov): Add a function to ConfigTree for skipping the tags of the
80  // subtree and move the code up in createBoundaryCondition().
81  if (bc_mesh.getDimension() == 0 && bc_mesh.getNumberOfNodes() == 0 &&
82  bc_mesh.getNumberOfElements() == 0)
83  {
84  return nullptr;
85  }
86 #endif // USE_PETSC
87 
88  return std::make_unique<DirichletBoundaryCondition>(
89  parameter, bc_mesh, dof_table_bulk, variable_id, component_id);
90 }

◆ createDirichletBoundaryConditionWithinTimeInterval()

std::unique_ptr< DirichletBoundaryConditionWithinTimeInterval > ProcessLib::createDirichletBoundaryConditionWithinTimeInterval ( BaseLib::ConfigTree const &  config,
MeshLib::Mesh const &  bc_mesh,
NumLib::LocalToGlobalIndexMap const &  dof_table_bulk,
int const  variable_id,
int const  component_id,
const std::vector< std::unique_ptr< ParameterLib::ParameterBase >> &  parameters 
)
Input File Parameter:
prj__process_variables__process_variable__boundary_conditions__boundary_condition__type
Input File Parameter:
prj__process_variables__process_variable__boundary_conditions__boundary_condition__DirichletWithinTimeInterval__parameter
Input File Parameter:
prj__process_variables__process_variable__boundary_conditions__boundary_condition__DirichletWithinTimeInterval__time_interval

Definition at line 96 of file DirichletBoundaryConditionWithinTimeInterval.cpp.

References BaseLib::ConfigTree::checkConfigParameter(), BaseLib::createTimeInterval(), BaseLib::ConfigTree::getConfigParameter(), MeshLib::Mesh::getDimension(), MeshLib::Mesh::getNumberOfElements(), MeshLib::Mesh::getNumberOfNodes(), and BaseLib::ConfigTree::peekConfigParameter().

Referenced by createBoundaryCondition().

101 {
102  DBUG(
103  "Constructing DirichletBoundaryConditionWithinTimeInterval from "
104  "config.");
105 
107  config.checkConfigParameter("type", "DirichletWithinTimeInterval");
108 
110  auto const param_name = config.getConfigParameter<std::string>("parameter");
111  DBUG("Using parameter %s", param_name.c_str());
112 
113  auto& param = ParameterLib::findParameter<double>(param_name, parameters, 1,
114  &bc_mesh);
115 
116 // In case of partitioned mesh the boundary could be empty, i.e. there is no
117 // boundary condition.
118 #ifdef USE_PETSC
119  // This can be extracted to createBoundaryCondition() but then the config
120  // parameters are not read and will cause an error.
121  // TODO (naumov): Add a function to ConfigTree for skipping the tags of the
122  // subtree and move the code up in createBoundaryCondition().
123  if (bc_mesh.getDimension() == 0 && bc_mesh.getNumberOfNodes() == 0 &&
124  bc_mesh.getNumberOfElements() == 0)
125  {
126  return nullptr;
127  }
128 #endif // USE_PETSC
129 
131  config.peekConfigParameter<std::string>("time_interval");
132 
133  return std::make_unique<DirichletBoundaryConditionWithinTimeInterval>(
134  BaseLib::createTimeInterval(config), param, bc_mesh, dof_table_bulk,
135  variable_id, component_id);
136 }
std::unique_ptr< TimeInterval > createTimeInterval(BaseLib::ConfigTree const &config)

◆ createHCNonAdvectiveFreeComponentFlowBoundaryCondition()

std::unique_ptr< HCNonAdvectiveFreeComponentFlowBoundaryCondition > ProcessLib::createHCNonAdvectiveFreeComponentFlowBoundaryCondition ( BaseLib::ConfigTree const &  config,
MeshLib::Mesh const &  bc_mesh,
NumLib::LocalToGlobalIndexMap const &  dof_table,
int const  variable_id,
int const  component_id,
unsigned const  integration_order,
std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const &  parameters,
unsigned const  global_dim,
Process const &  process,
unsigned const  shapefunction_order 
)
Input File Parameter:
prj__process_variables__process_variable__boundary_conditions__boundary_condition__type
Input File Parameter:
prj__process_variables__process_variable__boundary_conditions__boundary_condition__HCNonAdvectiveFreeComponentFlowBoundary__parameter

Definition at line 17 of file HCNonAdvectiveFreeComponentFlowBoundaryCondition.cpp.

References MeshLib::Cell, BaseLib::ConfigTree::checkConfigParameter(), BaseLib::ConfigTree::getConfigParameter(), MeshLib::Mesh::getDimension(), MeshLib::Mesh::getNumberOfElements(), MeshLib::Mesh::getNumberOfNodes(), MeshLib::Mesh::getProperties(), and OGS_FATAL.

Referenced by createBoundaryCondition().

24 {
25  DBUG(
26  "Constructing open boundary for Component Transport process from "
27  "config.");
29  config.checkConfigParameter("type",
30  "HCNonAdvectiveFreeComponentFlowBoundary");
31 
32  auto const boundary_permeability_name =
34  config.getConfigParameter<std::string>("parameter");
35  auto const& boundary_permeability = ParameterLib::findParameter<double>(
36  boundary_permeability_name, parameters, 1, &bc_mesh);
37 
38  if (global_dim != 3)
39  {
40  OGS_FATAL(
41  "HCNonAdvectiveFreeComponentFlowBoundary is only implemented for "
42  "2D boundary meshes");
43  }
44  auto const bulk_element_ids =
45  bc_mesh.getProperties().template getPropertyVector<std::size_t>(
46  "bulk_element_ids", MeshLib::MeshItemType::Cell, 1);
47  auto const bulk_face_ids =
48  bc_mesh.getProperties().template getPropertyVector<std::size_t>(
49  "bulk_face_ids", MeshLib::MeshItemType::Cell, 1);
50 
51  // In case of partitioned mesh the boundary could be empty, i.e. there is no
52  // boundary condition.
53 #ifdef USE_PETSC
54  // This can be extracted to createBoundaryCondition() but then the config
55  // parameters are not read and will cause an error.
56  // TODO (naumov): Add a function to ConfigTree for skipping the tags of the
57  // subtree and move the code up in createBoundaryCondition().
58  if (bc_mesh.getDimension() == 0 && bc_mesh.getNumberOfNodes() == 0 &&
59  bc_mesh.getNumberOfElements() == 0)
60  {
61  return nullptr;
62  }
63 #endif // USE_PETSC
64 
65  return std::make_unique<HCNonAdvectiveFreeComponentFlowBoundaryCondition>(
66  integration_order, shapefunction_order, dof_table, variable_id,
67  component_id, global_dim, bc_mesh,
68  HCNonAdvectiveFreeComponentFlowBoundaryConditionData{
69  boundary_permeability, *bulk_face_ids, *bulk_element_ids, process});
70 }
#define OGS_FATAL(fmt,...)
Definition: Error.h:63

◆ createJacobianAssembler()

std::unique_ptr< AbstractJacobianAssembler > ProcessLib::createJacobianAssembler ( boost::optional< BaseLib::ConfigTree > const &  config)
Input File Parameter:
prj__processes__process__jacobian_assembler__type

Definition at line 19 of file CreateJacobianAssembler.cpp.

References createCentralDifferencesJacobianAssembler(), createCompareJacobiansJacobianAssembler(), and OGS_FATAL.

Referenced by createCompareJacobiansJacobianAssembler(), and ProjectData::parseProcesses().

21 {
22  if (!config)
23  {
24  return std::make_unique<AnalyticalJacobianAssembler>();
25  }
26 
28  auto const type = config->peekConfigParameter<std::string>("type");
29 
30  if (type == "Analytical") {
31  config->ignoreConfigParameter("type");
32  return std::make_unique<AnalyticalJacobianAssembler>();
33  }
34  if (type == "CentralDifferences")
35  {
37  }
38  if (type == "CompareJacobians")
39  {
41  }
42 
43  OGS_FATAL("Unknown Jacobian assembler type: `%s'.", type.c_str());
44 }
std::unique_ptr< CompareJacobiansJacobianAssembler > createCompareJacobiansJacobianAssembler(BaseLib::ConfigTree const &config)
std::unique_ptr< CentralDifferencesJacobianAssembler > createCentralDifferencesJacobianAssembler(BaseLib::ConfigTree const &config)
#define OGS_FATAL(fmt,...)
Definition: Error.h:63

◆ createLocalAssemblers()

template<template< typename, typename, unsigned > class LocalAssemblerImplementation, typename LocalAssemblerInterface , typename... ExtraCtorArgs>
void ProcessLib::createLocalAssemblers ( const unsigned  dimension,
std::vector< MeshLib::Element *> const &  mesh_elements,
NumLib::LocalToGlobalIndexMap const &  dof_table,
const unsigned  shapefunction_order,
std::vector< std::unique_ptr< LocalAssemblerInterface >> &  local_assemblers,
ExtraCtorArgs &&...  extra_ctor_args 
)

Creates local assemblers for each element of the given mesh.

Template Parameters
LocalAssemblerImplementationthe individual local assembler type
LocalAssemblerInterfacethe general local assembler interface
ExtraCtorArgstypes of additional constructor arguments. Those arguments will be passed to the constructor of LocalAssemblerImplementation.

The first two template parameters cannot be deduced from the arguments. Therefore they always have to be provided manually.

Definition at line 69 of file CreateLocalAssemblers.h.

References OGS_FATAL.

Referenced by ProcessLib::ConstraintDirichletBoundaryCondition::ConstraintDirichletBoundaryCondition().

76 {
77  DBUG("Create local assemblers.");
78 
79  switch (dimension)
80  {
81  case 1:
82  detail::createLocalAssemblers<1, LocalAssemblerImplementation>(
83  dof_table, shapefunction_order, mesh_elements, local_assemblers,
84  std::forward<ExtraCtorArgs>(extra_ctor_args)...);
85  break;
86  case 2:
87  detail::createLocalAssemblers<2, LocalAssemblerImplementation>(
88  dof_table, shapefunction_order, mesh_elements, local_assemblers,
89  std::forward<ExtraCtorArgs>(extra_ctor_args)...);
90  break;
91  case 3:
92  detail::createLocalAssemblers<3, LocalAssemblerImplementation>(
93  dof_table, shapefunction_order, mesh_elements, local_assemblers,
94  std::forward<ExtraCtorArgs>(extra_ctor_args)...);
95  break;
96  default:
97  OGS_FATAL(
98  "Meshes with dimension greater than three are not supported.");
99  }
100 }
#define OGS_FATAL(fmt,...)
Definition: Error.h:63

◆ createNeumannBoundaryCondition()

std::unique_ptr< NeumannBoundaryCondition > ProcessLib::createNeumannBoundaryCondition ( BaseLib::ConfigTree const &  config,
MeshLib::Mesh const &  bc_mesh,
NumLib::LocalToGlobalIndexMap const &  dof_table,
int const  variable_id,
int const  component_id,
unsigned const  integration_order,
unsigned const  shapefunction_order,
unsigned const  global_dim,
std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const &  parameters 
)
Input File Parameter:
prj__process_variables__process_variable__boundary_conditions__boundary_condition__type
Input File Parameter:
prj__process_variables__process_variable__boundary_conditions__boundary_condition__Neumann__parameter

Definition at line 15 of file NeumannBoundaryCondition.cpp.

References BaseLib::ConfigTree::checkConfigParameter(), BaseLib::ConfigTree::getConfigParameter(), MeshLib::Mesh::getDimension(), MeshLib::Mesh::getNumberOfElements(), and MeshLib::Mesh::getNumberOfNodes().

Referenced by createBoundaryCondition().

21 {
22  DBUG("Constructing Neumann BC from config.");
24  config.checkConfigParameter("type", "Neumann");
25 
27  auto const param_name = config.getConfigParameter<std::string>("parameter");
28  DBUG("Using parameter %s", param_name.c_str());
29 
30  auto const& param = ParameterLib::findParameter<double>(
31  param_name, parameters, 1, &bc_mesh);
32 
33  // In case of partitioned mesh the boundary could be empty, i.e. there is no
34  // boundary condition.
35 #ifdef USE_PETSC
36  // This can be extracted to createBoundaryCondition() but then the config
37  // parameters are not read and will cause an error.
38  // TODO (naumov): Add a function to ConfigTree for skipping the tags of the
39  // subtree and move the code up in createBoundaryCondition().
40  if (bc_mesh.getDimension() == 0 && bc_mesh.getNumberOfNodes() == 0 &&
41  bc_mesh.getNumberOfElements() == 0)
42  {
43  return nullptr;
44  }
45 #endif // USE_PETSC
46 
47  return std::make_unique<NeumannBoundaryCondition>(
48  integration_order, shapefunction_order, dof_table, variable_id,
49  component_id, global_dim, bc_mesh, param);
50 }

◆ createNodalSourceTerm()

std::unique_ptr< SourceTerm > ProcessLib::createNodalSourceTerm ( BaseLib::ConfigTree const &  config,
MeshLib::Mesh const &  st_mesh,
std::unique_ptr< NumLib::LocalToGlobalIndexMap dof_table,
std::size_t const  source_term_mesh_id,
const int  variable_id,
const int  component_id,
std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const &  parameters 
)
Input File Parameter:
prj__process_variables__process_variable__source_terms__source_term__type
Input File Parameter:
prj__process_variables__process_variable__source_terms__source_term__Nodal__parameter

Definition at line 21 of file CreateNodalSourceTerm.cpp.

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

Referenced by createSourceTerm().

27 {
28  DBUG("Constructing NodalSourceTerm from config.");
30  config.checkConfigParameter("type", "Nodal");
31 
33  auto const param_name = config.getConfigParameter<std::string>("parameter");
34  DBUG("Using parameter %s as nodal source term.", param_name.c_str());
35 
36  auto& param = ParameterLib::findParameter<double>(param_name, parameters, 1,
37  &st_mesh);
38 
39  return std::make_unique<NodalSourceTerm>(std::move(dof_table),
40  source_term_mesh_id, st_mesh,
41  variable_id, component_id, param);
42 }

◆ createOutput()

std::unique_ptr< Output > ProcessLib::createOutput ( const BaseLib::ConfigTree config,
std::string const &  output_directory,
std::vector< std::unique_ptr< MeshLib::Mesh >> const &  meshes 
)
Input File Parameter:
prj__time_loop__output__type
Input File Parameter:
prj__time_loop__output__prefix
Input File Parameter:
prj__time_loop__output__compress_output
Input File Parameter:
prj__time_loop__output__data_mode
Input File Parameter:
prj__time_loop__output__timesteps
Input File Parameter:
prj__time_loop__output__timesteps__pair
Input File Parameter:
prj__time_loop__output__timesteps__pair__repeat
Input File Parameter:
prj__time_loop__output__timesteps__pair__each_steps
Input File Parameter:
prj__time_loop__output__variables
Input File Parameter:
prj__time_loop__output__variables__variable
Input File Parameter:
prj__time_loop__output__output_extrapolation_residuals
Input File Parameter:
prj__time_loop__output__meshes
Input File Parameter:
prj__time_loop__output__meshes__mesh
Input File Parameter:
prj__time_loop__output__fixed_output_times
Input File Parameter:
prj__time_loop__output__output_iteration_results

Definition at line 26 of file CreateOutput.cpp.

References BaseLib::ConfigTree::checkConfigParameter(), BaseLib::ConfigTree::getConfigParameter(), BaseLib::ConfigTree::getConfigParameterOptional(), BaseLib::ConfigTree::getConfigSubtree(), BaseLib::ConfigTree::getConfigSubtreeOptional(), BaseLib::makeVectorUnique(), and OGS_FATAL.

Referenced by createTimeLoop().

30 {
31  DBUG("Parse output configuration:");
32 
34  config.checkConfigParameter("type", "VTK");
35 
36  auto const prefix =
38  config.getConfigParameter<std::string>("prefix");
39 
40  auto const compress_output =
42  config.getConfigParameter("compress_output", true);
43 
44  auto const data_mode =
46  config.getConfigParameter<std::string>("data_mode", "Appended");
47 
48  // Construction of output times
49  std::vector<Output::PairRepeatEachSteps> repeats_each_steps;
50 
51  std::vector<double> fixed_output_times;
52 
54  if (auto const timesteps = config.getConfigSubtreeOptional("timesteps"))
55  {
57  for (auto pair : timesteps->getConfigSubtreeList("pair"))
58  {
60  auto repeat = pair.getConfigParameter<unsigned>("repeat");
62  auto each_steps = pair.getConfigParameter<unsigned>("each_steps");
63 
64  assert(repeat != 0 && each_steps != 0);
65  repeats_each_steps.emplace_back(repeat, each_steps);
66  }
67 
68  if (repeats_each_steps.empty())
69  {
70  OGS_FATAL(
71  "You have not given any pair (<repeat/>, <each_steps/>) that "
72  "defines"
73  " at which timesteps output shall be written. Aborting.");
74  }
75  }
76  else
77  {
78  repeats_each_steps.emplace_back(1, 1);
79  }
80 
82  auto const out_vars = config.getConfigSubtree("variables");
83 
84  std::set<std::string> output_variables;
85  for (auto out_var :
87  out_vars.getConfigParameterList<std::string>("variable"))
88  {
89  if (output_variables.find(out_var) != output_variables.cend())
90  {
91  OGS_FATAL("output variable `%s' specified more than once.",
92  out_var.c_str());
93  }
94 
95  DBUG("adding output variable `%s'", out_var.c_str());
96  output_variables.insert(out_var);
97  }
98 
100  bool const output_residuals = config.getConfigParameter<bool>(
101  "output_extrapolation_residuals", false);
102 
103  ProcessOutput process_output{output_variables, output_residuals};
104 
105  std::vector<std::string> mesh_names_for_output;
107  if (auto const meshes_config = config.getConfigSubtreeOptional("meshes"))
108  {
110  for (auto mesh_config : meshes_config->getConfigParameterList("mesh"))
111  {
112  mesh_names_for_output.push_back(
113  mesh_config.getValue<std::string>());
114  INFO("Configure mesh '%s' for output.",
115  mesh_names_for_output.back().c_str());
116  }
117  }
118 
119  auto fixed_output_times_ptr =
121  config.getConfigParameterOptional<std::vector<double>>(
122  "fixed_output_times");
123  if (fixed_output_times_ptr)
124  {
125  fixed_output_times = std::move(*fixed_output_times_ptr);
126  // Remove possible duplicated elements and sort in descending order.
127  BaseLib::makeVectorUnique(fixed_output_times, std::greater<>());
128  }
129 
130  bool const output_iteration_results =
132  config.getConfigParameter<bool>("output_iteration_results", false);
133 
134  return std::make_unique<Output>(
135  output_directory, prefix, compress_output, data_mode,
136  output_iteration_results, std::move(repeats_each_steps),
137  std::move(fixed_output_times), std::move(process_output),
138  std::move(mesh_names_for_output), meshes);
139 }
void makeVectorUnique(std::vector< T > &v)
Definition: Algorithm.h:195
T getConfigParameter(std::string const &param) const
void checkConfigParameter(std::string const &param, T const &value) const
ConfigTree getConfigSubtree(std::string const &root) const
Definition: ConfigTree.cpp:150
boost::optional< T > getConfigParameterOptional(std::string const &param) const
#define OGS_FATAL(fmt,...)
Definition: Error.h:63
boost::optional< ConfigTree > getConfigSubtreeOptional(std::string const &root) const
Definition: ConfigTree.cpp:160

◆ createPerProcessData()

std::vector< std::unique_ptr< ProcessData > > ProcessLib::createPerProcessData ( BaseLib::ConfigTree const &  config,
std::vector< std::unique_ptr< Process >> const &  processes,
std::map< std::string, std::unique_ptr< NumLib::NonlinearSolverBase >> const &  nonlinear_solvers 
)
Input File Parameter:
prj__time_loop__processes__process
Input File Parameter:
prj__time_loop__processes__process__ref
Input File Parameter:
prj__time_loop__processes__process__nonlinear_solver
Input File Parameter:
prj__time_loop__processes__process__time_discretization
Input File Parameter:
prj__time_loop__processes__process__time_stepping
Input File Parameter:
prj__time_loop__processes__process__convergence_criterion
Input File Parameter:
prj__time_loop__processes__process__output

Definition at line 48 of file CreateProcessData.cpp.

References NumLib::createConvergenceCriterion(), NumLib::createTimeDiscretization(), NumLib::createTimeStepper(), BaseLib::ConfigTree::getConfigSubtreeList(), BaseLib::getIfOrError(), BaseLib::getOrError(), makeProcessData(), and OGS_FATAL.

Referenced by createTimeLoop().

53 {
54  std::vector<std::unique_ptr<ProcessData>> per_process_data;
55 
57  for (auto pcs_config : config.getConfigSubtreeList("process"))
58  {
60  auto const pcs_name = pcs_config.getConfigAttribute<std::string>("ref");
61  auto& pcs = *BaseLib::getIfOrError(
62  processes,
63  [&pcs_name](std::unique_ptr<Process> const& p) {
64  return p->name == pcs_name;
65  },
66  "A process with the given name has not been defined.");
67 
68  auto const nl_slv_name =
70  pcs_config.getConfigParameter<std::string>("nonlinear_solver");
71  auto& nl_slv = *BaseLib::getOrError(
72  nonlinear_solvers, nl_slv_name,
73  "A nonlinear solver with the given name has not been defined.");
74 
75  auto time_disc = NumLib::createTimeDiscretization(
77  pcs_config.getConfigSubtree("time_discretization"));
78 
79  auto timestepper = NumLib::createTimeStepper(
81  pcs_config.getConfigSubtree("time_stepping"));
82 
83  auto conv_crit = NumLib::createConvergenceCriterion(
85  pcs_config.getConfigSubtree("convergence_criterion"));
86 
88  auto output = pcs_config.getConfigSubtreeOptional("output");
89  if (output)
90  {
91  OGS_FATAL(
92  "In order to make the specification of output in the project "
93  "file consistent, the variables output tags were moved from "
94  "xpath "
95  "'//OpenGeoSysProject/time_loop/processes/process/output' "
96  "to the global output section, i.e., to the xpath "
97  "'//OpenGeoSysProject/time_loop/output'. This has to be done "
98  "in the current project file!");
99  }
100 
101  per_process_data.emplace_back(makeProcessData(
102  std::move(timestepper), nl_slv, pcs, std::move(time_disc),
103  std::move(conv_crit)));
104  }
105 
106  if (per_process_data.size() != processes.size())
107  {
108  if (processes.size() > 1)
109  {
110  OGS_FATAL(
111  "Some processes have not been configured to be solved by this "
112  " time loop.");
113  }
114  else
115  {
116  INFO(
117  "The equations of the coupled processes will be solved by the "
118  "staggered scheme.");
119  }
120  }
121 
122  return per_process_data;
123 }
std::unique_ptr< TimeStepAlgorithm > createTimeStepper(BaseLib::ConfigTree const &config)
Map::mapped_type & getOrError(Map &map, Key const &key, std::string const &error_message)
Definition: Algorithm.h:147
Container::value_type const & getIfOrError(Container const &container, Predicate &&predicate, std::string const &error_message)
Definition: Algorithm.h:178
static const double p
#define OGS_FATAL(fmt,...)
Definition: Error.h:63
static std::unique_ptr< ProcessData > makeProcessData(std::unique_ptr< NumLib::TimeStepAlgorithm > &&timestepper, NumLib::NonlinearSolverBase &nonlinear_solver, Process &process, std::unique_ptr< NumLib::TimeDiscretization > &&time_disc, std::unique_ptr< NumLib::ConvergenceCriterion > &&conv_crit)
std::unique_ptr< ConvergenceCriterion > createConvergenceCriterion(const BaseLib::ConfigTree &config)
Creates a convergence criterion from the given configuration.
std::unique_ptr< TimeDiscretization > createTimeDiscretization(BaseLib::ConfigTree const &config)

◆ createPhaseFieldIrreversibleDamageOracleBoundaryCondition()

std::unique_ptr< PhaseFieldIrreversibleDamageOracleBoundaryCondition > ProcessLib::createPhaseFieldIrreversibleDamageOracleBoundaryCondition ( BaseLib::ConfigTree const &  config,
NumLib::LocalToGlobalIndexMap const &  dof_table,
MeshLib::Mesh const &  mesh,
int const  variable_id,
int const  component_id 
)
Input File Parameter:
prj__process_variables__process_variable__boundary_conditions__boundary_condition__type

Definition at line 67 of file PhaseFieldIrreversibleDamageOracleBoundaryCondition.cpp.

References BaseLib::ConfigTree::checkConfigParameter().

Referenced by createBoundaryCondition().

71 {
72  DBUG(
73  "Constructing PhaseFieldIrreversibleDamageOracleBoundaryCondition from "
74  "config.");
76  config.checkConfigParameter(
77  "type", "PhaseFieldIrreversibleDamageOracleBoundaryCondition");
78 
79  return std::make_unique<
80  PhaseFieldIrreversibleDamageOracleBoundaryCondition>(
81  dof_table, mesh, variable_id, component_id);
82 }

◆ createPythonBoundaryCondition()

std::unique_ptr< PythonBoundaryCondition > ProcessLib::createPythonBoundaryCondition ( BaseLib::ConfigTree const &  config,
MeshLib::Mesh const &  boundary_mesh,
NumLib::LocalToGlobalIndexMap const &  dof_table,
std::size_t  bulk_mesh_id,
int const  variable_id,
int const  component_id,
unsigned const  integration_order,
unsigned const  shapefunction_order,
unsigned const  global_dim 
)

Creates a new PythonBoundaryCondition object.

Input File Parameter:
prj__process_variables__process_variable__boundary_conditions__boundary_condition__type
Input File Parameter:
prj__process_variables__process_variable__boundary_conditions__boundary_condition__Python__bc_object
Input File Parameter:
prj__process_variables__process_variable__boundary_conditions__boundary_condition__Python__flush_stdout

Definition at line 192 of file PythonBoundaryCondition.cpp.

References BaseLib::ConfigTree::checkConfigParameter(), BaseLib::ConfigTree::getConfigParameter(), MeshLib::Mesh::getDimension(), NumLib::LocalToGlobalIndexMap::getGlobalComponent(), MeshLib::Mesh::getNumberOfElements(), MeshLib::Mesh::getNumberOfNodes(), NumLib::LocalToGlobalIndexMap::getNumberOfVariableComponents(), NumLib::LocalToGlobalIndexMap::getNumberOfVariables(), and OGS_FATAL.

Referenced by createBoundaryCondition().

198 {
200  config.checkConfigParameter("type", "Python");
201 
203  auto const bc_object = config.getConfigParameter<std::string>("bc_object");
205  auto const flush_stdout = config.getConfigParameter("flush_stdout", false);
206 
207  // Evaluate Python code in scope of main module
208  pybind11::object scope =
209  pybind11::module::import("__main__").attr("__dict__");
210 
211  if (!scope.contains(bc_object))
212  OGS_FATAL(
213  "Function `%s' is not defined in the python script file, or there "
214  "was no python script file specified.",
215  bc_object.c_str());
216 
217  auto* bc = scope[bc_object.c_str()]
218  .cast<PythonBoundaryConditionPythonSideInterface*>();
219 
220  if (variable_id >= static_cast<int>(dof_table.getNumberOfVariables()) ||
221  component_id >= dof_table.getNumberOfVariableComponents(variable_id))
222  {
223  OGS_FATAL(
224  "Variable id or component id too high. Actual values: (%d, %d), "
225  "maximum values: (%d, %d).",
226  variable_id, component_id, dof_table.getNumberOfVariables(),
227  dof_table.getNumberOfVariableComponents(variable_id));
228  }
229 
230  // In case of partitioned mesh the boundary could be empty, i.e. there is no
231  // boundary condition.
232 #ifdef USE_PETSC
233  // This can be extracted to createBoundaryCondition() but then the config
234  // parameters are not read and will cause an error.
235  // TODO (naumov): Add a function to ConfigTree for skipping the tags of the
236  // subtree and move the code up in createBoundaryCondition().
237  if (boundary_mesh.getDimension() == 0 &&
238  boundary_mesh.getNumberOfNodes() == 0 &&
239  boundary_mesh.getNumberOfElements() == 0)
240  {
241  return nullptr;
242  }
243 #endif // USE_PETSC
244 
245  return std::make_unique<PythonBoundaryCondition>(
246  PythonBoundaryConditionData{
247  bc, dof_table, bulk_mesh_id,
248  dof_table.getGlobalComponent(variable_id, component_id),
249  boundary_mesh},
250  integration_order, shapefunction_order, global_dim, flush_stdout);
251 }
#define OGS_FATAL(fmt,...)
Definition: Error.h:63

◆ createPythonSourceTerm()

std::unique_ptr< SourceTerm > ProcessLib::createPythonSourceTerm ( BaseLib::ConfigTree const &  config,
MeshLib::Mesh const &  source_term_mesh,
std::unique_ptr< NumLib::LocalToGlobalIndexMap dof_table,
std::size_t const  bulk_mesh_id,
int const  variable_id,
int const  component_id,
unsigned const  integration_order,
unsigned const  shapefunction_order,
unsigned const  global_dim 
)
Input File Parameter:
prj__process_variables__process_variable__source_terms__source_term__type
Input File Parameter:
prj__process_variables__process_variable__source_terms__source_term__Python__source_term_object
Input File Parameter:
prj__process_variables__process_variable__source_terms__source_term__Python__flush_stdout

Definition at line 22 of file CreatePythonSourceTerm.cpp.

References BaseLib::ConfigTree::checkConfigParameter(), BaseLib::ConfigTree::getConfigParameter(), MeshLib::Mesh::getDimension(), MeshLib::Mesh::getNumberOfElements(), MeshLib::Mesh::getNumberOfNodes(), and OGS_FATAL.

Referenced by createSourceTerm().

28 {
29  DBUG("Constructing PythonSourceTerm from config.");
31  config.checkConfigParameter("type", "Python");
32 
33  auto const source_term_object =
35  config.getConfigParameter<std::string>("source_term_object");
37  auto const flush_stdout = config.getConfigParameter("flush_stdout", false);
38 
39  // Evaluate Python code in scope of main module
40  pybind11::object scope =
41  pybind11::module::import("__main__").attr("__dict__");
42 
43  if (!scope.contains(source_term_object))
44  OGS_FATAL(
45  "Function `%s' is not defined in the python script file, or there "
46  "was no python script file specified.",
47  source_term_object.c_str());
48 
49  auto* source_term = scope[source_term_object.c_str()]
50  .cast<ProcessLib::SourceTerms::Python::
51  PythonSourceTermPythonSideInterface*>();
52 
53  // In case of partitioned mesh the source_term could be empty, i.e. there is
54  // no source_term condition.
55 #ifdef USE_PETSC
56  // This can be extracted to createSourceTerm() but then the config
57  // parameters are not read and will cause an error.
58  // TODO (naumov): Add a function to ConfigTree for skipping the tags of the
59  // subtree and move the code up in createSourceTerm().
60  if (source_term_mesh.getDimension() == 0 &&
61  source_term_mesh.getNumberOfNodes() == 0 &&
62  source_term_mesh.getNumberOfElements() == 0)
63  {
64  return nullptr;
65  }
66 #endif // USE_PETSC
67 
68  auto const global_component_id =
69  dof_table->getGlobalComponent(variable_id, component_id);
70  return std::make_unique<ProcessLib::SourceTerms::Python::PythonSourceTerm>(
71  std::move(dof_table),
73  source_term, bulk_mesh_id, global_component_id, source_term_mesh},
74  integration_order, shapefunction_order, global_dim, flush_stdout);
75 }
Groups data used by source terms, in particular by the local assemblers.
#define OGS_FATAL(fmt,...)
Definition: Error.h:63

◆ createRobinBoundaryCondition()

std::unique_ptr< RobinBoundaryCondition > ProcessLib::createRobinBoundaryCondition ( BaseLib::ConfigTree const &  config,
MeshLib::Mesh const &  bc_mesh,
NumLib::LocalToGlobalIndexMap const &  dof_table,
int const  variable_id,
int const  component_id,
unsigned const  integration_order,
unsigned const  shapefunction_order,
unsigned const  global_dim,
std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const &  parameters 
)

Creates a new uniform Robin boundary condition from the given data.

The Robin boundary condition is given in the form $ \alpha \cdot [ u_0 - u(x) ] $, where the coefficients $ \alpha $ and $ u_0 $ are obtained from the config, and $ u $ is the unknown to which the boundary condition is applied.

The value $ \alpha \cdot [ u_0 - u(x) ] $ is a flux. It replaces the integrand in the boundary integral for the variable $ u $.

Input File Parameter:
prj__process_variables__process_variable__boundary_conditions__boundary_condition__type
Input File Parameter:
prj__process_variables__process_variable__boundary_conditions__boundary_condition__Robin__alpha
Input File Parameter:
prj__process_variables__process_variable__boundary_conditions__boundary_condition__Robin__u_0

Definition at line 15 of file RobinBoundaryCondition.cpp.

References BaseLib::ConfigTree::checkConfigParameter(), BaseLib::ConfigTree::getConfigParameter(), MeshLib::Mesh::getDimension(), MeshLib::Mesh::getNumberOfElements(), and MeshLib::Mesh::getNumberOfNodes().

Referenced by createBoundaryCondition().

21 {
22  DBUG("Constructing RobinBcConfig from config.");
24  config.checkConfigParameter("type", "Robin");
25 
27  auto const alpha_name = config.getConfigParameter<std::string>("alpha");
29  auto const u_0_name = config.getConfigParameter<std::string>("u_0");
30 
31  auto const& alpha = ParameterLib::findParameter<double>(
32  alpha_name, parameters, 1, &bc_mesh);
33 
34  auto const& u_0 =
35  ParameterLib::findParameter<double>(u_0_name, parameters, 1, &bc_mesh);
36 
37  // In case of partitioned mesh the boundary could be empty, i.e. there is no
38  // boundary condition.
39 #ifdef USE_PETSC
40  // This can be extracted to createBoundaryCondition() but then the config
41  // parameters are not read and will cause an error.
42  // TODO (naumov): Add a function to ConfigTree for skipping the tags of the
43  // subtree and move the code up in createBoundaryCondition().
44  if (bc_mesh.getDimension() == 0 && bc_mesh.getNumberOfNodes() == 0 &&
45  bc_mesh.getNumberOfElements() == 0)
46  {
47  return nullptr;
48  }
49 #endif // USE_PETSC
50 
51  return std::make_unique<RobinBoundaryCondition>(
52  integration_order, shapefunction_order, dof_table, variable_id,
53  component_id, global_dim, bc_mesh,
54  RobinBoundaryConditionData{alpha, u_0});
55 }

◆ createSecondaryVariables()

void ProcessLib::createSecondaryVariables ( BaseLib::ConfigTree const &  config,
SecondaryVariableCollection secondary_variables,
NumLib::NamedFunctionCaller named_function_caller 
)
Input File Parameter:
prj__processes__process__secondary_variables
Input File Parameter:
prj__processes__process__secondary_variables__secondary_variable
Input File Parameter:
prj__processes__process__secondary_variables__secondary_variable__type
Input File Parameter:
prj__processes__process__secondary_variables__secondary_variable__internal_name
Input File Parameter:
prj__processes__process__secondary_variables__secondary_variable__output_name
Input File Parameter:
prj__processes__process__secondary_variables__secondary_variable__plug
Input File Parameter:
prj__processes__process__secondary_variables__secondary_variable__plug__sink_arg
Input File Parameter:
prj__processes__process__secondary_variables__secondary_variable__plug__source_fct

Definition at line 19 of file CreateSecondaryVariables.cpp.

References ProcessLib::SecondaryVariableCollection::addNameMapping(), BaseLib::ConfigTree::getConfigSubtreeOptional(), and NumLib::NamedFunctionCaller::plug().

Referenced by ProcessLib::ComponentTransport::createComponentTransportProcess(), ProcessLib::GroundwaterFlow::createGroundwaterFlowProcess(), ProcessLib::HeatConduction::createHeatConductionProcess(), ProcessLib::HeatTransportBHE::createHeatTransportBHEProcess(), ProcessLib::HT::createHTProcess(), ProcessLib::HydroMechanics::createHydroMechanicsProcess(), ProcessLib::LIE::HydroMechanics::createHydroMechanicsProcess(), ProcessLib::LiquidFlow::createLiquidFlowProcess(), ProcessLib::PhaseField::createPhaseFieldProcess(), ProcessLib::RichardsComponentTransport::createRichardsComponentTransportProcess(), ProcessLib::RichardsFlow::createRichardsFlowProcess(), ProcessLib::RichardsMechanics::createRichardsMechanicsProcess(), ProcessLib::SmallDeformationNonlocal::createSmallDeformationNonlocalProcess(), ProcessLib::SmallDeformation::createSmallDeformationProcess(), ProcessLib::LIE::SmallDeformation::createSmallDeformationProcess(), ProcessLib::TES::createTESProcess(), ProcessLib::ThermalTwoPhaseFlowWithPP::createThermalTwoPhaseFlowWithPPProcess(), ProcessLib::ThermoHydroMechanics::createThermoHydroMechanicsProcess(), ProcessLib::ThermoMechanicalPhaseField::createThermoMechanicalPhaseFieldProcess(), ProcessLib::ThermoMechanics::createThermoMechanicsProcess(), ProcessLib::TwoPhaseFlowWithPP::createTwoPhaseFlowWithPPProcess(), and ProcessLib::TwoPhaseFlowWithPrho::createTwoPhaseFlowWithPrhoProcess().

23 {
24  auto sec_vars_config =
26  config.getConfigSubtreeOptional("secondary_variables");
27  if (!sec_vars_config)
28  {
29  return;
30  }
31 
32  for (
33  auto sec_var_config :
35  sec_vars_config->getConfigSubtreeList("secondary_variable"))
36  {
37  auto const type =
39  sec_var_config.getConfigAttribute<std::string>("type");
40 
41  auto const internal_name =
43  sec_var_config.getConfigAttribute<std::string>("internal_name");
44  auto const output_name =
46  sec_var_config.getConfigAttribute<std::string>("output_name");
47 
48  secondary_variables.addNameMapping(internal_name, output_name);
49 
50  if (type == "static")
51  {
52  // alright
53  }
54  else if (type == "dynamic")
55  {
56  auto const& sink_fct = internal_name;
57 
58  for (
59  auto const plug :
61  sec_var_config.getConfigParameterList("plug"))
62  {
63  auto const sink_arg =
65  plug.getConfigAttribute<std::string>("sink_arg");
66  auto const source_fct =
68  plug.getConfigAttribute<std::string>("source_fct");
69 
70  named_function_caller.plug(sink_fct, sink_arg, source_fct);
71  }
72  }
73  }
74 }
void plug(std::string const &sink_fct, std::string const &sink_arg, std::string const &source_fct)

◆ createSourceTerm()

std::unique_ptr< SourceTerm > ProcessLib::createSourceTerm ( const SourceTermConfig config,
const NumLib::LocalToGlobalIndexMap dof_table_bulk,
const MeshLib::Mesh source_term_mesh,
const int  variable_id,
const unsigned  integration_order,
const unsigned  shapefunction_order,
std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const &  parameters 
)
Input File Parameter:
prj__process_variables__process_variable__source_terms__source_term__type

Definition at line 22 of file CreateSourceTerm.cpp.

References ProcessLib::SourceTermConfig::component_id, ProcessLib::SourceTermConfig::config, createNodalSourceTerm(), createPythonSourceTerm(), createVolumetricSourceTerm(), NumLib::LocalToGlobalIndexMap::deriveBoundaryConstrainedMap(), MeshLib::Mesh::getDimension(), MeshLib::Mesh::getID(), MeshLib::Mesh::getName(), MeshLib::Mesh::getNodes(), NumLib::LocalToGlobalIndexMap::getNumberOfVariableComponents(), NumLib::LocalToGlobalIndexMap::getNumberOfVariables(), MeshLib::Mesh::getProperties(), ProcessLib::SourceTermConfig::mesh, OGS_FATAL, and BaseLib::ConfigTree::peekConfigParameter().

Referenced by ProcessLib::ProcessVariable::createSourceTerms().

28 {
30  auto const type = config.config.peekConfigParameter<std::string>("type");
31 
32  // check basic data consistency
33  if (variable_id >=
34  static_cast<int>(dof_table_bulk.getNumberOfVariables()) ||
35  *config.component_id >=
36  dof_table_bulk.getNumberOfVariableComponents(variable_id))
37  {
38  OGS_FATAL(
39  "Variable id or component id too high. Actual values: (%d, "
40  "%d), maximum values: (%d, %d).",
41  variable_id, *config.component_id,
42  dof_table_bulk.getNumberOfVariables(),
43  dof_table_bulk.getNumberOfVariableComponents(variable_id));
44  }
45 
46  if (!source_term_mesh.getProperties()
47  .template existsPropertyVector<std::size_t>("bulk_node_ids"))
48  {
49  OGS_FATAL(
50  "The required bulk node ids map does not exist in the "
51  "source term mesh '%s'.",
52  source_term_mesh.getName().c_str());
53  }
54  std::vector<MeshLib::Node*> const& source_term_nodes =
55  source_term_mesh.getNodes();
56  DBUG(
57  "Found %d nodes for source term at mesh '%s' for the variable %d and "
58  "component %d",
59  source_term_nodes.size(), source_term_mesh.getName().c_str(),
60  variable_id, *config.component_id);
61 
62  MeshLib::MeshSubset source_term_mesh_subset(source_term_mesh,
63  source_term_nodes);
64 
65 
66  if (type == "Nodal")
67  {
68  std::unique_ptr<NumLib::LocalToGlobalIndexMap> dof_table_source_term(
69  dof_table_bulk.deriveBoundaryConstrainedMap(
70  variable_id, {*config.component_id},
71  std::move(source_term_mesh_subset)));
73  config.config, config.mesh, std::move(dof_table_source_term),
74  source_term_mesh.getID(), variable_id, *config.component_id,
75  parameters);
76  }
77 
78  if (type == "Volumetric")
79  {
80  std::unique_ptr<NumLib::LocalToGlobalIndexMap> dof_table_source_term(
81  dof_table_bulk.deriveBoundaryConstrainedMap(
82  variable_id, {*config.component_id},
83  std::move(source_term_mesh_subset)));
85  config.config, config.mesh, std::move(dof_table_source_term),
86  parameters, integration_order, shapefunction_order);
87  }
88 
89  if (type == "Python")
90  {
91 #ifdef OGS_USE_PYTHON
92  std::unique_ptr<NumLib::LocalToGlobalIndexMap> dof_table_source_term(
93  dof_table_bulk.deriveBoundaryConstrainedMap(
94  std::move(source_term_mesh_subset)));
95 
97  config.config, config.mesh, std::move(dof_table_source_term),
98  source_term_mesh.getID(), variable_id, *config.component_id,
99  integration_order, shapefunction_order,
100  source_term_mesh.getDimension());
101 #else
102  OGS_FATAL("OpenGeoSys has not been built with Python support.");
103 #endif
104  }
105 
106 
107  OGS_FATAL("Unknown source term type: `%s'.", type.c_str());
108 }
std::unique_ptr< SourceTerm > createVolumetricSourceTerm(BaseLib::ConfigTree const &config, MeshLib::Mesh const &source_term_mesh, std::unique_ptr< NumLib::LocalToGlobalIndexMap > source_term_dof_table, std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const &parameters, unsigned const integration_order, unsigned const shapefunction_order)
std::size_t getID() const
Get id of the mesh.
Definition: Mesh.h:123
int getNumberOfVariableComponents(int variable_id) const
std::vector< Node * > const & getNodes() const
Get the nodes-vector for the mesh.
Definition: Mesh.h:105
MeshLib::Properties & getProperties()
Definition: Mesh.h:134
std::unique_ptr< SourceTerm > createPythonSourceTerm(BaseLib::ConfigTree const &config, MeshLib::Mesh const &source_term_mesh, std::unique_ptr< NumLib::LocalToGlobalIndexMap > dof_table, std::size_t const bulk_mesh_id, int const variable_id, int const component_id, unsigned const integration_order, unsigned const shapefunction_order, unsigned const global_dim)
const std::string getName() const
Get name of the mesh.
Definition: Mesh.h:102
LocalToGlobalIndexMap * deriveBoundaryConstrainedMap(int const variable_id, std::vector< int > const &component_ids, MeshLib::MeshSubset &&new_mesh_subset) const
unsigned getDimension() const
Returns the dimension of the mesh (determined by the maximum dimension over all elements).
Definition: Mesh.h:81
std::unique_ptr< SourceTerm > createNodalSourceTerm(BaseLib::ConfigTree const &config, MeshLib::Mesh const &st_mesh, std::unique_ptr< NumLib::LocalToGlobalIndexMap > dof_table, std::size_t const source_term_mesh_id, const int variable_id, const int component_id, std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const &parameters)
#define OGS_FATAL(fmt,...)
Definition: Error.h:63
A subset of nodes on a single mesh.
Definition: MeshSubset.h:26

◆ createTimeLoop()

std::unique_ptr< TimeLoop > ProcessLib::createTimeLoop ( BaseLib::ConfigTree const &  config,
std::string const &  output_directory,
const std::vector< std::unique_ptr< Process >> &  processes,
const std::map< std::string, std::unique_ptr< NumLib::NonlinearSolverBase >> &  nonlinear_solvers,
std::vector< std::unique_ptr< MeshLib::Mesh >> const &  meshes,
std::unique_ptr< ChemistryLib::PhreeqcIO > &  phreeqc_io 
)

Builds a TimeLoop from the given configuration.

Input File Parameter:
prj__time_loop__global_process_coupling
Input File Parameter:
prj__time_loop__global_process_coupling__max_iter
Input File Parameter:
prj__time_loop__global_process_coupling__convergence_criteria
Input File Parameter:
prj__time_loop__global_process_coupling__convergence_criteria__convergence_criterion
Input File Parameter:
prj__time_loop__output
Input File Parameter:
prj__time_loop__processes

Definition at line 23 of file CreateTimeLoop.cpp.

References NumLib::createConvergenceCriterion(), createOutput(), createPerProcessData(), BaseLib::ConfigTree::getConfigSubtree(), BaseLib::ConfigTree::getConfigSubtreeOptional(), and OGS_FATAL.

Referenced by ProjectData::parseTimeLoop().

30 {
31  auto const& coupling_config
33  = config.getConfigSubtreeOptional("global_process_coupling");
34 
35  std::vector<std::unique_ptr<NumLib::ConvergenceCriterion>>
36  global_coupling_conv_criteria;
37  int max_coupling_iterations = 1;
38  if (coupling_config)
39  {
40  max_coupling_iterations
42  = coupling_config->getConfigParameter<int>("max_iter");
43 
44  auto const& coupling_convergence_criteria_config =
46  coupling_config->getConfigSubtree("convergence_criteria");
47 
48  for (
49  auto coupling_convergence_criterion_config :
51  coupling_convergence_criteria_config.getConfigSubtreeList(
52  "convergence_criterion"))
53  {
54  global_coupling_conv_criteria.push_back(
56  coupling_convergence_criterion_config));
57  }
58  }
59 
60  auto output =
62  createOutput(config.getConfigSubtree("output"), output_directory,
63  meshes);
64 
65  auto per_process_data = createPerProcessData(
67  config.getConfigSubtree("processes"), processes, nonlinear_solvers);
68 
69  if (coupling_config)
70  {
71  if (global_coupling_conv_criteria.size() != per_process_data.size())
72  {
73  OGS_FATAL(
74  "The number of convergence criteria of the global staggered "
75  "coupling loop is not identical to the number of the "
76  "processes! Please check the element by tag "
77  "global_process_coupling in the project file.");
78  }
79  }
80 
81  const auto minmax_iter = std::minmax_element(
82  per_process_data.begin(),
83  per_process_data.end(),
84  [](std::unique_ptr<ProcessData> const& a,
85  std::unique_ptr<ProcessData> const& b) {
86  return (a->timestepper->end() < b->timestepper->end());
87  });
88  const double start_time =
89  per_process_data[minmax_iter.first - per_process_data.begin()]
90  ->timestepper->begin();
91  const double end_time =
92  per_process_data[minmax_iter.second - per_process_data.begin()]
93  ->timestepper->end();
94 
95  return std::make_unique<TimeLoop>(
96  std::move(output), std::move(per_process_data), max_coupling_iterations,
97  std::move(global_coupling_conv_criteria), std::move(phreeqc_io),
98  start_time, end_time);
99 }
std::unique_ptr< Output > createOutput(std::vector< Component > const &components, std::vector< EquilibriumPhase > const &equilibrium_phases, std::vector< KineticReactant > const &kinetic_reactants, std::string const &project_file_name)
#define OGS_FATAL(fmt,...)
Definition: Error.h:63
std::vector< std::unique_ptr< ProcessData > > createPerProcessData(BaseLib::ConfigTree const &config, std::vector< std::unique_ptr< Process >> const &processes, std::map< std::string, std::unique_ptr< NumLib::NonlinearSolverBase >> const &nonlinear_solvers)
std::unique_ptr< ConvergenceCriterion > createConvergenceCriterion(const BaseLib::ConfigTree &config)
Creates a convergence criterion from the given configuration.

◆ createVariableDependentNeumannBoundaryCondition()

std::unique_ptr< VariableDependentNeumannBoundaryCondition > ProcessLib::createVariableDependentNeumannBoundaryCondition ( BaseLib::ConfigTree const &  config,
MeshLib::Mesh const &  bc_mesh,
NumLib::LocalToGlobalIndexMap const &  dof_table,
int const  variable_id,
int const  component_id,
unsigned const  integration_order,
unsigned const  shapefunction_order,
unsigned const  global_dim,
std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const &  parameters 
)
Input File Parameter:
prj__process_variables__process_variable__boundary_conditions__boundary_condition__type
Input File Parameter:
prj__process_variables__process_variable__boundary_conditions__boundary_condition__VariableDependentNeumann__constant_name
Input File Parameter:
prj__process_variables__process_variable__boundary_conditions__boundary_condition__VariableDependentNeumann__coefficient_current_variable_name
Input File Parameter:
prj__process_variables__process_variable__boundary_conditions__boundary_condition__VariableDependentNeumann__coefficient_other_variable_name
Input File Parameter:
prj__process_variables__process_variable__boundary_conditions__boundary_condition__VariableDependentNeumann__coefficient_mixed_variables_name

Definition at line 17 of file VariableDependentNeumannBoundaryCondition.cpp.

References BaseLib::ConfigTree::checkConfigParameter(), NumLib::LocalToGlobalIndexMap::deriveBoundaryConstrainedMap(), BaseLib::ConfigTree::getConfigParameter(), MeshLib::Mesh::getDimension(), MeshLib::Mesh::getNodes(), MeshLib::Mesh::getNumberOfElements(), MeshLib::Mesh::getNumberOfNodes(), NumLib::LocalToGlobalIndexMap::getNumberOfVariables(), and OGS_FATAL.

Referenced by createBoundaryCondition().

23 {
24  DBUG("Constructing VariableDependentNeumann BC from config.");
26  config.checkConfigParameter("type", "VariableDependentNeumann");
27  if (dof_table.getNumberOfVariables() != 2)
28  {
29  OGS_FATAL(
30  "VariableDependentNeumann BC only implemented for 2 "
31  "variable processes.");
32  }
33  assert(variable_id == 0 || variable_id == 1);
34 
35  auto const constant_name =
37  config.getConfigParameter<std::string>("constant_name");
38  auto const& constant = ParameterLib::findParameter<double>(
39  constant_name, parameters, 1, &bc_mesh);
40 
41  auto const coefficient_current_variable_name =
43  config.getConfigParameter<std::string>(
44  "coefficient_current_variable_name");
45  auto const& coefficient_current_variable =
46  ParameterLib::findParameter<double>(coefficient_current_variable_name,
47  parameters, 1, &bc_mesh);
48 
49  auto const coefficient_other_variable_name =
51  config.getConfigParameter<std::string>(
52  "coefficient_other_variable_name");
53  auto const& coefficient_other_variable =
54  ParameterLib::findParameter<double>(coefficient_other_variable_name,
55  parameters, 1, &bc_mesh);
56 
57  auto const coefficient_mixed_variables_name =
59  config.getConfigParameter<std::string>(
60  "coefficient_mixed_variables_name");
61  auto const& coefficient_mixed_variables =
62  ParameterLib::findParameter<double>(coefficient_mixed_variables_name,
63  parameters, 1, &bc_mesh);
64 
65  std::vector<MeshLib::Node*> const& bc_nodes = bc_mesh.getNodes();
66  MeshLib::MeshSubset bc_mesh_subset(bc_mesh, bc_nodes);
67  auto const& dof_table_boundary_other_variable =
68  *dof_table.deriveBoundaryConstrainedMap(
69  (variable_id + 1) % 2, {component_id}, std::move(bc_mesh_subset));
70 
71  // In case of partitioned mesh the boundary could be empty, i.e. there is no
72  // boundary condition.
73 #ifdef USE_PETSC
74  // This can be extracted to createBoundaryCondition() but then the config
75  // parameters are not read and will cause an error.
76  // TODO (naumov): Add a function to ConfigTree for skipping the tags of the
77  // subtree and move the code up in createBoundaryCondition().
78  if (bc_mesh.getDimension() == 0 && bc_mesh.getNumberOfNodes() == 0 &&
79  bc_mesh.getNumberOfElements() == 0)
80  {
81  return nullptr;
82  }
83 #endif // USE_PETSC
84 
85  return std::make_unique<VariableDependentNeumannBoundaryCondition>(
86  integration_order, shapefunction_order, dof_table, variable_id,
87  component_id, global_dim, bc_mesh,
88  VariableDependentNeumannBoundaryConditionData{
89  constant, coefficient_current_variable, coefficient_other_variable,
90  coefficient_mixed_variables, dof_table_boundary_other_variable});
91 }
#define OGS_FATAL(fmt,...)
Definition: Error.h:63
A subset of nodes on a single mesh.
Definition: MeshSubset.h:26

◆ createVolumetricSourceTerm()

std::unique_ptr< SourceTerm > ProcessLib::createVolumetricSourceTerm ( BaseLib::ConfigTree const &  config,
MeshLib::Mesh const &  source_term_mesh,
std::unique_ptr< NumLib::LocalToGlobalIndexMap source_term_dof_table,
std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const &  parameters,
unsigned const  integration_order,
unsigned const  shapefunction_order 
)
Input File Parameter:
prj__process_variables__process_variable__source_terms__source_term__type
Input File Parameter:
prj__process_variables__process_variable__source_terms__source_term__Volumetric__parameter

Definition at line 21 of file CreateVolumetricSourceTerm.cpp.

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

Referenced by createSourceTerm().

26 {
28  config.checkConfigParameter("type", "Volumetric");
29 
30  DBUG("Constructing VolumetricSourceTerm from config.");
31 
32  // source term field name
33  auto const& volumetric_source_term_parameter_name =
35  config.getConfigParameter<std::string>("parameter");
36  auto& volumetric_source_term = ParameterLib::findParameter<double>(
37  volumetric_source_term_parameter_name, parameters, 1,
38  &source_term_mesh);
39 
40  DBUG("Using '%s' as volumetric source term parameter.",
41  volumetric_source_term.name.c_str());
42 
43  return std::make_unique<VolumetricSourceTerm>(
44  source_term_mesh, std::move(source_term_dof_table), integration_order,
45  shapefunction_order, volumetric_source_term);
46 }

◆ findProcessVariable()

ProcessVariable& ProcessLib::findProcessVariable ( std::vector< ProcessVariable > const &  variables,
BaseLib::ConfigTree const &  pv_config,
std::string const &  tag 
)
Input File Parameter:
special OGS input file parameter

Definition at line 45 of file ProcessUtils.cpp.

References anonymous_namespace{ProcessUtils.cpp}::findVariableByName(), BaseLib::ConfigTree::getConfigParameter(), and MaterialPropertyLib::name.

48 {
49  // Find process variable name in process config.
51  std::string const name = pv_config.getConfigParameter<std::string>(tag);
52  return findVariableByName(variables, name, tag);
53 }
ProcessLib::ProcessVariable & findVariableByName(std::vector< ProcessLib::ProcessVariable > const &variables, std::string const &name, std::string const &tag)

◆ findProcessVariables() [1/2]

std::vector< std::reference_wrapper< ProcessVariable > > ProcessLib::findProcessVariables ( std::vector< ProcessVariable > const &  variables,
BaseLib::ConfigTree const &  process_config,
std::initializer_list< std::string >  tags 
)

Find process variables in variables whose names match the settings under the given tag_names in the process_config.

In the process config a process variable is referenced by a name. For example it will be looking for a variable named "H" in the list of process variables when the tag is "hydraulic_head":

<process>
...
<process_variables>
<hydraulic_head>H</hydraulic_head>
...
</process_variables>
...
</process>
Returns
a vector of references to the found variable(s).

Definition at line 55 of file ProcessUtils.cpp.

Referenced by ProcessLib::ComponentTransport::createComponentTransportProcess(), ProcessLib::GroundwaterFlow::createGroundwaterFlowProcess(), ProcessLib::HeatConduction::createHeatConductionProcess(), ProcessLib::HT::createHTProcess(), ProcessLib::HydroMechanics::createHydroMechanicsProcess(), ProcessLib::LiquidFlow::createLiquidFlowProcess(), ProcessLib::PhaseField::createPhaseFieldProcess(), ProcessLib::RichardsComponentTransport::createRichardsComponentTransportProcess(), ProcessLib::RichardsFlow::createRichardsFlowProcess(), ProcessLib::RichardsMechanics::createRichardsMechanicsProcess(), ProcessLib::SmallDeformationNonlocal::createSmallDeformationNonlocalProcess(), ProcessLib::SmallDeformation::createSmallDeformationProcess(), ProcessLib::TES::createTESProcess(), ProcessLib::ThermalTwoPhaseFlowWithPP::createThermalTwoPhaseFlowWithPPProcess(), ProcessLib::ThermoHydroMechanics::createThermoHydroMechanicsProcess(), ProcessLib::ThermoMechanicalPhaseField::createThermoMechanicalPhaseFieldProcess(), ProcessLib::ThermoMechanics::createThermoMechanicsProcess(), ProcessLib::TwoPhaseFlowWithPP::createTwoPhaseFlowWithPPProcess(), and ProcessLib::TwoPhaseFlowWithPrho::createTwoPhaseFlowWithPrhoProcess().

60 {
61  std::vector<std::reference_wrapper<ProcessVariable>> vars;
62  vars.reserve(variables.size());
63 
64  if (variables.size() > tags.size())
65  DBUG("Found multiple process variables with a same tag.");
66 
67  for (auto& tag : tags)
68  {
69  auto vars_per_tag = findProcessVariables(variables, pv_config, tag);
70  vars.insert(vars.end(), vars_per_tag.begin(), vars_per_tag.end());
71  }
72 
73  return vars;
74 }
std::vector< std::reference_wrapper< ProcessVariable > > findProcessVariables(std::vector< ProcessVariable > const &variables, BaseLib::ConfigTree const &pv_config, std::string const &tag)

◆ findProcessVariables() [2/2]

std::vector< std::reference_wrapper< ProcessVariable > > ProcessLib::findProcessVariables ( std::vector< ProcessVariable > const &  variables,
BaseLib::ConfigTree const &  pv_config,
std::string const &  tag 
)
Input File Parameter:
special OGS input file parameter

Definition at line 76 of file ProcessUtils.cpp.

References anonymous_namespace{ProcessUtils.cpp}::findVariableByName(), BaseLib::ConfigTree::getConfigParameterList(), BaseLib::makeVectorUnique(), and OGS_FATAL.

80 {
81  std::vector<std::reference_wrapper<ProcessVariable>> vars;
82 
84  auto var_names = pv_config.getConfigParameterList<std::string>(tag);
85 
86  if (var_names.empty())
87  {
88  OGS_FATAL("No entity is found with config tag <%s>.", tag.c_str());
89  }
90 
91  std::vector<std::string> cached_var_names;
92 
93  for (std::string const& var_name : var_names)
94  {
95  vars.emplace_back(findVariableByName(variables, var_name, tag));
96  cached_var_names.push_back(var_name);
97  }
98 
99  // Eliminate duplicates in the set of variable names
100  BaseLib::makeVectorUnique(cached_var_names);
101 
102  if (cached_var_names.size() != var_names.size())
103  {
104  OGS_FATAL("Found duplicates with config tag <%s>.", tag.c_str());
105  }
106 
107  return vars;
108 }
void makeVectorUnique(std::vector< T > &v)
Definition: Algorithm.h:195
ProcessLib::ProcessVariable & findVariableByName(std::vector< ProcessLib::ProcessVariable > const &variables, std::string const &name, std::string const &tag)
#define OGS_FATAL(fmt,...)
Definition: Error.h:63

◆ getCurrentLocalSolutions()

std::vector< std::vector< double > > ProcessLib::getCurrentLocalSolutions ( const CoupledSolutionsForStaggeredScheme cpl_xs,
const std::vector< std::vector< GlobalIndexType >> &  indices 
)

Fetch the nodal solutions of all coupled processes of the current time step of an element.

Parameters
cpl_xsSolutions of all coupled equations.
indicesNodal indices of an element.
Returns
Nodal solutions of the current time step of an element

Definition at line 53 of file CoupledSolutionsForStaggeredScheme.cpp.

References ProcessLib::CoupledSolutionsForStaggeredScheme::coupled_xs.

Referenced by ProcessLib::VectorMatrixAssembler::assemble(), ProcessLib::VectorMatrixAssembler::assembleWithJacobian(), ProcessLib::PhaseField::PhaseFieldLocalAssembler< ShapeFunction, IntegrationMethod, DisplacementDim >::computeCrackIntegral(), ProcessLib::PhaseField::PhaseFieldLocalAssembler< ShapeFunction, IntegrationMethod, DisplacementDim >::computeEnergy(), ProcessLib::ComponentTransport::ComponentTransportProcess::getFlux(), ProcessLib::HT::StaggeredHTFEM< ShapeFunction, IntegrationMethod, GlobalDim >::getIntPtDarcyVelocity(), and ProcessLib::ComponentTransport::LocalAssemblerData< ShapeFunction, IntegrationMethod, GlobalDim >::getIntPtDarcyVelocity().

56 {
57  if (cpl_xs.coupled_xs.empty())
58  {
59  return {};
60  }
61 
62  const auto number_of_coupled_solutions = cpl_xs.coupled_xs.size();
63  std::vector<std::vector<double>> local_xs_t1;
64  local_xs_t1.reserve(number_of_coupled_solutions);
65 
66  int coupling_id = 0;
67  for (auto const& x_t1 : cpl_xs.coupled_xs)
68  {
69  local_xs_t1.emplace_back(x_t1.get().get(indices[coupling_id]));
70  coupling_id++;
71  }
72  return local_xs_t1;
73 }

◆ getEssentialBCValuesLocal()

void ProcessLib::getEssentialBCValuesLocal ( ParameterLib::Parameter< double > const &  parameter,
MeshLib::Mesh const &  bc_mesh,
std::vector< MeshLib::Node *> const &  nodes_in_bc_mesh,
NumLib::LocalToGlobalIndexMap const &  dof_table_boundary,
int const  variable_id,
int const  component_id,
const double  t,
GlobalVector const &  ,
NumLib::IndexValueVector< GlobalIndexType > &  bc_values 
)

Definition at line 58 of file DirichletBoundaryConditionAuxiliaryFunctions.cpp.

References NumLib::LocalToGlobalIndexMap::getGlobalIndex(), MeshLib::Mesh::getID(), NumLib::IndexValueVector< IndexType >::ids, MeshLib::Node, NumLib::MeshComponentMap::nop, ParameterLib::SpatialPosition::setNodeID(), and NumLib::IndexValueVector< IndexType >::values.

Referenced by ProcessLib::DirichletBoundaryCondition::getEssentialBCValues(), and ProcessLib::DirichletBoundaryConditionWithinTimeInterval::getEssentialBCValues().

66 {
68 
69  bc_values.ids.clear();
70  bc_values.values.clear();
71 
72  // convert mesh node ids to global index for the given component
73  bc_values.ids.reserve(bc_values.ids.size() + nodes_in_bc_mesh.size());
74  bc_values.values.reserve(bc_values.values.size() + nodes_in_bc_mesh.size());
75  for (auto const* const node : nodes_in_bc_mesh)
76  {
77  auto const id = node->getID();
78  pos.setNodeID(node->getID());
79  // TODO: that might be slow, but only done once
80  auto const global_index = dof_table_boundary.getGlobalIndex(
81  {bc_mesh.getID(), MeshLib::MeshItemType::Node, id}, variable_id,
82  component_id);
83  if (global_index == NumLib::MeshComponentMap::nop)
84  {
85  continue;
86  }
87  // For the DDC approach (e.g. with PETSc option), the negative
88  // index of global_index means that the entry by that index is a ghost
89  // one, which should be dropped. Especially for PETSc routines
90  // MatZeroRows and MatZeroRowsColumns, which are called to apply the
91  // Dirichlet BC, the negative index is not accepted like other matrix or
92  // vector PETSc routines. Therefore, the following if-condition is
93  // applied.
94  if (global_index >= 0)
95  {
96  bc_values.ids.emplace_back(global_index);
97  bc_values.values.emplace_back(parameter(t, pos).front());
98  }
99  }
100 }
void setNodeID(std::size_t node_id)
std::vector< IndexType > ids
std::vector< double > values
static NUMLIB_EXPORT GlobalIndexType const nop

◆ getIntegrationPointMetaData()

IntegrationPointMetaData ProcessLib::getIntegrationPointMetaData ( MeshLib::Mesh const &  mesh,
std::string const &  name 
)

Returns integration point meta data for the given field name.

The data is read from a JSON encoded string stored in field data array.

Definition at line 107 of file IntegrationPointWriter.cpp.

References MeshLib::Properties::existsPropertyVector(), extractIntegrationPointMetaData(), MeshLib::Mesh::getProperties(), MeshLib::IntegrationPoint, and OGS_FATAL.

Referenced by ProcessLib::SmallDeformationNonlocal::SmallDeformationNonlocalProcess< DisplacementDim >::initializeConcreteProcess(), ProcessLib::SmallDeformation::SmallDeformationProcess< DisplacementDim >::initializeConcreteProcess(), and ProcessLib::ThermoMechanics::ThermoMechanicsProcess< DisplacementDim >::initializeConcreteProcess().

109 {
110  if (!mesh.getProperties().existsPropertyVector<char>(
111  "IntegrationPointMetaData"))
112  {
113  OGS_FATAL(
114  "Integration point data '%s' is present in the vtk field "
115  "data but the required 'IntegrationPointMetaData' array "
116  "is not available.",
117  name.c_str());
118  }
119  auto const& mesh_property_ip_meta_data =
120  *mesh.getProperties().template getPropertyVector<char>(
121  "IntegrationPointMetaData");
122 
123  if (mesh_property_ip_meta_data.getMeshItemType() !=
125  {
126  OGS_FATAL("IntegrationPointMetaData array must be field data.");
127  }
128 
129  // Find the current integration point data entry and extract the
130  // meta data.
131  auto const ip_meta_data = extractIntegrationPointMetaData(
132  json::parse(mesh_property_ip_meta_data.begin(),
133  mesh_property_ip_meta_data.end()),
134  name);
135 
136  return ip_meta_data;
137 }
static ProcessLib::IntegrationPointMetaData extractIntegrationPointMetaData(json const &meta_data, std::string const &name)
#define OGS_FATAL(fmt,...)
Definition: Error.h:63

◆ getPreviousLocalSolutions()

std::vector< std::vector< double > > ProcessLib::getPreviousLocalSolutions ( const CoupledSolutionsForStaggeredScheme cpl_xs,
const std::vector< std::vector< GlobalIndexType >> &  indices 
)

Fetch the nodal solutions of all coupled processes of the previous time step of an element.

Parameters
cpl_xsSolutions of all coupled equations.
indicesNodal indices of an element.
Returns
Nodal solutions of the previous time step of an element

Definition at line 31 of file CoupledSolutionsForStaggeredScheme.cpp.

References ProcessLib::CoupledSolutionsForStaggeredScheme::coupled_xs, and ProcessLib::CoupledSolutionsForStaggeredScheme::coupled_xs_t0.

Referenced by ProcessLib::VectorMatrixAssembler::assemble(), and ProcessLib::VectorMatrixAssembler::assembleWithJacobian().

34 {
35  if (cpl_xs.coupled_xs_t0.empty())
36  {
37  return {};
38  }
39 
40  const auto number_of_coupled_solutions = cpl_xs.coupled_xs.size();
41  std::vector<std::vector<double>> local_xs_t0;
42  local_xs_t0.reserve(number_of_coupled_solutions);
43 
44  int coupling_id = 0;
45  for (auto const& x_t0 : cpl_xs.coupled_xs_t0)
46  {
47  local_xs_t0.emplace_back(x_t0->get(indices[coupling_id]));
48  coupling_id++;
49  }
50  return local_xs_t0;
51 }

◆ initShapeMatrices()

template<typename ShapeFunction , typename ShapeMatricesType , typename IntegrationMethod , unsigned GlobalDim>
std::vector<typename ShapeMatricesType::ShapeMatrices, Eigen::aligned_allocator<typename ShapeMatricesType::ShapeMatrices> > ProcessLib::initShapeMatrices ( MeshLib::Element const &  e,
bool  is_axially_symmetric,
IntegrationMethod const &  integration_method 
)

Definition at line 23 of file InitShapeMatrices.h.

References NumLib::createIsoparametricFiniteElement().

Referenced by ProcessLib::HeatTransportBHE::HeatTransportBHELocalAssemblerBHE< ShapeFunction, IntegrationMethod, BHEType >::HeatTransportBHELocalAssemblerBHE(), ProcessLib::HeatTransportBHE::HeatTransportBHELocalAssemblerSoil< ShapeFunction, IntegrationMethod >::HeatTransportBHELocalAssemblerSoil(), ProcessLib::HT::HTFEM< ShapeFunction, IntegrationMethod, GlobalDim >::HTFEM(), ProcessLib::HydroMechanics::HydroMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod, DisplacementDim >::HydroMechanicsLocalAssembler(), ProcessLib::LIE::HydroMechanics::HydroMechanicsLocalAssemblerFracture< ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod, GlobalDim >::HydroMechanicsLocalAssemblerFracture(), ProcessLib::LIE::HydroMechanics::HydroMechanicsLocalAssemblerMatrix< ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod, GlobalDim >::HydroMechanicsLocalAssemblerMatrix(), ProcessLib::GenericNaturalBoundaryConditionLocalAssembler< ShapeFunction, IntegrationMethod, GlobalDim >::initNsAndWeights(), ProcessLib::LiquidFlow::LiquidFlowLocalAssembler< ShapeFunction, IntegrationMethod, GlobalDim >::LiquidFlowLocalAssembler(), ProcessLib::RichardsFlow::LocalAssemblerData< ShapeFunction, IntegrationMethod, GlobalDim >::LocalAssemblerData(), ProcessLib::RichardsComponentTransport::LocalAssemblerData< ShapeFunction, IntegrationMethod, GlobalDim >::LocalAssemblerData(), ProcessLib::ComponentTransport::LocalAssemblerData< ShapeFunction, IntegrationMethod, GlobalDim >::LocalAssemblerData(), ProcessLib::NormalTractionBoundaryCondition::NormalTractionBoundaryConditionLocalAssembler< ShapeFunctionDisplacement, IntegrationMethod, GlobalDim >::NormalTractionBoundaryConditionLocalAssembler(), ProcessLib::PhaseField::PhaseFieldLocalAssembler< ShapeFunction, IntegrationMethod, DisplacementDim >::PhaseFieldLocalAssembler(), ProcessLib::SourceTerms::Python::PythonSourceTermLocalAssembler< ShapeFunction, IntegrationMethod, GlobalDim >::PythonSourceTermLocalAssembler(), ProcessLib::RichardsMechanics::RichardsMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod, DisplacementDim >::RichardsMechanicsLocalAssembler(), ProcessLib::SmallDeformation::SmallDeformationLocalAssembler< ShapeFunction, IntegrationMethod, DisplacementDim >::SmallDeformationLocalAssembler(), ProcessLib::LIE::SmallDeformation::SmallDeformationLocalAssemblerMatrix< ShapeFunction, IntegrationMethod, DisplacementDim >::SmallDeformationLocalAssemblerMatrix(), ProcessLib::LIE::SmallDeformation::SmallDeformationLocalAssemblerMatrixNearFracture< ShapeFunction, IntegrationMethod, DisplacementDim >::SmallDeformationLocalAssemblerMatrixNearFracture(), ProcessLib::SmallDeformationNonlocal::SmallDeformationNonlocalLocalAssembler< ShapeFunction, IntegrationMethod, DisplacementDim >::SmallDeformationNonlocalLocalAssembler(), ProcessLib::ThermalTwoPhaseFlowWithPP::ThermalTwoPhaseFlowWithPPLocalAssembler< ShapeFunction, IntegrationMethod, GlobalDim >::ThermalTwoPhaseFlowWithPPLocalAssembler(), ProcessLib::ThermoHydroMechanics::ThermoHydroMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod, DisplacementDim >::ThermoHydroMechanicsLocalAssembler(), ProcessLib::ThermoMechanicalPhaseField::ThermoMechanicalPhaseFieldLocalAssembler< ShapeFunction, IntegrationMethod, DisplacementDim >::ThermoMechanicalPhaseFieldLocalAssembler(), ProcessLib::ThermoMechanics::ThermoMechanicsLocalAssembler< ShapeFunction, IntegrationMethod, DisplacementDim >::ThermoMechanicsLocalAssembler(), ProcessLib::TwoPhaseFlowWithPP::TwoPhaseFlowWithPPLocalAssembler< ShapeFunction, IntegrationMethod, GlobalDim >::TwoPhaseFlowWithPPLocalAssembler(), and ProcessLib::VolumetricSourceTermLocalAssembler< ShapeFunction, IntegrationMethod, GlobalDim >::VolumetricSourceTermLocalAssembler().

25 {
26  std::vector<
27  typename ShapeMatricesType::ShapeMatrices,
28  Eigen::aligned_allocator<typename ShapeMatricesType::ShapeMatrices>>
29  shape_matrices;
30 
31  auto const fe =
33  ShapeMatricesType>(e);
34 
35  unsigned const n_integration_points = integration_method.getNumberOfPoints();
36 
37  shape_matrices.reserve(n_integration_points);
38  for (unsigned ip = 0; ip < n_integration_points; ++ip) {
39  shape_matrices.emplace_back(ShapeFunction::DIM, GlobalDim,
40  ShapeFunction::NPOINTS);
41  fe.computeShapeFunctions(
42  integration_method.getWeightedPoint(ip).getCoords(),
43  shape_matrices[ip], GlobalDim, is_axially_symmetric);
44  }
45 
46  return shape_matrices;
47 }
NumLib::TemplateIsoparametric< ShapeFunction, ShapeMatricesType > createIsoparametricFiniteElement(MeshLib::Element const &e)

◆ interpolateCoordinates()

template<typename ShapeFunction , typename ShapeMatricesType >
std::array<double, 3> ProcessLib::interpolateCoordinates ( MeshLib::Element const &  e,
typename ShapeMatricesType::ShapeMatrices::ShapeType const &  N 
)

Definition at line 62 of file InitShapeMatrices.h.

References NumLib::createIsoparametricFiniteElement().

65 {
66  auto const fe =
68  ShapeMatricesType>(e);
69 
70  return fe.interpolateCoordinates(N);
71 }
NumLib::TemplateIsoparametric< ShapeFunction, ShapeMatricesType > createIsoparametricFiniteElement(MeshLib::Element const &e)

◆ interpolateXCoordinate()

template<typename ShapeFunction , typename ShapeMatricesType >
double ProcessLib::interpolateXCoordinate ( MeshLib::Element const &  e,
typename ShapeMatricesType::ShapeMatrices::ShapeType const &  N 
)

Definition at line 50 of file InitShapeMatrices.h.

References NumLib::createIsoparametricFiniteElement().

Referenced by ProcessLib::RichardsMechanics::RichardsMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod, DisplacementDim >::assemble(), ProcessLib::LIE::HydroMechanics::HydroMechanicsLocalAssemblerMatrix< ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod, GlobalDim >::assembleBlockMatricesWithJacobian(), ProcessLib::RichardsMechanics::RichardsMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod, DisplacementDim >::assembleWithJacobian(), ProcessLib::ThermoHydroMechanics::ThermoHydroMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod, DisplacementDim >::assembleWithJacobian(), ProcessLib::HydroMechanics::HydroMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod, DisplacementDim >::assembleWithJacobian(), ProcessLib::HydroMechanics::HydroMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod, DisplacementDim >::assembleWithJacobianForDeformationEquations(), ProcessLib::HydroMechanics::HydroMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod, DisplacementDim >::assembleWithJacobianForPressureEquations(), ProcessLib::LIE::HydroMechanics::HydroMechanicsLocalAssemblerMatrix< ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod, GlobalDim >::computeSecondaryVariableConcreteWithBlockVectors(), ProcessLib::ThermoHydroMechanics::ThermoHydroMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod, DisplacementDim >::postNonLinearSolverConcrete(), ProcessLib::RichardsMechanics::RichardsMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod, DisplacementDim >::postNonLinearSolverConcrete(), and ProcessLib::HydroMechanics::HydroMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod, DisplacementDim >::postNonLinearSolverConcrete().

53 {
54  auto const fe =
56  ShapeMatricesType>(e);
57 
58  return fe.interpolateZerothCoordinate(N);
59 }
NumLib::TemplateIsoparametric< ShapeFunction, ShapeMatricesType > createIsoparametricFiniteElement(MeshLib::Element const &e)

◆ makeExtrapolator()

template<typename LocalAssemblerCollection >
SecondaryVariableFunctions ProcessLib::makeExtrapolator ( const unsigned  num_components,
NumLib::Extrapolator extrapolator,
LocalAssemblerCollection const &  local_assemblers,
typename NumLib::ExtrapolatableLocalAssemblerCollection< LocalAssemblerCollection >::IntegrationPointValuesMethod  integration_point_values_method 
)

Creates an object that computes a secondary variable via extrapolation of integration point values.

Parameters
num_componentsThe number of components of the secondary variable.
extrapolatorThe extrapolator used for extrapolation.
local_assemblersThe collection of local assemblers whose integration point values will be extrapolated.
integration_point_values_methodThe member function of the local assembler returning/computing the integration point values of the specific property being extrapolated.

Definition at line 159 of file SecondaryVariable.h.

References NumLib::makeExtrapolatable().

Referenced by ProcessLib::HeatConduction::HeatConductionProcess::initializeConcreteProcess(), ProcessLib::RichardsFlow::RichardsFlowProcess::initializeConcreteProcess(), ProcessLib::SmallDeformationNonlocal::SmallDeformationNonlocalProcess< DisplacementDim >::initializeConcreteProcess(), ProcessLib::TwoPhaseFlowWithPrho::TwoPhaseFlowWithPrhoProcess::initializeConcreteProcess(), ProcessLib::TwoPhaseFlowWithPP::TwoPhaseFlowWithPPProcess::initializeConcreteProcess(), ProcessLib::LIE::SmallDeformation::SmallDeformationProcess< DisplacementDim >::initializeConcreteProcess(), ProcessLib::ThermalTwoPhaseFlowWithPP::ThermalTwoPhaseFlowWithPPProcess::initializeConcreteProcess(), ProcessLib::HydroMechanics::HydroMechanicsProcess< DisplacementDim >::initializeConcreteProcess(), ProcessLib::RichardsMechanics::RichardsMechanicsProcess< DisplacementDim >::initializeConcreteProcess(), ProcessLib::ThermoHydroMechanics::ThermoHydroMechanicsProcess< DisplacementDim >::initializeConcreteProcess(), ProcessLib::SmallDeformation::SmallDeformationProcess< DisplacementDim >::initializeConcreteProcess(), ProcessLib::PhaseField::PhaseFieldProcess< DisplacementDim >::initializeConcreteProcess(), ProcessLib::ThermoMechanics::ThermoMechanicsProcess< DisplacementDim >::initializeConcreteProcess(), ProcessLib::GroundwaterFlow::GroundwaterFlowProcess::initializeConcreteProcess(), ProcessLib::LiquidFlow::LiquidFlowProcess::initializeConcreteProcess(), ProcessLib::HT::HTProcess::initializeConcreteProcess(), ProcessLib::ThermoMechanicalPhaseField::ThermoMechanicalPhaseFieldProcess< DisplacementDim >::initializeConcreteProcess(), ProcessLib::RichardsComponentTransport::RichardsComponentTransportProcess::initializeConcreteProcess(), ProcessLib::ComponentTransport::ComponentTransportProcess::initializeConcreteProcess(), and ProcessLib::TES::TESProcess::initializeSecondaryVariables().

166 {
167  auto const eval_field = [num_components, &extrapolator, &local_assemblers,
168  integration_point_values_method](
169  const double t,
170  GlobalVector const& x,
171  NumLib::LocalToGlobalIndexMap const& dof_table,
172  std::unique_ptr<GlobalVector> & /*result_cache*/
173  ) -> GlobalVector const& {
174  auto const extrapolatables = NumLib::makeExtrapolatable(
175  local_assemblers, integration_point_values_method);
176  extrapolator.extrapolate(num_components, extrapolatables, t, x,
177  dof_table);
178  return extrapolator.getNodalValues();
179  };
180 
181  auto const eval_residuals =
182  [num_components, &extrapolator, &local_assemblers,
183  integration_point_values_method](
184  const double t,
185  GlobalVector const& x,
186  NumLib::LocalToGlobalIndexMap const& dof_table,
187  std::unique_ptr<GlobalVector> & /*result_cache*/
188  ) -> GlobalVector const& {
189  auto const extrapolatables = NumLib::makeExtrapolatable(
190  local_assemblers, integration_point_values_method);
191  extrapolator.calculateResiduals(num_components, extrapolatables, t, x,
192  dof_table);
193  return extrapolator.getElementResiduals();
194  };
195  return {num_components, eval_field, eval_residuals};
196 }
ExtrapolatableLocalAssemblerCollection< LocalAssemblerCollection > makeExtrapolatable(LocalAssemblerCollection const &local_assemblers, IntegrationPointValuesMethod integration_point_values_method)

◆ makeOutput()

void ProcessLib::makeOutput ( std::string const &  file_name,
MeshLib::Mesh const &  mesh,
bool const  compress_output,
int const  data_mode 
)

Writes output to the given file_name using the VTU file format.

See Output::_output_file_data_mode documentation for the data_mode parameter.

Definition at line 242 of file ProcessOutput.cpp.

Referenced by ProcessLib::Output::doOutputAlways(), ProcessLib::Output::doOutputNonlinearIteration(), and ProcessLib::Output::outputBulkMesh().

244 {
245  // Write output file
246  DBUG("Writing output to '%s'.", file_name.c_str());
247  MeshLib::IO::VtuInterface vtu_interface(&mesh, data_mode, compress_output);
248  vtu_interface.writeToFile(file_name);
249 }
Reads and writes VtkXMLUnstructuredGrid-files (vtu) to and from OGS data structures. This class is currently not inherited from Writer because VTK will implement writing to a string from 6.2 onwards.
Definition: VtuInterface.h:36

◆ makeProcessData()

static std::unique_ptr<ProcessData> ProcessLib::makeProcessData ( std::unique_ptr< NumLib::TimeStepAlgorithm > &&  timestepper,
NumLib::NonlinearSolverBase nonlinear_solver,
Process process,
std::unique_ptr< NumLib::TimeDiscretization > &&  time_disc,
std::unique_ptr< NumLib::ConvergenceCriterion > &&  conv_crit 
)
static

Definition at line 19 of file CreateProcessData.cpp.

References OGS_FATAL.

Referenced by createPerProcessData().

25 {
26  using Tag = NumLib::NonlinearSolverTag;
27 
28  if (auto* nonlinear_solver_picard =
30  &nonlinear_solver))
31  {
32  return std::make_unique<ProcessData>(
33  std::move(timestepper), *nonlinear_solver_picard,
34  std::move(conv_crit), std::move(time_disc), process);
35  }
36  if (auto* nonlinear_solver_newton =
38  &nonlinear_solver))
39  {
40  return std::make_unique<ProcessData>(
41  std::move(timestepper), *nonlinear_solver_newton,
42  std::move(conv_crit), std::move(time_disc), process);
43  }
44 
45  OGS_FATAL("Encountered unknown nonlinear solver type. Aborting");
46 }
NonlinearSolverTag
Tag used to specify which nonlinear solver will be used.
Definition: Types.h:19
#define OGS_FATAL(fmt,...)
Definition: Error.h:63

◆ processOutputData()

void ProcessLib::processOutputData ( const double  t,
GlobalVector const &  x,
MeshLib::Mesh mesh,
NumLib::LocalToGlobalIndexMap const &  dof_table,
std::vector< std::reference_wrapper< ProcessVariable >> const &  process_variables,
SecondaryVariableCollection const &  secondary_variables,
bool const  output_secondary_variable,
std::vector< std::unique_ptr< IntegrationPointWriter >> const &  integration_point_writer,
ProcessOutput const &  process_output 
)

Prepare the output data, i.e. add the solution to vtu data structure.

Definition at line 129 of file ProcessOutput.cpp.

References addIntegrationPointWriter(), addOgsVersion(), addSecondaryVariableNodes(), addSecondaryVariableResiduals(), NumLib::LocalToGlobalIndexMap::getLocalIndex(), MeshLib::MeshSubset::getMeshID(), NumLib::LocalToGlobalIndexMap::getMeshSubset(), ProcessLib::ProcessVariable::getName(), ProcessLib::ProcessVariable::getNumberOfComponents(), NumLib::LocalToGlobalIndexMap::getNumberOfVariables(), MaterialPropertyLib::name, MeshLib::Node, ProcessLib::ProcessOutput::output_residuals, and ProcessLib::ProcessOutput::output_variables.

Referenced by ProcessLib::Output::doOutputAlways(), and ProcessLib::Output::doOutputNonlinearIteration().

141 {
142  DBUG("Process output data.");
143 
144  addOgsVersion(mesh);
145 
146  // Copy result
147 #ifdef USE_PETSC
148  // TODO It is also possible directly to copy the data for single process
149  // variable to a mesh property. It needs a vector of global indices and
150  // some PETSc magic to do so.
151  std::vector<double> x_copy(x.getLocalSize() + x.getGhostSize());
152 #else
153  std::vector<double> x_copy(x.size());
154 #endif
155  x.copyValues(x_copy);
156 
157  auto const& output_variables = process_output.output_variables;
158  std::set<std::string> already_output;
159 
160  int global_component_offset = 0;
161  int global_component_offset_next = 0;
162 
163  const auto number_of_dof_variables = dof_table.getNumberOfVariables();
164  // primary variables
165  for (int variable_id = 0;
166  variable_id < static_cast<int>(process_variables.size());
167  ++variable_id)
168  {
169  ProcessVariable& pv = process_variables[variable_id];
170  int const n_components = pv.getNumberOfComponents();
171  // If (number_of_dof_variables==1), the case is either the staggered
172  // scheme being applied or a single PDE being solved.
173  const int sub_meshset_id =
174  (number_of_dof_variables == 1) ? 0 : variable_id;
175 
176  if (number_of_dof_variables > 1)
177  {
178  global_component_offset = global_component_offset_next;
179  global_component_offset_next += n_components;
180  }
181 
182  if (output_variables.find(pv.getName()) == output_variables.cend())
183  {
184  continue;
185  }
186 
187  already_output.insert(pv.getName());
188 
189  DBUG(" process variable %s", pv.getName().c_str());
190 
191  auto const num_comp = pv.getNumberOfComponents();
192  auto& output_data = *MeshLib::getOrCreateMeshProperty<double>(
193  mesh, pv.getName(), MeshLib::MeshItemType::Node, num_comp);
194 
195 
196  for (int component_id = 0; component_id < num_comp; ++component_id)
197  {
198  auto const& mesh_subset =
199  dof_table.getMeshSubset(sub_meshset_id, component_id);
200  auto const mesh_id = mesh_subset.getMeshID();
201  for (auto const* node : mesh_subset.getNodes())
202  {
204  node->getID());
205 
206  auto const global_component_id =
207  global_component_offset + component_id;
208  auto const index = dof_table.getLocalIndex(
209  l, global_component_id, x.getRangeBegin(), x.getRangeEnd());
210 
211  output_data[node->getID() * n_components + component_id] =
212  x_copy[index];
213  }
214  }
215  }
216 
217  if (output_secondary_variable)
218  {
219  for (auto const& external_variable_name : secondary_variables)
220  {
221  auto const& name = external_variable_name.first;
222  if (!already_output.insert(name).second)
223  {
224  // no insertion took place, output already done
225  continue;
226  }
227 
229  t, x, dof_table, secondary_variables.get(name), name, mesh);
230 
231  if (process_output.output_residuals)
232  {
234  t, x, dof_table, secondary_variables.get(name), name, mesh);
235  }
236  }
237  }
238 
239  addIntegrationPointWriter(mesh, integration_point_writer);
240 }
void addIntegrationPointWriter(MeshLib::Mesh &mesh, std::vector< std::unique_ptr< IntegrationPointWriter >> const &integration_point_writer)
const std::string getName() const
Get name of the mesh.
Definition: Mesh.h:102
static void addSecondaryVariableResiduals(double const t, GlobalVector const &x, NumLib::LocalToGlobalIndexMap const &dof_table, ProcessLib::SecondaryVariable const &var, std::string const &output_name, MeshLib::Mesh &mesh)
static void addSecondaryVariableNodes(double const t, GlobalVector const &x, NumLib::LocalToGlobalIndexMap const &dof_table, ProcessLib::SecondaryVariable const &var, std::string const &output_name, MeshLib::Mesh &mesh)
static void addOgsVersion(MeshLib::Mesh &mesh)

◆ pythonBindBoundaryCondition()

OGS_EXPORT_SYMBOL void ProcessLib::pythonBindBoundaryCondition ( pybind11::module &  m)

Creates Python bindings for the Python BC class.

Definition at line 48 of file PythonBoundaryConditionModule.cpp.

References ProcessLib::PythonBoundaryConditionPythonSideInterface::getDirichletBCValue(), and ProcessLib::PythonBoundaryConditionPythonSideInterface::getFlux().

Referenced by PYBIND11_EMBEDDED_MODULE().

49 {
50  namespace py = pybind11;
51 
52  py::class_<PythonBoundaryConditionPythonSideInterface,
53  PythonBoundaryConditionPythonSideInterfaceTrampoline>
54  pybc(m, "BoundaryCondition");
55 
56  pybc.def(py::init());
57 
58  pybc.def("getDirichletBCValue",
59  &PythonBoundaryConditionPythonSideInterface::getDirichletBCValue);
60  pybc.def("getFlux", &PythonBoundaryConditionPythonSideInterface::getFlux);
61 }

◆ setInitialConditions()

std::vector<GlobalVector*> ProcessLib::setInitialConditions ( double const  t0,
std::vector< std::unique_ptr< ProcessData >> const &  per_process_data 
)

Definition at line 125 of file TimeLoop.cpp.

References MathLib::LinAlg::finalizeAssembly(), NumLib::GlobalVectorProvider::provider, and anonymous_namespace{TimeLoop.cpp}::setEquationSystem().

Referenced by ProcessLib::TimeLoop::loop().

128 {
129  std::vector<GlobalVector*> process_solutions;
130 
131  int process_id = 0;
132  for (auto& process_data : per_process_data)
133  {
134  auto& pcs = process_data->process;
135  auto& time_disc = *process_data->time_disc;
136 
137  auto& ode_sys = *process_data->tdisc_ode_sys;
138  auto const nl_tag = process_data->nonlinear_solver_tag;
139 
140  // append a solution vector of suitable size
141  process_solutions.emplace_back(
143  ode_sys.getMatrixSpecifications(process_id)));
144 
145  auto& x0 = *process_solutions[process_id];
146  pcs.setInitialConditions(process_id, t0, x0);
148 
149  time_disc.setInitialState(t0, x0); // push IC
150 
151  if (time_disc.needsPreload())
152  {
153  auto& nonlinear_solver = process_data->nonlinear_solver;
154  auto& mat_strg = *process_data->mat_strg;
155  auto& conv_crit = *process_data->conv_crit;
156 
157  setEquationSystem(nonlinear_solver, ode_sys, conv_crit, nl_tag);
158  nonlinear_solver.assemble(x0);
159  time_disc.pushState(
160  t0, x0,
161  mat_strg); // TODO: that might do duplicate work
162  }
163 
164  ++process_id;
165  }
166 
167  return process_solutions;
168 }
void setEquationSystem(NumLib::NonlinearSolverBase &nonlinear_solver, NumLib::EquationSystem &eq_sys, NumLib::ConvergenceCriterion &conv_crit, NumLib::NonlinearSolverTag nl_tag)
Definition: TimeLoop.cpp:49
void finalizeAssembly(Matrix &)
static NUMLIB_EXPORT VectorProvider & provider

◆ setTimeDiscretizedODESystem() [1/2]

template<NumLib::ODESystemTag ODETag>
void ProcessLib::setTimeDiscretizedODESystem ( ProcessData process_data,
NumLib::ODESystem< ODETag, NumLib::NonlinearSolverTag::Picard > &  ode_sys 
)

Definition at line 72 of file TimeLoop.cpp.

References ProcessLib::ProcessData::mat_strg, ProcessLib::ProcessData::nonlinear_solver, OGS_FATAL, ProcessLib::ProcessData::process_id, ProcessLib::ProcessData::tdisc_ode_sys, and ProcessLib::ProcessData::time_disc.

Referenced by ProcessLib::TimeLoop::loop(), and setTimeDiscretizedODESystem().

75 {
76  using Tag = NumLib::NonlinearSolverTag;
77  // A concrete Picard solver
78  using NonlinearSolverPicard = NumLib::NonlinearSolver<Tag::Picard>;
79  // A concrete Newton solver
80  using NonlinearSolverNewton = NumLib::NonlinearSolver<Tag::Newton>;
81 
82  if (dynamic_cast<NonlinearSolverPicard*>(&process_data.nonlinear_solver))
83  {
84  // The Picard solver can also work with a Newton-ready ODE,
85  // because the Newton ODESystem derives from the Picard ODESystem.
86  // So no further checks are needed here.
87 
88  process_data.tdisc_ode_sys = std::make_unique<
90  process_data.process_id, ode_sys, *process_data.time_disc);
91  }
92  else if (dynamic_cast<NonlinearSolverNewton*>(
93  &process_data.nonlinear_solver))
94  {
95  // The Newton-Raphson method needs a Newton-ready ODE.
96 
98  if (auto* ode_newton = dynamic_cast<ODENewton*>(&ode_sys))
99  {
100  process_data.tdisc_ode_sys = std::make_unique<
102  process_data.process_id, *ode_newton, *process_data.time_disc);
103  }
104  else
105  {
106  OGS_FATAL(
107  "You are trying to solve a non-Newton-ready ODE with the"
108  " Newton-Raphson method. Aborting");
109  }
110  }
111  else
112  {
113  OGS_FATAL("Encountered unknown nonlinear solver type. Aborting");
114  }
115 
116  process_data.mat_strg = dynamic_cast<NumLib::InternalMatrixStorage*>(
117  process_data.tdisc_ode_sys.get());
118 }
NonlinearSolverTag
Tag used to specify which nonlinear solver will be used.
Definition: Types.h:19
#define OGS_FATAL(fmt,...)
Definition: Error.h:63

◆ setTimeDiscretizedODESystem() [2/2]

void ProcessLib::setTimeDiscretizedODESystem ( ProcessData process_data)

Definition at line 120 of file TimeLoop.cpp.

References ProcessLib::ProcessData::process, and setTimeDiscretizedODESystem().

121 {
122  setTimeDiscretizedODESystem(process_data, process_data.process);
123 }
void setTimeDiscretizedODESystem(ProcessData &process_data)
Definition: TimeLoop.cpp:120

◆ solveOneTimeStepOneProcess()

NumLib::NonlinearSolverStatus ProcessLib::solveOneTimeStepOneProcess ( int const  process_id,
GlobalVector &  x,
std::size_t const  timestep,
double const  t,
double const  delta_t,
ProcessData const &  process_data,
Output output_control 
)

Definition at line 170 of file TimeLoop.cpp.

References ProcessLib::ProcessData::conv_crit, ProcessLib::Output::doOutputNonlinearIteration(), ProcessLib::ProcessData::nonlinear_solver, ProcessLib::ProcessData::nonlinear_solver_tag, ProcessLib::ProcessData::process, anonymous_namespace{TimeLoop.cpp}::setEquationSystem(), ProcessLib::ProcessData::tdisc_ode_sys, and ProcessLib::ProcessData::time_disc.

Referenced by ProcessLib::TimeLoop::solveCoupledEquationSystemsByStaggeredScheme(), and ProcessLib::TimeLoop::solveUncoupledEquationSystems().

174 {
175  auto& process = process_data.process;
176  auto& time_disc = *process_data.time_disc;
177  auto& conv_crit = *process_data.conv_crit;
178  auto& ode_sys = *process_data.tdisc_ode_sys;
179  auto& nonlinear_solver = process_data.nonlinear_solver;
180  auto const nl_tag = process_data.nonlinear_solver_tag;
181 
182  setEquationSystem(nonlinear_solver, ode_sys, conv_crit, nl_tag);
183 
184  // Note: Order matters!
185  // First advance to the next timestep, then set known solutions at that
186  // time, afterwards pass the right solution vector and time to the
187  // preTimestep() hook.
188 
189  time_disc.nextTimestep(t, delta_t);
190 
191  auto const post_iteration_callback = [&](int iteration,
192  GlobalVector const& x) {
193  output_control.doOutputNonlinearIteration(process, process_id, timestep,
194  t, x, iteration);
195  };
196 
197  auto const nonlinear_solver_status =
198  nonlinear_solver.solve(x, post_iteration_callback);
199 
200  if (nonlinear_solver_status.error_norms_met)
201  {
202  process.postNonLinearSolver(x, t, process_id);
203  }
204 
205  return nonlinear_solver_status;
206 }
void setEquationSystem(NumLib::NonlinearSolverBase &nonlinear_solver, NumLib::EquationSystem &eq_sys, NumLib::ConvergenceCriterion &conv_crit, NumLib::NonlinearSolverTag nl_tag)
Definition: TimeLoop.cpp:49

Variable Documentation

◆ nonlinear_fixed_dt_fails_info

std::string const ProcessLib::nonlinear_fixed_dt_fails_info
static
Initial value:
=
"Nonlinear solver fails. Because the time stepper FixedTimeStepping is "
"used, the program has to be terminated."

Definition at line 541 of file TimeLoop.cpp.

◆ NUM_NODAL_DOF

const unsigned ProcessLib::NUM_NODAL_DOF = 1

Definition at line 47 of file VolumetricSourceTermFEM.h.