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  HT
 
namespace  HydroMechanics
 
namespace  LargeDeformation
 
namespace  LIE
 
namespace  LinearBMatrix
 
namespace  LiquidFlow
 
namespace  NonLinearBMatrix
 
namespace  NormalTractionBoundaryCondition
 
namespace  PhaseField
 
namespace  Reflection
 
namespace  RichardsComponentTransport
 
namespace  RichardsFlow
 
namespace  RichardsMechanics
 
namespace  SmallDeformation
 
namespace  SmallDeformationNonlocal
 
namespace  SourceTerms
 
namespace  SteadyStateDiffusion
 
namespace  StokesFlow
 
namespace  TES
 
namespace  TH2M
 
namespace  ThermalTwoPhaseFlowWithPP
 
namespace  ThermoHydroMechanics
 
namespace  ThermoMechanicalPhaseField
 
namespace  ThermoMechanics
 
namespace  ThermoRichardsFlow
 
namespace  ThermoRichardsMechanics
 
namespace  TwoPhaseFlowWithPP
 
namespace  TwoPhaseFlowWithPrho
 

Classes

class  AbstractJacobianAssembler
 Base class for Jacobian assemblers. More...
 
class  AnalyticalJacobianAssembler
 
struct  AssembledMatrixCache
 
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
 
class  CentralDifferencesJacobianAssembler
 Assembles the Jacobian matrix using central differences. More...
 
class  CompareJacobiansJacobianAssembler
 
class  ConstraintDirichletBoundaryCondition
 
class  ConstraintDirichletBoundaryConditionLocalAssembler
 
class  ConstraintDirichletBoundaryConditionLocalAssemblerInterface
 
struct  DeactivatedSubdomain
 
class  DeactivatedSubdomainDirichlet
 
struct  DeactivatedSubdomainMesh
 
class  DirichletBoundaryCondition
 
class  DirichletBoundaryConditionWithinTimeInterval
 
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  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
 
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...
 
class  PythonBoundaryConditionLocalAssembler
 
class  PythonBoundaryConditionLocalAssemblerInterface
 
class  PythonBoundaryConditionPythonSideInterface
 
class  PythonBoundaryConditionPythonSideInterfaceTrampoline
 
struct  RobinBoundaryConditionData
 
class  RobinBoundaryConditionLocalAssembler
 
struct  SecondaryVariable
 Stores information about a specific secondary variable. More...
 
class  SecondaryVariableCollection
 Handles configuration of several secondary variables from the project file. More...
 
struct  SecondaryVariableFunctions
 
class  SolutionDependentDirichletBoundaryCondition
 
class  SourceTerm
 
class  SourceTermCollection
 
struct  SourceTermConfig
 
struct  SourceTermIntegrationPointData
 
struct  SubmeshAssemblyData
 
class  SubmeshAssemblySupport
 
struct  SubmeshResiduumOutputConfig
 
class  SurfaceFlux
 
struct  SurfaceFluxData
 
class  SurfaceFluxLocalAssembler
 
class  SurfaceFluxLocalAssemblerInterface
 
class  TESFEMReactionAdaptorCaOH2
 
class  TimeLoop
 Time loop capable of time-integrating several processes at once. More...
 
struct  TrafoIdentity
 
struct  TrafoLog
 
struct  TrafoScale
 
struct  TrafoTanh
 
struct  VariableDependentNeumannBoundaryConditionData
 
class  VariableDependentNeumannBoundaryConditionLocalAssembler
 
class  VectorMatrixAssembler
 
class  VolumetricSourceTerm
 
class  VolumetricSourceTermLocalAssembler
 
class  VolumetricSourceTermLocalAssemblerInterface
 

Typedefs

using HCNonAdvectiveFreeComponentFlowBoundaryCondition
 
using NeumannBoundaryCondition
 
using RobinBoundaryCondition
 
using VariableDependentNeumannBoundaryCondition
 
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

std::unique_ptr< ConstraintDirichletBoundaryConditioncreateConstraintDirichletBoundaryCondition (BaseLib::ConfigTree const &config, MeshLib::Mesh const &bc_mesh, NumLib::LocalToGlobalIndexMap const &dof_table_bulk, int const variable_id, unsigned const integration_order, int const component_id, std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const &parameters, Process const &constraining_process)
 
std::unique_ptr< BoundaryConditioncreateBoundaryCondition (const BoundaryConditionConfig &config, const NumLib::LocalToGlobalIndexMap &dof_table, const MeshLib::Mesh &bulk_mesh, const int variable_id, const unsigned integration_order, const unsigned shapefunction_order, const std::vector< std::unique_ptr< ParameterLib::ParameterBase > > &parameters, const Process &process, std::vector< std::reference_wrapper< ProcessVariable > > const &all_process_variables_for_this_process, std::map< int, std::shared_ptr< MaterialPropertyLib::Medium > > const &)
 
std::unique_ptr< BoundaryConditioncreateDirichletBoundaryConditionWithinTimeInterval (BaseLib::ConfigTree const &config, MeshLib::Mesh const &bc_mesh, NumLib::LocalToGlobalIndexMap const &dof_table_bulk, int const variable_id, int const component_id, const std::vector< std::unique_ptr< ParameterLib::ParameterBase > > &parameters)
 
std::unique_ptr< SourceTermcreateNodalSourceTerm (BaseLib::ConfigTree const &config, MeshLib::Mesh const &st_mesh, std::unique_ptr< NumLib::LocalToGlobalIndexMap > dof_table, std::size_t const source_term_mesh_id, const int variable_id, const int component_id, std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const &parameters)
 
std::unique_ptr< SourceTermcreateSourceTerm (const SourceTermConfig &config, const NumLib::LocalToGlobalIndexMap &dof_table_bulk, const MeshLib::Mesh &source_term_mesh, const int variable_id, const unsigned integration_order, const unsigned shapefunction_order, std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const &parameters, std::vector< std::reference_wrapper< ProcessVariable > > const &all_process_variables_for_this_process)
 
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::unique_ptr< DirichletBoundaryConditioncreateDirichletBoundaryCondition (BaseLib::ConfigTree const &config, MeshLib::Mesh const &bc_mesh, NumLib::LocalToGlobalIndexMap const &dof_table_bulk, int const variable_id, int const component_id, const std::vector< std::unique_ptr< ParameterLib::ParameterBase > > &parameters)
 
void checkParametersOfDirichletBoundaryCondition (MeshLib::Mesh const &bc_mesh, NumLib::LocalToGlobalIndexMap const &dof_table_bulk, int const variable_id, int const component_id)
 
void getEssentialBCValuesLocal (ParameterLib::Parameter< double > const &parameter, MeshLib::Mesh const &bc_mesh, std::vector< 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)
 
std::unique_ptr< HCNonAdvectiveFreeComponentFlowBoundaryConditioncreateHCNonAdvectiveFreeComponentFlowBoundaryCondition (BaseLib::ConfigTree const &config, MeshLib::Mesh const &bc_mesh, NumLib::LocalToGlobalIndexMap const &dof_table, int const variable_id, int const component_id, unsigned const integration_order, std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const &parameters, unsigned const global_dim, Process const &process, unsigned const shapefunction_order)
 
std::unique_ptr< NeumannBoundaryConditioncreateNeumannBoundaryCondition (BaseLib::ConfigTree const &config, MeshLib::Mesh const &bc_mesh, NumLib::LocalToGlobalIndexMap const &dof_table, int const variable_id, int const component_id, unsigned const integration_order, unsigned const shapefunction_order, unsigned const global_dim, std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const &parameters)
 
std::unique_ptr< PhaseFieldIrreversibleDamageOracleBoundaryConditioncreatePhaseFieldIrreversibleDamageOracleBoundaryCondition (BaseLib::ConfigTree const &config, NumLib::LocalToGlobalIndexMap const &dof_table, MeshLib::Mesh const &mesh, int const variable_id, int const component_id)
 
std::unique_ptr< PrimaryVariableConstraintDirichletBoundaryConditioncreatePrimaryVariableConstraintDirichletBoundaryCondition (BaseLib::ConfigTree const &config, MeshLib::Mesh const &bc_mesh, NumLib::LocalToGlobalIndexMap const &dof_table_bulk, int const variable_id, int const component_id, const std::vector< std::unique_ptr< ParameterLib::ParameterBase > > &parameters)
 
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)
 
std::unique_ptr< PythonBoundaryConditioncreatePythonBoundaryCondition (BaseLib::ConfigTree 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.
 
std::unique_ptr< RobinBoundaryConditioncreateRobinBoundaryCondition (BaseLib::ConfigTree const &config, MeshLib::Mesh const &bc_mesh, NumLib::LocalToGlobalIndexMap const &dof_table, int const variable_id, int const component_id, unsigned const integration_order, unsigned const shapefunction_order, unsigned const global_dim, std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const &parameters)
 
std::unique_ptr< SolutionDependentDirichletBoundaryConditioncreateSolutionDependentDirichletBoundaryCondition (BaseLib::ConfigTree 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< VariableDependentNeumannBoundaryConditioncreateVariableDependentNeumannBoundaryCondition (BaseLib::ConfigTree const &config, MeshLib::Mesh const &bc_mesh, NumLib::LocalToGlobalIndexMap const &dof_table, int const variable_id, int const component_id, unsigned const integration_order, unsigned const shapefunction_order, unsigned const global_dim, std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const &parameters)
 
std::unique_ptr< CentralDifferencesJacobianAssemblercreateCentralDifferencesJacobianAssembler (BaseLib::ConfigTree const &config)
 
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)
 
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.
 
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 (const double t, std::vector< GlobalVector * > const &xs, int const process_id, ProcessOutputData const &process_output_data, bool const output_secondary_variables, OutputDataSpecification const &process_output)
 
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)
 
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 (double const t, double const dt, std::vector< std::unique_ptr< ProcessData > > const &per_process_data, std::vector< GlobalVector * > const &_process_solutions)
 
void postTimestepForAllProcesses (double 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 (double const t0, std::vector< std::unique_ptr< ProcessData > > const &per_process_data)
 
void calculateNonEquilibriumInitialResiduum (std::vector< std::unique_ptr< ProcessData > > const &per_process_data, std::vector< GlobalVector * > 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, double const time)
 
static NumLib::NonlinearSolverStatus solveMonolithicProcess (const double 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:
decltype(BaseLib::TMP::filter<NumLib::AllElementTraitsLagrange>(
detail::isElementEnabled))

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

Definition at line 119 of file EnabledElements.h.

◆ HCNonAdvectiveFreeComponentFlowBoundaryCondition

Initial value:
GenericNaturalBoundaryCondition<
HCNonAdvectiveFreeComponentFlowBoundaryConditionData,
HCNonAdvectiveFreeComponentFlowBoundaryConditionLocalAssembler>

Definition at line 19 of file HCNonAdvectiveFreeComponentFlowBoundaryCondition.h.

◆ LocalAssemblerFactory

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

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

Definition at line 89 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:
LocalAssemblerFactoryTaylorHood<1 ,
2 ,
LocalAssemblerInterface,
LocalAssemblerImplementation,
IntegrationMethodProvider,
GlobalDim,
ConstructorArgs...>

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

Definition at line 169 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:
LocalAssemblerFactoryForDimGreaterEqualN<2,
LocalAssemblerInterface,
LocalAssemblerImplementation,
IntegrationMethodProvider,
GlobalDim,
ConstructorArgs...>

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

Definition at line 104 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:
LocalAssemblerFactoryTaylorHood<2 ,
2 ,
LocalAssemblerInterface,
LocalAssemblerImplementation,
IntegrationMethodProvider,
GlobalDim,
ConstructorArgs...>

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

Definition at line 187 of file LocalAssemblerFactoryTaylorHood.h.

◆ LocalAssemblerTraits

template<typename ShpPol , unsigned NNodes, unsigned NodalDOF, int Dim>
using ProcessLib::LocalAssemblerTraits
Initial value:
detail::LocalAssemblerTraitsFixed<ShpPol, NNodes, NodalDOF, Dim>

Definition at line 185 of file LocalAssemblerTraits.h.

◆ NeumannBoundaryCondition

Initial value:
GenericNaturalBoundaryCondition<NeumannBoundaryConditionData,
NeumannBoundaryConditionLocalAssembler>

Definition at line 19 of file NeumannBoundaryCondition.h.

◆ RobinBoundaryCondition

Initial value:
GenericNaturalBoundaryCondition<RobinBoundaryConditionData,
RobinBoundaryConditionLocalAssembler>

Definition at line 18 of file RobinBoundaryCondition.h.

◆ Trafo

◆ VariableDependentNeumannBoundaryCondition

Initial value:
GenericNaturalBoundaryCondition<
VariableDependentNeumannBoundaryConditionData,
VariableDependentNeumannBoundaryConditionLocalAssembler>

Definition at line 19 of file VariableDependentNeumannBoundaryCondition.h.

Enumeration Type Documentation

◆ OutputType

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

Definition at line 21 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 31 of file Output.cpp.

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

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

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

◆ addProcessDataToMesh()

void ProcessLib::addProcessDataToMesh ( const double 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 374 of file AddProcessDataToMesh.cpp.

380{
381 DBUG("Process output data.");
382
383 auto const& pod = process_output_data;
384 auto const& process_variables = pod.getProcessVariables(process_id);
385 auto const& secondary_variables = pod.getSecondaryVariables();
386 auto const* const integration_point_writers =
387 pod.getIntegrationPointWriters();
388 auto const& bulk_mesh_dof_table = pod.getBulkMeshDofTable(process_id);
389 auto const& output_mesh_dof_table = pod.getOutputMeshDofTable(process_id);
390 auto& output_mesh = pod.getOutputMesh();
391
392 auto const& output_variables = process_output.output_variables;
393
394 addOgsVersion(output_mesh);
395
396 auto names_of_already_output_variables = addPrimaryVariablesToMesh(
397 output_mesh, *xs[process_id], process_variables, output_variables,
398 output_mesh_dof_table, bulk_mesh_dof_table);
399
400 if (output_secondary_variables)
401 {
402 auto const& output_mesh_dof_tables =
403 pod.getOutputMeshDofTablesOfAllProcesses();
404
405 addSecondaryVariablesToMesh(secondary_variables,
406 names_of_already_output_variables, t, xs,
407 output_mesh, output_mesh_dof_tables,
408 process_output.output_residuals);
409 }
410
411 if (integration_point_writers)
412 {
413 addIntegrationPointDataToMesh(output_mesh, *integration_point_writers);
414 }
415}
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, const double 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:30

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

◆ bheInflowpythonBindBoundaryCondition()

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

Creates BHE Inflow Python bindings for the Python BC class.

Definition at line 76 of file BHEInflowPythonBoundaryConditionModule.cpp.

77{
78 namespace py = pybind11;
79
82 pybc(m, "BHENetwork");
83
84 pybc.def(py::init());
85
86 pybc.def("initializeDataContainer",
88 initializeDataContainer);
89 pybc.def("tespySolver",
90 &BHEInflowPythonBoundaryConditionPythonSideInterface::tespySolver);
91
92 pybc.def("serverCommunicationPreTimestep",
94 serverCommunicationPreTimestep);
95
96 pybc.def("serverCommunicationPostTimestep",
98 serverCommunicationPostTimestep);
99}

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 205 of file TimeLoop.cpp.

209{
210 for (auto const& process_data : per_process_data)
211 {
212 auto& nonlinear_solver = process_data->nonlinear_solver;
213
214 setEquationSystem(*process_data);
215 nonlinear_solver.calculateNonEquilibriumInitialResiduum(
216 process_solutions, process_solutions_prev,
217 process_data->process_id);
218 }
219}
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 432 of file Output.cpp.

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

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

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

References DBUG(), MeshLib::Properties::existsPropertyVector(), MeshLib::getBulkIDString(), MeshLib::Mesh::getName(), MeshLib::Mesh::getNodes(), 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(), and ProcessLib::DirichletBoundaryConditionWithinTimeInterval::config().

◆ computationOfChangeNeeded()

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

Definition at line 279 of file TimeLoop.cpp.

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

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

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

◆ computeHMatrix()

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

Fills a H-matrix based on given shape function.

Definition at line 53 of file HMatrixUtils.h.

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

Referenced by ProcessLib::LIE::HydroMechanics::HydroMechanicsLocalAssemblerFracture< ShapeFunctionDisplacement, ShapeFunctionPressure, GlobalDim >::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 16 of file ComputeResiduum.cpp.

19{
20 using namespace MathLib::LinAlg;
21 GlobalVector residuum;
22 GlobalVector x_dot;
23 copy(x, x_dot); // tmp = x
24 axpy(x_dot, -1., x_prev); // tmp = x - x_prev
25 scale(x_dot, 1. / dt); // tmp = (x - x_prev)/dt
26 matMult(M, x_dot, residuum); // r = M*x_dot
27 matMultAdd(K, x, residuum, residuum); // r = M*x_dot + K*x
28 axpy(residuum, -1., b); // r = M*x_dot + K*x - b
29 scale(residuum, -1.); // r = -r
30 return residuum;
31}
Global vector based on Eigen vector.
Definition EigenVector.h:25

Referenced by ProcessLib::LiquidFlow::LiquidFlowProcess::assembleConcreteProcess(), ProcessLib::ComponentTransport::ComponentTransportProcess::preOutputConcreteProcess(), and ProcessLib::HeatConduction::HeatConductionProcess::preOutputConcreteProcess().

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

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

References DBUG(), and OGS_FATAL.

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

◆ createBoundaryCondition()

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

Definition at line 31 of file CreateBoundaryCondition.cpp.

42{
43 // Surface mesh and bulk mesh must have equal axial symmetry flags!
44 if (config.boundary_mesh.isAxiallySymmetric() !=
45 bulk_mesh.isAxiallySymmetric())
46 {
48 "The boundary mesh {:s} axially symmetric but the bulk mesh {:s}. "
49 "Both must have an equal axial symmetry property.",
50 config.boundary_mesh.isAxiallySymmetric() ? "is" : "is not",
51 bulk_mesh.isAxiallySymmetric() ? "is" : "is not");
52 }
53
55 auto const type = config.config.peekConfigParameter<std::string>("type");
56
57 if (bool const component_id_required = type != "NormalTraction";
58 component_id_required && !config.component_id.has_value())
59 {
61 "Specifying the component id (<component>) for a boundary "
62 "condition of type {} is mandatory.",
63 type);
64 }
65
66 if (type == "Dirichlet")
67 {
69 config.config, config.boundary_mesh, dof_table, variable_id,
70 *config.component_id, parameters);
71 }
72 if (type == "DirichletWithinTimeInterval")
73 {
75 config.config, config.boundary_mesh, dof_table, variable_id,
76 *config.component_id, parameters);
77 }
78 if (type == "Neumann")
79 {
81 config.config, config.boundary_mesh, dof_table, variable_id,
82 *config.component_id, integration_order, shapefunction_order,
83 bulk_mesh.getDimension(), parameters);
84 }
85 if (type == "Robin")
86 {
88 config.config, config.boundary_mesh, dof_table, variable_id,
89 *config.component_id, integration_order, shapefunction_order,
90 bulk_mesh.getDimension(), parameters);
91 }
92 if (type == "VariableDependentNeumann")
93 {
95 config.config, config.boundary_mesh, dof_table, variable_id,
96 *config.component_id, integration_order, shapefunction_order,
97 bulk_mesh.getDimension(), parameters);
98 }
99
100 if (type == "Python")
101 {
103 config.config, config.boundary_mesh, dof_table, bulk_mesh,
104 variable_id, *config.component_id, integration_order,
105 shapefunction_order, all_process_variables_for_this_process);
106 }
107
108 //
109 // Special boundary conditions
110 //
111 if (type == "ConstraintDirichlet")
112 {
114 config.config, config.boundary_mesh, dof_table, variable_id,
115 integration_order, *config.component_id, parameters, process);
116 }
117 if (type == "PrimaryVariableConstraintDirichlet")
118 {
120 config.config, config.boundary_mesh, dof_table, variable_id,
121 *config.component_id, parameters);
122 }
123 if (type == "SolutionDependentDirichlet")
124 {
126 config.config, config.boundary_mesh, dof_table, variable_id,
127 *config.component_id, parameters);
128 }
129 if (type == "HCNonAdvectiveFreeComponentFlowBoundary")
130 {
132 config.config, config.boundary_mesh, dof_table, variable_id,
133 *config.component_id, integration_order, parameters,
134 bulk_mesh.getDimension(), process, shapefunction_order);
135 }
136 if (type == "NormalTraction")
137 {
138 switch (bulk_mesh.getDimension())
139 {
140 case 2:
141 return ProcessLib::NormalTractionBoundaryCondition::
142 createNormalTractionBoundaryCondition<2>(
143 config.config, config.boundary_mesh, dof_table,
144 variable_id, integration_order, shapefunction_order,
145 parameters);
146 case 3:
147 return ProcessLib::NormalTractionBoundaryCondition::
148 createNormalTractionBoundaryCondition<3>(
149 config.config, config.boundary_mesh, dof_table,
150 variable_id, integration_order, shapefunction_order,
151 parameters);
152 default:
153 OGS_FATAL(
154 "NormalTractionBoundaryCondition can not be instantiated "
155 "for mesh dimensions other than two or three. "
156 "{}-dimensional mesh was given.",
157 bulk_mesh.getDimension());
158 }
159 }
160 if (type == "PhaseFieldIrreversibleDamageOracleBoundaryCondition")
161 {
162 return ProcessLib::
165 config.config, dof_table, bulk_mesh, variable_id,
166 *config.component_id);
167 }
168 OGS_FATAL("Unknown boundary condition type: `{:s}'.", type);
169}
T peekConfigParameter(std::string const &param) const
bool isAxiallySymmetric() const
Definition Mesh.h:137
unsigned getDimension() const
Returns the dimension of the mesh (determined by the maximum dimension over all elements).
Definition Mesh.h:88
std::unique_ptr< VariableDependentNeumannBoundaryCondition > createVariableDependentNeumannBoundaryCondition(BaseLib::ConfigTree const &config, MeshLib::Mesh const &bc_mesh, NumLib::LocalToGlobalIndexMap const &dof_table, int const variable_id, int const component_id, unsigned const integration_order, unsigned const shapefunction_order, unsigned const global_dim, std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const &parameters)
std::unique_ptr< SolutionDependentDirichletBoundaryCondition > createSolutionDependentDirichletBoundaryCondition(BaseLib::ConfigTree 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< RobinBoundaryCondition > createRobinBoundaryCondition(BaseLib::ConfigTree const &config, MeshLib::Mesh const &bc_mesh, NumLib::LocalToGlobalIndexMap const &dof_table, int const variable_id, int const component_id, unsigned const integration_order, unsigned const shapefunction_order, unsigned const global_dim, std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const &parameters)
std::unique_ptr< PhaseFieldIrreversibleDamageOracleBoundaryCondition > createPhaseFieldIrreversibleDamageOracleBoundaryCondition(BaseLib::ConfigTree const &config, NumLib::LocalToGlobalIndexMap const &dof_table, MeshLib::Mesh const &mesh, int const variable_id, int const component_id)
std::unique_ptr< BoundaryCondition > createDirichletBoundaryConditionWithinTimeInterval(BaseLib::ConfigTree const &config, MeshLib::Mesh const &bc_mesh, NumLib::LocalToGlobalIndexMap const &dof_table_bulk, int const variable_id, int const component_id, const std::vector< std::unique_ptr< ParameterLib::ParameterBase > > &parameters)
std::unique_ptr< DirichletBoundaryCondition > createDirichletBoundaryCondition(BaseLib::ConfigTree const &config, MeshLib::Mesh const &bc_mesh, NumLib::LocalToGlobalIndexMap const &dof_table_bulk, int const variable_id, int const component_id, const std::vector< std::unique_ptr< ParameterLib::ParameterBase > > &parameters)
std::unique_ptr< ConstraintDirichletBoundaryCondition > createConstraintDirichletBoundaryCondition(BaseLib::ConfigTree const &config, MeshLib::Mesh const &bc_mesh, NumLib::LocalToGlobalIndexMap const &dof_table_bulk, int const variable_id, unsigned const integration_order, int const component_id, std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const &parameters, Process const &constraining_process)
std::unique_ptr< PythonBoundaryCondition > createPythonBoundaryCondition(BaseLib::ConfigTree 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< NeumannBoundaryCondition > createNeumannBoundaryCondition(BaseLib::ConfigTree const &config, MeshLib::Mesh const &bc_mesh, NumLib::LocalToGlobalIndexMap const &dof_table, int const variable_id, int const component_id, unsigned const integration_order, unsigned const shapefunction_order, unsigned const global_dim, std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const &parameters)
std::unique_ptr< HCNonAdvectiveFreeComponentFlowBoundaryCondition > createHCNonAdvectiveFreeComponentFlowBoundaryCondition(BaseLib::ConfigTree const &config, MeshLib::Mesh const &bc_mesh, NumLib::LocalToGlobalIndexMap const &dof_table, int const variable_id, int const component_id, unsigned const integration_order, std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const &parameters, unsigned const global_dim, Process const &process, unsigned const shapefunction_order)
std::unique_ptr< PrimaryVariableConstraintDirichletBoundaryCondition > createPrimaryVariableConstraintDirichletBoundaryCondition(BaseLib::ConfigTree const &config, MeshLib::Mesh const &bc_mesh, NumLib::LocalToGlobalIndexMap const &dof_table_bulk, int const variable_id, int const component_id, const std::vector< std::unique_ptr< ParameterLib::ParameterBase > > &parameters)

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

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

◆ createCentralDifferencesJacobianAssembler()

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

Definition at line 171 of file CentralDifferencesJacobianAssembler.cpp.

172{
174 config.checkConfigParameter("type", "CentralDifferences");
175
176 // TODO make non-optional.
178 auto rel_eps = config.getConfigParameterOptional<std::vector<double>>(
179 "relative_epsilons");
181 auto comp_mag = config.getConfigParameterOptional<std::vector<double>>(
182 "component_magnitudes");
183
184 if (!!rel_eps != !!comp_mag)
185 {
186 OGS_FATAL(
187 "Either both or none of <relative_epsilons> and "
188 "<component_magnitudes> have to be specified.");
189 }
190
191 std::vector<double> abs_eps;
192
193 if (rel_eps)
194 {
195 if (rel_eps->size() != comp_mag->size())
196 {
197 OGS_FATAL(
198 "The numbers of components of <relative_epsilons> and "
199 "<component_magnitudes> do not match.");
200 }
201
202 abs_eps.resize(rel_eps->size());
203 for (std::size_t i = 0; i < rel_eps->size(); ++i)
204 {
205 abs_eps[i] = (*rel_eps)[i] * (*comp_mag)[i];
206 }
207 }
208 else
209 {
210 // By default 1e-8 is used as epsilon for all components.
211 // TODO: remove this default value.
212 abs_eps.emplace_back(1e-8);
213 }
214
215 return std::make_unique<CentralDifferencesJacobianAssembler>(
216 std::move(abs_eps));
217}

References BaseLib::ConfigTree::checkConfigParameter(), 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 411 of file CompareJacobiansJacobianAssembler.cpp.

412{
413 // TODO doc script corner case: Parameter could occur at different
414 // locations.
416 config.checkConfigParameter("type", "CompareJacobians");
417
418 auto asm1 =
420 createJacobianAssembler(config.getConfigSubtree("jacobian_assembler"));
421
422 auto asm2 = createJacobianAssembler(
424 config.getConfigSubtree("reference_jacobian_assembler"));
425
427 auto const abs_tol = config.getConfigParameter<double>("abs_tol");
429 auto const rel_tol = config.getConfigParameter<double>("rel_tol");
430
432 auto const fail_on_error = config.getConfigParameter<bool>("fail_on_error");
433
435 auto const log_file = config.getConfigParameter<std::string>("log_file");
436
437 return std::make_unique<CompareJacobiansJacobianAssembler>(
438 std::move(asm1), std::move(asm2), abs_tol, rel_tol, fail_on_error,
439 log_file);
440}
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 ( BaseLib::ConfigTree const & config,
MeshLib::Mesh const & bc_mesh,
NumLib::LocalToGlobalIndexMap const & dof_table_bulk,
int const variable_id,
unsigned const integration_order,
int const component_id,
std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const & parameters,
Process const & constraining_process )

The function parses the config tree and creates a ConstraintDirichletBoundaryCondition.

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

Definition at line 224 of file ConstraintDirichletBoundaryCondition.cpp.

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

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

Referenced by createBoundaryCondition().

◆ 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__boundary_parameter
Input File Parameter
prj__process_variables__process_variable__deactivated_subdomains__deactivated_subdomain__material_ids

Definition at line 214 of file CreateDeactivatedSubdomain.cpp.

220{
221 auto const& time_interval_config =
223 config.getConfigSubtreeOptional("time_interval");
224
225 auto const& curve_name =
227 config.getConfigParameterOptional<std::string>("time_curve");
228 auto time_interval =
229 parseTimeIntervalOrCurve(time_interval_config, curve_name, curves);
230
231 auto const line_segment_config =
233 config.getConfigSubtreeOptional("line_segment");
234
235 if (time_interval_config && line_segment_config)
236 {
237 OGS_FATAL(
238 "When using time interval for subdomain deactivation a line "
239 "segment must not be specified.");
240 }
241
242 if (curve_name && !line_segment_config)
243 {
244 OGS_FATAL(
245 "When using curve for subdomain deactivation a line segment must "
246 "be specified.");
247 }
248
249 // If time interval was specified then an empty optional line segment is
250 // used *internally* because the whole selected material ids subdomain will
251 // be deactivated.
252 std::optional<std::pair<Eigen::Vector3d, Eigen::Vector3d>> line_segment;
253 if (curve_name)
254 {
255 line_segment = parseLineSegment(*line_segment_config);
256 }
257
258 ParameterLib::Parameter<double>* boundary_value_parameter = nullptr;
259 auto boundary_value_parameter_name =
261 config.getConfigParameterOptional<std::string>("boundary_parameter");
262 if (boundary_value_parameter_name)
263 {
264 DBUG("Using parameter {:s}", *boundary_value_parameter_name);
265 boundary_value_parameter = &ParameterLib::findParameter<double>(
266 *boundary_value_parameter_name, parameters, 1, &mesh);
267 }
268
269 auto deactivated_subdomain_material_ids =
271 config.getConfigParameter("material_ids", std::vector<int>{}) |
272 ranges::to<std::unordered_set>();
273
274 if (deactivated_subdomain_material_ids.empty())
275 {
276 OGS_FATAL(
277 "The material IDs of the deactivated subdomains are not given. The "
278 "program terminates now.");
279 }
280
281 if (materialIDs(mesh) == nullptr)
282 {
283 OGS_FATAL(
284 "The mesh doesn't contain materialIDs for subdomain deactivation. "
285 "The program terminates now.");
286 }
287
288 auto deactivated_subdomain_mesh = createDeactivatedSubdomainMesh(
289 mesh, deactivated_subdomain_material_ids);
290
291 return {std::move(time_interval), line_segment,
292 std::move(deactivated_subdomain_mesh), boundary_value_parameter};
293}
PropertyVector< int > const * materialIDs(Mesh const &mesh)
Definition Mesh.cpp:268
static DeactivatedSubdomainMesh createDeactivatedSubdomainMesh(MeshLib::Mesh const &mesh, std::unordered_set< int > const &deactivated_subdomain_material_ids)
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(), BaseLib::ConfigTree::getConfigParameter(), BaseLib::ConfigTree::getConfigParameterOptional(), BaseLib::ConfigTree::getConfigSubtreeOptional(), OGS_FATAL, parseLineSegment(), and parseTimeIntervalOrCurve().

Referenced by createDeactivatedSubdomains().

◆ createDeactivatedSubdomainMesh()

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

Definition at line 92 of file CreateDeactivatedSubdomain.cpp.

95{
96 // An element is active if its material id matches one of the deactivated
97 // subdomain material ids.
98 auto is_active =
99 [&deactivated_subdomain_material_ids,
100 &material_ids = *materialIDs(mesh)](std::size_t element_id)
101 {
102 return deactivated_subdomain_material_ids.contains(
103 material_ids[element_id]);
104 };
105
106 auto const& elements = mesh.getElements();
107 std::vector<MeshLib::Element*> deactivated_elements;
108 ranges::copy_if(elements, back_inserter(deactivated_elements), is_active,
109 [](auto const e) { return e->getID(); });
110
111 auto bulk_element_ids = deactivated_elements | MeshLib::views::ids |
112 ranges::to<std::unordered_set>;
113
114 static int mesh_number = 0;
115 // Subdomain mesh consisting of deactivated elements.
117 "deactivate_subdomain_" + std::to_string(mesh_number++),
118 MeshLib::cloneElements(deactivated_elements));
119
120 auto [inner_nodes, outer_nodes] =
121 extractInnerAndOuterNodes(mesh, *sub_mesh, is_active);
122
123 auto outer_nodes_elements =
124 extractElementsAlongOuterNodes(mesh, *sub_mesh, outer_nodes);
125
126 return {std::move(*sub_mesh), std::move(bulk_element_ids),
127 std::move(inner_nodes), std::move(outer_nodes),
128 std::move(outer_nodes_elements)};
129}
constexpr ranges::views::view_closure ids
For an element of a range view return its id.
Definition Mesh.h:225
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 295 of file CreateDeactivatedSubdomain.cpp.

302{
303 std::vector<DeactivatedSubdomain> deactivated_subdomains;
304 // Deactivated subdomains
305 if (auto subdomains_config =
307 config.getConfigSubtreeOptional("deactivated_subdomains"))
308 {
309 INFO("There are subdomains being deactivated.");
310
311 auto const deactivated_subdomain_configs =
313 subdomains_config->getConfigSubtreeList("deactivated_subdomain");
314 std::transform(std::begin(deactivated_subdomain_configs),
315 std::end(deactivated_subdomain_configs),
316 std::back_inserter(deactivated_subdomains),
317 [&](auto const& config) {
319 config, mesh, parameters, curves);
320 });
321 }
322 return deactivated_subdomains;
323}
void INFO(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:35
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().

◆ createDirichletBoundaryCondition()

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

Definition at line 56 of file DirichletBoundaryCondition.cpp.

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

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

Referenced by createBoundaryCondition().

◆ createDirichletBoundaryConditionWithinTimeInterval()

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

Definition at line 20 of file CreateDirichletBoundaryConditionWithinTimeInterval.cpp.

25{
26 DBUG(
27 "Constructing DirichletBoundaryConditionWithinTimeInterval from "
28 "config.");
29
31 config.checkConfigParameter("type", "DirichletWithinTimeInterval");
32
34 auto const param_name = config.getConfigParameter<std::string>("parameter");
35 DBUG("Using parameter {:s}", param_name);
36
37 auto& param = ParameterLib::findParameter<double>(param_name, parameters, 1,
38 &bc_mesh);
39
41 config.peekConfigParameter<std::string>("time_interval");
42 auto time_interval = BaseLib::createTimeInterval(config);
43
44// In case of partitioned mesh the boundary could be empty, i.e. there is no
45// 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 return std::make_unique<DirichletBoundaryConditionWithinTimeInterval>(
59 std::move(time_interval), param, bc_mesh, dof_table_bulk, variable_id,
60 component_id);
61}
TimeInterval createTimeInterval(ConfigTree const &config)

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

Referenced by createBoundaryCondition().

◆ createForwardDifferencesJacobianAssembler()

std::unique_ptr< AbstractJacobianAssembler > ProcessLib::createForwardDifferencesJacobianAssembler ( BaseLib::ConfigTree const & config)
Input File Parameter
prj__processes__process__jacobian_assembler__type
Input File Parameter
prj__processes__process__jacobian_assembler__ForwardDifferences__relative_epsilons
Input File Parameter
prj__processes__process__jacobian_assembler__ForwardDifferences__component_magnitudes

Definition at line 19 of file CreateForwardDifferencesJacobianAssembler.cpp.

20{
22 config.checkConfigParameter("type", "ForwardDifferences");
23
24 // TODO make non-optional.
26 auto rel_eps = config.getConfigParameterOptional<std::vector<double>>(
27 "relative_epsilons");
29 auto comp_mag = config.getConfigParameterOptional<std::vector<double>>(
30 "component_magnitudes");
31
32 if (rel_eps.has_value() != comp_mag.has_value())
33 {
35 "Either both or none of <relative_epsilons> and "
36 "<component_magnitudes> have to be specified.");
37 }
38
39 std::vector<double> abs_eps;
40
41 if (rel_eps)
42 {
43 if (rel_eps->size() != comp_mag->size())
44 {
46 "The numbers of components of <relative_epsilons> and "
47 "<component_magnitudes> do not match.");
48 }
49
50 abs_eps.resize(rel_eps->size());
51 for (std::size_t i = 0; i < rel_eps->size(); ++i)
52 {
53 abs_eps[i] = (*rel_eps)[i] * (*comp_mag)[i];
54 }
55 }
56 else
57 {
58 // By default 1e-8 is used as epsilon for all components.
59 // TODO: remove this default value.
60 abs_eps.emplace_back(1e-8);
61 }
62
63 return std::make_unique<ForwardDifferencesJacobianAssembler>(
64 std::move(abs_eps));
65}

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

Referenced by createJacobianAssembler().

◆ createHCNonAdvectiveFreeComponentFlowBoundaryCondition()

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

Definition at line 19 of file HCNonAdvectiveFreeComponentFlowBoundaryCondition.cpp.

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

References MeshLib::Cell, BaseLib::ConfigTree::checkConfigParameter(), DBUG(), MeshLib::Face, MeshLib::getBulkIDString(), BaseLib::ConfigTree::getConfigParameter(), 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 25 of file CreateInitialStress.cpp.

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

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

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

24{
25 if (!config)
26 {
27 return std::make_unique<AnalyticalJacobianAssembler>();
28 }
29
31 auto const type = config->peekConfigParameter<std::string>("type");
32
33 if (type == "Analytical")
34 {
35 config->ignoreConfigParameter("type");
36 return std::make_unique<AnalyticalJacobianAssembler>();
37 }
38 if (type == "CentralDifferences")
39 {
41 }
42 if (type == "CompareJacobians")
43 {
45 }
46 if (type == "ForwardDifferences")
47 {
49 }
50
51 OGS_FATAL("Unknown Jacobian assembler type: `{:s}'.", type);
52}
std::unique_ptr< CompareJacobiansJacobianAssembler > createCompareJacobiansJacobianAssembler(BaseLib::ConfigTree const &config)
std::unique_ptr< AbstractJacobianAssembler > createForwardDifferencesJacobianAssembler(BaseLib::ConfigTree const &config)
std::unique_ptr< CentralDifferencesJacobianAssembler > 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 74 of file CreateLocalAssemblers.h.

81{
82 DBUG("Create local assemblers.");
83
84 switch (dimension)
85 {
86 case 1:
87 createLocalAssemblers<1, LocalAssemblerImplementation>(
88 mesh_elements, dof_table, local_assemblers, provider_or_order,
89 std::forward<ExtraCtorArgs>(extra_ctor_args)...);
90 break;
91 case 2:
92 createLocalAssemblers<2, LocalAssemblerImplementation>(
93 mesh_elements, dof_table, local_assemblers, provider_or_order,
94 std::forward<ExtraCtorArgs>(extra_ctor_args)...);
95 break;
96 case 3:
97 createLocalAssemblers<3, LocalAssemblerImplementation>(
98 mesh_elements, dof_table, local_assemblers, provider_or_order,
99 std::forward<ExtraCtorArgs>(extra_ctor_args)...);
100 break;
101 default:
102 OGS_FATAL(
103 "Meshes with dimension greater than three are not supported.");
104 }
105}

References 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 27 of file CreateLocalAssemblers.h.

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

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

◆ 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 )

◆ 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 106 of file CreateLocalAssemblersTaylorHood.h.

112{
113 detail::createLocalAssemblersTaylorHood<
114 LocalAssemblerFactoryStokes, GlobalDim, LocalAssemblerImplementation,
116 mesh_elements, dof_table, local_assemblers, provider_or_order,
117 std::forward<ExtraCtorArgs>(extra_ctor_args)...);
118}

◆ createNeumannBoundaryCondition()

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

Definition at line 17 of file NeumannBoundaryCondition.cpp.

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

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

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

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

References BaseLib::ConfigTree::checkConfigParameter(), DBUG(), 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 102 of file CreateOutput.cpp.

106{
107 std::vector<Output> outputs;
108 auto oc = createOutputConfig(config, meshes);
109 outputs.push_back(createOutput(std::move(oc), output_directory, meshes));
110 return outputs;
111}
OutputConfig createOutputConfig(const BaseLib::ConfigTree &config, std::vector< std::unique_ptr< MeshLib::Mesh > > &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 85 of file CreateOutput.cpp.

87{
88 auto output_format = createOutputFormat(
89 output_directory, oc.output_type, std::move(oc.prefix),
90 std::move(oc.suffix), oc.data_mode, oc.compress_output,
92
93 OutputDataSpecification output_data_specification{
94 std::move(oc.output_variables), std::move(oc.fixed_output_times),
96
97 return {std::move(output_format), oc.output_iteration_results,
98 std::move(output_data_specification),
99 std::move(oc.mesh_names_for_output), meshes};
100}
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__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 74 of file CreateOutputConfig.cpp.

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

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, 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 61 of file CreateOutput.cpp.

66{
67 switch (output_type)
68 {
69 case OutputType::vtk:
70 return std::make_unique<OutputVTKFormat>(
71 output_directory, std::move(prefix), std::move(suffix),
72 compress_output, convertVtkDataMode(data_mode));
73 case OutputType::xdmf:
74 return std::make_unique<OutputXDMFHDF5Format>(
75 output_directory, std::move(prefix), std::move(suffix),
76 compress_output, number_of_files, chunk_size_bytes);
77 default:
79 "No supported file type provided. Read '{}' from "
80 "<output><type> in prj file. Supported: VTK, XDMF.",
81 BaseLib::to_underlying(output_type));
82 }
83}
constexpr auto to_underlying(E e) noexcept
Converts an enumeration to its underlying type.
Definition cpp23.h:29
int convertVtkDataMode(std::string_view const &data_mode)

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 113 of file CreateOutput.cpp.

117{
118 DBUG("Parse outputs configuration:");
119 std::vector<Output> outputs;
120 for (auto const& output_config :
122 output_configs.getConfigSubtreeList("output"))
123 {
124 auto oc = createOutputConfig(output_config, meshes);
125 outputs.push_back(
126 createOutput(std::move(oc), output_directory, meshes));
127 }
128 if (areOutputNamesUnique(outputs))
129 {
130 return outputs;
131 }
132 else
133 {
134 OGS_FATAL(
135 "Output configuration paths are not unique. This will lead to "
136 "overwritten results or invalid / corrupted data within the "
137 "files.");
138 }
139}
bool areOutputNamesUnique(std::vector< ProcessLib::Output > const &outputs)

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 70 of file CreateProcessData.cpp.

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

Definition at line 74 of file PhaseFieldIrreversibleDamageOracleBoundaryCondition.cpp.

78{
79 DBUG(
80 "Constructing PhaseFieldIrreversibleDamageOracleBoundaryCondition from "
81 "config.");
83 config.checkConfigParameter(
84 "type", "PhaseFieldIrreversibleDamageOracleBoundaryCondition");
85
86 return std::make_unique<
88 dof_table, mesh, variable_id, component_id);
89}

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

Referenced by createBoundaryCondition().

◆ createPrimaryVariableConstraintDirichletBoundaryCondition()

std::unique_ptr< PrimaryVariableConstraintDirichletBoundaryCondition > ProcessLib::createPrimaryVariableConstraintDirichletBoundaryCondition ( BaseLib::ConfigTree const & config,
MeshLib::Mesh const & bc_mesh,
NumLib::LocalToGlobalIndexMap const & dof_table_bulk,
int const variable_id,
int const component_id,
const std::vector< std::unique_ptr< ParameterLib::ParameterBase > > & parameters )
Input File Parameter
prj__process_variables__process_variable__boundary_conditions__boundary_condition__type
Input File Parameter
prj__process_variables__process_variable__boundary_conditions__boundary_condition__PrimaryVariableConstraintDirichletBoundaryCondition__parameter
Input File Parameter
prj__process_variables__process_variable__boundary_conditions__boundary_condition__PrimaryVariableConstraintDirichletBoundaryCondition__threshold_parameter
Input File Parameter
prj__process_variables__process_variable__boundary_conditions__boundary_condition__PrimaryVariableConstraintDirichletBoundaryCondition__comparison_operator

Definition at line 107 of file PrimaryVariableConstraintDirichletBoundaryCondition.cpp.

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

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

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 143 of file ProcessOutputData.cpp.

146{
147 auto bulk_mesh_dof_tables =
148 getDofTablesOfAllProcesses(process, n_processes);
149
150 auto [output_mesh_dof_tables, container_that_owns_output_mesh_dof_tables] =
151 computeOutputMeshDofTables(process, output_mesh, bulk_mesh_dof_tables);
152
153 return {getProcessVariablesOfAllProcesses(process, n_processes),
154 process.getSecondaryVariables(),
155 ::getIntegrationPointWriters(process, output_mesh),
156 std::move(bulk_mesh_dof_tables),
157 std::move(output_mesh_dof_tables),
158 std::move(container_that_owns_output_mesh_dof_tables),
159 output_mesh};
160}
std::vector< std::reference_wrapper< const std::vector< std::reference_wrapper< ProcessLib::ProcessVariable > > > > getProcessVariablesOfAllProcesses(ProcessLib::Process const &process, std::size_t const n_processes)
decltype(auto) computeOutputMeshDofTables(ProcessLib::Process const &process, MeshLib::Mesh const &output_mesh, std::vector< NumLib::LocalToGlobalIndexMap const * > const &bulk_mesh_dof_tables)
std::vector< std::unique_ptr< MeshLib::IntegrationPointWriter > > const * getIntegrationPointWriters(ProcessLib::Process const &process, MeshLib::Mesh const &output_mesh)
std::vector< NumLib::LocalToGlobalIndexMap const * > getDofTablesOfAllProcesses(ProcessLib::Process const &process, std::size_t const n_processes)

References ProcessLib::Process::getSecondaryVariables().

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

◆ createPythonBoundaryCondition()

std::unique_ptr< PythonBoundaryCondition > ProcessLib::createPythonBoundaryCondition ( BaseLib::ConfigTree 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.

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

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

Referenced by createBoundaryCondition().

◆ 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 23 of file CreatePythonSourceTerm.cpp.

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

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

Referenced by createSourceTerm().

◆ createRobinBoundaryCondition()

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

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

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

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

Input File Parameter
prj__process_variables__process_variable__boundary_conditions__boundary_condition__type
Input File Parameter
prj__process_variables__process_variable__boundary_conditions__boundary_condition__Robin__alpha
Input File Parameter
prj__process_variables__process_variable__boundary_conditions__boundary_condition__Robin__u_0
Input File Parameter
prj__process_variables__process_variable__boundary_conditions__boundary_condition__Robin__area_parameter

Definition at line 17 of file RobinBoundaryCondition.cpp.

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

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

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__internal_name
Input File Parameter
prj__processes__process__secondary_variables__secondary_variable__output_name

Definition at line 18 of file CreateSecondaryVariables.cpp.

20{
21 auto sec_vars_config =
23 config.getConfigSubtreeOptional("secondary_variables");
24 if (!sec_vars_config)
25 {
26 return;
27 }
28
29 for (
30 auto sec_var_config :
32 sec_vars_config->getConfigSubtreeList("secondary_variable"))
33 {
34 auto const type =
36 sec_var_config.getConfigAttributeOptional<std::string>("type");
37 if (type)
38 {
39 WARN(
40 "Secondary variable type specification is deprecated and is "
41 "ignored. All secondary variable types are 'static'.");
42 }
43
44 auto const internal_name =
46 sec_var_config.getConfigAttribute<std::string>("internal_name");
47 auto const output_name =
49 sec_var_config.getConfigAttribute<std::string>("output_name");
50
51 secondary_variables.addNameMapping(internal_name, output_name);
52 }
53}
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::HT::createHTProcess(), ProcessLib::LIE::HydroMechanics::createHydroMechanicsProcess(), ProcessLib::HydroMechanics::createHydroMechanicsProcess(), ProcessLib::LargeDeformation::createLargeDeformationProcess(), ProcessLib::LiquidFlow::createLiquidFlowProcess(), ProcessLib::PhaseField::createPhaseFieldProcess(), ProcessLib::RichardsComponentTransport::createRichardsComponentTransportProcess(), ProcessLib::RichardsFlow::createRichardsFlowProcess(), ProcessLib::RichardsMechanics::createRichardsMechanicsProcess(), ProcessLib::SmallDeformationNonlocal::createSmallDeformationNonlocalProcess(), ProcessLib::LIE::SmallDeformation::createSmallDeformationProcess(), ProcessLib::SmallDeformation::createSmallDeformationProcess(), ProcessLib::SteadyStateDiffusion::createSteadyStateDiffusion(), ProcessLib::StokesFlow::createStokesFlowProcess(), ProcessLib::TES::createTESProcess(), ProcessLib::TH2M::createTH2MProcess(), ProcessLib::ThermalTwoPhaseFlowWithPP::createThermalTwoPhaseFlowWithPPProcess(), ProcessLib::ThermoHydroMechanics::createThermoHydroMechanicsProcess(), ProcessLib::ThermoMechanicalPhaseField::createThermoMechanicalPhaseFieldProcess(), ProcessLib::ThermoMechanics::createThermoMechanicsProcess(), ProcessLib::ThermoRichardsFlow::createThermoRichardsFlowProcess(), ProcessLib::ThermoRichardsMechanics::createThermoRichardsMechanicsProcessStage2(), ProcessLib::TwoPhaseFlowWithPP::createTwoPhaseFlowWithPPProcess(), and ProcessLib::TwoPhaseFlowWithPrho::createTwoPhaseFlowWithPrhoProcess().

◆ createSolutionDependentDirichletBoundaryCondition()

std::unique_ptr< SolutionDependentDirichletBoundaryCondition > ProcessLib::createSolutionDependentDirichletBoundaryCondition ( BaseLib::ConfigTree 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 )
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 100 of file SolutionDependentDirichletBoundaryCondition.cpp.

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

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

Referenced by createBoundaryCondition().

◆ createSourceTerm()

std::unique_ptr< SourceTerm > ProcessLib::createSourceTerm ( const SourceTermConfig & config,
const NumLib::LocalToGlobalIndexMap & dof_table_bulk,
const MeshLib::Mesh & source_term_mesh,
const int variable_id,
const unsigned integration_order,
const unsigned shapefunction_order,
std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const & parameters,
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

Definition at line 21 of file CreateSourceTerm.cpp.

29{
31 auto const type = config.config.peekConfigParameter<std::string>("type");
32
33 // check basic data consistency
34 if (variable_id >=
35 static_cast<int>(dof_table_bulk.getNumberOfVariables()) ||
36 config.component_id >=
37 dof_table_bulk.getNumberOfVariableComponents(variable_id))
38 {
40 "Variable id or component id too high. Actual values: ({:d}, "
41 "{:d}), maximum values: ({:d}, {:d}).",
42 variable_id, config.component_id,
43 dof_table_bulk.getNumberOfVariables(),
44 dof_table_bulk.getNumberOfVariableComponents(variable_id));
45 }
46
47 if (!source_term_mesh.getProperties()
48 .template existsPropertyVector<std::size_t>(
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
79 if (type == "Line" || type == "Volumetric")
80 {
81 auto dof_table_source_term =
82 dof_table_bulk.deriveBoundaryConstrainedMap(
83 variable_id, {config.component_id},
84 std::move(source_term_mesh_subset));
85 auto const& bulk_mesh_dimension =
86 dof_table_bulk.getMeshSubset(variable_id, config.component_id)
87 .getMesh()
88 .getDimension();
90 config.config, bulk_mesh_dimension, config.mesh,
91 std::move(dof_table_source_term), parameters, integration_order,
92 shapefunction_order);
93 }
94
95 if (type == "Python")
96 {
97 auto dof_table_source_term =
98 dof_table_bulk.deriveBoundaryConstrainedMap(
99 std::move(source_term_mesh_subset));
100
102 config.config, config.mesh, std::move(dof_table_source_term),
103 variable_id, config.component_id, integration_order,
104 shapefunction_order, source_term_mesh.getDimension(),
105 all_process_variables_for_this_process);
106 }
107
108 OGS_FATAL("Unknown source term type: `{:s}'.", type);
109}
A subset of nodes on a single mesh.
Definition MeshSubset.h:26
Mesh const & getMesh() const
Definition MeshSubset.h:92
std::vector< Node * > const & getNodes() const
Get the nodes-vector for the mesh.
Definition Mesh.h:106
std::size_t getID() const
Get id of the mesh.
Definition Mesh.h:121
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)
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)
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, 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 205 of file SubmeshResiduumOutputConfig.cpp.

208{
209 auto oc = createOutputConfig(config, meshes);
210
211 if (oc.mesh_names_for_output.empty())
212 {
213 OGS_FATAL(
214 "You did not specify any meshes for submesh residuum output.");
215 }
216
217 if (!areElementsUnique(oc.mesh_names_for_output))
218 {
219 OGS_FATAL("The mesh names for submesh residuum output are not unique.");
220 }
221
222 auto const meshes_filtered =
223 filterMeshesForResiduumOutput(meshes, oc.mesh_names_for_output);
224
225 for (auto const& mesh : meshes_filtered)
226 {
227 checkBulkIDMappingsPresent(mesh.get());
228 }
229
230 auto const& bulk_mesh =
231 *meshes.front(); // convention: the first mesh is the bulk mesh
232 checkNonOverlappingCover(bulk_mesh, meshes_filtered);
233
234 return {createOutput(std::move(oc), output_directory, meshes),
235 std::move(meshes_filtered)};
236}
std::unique_ptr< Output > createOutput(ChemicalSystem const &chemical_system, std::unique_ptr< UserPunch > const &user_punch, bool const use_high_precision, std::string const &project_file_name)
bool areElementsUnique(std::vector< std::string > const &strings)
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().

◆ 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 28 of file CreateTimeLoop.cpp.

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

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

Referenced by ProjectData::parseTimeLoop().

◆ createVariableDependentNeumannBoundaryCondition()

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

Definition at line 18 of file VariableDependentNeumannBoundaryCondition.cpp.

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

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

Referenced by createBoundaryCondition().

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

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

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

Referenced by createSourceTerm().

◆ extractElementsAlongOuterNodes()

static 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 69 of file CreateDeactivatedSubdomain.cpp.

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

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

Referenced by createDeactivatedSubdomainMesh().

◆ extractInnerAndOuterNodes()

template<typename IsActive >
static 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 32 of file CreateDeactivatedSubdomain.cpp.

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

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

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

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

62{
63 std::vector<std::reference_wrapper<ProcessVariable>> vars;
64 vars.reserve(variables.size());
65
66 if (variables.size() > tags.size())
67 DBUG("Found multiple process variables with a same tag.");
68
69 for (auto const& tag : tags)
70 {
71 auto vars_per_tag = findProcessVariables(variables, pv_config, tag);
72 vars.insert(vars.end(), vars_per_tag.begin(), vars_per_tag.end());
73 }
74
75 return vars;
76}
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::HT::createHTProcess(), ProcessLib::HydroMechanics::createHydroMechanicsProcess(), ProcessLib::LargeDeformation::createLargeDeformationProcess(), ProcessLib::LiquidFlow::createLiquidFlowProcess(), ProcessLib::PhaseField::createPhaseFieldProcess(), ProcessLib::RichardsComponentTransport::createRichardsComponentTransportProcess(), ProcessLib::RichardsFlow::createRichardsFlowProcess(), ProcessLib::RichardsMechanics::createRichardsMechanicsProcess(), ProcessLib::SmallDeformationNonlocal::createSmallDeformationNonlocalProcess(), ProcessLib::SmallDeformation::createSmallDeformationProcess(), ProcessLib::SteadyStateDiffusion::createSteadyStateDiffusion(), ProcessLib::StokesFlow::createStokesFlowProcess(), ProcessLib::TES::createTESProcess(), ProcessLib::TH2M::createTH2MProcess(), ProcessLib::ThermalTwoPhaseFlowWithPP::createThermalTwoPhaseFlowWithPPProcess(), ProcessLib::ThermoHydroMechanics::createThermoHydroMechanicsProcess(), ProcessLib::ThermoMechanicalPhaseField::createThermoMechanicalPhaseFieldProcess(), ProcessLib::ThermoMechanics::createThermoMechanicsProcess(), ProcessLib::ThermoRichardsFlow::createThermoRichardsFlowProcess(), ProcessLib::ThermoRichardsMechanics::createThermoRichardsMechanicsProcessStage2(), ProcessLib::TwoPhaseFlowWithPP::createTwoPhaseFlowWithPPProcess(), ProcessLib::TwoPhaseFlowWithPrho::createTwoPhaseFlowWithPrhoProcess(), 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 78 of file ProcessUtils.cpp.

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

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

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

Referenced by ProcessLib::VectorMatrixAssembler::assemble(), ProcessLib::VectorMatrixAssembler::assembleWithJacobian(), ProcessLib::PhaseField::PhaseFieldLocalAssembler< ShapeFunction, DisplacementDim >::computeCrackIntegral(), 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 113 of file DirichletBoundaryConditionAuxiliaryFunctions.cpp.

119{
121 parameter, bc_mesh,
122 bc_mesh.getNodes() | MeshLib::views::ids | ranges::to<std::vector>,
123 dof_table_boundary, variable_id, component_id, t, x, bc_values);
124}
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 69 of file DirichletBoundaryConditionAuxiliaryFunctions.cpp.

77{
79
80 bc_values.ids.clear();
81 bc_values.values.clear();
82
83 // convert mesh node ids to global index for the given component
84 bc_values.ids.reserve(nodes_in_bc_mesh.size());
85 bc_values.values.reserve(nodes_in_bc_mesh.size());
86 for (auto const node_id : nodes_in_bc_mesh)
87 {
88 // TODO: that might be slow, but only done once
89 auto const global_index = dof_table_boundary.getGlobalIndex(
90 {bc_mesh.getID(), MeshLib::MeshItemType::Node, node_id},
91 variable_id, component_id);
92 if (global_index == NumLib::MeshComponentMap::nop)
93 {
94 continue;
95 }
96 // For the DDC approach (e.g. with PETSc option), the negative
97 // index of global_index means that the entry by that index is a ghost
98 // one, which should be dropped. Especially for PETSc routines
99 // MatZeroRows and MatZeroRowsColumns, which are called to apply the
100 // Dirichlet BC, the negative index is not accepted like other matrix or
101 // vector PETSc routines. Therefore, the following if-condition is
102 // applied.
103 if (global_index >= 0)
104 {
105 pos.setNodeID(node_id);
106 pos.setCoordinates(*bc_mesh.getNode(node_id));
107 bc_values.ids.emplace_back(global_index);
108 bc_values.values.emplace_back(parameter(t, pos).front());
109 }
110 }
111}
static constexpr NUMLIB_EXPORT GlobalIndexType const nop
void setNodeID(std::size_t node_id)
void setCoordinates(MathLib::Point3d const &coordinates)
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 39 of file SetOrGetIntegrationPointData.h.

42{
43 using AccessorResult = decltype(std::declval<Accessor>()(
44 std::declval<IntegrationPointDataVector>()[0]));
45 static_assert(std::is_lvalue_reference_v<AccessorResult>,
46 "The ip data accessor should return a reference. This check "
47 "prevents accidental copies.");
48
49 auto const n_integration_points = ip_data_vector.size();
50 constexpr int size = DisplacementDim * DisplacementDim;
51
52 cache.clear();
53 auto cache_mat = MathLib::createZeroedMatrix<
54 Eigen::Matrix<double, size, Eigen::Dynamic, Eigen::RowMajor>>(
55 cache, size, n_integration_points);
56
57 for (unsigned ip = 0; ip < n_integration_points; ++ip)
58 {
59 auto const& dim_matix = accessor(ip_data_vector[ip]);
60 cache_mat.col(ip) = dim_matix.template reshaped<Eigen::RowMajor>();
61 }
62
63 return cache;
64}
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 26 of file SetOrGetIntegrationPointData.h.

29{
30 return getIntegrationPointDimMatrixData<DisplacementDim>(
31 ip_data_vector,
32 [member](IpData const& ip_data) -> auto const&
33 { return ip_data.*member; },
34 cache);
35}

◆ 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 81 of file SetOrGetIntegrationPointData.h.

84{
85 using AccessorResult = decltype(std::declval<Accessor>()(
86 std::declval<IntegrationPointDataVector>()[0]));
87 static_assert(std::is_lvalue_reference_v<AccessorResult>,
88 "The ip data accessor should return a reference. This check "
89 "prevents accidental copies.");
90
91 constexpr int kelvin_vector_size =
93 auto const n_integration_points = ip_data_vector.size();
94
95 cache.clear();
96 auto cache_mat = MathLib::createZeroedMatrix<Eigen::Matrix<
97 double, kelvin_vector_size, Eigen::Dynamic, Eigen::RowMajor>>(
98 cache, kelvin_vector_size, n_integration_points);
99
100 for (unsigned ip = 0; ip < n_integration_points; ++ip)
101 {
102 auto const& kelvin_vector = accessor(ip_data_vector[ip]);
103 cache_mat.col(ip) =
105 }
106
107 return cache;
108}
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 68 of file SetOrGetIntegrationPointData.h.

71{
72 return getIntegrationPointKelvinVectorData<DisplacementDim>(
73 ip_data_vector,
74 [member](IpData const& ip_data) -> auto const&
75 { return ip_data.*member; },
76 cache);
77}

◆ 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 116 of file SetOrGetIntegrationPointData.h.

118{
119 constexpr int kelvin_vector_size =
121
122 return transposeInPlace<kelvin_vector_size>(
123 [&](std::vector<double>& values)
124 {
125 return getIntegrationPointKelvinVectorData<DisplacementDim>(
126 ip_data_vector, member, values);
127 ;
128 });
129}

References MathLib::KelvinVector::kelvin_vector_dimensions().

◆ 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 188 of file SetOrGetIntegrationPointData.h.

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

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 176 of file SetOrGetIntegrationPointData.h.

179{
181 ip_data_vector,
182 [member](IpData const& ip_data) -> auto const&
183 { return ip_data.*member; },
184 cache);
185}
std::vector< double > const & getIntegrationPointScalarData(IntegrationPointDataVector const &ip_data_vector, MemberType IpData::*const member, std::vector< double > &cache)

References getIntegrationPointScalarData().

Referenced by getIntegrationPointScalarData(), ProcessLib::SmallDeformationNonlocal::SmallDeformationNonlocalLocalAssembler< ShapeFunction, DisplacementDim >::getIntPtDamage(), ProcessLib::RichardsMechanics::RichardsMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::getIntPtDryDensitySolid(), ProcessLib::ThermoRichardsFlow::ThermoRichardsFlowLocalAssembler< ShapeFunction, GlobalDim >::getIntPtDryDensitySolid(), ProcessLib::TH2M::TH2MLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::getIntPtEnthalpyGas(), ProcessLib::TH2M::TH2MLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::getIntPtEnthalpyLiquid(), ProcessLib::TH2M::TH2MLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::getIntPtEnthalpySolid(), ProcessLib::ThermoHydroMechanics::ThermoHydroMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::getIntPtFluidDensity(), ProcessLib::LIE::HydroMechanics::HydroMechanicsLocalAssemblerFracture< ShapeFunctionDisplacement, ShapeFunctionPressure, GlobalDim >::getIntPtFractureAperture(), ProcessLib::LIE::SmallDeformation::SmallDeformationLocalAssemblerFracture< ShapeFunction, DisplacementDim >::getIntPtFractureAperture(), ProcessLib::LIE::HydroMechanics::HydroMechanicsLocalAssemblerFracture< ShapeFunctionDisplacement, ShapeFunctionPressure, GlobalDim >::getIntPtFracturePermeability(), ProcessLib::TH2M::TH2MLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::getIntPtGasDensity(), ProcessLib::ThermoHydroMechanics::ThermoHydroMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::getIntPtIceVolume(), ProcessLib::TH2M::TH2MLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::getIntPtLiquidDensity(), ProcessLib::TH2M::TH2MLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::getIntPtMassFractionGas(), ProcessLib::TH2M::TH2MLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::getIntPtMassFractionLiquid(), ProcessLib::RichardsMechanics::RichardsMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::getIntPtMicroPressure(), ProcessLib::RichardsMechanics::RichardsMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::getIntPtMicroSaturation(), ProcessLib::TH2M::TH2MLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::getIntPtMoleFractionGas(), ProcessLib::RichardsMechanics::RichardsMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::getIntPtPorosity(), ProcessLib::ThermoRichardsFlow::ThermoRichardsFlowLocalAssembler< ShapeFunction, GlobalDim >::getIntPtPorosity(), ProcessLib::TH2M::TH2MLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::getIntPtPorosity(), ProcessLib::TH2M::TH2MLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::getIntPtRelativePermeabilityGas(), ProcessLib::TH2M::TH2MLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::getIntPtRelativePermeabilityLiquid(), ProcessLib::RichardsMechanics::RichardsMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::getIntPtSaturation(), ProcessLib::ThermoRichardsFlow::ThermoRichardsFlowLocalAssembler< ShapeFunction, GlobalDim >::getIntPtSaturation(), ProcessLib::TH2M::TH2MLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::getIntPtSolidDensity(), ProcessLib::RichardsMechanics::RichardsMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::getIntPtTransportPorosity(), ProcessLib::TH2M::TH2MLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::getIntPtVapourPressure(), and ProcessLib::ThermoHydroMechanics::ThermoHydroMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::getIntPtViscosity().

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

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

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::HT::HTProcess::initializeConcreteProcess(), ProcessLib::HydroMechanics::HydroMechanicsProcess< DisplacementDim >::initializeConcreteProcess(), ProcessLib::LargeDeformation::LargeDeformationProcess< DisplacementDim >::initializeConcreteProcess(), ProcessLib::LIE::HydroMechanics::HydroMechanicsProcess< GlobalDim >::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::SmallDeformationNonlocal::SmallDeformationNonlocalProcess< DisplacementDim >::initializeConcreteProcess(), ProcessLib::SteadyStateDiffusion::SteadyStateDiffusion::initializeConcreteProcess(), ProcessLib::TH2M::TH2MProcess< DisplacementDim >::initializeConcreteProcess(), ProcessLib::ThermalTwoPhaseFlowWithPP::ThermalTwoPhaseFlowWithPPProcess::initializeConcreteProcess(), ProcessLib::ThermoHydroMechanics::ThermoHydroMechanicsProcess< DisplacementDim >::initializeConcreteProcess(), ProcessLib::ThermoMechanicalPhaseField::ThermoMechanicalPhaseFieldProcess< DisplacementDim >::initializeConcreteProcess(), ProcessLib::ThermoMechanics::ThermoMechanicsProcess< DisplacementDim >::initializeConcreteProcess(), ProcessLib::ThermoRichardsFlow::ThermoRichardsFlowProcess::initializeConcreteProcess(), ProcessLib::ThermoRichardsMechanics::ThermoRichardsMechanicsProcess< DisplacementDim, ConstitutiveTraits >::initializeConcreteProcess(), ProcessLib::TwoPhaseFlowWithPP::TwoPhaseFlowWithPPProcess::initializeConcreteProcess(), ProcessLib::TwoPhaseFlowWithPrho::TwoPhaseFlowWithPrhoProcess::initializeConcreteProcess(), ProcessLib::TES::TESProcess::initializeSecondaryVariables(), 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 213 of file SecondaryVariable.h.

218{
219 using LocalAssemblerInterface = std::remove_cvref_t<
220 decltype(*std::declval<LocalAssemblerCollection>()[0])>;
221 static_assert(std::is_invocable_r_v<std::vector<double>, IPDataAccessor,
223
224 if (num_components == 1)
225 {
226 auto method_wrapped =
227 [accessor](
228 LocalAssemblerInterface const& loc_asm, const double /*t*/,
229 std::vector<GlobalVector*> const& /*x*/,
230 std::vector<
231 NumLib::LocalToGlobalIndexMap const*> const& /*dof_table*/,
232 std::vector<double>& cache) -> std::vector<double> const&
233 {
234 cache = accessor(loc_asm);
235 return cache;
236 };
237
238 return makeExtrapolator(num_components, extrapolator, local_assemblers,
239 method_wrapped);
240 }
241
242 auto method_wrapped =
243 [accessor, num_components](
244 LocalAssemblerInterface const& loc_asm, const double /*t*/,
245 std::vector<GlobalVector*> const& /*x*/,
246 std::vector<
247 NumLib::LocalToGlobalIndexMap const*> const& /*dof_table*/,
248 std::vector<double>& cache) -> std::vector<double> const&
249 {
250 cache = accessor(loc_asm);
251 transposeInPlace(cache, cache.size() / num_components);
252 return cache;
253 };
254
255 return makeExtrapolator(num_components, extrapolator, local_assemblers,
256 method_wrapped);
257}
std::vector< double > transposeInPlace(StoreValuesFunction const &store_values_function)
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()

static 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 24 of file CreateProcessData.cpp.

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

References OGS_FATAL.

Referenced by createPerProcessData().

◆ operator<<() [1/4]

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

Definition at line 446 of file Output.cpp.

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

◆ operator<<() [2/4]

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

Definition at line 90 of file OutputDataSpecification.cpp.

91{
92 os << "OuputDataSpecification" << std::endl;
93 os << "\toutput_variables: ";
94 std::copy(o.output_variables.begin(), o.output_variables.end(),
95 std::ostream_iterator<std::string>(os, " "));
96 os << "\n";
97 os << "\tfixed_output_times: ";
98 std::copy(o.fixed_output_times.begin(), o.fixed_output_times.end(),
99 std::ostream_iterator<double>(os, " "));
100 os << "\n";
101 os << "\trepeats_each_steps: ";
102 std::copy(o.repeats_each_steps.begin(), o.repeats_each_steps.end(),
103 std::ostream_iterator<PairRepeatEachSteps>(os, " "));
104 os << "\n";
105 os << "\toutput_residual: " << o.output_residuals << "\n";
106 return os;
107}

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 50 of file OutputFormat.h.

51{
52 os << "OutputFormat::directory:" << of.directory << std::endl;
53 os << "OutputFormat::prefix:" << of.prefix << std::endl;
54 os << "OutputFormat::suffix:" << of.suffix << std::endl;
55 os << "OutputFormat::compression:" << of.compression << std::endl;
56 return os;
57}

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 83 of file OutputDataSpecification.cpp.

84{
85 os << "Output " << pair.repeat << " times every " << pair.each_steps
86 << " timestep.\n";
87 return os;
88}

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 )

Definition at line 57 of file OutputFormat.cpp.

60{
61 auto const name =
62 output_file.constructFilename(mesh.getName(), timestep, t, iteration);
63 pvd_file.addVTUFile(name, t);
64
65 auto const path = BaseLib::joinPaths(output_file.directory, name);
66 // Output of NaN's triggers floating point exceptions. Because we are not
67 // debugging VTK (or other libraries) at this point, the possibly set
68 // exceptions are temporarily disabled and are restored at the end of the
69 // function.
70 [[maybe_unused]] DisableFPE disable_fpe;
71 outputMeshVtk(path, mesh, output_file.compression, output_file.data_mode);
72}
void addVTUFile(std::string const &vtu_fname, double timestep)
Add a VTU file to this PVD file.
Definition PVDFile.cpp:28
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 48 of file OutputFormat.cpp.

50{
51 DBUG("Writing output to '{:s}'.", file_name);
52
53 MeshLib::IO::VtuInterface vtu_interface(&mesh, data_mode, compress_output);
54 vtu_interface.writeToFile(file_name);
55}
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().

◆ parseLineSegment()

static 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 184 of file CreateDeactivatedSubdomain.cpp.

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

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

Referenced by createDeactivatedSubdomain().

◆ parseTimeIntervalOrCurve()

static 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 131 of file CreateDeactivatedSubdomain.cpp.

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

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

Referenced by createDeactivatedSubdomain().

◆ postTimestepForAllProcesses()

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

Definition at line 91 of file TimeLoop.cpp.

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

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

◆ preTimestepForAllProcesses()

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

Definition at line 78 of file TimeLoop.cpp.

82{
83 for (auto& process_data : per_process_data)
84 {
85 auto const process_id = process_data->process_id;
86 auto& pcs = process_data->process;
87 pcs.preTimestep(_process_solutions, t, dt, process_id);
88 }
89}

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 49 of file PythonBoundaryConditionModule.cpp.

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

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 22 of file SetIPDataInitialConditions.h.

23{
24 if (!name.ends_with("_ip"))
25 {
27 "The name of integration point data must end with '_ip'. '{}' "
28 "does not.",
29 name);
30 }
31
32 return {name.data(), name.size() - 3};
33}

References OGS_FATAL.

Referenced by setIPDataInitialConditions().

◆ setEquationSystem()

void ProcessLib::setEquationSystem ( ProcessData const & process_data)

Definition at line 17 of file ProcessData.cpp.

18{
19 auto& conv_crit = *process_data.conv_crit;
20 auto& nonlinear_solver = process_data.nonlinear_solver;
21
23 switch (process_data.nonlinear_solver_tag)
24 {
25 case Tag::Picard:
26 {
28 auto& eq_sys_ = static_cast<EqSys&>(*process_data.tdisc_ode_sys);
29 if (auto* nl_solver =
31 &nonlinear_solver);
32 nl_solver != nullptr)
33 {
34 nl_solver->setEquationSystem(eq_sys_, conv_crit);
35 }
36 else
37 {
39 "Could not cast nonlinear solver to Picard type solver.");
40 }
41 break;
42 }
43 case Tag::Newton:
44 {
46 auto& eq_sys_ = static_cast<EqSys&>(*process_data.tdisc_ode_sys);
47
48 if (auto* nl_solver =
50 &nonlinear_solver);
51 nl_solver != nullptr)
52 {
53 nl_solver->setEquationSystem(eq_sys_, conv_crit);
54 }
55#ifdef USE_PETSC
56 else if (auto* nl_solver =
57 dynamic_cast<NumLib::PETScNonlinearSolver*>(
58 &nonlinear_solver);
59 nl_solver != nullptr)
60 {
61 nl_solver->setEquationSystem(eq_sys_, conv_crit);
62 }
63#endif // USE_PETSC
64 else
65 {
67 "Could not cast nonlinear solver to Newton type solver.");
68 }
69 break;
70 }
71 }
72}

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 ( double const t0,
std::vector< std::unique_ptr< ProcessData > > const & per_process_data )

Definition at line 170 of file TimeLoop.cpp.

173{
174 std::vector<GlobalVector*> process_solutions;
175 std::vector<GlobalVector*> process_solutions_prev;
176
177 for (auto const& process_data : per_process_data)
178 {
179 auto const process_id = process_data->process_id;
180 auto& ode_sys = *process_data->tdisc_ode_sys;
181
182 // append a solution vector of suitable size
183 process_solutions.emplace_back(
185 ode_sys.getMatrixSpecifications(process_id)));
186 process_solutions_prev.emplace_back(
188 ode_sys.getMatrixSpecifications(process_id)));
189 }
190
191 for (auto const& process_data : per_process_data)
192 {
193 auto& pcs = process_data->process;
194 auto const process_id = process_data->process_id;
195 pcs.setInitialConditions(process_solutions, process_solutions_prev, t0,
196 process_id);
197
198 auto& time_disc = *process_data->time_disc;
199 time_disc.setInitialState(t0); // push IC
200 }
201
202 return {process_solutions, process_solutions_prev};
203}
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 145 of file SetOrGetIntegrationPointData.h.

149{
150 using AccessorResult = decltype(std::declval<Accessor>()(
151 std::declval<IntegrationPointDataVector>()[0]));
152 static_assert(std::is_lvalue_reference_v<AccessorResult>,
153 "The ip data accessor must return a reference.");
154
155 constexpr int kelvin_vector_size =
157 auto const n_integration_points = ip_data_vector.size();
158
159 auto kelvin_vector_values =
160 Eigen::Map<Eigen::Matrix<double, kelvin_vector_size, Eigen::Dynamic,
161 Eigen::ColMajor> const>(
162 values, kelvin_vector_size, n_integration_points);
163
164 for (unsigned ip = 0; ip < n_integration_points; ++ip)
165 {
166 accessor(ip_data_vector[ip]) =
168 kelvin_vector_values.col(ip));
169 }
170
171 return n_integration_points;
172}
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 133 of file SetOrGetIntegrationPointData.h.

137{
138 return setIntegrationPointKelvinVectorData<DisplacementDim>(
139 values, ip_data_vector,
140 [member](IpData& ip_data) -> auto& { return ip_data.*member; });
141}

◆ 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 226 of file SetOrGetIntegrationPointData.h.

230{
231 using AccessorResult = decltype(std::declval<Accessor>()(
232 std::declval<IntegrationPointDataVector>()[0]));
233 static_assert(std::is_lvalue_reference_v<AccessorResult>,
234 "The ip data accessor must return a reference.");
235
236 auto const n_integration_points = ip_data_vector.size();
237
238 for (unsigned ip = 0; ip < n_integration_points; ++ip)
239 {
240 accessor(ip_data_vector[ip]) = values[ip];
241 }
242 return n_integration_points;
243}

◆ 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 )

◆ 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 36 of file SetIPDataInitialConditions.h.

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

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

Referenced by ProcessLib::HydroMechanics::HydroMechanicsProcess< DisplacementDim >::initializeConcreteProcess(), ProcessLib::LargeDeformation::LargeDeformationProcess< DisplacementDim >::initializeConcreteProcess(), ProcessLib::RichardsMechanics::RichardsMechanicsProcess< DisplacementDim >::initializeConcreteProcess(), ProcessLib::SmallDeformation::SmallDeformationProcess< DisplacementDim >::initializeConcreteProcess(), ProcessLib::SmallDeformationNonlocal::SmallDeformationNonlocalProcess< 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 164 of file TimeLoop.cpp.

165{
166 setTimeDiscretizedODESystem(process_data, process_data.process);
167}
void setTimeDiscretizedODESystem(ProcessData &process_data, NumLib::ODESystem< ODETag, NumLib::NonlinearSolverTag::Picard > &ode_sys)
Definition TimeLoop.cpp:111

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 111 of file TimeLoop.cpp.

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

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

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

Definition at line 629 of file TimeLoop.cpp.

634{
635 BaseLib::RunTime time_timestep_process;
636 time_timestep_process.start();
637
638 auto const nonlinear_solver_status = solveOneTimeStepOneProcess(
639 x, x_prev, timestep_id, t, dt, process_data, outputs);
640
641 INFO("[time] Solving process #{:d} took {:g} s in time step #{:d}",
642 process_data.process_id, time_timestep_process.elapsed(), timestep_id);
643
644 return nonlinear_solver_status;
645}
Count the running time.
Definition RunTime.h:29
double elapsed() const
Get the elapsed time in seconds.
Definition RunTime.h:42
void start()
Start the timer.
Definition RunTime.h:32
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:221

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 221 of file TimeLoop.cpp.

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

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 41 of file TransposeInPlace.h.

42{
44 Eigen::Matrix<double, Eigen::Dynamic, Components, Eigen::RowMajor>>(
45 values, values.size() / Components, Components) =
47 Eigen::Matrix<double, Components, Eigen::Dynamic, Eigen::RowMajor>>(
48 values, Components, values.size() / Components)
49 .transpose()
50 .eval();
51}
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 53 of file TransposeInPlace.h.

55{
57 Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor>>(
58 values, values.size() / num_components, num_components) =
59 MathLib::toMatrix<Eigen::Matrix<double,
60 Eigen::Dynamic,
61 Eigen::Dynamic,
62 Eigen::RowMajor>>(
63 values, num_components, values.size() / num_components)
64 .transpose()
65 .eval();
66}

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 23 of file TransposeInPlace.h.

25{
26 std::vector<double> result;
27 store_values_function(result);
29 Eigen::Matrix<double, Eigen::Dynamic, Components, Eigen::RowMajor>>(
30 result, result.size() / Components, Components) =
32 Eigen::Matrix<double, Components, Eigen::Dynamic, Eigen::RowMajor>>(
33 result, Components, result.size() / Components)
34 .transpose()
35 .eval();
36
37 return result;
38}

References MathLib::toMatrix().

Referenced by makeExtrapolator2().

Variable Documentation

◆ timestepper_cannot_reduce_dt

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

Definition at line 647 of file TimeLoop.cpp.

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