OGS
ProcessLib Namespace Reference

Detailed Description

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

namespace  Assembly
namespace  BoundaryConditionAndSourceTerm
namespace  ComponentTransport
namespace  ConstitutiveRelations
namespace  Deformation
namespace  detail
namespace  Graph
namespace  HeatConduction
namespace  HeatTransportBHE
namespace  HMPhaseField
namespace  HT
namespace  HydroMechanics
namespace  LargeDeformation
namespace  LIE
namespace  LinearBMatrix
namespace  LiquidFlow
namespace  NonLinearBMatrix
namespace  NonLinearFbar
namespace  NormalTractionBoundaryCondition
namespace  PhaseField
namespace  Reflection
namespace  RichardsComponentTransport
namespace  RichardsFlow
namespace  RichardsMechanics
namespace  SmallDeformation
namespace  SourceTerms
namespace  SteadyStateDiffusion
namespace  TH2M
namespace  ThermalTwoPhaseFlowWithPP
namespace  ThermoHydroMechanics
namespace  ThermoMechanics
namespace  ThermoRichardsFlow
namespace  ThermoRichardsMechanics
namespace  TwoPhaseFlowWithPP
namespace  WellboreSimulator

Classes

class  AbstractJacobianAssembler
 Base class for Jacobian assemblers. More...
class  AnalyticalJacobianAssembler
class  AnchorTerm
struct  AssembledMatrixCache
 Stores assembled global M, K, b matrices/vectors for later reuse. More...
class  AssemblyMixin
class  AssemblyMixinBase
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
struct  CellAverageData
class  CentralDifferencesJacobianAssembler
 Assembles the Jacobian matrix using central differences. More...
class  CompareJacobiansJacobianAssembler
class  ConstraintDirichletBoundaryCondition
struct  ConstraintDirichletBoundaryConditionConfig
class  ConstraintDirichletBoundaryConditionLocalAssembler
class  ConstraintDirichletBoundaryConditionLocalAssemblerInterface
struct  DeactivatedSubdomain
class  DeactivatedSubdomainDirichlet
struct  DeactivatedSubdomainMesh
class  DirichletBoundaryCondition
struct  DirichletBoundaryConditionConfig
class  DirichletBoundaryConditionWithinTimeInterval
class  EmbeddedAnchor
class  ExtrapolatorData
class  ForwardDifferencesJacobianAssembler
 Assembles the Jacobian matrix using forward differences. More...
struct  GenericLocalAssemblerFactory
class  GenericNaturalBoundaryCondition
class  GenericNaturalBoundaryConditionLocalAssembler
class  GenericNaturalBoundaryConditionLocalAssemblerInterface
class  GMatrixPolicyType
struct  HCNonAdvectiveFreeComponentFlowBoundaryConditionData
class  HCNonAdvectiveFreeComponentFlowBoundaryConditionLocalAssembler
class  HMatrixPolicyType
struct  InitialStress
struct  IntegrationPointData
class  LocalAssemblerBuilderFactory
class  LocalAssemblerBuilderFactoryTaylorHood
class  LocalAssemblerFactoryForDimGreaterEqualN
class  LocalAssemblerFactoryTaylorHood
class  LocalAssemblerInterface
struct  MethodNotOverriddenInDerivedClassException
struct  NeumannBoundaryConditionConfig
struct  NeumannBoundaryConditionData
class  NeumannBoundaryConditionLocalAssembler
class  NodalSourceTerm
class  Output
struct  OutputConfig
struct  OutputDataSpecification
 Holds information about which variables to write to output files. More...
struct  OutputFormat
struct  OutputVTKFormat
struct  OutputXDMFHDF5Format
struct  PairRepeatEachSteps
struct  Parameter
class  PhaseFieldIrreversibleDamageOracleBoundaryCondition
class  PrimaryVariableConstraintDirichletBoundaryCondition
struct  PrimaryVariableConstraintDirichletBoundaryConditionConfig
class  Process
struct  ProcessData
class  ProcessOutputData
 Holds all data of a process that are needed for output. More...
class  ProcessVariable
struct  PythonBcData
class  PythonBoundaryCondition
 A boundary condition whose values are computed by a Python script. More...
struct  PythonBoundaryConditionConfig
class  PythonBoundaryConditionLocalAssembler
class  PythonBoundaryConditionLocalAssemblerInterface
class  PythonBoundaryConditionPythonSideInterface
class  PythonBoundaryConditionPythonSideInterfaceTrampoline
class  ReleaseNodalForce
 Boundary condition for simulating excavation using the release nodal force approach. More...
struct  RobinBoundaryConditionConfig
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  SolutionDependentDirichletBoundaryCondition
struct  SolutionDependentDirichletBoundaryConditionConfig
class  SourceTerm
class  SourceTermBase
class  SourceTermCollection
struct  SourceTermConfig
struct  SourceTermIntegrationPointData
class  SubmeshAssemblySupport
struct  SubmeshResiduumOutputConfig
class  SurfaceFlux
struct  SurfaceFluxData
class  SurfaceFluxLocalAssembler
class  SurfaceFluxLocalAssemblerInterface
class  TimeDecayDirichletBoundaryCondition
 Dirichlet boundary condition with time-dependent decay. More...
struct  TimeDecayDirichletBoundaryConditionConfig
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
struct  VariableDependentNeumannConfig
class  VectorMatrixAssembler
class  VolumetricSourceTerm
class  VolumetricSourceTermLocalAssembler
class  VolumetricSourceTermLocalAssemblerInterface
struct  WellboreCompensateCoefficients
struct  WellboreCompensateNeumannBoundaryConditionData
class  WellboreCompensateNeumannBoundaryConditionLocalAssembler

Typedefs

using HCNonAdvectiveFreeComponentFlowBoundaryCondition
using NeumannBoundaryCondition
using RobinBoundaryCondition
using VariableDependentNeumannBoundaryCondition
using WellboreCompensateNeumannBoundaryCondition
template<typename ShpPol, unsigned NNodes, unsigned NodalDOF, int Dim>
using LocalAssemblerTraits
using EnabledElementTraitsLagrange
template<typename LocalAssemblerInterface, template< typename, int > class LocalAssemblerImplementation, NumLib::IntegrationMethodProvider IntegrationMethodProvider, int GlobalDim, typename... ConstructorArgs>
using LocalAssemblerFactory
 By default processes in OGS are defined in 1D, 2D and 3D.
template<typename LocalAssemblerInterface, template< typename, int > class LocalAssemblerImplementation, NumLib::IntegrationMethodProvider IntegrationMethodProvider, int GlobalDim, typename... ConstructorArgs>
using LocalAssemblerFactorySD
 Mechanics processes in OGS are defined in 2D and 3D only.
template<typename LocalAssemblerInterface, template< typename, typename, int > class LocalAssemblerImplementation, NumLib::IntegrationMethodProvider IntegrationMethodProvider, int GlobalDim, typename... ConstructorArgs>
using LocalAssemblerFactoryHM
 HM processes in OGS are defined for linear and higher order elements.
template<typename LocalAssemblerInterface, template< typename, typename, int > class LocalAssemblerImplementation, NumLib::IntegrationMethodProvider IntegrationMethodProvider, int GlobalDim, typename... ConstructorArgs>
using LocalAssemblerFactoryStokes
 Stokes flow in OGS is defined for higher order elements only.
using Trafo = ProcessLib::TrafoScale

Enumerations

enum class  OutputType : uint8_t { vtk , xdmf }

Functions

ConstraintDirichletBoundaryConditionConfig parseConstraintDirichletBoundaryCondition (BaseLib::ConfigTree const &config)
std::unique_ptr< ConstraintDirichletBoundaryConditioncreateConstraintDirichletBoundaryCondition (ConstraintDirichletBoundaryConditionConfig 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)
template<int GlobalDim>
std::unique_ptr< SourceTermcreateAnchorTerm (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, std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const &parameters)
template std::unique_ptr< SourceTermcreateAnchorTerm< 2 > (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, std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const &parameters)
template std::unique_ptr< SourceTermcreateAnchorTerm< 3 > (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, std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const &parameters)
std::vector< std::unique_ptr< BoundaryCondition > > 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, std::vector< std::reference_wrapper< ProcessVariable > > const &all_process_variables_for_this_process, std::map< int, std::shared_ptr< MaterialPropertyLib::Medium > > const &media)
DirichletBoundaryConditionConfig parseDirichletBoundaryConditionWithinTimeIntervalConfig (BaseLib::ConfigTree const &config)
std::unique_ptr< BoundaryConditioncreateDirichletBoundaryConditionWithinTimeInterval (DirichletBoundaryConditionConfig const &config_args, 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)
template<int GlobalDim>
std::unique_ptr< SourceTermBasecreateEmbeddedAnchor (BaseLib::ConfigTree const &config, MeshLib::Mesh const &st_mesh, MeshLib::Mesh const &bulk_mesh, NumLib::LocalToGlobalIndexMap const &dof_table_bulk, std::size_t const source_term_mesh_id, const int variable_id)
template std::unique_ptr< SourceTermBasecreateEmbeddedAnchor< 2 > (BaseLib::ConfigTree const &config, MeshLib::Mesh const &st_mesh, MeshLib::Mesh const &bulk_mesh, NumLib::LocalToGlobalIndexMap const &dof_table_bulk, std::size_t const source_term_mesh_id, const int variable_id)
template std::unique_ptr< SourceTermBasecreateEmbeddedAnchor< 3 > (BaseLib::ConfigTree const &config, MeshLib::Mesh const &st_mesh, MeshLib::Mesh const &bulk_mesh, NumLib::LocalToGlobalIndexMap const &dof_table_bulk, std::size_t const source_term_mesh_id, const int variable_id)
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::string parseReleaseNodalForce (BoundaryConditionConfig const &bc_config)
std::unique_ptr< BoundaryConditioncreateReleaseNodalForce (unsigned const global_dim, int const variable_id, std::string const &decay_parameter_name, BoundaryConditionConfig const &bc_config, MeshLib::Mesh const &bc_mesh, NumLib::LocalToGlobalIndexMap const &dof_table_bulk, std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const &parameters)
std::unique_ptr< SourceTermBasecreateSourceTerm (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::vector< std::reference_wrapper< ProcessVariable > > const &all_process_variables_for_this_process, const MeshLib::Mesh &bulk_mesh)
TimeDecayDirichletBoundaryConditionConfig parseTimeDecayDirichletBoundaryConditionConfig (BaseLib::ConfigTree const &config)
std::unique_ptr< BoundaryConditioncreateTimeDecayDirichletBoundaryCondition (TimeDecayDirichletBoundaryConditionConfig const &config, int const variable_id, int const component_id, MeshLib::Mesh const &bc_mesh, NumLib::LocalToGlobalIndexMap const &dof_table_bulk, std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const &parameters)
std::unique_ptr< SourceTermcreateVolumetricSourceTerm (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::string parseDirichletBCConfig (BaseLib::ConfigTree const &config)
std::unique_ptr< DirichletBoundaryConditioncreateDirichletBoundaryCondition (std::string const &parameter_name, 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< std::size_t > 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)
void getEssentialBCValuesLocal (ParameterLib::Parameter< double > const &parameter, MeshLib::Mesh const &bc_mesh, NumLib::LocalToGlobalIndexMap const &dof_table_boundary, int const variable_id, int const component_id, const double t, GlobalVector const &x, NumLib::IndexValueVector< GlobalIndexType > &bc_values)
template<int GlobalDim>
auto nodeLocalIndices (std::size_t const i)
template<int GlobalDim>
Eigen::RowVectorXd computeShapeMatrix (MeshLib::Element const &bulk_element, std::span< double const, 3 > const nat_coords)
template<int GlobalDim>
std::tuple< Eigen::VectorXd, Eigen::MatrixXd > assembleLocalBJac (Eigen::Vector< double, GlobalDim > const &f, Eigen::Matrix< double, GlobalDim, GlobalDim > const &Df, std::vector< Eigen::RowVectorXd > const &shape_matrices, std::size_t const num_dof, std::array< std::size_t, 2 > const &nodes_per_element)
std::string parseHCNonAdvectiveFreeComponentFlowBoundaryCondition (BaseLib::ConfigTree const &config)
std::unique_ptr< HCNonAdvectiveFreeComponentFlowBoundaryConditioncreateHCNonAdvectiveFreeComponentFlowBoundaryCondition (std::string const &boundary_permeability_name, 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)
NeumannBoundaryConditionConfig parseNeumannBoundaryCondition (BaseLib::ConfigTree const &config)
std::unique_ptr< NeumannBoundaryConditioncreateNeumannBoundaryCondition (NeumannBoundaryConditionConfig 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)
void parsePhaseFieldIrreversibleDamageOracleBoundaryCondition (BaseLib::ConfigTree const &config)
std::unique_ptr< PhaseFieldIrreversibleDamageOracleBoundaryConditioncreatePhaseFieldIrreversibleDamageOracleBoundaryCondition (NumLib::LocalToGlobalIndexMap const &dof_table, MeshLib::Mesh const &mesh, int const variable_id, int const component_id)
PrimaryVariableConstraintDirichletBoundaryConditionConfig parsePrimaryVariableConstraintDirichletBoundaryCondition (BaseLib::ConfigTree const &config)
std::unique_ptr< PrimaryVariableConstraintDirichletBoundaryConditioncreatePrimaryVariableConstraintDirichletBoundaryCondition (PrimaryVariableConstraintDirichletBoundaryConditionConfig 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)
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.
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, std::vector< std::reference_wrapper< ProcessVariable > > const &all_process_variables_for_this_process)
PythonBoundaryConditionConfig parsePythonBoundaryCondition (BaseLib::ConfigTree const &config)
std::unique_ptr< PythonBoundaryConditioncreatePythonBoundaryCondition (PythonBoundaryConditionConfig const &config, MeshLib::Mesh const &boundary_mesh, NumLib::LocalToGlobalIndexMap const &dof_table_bulk, MeshLib::Mesh const &bulk_mesh, int const variable_id, int const component_id, unsigned const integration_order, unsigned const shapefunction_order, std::vector< std::reference_wrapper< ProcessVariable > > const &all_process_variables_for_this_process)
 Creates a new PythonBoundaryCondition object.
void pythonBindBoundaryCondition (pybind11::module &m)
 Creates Python bindings for the Python BC class.
RobinBoundaryConditionConfig parseRobinBoundaryCondition (BaseLib::ConfigTree const &config)
std::unique_ptr< RobinBoundaryConditioncreateRobinBoundaryCondition (RobinBoundaryConditionConfig 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)
SolutionDependentDirichletBoundaryConditionConfig parseSolutionDependentDirichletBoundaryCondition (BaseLib::ConfigTree const &config)
std::unique_ptr< SolutionDependentDirichletBoundaryConditioncreateSolutionDependentDirichletBoundaryCondition (SolutionDependentDirichletBoundaryConditionConfig const &config, MeshLib::Mesh const &bc_mesh, NumLib::LocalToGlobalIndexMap const &dof_table_bulk, int const variable_id, int const component_id, std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const &parameters)
std::unique_ptr< NumLib::LocalToGlobalIndexMapcreateBoundaryDOFTable (int const variable_id, int const component_id, MeshLib::Mesh const &boundary_mesh, NumLib::LocalToGlobalIndexMap const &dof_table_bulk)
VariableDependentNeumannConfig parseVariableDependentNeumannBoundaryCondition (BaseLib::ConfigTree const &config)
std::unique_ptr< VariableDependentNeumannBoundaryConditioncreateVariableDependentNeumannBoundaryCondition (VariableDependentNeumannConfig const &coefficients, 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)
WellboreCompensateCoefficients parseWellboreCompensateNeumannBoundaryCondition (BaseLib::ConfigTree const &config)
std::unique_ptr< WellboreCompensateNeumannBoundaryConditioncreateWellboreCompensateNeumannBoundaryCondition (WellboreCompensateCoefficients const &coefficients, 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::map< int, std::shared_ptr< MaterialPropertyLib::Medium > > const &media)
template<int DisplacementDim>
InitialStress createInitialStress (BaseLib::ConfigTree const &config, std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const &parameters, MeshLib::Mesh const &mesh, bool const mandatory_stress_type)
template InitialStress createInitialStress< 2 > (BaseLib::ConfigTree const &config, std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const &parameters, MeshLib::Mesh const &mesh, bool const mandatory_stress_type)
template InitialStress createInitialStress< 3 > (BaseLib::ConfigTree const &config, std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const &parameters, MeshLib::Mesh const &mesh, bool const mandatory_stress_type)
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< AbstractJacobianAssemblercreateCentralDifferencesJacobianAssembler (BaseLib::ConfigTree const &config)
template<typename IsActive>
static std::pair< std::vector< std::size_t >, std::vector< std::size_t > > extractInnerAndOuterNodes (MeshLib::Mesh const &mesh, MeshLib::Mesh const &sub_mesh, IsActive is_active)
static std::vector< std::vector< std::size_t > > extractElementsAlongOuterNodes (MeshLib::Mesh const &mesh, MeshLib::Mesh const &sub_mesh, std::vector< std::size_t > const &outer_nodes)
static DeactivatedSubdomainMesh createDeactivatedSubdomainMesh (MeshLib::Mesh const &mesh, std::unordered_set< int > const &deactivated_subdomain_material_ids)
static MathLib::PiecewiseLinearInterpolation parseTimeIntervalOrCurve (std::optional< BaseLib::ConfigTree > const &time_interval_config, std::optional< std::string > const &curve_name, std::map< std::string, std::unique_ptr< MathLib::PiecewiseLinearInterpolation > > const &curves)
static std::pair< Eigen::Vector3d, Eigen::Vector3d > parseLineSegment (BaseLib::ConfigTree const &config)
 Returns a line segment represented by its begin and end points.
static detail::Ball parseBall (BaseLib::ConfigTree const &config)
 Returns a ball represented by its center and its radius.
DeactivatedSubdomain createDeactivatedSubdomain (BaseLib::ConfigTree const &config, MeshLib::Mesh const &mesh, std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const &parameters, std::map< std::string, std::unique_ptr< MathLib::PiecewiseLinearInterpolation > > const &curves)
std::vector< DeactivatedSubdomaincreateDeactivatedSubdomains (BaseLib::ConfigTree const &config, MeshLib::Mesh const &mesh, std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const &parameters, std::map< std::string, std::unique_ptr< MathLib::PiecewiseLinearInterpolation > > const &curves)
std::unique_ptr< AbstractJacobianAssemblercreateForwardDifferencesJacobianAssembler (BaseLib::ConfigTree const &config)
std::unique_ptr< AbstractJacobianAssemblercreateJacobianAssembler (std::optional< BaseLib::ConfigTree > const &config)
static std::unique_ptr< ProcessDatamakeProcessData (std::unique_ptr< NumLib::TimeStepAlgorithm > &&timestepper, NumLib::NonlinearSolverBase &nonlinear_solver, int const process_id, std::string process_name, 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, bool const compensate_non_equilibrium_initial_residuum, std::vector< double > const &fixed_times_for_output)
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 > > &meshes, bool const compensate_non_equilibrium_initial_residuum)
 Builds a TimeLoop from the given configuration.
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.
void addProcessDataToMesh (NumLib::Time const &t, std::vector< GlobalVector * > const &xs, int const process_id, ProcessOutputData const &process_output_data, bool const output_secondary_variables, OutputDataSpecification const &process_output)
template<int dim, typename LAIntf>
void computeCellAverages (CellAverageData &cell_average_data, std::vector< std::unique_ptr< LAIntf > > const &local_assemblers)
std::unique_ptr< OutputFormatcreateOutputFormat (std::string const &output_directory, OutputType const output_type, std::string prefix, std::string suffix, std::string const &data_mode, bool const compress_output, unsigned int const number_of_files, unsigned int const chunk_size_bytes)
Output createOutput (OutputConfig &&oc, std::string const &output_directory, std::vector< std::unique_ptr< MeshLib::Mesh > > const &meshes)
std::vector< OutputcreateOutput (const BaseLib::ConfigTree &config, std::string const &output_directory, std::vector< std::unique_ptr< MeshLib::Mesh > > &meshes)
std::vector< OutputcreateOutputs (const BaseLib::ConfigTree &output_configs, std::string const &output_directory, std::vector< std::unique_ptr< MeshLib::Mesh > > &meshes)
OutputConfig createOutputConfig (const BaseLib::ConfigTree &config, std::vector< std::unique_ptr< MeshLib::Mesh > > &meshes)
void createSecondaryVariables (BaseLib::ConfigTree const &config, SecondaryVariableCollection &secondary_variables)
void addBulkMeshPropertyToSubMesh (MeshLib::Mesh const &bulk_mesh, MeshLib::Mesh &sub_mesh, std::string const &property_name)
std::vector< double > calculateUniqueFixedTimesForAllOutputs (std::vector< Output > const &outputs)
std::ostream & operator<< (std::ostream &os, Output const &output)
std::ostream & operator<< (std::ostream &os, PairRepeatEachSteps const &pair)
std::ostream & operator<< (std::ostream &os, OutputDataSpecification const &o)
void outputMeshVtk (std::string const &file_name, MeshLib::Mesh const &mesh, bool const compress_output, int const data_mode)
void outputMeshVtk (OutputVTKFormat const &output_file, MeshLib::IO::PVDFile &pvd_file, MeshLib::Mesh const &mesh, double const t, int const timestep, int const iteration, bool const converged)
std::ostream & operator<< (std::ostream &os, OutputFormat const &of)
ProcessOutputData createProcessOutputData (Process const &process, std::size_t const n_processes, MeshLib::Mesh &output_mesh)
 Extracts data necessary for output from the given process.
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)
template<typename LocalAssemblerCollection, typename IPDataAccessor>
SecondaryVariableFunctions makeExtrapolator2 (const unsigned num_components, NumLib::Extrapolator &extrapolator, LocalAssemblerCollection const &local_assemblers, IPDataAccessor &&accessor)
SubmeshResiduumOutputConfig createSubmeshResiduumOutputConfig (BaseLib::ConfigTree const &config, std::string const &output_directory, std::vector< std::unique_ptr< MeshLib::Mesh > > &meshes)
void setEquationSystem (ProcessData const &process_data)
void preTimestepForAllProcesses (NumLib::Time const &t, double const dt, std::vector< std::unique_ptr< ProcessData > > const &per_process_data, std::vector< GlobalVector * > const &_process_solutions)
void postTimestepForAllProcesses (NumLib::Time const &t, double const dt, std::vector< std::unique_ptr< ProcessData > > const &per_process_data, std::vector< GlobalVector * > const &process_solutions, std::vector< GlobalVector * > const &process_solutions_prev)
template<NumLib::ODESystemTag ODETag>
void setTimeDiscretizedODESystem (ProcessData &process_data, NumLib::ODESystem< ODETag, NumLib::NonlinearSolverTag::Picard > &ode_sys)
void setTimeDiscretizedODESystem (ProcessData &process_data)
std::pair< std::vector< GlobalVector * >, std::vector< GlobalVector * > > setInitialConditions (NumLib::Time 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 * > const &process_solutions, std::vector< GlobalVector * > const &process_solutions_prev)
NumLib::NonlinearSolverStatus solveOneTimeStepOneProcess (std::vector< GlobalVector * > &x, std::vector< GlobalVector * > const &x_prev, std::size_t const timestep, double const t, double const delta_t, ProcessData const &process_data, std::vector< Output > const &outputs)
bool computationOfChangeNeeded (NumLib::TimeStepAlgorithm const &timestep_algorithm, NumLib::Time const &time)
static NumLib::NonlinearSolverStatus solveMonolithicProcess (const NumLib::Time &t, const double dt, const std::size_t timestep_id, ProcessData const &process_data, std::vector< GlobalVector * > &x, std::vector< GlobalVector * > const &x_prev, std::vector< Output > const &outputs)
GlobalVector computeResiduum (double const dt, GlobalVector const &x, GlobalVector const &x_prev, GlobalMatrix const &M, GlobalMatrix const &K, GlobalVector const &b)
template<int GlobalDim, template< typename, int > class LocalAssemblerImplementation, typename LocalAssemblerInterface, IntegrationMethodProviderOrIntegrationOrder ProviderOrOrder, typename... ExtraCtorArgs>
void createLocalAssemblers (std::vector< MeshLib::Element * > const &mesh_elements, NumLib::LocalToGlobalIndexMap const &dof_table, std::vector< std::unique_ptr< LocalAssemblerInterface > > &local_assemblers, ProviderOrOrder const &provider_or_order, ExtraCtorArgs &&... extra_ctor_args)
template<template< typename, int > class LocalAssemblerImplementation, typename LocalAssemblerInterface, IntegrationMethodProviderOrIntegrationOrder ProviderOrOrder, typename... ExtraCtorArgs>
void createLocalAssemblers (const unsigned dimension, std::vector< MeshLib::Element * > const &mesh_elements, NumLib::LocalToGlobalIndexMap const &dof_table, std::vector< std::unique_ptr< LocalAssemblerInterface > > &local_assemblers, ProviderOrOrder const &provider_or_order, ExtraCtorArgs &&... extra_ctor_args)
template<int GlobalDim, template< typename, typename, int > class LocalAssemblerImplementation, typename LocalAssemblerInterface, IntegrationMethodProviderOrIntegrationOrder ProviderOrOrder, typename... ExtraCtorArgs>
void createLocalAssemblersHM (std::vector< MeshLib::Element * > const &mesh_elements, NumLib::LocalToGlobalIndexMap const &dof_table, std::vector< std::unique_ptr< LocalAssemblerInterface > > &local_assemblers, ProviderOrOrder const &provider_or_order, ExtraCtorArgs &&... extra_ctor_args)
template<int GlobalDim, template< typename, typename, int > class LocalAssemblerImplementation, typename LocalAssemblerInterface, IntegrationMethodProviderOrIntegrationOrder ProviderOrOrder, typename... ExtraCtorArgs>
void createLocalAssemblersStokes (std::vector< MeshLib::Element * > const &mesh_elements, NumLib::LocalToGlobalIndexMap const &dof_table, std::vector< std::unique_ptr< LocalAssemblerInterface > > &local_assemblers, ProviderOrOrder const &provider_or_order, ExtraCtorArgs &&... extra_ctor_args)
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, bool const optional)
std::string_view removeIPFieldDataNameSuffix (std::string_view const name)
 Removes the suffix '_ip' from the passed field name.
template<typename LocalAssemblersVector>
void setIPDataInitialConditions (std::vector< std::unique_ptr< MeshLib::IntegrationPointWriter > > const &_integration_point_writer, MeshLib::Properties const &mesh_properties, LocalAssemblersVector &local_assemblers)
template<int DisplacementDim, typename IntegrationPointDataVector, typename IpData, typename MemberType>
std::vector< double > const & getIntegrationPointDimMatrixData (IntegrationPointDataVector const &ip_data_vector, MemberType IpData::*const member, std::vector< double > &cache)
template<int DisplacementDim, typename IntegrationPointDataVector, typename Accessor>
std::vector< double > const & getIntegrationPointDimMatrixData (IntegrationPointDataVector const &ip_data_vector, Accessor &&accessor, std::vector< double > &cache)
template<int DisplacementDim, typename IntegrationPointDataVector, typename IpData, typename MemberType>
std::vector< double > const & getIntegrationPointKelvinVectorData (IntegrationPointDataVector const &ip_data_vector, MemberType IpData::*const member, std::vector< double > &cache)
template<int DisplacementDim, typename IntegrationPointDataVector, typename Accessor>
std::vector< double > const & getIntegrationPointKelvinVectorData (IntegrationPointDataVector const &ip_data_vector, Accessor &&accessor, std::vector< double > &cache)
template<int DisplacementDim, typename IntegrationPointDataVector, typename MemberType>
std::vector< double > getIntegrationPointKelvinVectorData (IntegrationPointDataVector const &ip_data_vector, MemberType member)
template<int DisplacementDim, typename IntegrationPointDataVector, typename IpData, typename MemberType>
std::size_t setIntegrationPointKelvinVectorData (double const *values, IntegrationPointDataVector &ip_data_vector, MemberType IpData::*const member)
template<int DisplacementDim, typename IntegrationPointDataVector, typename Accessor>
std::size_t setIntegrationPointKelvinVectorData (double const *values, IntegrationPointDataVector &ip_data_vector, Accessor &&accessor)
template<typename IntegrationPointDataVector, typename IpData, typename MemberType>
std::vector< double > const & getIntegrationPointScalarData (IntegrationPointDataVector const &ip_data_vector, MemberType IpData::*const member, std::vector< double > &cache)
template<typename IntegrationPointDataVector, typename Accessor>
std::vector< double > const & getIntegrationPointScalarData (IntegrationPointDataVector const &ip_data_vector, Accessor &&accessor, std::vector< double > &cache)
template<typename IntegrationPointDataVector, typename IpData, typename MemberType>
std::size_t setIntegrationPointScalarData (double const *values, IntegrationPointDataVector &ip_data_vector, MemberType IpData::*const member)
template<typename IntegrationPointDataVector, typename Accessor>
std::size_t setIntegrationPointScalarData (double const *values, IntegrationPointDataVector &ip_data_vector, Accessor &&accessor)
template<typename IntegrationPointDataVector, typename MemberType, typename MaterialStateVariables>
std::vector< double > getIntegrationPointDataMaterialStateVariables (IntegrationPointDataVector const &ip_data_vector, MemberType member, std::function< std::span< double >(MaterialStateVariables &)> get_values_span, int const n_components)
template<typename IntegrationPointDataVector, typename MemberType, typename MaterialStateVariables>
std::size_t setIntegrationPointDataMaterialStateVariables (double const *values, IntegrationPointDataVector &ip_data_vector, MemberType member, std::function< std::span< double >(MaterialStateVariables &)> get_values_span)
template<int Components, typename StoreValuesFunction>
std::vector< double > transposeInPlace (StoreValuesFunction const &store_values_function)
template<int Components>
void transposeInPlace (std::vector< double > &values)
void transposeInPlace (std::vector< double > &values, unsigned const num_components)

Variables

static constexpr std::string_view timestepper_cannot_reduce_dt

Typedef Documentation

◆ EnabledElementTraitsLagrange

Initial value:

List of all element types for which the local assemblers of OGS processes will be compiled.

Definition at line 112 of file EnabledElements.h.

◆ HCNonAdvectiveFreeComponentFlowBoundaryCondition

◆ LocalAssemblerFactory

template<typename LocalAssemblerInterface, template< typename, int > class LocalAssemblerImplementation, NumLib::IntegrationMethodProvider IntegrationMethodProvider, int GlobalDim, typename... ConstructorArgs>
using ProcessLib::LocalAssemblerFactory
Initial value:

By default processes in OGS are defined in 1D, 2D and 3D.

Definition at line 82 of file LocalAssemblerFactoryForDimGreaterEqualN.h.

◆ LocalAssemblerFactoryHM

template<typename LocalAssemblerInterface, template< typename, typename, int > class LocalAssemblerImplementation, NumLib::IntegrationMethodProvider IntegrationMethodProvider, int GlobalDim, typename... ConstructorArgs>
using ProcessLib::LocalAssemblerFactoryHM
Initial value:
2 ,
LocalAssemblerImplementation,
IntegrationMethodProvider,
GlobalDim,
ConstructorArgs...>

HM processes in OGS are defined for linear and higher order elements.

Definition at line 167 of file LocalAssemblerFactoryTaylorHood.h.

◆ LocalAssemblerFactorySD

template<typename LocalAssemblerInterface, template< typename, int > class LocalAssemblerImplementation, NumLib::IntegrationMethodProvider IntegrationMethodProvider, int GlobalDim, typename... ConstructorArgs>
using ProcessLib::LocalAssemblerFactorySD
Initial value:
LocalAssemblerImplementation,
IntegrationMethodProvider,
GlobalDim,
ConstructorArgs...>

Mechanics processes in OGS are defined in 2D and 3D only.

Definition at line 97 of file LocalAssemblerFactoryForDimGreaterEqualN.h.

◆ LocalAssemblerFactoryStokes

template<typename LocalAssemblerInterface, template< typename, typename, int > class LocalAssemblerImplementation, NumLib::IntegrationMethodProvider IntegrationMethodProvider, int GlobalDim, typename... ConstructorArgs>
using ProcessLib::LocalAssemblerFactoryStokes
Initial value:
2 ,
LocalAssemblerImplementation,
IntegrationMethodProvider,
GlobalDim,
ConstructorArgs...>

Stokes flow in OGS is defined for higher order elements only.

Definition at line 185 of file LocalAssemblerFactoryTaylorHood.h.

◆ LocalAssemblerTraits

template<typename ShpPol, unsigned NNodes, unsigned NodalDOF, int Dim>
using ProcessLib::LocalAssemblerTraits

◆ NeumannBoundaryCondition

◆ RobinBoundaryCondition

◆ Trafo

◆ VariableDependentNeumannBoundaryCondition

◆ WellboreCompensateNeumannBoundaryCondition

Enumeration Type Documentation

◆ OutputType

enum class ProcessLib::OutputType : uint8_t
strong
Enumerator
vtk 
xdmf 

Definition at line 14 of file OutputConfig.h.

Function Documentation

◆ addBulkMeshPropertyToSubMesh()

void ProcessLib::addBulkMeshPropertyToSubMesh ( MeshLib::Mesh const & bulk_mesh,
MeshLib::Mesh & sub_mesh,
std::string const & property_name )

Definition at line 25 of file ProcessLib/Output/Output.cpp.

28{
29 if (bulk_mesh == sub_mesh)
30 {
31 return;
32 }
33
34 if (!bulk_mesh.getProperties().existsPropertyVector<double>(
35 std::string_view(property_name)))
36 {
37 return;
38 }
39 auto const& bulk_mesh_property =
40 *bulk_mesh.getProperties().getPropertyVector<double>(
41 std::string_view(property_name));
42 auto const mesh_item_type = bulk_mesh_property.getMeshItemType();
43
44 std::string_view mesh_item_type_string =
45 [mesh_item_type, &property_name]() -> std::string_view
46 {
47 switch (mesh_item_type)
48 {
51 break;
54 break;
56 WARN(
57 "Property '{}' is assigned to edges. But mappings from the "
58 "bulk edges to submesh edges isn't implemented. Mesh item "
59 "type 'Edge' is not supported, only 'Node' and 'Cell' are "
60 "implemented at the moment.",
61 property_name);
62 return "";
63 break;
65 WARN(
66 "Property '{}' is assigned to faces. But mappings from the "
67 "bulk faces to submesh faces isn't implemented. Mesh item "
68 "type 'Face' is not supported, only 'Node' and 'Cell' are "
69 "implemented at the moment.",
70 property_name);
71 return "";
72 break;
74 WARN(
75 "Property '{}' is assigned to integration points. But "
76 "mappings from the bulk integration points to submesh "
77 "integration points isn't implemented. Mesh item type "
78 "'IntegrationPoint' is not supported, only 'Node' and "
79 "'Cell' are implemented at the moment.",
80 property_name);
81 return "";
82 break;
83 default:
84 OGS_FATAL("Unknown mesh item type '{}'.",
85 static_cast<int>(mesh_item_type));
86 return "";
87 }
88 }();
89
90 if (mesh_item_type_string.empty())
91 {
92 return;
93 }
94 if (!sub_mesh.getProperties().existsPropertyVector<std::size_t>(
95 mesh_item_type_string, mesh_item_type, 1))
96 {
97 WARN(
98 "The property {} is required for output on the mesh {}, but it "
99 "doesn't exist.",
100 mesh_item_type_string, sub_mesh.getName());
101 return;
102 }
103
104 auto const& bulk_ids =
105 *sub_mesh.getProperties().getPropertyVector<std::size_t>(
106 mesh_item_type_string);
107
108 auto const number_of_components =
109 bulk_mesh_property.getNumberOfGlobalComponents();
110 auto& sub_mesh_property = *MeshLib::getOrCreateMeshProperty<double>(
111 sub_mesh, property_name, mesh_item_type, number_of_components);
112
113 for (std::size_t sub_mesh_node_id = 0;
114 sub_mesh_node_id < bulk_ids.getNumberOfTuples();
115 ++sub_mesh_node_id)
116 {
117 auto const& bulk_id = bulk_ids[sub_mesh_node_id];
118 for (std::remove_cv_t<decltype(number_of_components)> c = 0;
119 c < number_of_components;
120 ++c)
121 {
122 sub_mesh_property.getComponent(sub_mesh_node_id, c) =
123 bulk_mesh_property.getComponent(bulk_id, c);
124 }
125 }
126}
#define OGS_FATAL(...)
Definition Error.h:19
void WARN(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:34
Properties & getProperties()
Definition Mesh.h:125
const std::string getName() const
Get name of the mesh.
Definition Mesh.h:94
bool existsPropertyVector(std::string_view name) const
PropertyVector< T > const * getPropertyVector(std::string_view name) const
int getNumberOfGlobalComponents() const
PropertyVector< T > * getOrCreateMeshProperty(Mesh &mesh, std::string const &property_name, MeshItemType const item_type, int const number_of_components)
constexpr std::string_view getBulkIDString(MeshItemType mesh_item_type)

References MeshLib::Cell, MeshLib::Edge, MeshLib::Properties::existsPropertyVector(), MeshLib::Face, MeshLib::getBulkIDString(), MeshLib::PropertyVectorBase::getMeshItemType(), MeshLib::Mesh::getName(), MeshLib::PropertyVectorBase::getNumberOfGlobalComponents(), MeshLib::getOrCreateMeshProperty(), MeshLib::Mesh::getProperties(), MeshLib::Properties::getPropertyVector(), MeshLib::IntegrationPoint, MeshLib::Node, OGS_FATAL, and WARN().

Referenced by ProcessLib::Output::prepareSubmesh().

◆ addProcessDataToMesh()

void ProcessLib::addProcessDataToMesh ( NumLib::Time const & t,
std::vector< GlobalVector * > const & xs,
int const process_id,
ProcessOutputData const & process_output_data,
bool const output_secondary_variables,
OutputDataSpecification const & process_output )

Adds output data to a mesh.

Note
The mesh is passed via process_output_data.

Definition at line 370 of file AddProcessDataToMesh.cpp.

376{
377 DBUG("Process output data.");
378
379 auto const& pod = process_output_data;
380 auto const& process_variables = pod.getProcessVariables(process_id);
381 auto const& secondary_variables = pod.getSecondaryVariables();
382 auto const* const integration_point_writers =
383 pod.getIntegrationPointWriters();
384 auto const& bulk_mesh_dof_table = pod.getBulkMeshDofTable(process_id);
385 auto const& output_mesh_dof_table = pod.getOutputMeshDofTable(process_id);
386 auto& output_mesh = pod.getOutputMesh();
387
388 auto const& output_variables = process_output.output_variables;
389
390 addOgsVersion(output_mesh);
391
392 auto names_of_already_output_variables = addPrimaryVariablesToMesh(
393 output_mesh, *xs[process_id], process_variables, output_variables,
394 output_mesh_dof_table, bulk_mesh_dof_table);
395
396 if (output_secondary_variables)
397 {
398 auto const& output_mesh_dof_tables =
399 pod.getOutputMeshDofTablesOfAllProcesses();
400
401 addSecondaryVariablesToMesh(secondary_variables,
402 names_of_already_output_variables, t, xs,
403 output_mesh, output_mesh_dof_tables,
404 process_output.output_residuals);
405 }
406
407 if (integration_point_writers)
408 {
409 addIntegrationPointDataToMesh(output_mesh, *integration_point_writers);
410 }
411}
static std::set< std::string > addPrimaryVariablesToMesh(MeshLib::Mesh &mesh, GlobalVector const &x, std::vector< std::reference_wrapper< ProcessLib::ProcessVariable > > const &process_variables, std::set< std::string > const &output_variables, NumLib::LocalToGlobalIndexMap const &dof_table, NumLib::LocalToGlobalIndexMap const &bulk_mesh_dof_table)
static void addSecondaryVariablesToMesh(ProcessLib::SecondaryVariableCollection const &secondary_variables, std::set< std::string > &names_of_already_output_variables, NumLib::Time const &t, std::vector< GlobalVector * > const &xs, MeshLib::Mesh &mesh, std::vector< NumLib::LocalToGlobalIndexMap const * > const &dof_tables, bool const output_residuals)
static void addOgsVersion(MeshLib::Mesh &mesh)
void DBUG(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:22

References addOgsVersion(), addPrimaryVariablesToMesh(), addSecondaryVariablesToMesh(), DBUG(), ProcessLib::ProcessOutputData::getProcessVariables(), ProcessLib::OutputDataSpecification::output_residuals, and ProcessLib::OutputDataSpecification::output_variables.

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

◆ assembleLocalBJac()

template<int GlobalDim>
std::tuple< Eigen::VectorXd, Eigen::MatrixXd > ProcessLib::assembleLocalBJac ( Eigen::Vector< double, GlobalDim > const & f,
Eigen::Matrix< double, GlobalDim, GlobalDim > const & Df,
std::vector< Eigen::RowVectorXd > const & shape_matrices,
std::size_t const num_dof,
std::array< std::size_t, 2 > const & nodes_per_element )

Definition at line 77 of file EmbeddedAnchor.cpp.

83{
84 // Signs for the two nodes alternate.
85 constexpr auto even_odd_sign = [](std::size_t const n)
86 { return (n % 2 == 0) ? 1.0 : -1.0; };
87
88 Eigen::VectorXd local_rhs(num_dof);
89 Eigen::MatrixXd local_Jac(num_dof, num_dof);
90 local_rhs.setZero();
91 local_Jac.setZero();
92
93 for (std::size_t node_idx = 0; node_idx < 2; ++node_idx)
94 {
95 // Select the correct block according to the node index.
96 // Replicate shape matrices of the corresponding element to GlobalDim
97 // dimensions. Multiply component-wise with the force vector f.
98 local_rhs.segment(node_idx * GlobalDim * nodes_per_element[0],
99 GlobalDim * nodes_per_element[node_idx]) =
100 even_odd_sign(node_idx) *
101 shape_matrices[node_idx]
102 .transpose()
103 .replicate<GlobalDim, 1>()
104 .cwiseProduct(f.transpose()
105 .replicate(nodes_per_element[node_idx], 1)
106 .reshaped());
107 for (std::size_t node_idx_inner = 0; node_idx_inner < 2;
108 ++node_idx_inner)
109 {
110 Eigen::MatrixXd const& ones = Eigen::MatrixXd::Ones(
111 nodes_per_element[node_idx], nodes_per_element[node_idx_inner]);
112
113 // Select the correct block according to the node index.
114 // Replicate shape matrices of the corresponding element to
115 // GlobalDim dimensions. Multiply component-wise with the derivative
116 // Df of force vector f.
117 local_Jac.block(node_idx * GlobalDim * nodes_per_element[0],
118 node_idx_inner * GlobalDim * nodes_per_element[0],
119 GlobalDim * nodes_per_element[node_idx],
120 GlobalDim * nodes_per_element[node_idx_inner]) =
121 (even_odd_sign(node_idx) *
122 shape_matrices[node_idx]
123 .transpose()
124 .replicate<GlobalDim, 1>() *
125 even_odd_sign(node_idx_inner) *
126 shape_matrices[node_idx_inner].replicate<1, GlobalDim>())
127 .cwiseProduct(kroneckerProduct(Df, ones));
128 }
129 }
130 return {local_rhs, local_Jac};
131}

Referenced by ProcessLib::EmbeddedAnchor< GlobalDim >::integrate().

◆ bheInflowpythonBindBoundaryCondition()

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

Creates BHE Inflow Python bindings for the Python BC class.

Definition at line 69 of file BHEInflowPythonBoundaryConditionModule.cpp.

70{
71 namespace py = pybind11;
72
75 pybc(m, "BHENetwork");
76
77 pybc.def(py::init());
78
79 pybc.def("initializeDataContainer",
81 initializeDataContainer);
82 pybc.def("tespySolver",
84
85 pybc.def("serverCommunicationPreTimestep",
87 serverCommunicationPreTimestep);
88
89 pybc.def("serverCommunicationPostTimestep",
91 serverCommunicationPostTimestep);
92}
virtual std::tuple< bool, bool, std::vector< double >, std::vector< double > > tespySolver(double, std::vector< double > const &, std::vector< double > const &) const

References ProcessLib::BHEInflowPythonBoundaryConditionPythonSideInterface::tespySolver().

Referenced by PYBIND11_EMBEDDED_MODULE(), and PYBIND11_MODULE().

◆ calculateNonEquilibriumInitialResiduum()

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

Definition at line 201 of file TimeLoop.cpp.

205{
206 for (auto const& process_data : per_process_data)
207 {
208 auto& nonlinear_solver = process_data->nonlinear_solver;
209
210 setEquationSystem(*process_data);
211 nonlinear_solver.calculateNonEquilibriumInitialResiduum(
212 process_solutions, process_solutions_prev,
213 process_data->process_id);
214 }
215}
void setEquationSystem(ProcessData const &process_data)

References setEquationSystem().

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

◆ calculateUniqueFixedTimesForAllOutputs()

std::vector< double > ProcessLib::calculateUniqueFixedTimesForAllOutputs ( std::vector< Output > const & outputs)

Definition at line 434 of file ProcessLib/Output/Output.cpp.

436{
437 std::vector<double> fixed_times;
438 for (auto const& output : outputs)
439 {
440 auto const& output_fixed_times = output.getFixedOutputTimes();
441 fixed_times.insert(fixed_times.end(), output_fixed_times.begin(),
442 output_fixed_times.end());
443 }
444 BaseLib::makeVectorUnique(fixed_times);
445 return fixed_times;
446}
void makeVectorUnique(std::vector< T > &v)
Definition Algorithm.h:173

References BaseLib::makeVectorUnique().

Referenced by ProcessLib::TimeLoop::calculateNextTimeStep(), createTimeLoop(), and ProcessLib::TimeLoop::initialize().

◆ 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 16 of file DirichletBoundaryConditionAuxiliaryFunctions.cpp.

21{
22 if (variable_id >=
23 static_cast<int>(dof_table_bulk.getNumberOfVariables()) ||
24 component_id >=
25 dof_table_bulk.getNumberOfVariableComponents(variable_id))
26 {
28 "Variable id or component id too high. Actual values: ({:d}, "
29 "{:d}), maximum values: ({:d}, {:d}).",
30 variable_id, component_id, dof_table_bulk.getNumberOfVariables(),
31 dof_table_bulk.getNumberOfVariableComponents(variable_id));
32 }
33
34 if (!bc_mesh.getProperties().hasPropertyVector(
36 {
38 "The required bulk node ids map does not exist in the boundary "
39 "mesh '{:s}'.",
40 bc_mesh.getName());
41 }
42
43 if (!bc_mesh.getProperties().existsPropertyVector<std::size_t>(
45 {
47 "The required bulk node ids map exists in the boundary mesh '{:s}' "
48 "but has wrong data type (should be equivalent to C++ data type "
49 "std::size_t which is an unsigned integer of size {:d} or UInt64 "
50 "in vtk terminology).",
51 bc_mesh.getName(), sizeof(std::size_t));
52 }
53
54 DBUG(
55 "Found {:d} nodes for Dirichlet BCs for the variable {:d} and "
56 "component {:d}",
57 bc_mesh.getNumberOfNodes(), variable_id, component_id);
58}

References DBUG(), MeshLib::Properties::existsPropertyVector(), MeshLib::getBulkIDString(), MeshLib::Mesh::getName(), MeshLib::Mesh::getNumberOfNodes(), NumLib::LocalToGlobalIndexMap::getNumberOfVariableComponents(), NumLib::LocalToGlobalIndexMap::getNumberOfVariables(), MeshLib::Mesh::getProperties(), MeshLib::Properties::hasPropertyVector(), MeshLib::Node, and OGS_FATAL.

Referenced by ProcessLib::DirichletBoundaryCondition::DirichletBoundaryCondition(), ProcessLib::PrimaryVariableConstraintDirichletBoundaryCondition::PrimaryVariableConstraintDirichletBoundaryCondition(), ProcessLib::SolutionDependentDirichletBoundaryCondition::SolutionDependentDirichletBoundaryCondition(), ProcessLib::DeactivatedSubdomainDirichlet::config(), ProcessLib::DirichletBoundaryConditionWithinTimeInterval::config(), and createBoundaryDOFTable().

◆ computationOfChangeNeeded()

bool ProcessLib::computationOfChangeNeeded ( NumLib::TimeStepAlgorithm const & timestep_algorithm,
NumLib::Time const & time )

Definition at line 277 of file TimeLoop.cpp.

280{
281 // for the first time step we can't compute the changes to the previous
282 // time step
283 if (time == timestep_algorithm.begin())
284 {
285 return false;
286 }
287 return timestep_algorithm.isSolutionErrorComputationNeeded();
288}

References NumLib::TimeStepAlgorithm::begin(), and NumLib::TimeStepAlgorithm::isSolutionErrorComputationNeeded().

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

◆ computeCellAverages()

template<int dim, typename LAIntf>
void ProcessLib::computeCellAverages ( CellAverageData & cell_average_data,
std::vector< std::unique_ptr< LAIntf > > const & local_assemblers )

Definition at line 38 of file CellAverageAlgorithm.h.

41{
42 auto const callback = [&cell_average_data, &local_assemblers](
43 std::string const& name,
44 unsigned const num_comp,
45 auto&& flattened_ip_data_accessor)
46 {
47 detail::computeCellAverages(cell_average_data, name, num_comp,
48 flattened_ip_data_accessor,
49 local_assemblers);
50 };
51
53 LAIntf>(
54 LAIntf::getReflectionDataForOutput(), callback);
55}
void forEachReflectedFlattenedIPDataAccessor(ReflData const &reflection_data, Callback const &callback)
void computeCellAverages(CellAverageData &cell_average_data, std::string const &name, unsigned const num_comp, auto &&flattened_ip_data_accessor, auto const &local_assemblers)

References ProcessLib::detail::computeCellAverages(), and ProcessLib::Reflection::forEachReflectedFlattenedIPDataAccessor().

Referenced by ProcessLib::LargeDeformation::LargeDeformationProcess< DisplacementDim >::computeSecondaryVariableConcrete(), ProcessLib::SmallDeformation::SmallDeformationProcess< DisplacementDim >::computeSecondaryVariableConcrete(), ProcessLib::TH2M::TH2MProcess< DisplacementDim >::computeSecondaryVariableConcrete(), and ProcessLib::ThermoRichardsMechanics::ThermoRichardsMechanicsProcess< DisplacementDim, ConstitutiveTraits >::computeSecondaryVariableConcrete().

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

47{
48 static_assert(1 < DisplacementDim && DisplacementDim <= 3,
49 "LinearHMatrix::computeHMatrix: DisplacementDim must be in "
50 "range (1,3].");
51
52 H.setZero();
53
54 for (int j = 0; j < DisplacementDim; j++)
55 {
56 H.block(j, j * NPOINTS, 1, NPOINTS) = N;
57 }
58}

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

◆ computeResiduum()

GlobalVector ProcessLib::computeResiduum ( double const dt,
GlobalVector const & x,
GlobalVector const & x_prev,
GlobalMatrix const & M,
GlobalMatrix const & K,
GlobalVector const & b )

Computes the residuum r = -M*x_dot - K*x + b. Negation for consistency with the Newton scheme.

Definition at line 10 of file ComputeResiduum.cpp.

13{
14 using namespace MathLib::LinAlg;
15 GlobalVector residuum;
16 GlobalVector x_dot;
17 copy(x, x_dot); // tmp = x
18 axpy(x_dot, -1., x_prev); // tmp = x - x_prev
19 scale(x_dot, 1. / dt); // tmp = (x - x_prev)/dt
20 matMult(M, x_dot, residuum); // r = M*x_dot
21 matMultAdd(K, x, residuum, residuum); // r = M*x_dot + K*x
22 axpy(residuum, -1., b); // r = M*x_dot + K*x - b
23 scale(residuum, -1.); // r = -r
24 return residuum;
25}
MathLib::EigenVector GlobalVector
void copy(PETScVector const &x, PETScVector &y)
Definition LinAlg.cpp:30
void matMult(PETScMatrix const &A, PETScVector const &x, PETScVector &y)
Definition LinAlg.cpp:142
void matMultAdd(PETScMatrix const &A, PETScVector const &v1, PETScVector const &v2, PETScVector &v3)
Definition LinAlg.cpp:152
void scale(PETScVector &x, PetscScalar const a)
Definition LinAlg.cpp:37
void axpy(PETScVector &y, PetscScalar const a, PETScVector const &x)
Definition LinAlg.cpp:50

References MathLib::LinAlg::axpy(), MathLib::LinAlg::copy(), MathLib::LinAlg::matMult(), MathLib::LinAlg::matMultAdd(), and MathLib::LinAlg::scale().

Referenced by ProcessLib::AssemblyMixin< Process >::assemble(), ProcessLib::LiquidFlow::LiquidFlowProcess::assembleConcreteProcess(), and ProcessLib::AssemblyMixin< Process >::assembleOnSubmeshes().

◆ computeShapeMatrix()

template<int GlobalDim>
Eigen::RowVectorXd ProcessLib::computeShapeMatrix ( MeshLib::Element const & bulk_element,
std::span< double const, 3 > const nat_coords )

Definition at line 33 of file EmbeddedAnchor.cpp.

36{
37 using ShapeMatricesType =
38 EigenDynamicShapeMatrixPolicy<void /* dummy */, -1 /* dynamic order */>;
39
40 typename ShapeMatricesType::ShapeMatrices shape_matrix(
41 bulk_element.getDimension(), GlobalDim,
42 bulk_element.getNumberOfNodes());
43
44 bool matched = false;
45
47 [&](auto* tag)
48 {
49 using ElementTrait = std::remove_pointer_t<decltype(tag)>;
50 using ShapeFunction = typename ElementTrait::ShapeFunction;
51 using MeshElement = typename ElementTrait::Element;
52
53 if (!matched &&
54 dynamic_cast<MeshElement const*>(&bulk_element) != nullptr)
55 {
57 ShapeFunction, ShapeMatricesType>(bulk_element);
58
59 fe.template computeShapeFunctions<NumLib::ShapeMatrixType::N>(
60 nat_coords.data(), shape_matrix, GlobalDim,
61 false /* axisymmetric */);
62
63 matched = true;
64 }
65 });
66
67 if (!matched)
68 {
69 OGS_FATAL("Element type '{:s}' is not supported as anchor element.",
70 MeshLib::CellType2String(bulk_element.getCellType()));
71 }
72
73 return shape_matrix.N;
74}
void foreach(Function &&f)
Definition TMP.h:150
std::string CellType2String(const CellType t)
Given a MeshElemType this returns the appropriate string.
NumLib::TemplateIsoparametric< ShapeFunction, ShapeMatricesType > createIsoparametricFiniteElement(MeshLib::Element const &e)

References MeshLib::CellType2String(), NumLib::createIsoparametricFiniteElement(), BaseLib::TMP::foreach(), MeshLib::Element::getCellType(), MeshLib::Element::getDimension(), MeshLib::Element::getNumberOfNodes(), and OGS_FATAL.

Referenced by ProcessLib::EmbeddedAnchor< GlobalDim >::getShapeMatricesAndGlobalIndicesAndDisplacements().

◆ createAnchorTerm()

template<int GlobalDim>
std::unique_ptr< SourceTerm > ProcessLib::createAnchorTerm ( 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,
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__Anchor__anchor_force_constant

Definition at line 14 of file CreateAnchorTerm.cpp.

19{
20 DBUG("Constructing AnchorTerm from config.");
22 config.checkConfigParameter("type", "Anchor");
23
24 auto const param_name =
26 config.getConfigParameter<std::string>("anchor_force_constant");
27 DBUG("Using parameter {:s} as anchor stiffness constant.", param_name);
28
29 auto& param = ParameterLib::findParameter<double>(param_name, parameters, 1,
30 &st_mesh);
31
32 for (MeshLib::Element const* const element : st_mesh.getElements())
33 {
34 if (element->getNumberOfNodes() != 2)
35 {
37 "Every anchor element needs to have precisely two nodes.");
38 }
39 }
40
41 return std::make_unique<AnchorTerm<GlobalDim>>(
42 std::move(dof_table), source_term_mesh_id, st_mesh, variable_id, param);
43}
OGS_NO_DANGLING Parameter< ParameterDataType > & findParameter(std::string const &parameter_name, std::vector< std::unique_ptr< ParameterBase > > const &parameters, int const num_components, MeshLib::Mesh const *const mesh=nullptr)

References BaseLib::ConfigTree::checkConfigParameter(), DBUG(), ParameterLib::findParameter(), BaseLib::ConfigTree::getConfigParameter(), MeshLib::Mesh::getElements(), and OGS_FATAL.

◆ createAnchorTerm< 2 >()

template std::unique_ptr< SourceTerm > ProcessLib::createAnchorTerm< 2 > ( 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,
std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const & parameters )

Referenced by createSourceTerm().

◆ createAnchorTerm< 3 >()

template std::unique_ptr< SourceTerm > ProcessLib::createAnchorTerm< 3 > ( 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,
std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const & parameters )

Referenced by createSourceTerm().

◆ 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 88 of file BHEInflowPythonBoundaryCondition.h.

93{
94 DBUG("Constructing BHEInflowPythonBoundaryCondition.");
95
96 // In case of partitioned mesh the boundary could be empty, i.e. there is no
97 // boundary condition.
98#ifdef USE_PETSC
99 // For this special boundary condition the boundary condition is not empty
100 // if the global indices are non-negative.
101 if (in_out_global_indices.first < 0 && in_out_global_indices.second < 0)
102 {
103 return nullptr;
104 }
105 // If only one of the global indices (in or out) is negative the
106 // implementation is not valid.
107 if (in_out_global_indices.first < 0 || in_out_global_indices.second < 0)
108 {
109 OGS_FATAL(
110 "The partition cuts the BHE into two independent parts. This "
111 "behaviour is not implemented.");
112 }
113#endif // USE_PETSC
114 return std::make_unique<BHEInflowPythonBoundaryCondition<BHEType>>(
115 std::move(in_out_global_indices), bhe, py_bc_object);
116}

References DBUG(), and OGS_FATAL.

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

◆ createBoundaryCondition()

std::vector< 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,
std::vector< std::reference_wrapper< ProcessVariable > > const & all_process_variables_for_this_process,
std::map< int, std::shared_ptr< MaterialPropertyLib::Medium > > const & media )
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
Input File Parameter
prj__process_variables__process_variable__boundary_conditions__boundary_condition__ReleaseNodalForce

Definition at line 30 of file CreateBoundaryCondition.cpp.

40{
41 // Surface mesh and bulk mesh must have equal axial symmetry flags!
42 for (auto const& i : config.boundary_meshes)
43 {
44 if (i.get().isAxiallySymmetric() != bulk_mesh.isAxiallySymmetric())
45 {
47 "The boundary mesh {:s} axially symmetric but the bulk mesh "
48 "{:s}. "
49 "Both must have an equal axial symmetry property.",
50 i.get().isAxiallySymmetric() ? "is" : "is not",
51 bulk_mesh.isAxiallySymmetric() ? "is" : "is not");
52 }
53 }
54
55 std::vector<std::unique_ptr<BoundaryCondition>> boundary_conditions;
56
58 auto const type = config.config.peekConfigParameter<std::string>("type");
59
60 if (bool const component_id_required =
61 !(type == "NormalTraction" || type == "ReleaseNodalForce");
62 component_id_required && !config.component_id.has_value())
63 {
65 "Specifying the component id (<component>) for a boundary "
66 "condition of type {} is mandatory.",
67 type);
68 }
69
70 if (type == "Dirichlet")
71 {
72 auto const parameter_name = parseDirichletBCConfig(config.config);
73 std::vector<std::unique_ptr<BoundaryCondition>> dirichlet_conditions;
74 for (auto const& bc_mesh : config.boundary_meshes)
75 {
76 dirichlet_conditions.push_back(
78 parameter_name, bc_mesh, dof_table, variable_id,
79 *config.component_id, parameters));
80 }
81 return dirichlet_conditions;
82 }
83 if (type == "DirichletWithinTimeInterval")
84 {
85 auto const config_args =
87 config.config);
88 std::vector<std::unique_ptr<BoundaryCondition>> conditions;
89 for (auto const& bc_mesh : config.boundary_meshes)
90 {
91 conditions.push_back(
93 config_args, bc_mesh, dof_table, variable_id,
94 *config.component_id, parameters));
95 }
96 return conditions;
97 }
98 if (type == "TimeDecayDirichlet")
99 {
100 auto const config_args =
102 std::vector<std::unique_ptr<BoundaryCondition>> conditions;
103 for (auto const& bc_mesh : config.boundary_meshes)
104 {
105 conditions.push_back(
107 config_args, variable_id, *config.component_id, bc_mesh,
108 dof_table, parameters));
109 }
110 return conditions;
111 }
112 if (type == "Neumann")
113 {
114 auto const config_args = parseNeumannBoundaryCondition(config.config);
115 std::vector<std::unique_ptr<BoundaryCondition>> conditions;
116 for (auto const& bc_mesh : config.boundary_meshes)
117 {
119 config_args, bc_mesh, dof_table, variable_id,
120 *config.component_id, integration_order, shapefunction_order,
121 bulk_mesh.getDimension(), parameters));
122 }
123 return conditions;
124 }
125 if (type == "Robin")
126 {
127 auto const config_args = parseRobinBoundaryCondition(config.config);
128 std::vector<std::unique_ptr<BoundaryCondition>> conditions;
129 for (auto const& bc_mesh : config.boundary_meshes)
130 {
131 conditions.push_back(ProcessLib::createRobinBoundaryCondition(
132 config_args, bc_mesh, dof_table, variable_id,
133 *config.component_id, integration_order, shapefunction_order,
134 bulk_mesh.getDimension(), parameters));
135 }
136 return conditions;
137 }
138 if (type == "VariableDependentNeumann")
139 {
140 auto const config_args =
142 std::vector<std::unique_ptr<BoundaryCondition>> conditions;
143 for (auto const& bc_mesh : config.boundary_meshes)
144 {
145 conditions.push_back(
147 config_args, bc_mesh, dof_table, variable_id,
148 *config.component_id, integration_order,
149 shapefunction_order, bulk_mesh.getDimension(), parameters));
150 }
151 return conditions;
152 }
153 if (type == "Python")
154 {
155 auto const config_args = parsePythonBoundaryCondition(config.config);
156 std::vector<std::unique_ptr<BoundaryCondition>> conditions;
157 for (auto const& bc_mesh : config.boundary_meshes)
158 {
160 config_args, bc_mesh, dof_table, bulk_mesh, variable_id,
161 *config.component_id, integration_order, shapefunction_order,
162 all_process_variables_for_this_process));
163 }
164 return conditions;
165 }
166
167 //
168 // Special boundary conditions
169 //
170 if (type == "ConstraintDirichlet")
171 {
172 auto const config_args =
174 std::vector<std::unique_ptr<BoundaryCondition>> conditions;
175 for (auto const& bc_mesh : config.boundary_meshes)
176 {
177 conditions.push_back(
179 config_args, bc_mesh, dof_table, variable_id,
180 integration_order, *config.component_id, parameters,
181 process));
182 }
183 return conditions;
184 }
185 if (type == "PrimaryVariableConstraintDirichlet")
186 {
187 auto const config_args =
189 config.config);
190 std::vector<std::unique_ptr<BoundaryCondition>> conditions;
191 for (auto const& bc_mesh : config.boundary_meshes)
192 {
193 conditions.push_back(
195 config_args, bc_mesh, dof_table, variable_id,
196 *config.component_id, parameters));
197 }
198 return conditions;
199 }
200 if (type == "WellboreCompensateNeumann")
201 {
202 auto const config_args =
204 std::vector<std::unique_ptr<BoundaryCondition>> conditions;
205 for (auto const& bc_mesh : config.boundary_meshes)
206 {
207 conditions.push_back(
209 config_args, bc_mesh, dof_table, variable_id,
210 *config.component_id, integration_order,
211 shapefunction_order, bulk_mesh.getDimension(), media));
212 }
213 return conditions;
214 }
215 if (type == "SolutionDependentDirichlet")
216 {
217 auto const config_args =
219 std::vector<std::unique_ptr<BoundaryCondition>> conditions;
220 for (auto const& bc_mesh : config.boundary_meshes)
221 {
222 conditions.push_back(
224 config_args, bc_mesh, dof_table, variable_id,
225 *config.component_id, parameters));
226 }
227 return conditions;
228 }
229 if (type == "HCNonAdvectiveFreeComponentFlowBoundary")
230 {
231 auto const boundary_permeability_name =
233 config.config);
234 std::vector<std::unique_ptr<BoundaryCondition>> conditions;
235 for (auto const& bc_mesh : config.boundary_meshes)
236 {
237 conditions.push_back(
239 boundary_permeability_name, bc_mesh, dof_table, variable_id,
240 *config.component_id, integration_order, parameters,
241 bulk_mesh.getDimension(), process, shapefunction_order));
242 }
243 return conditions;
244 }
245 if (type == "NormalTraction")
246 {
247 auto const parameter_name = NormalTractionBoundaryCondition::
249 std::vector<std::unique_ptr<BoundaryCondition>> conditions;
250 for (auto const& bc_mesh : config.boundary_meshes)
251 {
252 switch (bulk_mesh.getDimension())
253 {
254 case 2:
255 conditions.push_back(
256 ProcessLib::NormalTractionBoundaryCondition::
257 createNormalTractionBoundaryCondition<2>(
258 parameter_name, bc_mesh, bulk_mesh, dof_table,
259 variable_id, integration_order,
260 shapefunction_order, parameters));
261 break;
262 case 3:
263 conditions.push_back(
264 ProcessLib::NormalTractionBoundaryCondition::
265 createNormalTractionBoundaryCondition<3>(
266 parameter_name, bc_mesh, bulk_mesh, dof_table,
267 variable_id, integration_order,
268 shapefunction_order, parameters));
269 break;
270 default:
271 OGS_FATAL(
272 "NormalTractionBoundaryCondition can not be "
273 "instantiated for mesh dimensions other than two or "
274 "three. {}-dimensional mesh was given.",
275 bulk_mesh.getDimension());
276 }
277 }
278 return conditions;
279 }
280 if (type == "PhaseFieldIrreversibleDamageOracleBoundaryCondition")
281 {
283 std::vector<std::unique_ptr<BoundaryCondition>> conditions;
284 conditions.push_back(
287 dof_table, bulk_mesh, variable_id, *config.component_id));
288 return conditions;
289 }
290 if (type == "ReleaseNodalForce")
291 {
292 auto const decay_parameter_name = parseReleaseNodalForce(config);
293 std::vector<std::unique_ptr<BoundaryCondition>> conditions;
294 for (auto const& bc_mesh : config.boundary_meshes)
295 {
296 conditions.push_back(ProcessLib::createReleaseNodalForce(
298 bulk_mesh.getDimension(), variable_id, decay_parameter_name,
299 config, bc_mesh, dof_table, parameters));
300 }
301 return conditions;
302 }
303 OGS_FATAL("Unknown boundary condition type: `{:s}'.", type);
304}
T peekConfigParameter(std::string const &param) const
bool isAxiallySymmetric() const
Definition Mesh.h:128
unsigned getDimension() const
Returns the dimension of the mesh (determined by the maximum dimension over all elements).
Definition Mesh.h:79
std::string parseNormalTractionBoundaryCondition(BaseLib::ConfigTree const &config)
std::unique_ptr< RobinBoundaryCondition > createRobinBoundaryCondition(RobinBoundaryConditionConfig 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< PythonBoundaryCondition > createPythonBoundaryCondition(PythonBoundaryConditionConfig const &config, MeshLib::Mesh const &boundary_mesh, NumLib::LocalToGlobalIndexMap const &dof_table_bulk, MeshLib::Mesh const &bulk_mesh, int const variable_id, int const component_id, unsigned const integration_order, unsigned const shapefunction_order, std::vector< std::reference_wrapper< ProcessVariable > > const &all_process_variables_for_this_process)
Creates a new PythonBoundaryCondition object.
std::unique_ptr< ConstraintDirichletBoundaryCondition > createConstraintDirichletBoundaryCondition(ConstraintDirichletBoundaryConditionConfig 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)
RobinBoundaryConditionConfig parseRobinBoundaryCondition(BaseLib::ConfigTree const &config)
TimeDecayDirichletBoundaryConditionConfig parseTimeDecayDirichletBoundaryConditionConfig(BaseLib::ConfigTree const &config)
std::string parseReleaseNodalForce(BoundaryConditionConfig const &bc_config)
VariableDependentNeumannConfig parseVariableDependentNeumannBoundaryCondition(BaseLib::ConfigTree const &config)
std::string parseHCNonAdvectiveFreeComponentFlowBoundaryCondition(BaseLib::ConfigTree const &config)
void parsePhaseFieldIrreversibleDamageOracleBoundaryCondition(BaseLib::ConfigTree const &config)
PrimaryVariableConstraintDirichletBoundaryConditionConfig parsePrimaryVariableConstraintDirichletBoundaryCondition(BaseLib::ConfigTree const &config)
WellboreCompensateCoefficients parseWellboreCompensateNeumannBoundaryCondition(BaseLib::ConfigTree const &config)
std::unique_ptr< BoundaryCondition > createDirichletBoundaryConditionWithinTimeInterval(DirichletBoundaryConditionConfig const &config_args, 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)
PythonBoundaryConditionConfig parsePythonBoundaryCondition(BaseLib::ConfigTree const &config)
std::string parseDirichletBCConfig(BaseLib::ConfigTree const &config)
std::unique_ptr< BoundaryCondition > createTimeDecayDirichletBoundaryCondition(TimeDecayDirichletBoundaryConditionConfig const &config, int const variable_id, int const component_id, MeshLib::Mesh const &bc_mesh, NumLib::LocalToGlobalIndexMap const &dof_table_bulk, std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const &parameters)
std::unique_ptr< NeumannBoundaryCondition > createNeumannBoundaryCondition(NeumannBoundaryConditionConfig 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< SolutionDependentDirichletBoundaryCondition > createSolutionDependentDirichletBoundaryCondition(SolutionDependentDirichletBoundaryConditionConfig const &config, MeshLib::Mesh const &bc_mesh, NumLib::LocalToGlobalIndexMap const &dof_table_bulk, int const variable_id, int const component_id, std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const &parameters)
std::unique_ptr< DirichletBoundaryCondition > createDirichletBoundaryCondition(std::string const &parameter_name, 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)
SolutionDependentDirichletBoundaryConditionConfig parseSolutionDependentDirichletBoundaryCondition(BaseLib::ConfigTree const &config)
std::unique_ptr< BoundaryCondition > createReleaseNodalForce(unsigned const global_dim, int const variable_id, std::string const &decay_parameter_name, BoundaryConditionConfig const &bc_config, MeshLib::Mesh const &bc_mesh, NumLib::LocalToGlobalIndexMap const &dof_table_bulk, std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const &parameters)
DirichletBoundaryConditionConfig parseDirichletBoundaryConditionWithinTimeIntervalConfig(BaseLib::ConfigTree const &config)
NeumannBoundaryConditionConfig parseNeumannBoundaryCondition(BaseLib::ConfigTree const &config)
std::unique_ptr< PhaseFieldIrreversibleDamageOracleBoundaryCondition > createPhaseFieldIrreversibleDamageOracleBoundaryCondition(NumLib::LocalToGlobalIndexMap const &dof_table, MeshLib::Mesh const &mesh, int const variable_id, int const component_id)
std::unique_ptr< PrimaryVariableConstraintDirichletBoundaryCondition > createPrimaryVariableConstraintDirichletBoundaryCondition(PrimaryVariableConstraintDirichletBoundaryConditionConfig 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< WellboreCompensateNeumannBoundaryCondition > createWellboreCompensateNeumannBoundaryCondition(WellboreCompensateCoefficients const &coefficients, 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::map< int, std::shared_ptr< MaterialPropertyLib::Medium > > const &media)
std::unique_ptr< HCNonAdvectiveFreeComponentFlowBoundaryCondition > createHCNonAdvectiveFreeComponentFlowBoundaryCondition(std::string const &boundary_permeability_name, 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)
ConstraintDirichletBoundaryConditionConfig parseConstraintDirichletBoundaryCondition(BaseLib::ConfigTree const &config)
std::unique_ptr< VariableDependentNeumannBoundaryCondition > createVariableDependentNeumannBoundaryCondition(VariableDependentNeumannConfig const &coefficients, 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::vector< std::reference_wrapper< const MeshLib::Mesh > > boundary_meshes

References ProcessLib::BoundaryConditionConfig::boundary_meshes, ProcessLib::BoundaryConditionConfig::component_id, ProcessLib::BoundaryConditionConfig::config, createConstraintDirichletBoundaryCondition(), createDirichletBoundaryCondition(), createDirichletBoundaryConditionWithinTimeInterval(), createHCNonAdvectiveFreeComponentFlowBoundaryCondition(), createNeumannBoundaryCondition(), createPhaseFieldIrreversibleDamageOracleBoundaryCondition(), createPrimaryVariableConstraintDirichletBoundaryCondition(), createPythonBoundaryCondition(), createReleaseNodalForce(), createRobinBoundaryCondition(), createSolutionDependentDirichletBoundaryCondition(), createTimeDecayDirichletBoundaryCondition(), createVariableDependentNeumannBoundaryCondition(), createWellboreCompensateNeumannBoundaryCondition(), MeshLib::Mesh::getDimension(), MeshLib::Mesh::isAxiallySymmetric(), OGS_FATAL, parseConstraintDirichletBoundaryCondition(), parseDirichletBCConfig(), parseDirichletBoundaryConditionWithinTimeIntervalConfig(), parseHCNonAdvectiveFreeComponentFlowBoundaryCondition(), parseNeumannBoundaryCondition(), ProcessLib::NormalTractionBoundaryCondition::parseNormalTractionBoundaryCondition(), parsePhaseFieldIrreversibleDamageOracleBoundaryCondition(), parsePrimaryVariableConstraintDirichletBoundaryCondition(), parsePythonBoundaryCondition(), parseReleaseNodalForce(), parseRobinBoundaryCondition(), parseSolutionDependentDirichletBoundaryCondition(), parseTimeDecayDirichletBoundaryConditionConfig(), parseVariableDependentNeumannBoundaryCondition(), parseWellboreCompensateNeumannBoundaryCondition(), and BaseLib::ConfigTree::peekConfigParameter().

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

◆ createBoundaryDOFTable()

std::unique_ptr< NumLib::LocalToGlobalIndexMap > ProcessLib::createBoundaryDOFTable ( int const variable_id,
int const component_id,
MeshLib::Mesh const & boundary_mesh,
NumLib::LocalToGlobalIndexMap const & dof_table_bulk )

Definition at line 16 of file TimeDecayDirichletBoundaryCondition.cpp.

20{
21 checkParametersOfDirichletBoundaryCondition(boundary_mesh, dof_table_bulk,
22 variable_id, component_id);
23
24 std::vector<MeshLib::Node*> const& bc_nodes = boundary_mesh.getNodes();
25 MeshLib::MeshSubset bc_mesh_subset(boundary_mesh, bc_nodes);
26
27 // Create local DOF table from the BC mesh subset for the given variable
28 // and component id.
29 return dof_table_bulk.deriveBoundaryConstrainedMap(
30 variable_id, {component_id}, std::move(bc_mesh_subset));
31}
A subset of nodes on a single mesh.
Definition MeshSubset.h:17
void checkParametersOfDirichletBoundaryCondition(MeshLib::Mesh const &bc_mesh, NumLib::LocalToGlobalIndexMap const &dof_table_bulk, int const variable_id, int const component_id)

References checkParametersOfDirichletBoundaryCondition(), NumLib::LocalToGlobalIndexMap::deriveBoundaryConstrainedMap(), and MeshLib::Mesh::getNodes().

Referenced by ProcessLib::TimeDecayDirichletBoundaryCondition::TimeDecayDirichletBoundaryCondition().

◆ createCentralDifferencesJacobianAssembler()

std::unique_ptr< AbstractJacobianAssembler > ProcessLib::createCentralDifferencesJacobianAssembler ( BaseLib::ConfigTree const & config)
Input File Parameter
prj__processes__process__jacobian_assembler__type
Input File Parameter
special OGS input file parameter
Input File Parameter
prj__processes__process__jacobian_assembler__CentralDifferences__epsilons

Definition at line 14 of file CreateCentralDifferencesJacobianAssembler.cpp.

15{
17 config.checkConfigParameter("type", "CentralDifferences");
18
19 // TODO: to be removed
20 {
21 std::vector<std::string> const deprecated_keys{"relative_epsilons",
22 "component_magnitudes"};
23 for (auto const& key : deprecated_keys)
24 {
25 auto const deprecated_parameter =
27 config.getConfigParameterOptional<std::vector<double>>(key);
28 if ((deprecated_parameter.has_value() &&
29 !deprecated_parameter->empty()))
30 {
32 "Configuration parameter <{:s}> is deprecated and no "
33 "longer "
34 "supported.\n"
35 "(Removed in OGS version 6.5.6)\n\n"
36 "The numerical Jacobian assembler now uses absolute "
37 "perturbation values instead of relative scaling.\n\n"
38 "Migration required:\n"
39 " Old approach:\n"
40 " <relative_epsilons>1e-6 1e-6</relative_epsilons>\n"
41 " <component_magnitudes>1e2 1e2</component_magnitudes>\n"
42 " New approach:\n"
43 " <epsilons>1e-4 1e-4</epsilons>\n"
44 " where the epsilons are equal component-wise to "
45 "relative_epsilons * component_magnitudes",
46 key);
47 }
48 }
49 }
50
52 auto epsilons = config.getConfigParameter<std::vector<double>>("epsilons");
53
54 return std::make_unique<CentralDifferencesJacobianAssembler>(
55 std::move(epsilons));
56}

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

Referenced by createJacobianAssembler().

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

351{
352 // TODO doc script corner case: Parameter could occur at different
353 // locations.
355 config.checkConfigParameter("type", "CompareJacobians");
356
357 auto asm1 =
359 createJacobianAssembler(config.getConfigSubtree("jacobian_assembler"));
360
361 auto asm2 = createJacobianAssembler(
363 config.getConfigSubtree("reference_jacobian_assembler"));
364
366 auto const abs_tol = config.getConfigParameter<double>("abs_tol");
368 auto const rel_tol = config.getConfigParameter<double>("rel_tol");
369
371 auto const fail_on_error = config.getConfigParameter<bool>("fail_on_error");
372
374 auto const log_file = config.getConfigParameter<std::string>("log_file");
375
376 return std::make_unique<CompareJacobiansJacobianAssembler>(
377 std::move(asm1), std::move(asm2), abs_tol, rel_tol, fail_on_error,
378 log_file);
379}
std::unique_ptr< AbstractJacobianAssembler > createJacobianAssembler(std::optional< BaseLib::ConfigTree > const &config)

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

Referenced by createJacobianAssembler().

◆ createConstraintDirichletBoundaryCondition()

std::unique_ptr< ConstraintDirichletBoundaryCondition > ProcessLib::createConstraintDirichletBoundaryCondition ( ConstraintDirichletBoundaryConditionConfig 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.

Definition at line 249 of file ConstraintDirichletBoundaryCondition.cpp.

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

References ProcessLib::ConstraintDirichletBoundaryConditionConfig::constraining_process_variable, ProcessLib::ConstraintDirichletBoundaryConditionConfig::constraint_direction, ProcessLib::ConstraintDirichletBoundaryConditionConfig::constraint_threshold, ProcessLib::ConstraintDirichletBoundaryConditionConfig::constraint_type, createConstraintDirichletBoundaryCondition(), DBUG(), ParameterLib::findParameter(), MeshLib::Mesh::getDimension(), ProcessLib::Process::getMesh(), MeshLib::Mesh::getNumberOfElements(), MeshLib::Mesh::getNumberOfNodes(), ProcessLib::Process::getProcessVariables(), ProcessLib::Process::isMonolithicSchemeUsed(), OGS_FATAL, and ProcessLib::ConstraintDirichletBoundaryConditionConfig::parameter_name.

Referenced by createBoundaryCondition(), and createConstraintDirichletBoundaryCondition().

◆ createDeactivatedSubdomain()

DeactivatedSubdomain ProcessLib::createDeactivatedSubdomain ( BaseLib::ConfigTree const & config,
MeshLib::Mesh const & mesh,
std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const & parameters,
std::map< std::string, std::unique_ptr< MathLib::PiecewiseLinearInterpolation > > const & curves )
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__time_curve
Input File Parameter
prj__process_variables__process_variable__deactivated_subdomains__deactivated_subdomain__line_segment
Input File Parameter
prj__process_variables__process_variable__deactivated_subdomains__deactivated_subdomain__ball
Input File Parameter
prj__process_variables__process_variable__deactivated_subdomains__deactivated_subdomain__boundary_parameter
Input File Parameter
prj__process_variables__process_variable__deactivated_subdomains__deactivated_subdomain__material_ids

Definition at line 231 of file CreateDeactivatedSubdomain.cpp.

237{
238 auto const& time_interval_config =
240 config.getConfigSubtreeOptional("time_interval");
241
242 auto const& curve_name =
244 config.getConfigParameterOptional<std::string>("time_curve");
245 auto time_interval =
246 parseTimeIntervalOrCurve(time_interval_config, curve_name, curves);
247
248 auto const line_segment_config =
250 config.getConfigSubtreeOptional("line_segment");
251
252 auto const ball_config =
254 config.getConfigSubtreeOptional("ball");
255
256 if (line_segment_config && ball_config)
257 {
258 OGS_FATAL(
259 "line_segment and ball can not be defined "
260 "simultaneously.");
261 }
262
263 if (time_interval_config && (line_segment_config || ball_config))
264 {
265 OGS_FATAL(
266 "When using time interval for subdomain deactivation a line "
267 "segment or a ball must not be specified.");
268 }
269
270 if (curve_name && !(line_segment_config || ball_config))
271 {
272 OGS_FATAL(
273 "When using curve for subdomain deactivation a line segment or a "
274 "ball must be specified.");
275 }
276
277 // If time interval was specified then an empty optional line segment is
278 // used *internally* because the whole selected material ids subdomain will
279 // be deactivated.
280 std::optional<std::pair<Eigen::Vector3d, Eigen::Vector3d>> line_segment;
281 if (line_segment_config)
282 {
283 line_segment = parseLineSegment(*line_segment_config);
284 }
285
286 std::optional<detail::Ball> ball;
287 if (ball_config)
288 {
289 ball = parseBall(*ball_config);
290 }
291
292 ParameterLib::Parameter<double>* boundary_value_parameter = nullptr;
293 auto boundary_value_parameter_name =
295 config.getConfigParameterOptional<std::string>("boundary_parameter");
296 if (boundary_value_parameter_name)
297 {
298 DBUG("Using parameter {:s}", *boundary_value_parameter_name);
299 boundary_value_parameter = &ParameterLib::findParameter<double>(
300 *boundary_value_parameter_name, parameters, 1, &mesh);
301 }
302
303 auto deactivated_subdomain_material_ids =
305 config.getConfigParameter("material_ids", std::vector<int>{}) |
306 ranges::to<std::unordered_set>();
307
308 if (deactivated_subdomain_material_ids.empty())
309 {
310 OGS_FATAL(
311 "The material IDs of the deactivated subdomains are not given. The "
312 "program terminates now.");
313 }
314
315 if (materialIDs(mesh) == nullptr)
316 {
317 OGS_FATAL(
318 "The mesh doesn't contain materialIDs for subdomain deactivation. "
319 "The program terminates now.");
320 }
321
322 auto deactivated_subdomain_mesh = createDeactivatedSubdomainMesh(
323 mesh, deactivated_subdomain_material_ids);
324
325 return {std::move(time_interval), line_segment, ball,
326 std::move(deactivated_subdomain_mesh), boundary_value_parameter};
327}
PropertyVector< int > const * materialIDs(Mesh const &mesh)
Definition Mesh.cpp:258
static DeactivatedSubdomainMesh createDeactivatedSubdomainMesh(MeshLib::Mesh const &mesh, std::unordered_set< int > const &deactivated_subdomain_material_ids)
static detail::Ball parseBall(BaseLib::ConfigTree const &config)
Returns a ball represented by its center and its radius.
static std::pair< Eigen::Vector3d, Eigen::Vector3d > parseLineSegment(BaseLib::ConfigTree const &config)
Returns a line segment represented by its begin and end points.
static MathLib::PiecewiseLinearInterpolation parseTimeIntervalOrCurve(std::optional< BaseLib::ConfigTree > const &time_interval_config, std::optional< std::string > const &curve_name, std::map< std::string, std::unique_ptr< MathLib::PiecewiseLinearInterpolation > > const &curves)

References createDeactivatedSubdomainMesh(), DBUG(), ParameterLib::findParameter(), BaseLib::ConfigTree::getConfigParameter(), BaseLib::ConfigTree::getConfigParameterOptional(), BaseLib::ConfigTree::getConfigSubtreeOptional(), OGS_FATAL, parseBall(), parseLineSegment(), and parseTimeIntervalOrCurve().

Referenced by createDeactivatedSubdomains().

◆ createDeactivatedSubdomainMesh()

DeactivatedSubdomainMesh ProcessLib::createDeactivatedSubdomainMesh ( MeshLib::Mesh const & mesh,
std::unordered_set< int > const & deactivated_subdomain_material_ids )
static

Definition at line 87 of file CreateDeactivatedSubdomain.cpp.

90{
91 // An element is active if its material id matches one of the deactivated
92 // subdomain material ids.
93 auto is_active =
94 [&deactivated_subdomain_material_ids,
95 &material_ids = *materialIDs(mesh)](std::size_t element_id)
96 {
97 return deactivated_subdomain_material_ids.contains(
98 material_ids[element_id]);
99 };
100
101 auto const& elements = mesh.getElements();
102 std::vector<MeshLib::Element*> deactivated_elements;
103 ranges::copy_if(elements, back_inserter(deactivated_elements), is_active,
104 [](auto const e) { return e->getID(); });
105
106 auto bulk_element_ids = deactivated_elements | MeshLib::views::ids |
107 ranges::to<std::unordered_set>;
108
109 static int mesh_number = 0;
110 // Subdomain mesh consisting of deactivated elements.
112 "deactivate_subdomain_" + std::to_string(mesh_number++),
113 MeshLib::cloneElements(deactivated_elements));
114
115 auto [inner_nodes, outer_nodes] =
116 extractInnerAndOuterNodes(mesh, *sub_mesh, is_active);
117
118 auto outer_nodes_elements =
119 extractElementsAlongOuterNodes(mesh, *sub_mesh, outer_nodes);
120
121 return {std::move(*sub_mesh), std::move(bulk_element_ids),
122 std::move(inner_nodes), std::move(outer_nodes),
123 std::move(outer_nodes_elements)};
124}
constexpr ranges::views::view_closure ids
For an element of a range view return its id.
Definition Mesh.h:216
std::unique_ptr< MeshLib::Mesh > createMeshFromElementSelection(std::string mesh_name, std::vector< MeshLib::Element * > const &elements)
std::vector< Element * > cloneElements(std::vector< Element * > const &elements)
Clones a vector of elements using the Element::clone() function.
static std::pair< std::vector< std::size_t >, std::vector< std::size_t > > extractInnerAndOuterNodes(MeshLib::Mesh const &mesh, MeshLib::Mesh const &sub_mesh, IsActive is_active)
static std::vector< std::vector< std::size_t > > extractElementsAlongOuterNodes(MeshLib::Mesh const &mesh, MeshLib::Mesh const &sub_mesh, std::vector< std::size_t > const &outer_nodes)

References MeshLib::cloneElements(), MeshLib::createMeshFromElementSelection(), extractElementsAlongOuterNodes(), extractInnerAndOuterNodes(), MeshLib::Mesh::getElements(), and MeshLib::views::ids.

Referenced by createDeactivatedSubdomain().

◆ createDeactivatedSubdomains()

std::vector< DeactivatedSubdomain > ProcessLib::createDeactivatedSubdomains ( BaseLib::ConfigTree const & config,
MeshLib::Mesh const & mesh,
std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const & parameters,
std::map< std::string, std::unique_ptr< MathLib::PiecewiseLinearInterpolation > > const & curves )
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 329 of file CreateDeactivatedSubdomain.cpp.

336{
337 std::vector<DeactivatedSubdomain> deactivated_subdomains;
338 // Deactivated subdomains
339 if (auto subdomains_config =
341 config.getConfigSubtreeOptional("deactivated_subdomains"))
342 {
343 INFO("There are subdomains being deactivated.");
344
345 auto const deactivated_subdomain_configs =
347 subdomains_config->getConfigSubtreeList("deactivated_subdomain");
348 std::transform(std::begin(deactivated_subdomain_configs),
349 std::end(deactivated_subdomain_configs),
350 std::back_inserter(deactivated_subdomains),
351 [&](auto const& config) {
353 config, mesh, parameters, curves);
354 });
355 }
356 return deactivated_subdomains;
357}
void INFO(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:28
DeactivatedSubdomain createDeactivatedSubdomain(BaseLib::ConfigTree const &config, MeshLib::Mesh const &mesh, std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const &parameters, std::map< std::string, std::unique_ptr< MathLib::PiecewiseLinearInterpolation > > const &curves)

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

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

◆ createDirichletBoundaryCondition()

std::unique_ptr< DirichletBoundaryCondition > ProcessLib::createDirichletBoundaryCondition ( std::string const & parameter_name,
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 )

Definition at line 60 of file DirichletBoundaryCondition.cpp.

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

References DBUG(), ParameterLib::findParameter(), MeshLib::Mesh::getDimension(), MeshLib::Mesh::getNumberOfElements(), and MeshLib::Mesh::getNumberOfNodes().

Referenced by createBoundaryCondition().

◆ createDirichletBoundaryConditionWithinTimeInterval()

std::unique_ptr< BoundaryCondition > ProcessLib::createDirichletBoundaryConditionWithinTimeInterval ( DirichletBoundaryConditionConfig const & config_args,
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 )

Definition at line 33 of file CreateDirichletBoundaryConditionWithinTimeInterval.cpp.

39{
40 DBUG("Constructing DirichletBoundaryConditionWithinTimeInterval.");
41
43 config_args.parameter_name, parameters, 1, &bc_mesh);
44
45// In case of partitioned mesh the boundary could be empty, i.e. there is no
46// boundary condition.
47#ifdef USE_PETSC
48 // This can be extracted to createBoundaryCondition() but then the config
49 // parameters are not read and will cause an error.
50 // TODO (naumov): Add a function to ConfigTree for skipping the tags of the
51 // subtree and move the code up in createBoundaryCondition().
52 if (bc_mesh.getDimension() == 0 && bc_mesh.getNumberOfNodes() == 0 &&
53 bc_mesh.getNumberOfElements() == 0)
54 {
55 return nullptr;
56 }
57#endif // USE_PETSC
58
59 return std::make_unique<DirichletBoundaryConditionWithinTimeInterval>(
60 std::move(config_args.time_interval), param, bc_mesh, dof_table_bulk,
61 variable_id, component_id);
62}

References DBUG(), ParameterLib::findParameter(), MeshLib::Mesh::getDimension(), MeshLib::Mesh::getNumberOfElements(), MeshLib::Mesh::getNumberOfNodes(), ProcessLib::DirichletBoundaryConditionConfig::parameter_name, and ProcessLib::DirichletBoundaryConditionConfig::time_interval.

Referenced by createBoundaryCondition().

◆ createEmbeddedAnchor()

template<int GlobalDim>
std::unique_ptr< SourceTermBase > ProcessLib::createEmbeddedAnchor ( BaseLib::ConfigTree const & config,
MeshLib::Mesh const & st_mesh,
MeshLib::Mesh const & bulk_mesh,
NumLib::LocalToGlobalIndexMap const & dof_table_bulk,
std::size_t const source_term_mesh_id,
const int variable_id )
Input File Parameter
prj__process_variables__process_variable__source_terms__source_term__EmbeddedAnchor
Input File Parameter
Input File Parameter
prj__process_variables__process_variable__source_terms__source_term__type

Definition at line 14 of file CreateEmbeddedAnchor.cpp.

19{
20 DBUG("Constructing EmbeddedAnchor from config.");
21 // ...special is necessary, because EmbeddedAnchor has no configuration via
22 // child tags, hence it wouldn't be handled properly by the documentation
23 // scripts otherwise.
26 config.checkConfigParameter("type", "EmbeddedAnchor");
27
28 for (MeshLib::Element const* const element : st_mesh.getElements())
29 {
30 if (element->getNumberOfNodes() != 2)
31 {
33 "Every anchor element needs to have precisely two nodes.");
34 }
35 }
36#ifdef USE_PETSC
38 "The EmbeddedAnchor source term has not been tested with PETSc yet.");
39#endif
40
41 return std::make_unique<EmbeddedAnchor<GlobalDim>>(
42 bulk_mesh, dof_table_bulk, source_term_mesh_id, st_mesh, variable_id);
43}

References BaseLib::ConfigTree::checkConfigParameter(), DBUG(), MeshLib::Mesh::getElements(), and OGS_FATAL.

◆ createEmbeddedAnchor< 2 >()

template std::unique_ptr< SourceTermBase > ProcessLib::createEmbeddedAnchor< 2 > ( BaseLib::ConfigTree const & config,
MeshLib::Mesh const & st_mesh,
MeshLib::Mesh const & bulk_mesh,
NumLib::LocalToGlobalIndexMap const & dof_table_bulk,
std::size_t const source_term_mesh_id,
const int variable_id )

Referenced by createSourceTerm().

◆ createEmbeddedAnchor< 3 >()

template std::unique_ptr< SourceTermBase > ProcessLib::createEmbeddedAnchor< 3 > ( BaseLib::ConfigTree const & config,
MeshLib::Mesh const & st_mesh,
MeshLib::Mesh const & bulk_mesh,
NumLib::LocalToGlobalIndexMap const & dof_table_bulk,
std::size_t const source_term_mesh_id,
const int variable_id )

Referenced by createSourceTerm().

◆ createForwardDifferencesJacobianAssembler()

std::unique_ptr< AbstractJacobianAssembler > ProcessLib::createForwardDifferencesJacobianAssembler ( BaseLib::ConfigTree const & config)
Input File Parameter
prj__processes__process__jacobian_assembler__type
Input File Parameter
special OGS input file parameter
Input File Parameter
prj__processes__process__jacobian_assembler__ForwardDifferences__epsilons

Definition at line 13 of file CreateForwardDifferencesJacobianAssembler.cpp.

14{
16 config.checkConfigParameter("type", "ForwardDifferences");
17
18 // TODO: to be removed
19 {
20 std::vector<std::string> const deprecated_keys{"relative_epsilons",
21 "component_magnitudes"};
22 for (auto const& key : deprecated_keys)
23 {
24 auto const deprecated_parameter =
26 config.getConfigParameterOptional<std::vector<double>>(key);
27
28 if ((deprecated_parameter.has_value() &&
29 !deprecated_parameter->empty()))
30 {
32 "Configuration parameter <{:s}> is deprecated and no "
33 "longer supported.\n"
34 "(Removed in OGS version 6.5.6)\n\n"
35 "The numerical Jacobian assembler now uses absolute "
36 "perturbation values instead of relative scaling.\n\n"
37 "Migration required:\n"
38 " Old approach:\n"
39 " <relative_epsilons>1e-6 1e-6</relative_epsilons>\n"
40 " <component_magnitudes>1e2 1e2</component_magnitudes>\n"
41 " New approach:\n"
42 " <epsilons>1e-4 1e-4</epsilons>\n"
43 " where the epsilons are equal component-wise to "
44 "relative_epsilons * component_magnitudes",
45 key);
46 }
47 }
48 }
49
51 auto epsilons = config.getConfigParameter<std::vector<double>>("epsilons");
52
53 return std::make_unique<ForwardDifferencesJacobianAssembler>(
54 std::move(epsilons));
55}

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

Referenced by createJacobianAssembler().

◆ createHCNonAdvectiveFreeComponentFlowBoundaryCondition()

std::unique_ptr< HCNonAdvectiveFreeComponentFlowBoundaryCondition > ProcessLib::createHCNonAdvectiveFreeComponentFlowBoundaryCondition ( std::string const & boundary_permeability_name,
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 )

Definition at line 28 of file HCNonAdvectiveFreeComponentFlowBoundaryCondition.cpp.

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

References MeshLib::Cell, DBUG(), MeshLib::Face, ParameterLib::findParameter(), MeshLib::getBulkIDString(), MeshLib::Mesh::getDimension(), MeshLib::Mesh::getName(), MeshLib::Mesh::getNumberOfElements(), MeshLib::Mesh::getNumberOfNodes(), MeshLib::Mesh::getProperties(), and OGS_FATAL.

Referenced by createBoundaryCondition().

◆ createInitialStress()

template<int DisplacementDim>
InitialStress ProcessLib::createInitialStress ( BaseLib::ConfigTree const & config,
std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const & parameters,
MeshLib::Mesh const & mesh,
bool const mandatory_stress_type )
Input File Parameter
prj__processes__process__initial_stress
Input File Parameter
prj__processes__process__initial_stress__type

Definition at line 17 of file CreateInitialStress.cpp.

21{
22 auto const config_stress0 =
24 config.getConfigSubtreeOptional("initial_stress");
25
26 if (!config_stress0)
27 {
28 return {};
29 }
30
31 auto const stress0_type_opt =
33 config_stress0->getConfigAttributeOptional<std::string>("type");
34
35 // If the type is mandatory required but it is not presented:
36 if (mandatory_stress_type && !stress0_type_opt)
37 {
39 "The attribute \"type\" of the tag \"initial_stress\" is required "
40 "for the current process setting, for example using subtype = "
41 "\"StressSaturation_StrainPressureTemperature\" in TRM. "
42 "However it is missing.");
43 }
44
45 auto const stress0_type_str =
46 stress0_type_opt ? *stress0_type_opt : "effective";
47
48 InitialStress::Type stress0_type;
49 if (stress0_type_str == "total")
50 {
51 stress0_type = InitialStress::Type::Total;
52 }
53 else if (stress0_type_str == "effective")
54 {
55 stress0_type = InitialStress::Type::Effective;
56 }
57 else
58 {
60 "The initial stress type must be \"total\" or "
61 "\"effective\". But the given one is {:s}",
62 stress0_type_str);
63 }
64
65 auto const parameter_name = config_stress0->getValue<std::string>();
66 auto const initial_stress = &ParameterLib::findParameter<double>(
67 parameter_name, parameters,
69 &mesh);
70
71 return {initial_stress, stress0_type};
72}
constexpr int kelvin_vector_dimensions(int const displacement_dim)
Kelvin vector dimensions for given displacement dimension.

References ProcessLib::InitialStress::Effective, ParameterLib::findParameter(), BaseLib::ConfigTree::getConfigSubtreeOptional(), MathLib::KelvinVector::kelvin_vector_dimensions(), OGS_FATAL, and ProcessLib::InitialStress::Total.

Referenced by ProcessLib::HydroMechanics::createHydroMechanicsProcess(), ProcessLib::PhaseField::createPhaseFieldProcess(), ProcessLib::RichardsMechanics::createRichardsMechanicsProcess(), ProcessLib::TH2M::createTH2MProcess(), ProcessLib::ThermoHydroMechanics::createThermoHydroMechanicsProcess(), and ProcessLib::ThermoRichardsMechanics::createThermoRichardsMechanicsProcessStage2().

◆ createInitialStress< 2 >()

template InitialStress ProcessLib::createInitialStress< 2 > ( BaseLib::ConfigTree const & config,
std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const & parameters,
MeshLib::Mesh const & mesh,
bool const mandatory_stress_type )

◆ createInitialStress< 3 >()

template InitialStress ProcessLib::createInitialStress< 3 > ( BaseLib::ConfigTree const & config,
std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const & parameters,
MeshLib::Mesh const & mesh,
bool const mandatory_stress_type )

◆ createJacobianAssembler()

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

Definition at line 15 of file CreateJacobianAssembler.cpp.

17{
18 if (!config)
19 {
20 return std::make_unique<AnalyticalJacobianAssembler>();
21 }
22
24 auto const type = config->peekConfigParameter<std::string>("type");
25
26 if (type == "Analytical")
27 {
28 config->ignoreConfigParameter("type");
29 return std::make_unique<AnalyticalJacobianAssembler>();
30 }
31 if (type == "CentralDifferences")
32 {
34 }
35 if (type == "CompareJacobians")
36 {
38 }
39 if (type == "ForwardDifferences")
40 {
42 }
43
44 OGS_FATAL("Unknown Jacobian assembler type: `{:s}'.", type);
45}
std::unique_ptr< CompareJacobiansJacobianAssembler > createCompareJacobiansJacobianAssembler(BaseLib::ConfigTree const &config)
std::unique_ptr< AbstractJacobianAssembler > createForwardDifferencesJacobianAssembler(BaseLib::ConfigTree const &config)
std::unique_ptr< AbstractJacobianAssembler > createCentralDifferencesJacobianAssembler(BaseLib::ConfigTree const &config)

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

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

◆ createLocalAssemblers() [1/2]

template<template< typename, int > class LocalAssemblerImplementation, typename LocalAssemblerInterface, IntegrationMethodProviderOrIntegrationOrder ProviderOrOrder, typename... ExtraCtorArgs>
void ProcessLib::createLocalAssemblers ( const unsigned dimension,
std::vector< MeshLib::Element * > const & mesh_elements,
NumLib::LocalToGlobalIndexMap const & dof_table,
std::vector< std::unique_ptr< LocalAssemblerInterface > > & local_assemblers,
ProviderOrOrder const & provider_or_order,
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 68 of file Utils/CreateLocalAssemblers.h.

75{
76 DBUG("Create local assemblers.");
77
78 switch (dimension)
79 {
80 case 1:
82 mesh_elements, dof_table, local_assemblers, provider_or_order,
83 std::forward<ExtraCtorArgs>(extra_ctor_args)...);
84 break;
85 case 2:
87 mesh_elements, dof_table, local_assemblers, provider_or_order,
88 std::forward<ExtraCtorArgs>(extra_ctor_args)...);
89 break;
90 case 3:
92 mesh_elements, dof_table, local_assemblers, provider_or_order,
93 std::forward<ExtraCtorArgs>(extra_ctor_args)...);
94 break;
95 default:
97 "Meshes with dimension greater than three are not supported.");
98 }
99}
void createLocalAssemblers(std::vector< MeshLib::Element * > const &mesh_elements, NumLib::LocalToGlobalIndexMap const &dof_table, std::vector< std::unique_ptr< LocalAssemblerInterface > > &local_assemblers, ProviderOrOrder const &provider_or_order, ExtraCtorArgs &&... extra_ctor_args)

References createLocalAssemblers(), DBUG(), and OGS_FATAL.

◆ createLocalAssemblers() [2/2]

template<int GlobalDim, template< typename, int > class LocalAssemblerImplementation, typename LocalAssemblerInterface, IntegrationMethodProviderOrIntegrationOrder ProviderOrOrder, typename... ExtraCtorArgs>
void ProcessLib::createLocalAssemblers ( std::vector< MeshLib::Element * > const & mesh_elements,
NumLib::LocalToGlobalIndexMap const & dof_table,
std::vector< std::unique_ptr< LocalAssemblerInterface > > & local_assemblers,
ProviderOrOrder const & provider_or_order,
ExtraCtorArgs &&... extra_ctor_args )

Definition at line 21 of file Utils/CreateLocalAssemblers.h.

27{
28 static_assert(
29 GlobalDim == 1 || GlobalDim == 2 || GlobalDim == 3,
30 "Meshes with dimension greater than three are not supported.");
31
32 DBUG("Create local assemblers.");
33
34 auto const& integration_method_provider =
35 getIntegrationMethodProvider(provider_or_order);
36
37 using IntegrationMethodProvider =
38 std::remove_cvref_t<decltype(integration_method_provider)>;
39 using LocAsmFac = LocalAssemblerFactory<
40 LocalAssemblerInterface, LocalAssemblerImplementation,
41 IntegrationMethodProvider, GlobalDim, ExtraCtorArgs...>;
42
43 LocAsmFac factory(dof_table, integration_method_provider);
44 local_assemblers.resize(mesh_elements.size());
45
46 DBUG("Calling local assembler builder for all mesh elements.");
48 factory, mesh_elements, local_assemblers,
49 std::forward<ExtraCtorArgs>(extra_ctor_args)...);
50}
LocalAssemblerFactoryForDimGreaterEqualN< 1, LocalAssemblerInterface, LocalAssemblerImplementation, IntegrationMethodProvider, GlobalDim, ConstructorArgs... > LocalAssemblerFactory
By default processes in OGS are defined in 1D, 2D and 3D.
static void transformDereferenced(F const &f, C const &c, Data &data, Args_ &&... args)

References createLocalAssemblers(), DBUG(), and NumLib::SerialExecutor::transformDereferenced().

Referenced by ProcessLib::SurfaceFlux::SurfaceFlux(), createLocalAssemblers(), createLocalAssemblers(), ProcessLib::ComponentTransport::ComponentTransportProcess::initializeConcreteProcess(), ProcessLib::HeatConduction::HeatConductionProcess::initializeConcreteProcess(), ProcessLib::HT::HTProcess::initializeConcreteProcess(), ProcessLib::LiquidFlow::LiquidFlowProcess::initializeConcreteProcess(), ProcessLib::RichardsComponentTransport::RichardsComponentTransportProcess::initializeConcreteProcess(), ProcessLib::RichardsFlow::RichardsFlowProcess::initializeConcreteProcess(), ProcessLib::SteadyStateDiffusion::SteadyStateDiffusion::initializeConcreteProcess(), ProcessLib::ThermalTwoPhaseFlowWithPP::ThermalTwoPhaseFlowWithPPProcess::initializeConcreteProcess(), ProcessLib::ThermoRichardsFlow::ThermoRichardsFlowProcess::initializeConcreteProcess(), ProcessLib::TwoPhaseFlowWithPP::TwoPhaseFlowWithPPProcess::initializeConcreteProcess(), and ProcessLib::WellboreSimulator::WellboreSimulatorProcess::initializeConcreteProcess().

◆ createLocalAssemblersHM()

template<int GlobalDim, template< typename, typename, int > class LocalAssemblerImplementation, typename LocalAssemblerInterface, IntegrationMethodProviderOrIntegrationOrder ProviderOrOrder, typename... ExtraCtorArgs>
void ProcessLib::createLocalAssemblersHM ( std::vector< MeshLib::Element * > const & mesh_elements,
NumLib::LocalToGlobalIndexMap const & dof_table,
std::vector< std::unique_ptr< LocalAssemblerInterface > > & local_assemblers,
ProviderOrOrder const & provider_or_order,
ExtraCtorArgs &&... extra_ctor_args )

Definition at line 78 of file CreateLocalAssemblersTaylorHood.h.

84{
86 LocalAssemblerImplementation,
88 mesh_elements, dof_table, local_assemblers, provider_or_order,
89 std::forward<ExtraCtorArgs>(extra_ctor_args)...);
90}
void createLocalAssemblersTaylorHood(std::vector< MeshLib::Element * > const &mesh_elements, NumLib::LocalToGlobalIndexMap const &dof_table, std::vector< std::unique_ptr< LocalAssemblerInterface > > &local_assemblers, ProviderOrOrder const &provider_or_order, ExtraCtorArgs &&... extra_ctor_args)
LocalAssemblerFactoryTaylorHood< 1, 2, LocalAssemblerInterface, LocalAssemblerImplementation, IntegrationMethodProvider, GlobalDim, ConstructorArgs... > LocalAssemblerFactoryHM
HM processes in OGS are defined for linear and higher order elements.

References createLocalAssemblersHM(), and ProcessLib::detail::createLocalAssemblersTaylorHood().

Referenced by ProcessLib::TH2M::createLocalAssemblers(), ProcessLib::ThermoRichardsMechanics::createLocalAssemblers(), createLocalAssemblersHM(), ProcessLib::HydroMechanics::HydroMechanicsProcess< DisplacementDim >::initializeConcreteProcess(), ProcessLib::RichardsMechanics::RichardsMechanicsProcess< DisplacementDim >::initializeConcreteProcess(), and ProcessLib::ThermoHydroMechanics::ThermoHydroMechanicsProcess< DisplacementDim >::initializeConcreteProcess().

◆ createLocalAssemblersStokes()

template<int GlobalDim, template< typename, typename, int > class LocalAssemblerImplementation, typename LocalAssemblerInterface, IntegrationMethodProviderOrIntegrationOrder ProviderOrOrder, typename... ExtraCtorArgs>
void ProcessLib::createLocalAssemblersStokes ( std::vector< MeshLib::Element * > const & mesh_elements,
NumLib::LocalToGlobalIndexMap const & dof_table,
std::vector< std::unique_ptr< LocalAssemblerInterface > > & local_assemblers,
ProviderOrOrder const & provider_or_order,
ExtraCtorArgs &&... extra_ctor_args )

Definition at line 99 of file CreateLocalAssemblersTaylorHood.h.

105{
107 LocalAssemblerFactoryStokes, GlobalDim, LocalAssemblerImplementation,
109 mesh_elements, dof_table, local_assemblers, provider_or_order,
110 std::forward<ExtraCtorArgs>(extra_ctor_args)...);
111}
LocalAssemblerFactoryTaylorHood< 2, 2, LocalAssemblerInterface, LocalAssemblerImplementation, IntegrationMethodProvider, GlobalDim, ConstructorArgs... > LocalAssemblerFactoryStokes
Stokes flow in OGS is defined for higher order elements only.

References createLocalAssemblersStokes(), and ProcessLib::detail::createLocalAssemblersTaylorHood().

Referenced by createLocalAssemblersStokes().

◆ createNeumannBoundaryCondition()

std::unique_ptr< NeumannBoundaryCondition > ProcessLib::createNeumannBoundaryCondition ( NeumannBoundaryConditionConfig 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 )

Definition at line 32 of file NeumannBoundaryCondition.cpp.

38{
39 DBUG("Constructing Neumann BC.");
40
41 auto const& param = ParameterLib::findParameter<double>(
42 config.parameter_name, parameters, 1, &bc_mesh);
43
44 // In case of partitioned mesh the boundary could be empty, i.e. there
45 // is no boundary condition.
46#ifdef USE_PETSC
47 // This can be extracted to createBoundaryCondition() but then the config
48 // parameters are not read and will cause an error.
49 // TODO (naumov): Add a function to ConfigTree for skipping the tags of the
50 // subtree and move the code up in createBoundaryCondition().
51 if (bc_mesh.getDimension() == 0 && bc_mesh.getNumberOfNodes() == 0 &&
52 bc_mesh.getNumberOfElements() == 0)
53 {
54 return nullptr;
55 }
56#endif // USE_PETSC
57
58 ParameterLib::Parameter<double> const* integral_measure(nullptr);
59 if (global_dim - bc_mesh.getDimension() != 1)
60 {
61 if (!config.area_parameter_name)
62 {
63 OGS_FATAL("{}: tag <area_parameter> required in Neumann BC.",
64 __FUNCTION__);
65 }
66 integral_measure = &ParameterLib::findParameter<double>(
67 config.area_parameter_name.value(), parameters, 1, &bc_mesh);
68 }
69
70 if (bc_mesh.getDimension() >= global_dim)
71 {
73 "The dimension ({:d}) of the given boundary mesh '{:s}' is not "
74 "lower than the bulk dimension ({:d}).",
75 bc_mesh.getDimension(), bc_mesh.getName(), global_dim);
76 }
77
78 return std::make_unique<NeumannBoundaryCondition>(
79 integration_order, shapefunction_order, dof_table, variable_id,
80 component_id, global_dim, bc_mesh,
81 NeumannBoundaryConditionData{param, integral_measure});
82}

References ProcessLib::NeumannBoundaryConditionConfig::area_parameter_name, DBUG(), ParameterLib::findParameter(), MeshLib::Mesh::getDimension(), MeshLib::Mesh::getName(), MeshLib::Mesh::getNumberOfElements(), MeshLib::Mesh::getNumberOfNodes(), OGS_FATAL, and ProcessLib::NeumannBoundaryConditionConfig::parameter_name.

Referenced by createBoundaryCondition().

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

19{
20 DBUG("Constructing NodalSourceTerm from config.");
22 config.checkConfigParameter("type", "Nodal");
23
25 auto const param_name = config.getConfigParameter<std::string>("parameter");
26 DBUG("Using parameter {:s} as nodal source term.", param_name);
27
28 auto& param = ParameterLib::findParameter<double>(param_name, parameters, 1,
29 &st_mesh);
30
31 return std::make_unique<NodalSourceTerm>(std::move(dof_table),
32 source_term_mesh_id, st_mesh,
33 variable_id, component_id, param);
34}

References BaseLib::ConfigTree::checkConfigParameter(), DBUG(), ParameterLib::findParameter(), and BaseLib::ConfigTree::getConfigParameter().

Referenced by createSourceTerm().

◆ createOutput() [1/2]

std::vector< Output > ProcessLib::createOutput ( const BaseLib::ConfigTree & config,
std::string const & output_directory,
std::vector< std::unique_ptr< MeshLib::Mesh > > & meshes )

Definition at line 95 of file ProcessLib/Output/CreateOutput.cpp.

99{
100 std::vector<Output> outputs;
101 auto oc = createOutputConfig(config, meshes);
102 outputs.push_back(createOutput(std::move(oc), output_directory, meshes));
103 return outputs;
104}
OutputConfig createOutputConfig(const BaseLib::ConfigTree &config, std::vector< std::unique_ptr< MeshLib::Mesh > > &meshes)
Output createOutput(OutputConfig &&oc, std::string const &output_directory, std::vector< std::unique_ptr< MeshLib::Mesh > > const &meshes)

References createOutput(), and createOutputConfig().

◆ createOutput() [2/2]

Output ProcessLib::createOutput ( OutputConfig && oc,
std::string const & output_directory,
std::vector< std::unique_ptr< MeshLib::Mesh > > const & meshes )

Definition at line 78 of file ProcessLib/Output/CreateOutput.cpp.

80{
81 auto output_format = createOutputFormat(
82 output_directory, oc.output_type, std::move(oc.prefix),
83 std::move(oc.suffix), oc.data_mode, oc.compress_output,
85
86 OutputDataSpecification output_data_specification{
87 std::move(oc.output_variables), std::move(oc.fixed_output_times),
89
90 return {std::move(output_format), oc.output_iteration_results,
91 std::move(output_data_specification),
92 std::move(oc.mesh_names_for_output), meshes};
93}
std::unique_ptr< OutputFormat > createOutputFormat(std::string const &output_directory, OutputType const output_type, std::string prefix, std::string suffix, std::string const &data_mode, bool const compress_output, unsigned int const number_of_files, unsigned int const chunk_size_bytes)
std::vector< PairRepeatEachSteps > repeats_each_steps
std::vector< double > fixed_output_times
unsigned int number_of_files
unsigned int chunk_size_bytes
std::set< std::string > output_variables
std::vector< std::string > mesh_names_for_output
Holds information about which variables to write to output files.

References createOutputFormat().

Referenced by createOutput(), createOutputs(), createSubmeshResiduumOutputConfig(), and createTimeLoop().

◆ createOutputConfig()

OutputConfig ProcessLib::createOutputConfig ( const BaseLib::ConfigTree & config,
std::vector< std::unique_ptr< MeshLib::Mesh > > & meshes )
Input File Parameter
prj__time_loop__output__type
Input File Parameter
prj__time_loop__output__prefix
Input File Parameter
prj__time_loop__output__suffix
Input File Parameter
prj__time_loop__output__compress_output
Input File Parameter
prj__time_loop__output__hdf
Input File Parameter
prj__time_loop__output__hdf__number_of_files
Input File Parameter
prj__time_loop__output__hdf__chunk_size_bytes
Input File Parameter
prj__time_loop__output__data_mode
Input File Parameter
prj__time_loop__output__fixed_output_times
Input File Parameter
prj__time_loop__output__fixed_output_times_from_file
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__geometrical_sets
Input File Parameter
prj__time_loop__output__geometrical_sets__geometrical_set
Input File Parameter
prj__time_loop__output__geometrical_sets__geometrical_set__name
Input File Parameter
prj__time_loop__output__geometrical_sets__geometrical_set__geometry
Input File Parameter
prj__time_loop__output__output_iteration_results

Definition at line 70 of file CreateOutputConfig.cpp.

73{
74 OutputConfig output_config;
75
76 output_config.output_type = [](auto output_type)
77 {
78 try
79 {
80 const std::map<std::string, OutputType> outputType_to_enum = {
81 {"VTK", OutputType::vtk}, {"XDMF", OutputType::xdmf}};
82 auto type = outputType_to_enum.at(output_type);
83
84 return type;
85 }
86 catch (std::out_of_range&)
87 {
89 "No supported file type provided. Read `{:s}' from <output><type> \
90 in prj File. Supported: VTK, XDMF.",
91 output_type);
92 }
94 }(config.getConfigParameter<std::string>("type"));
95
96 output_config.prefix =
98 config.getConfigParameter<std::string>("prefix", "{:meshname}");
99
100 output_config.suffix =
102 config.getConfigParameter<std::string>("suffix",
103 "_ts_{:timestep}_t_{:time}");
104
105 output_config.compress_output =
107 config.getConfigParameter("compress_output", true);
108
109 auto const hdf =
111 config.getConfigSubtreeOptional("hdf");
112
113 output_config.number_of_files = [&hdf]() -> unsigned int
114 {
115 if (hdf)
116 {
118 return hdf->getConfigParameter<unsigned int>("number_of_files");
119 }
120 return 1;
121 }();
122 output_config.chunk_size_bytes = [&hdf]() -> unsigned int
123 {
124 if (hdf)
125 {
127 return hdf->getConfigParameter<unsigned int>("chunk_size_bytes");
128 }
129 return 1048576; // default chunk size in bytes according to
130 // https://www.hdfgroup.org/2022/10/improve-hdf5-performance-using-caching/
131 }();
132
133 output_config.data_mode =
135 config.getConfigParameter<std::string>("data_mode", "Appended");
136
137 //
138 // Construction of output times
139 //
140
141 output_config.fixed_output_times =
143 config.getConfigParameter<std::vector<double>>("fixed_output_times",
144 {});
145 if (output_config.fixed_output_times.empty())
146 {
148 std::string filename = config.getConfigParameter<std::string>(
149 "fixed_output_times_from_file", "no_file");
150
151 if (filename != "no_file")
152 {
153 output_config.fixed_output_times =
155 filename, config.projectDirectory().string());
156 }
157 }
158 // Remove possible duplicated elements and sort.
160
161 auto& repeats_each_steps = output_config.repeats_each_steps;
162
164 if (auto const timesteps = config.getConfigSubtreeOptional("timesteps"))
165 {
167 for (auto pair : timesteps->getConfigSubtreeList("pair"))
168 {
170 auto repeat = pair.getConfigParameter<unsigned>("repeat");
172 auto each_steps = pair.getConfigParameter<unsigned>("each_steps");
173
174 assert(repeat != 0 && each_steps != 0);
175 repeats_each_steps.emplace_back(repeat, each_steps);
176 }
177
178 if (repeats_each_steps.empty())
179 {
180 OGS_FATAL(
181 "You have not given any pair (<repeat/>, <each_steps/>) that "
182 "defines at which timesteps output shall be written. "
183 "Aborting.");
184 }
185 }
186 // In case nothing was specified, i.e. no explicit time steps or fixed
187 // output times, every time step will be written.
188 if (output_config.fixed_output_times.empty() &&
189 output_config.repeats_each_steps.empty())
190 {
191 repeats_each_steps.emplace_back(1, 1);
192 }
193
195 auto const out_vars = config.getConfigSubtree("variables");
196
197 auto& output_variables = output_config.output_variables;
198 for (auto out_var :
200 out_vars.getConfigParameterList<std::string>("variable"))
201 {
202 if (output_variables.find(out_var) != output_variables.cend())
203 {
204 OGS_FATAL("output variable `{:s}' specified more than once.",
205 out_var);
206 }
207
208 DBUG("adding output variable `{:s}'", out_var);
209 output_variables.insert(out_var);
210 }
211
212 output_config.output_extrapolation_residuals =
214 config.getConfigParameter<bool>("output_extrapolation_residuals",
215 false);
216
217 auto& mesh_names_for_output = output_config.mesh_names_for_output;
219 if (auto const meshes_config = config.getConfigSubtreeOptional("meshes"))
220 {
221 if (output_config.prefix.find("{:meshname}") == std::string::npos)
222 {
223 OGS_FATAL(
224 "There are multiple meshes defined in the output section of "
225 "the project file, but the prefix doesn't contain "
226 "'{{:meshname}}'. Thus the names for the files, the simulation "
227 "results should be written to, would not be distinguishable "
228 "for different meshes.");
229 }
231 for (auto mesh_config : meshes_config->getConfigParameterList("mesh"))
232 {
233 mesh_names_for_output.push_back(
234 parseOutputMeshConfig(mesh_config, meshes));
235 INFO("Configure mesh '{:s}' for output.",
236 mesh_names_for_output.back());
237 }
238 }
239
240 if (auto const geometrical_sets_config =
242 config.getConfigSubtreeOptional("geometrical_sets"))
243 {
244 for (
245 auto geometrical_set_config :
247 geometrical_sets_config->getConfigSubtreeList("geometrical_set"))
248 {
249 auto const geometrical_set_name =
251 geometrical_set_config.getConfigParameter<std::string>("name",
252 "");
253 auto const geometry_name =
255 geometrical_set_config.getConfigParameter<std::string>(
256 "geometry");
257 mesh_names_for_output.push_back(geometrical_set_name + "_" +
258 geometry_name);
259 }
260 }
261
262 output_config.output_iteration_results =
264 config.getConfigParameter<bool>("output_iteration_results", false);
265
266 return output_config;
267}
std::string parseOutputMeshConfig(BaseLib::ConfigTree const &output_mesh_config, std::vector< std::unique_ptr< MeshLib::Mesh > > &meshes)
std::optional< ConfigTree > getConfigSubtreeOptional(std::string const &root) const
std::filesystem::path projectDirectory() const
T getConfigParameter(std::string const &param) const
ConfigTree getConfigSubtree(std::string const &root) const
std::vector< double > readDoublesFromBinaryFile(const std::string &filename, const std::string &project_directory)

References ProcessLib::OutputConfig::chunk_size_bytes, ProcessLib::OutputConfig::compress_output, ProcessLib::OutputConfig::data_mode, DBUG(), ProcessLib::OutputConfig::fixed_output_times, BaseLib::ConfigTree::getConfigParameter(), BaseLib::ConfigTree::getConfigSubtree(), BaseLib::ConfigTree::getConfigSubtreeOptional(), INFO(), BaseLib::makeVectorUnique(), ProcessLib::OutputConfig::mesh_names_for_output, ProcessLib::OutputConfig::number_of_files, OGS_FATAL, ProcessLib::OutputConfig::output_extrapolation_residuals, ProcessLib::OutputConfig::output_iteration_results, ProcessLib::OutputConfig::output_type, ProcessLib::OutputConfig::output_variables, parseOutputMeshConfig(), ProcessLib::OutputConfig::prefix, BaseLib::ConfigTree::projectDirectory(), BaseLib::readDoublesFromBinaryFile(), ProcessLib::OutputConfig::repeats_each_steps, ProcessLib::OutputConfig::suffix, vtk, and xdmf.

Referenced by createOutput(), createOutputs(), and createSubmeshResiduumOutputConfig().

◆ createOutputFormat()

std::unique_ptr< OutputFormat > ProcessLib::createOutputFormat ( std::string const & output_directory,
OutputType const output_type,
std::string prefix,
std::string suffix,
std::string const & data_mode,
bool const compress_output,
unsigned int const number_of_files,
unsigned int const chunk_size_bytes )

Definition at line 54 of file ProcessLib/Output/CreateOutput.cpp.

59{
60 switch (output_type)
61 {
62 case OutputType::vtk:
63 return std::make_unique<OutputVTKFormat>(
64 output_directory, std::move(prefix), std::move(suffix),
65 compress_output, convertVtkDataMode(data_mode));
67 return std::make_unique<OutputXDMFHDF5Format>(
68 output_directory, std::move(prefix), std::move(suffix),
69 compress_output, number_of_files, chunk_size_bytes);
70 default:
72 "No supported file type provided. Read '{}' from "
73 "<output><type> in prj file. Supported: VTK, XDMF.",
74 BaseLib::to_underlying(output_type));
75 }
76}
constexpr auto to_underlying(E e) noexcept
Converts an enumeration to its underlying type.
Definition cpp23.h:22

References OGS_FATAL, BaseLib::to_underlying(), vtk, and xdmf.

Referenced by createOutput().

◆ createOutputs()

std::vector< Output > ProcessLib::createOutputs ( const BaseLib::ConfigTree & output_configs,
std::string const & output_directory,
std::vector< std::unique_ptr< MeshLib::Mesh > > & meshes )
Input File Parameter
prj__time_loop__outputs__output

Definition at line 106 of file ProcessLib/Output/CreateOutput.cpp.

110{
111 DBUG("Parse outputs configuration:");
112 std::vector<Output> outputs;
113 for (auto const& output_config :
115 output_configs.getConfigSubtreeList("output"))
116 {
117 auto oc = createOutputConfig(output_config, meshes);
118 outputs.push_back(
119 createOutput(std::move(oc), output_directory, meshes));
120 }
121 if (areOutputNamesUnique(outputs))
122 {
123 return outputs;
124 }
125 else
126 {
127 OGS_FATAL(
128 "Output configuration paths are not unique. This will lead to "
129 "overwritten results or invalid / corrupted data within the "
130 "files.");
131 }
132}
Range< SubtreeIterator > getConfigSubtreeList(std::string const &root) const

References createOutput(), createOutputConfig(), DBUG(), BaseLib::ConfigTree::getConfigSubtreeList(), and OGS_FATAL.

Referenced by createTimeLoop().

◆ 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,
bool const compensate_non_equilibrium_initial_residuum,
std::vector< double > const & fixed_times_for_output )
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__process_name
Input File Parameter
prj__time_loop__processes__process__nonlinear_solver
Input File Parameter
prj__time_loop__processes__process__time_discretization
Input File Parameter
prj__time_loop__processes__process__time_stepping
Input File Parameter
prj__time_loop__processes__process__convergence_criterion
Input File Parameter
prj__time_loop__processes__process__output

Definition at line 63 of file CreateProcessData.cpp.

70{
71 std::vector<std::unique_ptr<ProcessData>> per_process_data;
72 std::vector<std::string> process_names;
73 int process_id = 0;
74
76 for (auto pcs_config : config.getConfigSubtreeList("process"))
77 {
79 auto const pcs_name = pcs_config.getConfigAttribute<std::string>("ref");
80 auto& pcs = *BaseLib::getIfOrError(
81 processes,
82 [&pcs_name](std::unique_ptr<Process> const& p)
83 { return p->name == pcs_name; },
84 "A process with the given name has not been defined.");
85
86 auto const process_name =
88 pcs_config.getConfigParameter<std::string>("process_name", "");
89 if (process_name != "")
90 {
91 if (ranges::contains(process_names, process_name))
92 {
94 "The given process name is not unique! Please check the "
95 "element "
96 "'time_loop/process/name' in the project file. Found "
97 "duplicate "
98 "process name '{:s}'.",
99 process_name);
100 }
101 process_names.emplace_back(process_name);
102 }
103
104 auto const nl_slv_name =
106 pcs_config.getConfigParameter<std::string>("nonlinear_solver");
107 auto& nl_slv = *BaseLib::getOrError(
108 nonlinear_solvers, nl_slv_name,
109 "A nonlinear solver with the given name has not been defined.");
110
111 auto time_disc = NumLib::createTimeDiscretization(
113 pcs_config.getConfigSubtree("time_discretization"));
114
115 auto timestepper = NumLib::createTimeStepper(
117 pcs_config.getConfigSubtree("time_stepping"),
118 fixed_times_for_output);
119
120 auto conv_crit = NumLib::createConvergenceCriterion(
122 pcs_config.getConfigSubtree("convergence_criterion"));
123
125 auto output = pcs_config.getConfigSubtreeOptional("output");
126 if (output)
127 {
128 OGS_FATAL(
129 "In order to make the specification of output in the project "
130 "file consistent, the variables output tags were moved from "
131 "xpath "
132 "'//OpenGeoSysProject/time_loop/processes/process/output' to "
133 "the global output section, i.e., to the xpath "
134 "'//OpenGeoSysProject/time_loop/output'. This has to be done "
135 "in the current project file!");
136 }
137
138 per_process_data.emplace_back(makeProcessData(
139 std::move(timestepper), nl_slv, process_id, std::move(process_name),
140 pcs, std::move(time_disc), std::move(conv_crit),
141 compensate_non_equilibrium_initial_residuum));
142 ++process_id;
143 }
144
145 if (per_process_data.size() != processes.size())
146 {
147 if (processes.size() > 1)
148 {
149 OGS_FATAL(
150 "Some processes have not been configured to be solved by this "
151 "time loop.");
152 }
153 else
154 {
155 INFO(
156 "The equations of the coupled processes will be solved by the "
157 "staggered scheme.");
158 }
159 }
160
161 return per_process_data;
162}
OGS_NO_DANGLING Container::value_type const & getIfOrError(Container const &container, Predicate &&predicate, std::string const &error_message)
Definition Algorithm.h:156
OGS_NO_DANGLING Map::mapped_type & getOrError(Map &map, Key const &key, std::string const &error_message)
Definition Algorithm.h:111
std::unique_ptr< TimeDiscretization > createTimeDiscretization(BaseLib::ConfigTree const &config)
std::unique_ptr< TimeStepAlgorithm > createTimeStepper(BaseLib::ConfigTree const &config, std::vector< double > const &fixed_times_for_output)
std::unique_ptr< ConvergenceCriterion > createConvergenceCriterion(const BaseLib::ConfigTree &config)
Creates a convergence criterion from the given configuration.
static std::unique_ptr< ProcessData > makeProcessData(std::unique_ptr< NumLib::TimeStepAlgorithm > &&timestepper, NumLib::NonlinearSolverBase &nonlinear_solver, int const process_id, std::string process_name, Process &process, std::unique_ptr< NumLib::TimeDiscretization > &&time_disc, std::unique_ptr< NumLib::ConvergenceCriterion > &&conv_crit, bool const compensate_non_equilibrium_initial_residuum)

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

Referenced by createTimeLoop().

◆ createPhaseFieldIrreversibleDamageOracleBoundaryCondition()

std::unique_ptr< PhaseFieldIrreversibleDamageOracleBoundaryCondition > ProcessLib::createPhaseFieldIrreversibleDamageOracleBoundaryCondition ( NumLib::LocalToGlobalIndexMap const & dof_table,
MeshLib::Mesh const & mesh,
int const variable_id,
int const component_id )

Definition at line 74 of file PhaseFieldIrreversibleDamageOracleBoundaryCondition.cpp.

77{
78 DBUG("Constructing PhaseFieldIrreversibleDamageOracleBoundaryCondition.");
79
80 return std::make_unique<
82 dof_table, mesh, variable_id, component_id);
83}

References DBUG().

Referenced by createBoundaryCondition().

◆ createPrimaryVariableConstraintDirichletBoundaryCondition()

std::unique_ptr< PrimaryVariableConstraintDirichletBoundaryCondition > ProcessLib::createPrimaryVariableConstraintDirichletBoundaryCondition ( PrimaryVariableConstraintDirichletBoundaryConditionConfig 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 )

Definition at line 124 of file PrimaryVariableConstraintDirichletBoundaryCondition.cpp.

130{
131 DBUG("Constructing PrimaryVariableConstraintDirichletBoundaryCondition.");
132
133 auto& parameter = ParameterLib::findParameter<double>(
134 config.parameter_name, parameters, 1, &bc_mesh);
135
136 auto& threshold_parameter = ParameterLib::findParameter<double>(
137 config.threshold_parameter_name, parameters, 1, &bc_mesh);
138
139 if (config.comparison_operator_string != "greater" &&
140 config.comparison_operator_string != "less")
141 {
142 OGS_FATAL(
143 "The comparison operator is '{:s}', but has to be either "
144 "'greater' or 'less'.",
145 config.comparison_operator_string);
146 }
147 bool const less = config.comparison_operator_string == "less";
148
149// In case of partitioned mesh the boundary could be empty, i.e. there is no
150// boundary condition.
151#ifdef USE_PETSC
152 // This can be extracted to createBoundaryCondition() but then the config
153 // parameters are not read and will cause an error.
154 // TODO (naumov): Add a function to ConfigTree for skipping the tags of the
155 // subtree and move the code up in createBoundaryCondition().
156 if (bc_mesh.getDimension() == 0 && bc_mesh.getNumberOfNodes() == 0 &&
157 bc_mesh.getNumberOfElements() == 0)
158 {
159 return nullptr;
160 }
161#endif // USE_PETSC
162
163 return std::make_unique<
165 parameter, bc_mesh, dof_table_bulk, variable_id, component_id,
166 threshold_parameter, less);
167}

References ProcessLib::PrimaryVariableConstraintDirichletBoundaryConditionConfig::comparison_operator_string, DBUG(), ParameterLib::findParameter(), MeshLib::Mesh::getDimension(), MeshLib::Mesh::getNumberOfElements(), MeshLib::Mesh::getNumberOfNodes(), OGS_FATAL, ProcessLib::PrimaryVariableConstraintDirichletBoundaryConditionConfig::parameter_name, and ProcessLib::PrimaryVariableConstraintDirichletBoundaryConditionConfig::threshold_parameter_name.

Referenced by createBoundaryCondition().

◆ createProcessOutputData()

ProcessOutputData ProcessLib::createProcessOutputData ( Process const & process,
std::size_t const n_processes,
MeshLib::Mesh & output_mesh )

Extracts data necessary for output from the given process.

Definition at line 136 of file ProcessOutputData.cpp.

139{
140 auto bulk_mesh_dof_tables =
141 getDofTablesOfAllProcesses(process, n_processes);
142
143 auto [output_mesh_dof_tables, container_that_owns_output_mesh_dof_tables] =
144 computeOutputMeshDofTables(process, output_mesh, bulk_mesh_dof_tables);
145
146 return {getProcessVariablesOfAllProcesses(process, n_processes),
147 process.getSecondaryVariables(),
148 ::getIntegrationPointWriters(process, output_mesh),
149 std::move(bulk_mesh_dof_tables),
150 std::move(output_mesh_dof_tables),
151 std::move(container_that_owns_output_mesh_dof_tables),
152 output_mesh};
153}

References ProcessLib::Process::getSecondaryVariables().

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

◆ createPythonBoundaryCondition()

std::unique_ptr< PythonBoundaryCondition > ProcessLib::createPythonBoundaryCondition ( PythonBoundaryConditionConfig const & config,
MeshLib::Mesh const & boundary_mesh,
NumLib::LocalToGlobalIndexMap const & dof_table_bulk,
MeshLib::Mesh const & bulk_mesh,
int const variable_id,
int const component_id,
unsigned const integration_order,
unsigned const shapefunction_order,
std::vector< std::reference_wrapper< ProcessVariable > > const & all_process_variables_for_this_process )

Creates a new PythonBoundaryCondition object.

Definition at line 276 of file PythonBoundaryCondition.cpp.

285{
286 // Evaluate Python code in scope of main module
287 pybind11::object scope =
288 pybind11::module::import("__main__").attr("__dict__");
289
290 if (!scope.contains(config.bc_object))
291 {
292 OGS_FATAL(
293 "Function `{:s}' is not defined in the python script file, or "
294 "there was no python script file specified.",
295 config.bc_object);
296 }
297
298 auto* bc = scope[config.bc_object.c_str()]
299 .cast<PythonBoundaryConditionPythonSideInterface*>();
300
301 if (variable_id >=
302 static_cast<int>(dof_table_bulk.getNumberOfVariables()) ||
303 component_id >=
304 dof_table_bulk.getNumberOfVariableComponents(variable_id))
305 {
306 OGS_FATAL(
307 "Variable id or component id too high. Actual values: ({:d}, "
308 "{:d}), maximum values: ({:d}, {:d}).",
309 variable_id, component_id, dof_table_bulk.getNumberOfVariables(),
310 dof_table_bulk.getNumberOfVariableComponents(variable_id));
311 }
312
313 // In case of partitioned mesh the boundary could be empty, i.e. there is no
314 // boundary condition.
315#ifdef USE_PETSC
316 // This can be extracted to createBoundaryCondition() but then the config
317 // parameters are not read and will cause an error.
318 // TODO (naumov): Add a function to ConfigTree for skipping the tags of the
319 // subtree and move the code up in createBoundaryCondition().
320 if (boundary_mesh.getDimension() == 0 &&
321 boundary_mesh.getNumberOfNodes() == 0 &&
322 boundary_mesh.getNumberOfElements() == 0)
323 {
324 return nullptr;
325 }
326#endif // USE_PETSC
327
328 return std::make_unique<PythonBoundaryCondition>(
330 {bc, dof_table_bulk.getGlobalComponent(variable_id, component_id),
331 boundary_mesh, all_process_variables_for_this_process,
332 shapefunction_order}},
333 integration_order, config.flush_stdout, bulk_mesh.getDimension(),
334 dof_table_bulk);
335}

References ProcessLib::PythonBoundaryConditionConfig::bc_object, ProcessLib::PythonBoundaryConditionConfig::flush_stdout, MeshLib::Mesh::getDimension(), NumLib::LocalToGlobalIndexMap::getGlobalComponent(), MeshLib::Mesh::getNumberOfElements(), MeshLib::Mesh::getNumberOfNodes(), NumLib::LocalToGlobalIndexMap::getNumberOfVariableComponents(), NumLib::LocalToGlobalIndexMap::getNumberOfVariables(), and OGS_FATAL.

Referenced by createBoundaryCondition().

◆ 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,
std::vector< std::reference_wrapper< ProcessVariable > > const & all_process_variables_for_this_process )
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 17 of file CreatePythonSourceTerm.cpp.

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

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

Referenced by createSourceTerm().

◆ createReleaseNodalForce()

std::unique_ptr< BoundaryCondition > ProcessLib::createReleaseNodalForce ( unsigned const global_dim,
int const variable_id,
std::string const & decay_parameter_name,
BoundaryConditionConfig const & bc_config,
MeshLib::Mesh const & bc_mesh,
NumLib::LocalToGlobalIndexMap const & dof_table_bulk,
std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const & parameters )

Definition at line 46 of file CreateReleaseNodalForce.cpp.

52{
53 DBUG("Create ReleaseNodalForce boundary condition.");
54
55 if (!bc_config.compensate_non_equilibrium_initial_residuum)
56 {
58 "The compensate_non_equilibrium_initial_residuum must be set for "
59 "the ReleaseNodalForce boundary condition.");
60 }
61
62 auto const& time_decay_parameter = ParameterLib::findParameter<double>(
63 decay_parameter_name, parameters, 1, &bc_mesh);
64
65 // In case of partitioned mesh the boundary could be empty, i.e. there
66 // is no boundary condition.
67#ifdef USE_PETSC
68 // This can be extracted to createBoundaryCondition() but then the
69 // config parameters are not read and will cause an error.
70 // TODO (naumov): Add a function to ConfigTree for skipping the tags of
71 // the subtree and move the code up in createBoundaryCondition().
72 if (bc_mesh.getDimension() == 0 && bc_mesh.getNumberOfNodes() == 0 &&
73 bc_mesh.getNumberOfElements() == 0)
74 {
75 return nullptr;
76 }
77#endif // USE_PETSC
78
79 if (bc_mesh.getDimension() >= global_dim)
80 {
82 "The dimension ({:d}) of the given boundary mesh '{:s}' is not "
83 "lower than the bulk dimension ({:d}).",
84 bc_mesh.getDimension(), bc_mesh.getName(), global_dim);
85 }
86
87 // Create component ids vector for the current variable.
88 auto const& number_of_components =
89 dof_table_bulk.getNumberOfVariableComponents(variable_id);
90 std::vector<int> component_ids =
91 ranges::views::iota(0, number_of_components) | ranges::to_vector;
92
93 // BC mesh subset creation
94 std::vector<MeshLib::Node*> const bc_nodes = bc_mesh.getNodes();
95 DBUG("Found {:d} nodes for Natural BCs for the variable {:d}",
96 bc_nodes.size(), variable_id);
97
98 MeshLib::MeshSubset bc_mesh_subset(bc_mesh, bc_nodes);
99
100 // Create local DOF table from the BC mesh subset for the given variable
101 // and component ids.
102 auto dof_table_boundary = dof_table_bulk.deriveBoundaryConstrainedMap(
103 variable_id, std::move(component_ids), std::move(bc_mesh_subset));
104
105 ParameterLib::SpatialPosition pos;
106 pos.setNodeID(0);
107 pos.setCoordinates(MathLib::Point3d{});
108 if (time_decay_parameter(0, pos).front() - 1.0 >
109 std::numeric_limits<double>::epsilon())
110 {
111 OGS_FATAL(
112 "The time_decay_parameter '{:s}' must be equal to 1.0 at t=0.0. "
113 "and decrease over time to 0. ",
114 decay_parameter_name);
115 }
116
117 return std::make_unique<ReleaseNodalForce>(
118 variable_id, bc_mesh, dof_table_boundary, time_decay_parameter);
119}
void setNodeID(std::size_t node_id)
void setCoordinates(MathLib::Point3d const &coordinates)

References ProcessLib::BoundaryConditionConfig::compensate_non_equilibrium_initial_residuum, DBUG(), NumLib::LocalToGlobalIndexMap::deriveBoundaryConstrainedMap(), ParameterLib::findParameter(), MeshLib::Mesh::getDimension(), MeshLib::Mesh::getName(), MeshLib::Mesh::getNodes(), MeshLib::Mesh::getNumberOfElements(), MeshLib::Mesh::getNumberOfNodes(), NumLib::LocalToGlobalIndexMap::getNumberOfVariableComponents(), OGS_FATAL, ParameterLib::SpatialPosition::setCoordinates(), and ParameterLib::SpatialPosition::setNodeID().

Referenced by createBoundaryCondition().

◆ createRobinBoundaryCondition()

std::unique_ptr< RobinBoundaryCondition > ProcessLib::createRobinBoundaryCondition ( RobinBoundaryConditionConfig 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 \).

Definition at line 34 of file RobinBoundaryCondition.cpp.

40{
41 DBUG("Constructing RobinBcConfig.");
42
43 if (bc_mesh.getDimension() >= global_dim)
44 {
46 "The dimension ({:d}) of the given boundary mesh '{:s}' is not "
47 "lower than the bulk dimension ({:d}).",
48 bc_mesh.getDimension(), bc_mesh.getName(), global_dim);
49 }
50
51 auto const& alpha = ParameterLib::findParameter<double>(
52 config.alpha_name, parameters, 1, &bc_mesh);
54 config.u_0_name, parameters, 1, &bc_mesh);
55
56 ParameterLib::Parameter<double> const* integral_measure(nullptr);
57 if (global_dim - bc_mesh.getDimension() != 1)
58 {
59 if (!config.area_parameter_name)
60 {
61 OGS_FATAL("{}: tag <area_parameter> required in Robin BC.",
62 __FUNCTION__);
63 }
64 integral_measure = &ParameterLib::findParameter<double>(
65 config.area_parameter_name.value(), parameters, 1, &bc_mesh);
66 }
67
68 // In case of partitioned mesh the boundary could be empty, i.e. there is no
69 // boundary condition.
70#ifdef USE_PETSC
71 // This can be extracted to createBoundaryCondition() but then the config
72 // parameters are not read and will cause an error.
73 // TODO (naumov): Add a function to ConfigTree for skipping the tags of the
74 // subtree and move the code up in createBoundaryCondition().
75 if (bc_mesh.getDimension() == 0 && bc_mesh.getNumberOfNodes() == 0 &&
76 bc_mesh.getNumberOfElements() == 0)
77 {
78 return nullptr;
79 }
80#endif // USE_PETSC
81
82 return std::make_unique<RobinBoundaryCondition>(
83 integration_order, shapefunction_order, dof_table, variable_id,
84 component_id, global_dim, bc_mesh,
85 RobinBoundaryConditionData{alpha, u_0, integral_measure});
86}

References ProcessLib::RobinBoundaryConditionConfig::alpha_name, ProcessLib::RobinBoundaryConditionConfig::area_parameter_name, DBUG(), ParameterLib::findParameter(), MeshLib::Mesh::getDimension(), MeshLib::Mesh::getName(), MeshLib::Mesh::getNumberOfElements(), MeshLib::Mesh::getNumberOfNodes(), OGS_FATAL, and ProcessLib::RobinBoundaryConditionConfig::u_0_name.

Referenced by createBoundaryCondition().

◆ 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__name
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 11 of file CreateSecondaryVariables.cpp.

13{
14 auto sec_vars_config =
16 config.getConfigSubtreeOptional("secondary_variables");
17 if (!sec_vars_config)
18 {
19 return;
20 }
21
22 for (
23 auto sec_var_config :
25 sec_vars_config->getConfigSubtreeList("secondary_variable"))
26 {
27 auto const type =
29 sec_var_config.getConfigAttributeOptional<std::string>("type");
30 if (type)
31 {
32 WARN(
33 "Secondary variable type specification is deprecated and is "
34 "ignored. All secondary variable types are 'static'.");
35 }
36
37 auto const [internal_name, output_name] =
38 [&sec_var_config]() -> std::pair<std::string, std::string>
39 {
40 auto const name =
42 sec_var_config.getConfigAttributeOptional<std::string>("name");
43 if (name)
44 {
45 return {*name, *name};
46 }
47 else
48 {
49 auto const internal_name =
51 sec_var_config.getConfigAttribute<std::string>(
52 "internal_name");
53 auto const output_name =
55 sec_var_config.getConfigAttribute<std::string>(
56 "output_name");
57 return {internal_name, output_name};
58 }
59 }();
60
61 secondary_variables.addNameMapping(internal_name, output_name);
62 }
63}
void addNameMapping(std::string const &internal_name, std::string const &external_name)
Register a variable with the given internal and external names.

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

Referenced by ProcessLib::ComponentTransport::createComponentTransportProcess(), ProcessLib::HeatConduction::createHeatConductionProcess(), ProcessLib::HeatTransportBHE::createHeatTransportBHEProcess(), ProcessLib::HMPhaseField::createHMPhaseFieldProcess(), ProcessLib::HT::createHTProcess(), ProcessLib::HydroMechanics::createHydroMechanicsProcess(), ProcessLib::LIE::HydroMechanics::createHydroMechanicsProcess(), ProcessLib::LargeDeformation::createLargeDeformationProcess(), ProcessLib::LiquidFlow::createLiquidFlowProcess(), ProcessLib::PhaseField::createPhaseFieldProcess(), ProcessLib::RichardsComponentTransport::createRichardsComponentTransportProcess(), ProcessLib::RichardsFlow::createRichardsFlowProcess(), ProcessLib::RichardsMechanics::createRichardsMechanicsProcess(), ProcessLib::LIE::SmallDeformation::createSmallDeformationProcess(), ProcessLib::SmallDeformation::createSmallDeformationProcess(), ProcessLib::SteadyStateDiffusion::createSteadyStateDiffusion(), ProcessLib::TH2M::createTH2MProcess(), ProcessLib::ThermalTwoPhaseFlowWithPP::createThermalTwoPhaseFlowWithPPProcess(), ProcessLib::ThermoHydroMechanics::createThermoHydroMechanicsProcess(), ProcessLib::ThermoMechanics::createThermoMechanicsProcess(), ProcessLib::ThermoRichardsFlow::createThermoRichardsFlowProcess(), ProcessLib::ThermoRichardsMechanics::createThermoRichardsMechanicsProcessStage2(), ProcessLib::TwoPhaseFlowWithPP::createTwoPhaseFlowWithPPProcess(), and ProcessLib::WellboreSimulator::createWellboreSimulatorProcess().

◆ createSolutionDependentDirichletBoundaryCondition()

std::unique_ptr< SolutionDependentDirichletBoundaryCondition > ProcessLib::createSolutionDependentDirichletBoundaryCondition ( SolutionDependentDirichletBoundaryConditionConfig const & config,
MeshLib::Mesh const & bc_mesh,
NumLib::LocalToGlobalIndexMap const & dof_table_bulk,
int const variable_id,
int const component_id,
std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const & parameters )

Definition at line 113 of file SolutionDependentDirichletBoundaryCondition.cpp.

119{
120 DBUG("Constructing SolutionDependentDirichletBoundaryCondition.");
121
122 auto& initial_value_parameter = ParameterLib::findParameter<double>(
123 config.initial_value_parameter_string, parameters, 1, &bc_mesh);
124
125// In case of partitioned mesh the boundary could be empty, i.e. there is no
126// boundary condition.
127#ifdef USE_PETSC
128 // This can be extracted to createBoundaryCondition() but then the config
129 // parameters are not read and will cause an error.
130 // TODO (naumov): Add a function to ConfigTree for skipping the tags of the
131 // subtree and move the code up in createBoundaryCondition().
132 if (bc_mesh.getDimension() == 0 && bc_mesh.getNumberOfNodes() == 0 &&
133 bc_mesh.getNumberOfElements() == 0)
134 {
135 return nullptr;
136 }
137#endif // USE_PETSC
138
139 return std::make_unique<SolutionDependentDirichletBoundaryCondition>(
140 config.property_name, initial_value_parameter, bc_mesh, dof_table_bulk,
141 variable_id, component_id);
142}

References DBUG(), ParameterLib::findParameter(), MeshLib::Mesh::getDimension(), MeshLib::Mesh::getNumberOfElements(), MeshLib::Mesh::getNumberOfNodes(), ProcessLib::SolutionDependentDirichletBoundaryConditionConfig::initial_value_parameter_string, and ProcessLib::SolutionDependentDirichletBoundaryConditionConfig::property_name.

Referenced by createBoundaryCondition().

◆ createSourceTerm()

std::unique_ptr< SourceTermBase > 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,
std::vector< std::reference_wrapper< ProcessVariable > > const & all_process_variables_for_this_process,
const MeshLib::Mesh & bulk_mesh )
Input File Parameter
prj__process_variables__process_variable__source_terms__source_term__type

Definition at line 19 of file CreateSourceTerm.cpp.

28{
30 auto const type = config.config.peekConfigParameter<std::string>("type");
31
32 // check basic data consistency
33 if (variable_id >=
34 static_cast<int>(dof_table_bulk.getNumberOfVariables()) ||
35 config.component_id >=
36 dof_table_bulk.getNumberOfVariableComponents(variable_id))
37 {
39 "Variable id or component id too high. Actual values: ({:d}, "
40 "{:d}), maximum values: ({:d}, {:d}).",
41 variable_id, config.component_id,
42 dof_table_bulk.getNumberOfVariables(),
43 dof_table_bulk.getNumberOfVariableComponents(variable_id));
44 }
45
46 if (!source_term_mesh.getProperties()
47 .template existsPropertyVector<std::size_t>(
49 (type != "EmbeddedAnchor"))
50 {
52 "The required bulk node ids map does not exist in the source term "
53 "mesh '{:s}'.",
54 source_term_mesh.getName());
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} "
60 "and component {:d}",
61 source_term_nodes.size(), source_term_mesh.getName(), variable_id,
62 config.component_id);
63
64 MeshLib::MeshSubset source_term_mesh_subset(source_term_mesh,
65 source_term_nodes);
66
67 if (type == "Nodal")
68 {
69 auto dof_table_source_term =
70 dof_table_bulk.deriveBoundaryConstrainedMap(
71 variable_id, {config.component_id},
72 std::move(source_term_mesh_subset));
74 config.config, config.mesh, std::move(dof_table_source_term),
75 source_term_mesh.getID(), variable_id, config.component_id,
76 parameters);
77 }
78 if (type == "Anchor")
79 {
80 const int number_of_components =
81 dof_table_bulk.getNumberOfVariableComponents(variable_id);
82 std::vector<int> component_ids(number_of_components);
83 std::iota(std::begin(component_ids), std::end(component_ids), 0);
84 auto dof_table_source_term =
85 dof_table_bulk.deriveBoundaryConstrainedMap(
86 variable_id, component_ids, std::move(source_term_mesh_subset));
87 const int bulk_mesh_dimension =
88 dof_table_bulk.getMeshSubset(variable_id, 0)
89 .getMesh()
90 .getDimension();
91 if (bulk_mesh_dimension != number_of_components)
92 {
94 "For the Anchor source term type,"
95 "the bulk mesh dimension needs to be the same "
96 "as the number of process variable components.");
97 }
98 switch (bulk_mesh_dimension)
99 {
100 case 2:
102 config.config, config.mesh,
103 std::move(dof_table_source_term), source_term_mesh.getID(),
104 variable_id, parameters);
105 case 3:
107 config.config, config.mesh,
108 std::move(dof_table_source_term), source_term_mesh.getID(),
109 variable_id, parameters);
110 default:
111 OGS_FATAL(
112 "Anchor can not be instantiated "
113 "for mesh dimensions other than two or three. "
114 "{}-dimensional mesh was given.",
115 bulk_mesh_dimension);
116 }
117 }
118 if (type == "EmbeddedAnchor")
119 {
120 const int number_of_components =
121 dof_table_bulk.getNumberOfVariableComponents(variable_id);
122
123 const int bulk_mesh_dimension = bulk_mesh.getDimension();
124 if (bulk_mesh_dimension != number_of_components)
125 {
126 OGS_FATAL(
127 "For the EmbeddedAnchor source term type,"
128 "the bulk mesh dimension needs to be the same "
129 "as the number of process variable components.");
130 }
131 switch (bulk_mesh_dimension)
132 {
133 case 2:
135 config.config, config.mesh, bulk_mesh, dof_table_bulk,
136 source_term_mesh.getID(), variable_id);
137 case 3:
139 config.config, config.mesh, bulk_mesh, dof_table_bulk,
140 source_term_mesh.getID(), variable_id);
141 default:
142 OGS_FATAL(
143 "Anchor can not be instantiated "
144 "for mesh dimensions other than two or three. "
145 "{}-dimensional mesh was given.",
146 bulk_mesh_dimension);
147 }
148 }
149 if (type == "Line" || type == "Volumetric")
150 {
151 auto dof_table_source_term =
152 dof_table_bulk.deriveBoundaryConstrainedMap(
153 variable_id, {config.component_id},
154 std::move(source_term_mesh_subset));
155 auto const& bulk_mesh_dimension =
156 dof_table_bulk.getMeshSubset(variable_id, config.component_id)
157 .getMesh()
158 .getDimension();
160 config.config, bulk_mesh_dimension, config.mesh,
161 std::move(dof_table_source_term), parameters, integration_order,
162 shapefunction_order);
163 }
164 if (type == "Python")
165 {
166 auto dof_table_source_term =
167 dof_table_bulk.deriveBoundaryConstrainedMap(
168 std::move(source_term_mesh_subset));
169
171 config.config, config.mesh, std::move(dof_table_source_term),
172 variable_id, config.component_id, integration_order,
173 shapefunction_order, source_term_mesh.getDimension(),
174 all_process_variables_for_this_process);
175 }
176
177 OGS_FATAL("Unknown source term type: `{:s}'.", type);
178}
Mesh const & getMesh() const
Definition MeshSubset.h:83
std::vector< Node * > const & getNodes() const
Get the nodes-vector for the mesh.
Definition Mesh.h:97
std::size_t getID() const
Get id of the mesh.
Definition Mesh.h:112
int getNumberOfVariableComponents(int variable_id) const
std::unique_ptr< 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
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, std::vector< std::reference_wrapper< ProcessVariable > > const &all_process_variables_for_this_process)
template std::unique_ptr< SourceTerm > createAnchorTerm< 3 >(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, std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const &parameters)
template std::unique_ptr< SourceTermBase > createEmbeddedAnchor< 2 >(BaseLib::ConfigTree const &config, MeshLib::Mesh const &st_mesh, MeshLib::Mesh const &bulk_mesh, NumLib::LocalToGlobalIndexMap const &dof_table_bulk, std::size_t const source_term_mesh_id, const int variable_id)
template std::unique_ptr< SourceTerm > createAnchorTerm< 2 >(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, std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const &parameters)
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)
template std::unique_ptr< SourceTermBase > createEmbeddedAnchor< 3 >(BaseLib::ConfigTree const &config, MeshLib::Mesh const &st_mesh, MeshLib::Mesh const &bulk_mesh, NumLib::LocalToGlobalIndexMap const &dof_table_bulk, std::size_t const source_term_mesh_id, const int variable_id)
std::unique_ptr< SourceTerm > createVolumetricSourceTerm(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)
MeshLib::Mesh const & mesh

References ProcessLib::SourceTermConfig::component_id, ProcessLib::SourceTermConfig::config, createAnchorTerm< 2 >(), createAnchorTerm< 3 >(), createEmbeddedAnchor< 2 >(), createEmbeddedAnchor< 3 >(), createNodalSourceTerm(), createPythonSourceTerm(), createVolumetricSourceTerm(), DBUG(), NumLib::LocalToGlobalIndexMap::deriveBoundaryConstrainedMap(), MeshLib::getBulkIDString(), 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, MeshLib::Node, OGS_FATAL, and BaseLib::ConfigTree::peekConfigParameter().

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

◆ createSubmeshResiduumOutputConfig()

SubmeshResiduumOutputConfig ProcessLib::createSubmeshResiduumOutputConfig ( BaseLib::ConfigTree const & config,
std::string const & output_directory,
std::vector< std::unique_ptr< MeshLib::Mesh > > & meshes )

Definition at line 203 of file SubmeshResiduumOutputConfig.cpp.

206{
207 auto oc = createOutputConfig(config, meshes);
208
209 if (oc.mesh_names_for_output.empty())
210 {
211 OGS_FATAL(
212 "You did not specify any meshes for submesh residuum output.");
213 }
214
215 if (!areElementsUnique(oc.mesh_names_for_output))
216 {
217 OGS_FATAL("The mesh names for submesh residuum output are not unique.");
218 }
219
220 auto const meshes_filtered =
221 filterMeshesForResiduumOutput(meshes, oc.mesh_names_for_output);
222
223 for (auto const& mesh : meshes_filtered)
224 {
225 checkBulkIDMappingsPresent(mesh.get());
226 }
227
228 auto const& bulk_mesh =
229 *meshes.front(); // convention: the first mesh is the bulk mesh
230 checkNonOverlappingCover(bulk_mesh, meshes_filtered);
231
232 return {createOutput(std::move(oc), output_directory, meshes),
233 std::move(meshes_filtered)};
234}
std::vector< std::reference_wrapper< MeshLib::Mesh > > filterMeshesForResiduumOutput(std::vector< std::unique_ptr< MeshLib::Mesh > > const &meshes, std::vector< std::string > const &mesh_names_for_output)
void checkNonOverlappingCover(MeshLib::Mesh const &bulk_mesh, std::vector< std::reference_wrapper< MeshLib::Mesh > > const &submesh_refs)

References createOutput(), createOutputConfig(), and OGS_FATAL.

Referenced by createTimeLoop().

◆ createTimeDecayDirichletBoundaryCondition()

std::unique_ptr< BoundaryCondition > ProcessLib::createTimeDecayDirichletBoundaryCondition ( TimeDecayDirichletBoundaryConditionConfig const & config,
int const variable_id,
int const component_id,
MeshLib::Mesh const & bc_mesh,
NumLib::LocalToGlobalIndexMap const & dof_table_bulk,
std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const & parameters )

Definition at line 37 of file CreateTimeDecayDirichletBoundaryCondition.cpp.

42{
43 DBUG("Create TimeDecayDirichlet.");
44 auto const& time_decay_parameter = ParameterLib::findParameter<double>(
45 config.parameter_name, parameters, 1, &bc_mesh);
46
47 // In case of partitioned mesh the boundary could be empty, i.e. there
48 // is no boundary condition.
49#ifdef USE_PETSC
50 // This can be extracted to createBoundaryCondition() but then the config
51 // parameters are not read and will cause an error.
52 // TODO (naumov): Add a function to ConfigTree for skipping the tags of the
53 // subtree and move the code up in createBoundaryCondition().
54 if (bc_mesh.getDimension() == 0 && bc_mesh.getNumberOfNodes() == 0 &&
55 bc_mesh.getNumberOfElements() == 0)
56 {
57 return nullptr;
58 }
59#endif // USE_PETSC
60
61 return std::make_unique<TimeDecayDirichletBoundaryCondition>(
62 variable_id, component_id, bc_mesh, dof_table_bulk,
63 time_decay_parameter, config.lower_limit);
64}

References DBUG(), ParameterLib::findParameter(), MeshLib::Mesh::getDimension(), MeshLib::Mesh::getNumberOfElements(), MeshLib::Mesh::getNumberOfNodes(), ProcessLib::TimeDecayDirichletBoundaryConditionConfig::lower_limit, and ProcessLib::TimeDecayDirichletBoundaryConditionConfig::parameter_name.

Referenced by createBoundaryCondition().

◆ 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 > > & meshes,
bool const compensate_non_equilibrium_initial_residuum )

Builds a TimeLoop from the given configuration.

Input File Parameter
prj__time_loop__output
Input File Parameter
prj__time_loop__outputs
Input File Parameter
prj__time_loop__submesh_residuum_output
Input File Parameter
prj__time_loop__processes

Definition at line 22 of file CreateTimeLoop.cpp.

29{
31 auto output_config_tree = config.getConfigSubtreeOptional("output");
32 if (!output_config_tree)
33 {
34 INFO("No output section found.");
35 }
36 auto outputs =
37 output_config_tree
38 ? createOutput(*output_config_tree, output_directory, meshes)
40 : createOutputs(config.getConfigSubtree("outputs"),
41 output_directory, meshes);
42 auto const fixed_times_for_output =
44
45 if (auto const submesh_residuum_output_config_tree =
47 config.getConfigSubtreeOptional("submesh_residuum_output");
48 submesh_residuum_output_config_tree)
49 {
51 *submesh_residuum_output_config_tree, output_directory, meshes);
52
53 for (auto& process : processes)
54 {
55 auto const& residuum_vector_names =
56 process->initializeAssemblyOnSubmeshes(smroc.meshes);
57
58 for (auto const& name : residuum_vector_names | ranges::views::join)
59 {
60 smroc.output.doNotProjectFromBulkMeshToSubmeshes(
62 }
63 }
64
65 outputs.push_back(std::move(smroc.output));
66 }
67 else
68 {
69 // Submesh assembly must always be initialized.
70 for (auto& process : processes)
71 {
72 process->initializeAssemblyOnSubmeshes({});
73 }
74 }
75
76 auto per_process_data = createPerProcessData(
78 config.getConfigSubtree("processes"), processes, nonlinear_solvers,
79 compensate_non_equilibrium_initial_residuum, fixed_times_for_output);
80
81 const bool use_staggered_scheme =
82 ranges::any_of(processes.begin(), processes.end(),
83 [](auto const& process)
84 { return !(process->isMonolithicSchemeUsed()); });
85
86 std::unique_ptr<NumLib::StaggeredCoupling> staggered_coupling = nullptr;
87 if (use_staggered_scheme)
88 {
90 config, per_process_data);
91 }
92 else
93 {
94 if (per_process_data.size() > 1)
95 {
97 "The monolithic scheme is used. However more than one "
98 "process data tags (by name \"process\") inside tag "
99 "\"time_loop\" are defined for the staggered scheme. If you "
100 "want to use staggered scheme, please set the element of tag "
101 "\"<coupling_scheme>\" to \"staggered\".");
102 }
103 }
104
105 const auto minmax_iter =
106 std::minmax_element(per_process_data.begin(),
107 per_process_data.end(),
108 [](std::unique_ptr<ProcessData> const& a,
109 std::unique_ptr<ProcessData> const& b) {
110 return (a->timestep_algorithm->end() <
111 b->timestep_algorithm->end());
112 });
113 auto const start_time =
114 per_process_data[minmax_iter.first - per_process_data.begin()]
115 ->timestep_algorithm->begin();
116 auto const end_time =
117 per_process_data[minmax_iter.second - per_process_data.begin()]
118 ->timestep_algorithm->end();
119
120 return std::make_unique<TimeLoop>(
121 std::move(outputs), std::move(per_process_data),
122 std::move(staggered_coupling), start_time, end_time);
123}
std::unique_ptr< StaggeredCoupling > createStaggeredCoupling(BaseLib::ConfigTree const &config, std::vector< std::unique_ptr< ProcessData > > const &per_process_data)
Create a StaggeredCoupling instance from the given configuration.
SubmeshResiduumOutputConfig createSubmeshResiduumOutputConfig(BaseLib::ConfigTree const &config, std::string const &output_directory, std::vector< std::unique_ptr< MeshLib::Mesh > > &meshes)
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, bool const compensate_non_equilibrium_initial_residuum, std::vector< double > const &fixed_times_for_output)
std::vector< double > calculateUniqueFixedTimesForAllOutputs(std::vector< Output > const &outputs)
std::vector< Output > createOutputs(const BaseLib::ConfigTree &output_configs, std::string const &output_directory, std::vector< std::unique_ptr< MeshLib::Mesh > > &meshes)

References calculateUniqueFixedTimesForAllOutputs(), createOutput(), createOutputs(), createPerProcessData(), NumLib::createStaggeredCoupling(), createSubmeshResiduumOutputConfig(), BaseLib::ConfigTree::getConfigSubtree(), BaseLib::ConfigTree::getConfigSubtreeOptional(), INFO(), MeshLib::Node, and OGS_FATAL.

Referenced by ProjectData::parseTimeLoop().

◆ createVariableDependentNeumannBoundaryCondition()

std::unique_ptr< VariableDependentNeumannBoundaryCondition > ProcessLib::createVariableDependentNeumannBoundaryCondition ( VariableDependentNeumannConfig const & coefficients,
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 )

Definition at line 40 of file VariableDependentNeumannBoundaryCondition.cpp.

47{
48 DBUG("Constructing VariableDependentNeumann BC.");
49 if (dof_table.getNumberOfVariables() != 2)
50 {
52 "VariableDependentNeumann BC only implemented for 2 variable "
53 "processes.");
54 }
55 assert(variable_id == 0 || variable_id == 1);
56
57 if (bc_mesh.getDimension() + 1 != global_dim)
58 {
60 "The dimension ({:d}) of the given boundary mesh '{:s}' is not by "
61 "one lower than the bulk dimension ({:d}).",
62 bc_mesh.getDimension(), bc_mesh.getName(), global_dim);
63 }
64
65 auto const& constant = ParameterLib::findParameter<double>(
66 coefficients.constant_name, parameters, 1, &bc_mesh);
67
68 auto const& coefficient_current_variable =
69 ParameterLib::findParameter<double>(coefficients.current_variable_name,
70 parameters, 1, &bc_mesh);
71
72 auto const& coefficient_other_variable =
73 ParameterLib::findParameter<double>(coefficients.other_variable_name,
74 parameters, 1, &bc_mesh);
75
76 auto const& coefficient_mixed_variables =
77 ParameterLib::findParameter<double>(coefficients.mixed_variables_name,
78 parameters, 1, &bc_mesh);
79
80 std::vector<MeshLib::Node*> const& bc_nodes = bc_mesh.getNodes();
81 MeshLib::MeshSubset bc_mesh_subset(bc_mesh, bc_nodes);
82 auto dof_table_boundary_other_variable =
83 dof_table.deriveBoundaryConstrainedMap(
84 (variable_id + 1) % 2, {component_id}, std::move(bc_mesh_subset));
85
86 // In case of partitioned mesh the boundary could be empty, i.e. there is no
87 // boundary condition.
88#ifdef USE_PETSC
89 // This can be extracted to createBoundaryCondition() but then the config
90 // parameters are not read and will cause an error.
91 // TODO (naumov): Add a function to ConfigTree for skipping the tags of the
92 // subtree and move the code up in createBoundaryCondition().
93 if (bc_mesh.getDimension() == 0 && bc_mesh.getNumberOfNodes() == 0 &&
94 bc_mesh.getNumberOfElements() == 0)
95 {
96 return nullptr;
97 }
98#endif // USE_PETSC
99
100 return std::make_unique<VariableDependentNeumannBoundaryCondition>(
101 integration_order, shapefunction_order, dof_table, variable_id,
102 component_id, global_dim, bc_mesh,
104 constant, coefficient_current_variable, coefficient_other_variable,
105 coefficient_mixed_variables,
106 std::move(dof_table_boundary_other_variable)});
107}

References ProcessLib::VariableDependentNeumannConfig::constant_name, ProcessLib::VariableDependentNeumannConfig::current_variable_name, DBUG(), NumLib::LocalToGlobalIndexMap::deriveBoundaryConstrainedMap(), ParameterLib::findParameter(), MeshLib::Mesh::getDimension(), MeshLib::Mesh::getName(), MeshLib::Mesh::getNodes(), MeshLib::Mesh::getNumberOfElements(), MeshLib::Mesh::getNumberOfNodes(), NumLib::LocalToGlobalIndexMap::getNumberOfVariables(), ProcessLib::VariableDependentNeumannConfig::mixed_variables_name, OGS_FATAL, and ProcessLib::VariableDependentNeumannConfig::other_variable_name.

Referenced by createBoundaryCondition().

◆ createVolumetricSourceTerm()

std::unique_ptr< SourceTerm > ProcessLib::createVolumetricSourceTerm ( 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__type
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
Input File Parameter
prj__process_variables__process_variable__source_terms__source_term__Line__parameter

Definition at line 15 of file CreateVolumetricSourceTerm.cpp.

21{
23 auto const type = config.peekConfigParameter<std::string>("type");
24 if (type == "Line")
25 {
27 config.checkConfigParameter("type", "Line");
28 DBUG("Constructing LineSourceTerm from config.");
29 }
30 else
31 {
33 config.checkConfigParameter("type", "Volumetric");
34 DBUG("Constructing VolumetricSourceTerm from config.");
35 }
36
37 // source term field name
38 auto const& volumetric_source_term_parameter_name =
40 config.getConfigParameter<std::string>("parameter");
41 auto& volumetric_source_term = ParameterLib::findParameter<double>(
42 volumetric_source_term_parameter_name, parameters, 1,
43 &source_term_mesh);
44
45 // instruction to create documentation for the parameter
47
48 DBUG("Using '{:s}' as volumetric source term parameter.",
49 volumetric_source_term.name);
50
51 return std::make_unique<VolumetricSourceTerm>(
52 bulk_mesh_dimension, source_term_mesh, std::move(source_term_dof_table),
53 integration_order, shapefunction_order, volumetric_source_term);
54}

References BaseLib::ConfigTree::checkConfigParameter(), DBUG(), ParameterLib::findParameter(), BaseLib::ConfigTree::getConfigParameter(), and BaseLib::ConfigTree::peekConfigParameter().

Referenced by createSourceTerm().

◆ createWellboreCompensateNeumannBoundaryCondition()

std::unique_ptr< WellboreCompensateNeumannBoundaryCondition > ProcessLib::createWellboreCompensateNeumannBoundaryCondition ( WellboreCompensateCoefficients const & coefficients,
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::map< int, std::shared_ptr< MaterialPropertyLib::Medium > > const & media )

Definition at line 34 of file WellboreCompensateNeumannBoundaryCondition.cpp.

41{
42 DBUG("Constructing WellboreCompensateNeumann BC.");
43
44 if (dof_table.getNumberOfVariables() != 3)
45 {
47 "WellboreCompensateNeumann BC only implemented for the "
48 "WellboreSimulator processes.");
49 }
50 assert(variable_id == 0 || variable_id == 1 || variable_id == 2);
51
52 if (bc_mesh.getDimension() + 1 != global_dim)
53 {
55 "The dimension ({:d}) of the given boundary mesh '{:s}' is not by "
56 "one "
57 "lower than the bulk dimension ({:d}).",
58 bc_mesh.getDimension(), bc_mesh.getName(), global_dim);
59 }
60
61 auto const pressure_id = 0;
62 auto const velocity_id = 1;
63 auto const enthalpy_id = 2;
64
65 std::vector<MeshLib::Node*> const& bc_nodes = bc_mesh.getNodes();
66 MeshLib::MeshSubset bc_mesh_subset(bc_mesh, bc_nodes);
67 auto dof_table_boundary_pressure = dof_table.deriveBoundaryConstrainedMap(
68 pressure_id, {component_id}, std::move(bc_mesh_subset));
69 auto dof_table_boundary_velocity = dof_table.deriveBoundaryConstrainedMap(
70 velocity_id, {component_id}, std::move(bc_mesh_subset));
71 auto dof_table_boundary_enthalpy = dof_table.deriveBoundaryConstrainedMap(
72 enthalpy_id, {component_id}, std::move(bc_mesh_subset));
73
74 //
75 // maybe the boundary mesh needs material ids
77 media, bc_mesh);
78
79 return std::make_unique<WellboreCompensateNeumannBoundaryCondition>(
80 integration_order, shapefunction_order, dof_table, variable_id,
81 component_id, global_dim, bc_mesh,
83 coefficients, std::move(dof_table_boundary_pressure),
84 std::move(dof_table_boundary_velocity),
85 std::move(dof_table_boundary_enthalpy), std::move(media_map)});
86}
MaterialSpatialDistributionMap createMaterialSpatialDistributionMap(std::map< int, std::shared_ptr< Medium > > const &media, MeshLib::Mesh const &mesh)

References MaterialPropertyLib::createMaterialSpatialDistributionMap(), DBUG(), NumLib::LocalToGlobalIndexMap::deriveBoundaryConstrainedMap(), MeshLib::Mesh::getDimension(), MeshLib::Mesh::getName(), MeshLib::Mesh::getNodes(), NumLib::LocalToGlobalIndexMap::getNumberOfVariables(), and OGS_FATAL.

Referenced by createBoundaryCondition().

◆ extractElementsAlongOuterNodes()

std::vector< std::vector< std::size_t > > ProcessLib::extractElementsAlongOuterNodes ( MeshLib::Mesh const & mesh,
MeshLib::Mesh const & sub_mesh,
std::vector< std::size_t > const & outer_nodes )
static

Definition at line 64 of file CreateDeactivatedSubdomain.cpp.

67{
68 auto const& bulk_node_ids =
69 *sub_mesh.getProperties().template getPropertyVector<std::size_t>(
72
73 auto to_bulk_node_id =
74 ranges::views::transform([&bulk_node_ids](std::size_t const node_id)
75 { return bulk_node_ids[node_id]; });
76 auto connected_elements = ranges::views::transform(
77 [&mesh](std::size_t const node_id)
78 {
79 return mesh.getElementsConnectedToNode(node_id) |
80 MeshLib::views::ids | ranges::to<std::vector>;
81 });
82
83 return outer_nodes | to_bulk_node_id | connected_elements |
84 ranges::to<std::vector>;
85}

References MeshLib::getBulkIDString(), MeshLib::Mesh::getElementsConnectedToNode(), MeshLib::Mesh::getProperties(), MeshLib::views::ids, and MeshLib::Node.

Referenced by createDeactivatedSubdomainMesh().

◆ extractInnerAndOuterNodes()

template<typename IsActive>
std::pair< std::vector< std::size_t >, std::vector< std::size_t > > ProcessLib::extractInnerAndOuterNodes ( MeshLib::Mesh const & mesh,
MeshLib::Mesh const & sub_mesh,
IsActive is_active )
static

Definition at line 27 of file CreateDeactivatedSubdomain.cpp.

30{
31 auto* const bulk_node_ids = MeshLib::bulkNodeIDs(sub_mesh);
32 if (bulk_node_ids == nullptr)
33 {
35 "Bulk node ids map is not available in the deactivate subdomain "
36 "mesh.");
37 }
38
39 std::vector<std::size_t> inner_nodes;
40 // Reserve for more than needed, but not much, because almost all nodes will
41 // be the inner nodes.
42 inner_nodes.reserve(sub_mesh.getNumberOfNodes());
43
44 std::vector<std::size_t> outer_nodes;
45
46 ranges::partition_copy(
47 sub_mesh.getNodes() | MeshLib::views::ids,
48 back_inserter(inner_nodes),
49 back_inserter(outer_nodes),
50 [&](std::size_t const n)
51 {
52 auto const bulk_node = mesh.getNode((*bulk_node_ids)[n]);
53 const auto& connected_elements =
54 mesh.getElementsConnectedToNode(*bulk_node);
55 // Check whether this node is connected only to an active
56 // elements. Then it is an inner node, and outer otherwise.
57 return ranges::all_of(connected_elements | MeshLib::views::ids,
58 is_active);
59 });
60
61 return {std::move(inner_nodes), std::move(outer_nodes)};
62}
PropertyVector< std::size_t > const * bulkNodeIDs(Mesh const &mesh)
Definition Mesh.cpp:282

References MeshLib::bulkNodeIDs(), MeshLib::Mesh::getElementsConnectedToNode(), MeshLib::Mesh::getNode(), MeshLib::Mesh::getNodes(), MeshLib::Mesh::getNumberOfNodes(), MeshLib::views::ids, and OGS_FATAL.

Referenced by createDeactivatedSubdomainMesh().

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

43{
44 // Find process variable name in process config.
46 std::string const name = pv_config.getConfigParameter<std::string>(tag);
47 return findVariableByName(variables, name, tag);
48}

References BaseLib::ConfigTree::getConfigParameter().

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

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

References DBUG(), and findProcessVariables().

Referenced by ProcessLib::ComponentTransport::createComponentTransportProcess(), ProcessLib::HeatConduction::createHeatConductionProcess(), ProcessLib::HMPhaseField::createHMPhaseFieldProcess(), ProcessLib::HT::createHTProcess(), ProcessLib::HydroMechanics::createHydroMechanicsProcess(), ProcessLib::LargeDeformation::createLargeDeformationProcess(), ProcessLib::LiquidFlow::createLiquidFlowProcess(), ProcessLib::PhaseField::createPhaseFieldProcess(), ProcessLib::RichardsComponentTransport::createRichardsComponentTransportProcess(), ProcessLib::RichardsFlow::createRichardsFlowProcess(), ProcessLib::RichardsMechanics::createRichardsMechanicsProcess(), ProcessLib::SmallDeformation::createSmallDeformationProcess(), ProcessLib::SteadyStateDiffusion::createSteadyStateDiffusion(), ProcessLib::TH2M::createTH2MProcess(), ProcessLib::ThermalTwoPhaseFlowWithPP::createThermalTwoPhaseFlowWithPPProcess(), ProcessLib::ThermoHydroMechanics::createThermoHydroMechanicsProcess(), ProcessLib::ThermoMechanics::createThermoMechanicsProcess(), ProcessLib::ThermoRichardsFlow::createThermoRichardsFlowProcess(), ProcessLib::ThermoRichardsMechanics::createThermoRichardsMechanicsProcessStage2(), ProcessLib::TwoPhaseFlowWithPP::createTwoPhaseFlowWithPPProcess(), ProcessLib::WellboreSimulator::createWellboreSimulatorProcess(), and findProcessVariables().

◆ 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,
bool const optional )
Input File Parameter
special OGS input file parameter

Definition at line 71 of file ProcessUtils.cpp.

75{
77 auto var_names = pv_config.getConfigParameterList<std::string>(tag);
78
79 if (var_names.empty())
80 {
81 if (optional)
82 {
83 return {};
84 }
85 OGS_FATAL("No entity is found with config tag <{:s}>.", tag);
86 }
87
88 std::vector<std::reference_wrapper<ProcessVariable>> vars;
89 std::vector<std::string> cached_var_names;
90
91 for (std::string const& var_name : var_names)
92 {
93 vars.emplace_back(findVariableByName(variables, var_name, tag));
94 cached_var_names.push_back(var_name);
95 }
96
97 // Eliminate duplicates in the set of variable names
98 BaseLib::makeVectorUnique(cached_var_names);
99
100 if (cached_var_names.size() != var_names.size())
101 {
102 OGS_FATAL("Found duplicates with config tag <{:s}>.", tag);
103 }
104
105 return vars;
106}
ProcessLib::ProcessVariable & findVariableByName(std::vector< ProcessLib::ProcessVariable > const &variables, std::string const &name, std::string const &tag)

References BaseLib::ConfigTree::getConfigParameterList(), BaseLib::makeVectorUnique(), and OGS_FATAL.

◆ 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 12 of file CoupledSolutionsForStaggeredScheme.cpp.

15{
16 if (global_solutions.empty())
17 {
18 return {};
19 }
20
21 std::size_t const local_solutions_size =
22 std::accumulate(cbegin(indices),
23 cend(indices),
24 std::size_t(0),
25 [](GlobalIndexType const size,
26 std::vector<GlobalIndexType> const& process_indices)
27 { return size + process_indices.size(); });
28 std::vector<double> local_solutions;
29 local_solutions.reserve(local_solutions_size);
30
31 int number_of_processes = static_cast<int>(global_solutions.size());
32 for (int process_id = 0; process_id < number_of_processes; ++process_id)
33 {
34 auto values = global_solutions[process_id]->get(indices[process_id]);
35 local_solutions.insert(cend(local_solutions),
36 std::make_move_iterator(begin(values)),
37 std::make_move_iterator(end(values)));
38 }
39 return local_solutions;
40}
GlobalMatrix::IndexType GlobalIndexType
constexpr int size(int const displacement_dim)
Vectorized tensor size for given displacement dimension.

Referenced by ProcessLib::HMPhaseField::HMPhaseFieldLocalAssembler< ShapeFunction, DisplacementDim >::approximateFractureWidth(), ProcessLib::VectorMatrixAssembler::assemble(), anonymous_namespace{ParallelVectorMatrixAssembler.cpp}::assembleForStaggeredSchemeOneElement(), ProcessLib::VectorMatrixAssembler::assembleWithJacobian(), anonymous_namespace{ParallelVectorMatrixAssembler.cpp}::assembleWithJacobianForStaggeredSchemeOneElement(), ProcessLib::PhaseField::PhaseFieldLocalAssembler< ShapeFunction, DisplacementDim >::computeCrackIntegral(), ProcessLib::HMPhaseField::HMPhaseFieldLocalAssembler< ShapeFunction, DisplacementDim >::computeEnergy(), ProcessLib::PhaseField::PhaseFieldLocalAssembler< ShapeFunction, DisplacementDim >::computeEnergy(), ProcessLib::ComponentTransport::ComponentTransportProcess::getFlux(), ProcessLib::HT::HTProcess::getFlux(), and ProcessLib::HT::StaggeredHTFEM< ShapeFunction, GlobalDim >::getIntPtDarcyVelocity().

◆ getEssentialBCValuesLocal() [1/2]

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

Definition at line 104 of file DirichletBoundaryConditionAuxiliaryFunctions.cpp.

110{
112 parameter, bc_mesh,
113 bc_mesh.getNodes() | MeshLib::views::ids | ranges::to<std::vector>,
114 dof_table_boundary, variable_id, component_id, t, x, bc_values);
115}
void getEssentialBCValuesLocal(ParameterLib::Parameter< double > const &parameter, MeshLib::Mesh const &bc_mesh, std::vector< std::size_t > 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)

References getEssentialBCValuesLocal(), MeshLib::Mesh::getNodes(), and MeshLib::views::ids.

◆ getEssentialBCValuesLocal() [2/2]

void ProcessLib::getEssentialBCValuesLocal ( ParameterLib::Parameter< double > const & parameter,
MeshLib::Mesh const & bc_mesh,
std::vector< std::size_t > 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 60 of file DirichletBoundaryConditionAuxiliaryFunctions.cpp.

68{
70
71 bc_values.ids.clear();
72 bc_values.values.clear();
73
74 // convert mesh node ids to global index for the given component
75 bc_values.ids.reserve(nodes_in_bc_mesh.size());
76 bc_values.values.reserve(nodes_in_bc_mesh.size());
77 for (auto const node_id : nodes_in_bc_mesh)
78 {
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, node_id},
82 variable_id, 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 pos.setNodeID(node_id);
97 pos.setCoordinates(*bc_mesh.getNode(node_id));
98 bc_values.ids.emplace_back(global_index);
99 bc_values.values.emplace_back(parameter(t, pos).front());
100 }
101 }
102}
static constexpr NUMLIB_EXPORT GlobalIndexType const nop
std::vector< IndexType > ids
std::vector< double > values

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

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

◆ getIntegrationPointDataMaterialStateVariables()

template<typename IntegrationPointDataVector, typename MemberType, typename MaterialStateVariables>
std::vector< double > ProcessLib::getIntegrationPointDataMaterialStateVariables ( IntegrationPointDataVector const & ip_data_vector,
MemberType member,
std::function< std::span< double >(MaterialStateVariables &)> get_values_span,
int const n_components )

◆ getIntegrationPointDimMatrixData() [1/2]

template<int DisplacementDim, typename IntegrationPointDataVector, typename Accessor>
std::vector< double > const & ProcessLib::getIntegrationPointDimMatrixData ( IntegrationPointDataVector const & ip_data_vector,
Accessor && accessor,
std::vector< double > & cache )

Definition at line 31 of file SetOrGetIntegrationPointData.h.

34{
35 using AccessorResult = decltype(std::declval<Accessor>()(
36 std::declval<IntegrationPointDataVector>()[0]));
37 static_assert(std::is_lvalue_reference_v<AccessorResult>,
38 "The ip data accessor should return a reference. This check "
39 "prevents accidental copies.");
40
41 auto const n_integration_points = ip_data_vector.size();
42 constexpr int size = DisplacementDim * DisplacementDim;
43
44 cache.clear();
45 auto cache_mat = MathLib::createZeroedMatrix<
46 Eigen::Matrix<double, size, Eigen::Dynamic, Eigen::RowMajor>>(
47 cache, size, n_integration_points);
48
49 for (unsigned ip = 0; ip < n_integration_points; ++ip)
50 {
51 auto const& dim_matix = accessor(ip_data_vector[ip]);
52 cache_mat.col(ip) = dim_matix.template reshaped<Eigen::RowMajor>();
53 }
54
55 return cache;
56}
Eigen::Map< Matrix > createZeroedMatrix(std::vector< double > &data, Eigen::MatrixXd::Index rows, Eigen::MatrixXd::Index cols)

References MathLib::createZeroedMatrix().

◆ getIntegrationPointDimMatrixData() [2/2]

template<int DisplacementDim, typename IntegrationPointDataVector, typename IpData, typename MemberType>
std::vector< double > const & ProcessLib::getIntegrationPointDimMatrixData ( IntegrationPointDataVector const & ip_data_vector,
MemberType IpData::*const member,
std::vector< double > & cache )

Definition at line 18 of file SetOrGetIntegrationPointData.h.

21{
23 ip_data_vector,
24 [member](IpData const& ip_data) -> auto const&
25 { return ip_data.*member; },
26 cache);
27}
std::vector< double > const & getIntegrationPointDimMatrixData(IntegrationPointDataVector const &ip_data_vector, MemberType IpData::*const member, std::vector< double > &cache)

References getIntegrationPointDimMatrixData().

Referenced by getIntegrationPointDimMatrixData().

◆ getIntegrationPointKelvinVectorData() [1/3]

template<int DisplacementDim, typename IntegrationPointDataVector, typename Accessor>
std::vector< double > const & ProcessLib::getIntegrationPointKelvinVectorData ( IntegrationPointDataVector const & ip_data_vector,
Accessor && accessor,
std::vector< double > & cache )

Definition at line 73 of file SetOrGetIntegrationPointData.h.

76{
77 using AccessorResult = decltype(std::declval<Accessor>()(
78 std::declval<IntegrationPointDataVector>()[0]));
79 static_assert(std::is_lvalue_reference_v<AccessorResult>,
80 "The ip data accessor should return a reference. This check "
81 "prevents accidental copies.");
82
83 constexpr int kelvin_vector_size =
85 auto const n_integration_points = ip_data_vector.size();
86
87 cache.clear();
88 auto cache_mat = MathLib::createZeroedMatrix<Eigen::Matrix<
89 double, kelvin_vector_size, Eigen::Dynamic, Eigen::RowMajor>>(
90 cache, kelvin_vector_size, n_integration_points);
91
92 for (unsigned ip = 0; ip < n_integration_points; ++ip)
93 {
94 auto const& kelvin_vector = accessor(ip_data_vector[ip]);
95 cache_mat.col(ip) =
97 }
98
99 return cache;
100}
Eigen::Matrix< double, 4, 1 > kelvinVectorToSymmetricTensor(Eigen::Matrix< double, 4, 1, Eigen::ColMajor, 4, 1 > const &v)

References MathLib::createZeroedMatrix(), MathLib::KelvinVector::kelvin_vector_dimensions(), and MathLib::KelvinVector::kelvinVectorToSymmetricTensor().

◆ getIntegrationPointKelvinVectorData() [2/3]

template<int DisplacementDim, typename IntegrationPointDataVector, typename IpData, typename MemberType>
std::vector< double > const & ProcessLib::getIntegrationPointKelvinVectorData ( IntegrationPointDataVector const & ip_data_vector,
MemberType IpData::*const member,
std::vector< double > & cache )

Definition at line 60 of file SetOrGetIntegrationPointData.h.

63{
65 ip_data_vector,
66 [member](IpData const& ip_data) -> auto const&
67 { return ip_data.*member; },
68 cache);
69}
std::vector< double > const & getIntegrationPointKelvinVectorData(IntegrationPointDataVector const &ip_data_vector, MemberType IpData::*const member, std::vector< double > &cache)

References getIntegrationPointKelvinVectorData().

Referenced by getIntegrationPointKelvinVectorData(), getIntegrationPointKelvinVectorData(), ProcessLib::HMPhaseField::HMPhaseFieldLocalAssembler< ShapeFunction, DisplacementDim >::getIntPtEpsilon(), ProcessLib::HydroMechanics::HydroMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::getIntPtEpsilon(), ProcessLib::LIE::HydroMechanics::HydroMechanicsLocalAssemblerMatrix< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::getIntPtEpsilon(), ProcessLib::LIE::SmallDeformation::SmallDeformationLocalAssemblerMatrix< ShapeFunction, DisplacementDim >::getIntPtEpsilon(), ProcessLib::LIE::SmallDeformation::SmallDeformationLocalAssemblerMatrixNearFracture< ShapeFunction, DisplacementDim >::getIntPtEpsilon(), ProcessLib::PhaseField::PhaseFieldLocalAssembler< ShapeFunction, DisplacementDim >::getIntPtEpsilon(), ProcessLib::ThermoHydroMechanics::ThermoHydroMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::getIntPtEpsilon(), ProcessLib::ThermoMechanics::ThermoMechanicsLocalAssembler< ShapeFunction, DisplacementDim >::getIntPtEpsilon(), ProcessLib::ThermoHydroMechanics::ThermoHydroMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::getIntPtEpsilon0(), ProcessLib::ThermoHydroMechanics::ThermoHydroMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::getIntPtEpsilonM(), ProcessLib::ThermoMechanics::ThermoMechanicsLocalAssembler< ShapeFunction, DisplacementDim >::getIntPtEpsilonMechanical(), ProcessLib::PhaseField::PhaseFieldLocalAssembler< ShapeFunction, DisplacementDim >::getIntPtEpsilonTensile(), ProcessLib::HMPhaseField::HMPhaseFieldLocalAssembler< ShapeFunction, DisplacementDim >::getIntPtSigma(), ProcessLib::HydroMechanics::HydroMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::getIntPtSigma(), ProcessLib::LIE::HydroMechanics::HydroMechanicsLocalAssemblerMatrix< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::getIntPtSigma(), ProcessLib::LIE::SmallDeformation::SmallDeformationLocalAssemblerMatrix< ShapeFunction, DisplacementDim >::getIntPtSigma(), ProcessLib::LIE::SmallDeformation::SmallDeformationLocalAssemblerMatrixNearFracture< ShapeFunction, DisplacementDim >::getIntPtSigma(), ProcessLib::PhaseField::PhaseFieldLocalAssembler< ShapeFunction, DisplacementDim >::getIntPtSigma(), ProcessLib::ThermoHydroMechanics::ThermoHydroMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::getIntPtSigma(), ProcessLib::ThermoMechanics::ThermoMechanicsLocalAssembler< ShapeFunction, DisplacementDim >::getIntPtSigma(), ProcessLib::PhaseField::PhaseFieldLocalAssembler< ShapeFunction, DisplacementDim >::getIntPtSigmaCompressive(), ProcessLib::ThermoHydroMechanics::ThermoHydroMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::getIntPtSigmaIce(), ProcessLib::PhaseField::PhaseFieldLocalAssembler< ShapeFunction, DisplacementDim >::getIntPtSigmaTensile(), ProcessLib::HydroMechanics::HydroMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::getSigma(), and ProcessLib::PhaseField::PhaseFieldLocalAssembler< ShapeFunction, DisplacementDim >::getSigma().

◆ getIntegrationPointKelvinVectorData() [3/3]

template<int DisplacementDim, typename IntegrationPointDataVector, typename MemberType>
std::vector< double > ProcessLib::getIntegrationPointKelvinVectorData ( IntegrationPointDataVector const & ip_data_vector,
MemberType member )

Overload without cache argument.

Note
This function returns the data in transposed storage order compared to the overloads that have a cache argument.

Definition at line 108 of file SetOrGetIntegrationPointData.h.

110{
111 constexpr int kelvin_vector_size =
113
115 [&](std::vector<double>& values)
116 {
118 ip_data_vector, member, values);
119 ;
120 });
121}
std::vector< double > transposeInPlace(StoreValuesFunction const &store_values_function)

References getIntegrationPointKelvinVectorData(), MathLib::KelvinVector::kelvin_vector_dimensions(), and transposeInPlace().

◆ getIntegrationPointScalarData() [1/2]

template<typename IntegrationPointDataVector, typename Accessor>
std::vector< double > const & ProcessLib::getIntegrationPointScalarData ( IntegrationPointDataVector const & ip_data_vector,
Accessor && accessor,
std::vector< double > & cache )

Definition at line 180 of file SetOrGetIntegrationPointData.h.

183{
184 using AccessorResult = decltype(std::declval<Accessor>()(
185 std::declval<IntegrationPointDataVector>()[0]));
186 static_assert(std::is_lvalue_reference_v<AccessorResult>,
187 "The ip data accessor should return a reference. This check "
188 "prevents accidental copies.");
189
190 auto const n_integration_points = ip_data_vector.size();
191
192 cache.clear();
193 auto cache_mat = MathLib::createZeroedMatrix<
194 Eigen::Matrix<double, 1, Eigen::Dynamic, Eigen::RowMajor>>(
195 cache, 1, n_integration_points);
196
197 for (unsigned ip = 0; ip < n_integration_points; ++ip)
198 {
199 cache_mat[ip] = accessor(ip_data_vector[ip]);
200 }
201
202 return cache;
203}

References MathLib::createZeroedMatrix().

◆ getIntegrationPointScalarData() [2/2]

template<typename IntegrationPointDataVector, typename IpData, typename MemberType>
std::vector< double > const & ProcessLib::getIntegrationPointScalarData ( IntegrationPointDataVector const & ip_data_vector,
MemberType IpData::*const member,
std::vector< double > & cache )

Definition at line 168 of file SetOrGetIntegrationPointData.h.

171{
173 ip_data_vector,
174 [member](IpData const& ip_data) -> auto const&
175 { return ip_data.*member; },
176 cache);
177}
std::vector< double > const & getIntegrationPointScalarData(IntegrationPointDataVector const &ip_data_vector, MemberType IpData::*const member, std::vector< double > &cache)

References getIntegrationPointScalarData().

Referenced by getIntegrationPointScalarData(), ProcessLib::ThermoRichardsFlow::ThermoRichardsFlowLocalAssembler< ShapeFunction, GlobalDim >::getIntPtDryDensitySolid(), ProcessLib::WellboreSimulator::WellboreSimulatorFEM< ShapeFunction, GlobalDim >::getIntPtDryness(), ProcessLib::ThermoHydroMechanics::ThermoHydroMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::getIntPtFluidDensity(), ProcessLib::LIE::HydroMechanics::HydroMechanicsLocalAssemblerFracture< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::getIntPtFractureAperture(), ProcessLib::LIE::SmallDeformation::SmallDeformationLocalAssemblerFracture< ShapeFunction, DisplacementDim >::getIntPtFractureAperture(), ProcessLib::LIE::HydroMechanics::HydroMechanicsLocalAssemblerFracture< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::getIntPtFracturePermeability(), ProcessLib::ThermoHydroMechanics::ThermoHydroMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::getIntPtIceVolume(), ProcessLib::WellboreSimulator::WellboreSimulatorFEM< ShapeFunction, GlobalDim >::getIntPtLiquidMassFlowRate(), ProcessLib::ThermoRichardsFlow::ThermoRichardsFlowLocalAssembler< ShapeFunction, GlobalDim >::getIntPtPorosity(), ProcessLib::ThermoRichardsFlow::ThermoRichardsFlowLocalAssembler< ShapeFunction, GlobalDim >::getIntPtSaturation(), ProcessLib::WellboreSimulator::WellboreSimulatorFEM< ShapeFunction, GlobalDim >::getIntPtTemperature(), ProcessLib::WellboreSimulator::WellboreSimulatorFEM< ShapeFunction, GlobalDim >::getIntPtVaporMassFlowRate(), ProcessLib::WellboreSimulator::WellboreSimulatorFEM< ShapeFunction, GlobalDim >::getIntPtVaporVolumeFraction(), ProcessLib::ThermoHydroMechanics::ThermoHydroMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::getIntPtViscosity(), and ProcessLib::HMPhaseField::HMPhaseFieldLocalAssembler< ShapeFunction, DisplacementDim >::getIntPtWidth().

◆ 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 157 of file SecondaryVariable.h.

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

References NumLib::Extrapolator::calculateResiduals(), NumLib::Extrapolator::extrapolate(), NumLib::Extrapolator::getElementResiduals(), NumLib::Extrapolator::getNodalValues(), and NumLib::makeExtrapolatable().

Referenced by ProcessLib::ComponentTransport::ComponentTransportProcess::initializeConcreteProcess(), ProcessLib::HeatConduction::HeatConductionProcess::initializeConcreteProcess(), ProcessLib::HMPhaseField::HMPhaseFieldProcess< DisplacementDim >::initializeConcreteProcess(), ProcessLib::HT::HTProcess::initializeConcreteProcess(), ProcessLib::HydroMechanics::HydroMechanicsProcess< DisplacementDim >::initializeConcreteProcess(), ProcessLib::LargeDeformation::LargeDeformationProcess< DisplacementDim >::initializeConcreteProcess(), ProcessLib::LIE::HydroMechanics::HydroMechanicsProcess< DisplacementDim >::initializeConcreteProcess(), ProcessLib::LIE::SmallDeformation::SmallDeformationProcess< DisplacementDim >::initializeConcreteProcess(), ProcessLib::LiquidFlow::LiquidFlowProcess::initializeConcreteProcess(), ProcessLib::PhaseField::PhaseFieldProcess< DisplacementDim >::initializeConcreteProcess(), ProcessLib::RichardsComponentTransport::RichardsComponentTransportProcess::initializeConcreteProcess(), ProcessLib::RichardsFlow::RichardsFlowProcess::initializeConcreteProcess(), ProcessLib::RichardsMechanics::RichardsMechanicsProcess< DisplacementDim >::initializeConcreteProcess(), ProcessLib::SmallDeformation::SmallDeformationProcess< DisplacementDim >::initializeConcreteProcess(), ProcessLib::SteadyStateDiffusion::SteadyStateDiffusion::initializeConcreteProcess(), ProcessLib::TH2M::TH2MProcess< DisplacementDim >::initializeConcreteProcess(), ProcessLib::ThermalTwoPhaseFlowWithPP::ThermalTwoPhaseFlowWithPPProcess::initializeConcreteProcess(), ProcessLib::ThermoHydroMechanics::ThermoHydroMechanicsProcess< DisplacementDim >::initializeConcreteProcess(), ProcessLib::ThermoMechanics::ThermoMechanicsProcess< DisplacementDim >::initializeConcreteProcess(), ProcessLib::ThermoRichardsFlow::ThermoRichardsFlowProcess::initializeConcreteProcess(), ProcessLib::ThermoRichardsMechanics::ThermoRichardsMechanicsProcess< DisplacementDim, ConstitutiveTraits >::initializeConcreteProcess(), ProcessLib::TwoPhaseFlowWithPP::TwoPhaseFlowWithPPProcess::initializeConcreteProcess(), ProcessLib::WellboreSimulator::WellboreSimulatorProcess::initializeConcreteProcess(), and makeExtrapolator2().

◆ makeExtrapolator2()

template<typename LocalAssemblerCollection, typename IPDataAccessor>
SecondaryVariableFunctions ProcessLib::makeExtrapolator2 ( const unsigned num_components,
NumLib::Extrapolator & extrapolator,
LocalAssemblerCollection const & local_assemblers,
IPDataAccessor && accessor )

A variant that takes an accessor function as a callback.

The accessor must take a local assembler by const reference as its only argument and must return a std::vector<double> of integration point data. The data returned by the accessor must be in "integration point writer order", which is transposed compared to "extrapolator order".

Definition at line 206 of file SecondaryVariable.h.

211{
212 using LocalAssemblerInterface = std::remove_cvref_t<
213 decltype(*std::declval<LocalAssemblerCollection>()[0])>;
214 static_assert(std::is_invocable_r_v<std::vector<double>, IPDataAccessor,
216
217 if (num_components == 1)
218 {
219 auto method_wrapped =
220 [accessor](
221 LocalAssemblerInterface const& loc_asm, const double /*t*/,
222 std::vector<GlobalVector*> const& /*x*/,
223 std::vector<
224 NumLib::LocalToGlobalIndexMap const*> const& /*dof_table*/,
225 std::vector<double>& cache) -> std::vector<double> const&
226 {
227 cache = accessor(loc_asm);
228 return cache;
229 };
230
231 return makeExtrapolator(num_components, extrapolator, local_assemblers,
232 method_wrapped);
233 }
234
235 auto method_wrapped =
236 [accessor, num_components](
237 LocalAssemblerInterface const& loc_asm, const double /*t*/,
238 std::vector<GlobalVector*> const& /*x*/,
239 std::vector<
240 NumLib::LocalToGlobalIndexMap const*> const& /*dof_table*/,
241 std::vector<double>& cache) -> std::vector<double> const&
242 {
243 cache = accessor(loc_asm);
244 transposeInPlace(cache, cache.size() / num_components);
245 return cache;
246 };
247
248 return makeExtrapolator(num_components, extrapolator, local_assemblers,
249 method_wrapped);
250}
SecondaryVariableFunctions makeExtrapolator(const unsigned num_components, NumLib::Extrapolator &extrapolator, LocalAssemblerCollection const &local_assemblers, typename NumLib::ExtrapolatableLocalAssemblerCollection< LocalAssemblerCollection >::IntegrationPointValuesMethod integration_point_values_method)

References makeExtrapolator(), and transposeInPlace().

Referenced by ProcessLib::Reflection::addReflectedSecondaryVariables().

◆ makeProcessData()

std::unique_ptr< ProcessData > ProcessLib::makeProcessData ( std::unique_ptr< NumLib::TimeStepAlgorithm > && timestepper,
NumLib::NonlinearSolverBase & nonlinear_solver,
int const process_id,
std::string process_name,
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 17 of file CreateProcessData.cpp.

24{
26
27 if (auto* nonlinear_solver_picard =
29 &nonlinear_solver))
30 {
31 nonlinear_solver_picard->compensateNonEquilibriumInitialResiduum(
32 compensate_non_equilibrium_initial_residuum);
33 return std::make_unique<ProcessData>(
34 std::move(timestepper), Tag::Picard, *nonlinear_solver_picard,
35 std::move(conv_crit), std::move(time_disc), process_id,
36 std::move(process_name), process);
37 }
38 if (auto* nonlinear_solver_newton =
40 &nonlinear_solver))
41 {
42 nonlinear_solver_newton->compensateNonEquilibriumInitialResiduum(
43 compensate_non_equilibrium_initial_residuum);
44 return std::make_unique<ProcessData>(
45 std::move(timestepper), Tag::Newton, *nonlinear_solver_newton,
46 std::move(conv_crit), std::move(time_disc), process_id,
47 std::move(process_name), process);
48 }
49#ifdef USE_PETSC
50 if (auto* nonlinear_solver_petsc =
51 dynamic_cast<NumLib::PETScNonlinearSolver*>(&nonlinear_solver))
52 {
53 return std::make_unique<ProcessData>(
54 std::move(timestepper), Tag::Newton, *nonlinear_solver_petsc,
55 std::move(conv_crit), std::move(time_disc), process_id,
56 std::move(process_name), process);
57 }
58#endif // USE_PETSC
59
60 OGS_FATAL("Encountered unknown nonlinear solver type. Aborting");
61}
NonlinearSolverTag
Tag used to specify which nonlinear solver will be used.
Definition Types.h:13

References OGS_FATAL.

Referenced by createPerProcessData().

◆ nodeLocalIndices()

template<int GlobalDim>
auto ProcessLib::nodeLocalIndices ( std::size_t const i)

Definition at line 27 of file EmbeddedAnchor.cpp.

28{
29 return Eigen::seqN(i, Eigen::fix<GlobalDim>, Eigen::fix<2>);
30}

Referenced by ProcessLib::EmbeddedAnchor< GlobalDim >::getShapeMatricesAndGlobalIndicesAndDisplacements(), and ProcessLib::EmbeddedAnchor< GlobalDim >::integrate().

◆ operator<<() [1/4]

std::ostream & ProcessLib::operator<< ( std::ostream & os,
Output const & output )

Definition at line 448 of file ProcessLib/Output/Output.cpp.

449{
450 os << "Output::_output_data_specification:\t"
451 << output._output_data_specification;
452 os << "Output::_output_format:\t" << *(output._output_format);
453 return os;
454}

◆ operator<<() [2/4]

std::ostream & ProcessLib::operator<< ( std::ostream & os,
OutputDataSpecification const & o )

Definition at line 84 of file OutputDataSpecification.cpp.

85{
86 os << "OuputDataSpecification" << std::endl;
87 os << "\toutput_variables: ";
88 std::copy(o.output_variables.begin(), o.output_variables.end(),
89 std::ostream_iterator<std::string>(os, " "));
90 os << "\n";
91 os << "\tfixed_output_times: ";
92 std::copy(o.fixed_output_times.begin(), o.fixed_output_times.end(),
93 std::ostream_iterator<double>(os, " "));
94 os << "\n";
95 os << "\trepeats_each_steps: ";
96 std::copy(o.repeats_each_steps.begin(), o.repeats_each_steps.end(),
97 std::ostream_iterator<PairRepeatEachSteps>(os, " "));
98 os << "\n";
99 os << "\toutput_residual: " << o.output_residuals << "\n";
100 return os;
101}

References ProcessLib::OutputDataSpecification::fixed_output_times, ProcessLib::OutputDataSpecification::output_residuals, ProcessLib::OutputDataSpecification::output_variables, and ProcessLib::OutputDataSpecification::repeats_each_steps.

◆ operator<<() [3/4]

std::ostream & ProcessLib::operator<< ( std::ostream & os,
OutputFormat const & of )
inline

Definition at line 44 of file OutputFormat.h.

45{
46 os << "OutputFormat::directory:" << of.directory << std::endl;
47 os << "OutputFormat::prefix:" << of.prefix << std::endl;
48 os << "OutputFormat::suffix:" << of.suffix << std::endl;
49 os << "OutputFormat::compression:" << of.compression << std::endl;
50 return os;
51}

References ProcessLib::OutputFormat::compression, ProcessLib::OutputFormat::directory, ProcessLib::OutputFormat::prefix, and ProcessLib::OutputFormat::suffix.

◆ operator<<() [4/4]

std::ostream & ProcessLib::operator<< ( std::ostream & os,
PairRepeatEachSteps const & pair )

Definition at line 77 of file OutputDataSpecification.cpp.

78{
79 os << "Output " << pair.repeat << " times every " << pair.each_steps
80 << " timestep.\n";
81 return os;
82}

References ProcessLib::PairRepeatEachSteps::each_steps, and ProcessLib::PairRepeatEachSteps::repeat.

◆ outputMeshVtk() [1/2]

void ProcessLib::outputMeshVtk ( OutputVTKFormat const & output_file,
MeshLib::IO::PVDFile & pvd_file,
MeshLib::Mesh const & mesh,
double const t,
int const timestep,
int const iteration,
bool const converged )

Definition at line 50 of file OutputFormat.cpp.

54{
55 auto const name = output_file.constructFilename(mesh.getName(), timestep, t,
56 iteration, converged);
57 pvd_file.addVTUFile(name, t);
58
59 auto const path = BaseLib::joinPaths(output_file.directory, name);
60 // Output of NaN's triggers floating point exceptions. Because we are not
61 // debugging VTK (or other libraries) at this point, the possibly set
62 // exceptions are temporarily disabled and are restored at the end of the
63 // function.
64 [[maybe_unused]] DisableFPE disable_fpe;
65 outputMeshVtk(path, mesh, output_file.compression, output_file.data_mode);
66}
void addVTUFile(std::string const &vtu_fname, double timestep)
Add a VTU file to this PVD file.
Definition PVDFile.cpp:23
std::string joinPaths(std::string const &pathA, std::string const &pathB)
void outputMeshVtk(std::string const &file_name, MeshLib::Mesh const &mesh, bool const compress_output, int const data_mode)

References MeshLib::IO::PVDFile::addVTUFile(), ProcessLib::OutputFormat::compression, ProcessLib::OutputVTKFormat::constructFilename(), ProcessLib::OutputVTKFormat::data_mode, ProcessLib::OutputFormat::directory, MeshLib::Mesh::getName(), BaseLib::joinPaths(), and outputMeshVtk().

◆ outputMeshVtk() [2/2]

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

Definition at line 41 of file OutputFormat.cpp.

43{
44 DBUG("Writing output to '{:s}'.", file_name);
45
46 MeshLib::IO::VtuInterface vtu_interface(&mesh, data_mode, compress_output);
47 vtu_interface.writeToFile(file_name);
48}
Reads and writes VtkXMLUnstructuredGrid-files (vtu) to and from OGS data structures....

References DBUG(), and MeshLib::IO::VtuInterface::writeToFile().

Referenced by ProcessLib::Output::doOutputNonlinearIteration(), ProcessLib::OutputVTKFormat::outputMeshes(), and outputMeshVtk().

◆ parseBall()

detail::Ball ProcessLib::parseBall ( BaseLib::ConfigTree const & config)
static

Returns a ball represented by its center and its radius.

Input File Parameter
prj__process_variables__process_variable__deactivated_subdomains__deactivated_subdomain__ball__center
Input File Parameter
prj__process_variables__process_variable__deactivated_subdomains__deactivated_subdomain__ball__radius

Definition at line 210 of file CreateDeactivatedSubdomain.cpp.

211{
212 DBUG("Constructing a ball");
213 auto const center =
215 config.getConfigParameter<std::vector<double>>("center");
216 if (center.size() != 3)
217 {
218 OGS_FATAL(
219 "For construction of the center of a ball must be a 3D point. Got "
220 "a vector of size {}.",
221 center.size());
222 }
223
224 auto const radius =
226 config.getConfigParameter<double>("radius");
227
228 return {Eigen::Vector3d{center[0], center[1], center[2]}, radius};
229}

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

Referenced by createDeactivatedSubdomain().

◆ parseConstraintDirichletBoundaryCondition()

ConstraintDirichletBoundaryConditionConfig ProcessLib::parseConstraintDirichletBoundaryCondition ( BaseLib::ConfigTree const & config)
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__ConstraintDirichlet__constraint_type
Input File Parameter
prj__process_variables__process_variable__boundary_conditions__boundary_condition__ConstraintDirichlet__constraining_process_variable
Input File Parameter
prj__process_variables__process_variable__boundary_conditions__boundary_condition__ConstraintDirichlet__constraint_threshold
Input File Parameter
prj__process_variables__process_variable__boundary_conditions__boundary_condition__ConstraintDirichlet__constraint_direction
Input File Parameter
prj__process_variables__process_variable__boundary_conditions__boundary_condition__ConstraintDirichlet__parameter

Definition at line 217 of file ConstraintDirichletBoundaryCondition.cpp.

218{
219 DBUG("Parsing ConstraintDirichletBoundaryCondition from config.");
221 config.checkConfigParameter("type", "ConstraintDirichlet");
222
223 auto const type =
225 config.getConfigParameter<std::string>("constraint_type");
226
227 // Todo (TF) Open question: How to specify which getFlux function should be
228 // used for the constraint calculation?
229 auto const process_variable =
231 config.getConfigParameter<std::string>("constraining_process_variable");
232
233 auto const threshold =
235 config.getConfigParameter<double>("constraint_threshold");
236
237 auto const direction_string =
239 config.getConfigParameter<std::string>("constraint_direction");
240
242 auto const name = config.getConfigParameter<std::string>("parameter");
243 DBUG("parameter name {:s}", name);
244
245 return {type, process_variable, threshold, direction_string, name};
246}

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

Referenced by createBoundaryCondition(), and parseConstraintDirichletBoundaryCondition().

◆ parseDirichletBCConfig()

std::string ProcessLib::parseDirichletBCConfig ( BaseLib::ConfigTree const & config)
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 49 of file DirichletBoundaryCondition.cpp.

50{
52 config.checkConfigParameter("type", "Dirichlet");
53
55 auto const name = config.getConfigParameter<std::string>("parameter");
56 DBUG("{}: parameter name {:s}", __FUNCTION__, name);
57 return name;
58}

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

Referenced by createBoundaryCondition().

◆ parseDirichletBoundaryConditionWithinTimeIntervalConfig()

DirichletBoundaryConditionConfig ProcessLib::parseDirichletBoundaryConditionWithinTimeIntervalConfig ( BaseLib::ConfigTree const & config)
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 15 of file CreateDirichletBoundaryConditionWithinTimeInterval.cpp.

17{
19 config.checkConfigParameter("type", "DirichletWithinTimeInterval");
20
22 auto const name = config.getConfigParameter<std::string>("parameter");
23 DBUG("{}: parameter name {:s}", __FUNCTION__, name);
24
26 config.peekConfigParameter<std::string>("time_interval");
27 auto time_interval = BaseLib::createTimeInterval(config);
28
29 return {name, time_interval};
30}
TimeInterval createTimeInterval(ConfigTree const &config)

References BaseLib::ConfigTree::checkConfigParameter(), BaseLib::createTimeInterval(), DBUG(), BaseLib::ConfigTree::getConfigParameter(), and BaseLib::ConfigTree::peekConfigParameter().

Referenced by createBoundaryCondition().

◆ parseHCNonAdvectiveFreeComponentFlowBoundaryCondition()

std::string ProcessLib::parseHCNonAdvectiveFreeComponentFlowBoundaryCondition ( BaseLib::ConfigTree const & config)
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 11 of file HCNonAdvectiveFreeComponentFlowBoundaryCondition.cpp.

13{
14 DBUG("Parsing open boundary for Component Transport process.");
15
17 config.checkConfigParameter("type",
18 "HCNonAdvectiveFreeComponentFlowBoundary");
19
20 auto const boundary_permeability_name =
22 config.getConfigParameter<std::string>("parameter");
23
24 return boundary_permeability_name;
25}

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

Referenced by createBoundaryCondition().

◆ parseLineSegment()

std::pair< Eigen::Vector3d, Eigen::Vector3d > ProcessLib::parseLineSegment ( BaseLib::ConfigTree const & config)
static

Returns a line segment represented by its begin and end points.

Input File Parameter
prj__process_variables__process_variable__deactivated_subdomains__deactivated_subdomain__line_segment__start
Input File Parameter
prj__process_variables__process_variable__deactivated_subdomains__deactivated_subdomain__line_segment__end

Definition at line 179 of file CreateDeactivatedSubdomain.cpp.

181{
182 DBUG("Constructing line segment");
183 auto const start =
185 config.getConfigParameter<std::vector<double>>("start");
186 if (start.size() != 3)
187 {
188 OGS_FATAL(
189 "For construction of a line segment the start point must be a 3D "
190 "point. Got a vector of size {}.",
191 start.size());
192 }
193
194 auto const end =
196 config.getConfigParameter<std::vector<double>>("end");
197
198 if (end.size() != 3)
199 {
200 OGS_FATAL(
201 "For construction of a line segment the end point must be a 3D "
202 "point. Got a vector of size {}.",
203 end.size());
204 }
205 return {Eigen::Vector3d{start[0], start[1], start[2]},
206 Eigen::Vector3d{end[0], end[1], end[2]}};
207}

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

Referenced by createDeactivatedSubdomain().

◆ parseNeumannBoundaryCondition()

NeumannBoundaryConditionConfig ProcessLib::parseNeumannBoundaryCondition ( BaseLib::ConfigTree const & config)
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 10 of file NeumannBoundaryCondition.cpp.

12{
14 config.checkConfigParameter("type", "Neumann");
15
17 auto const name = config.getConfigParameter<std::string>("parameter");
18 DBUG("{}: parameter {:s}", __FUNCTION__, name);
19
20 auto const area_parameter_name =
22 config.getConfigParameterOptional<std::string>("area_parameter");
23 if (area_parameter_name.has_value())
24 {
25 DBUG("{}: area parameter name '{:s}'", __FUNCTION__,
26 area_parameter_name.value());
27 }
28
29 return {name, area_parameter_name};
30}

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

Referenced by createBoundaryCondition().

◆ parsePhaseFieldIrreversibleDamageOracleBoundaryCondition()

void ProcessLib::parsePhaseFieldIrreversibleDamageOracleBoundaryCondition ( BaseLib::ConfigTree const & config)
Input File Parameter
prj__process_variables__process_variable__boundary_conditions__boundary_condition__type

Definition at line 63 of file PhaseFieldIrreversibleDamageOracleBoundaryCondition.cpp.

65{
66 DBUG("Parsing PhaseFieldIrreversibleDamageOracleBoundaryCondition.");
67
69 config.checkConfigParameter(
70 "type", "PhaseFieldIrreversibleDamageOracleBoundaryCondition");
71}

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

Referenced by createBoundaryCondition().

◆ parsePrimaryVariableConstraintDirichletBoundaryCondition()

PrimaryVariableConstraintDirichletBoundaryConditionConfig ProcessLib::parsePrimaryVariableConstraintDirichletBoundaryCondition ( BaseLib::ConfigTree const & config)
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__PrimaryVariableConstraintDirichlet__parameter
Input File Parameter
prj__process_variables__process_variable__boundary_conditions__boundary_condition__PrimaryVariableConstraintDirichlet__threshold_parameter
Input File Parameter
prj__process_variables__process_variable__boundary_conditions__boundary_condition__PrimaryVariableConstraintDirichlet__comparison_operator

Definition at line 100 of file PrimaryVariableConstraintDirichletBoundaryCondition.cpp.

102{
103 DBUG("Parsing PrimaryVariableConstraintDirichletBoundaryCondition config.");
105 config.checkConfigParameter("type", "PrimaryVariableConstraintDirichlet");
106
108 auto const name = config.getConfigParameter<std::string>("parameter");
109 DBUG("parameter {:s}", name);
110
111 auto const threshold_parameter_name =
113 config.getConfigParameter<std::string>("threshold_parameter");
114 DBUG("parameter {:s} as threshold_parameter", threshold_parameter_name);
115
116 auto const comparison_operator_string =
118 config.getConfigParameter<std::string>("comparison_operator");
119
120 return {name, threshold_parameter_name, comparison_operator_string};
121}

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

Referenced by createBoundaryCondition().

◆ parsePythonBoundaryCondition()

PythonBoundaryConditionConfig ProcessLib::parsePythonBoundaryCondition ( BaseLib::ConfigTree const & config)
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 262 of file PythonBoundaryCondition.cpp.

264{
266 config.checkConfigParameter("type", "Python");
267
269 auto const bc_object = config.getConfigParameter<std::string>("bc_object");
271 auto const flush_stdout = config.getConfigParameter("flush_stdout", false);
272
273 return {bc_object, flush_stdout};
274}

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

Referenced by createBoundaryCondition().

◆ parseReleaseNodalForce()

std::string ProcessLib::parseReleaseNodalForce ( BoundaryConditionConfig const & bc_config)
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__ReleaseNodalForce__time_decay_parameter

Definition at line 23 of file CreateReleaseNodalForce.cpp.

24{
25 DBUG("Parse ReleaseNodalForce boundary condition.");
26
27 if (!bc_config.compensate_non_equilibrium_initial_residuum)
28 {
30 "The compensate_non_equilibrium_initial_residuum must be set for "
31 "the ReleaseNodalForce boundary condition.");
32 }
33
34 auto const& config = bc_config.config;
36 config.checkConfigParameter("type", "ReleaseNodalForce");
37
38 auto const decay_parameter_name =
40 config.getConfigParameter<std::string>("time_decay_parameter");
41 DBUG("decay parameter {:s}", decay_parameter_name);
42
43 return decay_parameter_name;
44}

References BaseLib::ConfigTree::checkConfigParameter(), ProcessLib::BoundaryConditionConfig::compensate_non_equilibrium_initial_residuum, ProcessLib::BoundaryConditionConfig::config, DBUG(), and OGS_FATAL.

Referenced by createBoundaryCondition().

◆ parseRobinBoundaryCondition()

RobinBoundaryConditionConfig ProcessLib::parseRobinBoundaryCondition ( BaseLib::ConfigTree const & config)
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 10 of file RobinBoundaryCondition.cpp.

12{
13 DBUG("parsing RobinBoundaryConditionConfig.");
15 config.checkConfigParameter("type", "Robin");
16
18 auto const alpha_name = config.getConfigParameter<std::string>("alpha");
20 auto const u_0_name = config.getConfigParameter<std::string>("u_0");
21
22 auto const area_parameter_name =
24 config.getConfigParameterOptional<std::string>("area_parameter");
25 if (area_parameter_name.has_value())
26 {
27 DBUG("area parameter name '{:s}'", __FUNCTION__,
28 area_parameter_name.value());
29 }
30
31 return {alpha_name, u_0_name, area_parameter_name};
32}

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

Referenced by createBoundaryCondition().

◆ parseSolutionDependentDirichletBoundaryCondition()

SolutionDependentDirichletBoundaryConditionConfig ProcessLib::parseSolutionDependentDirichletBoundaryCondition ( BaseLib::ConfigTree const & config)
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__SolutionDependentDirichlet__property_name
Input File Parameter
prj__process_variables__process_variable__boundary_conditions__boundary_condition__SolutionDependentDirichlet__initial_value_parameter

Definition at line 93 of file SolutionDependentDirichletBoundaryCondition.cpp.

95{
96 DBUG("Parsing SolutionDependentDirichletBoundaryCondition.");
97
99 config.checkConfigParameter("type", "SolutionDependentDirichlet");
100
101 auto property_name =
103 config.getConfigParameter<std::string>("property_name");
104
105 auto const initial_value_parameter_string =
107 config.getConfigParameter<std::string>("initial_value_parameter");
108
109 return {property_name, initial_value_parameter_string};
110}

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

Referenced by createBoundaryCondition().

◆ parseTimeDecayDirichletBoundaryConditionConfig()

TimeDecayDirichletBoundaryConditionConfig ProcessLib::parseTimeDecayDirichletBoundaryConditionConfig ( BaseLib::ConfigTree const & config)
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__TimeDecayDirichlet__time_decay_parameter
Input File Parameter
prj__process_variables__process_variable__boundary_conditions__boundary_condition__TimeDecayDirichlet__lower_limit

Definition at line 19 of file CreateTimeDecayDirichletBoundaryCondition.cpp.

21{
23 config.checkConfigParameter("type", "TimeDecayDirichlet");
24
25 auto const parameter_name =
27 config.getConfigParameter<std::string>("time_decay_parameter");
28 DBUG("Using parameter {:s}", parameter_name);
29
30 auto const lower_limit =
32 config.getConfigParameter<double>("lower_limit");
33
34 return {parameter_name, lower_limit};
35}

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

Referenced by createBoundaryCondition().

◆ parseTimeIntervalOrCurve()

MathLib::PiecewiseLinearInterpolation ProcessLib::parseTimeIntervalOrCurve ( std::optional< BaseLib::ConfigTree > const & time_interval_config,
std::optional< std::string > const & curve_name,
std::map< std::string, std::unique_ptr< MathLib::PiecewiseLinearInterpolation > > const & curves )
static
Input File Parameter
prj__process_variables__process_variable__deactivated_subdomains__deactivated_subdomain__time_interval__start
Input File Parameter
prj__process_variables__process_variable__deactivated_subdomains__deactivated_subdomain__time_interval__end

Definition at line 126 of file CreateDeactivatedSubdomain.cpp.

132{
133 // Check for the error case first: only one of the configs must be used.
134 if (time_interval_config && curve_name)
135 {
136 OGS_FATAL(
137 "In the deactivate subdomain either a time interval or a curve "
138 "must be given, not both.");
139 }
140
141 // Parse time interval and return a curve
142 if (time_interval_config)
143 {
144 DBUG("Constructing time interval");
145 auto const start_time =
147 time_interval_config->getConfigParameter<double>("start");
148
149 auto const end_time =
151 time_interval_config->getConfigParameter<double>("end");
152
153 // Using very large value for the curve's value, s.t. for any time from
154 // start to end the whole subdomain is deactivated at once.
155 return {std::vector<double>({start_time, end_time}),
156 std::vector<double>({std::numeric_limits<double>::max(),
157 std::numeric_limits<double>::max()}),
158 false};
159 }
160
161 // Try to find the curve.
162 if (curve_name)
163 {
164 DBUG("Using curve '{:s}'", *curve_name);
165 // Return a copy of the curve because the time interval in the other
166 // branch returns a temporary.
167 return *BaseLib::getOrError(curves, *curve_name,
168 "Could not find curve.");
169 }
170
171 // If we got so far, there is an error: one of the configs must be
172 // available.
173 OGS_FATAL(
174 "In the deactivate subdomain neither a time interval nor a curve are "
175 "given. One of them must be specified.");
176}

References DBUG(), BaseLib::getOrError(), and OGS_FATAL.

Referenced by createDeactivatedSubdomain().

◆ parseVariableDependentNeumannBoundaryCondition()

VariableDependentNeumannConfig ProcessLib::parseVariableDependentNeumannBoundaryCondition ( BaseLib::ConfigTree const & config)
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 10 of file VariableDependentNeumannBoundaryCondition.cpp.

12{
14 config.checkConfigParameter("type", "VariableDependentNeumann");
15
16 auto const constant_name =
18 config.getConfigParameter<std::string>("constant_name");
19
20 auto const coefficient_current_variable_name =
22 config.getConfigParameter<std::string>(
23 "coefficient_current_variable_name");
24
25 auto const coefficient_other_variable_name =
27 config.getConfigParameter<std::string>(
28 "coefficient_other_variable_name");
29
30 auto const coefficient_mixed_variables_name =
32 config.getConfigParameter<std::string>(
33 "coefficient_mixed_variables_name");
34
35 return {constant_name, coefficient_current_variable_name,
36 coefficient_other_variable_name, coefficient_mixed_variables_name};
37}

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

Referenced by createBoundaryCondition().

◆ parseWellboreCompensateNeumannBoundaryCondition()

WellboreCompensateCoefficients ProcessLib::parseWellboreCompensateNeumannBoundaryCondition ( BaseLib::ConfigTree const & config)
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__WellboreCompensateNeumann__coefficient_pressure
Input File Parameter
prj__process_variables__process_variable__boundary_conditions__boundary_condition__WellboreCompensateNeumann__coefficient_velocity
Input File Parameter
prj__process_variables__process_variable__boundary_conditions__boundary_condition__WellboreCompensateNeumann__coefficient_enthalpy

Definition at line 11 of file WellboreCompensateNeumannBoundaryCondition.cpp.

13{
14 DBUG("Parsing WellboreCompensateNeumann BC.");
16 config.checkConfigParameter("type", "WellboreCompensateNeumann");
17
18 auto const pressure_coefficient =
20 config.getConfigParameter<double>("coefficient_pressure");
21
22 auto const velocity_coefficient =
24 config.getConfigParameter<double>("coefficient_velocity");
25
26 auto const enthalpy_coefficient =
28 config.getConfigParameter<double>("coefficient_enthalpy");
29
30 return {pressure_coefficient, velocity_coefficient, enthalpy_coefficient};
31}

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

Referenced by createBoundaryCondition().

◆ postTimestepForAllProcesses()

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

Definition at line 87 of file TimeLoop.cpp.

92{
93 for (auto& process_data : per_process_data)
94 {
95 auto const process_id = process_data->process_id;
96 auto& pcs = process_data->process;
97
98 pcs.computeSecondaryVariable(t(), dt, process_solutions,
99 *process_solutions_prev[process_id],
100 process_id);
101 pcs.postTimestep(process_solutions, process_solutions_prev, t(), dt,
102 process_id);
103 }
104}

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

◆ preTimestepForAllProcesses()

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

Definition at line 74 of file TimeLoop.cpp.

78{
79 for (auto& process_data : per_process_data)
80 {
81 auto const process_id = process_data->process_id;
82 auto& pcs = process_data->process;
83 pcs.preTimestep(_process_solutions, t(), dt, process_id);
84 }
85}

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

◆ pythonBindBoundaryCondition()

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

Creates Python bindings for the Python BC class.

Definition at line 42 of file PythonBoundaryConditionModule.cpp.

43{
44 namespace py = pybind11;
45
48 pybc(m, "BoundaryCondition");
49
50 pybc.def(py::init());
51
52 pybc.def("getDirichletBCValue",
55}
virtual std::pair< bool, double > getDirichletBCValue(double, std::array< double, 3 >, std::size_t, std::vector< double > const &) const
virtual std::tuple< bool, double, std::vector< double > > getFlux(double, std::array< double, 3 >, std::vector< double > const &) const

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

Referenced by PYBIND11_EMBEDDED_MODULE(), and PYBIND11_MODULE().

◆ removeIPFieldDataNameSuffix()

std::string_view ProcessLib::removeIPFieldDataNameSuffix ( std::string_view const name)
inline

Removes the suffix '_ip' from the passed field name.

Definition at line 15 of file SetIPDataInitialConditions.h.

16{
17 if (!name.ends_with("_ip"))
18 {
20 "The name of integration point data must end with '_ip'. '{}' "
21 "does not.",
22 name);
23 }
24
25 return {name.data(), name.size() - 3};
26}

References OGS_FATAL.

Referenced by setIPDataInitialConditions().

◆ setEquationSystem()

void ProcessLib::setEquationSystem ( ProcessData const & process_data)

Definition at line 10 of file ProcessData.cpp.

11{
12 auto& conv_crit = *process_data.conv_crit;
13 auto& nonlinear_solver = process_data.nonlinear_solver;
14
16 switch (process_data.nonlinear_solver_tag)
17 {
18 case Tag::Picard:
19 {
21 auto& eq_sys_ = static_cast<EqSys&>(*process_data.tdisc_ode_sys);
22 if (auto* nl_solver =
24 &nonlinear_solver);
25 nl_solver != nullptr)
26 {
27 nl_solver->setEquationSystem(eq_sys_, conv_crit);
28 }
29 else
30 {
32 "Could not cast nonlinear solver to Picard type solver.");
33 }
34 break;
35 }
36 case Tag::Newton:
37 {
38 using EqSys = NumLib::NonlinearSystem<Tag::Newton>;
39 auto& eq_sys_ = static_cast<EqSys&>(*process_data.tdisc_ode_sys);
40
41 if (auto* nl_solver =
42 dynamic_cast<NumLib::NonlinearSolver<Tag::Newton>*>(
43 &nonlinear_solver);
44 nl_solver != nullptr)
45 {
46 nl_solver->setEquationSystem(eq_sys_, conv_crit);
47 }
48#ifdef USE_PETSC
49 else if (auto* nl_solver =
50 dynamic_cast<NumLib::PETScNonlinearSolver*>(
51 &nonlinear_solver);
52 nl_solver != nullptr)
53 {
54 nl_solver->setEquationSystem(eq_sys_, conv_crit);
55 }
56#endif // USE_PETSC
57 else
58 {
60 "Could not cast nonlinear solver to Newton type solver.");
61 }
62 break;
63 }
64 }
65}

References ProcessLib::ProcessData::conv_crit, ProcessLib::ProcessData::nonlinear_solver, ProcessLib::ProcessData::nonlinear_solver_tag, OGS_FATAL, and ProcessLib::ProcessData::tdisc_ode_sys.

Referenced by calculateNonEquilibriumInitialResiduum(), and solveOneTimeStepOneProcess().

◆ setInitialConditions()

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

Definition at line 166 of file TimeLoop.cpp.

169{
170 std::vector<GlobalVector*> process_solutions;
171 std::vector<GlobalVector*> process_solutions_prev;
172
173 for (auto const& process_data : per_process_data)
174 {
175 auto const process_id = process_data->process_id;
176 auto& ode_sys = *process_data->tdisc_ode_sys;
177
178 // append a solution vector of suitable size
179 process_solutions.emplace_back(
181 ode_sys.getMatrixSpecifications(process_id)));
182 process_solutions_prev.emplace_back(
184 ode_sys.getMatrixSpecifications(process_id)));
185 }
186
187 for (auto const& process_data : per_process_data)
188 {
189 auto& pcs = process_data->process;
190 auto const process_id = process_data->process_id;
191 pcs.setInitialConditions(process_solutions, process_solutions_prev,
192 t0(), process_id);
193
194 auto& time_disc = *process_data->time_disc;
195 time_disc.setInitialState(t0()); // push IC
196 }
197
198 return {process_solutions, process_solutions_prev};
199}
static NUMLIB_EXPORT VectorProvider & provider

References NumLib::GlobalVectorProvider::provider.

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

◆ setIntegrationPointDataMaterialStateVariables()

template<typename IntegrationPointDataVector, typename MemberType, typename MaterialStateVariables>
std::size_t ProcessLib::setIntegrationPointDataMaterialStateVariables ( double const * values,
IntegrationPointDataVector & ip_data_vector,
MemberType member,
std::function< std::span< double >(MaterialStateVariables &)> get_values_span )

◆ setIntegrationPointKelvinVectorData() [1/2]

template<int DisplacementDim, typename IntegrationPointDataVector, typename Accessor>
std::size_t ProcessLib::setIntegrationPointKelvinVectorData ( double const * values,
IntegrationPointDataVector & ip_data_vector,
Accessor && accessor )

Definition at line 137 of file SetOrGetIntegrationPointData.h.

141{
142 using AccessorResult = decltype(std::declval<Accessor>()(
143 std::declval<IntegrationPointDataVector>()[0]));
144 static_assert(std::is_lvalue_reference_v<AccessorResult>,
145 "The ip data accessor must return a reference.");
146
147 constexpr int kelvin_vector_size =
149 auto const n_integration_points = ip_data_vector.size();
150
151 auto kelvin_vector_values =
152 Eigen::Map<Eigen::Matrix<double, kelvin_vector_size, Eigen::Dynamic,
153 Eigen::ColMajor> const>(
154 values, kelvin_vector_size, n_integration_points);
155
156 for (unsigned ip = 0; ip < n_integration_points; ++ip)
157 {
158 accessor(ip_data_vector[ip]) =
160 kelvin_vector_values.col(ip));
161 }
162
163 return n_integration_points;
164}
Eigen::Matrix< double, Eigen::MatrixBase< Derived >::RowsAtCompileTime, 1 > symmetricTensorToKelvinVector(Eigen::MatrixBase< Derived > const &v)

References MathLib::KelvinVector::kelvin_vector_dimensions(), and MathLib::KelvinVector::symmetricTensorToKelvinVector().

◆ setIntegrationPointKelvinVectorData() [2/2]

template<int DisplacementDim, typename IntegrationPointDataVector, typename IpData, typename MemberType>
std::size_t ProcessLib::setIntegrationPointKelvinVectorData ( double const * values,
IntegrationPointDataVector & ip_data_vector,
MemberType IpData::*const member )

Definition at line 125 of file SetOrGetIntegrationPointData.h.

129{
131 values, ip_data_vector,
132 [member](IpData& ip_data) -> auto& { return ip_data.*member; });
133}
std::size_t setIntegrationPointKelvinVectorData(double const *values, IntegrationPointDataVector &ip_data_vector, MemberType IpData::*const member)

References setIntegrationPointKelvinVectorData().

Referenced by ProcessLib::ThermoMechanics::ThermoMechanicsLocalAssembler< ShapeFunction, DisplacementDim >::setEpsilon(), ProcessLib::ThermoMechanics::ThermoMechanicsLocalAssembler< ShapeFunction, DisplacementDim >::setEpsilonMechanical(), setIntegrationPointKelvinVectorData(), ProcessLib::HydroMechanics::HydroMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::setIPDataInitialConditions(), ProcessLib::PhaseField::PhaseFieldLocalAssembler< ShapeFunction, DisplacementDim >::setIPDataInitialConditions(), ProcessLib::ThermoHydroMechanics::ThermoHydroMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::setIPDataInitialConditions(), ProcessLib::ThermoHydroMechanics::ThermoHydroMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::setSigma(), and ProcessLib::ThermoMechanics::ThermoMechanicsLocalAssembler< ShapeFunction, DisplacementDim >::setSigma().

◆ setIntegrationPointScalarData() [1/2]

template<typename IntegrationPointDataVector, typename Accessor>
std::size_t ProcessLib::setIntegrationPointScalarData ( double const * values,
IntegrationPointDataVector & ip_data_vector,
Accessor && accessor )

Definition at line 218 of file SetOrGetIntegrationPointData.h.

222{
223 using AccessorResult = decltype(std::declval<Accessor>()(
224 std::declval<IntegrationPointDataVector>()[0]));
225 static_assert(std::is_lvalue_reference_v<AccessorResult>,
226 "The ip data accessor must return a reference.");
227
228 auto const n_integration_points = ip_data_vector.size();
229
230 for (unsigned ip = 0; ip < n_integration_points; ++ip)
231 {
232 accessor(ip_data_vector[ip]) = values[ip];
233 }
234 return n_integration_points;
235}

◆ setIntegrationPointScalarData() [2/2]

template<typename IntegrationPointDataVector, typename IpData, typename MemberType>
std::size_t ProcessLib::setIntegrationPointScalarData ( double const * values,
IntegrationPointDataVector & ip_data_vector,
MemberType IpData::*const member )

Definition at line 207 of file SetOrGetIntegrationPointData.h.

211{
212 return setIntegrationPointScalarData(values, ip_data_vector,
213 [member](IpData& ip_data) -> auto&
214 { return ip_data.*member; });
215}
std::size_t setIntegrationPointScalarData(double const *values, IntegrationPointDataVector &ip_data_vector, MemberType IpData::*const member)

References setIntegrationPointScalarData().

Referenced by setIntegrationPointScalarData(), ProcessLib::HydroMechanics::HydroMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::setIPDataInitialConditions(), and ProcessLib::ThermoRichardsFlow::ThermoRichardsFlowLocalAssembler< ShapeFunction, GlobalDim >::setIPDataInitialConditions().

◆ setIPDataInitialConditions()

template<typename LocalAssemblersVector>
void ProcessLib::setIPDataInitialConditions ( std::vector< std::unique_ptr< MeshLib::IntegrationPointWriter > > const & _integration_point_writer,
MeshLib::Properties const & mesh_properties,
LocalAssemblersVector & local_assemblers )

Definition at line 29 of file SetIPDataInitialConditions.h.

34{
35 auto const& opt_ip_meta_data_all =
37
38 for (auto const& ip_writer : _integration_point_writer)
39 {
40 // Find the mesh property with integration point writer's name.
41 auto const& name = ip_writer->name();
42 if (!mesh_properties.existsPropertyVector<double>(name))
43 {
44 continue;
45 }
46 auto const& mesh_property =
47 *mesh_properties.template getPropertyVector<double>(name);
48
49 // The mesh property must be defined on integration points.
50 if (mesh_property.getMeshItemType() !=
52 {
53 continue;
54 }
55
56 auto const ip_meta_data =
57 getIntegrationPointMetaDataSingleField(opt_ip_meta_data_all, name);
58
59 // Check the number of components.
60 if (ip_meta_data.n_components !=
61 mesh_property.getNumberOfGlobalComponents())
62 {
64 "Different number of components in meta data ({:d}) than in "
65 "the integration point field data for '{:s}': {:d}.",
66 ip_meta_data.n_components, name,
67 mesh_property.getNumberOfGlobalComponents());
68 }
69
70 INFO("Setting initial integration point data for '{}'", name);
71
72 auto const name_transformed = removeIPFieldDataNameSuffix(name);
73
74 // Now we have a properly named vtk's field data array and the
75 // corresponding meta data.
76 std::size_t position = 0;
77 for (auto& local_asm : local_assemblers)
78 {
79 std::size_t const integration_points_read =
80 local_asm->setIPDataInitialConditions(
81 name_transformed, &mesh_property[position],
82 ip_meta_data.integration_order);
83 // The number of read integration points could be zero in case there
84 // are e.g. multiple materials with different sets of internal state
85 // variables.
86
87 position += integration_points_read * ip_meta_data.n_components;
88 }
89 }
90}
std::optional< IntegrationPointMetaData > getIntegrationPointMetaData(MeshLib::Properties const &properties)
IntegrationPointMetaDataSingleField getIntegrationPointMetaDataSingleField(std::optional< IntegrationPointMetaData > const &ip_meta_data, std::string const &field_name)
std::string_view removeIPFieldDataNameSuffix(std::string_view const name)
Removes the suffix '_ip' from the passed field name.

References MeshLib::Properties::existsPropertyVector(), MeshLib::getIntegrationPointMetaData(), INFO(), MeshLib::IntegrationPoint, OGS_FATAL, and removeIPFieldDataNameSuffix().

Referenced by ProcessLib::HydroMechanics::HydroMechanicsProcess< DisplacementDim >::initializeConcreteProcess(), ProcessLib::LargeDeformation::LargeDeformationProcess< DisplacementDim >::initializeConcreteProcess(), ProcessLib::PhaseField::PhaseFieldProcess< DisplacementDim >::initializeConcreteProcess(), ProcessLib::RichardsMechanics::RichardsMechanicsProcess< DisplacementDim >::initializeConcreteProcess(), ProcessLib::SmallDeformation::SmallDeformationProcess< DisplacementDim >::initializeConcreteProcess(), ProcessLib::TH2M::TH2MProcess< DisplacementDim >::initializeConcreteProcess(), ProcessLib::ThermoHydroMechanics::ThermoHydroMechanicsProcess< DisplacementDim >::initializeConcreteProcess(), ProcessLib::ThermoMechanics::ThermoMechanicsProcess< DisplacementDim >::initializeConcreteProcess(), ProcessLib::ThermoRichardsFlow::ThermoRichardsFlowProcess::initializeConcreteProcess(), and ProcessLib::ThermoRichardsMechanics::ThermoRichardsMechanicsProcess< DisplacementDim, ConstitutiveTraits >::initializeConcreteProcess().

◆ setTimeDiscretizedODESystem() [1/2]

void ProcessLib::setTimeDiscretizedODESystem ( ProcessData & process_data)

Definition at line 160 of file TimeLoop.cpp.

161{
162 setTimeDiscretizedODESystem(process_data, process_data.process);
163}
void setTimeDiscretizedODESystem(ProcessData &process_data, NumLib::ODESystem< ODETag, NumLib::NonlinearSolverTag::Picard > &ode_sys)
Definition TimeLoop.cpp:107

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

◆ setTimeDiscretizedODESystem() [2/2]

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

Definition at line 107 of file TimeLoop.cpp.

110{
111 using Tag = NumLib::NonlinearSolverTag;
112 // A concrete Picard solver
113 using NonlinearSolverPicard = NumLib::NonlinearSolver<Tag::Picard>;
114 // A concrete Newton solver
115 using NonlinearSolverNewton = NumLib::NonlinearSolver<Tag::Newton>;
116
117 if (dynamic_cast<NonlinearSolverPicard*>(&process_data.nonlinear_solver))
118 {
119 // The Picard solver can also work with a Newton-ready ODE,
120 // because the Newton ODESystem derives from the Picard ODESystem.
121 // So no further checks are needed here.
122
123 process_data.tdisc_ode_sys = std::make_unique<
125 process_data.process_id, ode_sys, *process_data.time_disc);
126 }
127 // TODO (naumov) Provide a function to nonlinear_solver to distinguish the
128 // types. Could be handy, because a nonlinear solver could handle both types
129 // like PETScSNES.
130 else if ((dynamic_cast<NonlinearSolverNewton*>(
131 &process_data.nonlinear_solver) != nullptr)
132#ifdef USE_PETSC
133 || (dynamic_cast<NumLib::PETScNonlinearSolver*>(
134 &process_data.nonlinear_solver) != nullptr)
135#endif // USE_PETSC
136 )
137 {
138 // The Newton-Raphson method needs a Newton-ready ODE.
139
141 if (auto* ode_newton = dynamic_cast<ODENewton*>(&ode_sys))
142 {
143 process_data.tdisc_ode_sys = std::make_unique<
145 process_data.process_id, *ode_newton, *process_data.time_disc);
146 }
147 else
148 {
149 OGS_FATAL(
150 "You are trying to solve a non-Newton-ready ODE with the"
151 " Newton-Raphson method. Aborting");
152 }
153 }
154 else
155 {
156 OGS_FATAL("Encountered unknown nonlinear solver type. Aborting");
157 }
158}
std::unique_ptr< NumLib::TimeDiscretization > time_disc
Definition ProcessData.h:55
NumLib::NonlinearSolverBase & nonlinear_solver
Definition ProcessData.h:51
std::unique_ptr< NumLib::EquationSystem > tdisc_ode_sys
type-erased time-discretized ODE system
Definition ProcessData.h:57

References 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().

◆ solveMonolithicProcess()

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

Definition at line 619 of file TimeLoop.cpp.

624{
625 BaseLib::RunTime time_timestep_process;
626 time_timestep_process.start();
627
628 INFO("Solving process #{:d} started.", process_data.process_id);
629
630 auto const nonlinear_solver_status = solveOneTimeStepOneProcess(
631 x, x_prev, timestep_id, t(), dt, process_data, outputs);
632
633 INFO("[time] Solving process #{:d} took {:g} s in time step #{:d}",
634 process_data.process_id, time_timestep_process.elapsed(), timestep_id);
635
636 return nonlinear_solver_status;
637}
Count the running time.
Definition RunTime.h:18
double elapsed() const
Get the elapsed time in seconds.
Definition RunTime.h:31
void start()
Start the timer.
Definition RunTime.h:21
NumLib::NonlinearSolverStatus solveOneTimeStepOneProcess(std::vector< GlobalVector * > &x, std::vector< GlobalVector * > const &x_prev, std::size_t const timestep, double const t, double const delta_t, ProcessData const &process_data, std::vector< Output > const &outputs)
Definition TimeLoop.cpp:217

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

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

◆ solveOneTimeStepOneProcess()

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

Definition at line 217 of file TimeLoop.cpp.

221{
222 auto& process = process_data.process;
223 int const process_id = process_data.process_id;
224 auto& time_disc = *process_data.time_disc;
225 auto& nonlinear_solver = process_data.nonlinear_solver;
226
227 setEquationSystem(process_data);
228
229 // Note: Order matters!
230 // First advance to the next timestep, then set known solutions at that
231 // time, afterwards pass the right solution vector and time to the
232 // preTimestep() hook.
233
234 time_disc.nextTimestep(t, delta_t);
235
236 auto const post_iteration_callback =
237 [&](int const iteration, bool const converged,
238 std::vector<GlobalVector*> const& x)
239 {
240 // Note: We don't call the postNonLinearSolver(), preOutput(),
241 // computeSecondaryVariable() and postTimestep() hooks here. This might
242 // lead to some inconsistencies in the data compared to regular output.
243 for (auto const& output : outputs)
244 {
245 output.doOutputNonlinearIteration(process, process_id, timestep,
246 NumLib::Time(t), iteration,
247 converged, x);
248 }
249 };
250
251 auto const nonlinear_solver_status =
252 nonlinear_solver.solve(x, x_prev, post_iteration_callback, process_id);
253
254 if (!nonlinear_solver_status.error_norms_met)
255 {
256 return nonlinear_solver_status;
257 }
258
259 process.postNonLinearSolver(x, x_prev, t, delta_t, process_id);
260
261 return nonlinear_solver_status;
262}

References ProcessLib::ProcessData::nonlinear_solver, ProcessLib::ProcessData::process, ProcessLib::ProcessData::process_id, setEquationSystem(), and ProcessLib::ProcessData::time_disc.

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

◆ transposeInPlace() [1/3]

template<int Components>
void ProcessLib::transposeInPlace ( std::vector< double > & values)

Definition at line 35 of file TransposeInPlace.h.

36{
38 Eigen::Matrix<double, Eigen::Dynamic, Components, Eigen::RowMajor>>(
39 values, values.size() / Components, Components) =
41 Eigen::Matrix<double, Components, Eigen::Dynamic, Eigen::RowMajor>>(
42 values, Components, values.size() / Components)
43 .transpose()
44 .eval();
45}
Eigen::Map< const Matrix > toMatrix(std::vector< double > const &data, Eigen::MatrixXd::Index rows, Eigen::MatrixXd::Index cols)

References MathLib::toMatrix().

◆ transposeInPlace() [2/3]

void ProcessLib::transposeInPlace ( std::vector< double > & values,
unsigned const num_components )
inline

Definition at line 47 of file TransposeInPlace.h.

49{
51 Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor>>(
52 values, values.size() / num_components, num_components) =
53 MathLib::toMatrix<Eigen::Matrix<double,
54 Eigen::Dynamic,
55 Eigen::Dynamic,
56 Eigen::RowMajor>>(
57 values, num_components, values.size() / num_components)
58 .transpose()
59 .eval();
60}

References MathLib::toMatrix().

◆ transposeInPlace() [3/3]

template<int Components, typename StoreValuesFunction>
std::vector< double > ProcessLib::transposeInPlace ( StoreValuesFunction const & store_values_function)

In-place transpose. A helper function for the integration point data getters. For time being Eigen's transposeInPlace doesn't work for non-square mapped matrices.

Definition at line 17 of file TransposeInPlace.h.

19{
20 std::vector<double> result;
21 store_values_function(result);
23 Eigen::Matrix<double, Eigen::Dynamic, Components, Eigen::RowMajor>>(
24 result, result.size() / Components, Components) =
26 Eigen::Matrix<double, Components, Eigen::Dynamic, Eigen::RowMajor>>(
27 result, Components, result.size() / Components)
28 .transpose()
29 .eval();
30
31 return result;
32}

References MathLib::toMatrix().

Referenced by ProcessLib::ThermoHydroMechanics::ThermoHydroMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::getEpsilon(), ProcessLib::ThermoMechanics::ThermoMechanicsLocalAssembler< ShapeFunction, DisplacementDim >::getEpsilon(), ProcessLib::ThermoHydroMechanics::ThermoHydroMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::getEpsilon0(), ProcessLib::ThermoHydroMechanics::ThermoHydroMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::getEpsilonM(), ProcessLib::ThermoMechanics::ThermoMechanicsLocalAssembler< ShapeFunction, DisplacementDim >::getEpsilonMechanical(), getIntegrationPointKelvinVectorData(), ProcessLib::ThermoHydroMechanics::ThermoHydroMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::getSigma(), ProcessLib::ThermoMechanics::ThermoMechanicsLocalAssembler< ShapeFunction, DisplacementDim >::getSigma(), and makeExtrapolator2().

Variable Documentation

◆ timestepper_cannot_reduce_dt

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

Definition at line 639 of file TimeLoop.cpp.

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