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  Deformation
 
namespace  detail
 
namespace  HeatConduction
 
namespace  HeatTransportBHE
 
namespace  HT
 
namespace  HydroMechanics
 
namespace  LIE
 
namespace  LinearBMatrix
 
namespace  LiquidFlow
 
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
 
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  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 = GenericNaturalBoundaryCondition< HCNonAdvectiveFreeComponentFlowBoundaryConditionData, HCNonAdvectiveFreeComponentFlowBoundaryConditionLocalAssembler >
 
using NeumannBoundaryCondition = GenericNaturalBoundaryCondition< NeumannBoundaryConditionData, NeumannBoundaryConditionLocalAssembler >
 
using RobinBoundaryCondition = GenericNaturalBoundaryCondition< RobinBoundaryConditionData, RobinBoundaryConditionLocalAssembler >
 
using VariableDependentNeumannBoundaryCondition = GenericNaturalBoundaryCondition< VariableDependentNeumannBoundaryConditionData, VariableDependentNeumannBoundaryConditionLocalAssembler >
 
template<typename ShpPol , unsigned NNodes, unsigned NodalDOF, int Dim>
using LocalAssemblerTraits = detail::LocalAssemblerTraitsFixed< ShpPol, NNodes, NodalDOF, Dim >
 
using EnabledElementTraitsLagrange = decltype(BaseLib::TMP::filter< NumLib::AllElementTraitsLagrange >(detail::isElementEnabled))
 
template<typename LocalAssemblerInterface , template< typename, int > class LocalAssemblerImplementation, NumLib::IntegrationMethodProvider IntegrationMethodProvider, int GlobalDim, typename... ConstructorArgs>
using LocalAssemblerFactory = LocalAssemblerFactoryForDimGreaterEqualN< 1, LocalAssemblerInterface, LocalAssemblerImplementation, IntegrationMethodProvider, GlobalDim, ConstructorArgs... >
 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 = LocalAssemblerFactoryForDimGreaterEqualN< 2, LocalAssemblerInterface, LocalAssemblerImplementation, IntegrationMethodProvider, GlobalDim, ConstructorArgs... >
 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 = LocalAssemblerFactoryTaylorHood< 1, 2, LocalAssemblerInterface, LocalAssemblerImplementation, IntegrationMethodProvider, GlobalDim, ConstructorArgs... >
 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 = LocalAssemblerFactoryTaylorHood< 2, 2, LocalAssemblerInterface, LocalAssemblerImplementation, IntegrationMethodProvider, GlobalDim, ConstructorArgs... >
 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)
 
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, 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::map< std::string, int > &local_coupling_processes)
 
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)
 
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)
 
std::string removeIPFieldDataNameSuffix (std::string 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, bool const remove_name_suffix=false)
 
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

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

◆ LocalAssemblerFactory

template<typename LocalAssemblerInterface , template< typename, int > class LocalAssemblerImplementation, NumLib::IntegrationMethodProvider IntegrationMethodProvider, int GlobalDim, typename... ConstructorArgs>
using ProcessLib::LocalAssemblerFactory = typedef 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 = typedef 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 = typedef 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 = typedef 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 = typedef detail::LocalAssemblerTraitsFixed<ShpPol, NNodes, NodalDOF, Dim>

Definition at line 185 of file LocalAssemblerTraits.h.

◆ NeumannBoundaryCondition

◆ RobinBoundaryCondition

◆ Trafo

Definition at line 87 of file VariableTransformation.h.

◆ VariableDependentNeumannBoundaryCondition

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 30 of file Output.cpp.

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

208{
209 for (auto const& process_data : per_process_data)
210 {
211 auto& nonlinear_solver = process_data->nonlinear_solver;
212
213 setEquationSystem(*process_data);
214 nonlinear_solver.calculateNonEquilibriumInitialResiduum(
215 process_solutions, process_solutions_prev,
216 process_data->process_id);
217 }
218}
void setEquationSystem(ProcessData const &process_data)
Definition: ProcessData.cpp:17

References setEquationSystem().

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

◆ calculateUniqueFixedTimesForAllOutputs()

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

Definition at line 435 of file Output.cpp.

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

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

◆ 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::HeatConduction::HeatConductionProcess::assembleConcreteProcess(), and ProcessLib::ComponentTransport::ComponentTransportProcess::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:133
unsigned getDimension() const
Returns the dimension of the mesh (determined by the maximum dimension over all elements).
Definition: Mesh.h:84
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:258
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:217
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().

◆ 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
Definition: OutputConfig.h:48
std::vector< double > fixed_output_times
Definition: OutputConfig.h:65
unsigned int number_of_files
Definition: OutputConfig.h:40
unsigned int chunk_size_bytes
Definition: OutputConfig.h:41
std::set< std::string > output_variables
Definition: OutputConfig.h:57
std::vector< std::string > mesh_names_for_output
Definition: OutputConfig.h:59
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 81 of file CreateOutputConfig.cpp.

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

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}
Range< SubtreeIterator > getConfigSubtreeList(std::string const &root) const
Definition: ConfigTree.cpp:185
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,
std::map< std::string, int > &  local_coupling_processes 
)
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 68 of file CreateProcessData.cpp.

76{
77 std::vector<std::unique_ptr<ProcessData>> per_process_data;
78 std::vector<std::string> process_names;
79 int process_id = 0;
80
82 for (auto pcs_config : config.getConfigSubtreeList("process"))
83 {
85 auto const pcs_name = pcs_config.getConfigAttribute<std::string>("ref");
86 auto& pcs = *BaseLib::getIfOrError(
87 processes,
88 [&pcs_name](std::unique_ptr<Process> const& p)
89 { return p->name == pcs_name; },
90 "A process with the given name has not been defined.");
91
92 auto const process_name =
94 pcs_config.getConfigParameterOptional<std::string>("process_name");
95 if (process_name)
96 {
97 if (!local_coupling_processes.contains(*process_name))
98 {
100 "The given process name '{}' for the element "
101 "'time_loop/processes/process/process_name' is not found "
102 "in the element "
103 "'time_loop/global_process_coupling/"
104 "local_coupling_processes/process_name' in the project "
105 "file.",
106 *process_name);
107 }
108
109 if (ranges::contains(process_names, *process_name))
110 {
111 OGS_FATAL(
112 "The given process name '{}' for the element "
113 "'time_loop/processes/process/process_name' is not unique! "
114 "Please check this in the project file.",
115 *process_name);
116 }
117 process_names.emplace_back(*process_name);
118 local_coupling_processes[*process_name] = process_id;
119 }
120
121 auto const nl_slv_name =
123 pcs_config.getConfigParameter<std::string>("nonlinear_solver");
124 auto& nl_slv = *BaseLib::getOrError(
125 nonlinear_solvers, nl_slv_name,
126 "A nonlinear solver with the given name has not been defined.");
127
128 auto time_disc = NumLib::createTimeDiscretization(
130 pcs_config.getConfigSubtree("time_discretization"));
131
132 auto timestepper = NumLib::createTimeStepper(
134 pcs_config.getConfigSubtree("time_stepping"),
135 fixed_times_for_output);
136
137 auto conv_crit = NumLib::createConvergenceCriterion(
139 pcs_config.getConfigSubtree("convergence_criterion"));
140
142 auto output = pcs_config.getConfigSubtreeOptional("output");
143 if (output)
144 {
145 OGS_FATAL(
146 "In order to make the specification of output in the project "
147 "file consistent, the variables output tags were moved from "
148 "xpath "
149 "'//OpenGeoSysProject/time_loop/processes/process/output' to "
150 "the global output section, i.e., to the xpath "
151 "'//OpenGeoSysProject/time_loop/output'. This has to be done "
152 "in the current project file!");
153 }
154
155 per_process_data.emplace_back(
156 makeProcessData(std::move(timestepper), nl_slv, process_id, pcs,
157 std::move(time_disc), std::move(conv_crit),
158 compensate_non_equilibrium_initial_residuum));
159 ++process_id;
160 }
161
162 if (per_process_data.size() != processes.size())
163 {
164 if (processes.size() > 1)
165 {
166 OGS_FATAL(
167 "Some processes have not been configured to be solved by this "
168 "time loop.");
169 }
170 else
171 {
172 INFO(
173 "The equations of the coupled processes will be solved by the "
174 "staggered scheme.");
175 }
176 }
177
178 if (process_names.size() != local_coupling_processes.size())
179 {
180 OGS_FATAL(
181 "The number of the given process names for the element "
182 "'time_loop/processes/process/process_name' is not equal to that "
183 "in the element "
184 "'time_loop/global_process_coupling/local_coupling_processes/"
185 "process_name' in the project file.");
186 }
187
188 return per_process_data;
189}
Map::mapped_type & getOrError(Map &map, Key const &key, std::string const &error_message)
Definition: Algorithm.h:103
Container::value_type const & getIfOrError(Container const &container, Predicate &&predicate, std::string const &error_message)
Definition: Algorithm.h:148
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, 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::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:102
std::size_t getID() const
Get id of the mesh.
Definition: Mesh.h:117
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)
BaseLib::ConfigTree config
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__global_process_coupling
Input File Parameter:
prj__time_loop__global_process_coupling__max_iter
Input File Parameter:
prj__time_loop__global_process_coupling__convergence_criteria
Input File Parameter:
prj__time_loop__global_process_coupling__convergence_criteria__convergence_criterion
Input File Parameter:
prj__time_loop__global_process_coupling__local_coupling_processes
Input File Parameter:
prj__time_loop__global_process_coupling__local_coupling_processes__process_name
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 24 of file CreateTimeLoop.cpp.

31{
32 auto const& coupling_config
34 = config.getConfigSubtreeOptional("global_process_coupling");
35
36 std::vector<std::unique_ptr<NumLib::ConvergenceCriterion>>
37 global_coupling_conv_criteria;
38 std::map<std::string, int> local_coupling_processes;
39 int max_coupling_iterations = 1;
40 if (coupling_config)
41 {
42 max_coupling_iterations
44 = coupling_config->getConfigParameter<int>("max_iter");
45
46 auto const& coupling_convergence_criteria_config =
48 coupling_config->getConfigSubtree("convergence_criteria");
49
50 auto coupling_convergence_criterion_config =
52 coupling_convergence_criteria_config.getConfigSubtreeList(
53 "convergence_criterion");
54 std::transform(coupling_convergence_criterion_config.begin(),
55 coupling_convergence_criterion_config.end(),
56 std::back_inserter(global_coupling_conv_criteria),
57 [](BaseLib::ConfigTree const& c)
58 { return NumLib::createConvergenceCriterion(c); });
59
60 auto const& local_coupling_processes_config =
61 coupling_config
63 ->getConfigSubtreeOptional("local_coupling_processes");
64 if (local_coupling_processes_config)
65 {
66 for (
67 auto name :
68 local_coupling_processes_config
70 ->getConfigParameterList<std::string>("process_name"))
71 {
73 local_coupling_processes, name, -1,
74 "The name of locally coupled process is not unique.");
75 }
76
77 static std::string const error_info =
78 "Please check the number of elements in the tag "
79 "'time_loop/global_process_coupling/"
80 "local_coupling_processes' in the project file.";
81 if (local_coupling_processes.size() >
82 global_coupling_conv_criteria.size() - 1)
83 {
85 "The number of the locally coupled processes is greater "
86 "than or equal to the number of total coupled processes. "
87 "{}",
88 error_info);
89 }
90
91 INFO("There are {:d} locally coupled processes.",
92 local_coupling_processes.size());
93
94 if (local_coupling_processes.size() < 2)
95 {
97 "At least two locally coupled processes are required for "
98 "the local iteration solution! {} ",
99 error_info);
100 }
101 }
102 }
103
105 auto output_config_tree = config.getConfigSubtreeOptional("output");
106 if (!output_config_tree)
107 {
108 INFO("No output section found.");
109 }
110 auto outputs =
111 output_config_tree
112 ? createOutput(*output_config_tree, output_directory, meshes)
114 : createOutputs(config.getConfigSubtree("outputs"),
115 output_directory, meshes);
116 auto const fixed_times_for_output =
118
119 if (auto const submesh_residuum_output_config_tree =
121 config.getConfigSubtreeOptional("submesh_residuum_output");
122 submesh_residuum_output_config_tree)
123 {
125 *submesh_residuum_output_config_tree, output_directory, meshes);
126
127 for (auto& process : processes)
128 {
129 auto const& residuum_vector_names =
130 process->initializeAssemblyOnSubmeshes(smroc.meshes);
131
132 for (auto const& name : residuum_vector_names)
133 {
134 smroc.output.doNotProjectFromBulkMeshToSubmeshes(
136 }
137 }
138
139 outputs.push_back(std::move(smroc.output));
140 }
141 else
142 {
143 // Submesh assembly must always be initialized.
144 for (auto& process : processes)
145 {
146 process->initializeAssemblyOnSubmeshes({});
147 }
148 }
149
150 auto per_process_data = createPerProcessData(
152 config.getConfigSubtree("processes"), processes, nonlinear_solvers,
153 compensate_non_equilibrium_initial_residuum, fixed_times_for_output,
154 local_coupling_processes);
155
156 const bool use_staggered_scheme =
157 ranges::any_of(processes.begin(), processes.end(),
158 [](auto const& process)
159 { return !(process->isMonolithicSchemeUsed()); });
160
161 if (!use_staggered_scheme && per_process_data.size() > 1)
162 {
163 OGS_FATAL(
164 "The monolithic scheme is used. However more than one process data "
165 "tags (by name \"process\") inside tag \"time_loop\" are defined "
166 "for the staggered scheme. If you want to use staggered scheme, "
167 "please set the element of tag \"<coupling_scheme>\" to "
168 "\"staggered\".");
169 }
170
171 if (coupling_config)
172 {
173 if (global_coupling_conv_criteria.size() != per_process_data.size())
174 {
175 OGS_FATAL(
176 "The number of convergence criteria of the global staggered "
177 "coupling loop is not identical to the number of the "
178 "processes! Please check the element by tag "
179 "global_process_coupling in the project file.");
180 }
181 }
182
183 const auto minmax_iter =
184 std::minmax_element(per_process_data.begin(),
185 per_process_data.end(),
186 [](std::unique_ptr<ProcessData> const& a,
187 std::unique_ptr<ProcessData> const& b) {
188 return (a->timestep_algorithm->end() <
189 b->timestep_algorithm->end());
190 });
191 const double start_time =
192 per_process_data[minmax_iter.first - per_process_data.begin()]
193 ->timestep_algorithm->begin();
194 const double end_time =
195 per_process_data[minmax_iter.second - per_process_data.begin()]
196 ->timestep_algorithm->end();
197
198 return std::make_unique<TimeLoop>(
199 std::move(outputs), std::move(per_process_data),
200 max_coupling_iterations, std::move(global_coupling_conv_criteria),
201 std::move(local_coupling_processes), start_time, end_time);
202}
void insertIfKeyUniqueElseError(Map &map, Key const &key, Value &&value, std::string const &error_message)
Definition: Algorithm.h:87
SubmeshResiduumOutputConfig createSubmeshResiduumOutputConfig(BaseLib::ConfigTree const &config, std::string const &output_directory, std::vector< std::unique_ptr< MeshLib::Mesh > > &meshes)
std::vector< std::unique_ptr< ProcessData > > createPerProcessData(BaseLib::ConfigTree const &config, std::vector< std::unique_ptr< Process > > const &processes, std::map< std::string, std::unique_ptr< NumLib::NonlinearSolverBase > > const &nonlinear_solvers, bool const compensate_non_equilibrium_initial_residuum, std::vector< double > const &fixed_times_for_output, std::map< std::string, int > &local_coupling_processes)
std::vector< double > calculateUniqueFixedTimesForAllOutputs(std::vector< Output > const &outputs)
Definition: Output.cpp:435
std::vector< Output > createOutputs(const BaseLib::ConfigTree &output_configs, std::string const &output_directory, std::vector< std::unique_ptr< MeshLib::Mesh > > &meshes)

References calculateUniqueFixedTimesForAllOutputs(), createOutput(), createOutputs(), createPerProcessData(), createSubmeshResiduumOutputConfig(), BaseLib::ConfigTree::getConfigSubtree(), BaseLib::ConfigTree::getConfigSubtreeOptional(), INFO(), BaseLib::insertIfKeyUniqueElseError(), 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:282

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

Referenced by createDeactivatedSubdomainMesh().

◆ findProcessVariable()

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

Definition at line 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::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 
)
Input File Parameter:
special OGS input file parameter

Definition at line 78 of file ProcessUtils.cpp.

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

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

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 
)

Definition at line 247 of file SetOrGetIntegrationPointData.h.

253{
254 std::vector<double> result;
255 result.reserve(ip_data_vector.size() * n_components);
256
257 for (auto& ip_data : ip_data_vector)
258 {
259 auto const values_span = get_values_span(*(ip_data.*member));
260 assert(values_span.size() == static_cast<std::size_t>(n_components));
261
262 result.insert(end(result), values_span.begin(), values_span.end());
263 }
264
265 return result;
266}

Referenced by ProcessLib::SmallDeformation::SmallDeformationLocalAssemblerInterface< DisplacementDim >::getMaterialStateVariableInternalState(), ProcessLib::ThermoRichardsMechanics::LocalAssemblerInterface< DisplacementDim, ConstitutiveTraits >::getMaterialStateVariableInternalState(), ProcessLib::RichardsMechanics::RichardsMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::getMaterialStateVariableInternalState(), and ProcessLib::TH2M::TH2MLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::getMaterialStateVariableInternalState().

◆ 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)
Definition: EigenMapTools.h:32

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)
constexpr int kelvin_vector_dimensions(int const displacement_dim)
Kelvin vector dimensions for given displacement dimension.
Definition: KelvinVector.h:24

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::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 >::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::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,
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.

32{
34
35 if (auto* nonlinear_solver_picard =
37 &nonlinear_solver))
38 {
39 nonlinear_solver_picard->compensateNonEquilibriumInitialResiduum(
40 compensate_non_equilibrium_initial_residuum);
41 return std::make_unique<ProcessData>(
42 std::move(timestepper), Tag::Picard, *nonlinear_solver_picard,
43 std::move(conv_crit), std::move(time_disc), process_id, 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, process);
54 }
55#ifdef USE_PETSC
56 if (auto* nonlinear_solver_petsc =
57 dynamic_cast<NumLib::PETScNonlinearSolver*>(&nonlinear_solver))
58 {
59 return std::make_unique<ProcessData>(
60 std::move(timestepper), Tag::Newton, *nonlinear_solver_petsc,
61 std::move(conv_crit), std::move(time_disc), process_id, process);
62 }
63#endif // USE_PETSC
64
65 OGS_FATAL("Encountered unknown nonlinear solver type. Aborting");
66}
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 449 of file Output.cpp.

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

◆ 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)
Definition: FileTools.cpp:219
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....
Definition: VtuInterface.h:38

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

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

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

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

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 ProcessLib::removeIPFieldDataNameSuffix ( std::string const &  name)
inline

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

Definition at line 20 of file SetIPDataInitialConditions.h.

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

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

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

Definition at line 270 of file SetOrGetIntegrationPointData.h.

276{
277 auto const n_integration_points = ip_data_vector.size();
278
279 std::size_t position = 0;
280 for (auto const& ip_data : ip_data_vector)
281 {
282 auto const values_span = get_values_span(*(ip_data.*member));
283 std::copy_n(values + position, values_span.size(), values_span.begin());
284 position += values_span.size();
285 }
286 return n_integration_points;
287}

Referenced by ProcessLib::SmallDeformation::SmallDeformationLocalAssemblerInterface< DisplacementDim >::setIPDataInitialConditions(), ProcessLib::ThermoRichardsMechanics::LocalAssemblerInterface< DisplacementDim, ConstitutiveTraits >::setIPDataInitialConditions(), ProcessLib::RichardsMechanics::RichardsMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::setIPDataInitialConditions(), and ProcessLib::TH2M::TH2MLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::setIPDataInitialConditions().

◆ 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)
Definition: KelvinVector.h:171

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,
bool const  remove_name_suffix = false 
)

Definition at line 34 of file SetIPDataInitialConditions.h.

40{
41 for (auto const& ip_writer : _integration_point_writer)
42 {
43 // Find the mesh property with integration point writer's name.
44 auto const& name = ip_writer->name();
45 if (!mesh_properties.existsPropertyVector<double>(name))
46 {
47 continue;
48 }
49 auto const& mesh_property =
50 *mesh_properties.template getPropertyVector<double>(name);
51
52 // The mesh property must be defined on integration points.
53 if (mesh_property.getMeshItemType() !=
55 {
56 continue;
57 }
58
59 auto const ip_meta_data =
60 getIntegrationPointMetaData(mesh_properties, name);
61
62 // Check the number of components.
63 if (ip_meta_data.n_components !=
64 mesh_property.getNumberOfGlobalComponents())
65 {
67 "Different number of components in meta data ({:d}) than in "
68 "the integration point field data for '{:s}': {:d}.",
69 ip_meta_data.n_components, name,
70 mesh_property.getNumberOfGlobalComponents());
71 }
72
73 INFO("Setting initial integration point data for '{}'", name);
74
75 auto const& name_transformed =
76 remove_name_suffix ? removeIPFieldDataNameSuffix(name) : 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 removeIPFieldDataNameSuffix(std::string 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::RichardsMechanics::RichardsMechanicsProcess< DisplacementDim >::initializeConcreteProcess(), ProcessLib::SmallDeformation::SmallDeformationProcess< DisplacementDim >::initializeConcreteProcess(), ProcessLib::TH2M::TH2MProcess< DisplacementDim >::initializeConcreteProcess(), ProcessLib::ThermoHydroMechanics::ThermoHydroMechanicsProcess< DisplacementDim >::initializeConcreteProcess(), ProcessLib::ThermoMechanics::ThermoMechanicsProcess< DisplacementDim >::initializeConcreteProcess(), ProcessLib::ThermoRichardsFlow::ThermoRichardsFlowProcess::initializeConcreteProcess(), and ProcessLib::ThermoRichardsMechanics::ThermoRichardsMechanicsProcess< DisplacementDim, ConstitutiveTraits >::initializeConcreteProcess().

◆ setTimeDiscretizedODESystem() [1/2]

void ProcessLib::setTimeDiscretizedODESystem ( ProcessData process_data)

Definition at line 163 of file TimeLoop.cpp.

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

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

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

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

640{
641 BaseLib::RunTime time_timestep_process;
642 time_timestep_process.start();
643
644 auto const nonlinear_solver_status = solveOneTimeStepOneProcess(
645 x, x_prev, timestep_id, t, dt, process_data, outputs);
646
647 INFO("[time] Solving process #{:d} took {:g} s in time step #{:d}",
648 process_data.process_id, time_timestep_process.elapsed(), timestep_id);
649
650 return nonlinear_solver_status;
651}
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:220

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

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

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)
Definition: EigenMapTools.h:72

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

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