OGS 6.2.2-330-gf48c72f61.dirty.20200225212913
ProcessLib Namespace Reference

Detailed Description

Common convenitions for naming: X_gas_nonwet mass fraction of gas component(e.g air) in nonwetting phase (gas component doesn't include water vapor, same for the following) x_gas_nonwet molar fraction of gas component in nonwetting phase x_vapor_nonwet molar fraction of vapor in nonwetting phase p_vapor_nonwet water vapor pressure p_gas_nonwet partial pressure of gas component mol_density_nonwet molar density of nonwetting phase mol_density_water molar density of water density_water mass density of water density_nonwet_gas mass density of gas component in the nonwetting phase density_nonwet_vapor mass density of vapor in the nonwetting phase density_nonwet mass density of the nonwetting phase density_wet mass density of wetting pahse density_solid mass density of the solid phase velocity_nonwet velocity of nonwetting phase velocity_wet velocity of wetting phase heat_capacity_dry_gas heat capacity of dry gas heat_capacity_water_vapor heat capacity of water vapor heat_capacity_water heat capacity of liquid water heat_capacity_solid heat capacity of soil grain latent_heat_evaporation latent heat for evaporation(water to vapor) enthalpy_nonwet_gas enthalpy of gas component in the nonwetting phase enthalpy_nonwet_vapor enthalpy of water vapor in the nonwetting phase enthalpy_wet enthalpy of wetting phase enthalpy_nonwet enthalpy of the nonwetting phase internal_energy_nonwet specific internal energy for the nonwetting phase internal_energy_wet specific internal energy for the wetting phase heat_conductivity_dry_solid heat conductivity of the dry porous medium heat_conductivity_wet_solid heat conductivity of the fully saturated porous medium heat_conductivity_unsaturated heat conductivity of the unsaturated porous medium

common nomenclature -----------—primary variable-------------------— pn_int_pt pressure for nonwetting phase at each integration point pc_int_pt capillary pressure at each integration point -----------—secondary variable-----------------— Sw wetting phase saturation dSw_dpc derivative of wetting phase saturation with respect to capillary pressure rho_nonwet density of nonwetting phase drhononwet_dpn derivative of nonwetting phase density with respect to nonwetting phase pressure rho_wet density of wetting phase k_rel_nonwet relative permeability of nonwetting phase mu_nonwet viscosity of nonwetting phase lambda_nonwet mobility of nonwetting phase k_rel_wet relative permeability of wetting phase mu_wet viscosity of wetting phase lambda_wet mobility of wetting phase

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  BHEInflowPythonBoundaryCondition
 A boundary condition whose values are computed by a Python script. More...
 
class  BHEInflowPythonBoundaryConditionPythonSideInterface
 
class  BHEInflowPythonBoundaryConditionPythonSideInterfaceTrampoline
 
class  BMatrixPolicyType
 
class  BoundaryCondition
 
class  BoundaryConditionCollection
 
struct  BoundaryConditionConfig
 
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  GMatrixPolicyType
 
struct  HCNonAdvectiveFreeComponentFlowBoundaryConditionData
 
class  HCNonAdvectiveFreeComponentFlowBoundaryConditionLocalAssembler
 
class  HMatrixPolicyType
 
struct  IntegrationPointData
 
struct  IntegrationPointMetaData
 
struct  IntegrationPointWriter
 
class  LineSourceTerm
 
class  LineSourceTermLocalAssembler
 
class  LineSourceTermLocalAssemblerInterface
 
class  LocalAssemblerInterface
 
struct  LocalCoupledSolutions
 
class  LocalDataInitializer
 
struct  MethodNotOverriddenInDerivedClassException
 
struct  NeumannBoundaryConditionData
 
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  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< NeumannBoundaryConditionData, 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)
 
template<typename BHEType >
std::unique_ptr< BHEInflowPythonBoundaryCondition< BHEType > > createBHEInflowPythonBoundaryCondition (std::pair< GlobalIndexType, GlobalIndexType > &&in_out_global_indices, BHEType &bhe, BHEInflowPythonBoundaryConditionPythonSideInterface &py_bc_object)
 
void bheInflowpythonBindBoundaryCondition (pybind11::module &m)
 Creates BHE Inflow Python bindings for the Python BC class. More...
 
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< double > getCoupledLocalSolutions (std::vector< GlobalVector *> const &global_solutions, std::vector< std::vector< GlobalIndexType >> const &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, int const process_id, Process &process, std::unique_ptr< NumLib::TimeDiscretization > &&time_disc, std::unique_ptr< NumLib::ConvergenceCriterion > &&conv_crit, bool const compensate_non_equilibrium_initial_residuum)
 
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::ChemicalSolverInterface > &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)
 
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, std::vector< GlobalVector * > const &x, int const process_id, MeshLib::Mesh &mesh, std::vector< NumLib::LocalToGlobalIndexMap const * > 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< SourceTermcreateLineSourceTerm (BaseLib::ConfigTree const &config, unsigned const bulk_mesh_dimension, 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< 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, 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)
 
void calculateNonEquilibriumInitialResiduum (std::vector< std::unique_ptr< ProcessData >> const &per_process_data, std::vector< GlobalVector *> process_solutions)
 
NumLib::NonlinearSolverStatus solveOneTimeStepOneProcess (std::vector< GlobalVector *> &x, std::size_t const timestep, double const t, double const delta_t, ProcessData const &process_data, Output &output_control)
 
void preTimestepForAllProcesses (double const t, double const dt, std::vector< std::unique_ptr< ProcessData >> const &per_process_data, std::vector< GlobalVector *> const &_process_solutions)
 
static NumLib::NonlinearSolverStatus solveMonolithicProcess (const double t, const double dt, const std::size_t timestep_id, ProcessData const &process_data, std::vector< GlobalVector *> &x, Output &output)
 
void postTimestepForAllProcesses (double const t, double const dt, std::vector< std::unique_ptr< ProcessData >> const &per_process_data, std::vector< GlobalVector *> const &process_solutions)
 
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 constexpr std::string_view timestepper_cannot_reduce_dt
 

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 222 of file LocalAssemblerTraits.h.

◆ NeumannBoundaryCondition

◆ RobinBoundaryCondition

◆ Trafo

Definition at line 87 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 90 of file IntegrationPointWriter.cpp.

References addIntegrationPointData(), and addIntegrationPointMetaData().

Referenced by processOutputData().

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

◆ bheInflowpythonBindBoundaryCondition()

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

Creates BHE Inflow Python bindings for the Python BC class.

Definition at line 61 of file BHEInflowPythonBoundaryConditionModule.cpp.

References ProcessLib::BHEInflowPythonBoundaryConditionPythonSideInterfaceTrampoline::initializeDataContainer(), ProcessLib::BHEInflowPythonBoundaryConditionPythonSideInterface::tespyHydroSolver(), and ProcessLib::BHEInflowPythonBoundaryConditionPythonSideInterfaceTrampoline::tespyThermalSolver().

Referenced by PYBIND11_EMBEDDED_MODULE().

62 {
63  namespace py = pybind11;
64 
65  py::class_<BHEInflowPythonBoundaryConditionPythonSideInterface,
66  BHEInflowPythonBoundaryConditionPythonSideInterfaceTrampoline>
67  pybc(m, "BHENetwork");
68 
69  pybc.def(py::init());
70 
71  pybc.def("initializeDataContainer",
72  &BHEInflowPythonBoundaryConditionPythonSideInterface::
73  initializeDataContainer);
74  pybc.def("tespyThermalSolver",
75  &BHEInflowPythonBoundaryConditionPythonSideInterface::
76  tespyThermalSolver);
77  pybc.def(
78  "tespyHydroSolver",
79  &BHEInflowPythonBoundaryConditionPythonSideInterface::tespyHydroSolver);
80 }

◆ calculateNonEquilibriumInitialResiduum()

void ProcessLib::calculateNonEquilibriumInitialResiduum ( std::vector< std::unique_ptr< ProcessData >> const &  per_process_data,
std::vector< GlobalVector *>  process_solutions 
)

Definition at line 170 of file TimeLoop.cpp.

References anonymous_namespace{TimeLoop.cpp}::setEquationSystem().

Referenced by NumLib::NonlinearSolver< NonlinearSolverTag::Newton >::assemble(), NumLib::NonlinearSolver< NonlinearSolverTag::Picard >::assemble(), ProcessLib::TimeLoop::loop(), NumLib::NonlinearSolver< NonlinearSolverTag::Newton >::setEquationSystem(), and NumLib::NonlinearSolver< NonlinearSolverTag::Picard >::setEquationSystem().

174 {
175  INFO("Calculate non-equilibrium initial residuum.");
176  for (auto& process_data : per_process_data)
177  {
178  auto& ode_sys = *process_data->tdisc_ode_sys;
179 
180  auto& time_disc = *process_data->time_disc;
181  auto& nonlinear_solver = process_data->nonlinear_solver;
182  auto& conv_crit = *process_data->conv_crit;
183 
184  auto const nl_tag = process_data->nonlinear_solver_tag;
185  setEquationSystem(nonlinear_solver, ode_sys, conv_crit, nl_tag);
186  // dummy values to handle the time derivative terms more or less
187  // correctly, i.e. to ignore them.
188  double const t = 0;
189  double const dt = 1;
190  time_disc.nextTimestep(t, dt);
191  nonlinear_solver.calculateNonEquilibriumInitialResiduum(
192  process_solutions, process_data->process_id);
193  }
194 }
void setEquationSystem(NumLib::NonlinearSolverBase &nonlinear_solver, NumLib::EquationSystem &eq_sys, NumLib::ConvergenceCriterion &conv_crit, NumLib::NonlinearSolverTag nl_tag)
Definition: TimeLoop.cpp:48

◆ 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:64

◆ 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 53 of file HMatrixUtils.h.

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

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

◆ createBHEInflowPythonBoundaryCondition()

template<typename BHEType >
std::unique_ptr<BHEInflowPythonBoundaryCondition<BHEType> > ProcessLib::createBHEInflowPythonBoundaryCondition ( std::pair< GlobalIndexType, GlobalIndexType > &&  in_out_global_indices,
BHEType &  bhe,
BHEInflowPythonBoundaryConditionPythonSideInterface py_bc_object 
)

Definition at line 96 of file BHEInflowPythonBoundaryCondition.h.

References OGS_FATAL.

Referenced by ProcessLib::HeatTransportBHE::HeatTransportBHEProcess::createBHEBoundaryConditionTopBottom().

101 {
102  DBUG("Constructing BHEInflowPythonBoundaryCondition.");
103 
104  // In case of partitioned mesh the boundary could be empty, i.e. there is no
105  // boundary condition.
106 #ifdef USE_PETSC
107  // For this special boundary condition the boundary condition is not empty
108  // if the global indices are non-negative.
109  if (in_out_global_indices.first < 0 && in_out_global_indices.second < 0)
110  {
111  return nullptr;
112  }
113  // If only one of the global indices (in or out) is negative the
114  // implementation is not valid.
115  if (in_out_global_indices.first < 0 || in_out_global_indices.second < 0)
116  {
117  OGS_FATAL(
118  "The partition cuts the BHE into two independent parts. This "
119  "behaviour is not implemented.");
120  }
121 #endif // USE_PETSC
122  return std::make_unique<BHEInflowPythonBoundaryCondition<BHEType>>(
123  std::move(in_out_global_indices), bhe, py_bc_object);
124 }
#define OGS_FATAL(fmt,...)
Definition: Error.h: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 33 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().

40 {
41  // Surface mesh and bulk mesh must have equal axial symmetry flags!
42  if (config.boundary_mesh.isAxiallySymmetric() !=
43  bulk_mesh.isAxiallySymmetric())
44  {
45  OGS_FATAL(
46  "The boundary mesh %s axially symmetric but the bulk mesh %s. Both "
47  "must have an equal axial symmetry property.",
48  config.boundary_mesh.isAxiallySymmetric() ? "is" : "is not",
49  bulk_mesh.isAxiallySymmetric() ? "is" : "is not");
50  }
51 
53  auto const type = config.config.peekConfigParameter<std::string>("type");
54 
55  if (type == "Dirichlet")
56  {
58  config.config, config.boundary_mesh, dof_table, variable_id,
59  *config.component_id, parameters);
60  }
61  if (type == "DirichletWithinTimeInterval")
62  {
64  config.config, config.boundary_mesh, dof_table, variable_id,
65  *config.component_id, parameters);
66  }
67  if (type == "Neumann")
68  {
70  config.config, config.boundary_mesh, dof_table, variable_id,
71  *config.component_id, integration_order, shapefunction_order,
72  bulk_mesh.getDimension(), parameters);
73  }
74  if (type == "Robin")
75  {
77  config.config, config.boundary_mesh, dof_table, variable_id,
78  *config.component_id, integration_order, shapefunction_order,
79  bulk_mesh.getDimension(), parameters);
80  }
81  if (type == "VariableDependentNeumann")
82  {
84  config.config, config.boundary_mesh, dof_table, variable_id,
85  *config.component_id, integration_order, shapefunction_order,
86  bulk_mesh.getDimension(), parameters);
87  }
88 
89  if (type == "Python")
90  {
91 #ifdef OGS_USE_PYTHON
93  config.config, config.boundary_mesh, dof_table, bulk_mesh.getID(),
94  variable_id, *config.component_id, integration_order,
95  shapefunction_order, bulk_mesh.getDimension());
96 #else
97  OGS_FATAL("OpenGeoSys has not been built with Python support.");
98 #endif
99  }
100 
101  //
102  // Special boundary conditions
103  //
104  if (type == "ConstraintDirichlet")
105  {
107  config.config, config.boundary_mesh, dof_table, variable_id,
108  integration_order, *config.component_id, parameters, process);
109  }
110  if (type == "HCNonAdvectiveFreeComponentFlowBoundary")
111  {
113  config.config, config.boundary_mesh, dof_table, variable_id,
114  *config.component_id, integration_order, parameters,
115  bulk_mesh.getDimension(), process, shapefunction_order);
116  }
117  if (type == "NormalTraction")
118  {
121  config.config, config.boundary_mesh, dof_table, variable_id,
122  integration_order, shapefunction_order,
123  bulk_mesh.getDimension(), parameters);
124  }
125  if (type == "PhaseFieldIrreversibleDamageOracleBoundaryCondition")
126  {
127  return ProcessLib::
130  config.config, dof_table, bulk_mesh, variable_id,
131  *config.component_id);
132  }
133  OGS_FATAL("Unknown boundary condition type: `%s'.", type.c_str());
134 }
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:120
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:134
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:78
#define OGS_FATAL(fmt,...)
Definition: Error.h:64
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 136 of file CentralDifferencesJacobianAssembler.cpp.

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

Referenced by createJacobianAssembler().

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

◆ 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 400 of file CompareJacobiansJacobianAssembler.cpp.

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

Referenced by createJacobianAssembler().

401 {
402  // TODO doc script corner case: Parameter could occur at different
403  // locations.
405  config.checkConfigParameter("type", "CompareJacobians");
406 
407  auto asm1 =
409  createJacobianAssembler(config.getConfigSubtree("jacobian_assembler"));
410 
411  auto asm2 = createJacobianAssembler(
413  config.getConfigSubtree("reference_jacobian_assembler"));
414 
416  auto const abs_tol = config.getConfigParameter<double>("abs_tol");
418  auto const rel_tol = config.getConfigParameter<double>("rel_tol");
419 
421  auto const fail_on_error = config.getConfigParameter<bool>("fail_on_error");
422 
424  auto const log_file = config.getConfigParameter<std::string>("log_file");
425 
426  return std::make_unique<CompareJacobiansJacobianAssembler>(
427  std::move(asm1), std::move(asm2), abs_tol, rel_tol, fail_on_error,
428  log_file);
429 }
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 230 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().

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

◆ 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 53 of file DeactivatedSubdomain.cpp.

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

Referenced by createDeactivatedSubdomains().

55 {
57  config.peekConfigParameter<std::string>("time_interval");
58  auto time_interval = BaseLib::createTimeInterval(config);
59 
60  std::vector<int> deactivated_subdomain_material_ids;
61  deactivated_subdomain_material_ids =
63  config.getConfigParameter<std::vector<int>>("material_ids",
64  std::vector<int>{});
65 
66  if (deactivated_subdomain_material_ids.empty())
67  {
68  OGS_FATAL(
69  "The material IDs of the deactivated subdomains are not given. The "
70  "program terminates now.");
71  }
72 
73  std::sort(deactivated_subdomain_material_ids.begin(),
74  deactivated_subdomain_material_ids.end());
75 
76  auto const* const material_ids = MeshLib::materialIDs(mesh);
77  if (material_ids == nullptr)
78  {
79  OGS_FATAL(
80  "The mesh doesn't contain materialIDs for subdomain deactivation. "
81  "The program terminates now.");
82  }
83 
84  std::vector<std::unique_ptr<DeactivetedSubdomainMesh>>
85  deactivated_subdomain_meshes;
86  deactivated_subdomain_meshes.reserve(
87  deactivated_subdomain_material_ids.size());
88 
89  for (auto const ids : deactivated_subdomain_material_ids)
90  {
91  auto const& nodes = mesh.getNodes();
92  std::vector<std::size_t> deactivated_bulk_node_ids;
93  for (auto const& node : nodes)
94  {
95  const auto& connected_elements = node->getElements();
96 
97  // Check whether this node is in an activated element.
98  if (std::find_if(
99  connected_elements.begin(),
100  connected_elements.end(),
101  [&](auto const* const connected_elem) -> bool {
102  return ids != (*material_ids)[connected_elem->getID()];
103  }) != connected_elements.end())
104  {
105  continue;
106  }
107 
108  deactivated_bulk_node_ids.push_back(node->getID());
109  }
110 
111  auto const& elements = mesh.getElements();
112  std::vector<MeshLib::Element*> deactivated_elements;
113  for (auto const& element : elements)
114  {
115  if (ids != (*material_ids)[element->getID()])
116  {
117  continue;
118  }
119 
120  deactivated_elements.push_back(
121  const_cast<MeshLib::Element*>(element));
122  }
123 
125  "deactivate_subdomain" + std::to_string(ids),
126  MeshLib::cloneElements(deactivated_elements));
127 
128  auto const& new_mesh_properties = bc_mesh->getProperties();
129  if (!new_mesh_properties.template existsPropertyVector<std::size_t>(
130  "bulk_node_ids"))
131  {
132  OGS_FATAL(
133  "Bulk node ids map expected in the construction of the mesh "
134  "subset.");
135  }
136  auto const& bulk_node_ids_map =
137  *new_mesh_properties.template getPropertyVector<std::size_t>(
138  "bulk_node_ids", MeshLib::MeshItemType::Node, 1);
139 
140  std::vector<MeshLib::Node*> deactivated_nodes;
141  auto const& nodes_in_bc_mesh = bc_mesh->getNodes();
142  for (std::size_t i = 0; i < bulk_node_ids_map.size(); i++)
143  {
144  auto const found_iterator = std::find(
145  deactivated_bulk_node_ids.begin(),
146  deactivated_bulk_node_ids.end(), bulk_node_ids_map[i]);
147 
148  if (std::end(deactivated_bulk_node_ids) == found_iterator)
149  {
150  continue;
151  }
152  deactivated_nodes.push_back(
153  const_cast<MeshLib::Node*>(nodes_in_bc_mesh[i]));
154 
155  deactivated_bulk_node_ids.erase(found_iterator);
156  }
157 
158  deactivated_subdomain_meshes.emplace_back(
159  std::make_unique<DeactivetedSubdomainMesh>(
160  std::move(bc_mesh), std::move(deactivated_nodes)));
161  }
162 
163  return std::make_unique<DeactivatedSubdomain const>(
164  std::move(time_interval),
165  std::move(deactivated_subdomain_material_ids),
166  std::move(deactivated_subdomain_meshes));
167 }
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:320
std::unique_ptr< TimeInterval > createTimeInterval(BaseLib::ConfigTree const &config)
PropertyVector< int > const * materialIDs(Mesh const &mesh)
Definition: Mesh.cpp:310
#define OGS_FATAL(fmt,...)
Definition: Error.h:64

◆ 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 170 of file DeactivatedSubdomain.cpp.

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

172 {
173  std::vector<std::unique_ptr<DeactivatedSubdomain const>>
174  deactivated_subdomains;
175  // Deactivated subdomains
176  if (auto subdomains_config =
178  config.getConfigSubtreeOptional("deactivated_subdomains"))
179  {
180  INFO("There are subdomains being deactivated.");
181 
182  for (
183  auto subdomain_config :
185  subdomains_config->getConfigSubtreeList("deactivated_subdomain"))
186  {
187  deactivated_subdomains.emplace_back(
188  createDeactivatedSubdomain(subdomain_config, mesh));
189  }
190  }
191  return deactivated_subdomains;
192 }
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 58 of file DirichletBoundaryCondition.cpp.

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

Referenced by createBoundaryCondition().

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

◆ 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 18 of file HCNonAdvectiveFreeComponentFlowBoundaryCondition.cpp.

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

Referenced by createBoundaryCondition().

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

◆ 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 20 of file CreateJacobianAssembler.cpp.

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

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

22 {
23  if (!config)
24  {
25  return std::make_unique<AnalyticalJacobianAssembler>();
26  }
27 
29  auto const type = config->peekConfigParameter<std::string>("type");
30 
31  if (type == "Analytical") {
32  config->ignoreConfigParameter("type");
33  return std::make_unique<AnalyticalJacobianAssembler>();
34  }
35  if (type == "CentralDifferences")
36  {
38  }
39  if (type == "CompareJacobians")
40  {
42  }
43 
44  OGS_FATAL("Unknown Jacobian assembler type: `%s'.", type.c_str());
45 }
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:64

◆ createLineSourceTerm()

std::unique_ptr< SourceTerm > ProcessLib::createLineSourceTerm ( BaseLib::ConfigTree const &  config,
unsigned const  bulk_mesh_dimension,
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__Line__parameter

Definition at line 22 of file CreateLineSourceTerm.cpp.

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

Referenced by createSourceTerm().

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

◆ 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 70 of file CreateLocalAssemblers.h.

References OGS_FATAL.

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

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

◆ 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
Input File Parameter:
prj__process_variables__process_variable__boundary_conditions__boundary_condition__Neumann__area_parameter

Definition at line 16 of file NeumannBoundaryCondition.cpp.

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

Referenced by createBoundaryCondition().

22 {
23  DBUG("Constructing Neumann BC from config.");
25  config.checkConfigParameter("type", "Neumann");
26 
28  auto const param_name = config.getConfigParameter<std::string>("parameter");
29  DBUG("Using parameter %s", param_name.c_str());
30 
31  auto const& param = ParameterLib::findParameter<double>(
32  param_name, parameters, 1, &bc_mesh);
33 
34  // In case of partitioned mesh the boundary could be empty, i.e. there
35  // is no boundary condition.
36 #ifdef USE_PETSC
37  // This can be extracted to createBoundaryCondition() but then the config
38  // parameters are not read and will cause an error.
39  // TODO (naumov): Add a function to ConfigTree for skipping the tags of the
40  // subtree and move the code up in createBoundaryCondition().
41  if (bc_mesh.getDimension() == 0 && bc_mesh.getNumberOfNodes() == 0 &&
42  bc_mesh.getNumberOfElements() == 0)
43  {
44  return nullptr;
45  }
46 #endif // USE_PETSC
47 
48  ParameterLib::Parameter<double> const* integral_measure(nullptr);
49  if (global_dim - bc_mesh.getDimension() != 1)
50  {
51  auto const area_parameter_name =
53  config.getConfigParameter<std::string>("area_parameter");
54  DBUG("area parameter name '%s'", area_parameter_name.c_str());
55  integral_measure = &ParameterLib::findParameter<double>(
56  area_parameter_name, parameters, 1, &bc_mesh);
57  }
58 
59  if (bc_mesh.getDimension() >= global_dim)
60  {
61  OGS_FATAL(
62  "The dimension (%d) of the given boundary mesh '%s' is not lower "
63  "than the bulk dimension (%d).",
64  bc_mesh.getDimension(), bc_mesh.getName().c_str(), global_dim);
65  }
66 
67  return std::make_unique<NeumannBoundaryCondition>(
68  integration_order, shapefunction_order, dof_table, variable_id,
69  component_id, global_dim, bc_mesh,
70  NeumannBoundaryConditionData{param, integral_measure});
71 }
#define OGS_FATAL(fmt,...)
Definition: Error.h:64

◆ 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 22 of file CreateNodalSourceTerm.cpp.

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

Referenced by createSourceTerm().

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

◆ 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 27 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().

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

◆ 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__compensate_non_equilibrium_initial_residuum
Input File Parameter:
prj__time_loop__processes__process__output

Definition at line 55 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().

60 {
61  std::vector<std::unique_ptr<ProcessData>> per_process_data;
62  int process_id = 0;
63 
65  for (auto pcs_config : config.getConfigSubtreeList("process"))
66  {
68  auto const pcs_name = pcs_config.getConfigAttribute<std::string>("ref");
69  auto& pcs = *BaseLib::getIfOrError(
70  processes,
71  [&pcs_name](std::unique_ptr<Process> const& p) {
72  return p->name == pcs_name;
73  },
74  "A process with the given name has not been defined.");
75 
76  auto const nl_slv_name =
78  pcs_config.getConfigParameter<std::string>("nonlinear_solver");
79  auto& nl_slv = *BaseLib::getOrError(
80  nonlinear_solvers, nl_slv_name,
81  "A nonlinear solver with the given name has not been defined.");
82 
83  auto time_disc = NumLib::createTimeDiscretization(
85  pcs_config.getConfigSubtree("time_discretization"));
86 
87  auto timestepper = NumLib::createTimeStepper(
89  pcs_config.getConfigSubtree("time_stepping"));
90 
91  auto conv_crit = NumLib::createConvergenceCriterion(
93  pcs_config.getConfigSubtree("convergence_criterion"));
94 
95  auto const compensate_non_equilibrium_initial_residuum =
97  pcs_config.getConfigParameter<bool>(
98  "compensate_non_equilibrium_initial_residuum", false);
99 
101  auto output = pcs_config.getConfigSubtreeOptional("output");
102  if (output)
103  {
104  OGS_FATAL(
105  "In order to make the specification of output in the project "
106  "file consistent, the variables output tags were moved from "
107  "xpath "
108  "'//OpenGeoSysProject/time_loop/processes/process/output' "
109  "to the global output section, i.e., to the xpath "
110  "'//OpenGeoSysProject/time_loop/output'. This has to be done "
111  "in the current project file!");
112  }
113 
114  per_process_data.emplace_back(
115  makeProcessData(std::move(timestepper), nl_slv, process_id, pcs,
116  std::move(time_disc), std::move(conv_crit),
117  compensate_non_equilibrium_initial_residuum));
118  ++process_id;
119  }
120 
121  if (per_process_data.size() != processes.size())
122  {
123  if (processes.size() > 1)
124  {
125  OGS_FATAL(
126  "Some processes have not been configured to be solved by this "
127  " time loop.");
128  }
129  else
130  {
131  INFO(
132  "The equations of the coupled processes will be solved by the "
133  "staggered scheme.");
134  }
135  }
136 
137  return per_process_data;
138 }
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:148
Container::value_type const & getIfOrError(Container const &container, Predicate &&predicate, std::string const &error_message)
Definition: Algorithm.h:179
static std::unique_ptr< ProcessData > makeProcessData(std::unique_ptr< NumLib::TimeStepAlgorithm > &&timestepper, NumLib::NonlinearSolverBase &nonlinear_solver, int const process_id, Process &process, std::unique_ptr< NumLib::TimeDiscretization > &&time_disc, std::unique_ptr< NumLib::ConvergenceCriterion > &&conv_crit, bool const compensate_non_equilibrium_initial_residuum)
static const double p
#define OGS_FATAL(fmt,...)
Definition: Error.h:64
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 69 of file PhaseFieldIrreversibleDamageOracleBoundaryCondition.cpp.

References BaseLib::ConfigTree::checkConfigParameter().

Referenced by createBoundaryCondition().

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

◆ 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 201 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().

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

◆ createPythonSourceTerm()

std::unique_ptr< SourceTerm > ProcessLib::createPythonSourceTerm ( BaseLib::ConfigTree const &  config,
MeshLib::Mesh const &  source_term_mesh,
std::unique_ptr< NumLib::LocalToGlobalIndexMap dof_table,
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 23 of file CreatePythonSourceTerm.cpp.

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

Referenced by createSourceTerm().

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

◆ 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
Input File Parameter:
prj__process_variables__process_variable__boundary_conditions__boundary_condition__Robin__area_parameter

Definition at line 17 of file RobinBoundaryCondition.cpp.

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

Referenced by createBoundaryCondition().

23 {
24  DBUG("Constructing RobinBcConfig from config.");
26  config.checkConfigParameter("type", "Robin");
27 
28  if (bc_mesh.getDimension() >= global_dim)
29  {
30  OGS_FATAL(
31  "The dimension (%d) of the given boundary mesh '%s' is not lower "
32  "than the bulk dimension (%d).",
33  bc_mesh.getDimension(), bc_mesh.getName().c_str(), global_dim);
34  }
35 
37  auto const alpha_name = config.getConfigParameter<std::string>("alpha");
39  auto const u_0_name = config.getConfigParameter<std::string>("u_0");
40 
41  auto const& alpha = ParameterLib::findParameter<double>(
42  alpha_name, parameters, 1, &bc_mesh);
43  auto const& u_0 =
44  ParameterLib::findParameter<double>(u_0_name, parameters, 1, &bc_mesh);
45 
46  ParameterLib::Parameter<double> const* integral_measure(nullptr);
47  if (global_dim - bc_mesh.getDimension() != 1)
48  {
49  auto const area_parameter_name =
51  config.getConfigParameter<std::string>("area_parameter");
52  DBUG("area parameter name '%s'", area_parameter_name.c_str());
53  integral_measure = &ParameterLib::findParameter<double>(
54  area_parameter_name, parameters, 1, &bc_mesh);
55  }
56 
57  // In case of partitioned mesh the boundary could be empty, i.e. there is no
58  // boundary condition.
59 #ifdef USE_PETSC
60  // This can be extracted to createBoundaryCondition() but then the config
61  // parameters are not read and will cause an error.
62  // TODO (naumov): Add a function to ConfigTree for skipping the tags of the
63  // subtree and move the code up in createBoundaryCondition().
64  if (bc_mesh.getDimension() == 0 && bc_mesh.getNumberOfNodes() == 0 &&
65  bc_mesh.getNumberOfElements() == 0)
66  {
67  return nullptr;
68  }
69 #endif // USE_PETSC
70 
71  return std::make_unique<RobinBoundaryCondition>(
72  integration_order, shapefunction_order, dof_table, variable_id,
73  component_id, global_dim, bc_mesh,
74  RobinBoundaryConditionData{alpha, u_0, integral_measure});
75 }
#define OGS_FATAL(fmt,...)
Definition: Error.h:64

◆ createSecondaryVariables()

void ProcessLib::createSecondaryVariables ( BaseLib::ConfigTree const &  config,
SecondaryVariableCollection secondary_variables 
)
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

Definition at line 18 of file CreateSecondaryVariables.cpp.

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

Referenced by ProcessLib::ComponentTransport::createComponentTransportProcess(), ProcessLib::GroundwaterFlow::createGroundwaterFlowProcess(), ProcessLib::HeatConduction::createHeatConductionProcess(), ProcessLib::HeatTransportBHE::createHeatTransportBHEProcess(), ProcessLib::HT::createHTProcess(), ProcessLib::LIE::HydroMechanics::createHydroMechanicsProcess(), 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::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().

20 {
21  auto sec_vars_config =
23  config.getConfigSubtreeOptional("secondary_variables");
24  if (!sec_vars_config)
25  {
26  return;
27  }
28 
29  for (
30  auto sec_var_config :
32  sec_vars_config->getConfigSubtreeList("secondary_variable"))
33  {
34  auto const type =
36  sec_var_config.getConfigAttributeOptional<std::string>("type");
37  if (type)
38  {
39  WARN(
40  "Secondary variable type specification is deprecated and is "
41  "ignored. All secondary variable types are 'static'.");
42  }
43 
44  auto const internal_name =
46  sec_var_config.getConfigAttribute<std::string>("internal_name");
47  auto const output_name =
49  sec_var_config.getConfigAttribute<std::string>("output_name");
50 
51  secondary_variables.addNameMapping(internal_name, output_name);
52  }
53 }

◆ 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 24 of file CreateSourceTerm.cpp.

References ProcessLib::SourceTermConfig::component_id, ProcessLib::SourceTermConfig::config, createLineSourceTerm(), createNodalSourceTerm(), createPythonSourceTerm(), createVolumetricSourceTerm(), NumLib::LocalToGlobalIndexMap::deriveBoundaryConstrainedMap(), MeshLib::Mesh::getDimension(), MeshLib::Mesh::getID(), MeshLib::MeshSubset::getMesh(), NumLib::LocalToGlobalIndexMap::getMeshSubset(), 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().

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

◆ 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::ChemicalSolverInterface > &  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 22 of file CreateTimeLoop.cpp.

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

Referenced by ProjectData::parseTimeLoop().

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

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

Referenced by createBoundaryCondition().

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

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

Referenced by createSourceTerm().

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

◆ 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 46 of file ProcessUtils.cpp.

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

49 {
50  // Find process variable name in process config.
52  std::string const name = pv_config.getConfigParameter<std::string>(tag);
53  return findVariableByName(variables, name, tag);
54 }
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 &  pv_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 56 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().

61 {
62  std::vector<std::reference_wrapper<ProcessVariable>> vars;
63  vars.reserve(variables.size());
64 
65  if (variables.size() > tags.size())
66  DBUG("Found multiple process variables with a same tag.");
67 
68  for (auto& tag : tags)
69  {
70  auto vars_per_tag = findProcessVariables(variables, pv_config, tag);
71  vars.insert(vars.end(), vars_per_tag.begin(), vars_per_tag.end());
72  }
73 
74  return vars;
75 }
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 77 of file ProcessUtils.cpp.

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

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

◆ getCoupledLocalSolutions()

std::vector< double > ProcessLib::getCoupledLocalSolutions ( std::vector< GlobalVector * > const &  global_solutions,
std::vector< std::vector< GlobalIndexType >> const &  indices 
)

Fetch the nodal solutions of all coupled processes from the given vector of global solutions for each process into a flat vector.

Definition at line 32 of file CoupledSolutionsForStaggeredScheme.cpp.

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

35 {
36  if (global_solutions.empty())
37  {
38  return {};
39  }
40 
41  std::size_t const local_solutions_size = std::accumulate(
42  cbegin(indices),
43  cend(indices),
44  std::size_t(0),
45  [](GlobalIndexType const size,
46  std::vector<GlobalIndexType> const& process_indices) {
47  return size + process_indices.size();
48  });
49  std::vector<double> local_solutions;
50  local_solutions.reserve(local_solutions_size);
51 
52  int number_of_processes = static_cast<int>(global_solutions.size());
53  for (int process_id = 0; process_id < number_of_processes; ++process_id)
54  {
55  auto values = global_solutions[process_id]->get(indices[process_id]);
56  local_solutions.insert(cend(local_solutions),
57  std::make_move_iterator(begin(values)),
58  std::make_move_iterator(end(values)));
59  }
60  return local_solutions;
61 }
GlobalMatrix::IndexType GlobalIndexType

◆ 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 106 of file IntegrationPointWriter.cpp.

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

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

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

◆ 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 24 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::LineSourceTermLocalAssembler< ShapeFunction, IntegrationMethod, GlobalDim >::LineSourceTermLocalAssembler(), 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().

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

◆ interpolateXCoordinate()

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

Definition at line 51 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::ThermoHydroMechanics::ThermoHydroMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod, DisplacementDim >::postNonLinearSolverConcrete(), ProcessLib::RichardsMechanics::RichardsMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod, DisplacementDim >::postNonLinearSolverConcrete(), ProcessLib::HydroMechanics::HydroMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod, DisplacementDim >::postNonLinearSolverConcrete(), and ProcessLib::LIE::HydroMechanics::HydroMechanicsLocalAssemblerMatrix< ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod, GlobalDim >::postTimestepConcreteWithBlockVectors().

54 {
55  auto const fe =
57  ShapeMatricesType>(e);
58 
59  return fe.interpolateZerothCoordinate(N);
60 }
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 166 of file SecondaryVariable.h.

References NumLib::makeExtrapolatable().

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

173 {
174  auto const eval_field =
175  [num_components, &extrapolator, &local_assemblers,
176  integration_point_values_method](
177  const double t,
178  std::vector<GlobalVector*> const& x,
179  std::vector<NumLib::LocalToGlobalIndexMap const*> const& dof_table,
180  std::unique_ptr<GlobalVector> & /*result_cache*/
181  ) -> GlobalVector const& {
182  auto const extrapolatables = NumLib::makeExtrapolatable(
183  local_assemblers, integration_point_values_method);
184  extrapolator.extrapolate(num_components, extrapolatables, t, x,
185  dof_table);
186  return extrapolator.getNodalValues();
187  };
188 
189  auto const eval_residuals =
190  [num_components, &extrapolator, &local_assemblers,
191  integration_point_values_method](
192  const double t,
193  std::vector<GlobalVector*> const& x,
194  std::vector<NumLib::LocalToGlobalIndexMap const*> const& dof_table,
195  std::unique_ptr<GlobalVector> & /*result_cache*/
196  ) -> GlobalVector const& {
197  auto const extrapolatables = NumLib::makeExtrapolatable(
198  local_assemblers, integration_point_values_method);
199  extrapolator.calculateResiduals(num_components, extrapolatables, t, x,
200  dof_table);
201  return extrapolator.getElementResiduals();
202  };
203  return {num_components, eval_field, eval_residuals};
204 }
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 247 of file ProcessOutput.cpp.

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

249 {
250  // Write output file
251  DBUG("Writing output to '%s'.", file_name.c_str());
252  MeshLib::IO::VtuInterface vtu_interface(&mesh, data_mode, compress_output);
253  vtu_interface.writeToFile(file_name);
254 }
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,
int const  process_id,
Process process,
std::unique_ptr< NumLib::TimeDiscretization > &&  time_disc,
std::unique_ptr< NumLib::ConvergenceCriterion > &&  conv_crit,
bool const  compensate_non_equilibrium_initial_residuum 
)
static

Definition at line 20 of file CreateProcessData.cpp.

References OGS_FATAL.

Referenced by createPerProcessData().

28 {
29  using Tag = NumLib::NonlinearSolverTag;
30 
31  if (auto* nonlinear_solver_picard =
33  &nonlinear_solver))
34  {
35  nonlinear_solver_picard->compensateNonEquilibriumInitialResiduum(
36  compensate_non_equilibrium_initial_residuum);
37  return std::make_unique<ProcessData>(
38  std::move(timestepper), *nonlinear_solver_picard,
39  std::move(conv_crit), std::move(time_disc), process_id, process);
40  }
41  if (auto* nonlinear_solver_newton =
43  &nonlinear_solver))
44  {
45  nonlinear_solver_newton->compensateNonEquilibriumInitialResiduum(
46  compensate_non_equilibrium_initial_residuum);
47  return std::make_unique<ProcessData>(
48  std::move(timestepper), *nonlinear_solver_newton,
49  std::move(conv_crit), std::move(time_disc), process_id, process);
50  }
51 
52  OGS_FATAL("Encountered unknown nonlinear solver type. Aborting");
53 }
NonlinearSolverTag
Tag used to specify which nonlinear solver will be used.
Definition: Types.h:20
#define OGS_FATAL(fmt,...)
Definition: Error.h:64

◆ postTimestepForAllProcesses()

void ProcessLib::postTimestepForAllProcesses ( double const  t,
double const  dt,
std::vector< std::unique_ptr< ProcessData >> const &  per_process_data,
std::vector< GlobalVector *> const &  process_solutions 
)

Definition at line 598 of file TimeLoop.cpp.

References anonymous_namespace{TimeLoop.cpp}::isMonolithicProcess().

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

602 {
603  // All _per_process_data share the first process.
604  bool const is_staggered_coupling =
605  !isMonolithicProcess(*per_process_data[0]);
606 
607  for (auto& process_data : per_process_data)
608  {
609  auto const process_id = process_data->process_id;
610  auto& pcs = process_data->process;
611 
612  if (is_staggered_coupling)
613  {
614  CoupledSolutionsForStaggeredScheme coupled_solutions(
615  process_solutions);
616  pcs.setCoupledSolutionsForStaggeredScheme(&coupled_solutions);
617  }
618  auto& x = *process_solutions[process_id];
619  pcs.postTimestep(process_solutions, t, dt, process_id);
620  pcs.computeSecondaryVariable(t, x, process_id);
621  }
622 }
bool isMonolithicProcess(ProcessLib::ProcessData const &process_data)
Definition: TimeLoop.cpp:65

◆ preTimestepForAllProcesses()

void ProcessLib::preTimestepForAllProcesses ( double const  t,
double const  dt,
std::vector< std::unique_ptr< ProcessData >> const &  per_process_data,
std::vector< GlobalVector *> const &  _process_solutions 
)

Definition at line 565 of file TimeLoop.cpp.

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

569 {
570  for (auto& process_data : per_process_data)
571  {
572  auto const process_id = process_data->process_id;
573  auto& pcs = process_data->process;
574  pcs.preTimestep(_process_solutions, t, dt, process_id);
575  }
576 }

◆ processOutputData()

void ProcessLib::processOutputData ( const double  t,
std::vector< GlobalVector *> const &  x,
int const  process_id,
MeshLib::Mesh mesh,
std::vector< NumLib::LocalToGlobalIndexMap const *> 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 130 of file ProcessOutput.cpp.

References addIntegrationPointWriter(), addOgsVersion(), addSecondaryVariableNodes(), addSecondaryVariableResiduals(), ProcessLib::ProcessVariable::getName(), ProcessLib::ProcessVariable::getNumberOfComponents(), MaterialPropertyLib::name, MeshLib::Node, ProcessLib::ProcessOutput::output_residuals, and ProcessLib::ProcessOutput::output_variables.

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

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

◆ pythonBindBoundaryCondition()

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

Creates Python bindings for the Python BC class.

Definition at line 49 of file PythonBoundaryConditionModule.cpp.

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

Referenced by PYBIND11_EMBEDDED_MODULE().

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

◆ setInitialConditions()

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

Definition at line 127 of file TimeLoop.cpp.

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

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

130 {
131  std::vector<GlobalVector*> process_solutions;
132 
133  for (auto& process_data : per_process_data)
134  {
135  auto& pcs = process_data->process;
136  auto const process_id = process_data->process_id;
137  auto& time_disc = *process_data->time_disc;
138 
139  auto& ode_sys = *process_data->tdisc_ode_sys;
140 
141  // append a solution vector of suitable size
142  process_solutions.emplace_back(
144  ode_sys.getMatrixSpecifications(process_id)));
145 
146  auto& x0 = *process_solutions[process_id];
147  pcs.setInitialConditions(process_id, t0, x0);
149 
150  time_disc.setInitialState(t0, x0); // push IC
151 
152  if (time_disc.needsPreload())
153  {
154  auto& nonlinear_solver = process_data->nonlinear_solver;
155  auto& mat_strg = *process_data->mat_strg;
156  auto& conv_crit = *process_data->conv_crit;
157 
158  auto const nl_tag = process_data->nonlinear_solver_tag;
159  setEquationSystem(nonlinear_solver, ode_sys, conv_crit, nl_tag);
160  nonlinear_solver.assemble(process_solutions, process_id);
161  time_disc.pushState(
162  t0, x0,
163  mat_strg); // TODO: that might do duplicate work
164  }
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:48
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 74 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::initialize(), and setTimeDiscretizedODESystem().

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

◆ setTimeDiscretizedODESystem() [2/2]

void ProcessLib::setTimeDiscretizedODESystem ( ProcessData process_data)

Definition at line 122 of file TimeLoop.cpp.

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

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

◆ solveMonolithicProcess()

static NumLib::NonlinearSolverStatus ProcessLib::solveMonolithicProcess ( const double  t,
const double  dt,
const std::size_t  timestep_id,
ProcessData const &  process_data,
std::vector< GlobalVector *> &  x,
Output output 
)
static

Definition at line 578 of file TimeLoop.cpp.

References BaseLib::RunTime::elapsed(), ProcessLib::ProcessData::process_id, solveOneTimeStepOneProcess(), and BaseLib::RunTime::start().

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

582 {
583  BaseLib::RunTime time_timestep_process;
584  time_timestep_process.start();
585 
586  auto const nonlinear_solver_status =
587  solveOneTimeStepOneProcess(x, timestep_id, t, dt, process_data, output);
588 
589  INFO("[time] Solving process #%u took %g s in time step #%u ",
590  process_data.process_id, time_timestep_process.elapsed(), timestep_id);
591 
592  return nonlinear_solver_status;
593 }
NumLib::NonlinearSolverStatus solveOneTimeStepOneProcess(std::vector< GlobalVector *> &x, std::size_t const timestep, double const t, double const delta_t, ProcessData const &process_data, Output &output_control)
Definition: TimeLoop.cpp:196
Count the running time.
Definition: RunTime.h:31
void start()
Start the timer.
Definition: RunTime.h:35
double elapsed() const
Get the elapsed time after started.
Definition: RunTime.h:51

◆ solveOneTimeStepOneProcess()

NumLib::NonlinearSolverStatus ProcessLib::solveOneTimeStepOneProcess ( std::vector< GlobalVector *> &  x,
std::size_t const  timestep,
double const  t,
double const  delta_t,
ProcessData const &  process_data,
Output output_control 
)

Definition at line 196 of file TimeLoop.cpp.

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

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

200 {
201  auto& process = process_data.process;
202  int const process_id = process_data.process_id;
203  auto& time_disc = *process_data.time_disc;
204  auto& conv_crit = *process_data.conv_crit;
205  auto& ode_sys = *process_data.tdisc_ode_sys;
206  auto& nonlinear_solver = process_data.nonlinear_solver;
207  auto const nl_tag = process_data.nonlinear_solver_tag;
208 
209  setEquationSystem(nonlinear_solver, ode_sys, conv_crit, nl_tag);
210 
211  // Note: Order matters!
212  // First advance to the next timestep, then set known solutions at that
213  // time, afterwards pass the right solution vector and time to the
214  // preTimestep() hook.
215 
216  time_disc.nextTimestep(t, delta_t);
217 
218  auto const post_iteration_callback =
219  [&](int iteration, std::vector<GlobalVector*> const& x) {
220  output_control.doOutputNonlinearIteration(
221  process, process_id, timestep, t, x, iteration);
222  };
223 
224  auto const nonlinear_solver_status =
225  nonlinear_solver.solve(x, post_iteration_callback, process_id);
226 
227  if (nonlinear_solver_status.error_norms_met)
228  {
229  process.postNonLinearSolver(*x[process_id], t, delta_t, process_id);
230  }
231 
232  return nonlinear_solver_status;
233 }
void setEquationSystem(NumLib::NonlinearSolverBase &nonlinear_solver, NumLib::EquationSystem &eq_sys, NumLib::ConvergenceCriterion &conv_crit, NumLib::NonlinearSolverTag nl_tag)
Definition: TimeLoop.cpp:48

Variable Documentation

◆ NUM_NODAL_DOF

const unsigned ProcessLib::NUM_NODAL_DOF = 1

Definition at line 34 of file LineSourceTermFEM.h.

◆ timestepper_cannot_reduce_dt

constexpr std::string_view ProcessLib::timestepper_cannot_reduce_dt
static
Initial value:
=
"Time stepper cannot reduce the time step size further."

Definition at line 595 of file TimeLoop.cpp.