OGS
ProcessLib Namespace Reference

Detailed Description

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

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

Namespaces

 BoundaryConditionAndSourceTerm
 
 ComponentTransport
 
 Deformation
 
 detail
 
 HeatConduction
 
 HeatTransportBHE
 
 HT
 
 HydroMechanics
 
 LIE
 
 LinearBMatrix
 
 LiquidFlow
 
 NormalTractionBoundaryCondition
 
 PhaseField
 
 RichardsComponentTransport
 
 RichardsFlow
 
 RichardsMechanics
 
 SmallDeformation
 
 SmallDeformationNonlocal
 
 SourceTerms
 
 SteadyStateDiffusion
 
 StokesFlow
 
 TES
 
 TH2M
 
 ThermalTwoPhaseFlowWithPP
 
 ThermoHydroMechanics
 
 ThermoMechanicalPhaseField
 
 ThermoMechanics
 
 ThermoRichardsFlow
 
 ThermoRichardsMechanics
 
 TwoPhaseFlowWithPP
 
 TwoPhaseFlowWithPrho
 

Classes

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

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 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::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::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< MeshLib::Node * > const &nodes_in_bc_mesh, NumLib::LocalToGlobalIndexMap const &dof_table_boundary, int const variable_id, int const component_id, const double t, GlobalVector const &, NumLib::IndexValueVector< GlobalIndexType > &bc_values)
 
std::unique_ptr< 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. More...
 
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::unique_ptr< PythonBoundaryConditioncreatePythonBoundaryCondition (BaseLib::ConfigTree const &config, MeshLib::Mesh const &boundary_mesh, NumLib::LocalToGlobalIndexMap const &dof_table, std::size_t bulk_mesh_id, int const variable_id, int const component_id, unsigned const integration_order, unsigned const shapefunction_order, unsigned const global_dim)
 Creates a new PythonBoundaryCondition object. More...
 
void pythonBindBoundaryCondition (pybind11::module &m)
 Creates Python bindings for the Python BC class. More...
 
std::unique_ptr< RobinBoundaryConditioncreateRobinBoundaryCondition (BaseLib::ConfigTree const &config, MeshLib::Mesh const &bc_mesh, NumLib::LocalToGlobalIndexMap const &dof_table, int const variable_id, int const component_id, unsigned const integration_order, unsigned const shapefunction_order, unsigned const global_dim, std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const &parameters)
 
std::unique_ptr< 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< MeshLib::Node * >, std::vector< MeshLib::Node * > > extractInnerAndOuterNodes (MeshLib::Mesh const &mesh, MeshLib::Mesh const &sub_mesh, IsActive is_active)
 
static std::unique_ptr< DeactivatedSubdomainMeshcreateDeactivatedSubdomainMesh (MeshLib::Mesh const &mesh, int const material_id)
 
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. More...
 
std::unique_ptr< DeactivatedSubdomain const > 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< std::unique_ptr< DeactivatedSubdomain const > > 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)
 
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)
 
std::unique_ptr< TimeLoopcreateTimeLoop (BaseLib::ConfigTree const &config, std::string const &output_directory, std::vector< std::unique_ptr< Process >> const &processes, std::map< std::string, std::unique_ptr< NumLib::NonlinearSolverBase >> const &nonlinear_solvers, std::vector< std::unique_ptr< MeshLib::Mesh >> const &meshes)
 Builds a TimeLoop from the given configuration. More...
 
template<int DisplacementDim, int NPOINTS, typename N_Type , typename HMatrixType >
void computeHMatrix (N_Type const &N, HMatrixType &H)
 Fills a H-matrix based on given shape function. More...
 
std::unique_ptr< OutputcreateOutput (const BaseLib::ConfigTree &config, std::string const &output_directory, std::vector< std::unique_ptr< MeshLib::Mesh >> const &meshes)
 
void createSecondaryVariables (BaseLib::ConfigTree const &config, SecondaryVariableCollection &secondary_variables)
 
void addIntegrationPointWriter (MeshLib::Mesh &mesh, std::vector< std::unique_ptr< IntegrationPointWriter >> const &integration_point_writer)
 
IntegrationPointMetaData getIntegrationPointMetaData (MeshLib::Mesh const &mesh, std::string const &name)
 
void addProcessDataToMesh (const double t, std::vector< GlobalVector * > const &x, int const process_id, MeshLib::Mesh &mesh, [[maybe_unused]] std::vector< NumLib::LocalToGlobalIndexMap const * > const &bulk_dof_tables, std::vector< NumLib::LocalToGlobalIndexMap const * > const &dof_table, std::vector< std::reference_wrapper< ProcessVariable >> const &process_variables, SecondaryVariableCollection const &secondary_variables, bool const output_secondary_variable, std::vector< std::unique_ptr< IntegrationPointWriter >> const *const integration_point_writer, OutputDataSpecification const &process_output)
 
void makeOutput (std::string const &file_name, MeshLib::Mesh const &mesh, bool const compress_output, int const data_mode)
 
void addProcessDataToMesh (const double t, std::vector< GlobalVector * > const &x, int const process_id, MeshLib::Mesh &mesh, std::vector< NumLib::LocalToGlobalIndexMap const * > const &bulk_dof_tables, std::vector< NumLib::LocalToGlobalIndexMap const * > const &dof_tables, std::vector< std::reference_wrapper< ProcessVariable >> const &process_variables, SecondaryVariableCollection const &secondary_variables, bool const output_secondary_variable, std::vector< std::unique_ptr< IntegrationPointWriter >> const *integration_point_writer, OutputDataSpecification const &process_output)
 Prepare the output data, i.e. add the solution to vtu data structure. More...
 
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)
 
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, std::vector< std::size_t > &xdot_vector_ids)
 
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 * > 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, Output &output_control, std::size_t &xdot_id)
 
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, Output &output, std::size_t &xdot_id)
 
GlobalVector computeResiduum (GlobalVector const &x, GlobalVector const &xdot, GlobalMatrix const &M, GlobalMatrix const &K, GlobalVector const &b)
 
template<int GlobalDim, template< typename, typename, int > class LocalAssemblerImplementation, typename LocalAssemblerInterface , typename... ExtraCtorArgs>
void createLocalAssemblers (NumLib::LocalToGlobalIndexMap const &dof_table, const unsigned shapefunction_order, std::vector< MeshLib::Element * > const &mesh_elements, std::vector< std::unique_ptr< LocalAssemblerInterface >> &local_assemblers, ExtraCtorArgs &&... extra_ctor_args)
 
template<template< typename, typename, int > class LocalAssemblerImplementation, typename LocalAssemblerInterface , typename... ExtraCtorArgs>
void createLocalAssemblers (const unsigned dimension, std::vector< MeshLib::Element * > const &mesh_elements, NumLib::LocalToGlobalIndexMap const &dof_table, const unsigned shapefunction_order, std::vector< std::unique_ptr< LocalAssemblerInterface >> &local_assemblers, ExtraCtorArgs &&... extra_ctor_args)
 
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)
 
template<int DisplacementDim, typename IntegrationPointData , typename MemberType >
std::vector< double > const & getIntegrationPointKelvinVectorData (std::vector< IntegrationPointData, Eigen::aligned_allocator< IntegrationPointData >> const &ip_data, MemberType member, std::vector< double > &cache)
 
template<int DisplacementDim, typename IntegrationPointData , typename MemberType >
std::vector< double > getIntegrationPointKelvinVectorData (std::vector< IntegrationPointData, Eigen::aligned_allocator< IntegrationPointData >> const &ip_data, MemberType member)
 
template<int DisplacementDim, typename IntegrationPointData , typename MemberType >
std::size_t setIntegrationPointKelvinVectorData (double const *values, std::vector< IntegrationPointData, Eigen::aligned_allocator< IntegrationPointData >> &ip_data, MemberType member)
 
template<typename IntegrationPointData , typename MemberType >
std::vector< double > const & getIntegrationPointScalarData (std::vector< IntegrationPointData, Eigen::aligned_allocator< IntegrationPointData >> const &ip_data, MemberType member, std::vector< double > &cache)
 
template<typename IntegrationPointData , typename MemberType >
std::size_t setIntegrationPointScalarData (double const *values, std::vector< IntegrationPointData, Eigen::aligned_allocator< IntegrationPointData >> &ip_data, MemberType member)
 
template<typename IntegrationPointData , typename MemberType , typename MaterialStateVariables >
std::vector< double > getIntegrationPointDataMaterialStateVariables (std::vector< IntegrationPointData, Eigen::aligned_allocator< IntegrationPointData >> const &ip_data_vector, MemberType member, std::function< BaseLib::DynamicSpan< double >(MaterialStateVariables &)> get_values_span, int const n_components)
 
template<typename IntegrationPointData , typename MemberType , typename MaterialStateVariables >
std::size_t setIntegrationPointDataMaterialStateVariables (double const *values, std::vector< IntegrationPointData, Eigen::aligned_allocator< IntegrationPointData >> &ip_data_vector, MemberType member, std::function< BaseLib::DynamicSpan< double >(MaterialStateVariables &)> get_values_span)
 
template<int Components, typename StoreValuesFunction >
std::vector< double > transposeInPlace (StoreValuesFunction const &store_values_function)
 

Variables

static constexpr std::string_view timestepper_cannot_reduce_dt
 

Typedef Documentation

◆ HCNonAdvectiveFreeComponentFlowBoundaryCondition

◆ LocalAssemblerTraits

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

Definition at line 186 of file LocalAssemblerTraits.h.

◆ NeumannBoundaryCondition

◆ RobinBoundaryCondition

◆ Trafo

Definition at line 87 of file VariableTransformation.h.

◆ VariableDependentNeumannBoundaryCondition

Enumeration Type Documentation

◆ OutputType

enum ProcessLib::OutputType : uint8_t
strong

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

See Output::_output_file_data_mode documentation for the data_mode parameter.

Enumerator
vtk 
xdmf 

Definition at line 50 of file ProcessOutput.h.

Function Documentation

◆ addIntegrationPointWriter()

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

Add integration point data the the mesh's properties.

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

Definition at line 91 of file IntegrationPointWriter.cpp.

95 {
96  std::vector<IntegrationPointMetaData> meta_data;
97  meta_data.reserve(size(integration_point_writer));
98  transform(cbegin(integration_point_writer), cend(integration_point_writer),
99  back_inserter(meta_data),
100  [&](auto const& ip_writer)
101  { return addIntegrationPointData(mesh, *ip_writer); });
102  if (!meta_data.empty())
103  {
104  addIntegrationPointMetaData(mesh, meta_data);
105  }
106 }
static ProcessLib::IntegrationPointMetaData addIntegrationPointData(MeshLib::Mesh &mesh, ProcessLib::IntegrationPointWriter const &writer)
static void addIntegrationPointMetaData(MeshLib::Mesh &mesh, std::vector< ProcessLib::IntegrationPointMetaData > const &meta_data)

References addIntegrationPointData(), and addIntegrationPointMetaData().

Referenced by addProcessDataToMesh().

◆ addProcessDataToMesh() [1/2]

void ProcessLib::addProcessDataToMesh ( const double  t,
std::vector< GlobalVector * > const &  x,
int const  process_id,
MeshLib::Mesh mesh,
[[maybe_unused] ] std::vector< NumLib::LocalToGlobalIndexMap const * > const &  bulk_dof_tables,
std::vector< NumLib::LocalToGlobalIndexMap const * > const &  dof_table,
std::vector< std::reference_wrapper< ProcessVariable >> const &  process_variables,
SecondaryVariableCollection const &  secondary_variables,
bool const  output_secondary_variable,
std::vector< std::unique_ptr< IntegrationPointWriter >> const *const  integration_point_writer,
OutputDataSpecification const &  process_output 
)

Definition at line 137 of file ProcessOutput.cpp.

150 {
151  DBUG("Process output data.");
152 
153  addOgsVersion(mesh);
154 
155  // Copy result
156 #ifdef USE_PETSC
157  // TODO It is also possible directly to copy the data for single process
158  // variable to a mesh property. It needs a vector of global indices and
159  // some PETSc magic to do so.
160  std::vector<double> x_copy(x[process_id]->getLocalSize() +
161  x[process_id]->getGhostSize());
162 #else
163  std::vector<double> x_copy(x[process_id]->size());
164 #endif
165  x[process_id]->copyValues(x_copy);
166 
167  auto const& output_variables = process_output.output_variables;
168  std::set<std::string> already_output;
169 
170  int global_component_offset = 0;
171  int global_component_offset_next = 0;
172 
173  const auto number_of_dof_variables =
174  dof_table[process_id]->getNumberOfVariables();
175  // primary variables
176  for (int variable_id = 0;
177  variable_id < static_cast<int>(process_variables.size());
178  ++variable_id)
179  {
180  ProcessVariable& pv = process_variables[variable_id];
181  int const n_components = pv.getNumberOfGlobalComponents();
182  // If (number_of_dof_variables==1), the case is either the staggered
183  // scheme being applied or a single PDE being solved.
184  const int sub_meshset_id =
185  (number_of_dof_variables == 1) ? 0 : variable_id;
186 
187  if (number_of_dof_variables > 1)
188  {
189  global_component_offset = global_component_offset_next;
190  global_component_offset_next += n_components;
191  }
192 
193  if (output_variables.find(pv.getName()) == output_variables.cend())
194  {
195  continue;
196  }
197 
198  already_output.insert(pv.getName());
199 
200  DBUG(" process variable {:s}", pv.getName());
201 
202  auto const num_comp = pv.getNumberOfGlobalComponents();
203  auto& output_data = *MeshLib::getOrCreateMeshProperty<double>(
204  mesh, pv.getName(), MeshLib::MeshItemType::Node, num_comp);
205 
206  for (int component_id = 0; component_id < num_comp; ++component_id)
207  {
208  auto const& mesh_subset = dof_table[process_id]->getMeshSubset(
209  sub_meshset_id, component_id);
210  auto const mesh_id = mesh_subset.getMeshID();
211  for (auto const* node : mesh_subset.getNodes())
212  {
213 #ifdef USE_PETSC
214  if (bulk_dof_tables[process_id] != dof_table[process_id])
215  {
216  if (!mesh.getProperties().existsPropertyVector<std::size_t>(
217  "bulk_node_ids"))
218  {
219  OGS_FATAL(
220  "The required bulk node ids map does not exist in "
221  "the boundary mesh '{:s}' or has the wrong data "
222  "type (should be equivalent to C++ data type "
223  "std::size_t which is an unsigned integer of size "
224  "{:d} or UInt64 in vtk terminology).",
225  mesh.getName(), sizeof(std::size_t));
226  }
227  auto const bulk_node_id_map =
228  *mesh.getProperties().getPropertyVector<std::size_t>(
229  "bulk_node_ids");
230 
231  if (static_cast<MeshLib::NodePartitionedMesh const&>(mesh)
232  .isGhostNode(node->getID()))
233  {
234  auto const bulk_node_id =
235  bulk_node_id_map[node->getID()];
236  // use bulk_dof_tables to find information
237  std::size_t const bulk_mesh_id = 0;
238  MeshLib::Location const l(bulk_mesh_id,
240  bulk_node_id);
241  auto const global_component_id =
242  global_component_offset + component_id;
243  auto const index =
244  bulk_dof_tables[process_id]->getLocalIndex(
245  l, global_component_id,
246  x[process_id]->getRangeBegin(),
247  x[process_id]->getRangeEnd());
248 
249  output_data[node->getID() * n_components +
250  component_id] = x_copy[index];
251  continue;
252  }
253  }
254 #endif
256  node->getID());
257 
258  auto const global_component_id =
259  global_component_offset + component_id;
260  auto const index = dof_table[process_id]->getLocalIndex(
261  l, global_component_id, x[process_id]->getRangeBegin(),
262  x[process_id]->getRangeEnd());
263 
264  output_data[node->getID() * n_components + component_id] =
265  x_copy[index];
266  }
267  }
268  }
269 
270  if (output_secondary_variable)
271  {
272  for (auto const& external_variable_name : secondary_variables)
273  {
274  auto const& name = external_variable_name.first;
275  if (!already_output.insert(name).second)
276  {
277  // no insertion took place, output already done
278  continue;
279  }
280 
282  t, x, dof_table, secondary_variables.get(name), name, mesh);
283 
284  if (process_output.output_residuals)
285  {
287  t, x, dof_table, secondary_variables.get(name), name, mesh);
288  }
289  }
290  }
291 
292  if (integration_point_writer != nullptr)
293  {
294  addIntegrationPointWriter(mesh, *integration_point_writer);
295  }
296 }
#define OGS_FATAL(...)
Definition: Error.h:26
void DBUG(char const *fmt, Args const &... args)
Definition: Logging.h:27
static void addSecondaryVariableNodes(double const t, std::vector< GlobalVector * > const &x, std::vector< NumLib::LocalToGlobalIndexMap const * > const &dof_table, ProcessLib::SecondaryVariable const &var, std::string const &output_name, MeshLib::Mesh &mesh)
static void addSecondaryVariableResiduals(double const t, std::vector< GlobalVector * > const &x, std::vector< NumLib::LocalToGlobalIndexMap const * > const &dof_table, ProcessLib::SecondaryVariable const &var, std::string const &output_name, MeshLib::Mesh &mesh)
static void addOgsVersion(MeshLib::Mesh &mesh)
const std::string getName() const
Get name of the mesh.
Definition: Mesh.h:92
Properties & getProperties()
Definition: Mesh.h:123
bool isGhostNode(const std::size_t node_id) const
Check whether a node with ID of node_id is a ghost node.
PropertyVector< T > const * getPropertyVector(std::string const &name) const
bool existsPropertyVector(std::string const &name) const
void addIntegrationPointWriter(MeshLib::Mesh &mesh, std::vector< std::unique_ptr< IntegrationPointWriter >> const &integration_point_writer)

References addIntegrationPointWriter(), addOgsVersion(), addSecondaryVariableNodes(), addSecondaryVariableResiduals(), DBUG(), MeshLib::Properties::existsPropertyVector(), MeshLib::Mesh::getName(), ProcessLib::ProcessVariable::getName(), ProcessLib::ProcessVariable::getNumberOfGlobalComponents(), MeshLib::Mesh::getProperties(), MeshLib::Properties::getPropertyVector(), MeshLib::NodePartitionedMesh::isGhostNode(), MaterialPropertyLib::name, MeshLib::Node, OGS_FATAL, ProcessLib::OutputDataSpecification::output_residuals, and ProcessLib::OutputDataSpecification::output_variables.

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

◆ addProcessDataToMesh() [2/2]

void ProcessLib::addProcessDataToMesh ( const double  t,
std::vector< GlobalVector * > const &  x,
int const  process_id,
MeshLib::Mesh mesh,
std::vector< NumLib::LocalToGlobalIndexMap const * > const &  bulk_dof_tables,
std::vector< NumLib::LocalToGlobalIndexMap const * > const &  dof_tables,
std::vector< std::reference_wrapper< ProcessVariable >> const &  process_variables,
SecondaryVariableCollection const &  secondary_variables,
bool const  output_secondary_variable,
std::vector< std::unique_ptr< IntegrationPointWriter >> const *  integration_point_writer,
OutputDataSpecification const &  process_output 
)

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

◆ bheInflowpythonBindBoundaryCondition()

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

Creates BHE Inflow Python bindings for the Python BC class.

Definition at line 64 of file BHEInflowPythonBoundaryConditionModule.cpp.

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

References ProcessLib::BHEInflowPythonBoundaryConditionPythonSideInterface::tespySolver().

Referenced by PYBIND11_EMBEDDED_MODULE().

◆ calculateNonEquilibriumInitialResiduum()

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

Definition at line 251 of file TimeLoop.cpp.

256 {
257  INFO("Calculate non-equilibrium initial residuum.");
258  for (auto& process_data : per_process_data)
259  {
260  auto& ode_sys = *process_data->tdisc_ode_sys;
261 
262  auto& time_disc = *process_data->time_disc;
263  auto& nonlinear_solver = process_data->nonlinear_solver;
264  auto& conv_crit = *process_data->conv_crit;
265 
266  auto const nl_tag = process_data->nonlinear_solver_tag;
267  setEquationSystem(nonlinear_solver, ode_sys, conv_crit, nl_tag);
268  // dummy values to handle the time derivative terms more or less
269  // correctly, i.e. to ignore them.
270  double const t = 0;
271  double const dt = 1;
272  time_disc.nextTimestep(t, dt);
273  nonlinear_solver.calculateNonEquilibriumInitialResiduum(
274  process_solutions, process_solutions_prev,
275  process_data->process_id);
276  }
277 }
void INFO(char const *fmt, Args const &... args)
Definition: Logging.h:32
void setEquationSystem(NumLib::NonlinearSolverBase &nonlinear_solver, NumLib::EquationSystem &eq_sys, NumLib::ConvergenceCriterion &conv_crit, NumLib::NonlinearSolverTag nl_tag)
Definition: TimeLoop.cpp:25

References INFO(), and anonymous_namespace{TimeLoop.cpp}::setEquationSystem().

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

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

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

References DBUG(), MeshLib::Properties::existsPropertyVector(), MeshLib::Mesh::getName(), MeshLib::Mesh::getNodes(), NumLib::LocalToGlobalIndexMap::getNumberOfVariableComponents(), NumLib::LocalToGlobalIndexMap::getNumberOfVariables(), MeshLib::Mesh::getProperties(), 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, IntegrationMethod, GlobalDim >::HydroMechanicsLocalAssemblerFracture(), and ProcessLib::LIE::SmallDeformation::SmallDeformationLocalAssemblerFracture< ShapeFunction, IntegrationMethod, DisplacementDim >::SmallDeformationLocalAssemblerFracture().

◆ computeResiduum()

GlobalVector ProcessLib::computeResiduum ( GlobalVector const &  x,
GlobalVector const &  xdot,
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  matMult(M, xdot, residuum);
23  matMultAdd(K, x, residuum, residuum);
24  axpy(residuum, -1, b);
25  scale(residuum, -1);
26  return residuum;
27 }
Global vector based on Eigen vector.
Definition: EigenVector.h:26
void axpy(PETScVector &y, double const a, PETScVector const &x)
Definition: LinAlg.cpp:57
void scale(PETScVector &x, double const a)
Definition: LinAlg.cpp:44
void matMult(PETScMatrix const &A, PETScVector const &x, PETScVector &y)
Definition: LinAlg.cpp:141
void matMultAdd(PETScMatrix const &A, PETScVector const &v1, PETScVector const &v2, PETScVector &v3)
Definition: LinAlg.cpp:151

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

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

◆ createBHEInflowPythonBoundaryCondition()

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

Definition at line 96 of file BHEInflowPythonBoundaryCondition.h.

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

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 
)
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 35 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  {
47  OGS_FATAL(
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 (type == "Dirichlet")
58  {
60  config.config, config.boundary_mesh, dof_table, variable_id,
61  *config.component_id, parameters);
62  }
63  if (type == "DirichletWithinTimeInterval")
64  {
66  config.config, config.boundary_mesh, dof_table, variable_id,
67  *config.component_id, parameters);
68  }
69  if (type == "Neumann")
70  {
72  config.config, config.boundary_mesh, dof_table, variable_id,
73  *config.component_id, integration_order, shapefunction_order,
74  bulk_mesh.getDimension(), parameters);
75  }
76  if (type == "Robin")
77  {
79  config.config, config.boundary_mesh, dof_table, variable_id,
80  *config.component_id, integration_order, shapefunction_order,
81  bulk_mesh.getDimension(), parameters);
82  }
83  if (type == "VariableDependentNeumann")
84  {
86  config.config, config.boundary_mesh, dof_table, variable_id,
87  *config.component_id, integration_order, shapefunction_order,
88  bulk_mesh.getDimension(), parameters);
89  }
90 
91  if (type == "Python")
92  {
93 #ifdef OGS_USE_PYTHON
95  config.config, config.boundary_mesh, dof_table, bulk_mesh.getID(),
96  variable_id, *config.component_id, integration_order,
97  shapefunction_order, bulk_mesh.getDimension());
98 #else
99  OGS_FATAL("OpenGeoSys has not been built with Python support.");
100 #endif
101  }
102 
103  //
104  // Special boundary conditions
105  //
106  if (type == "ConstraintDirichlet")
107  {
109  config.config, config.boundary_mesh, dof_table, variable_id,
110  integration_order, *config.component_id, parameters, process);
111  }
112  if (type == "PrimaryVariableConstraintDirichlet")
113  {
115  config.config, config.boundary_mesh, dof_table, variable_id,
116  *config.component_id, parameters);
117  }
118  if (type == "SolutionDependentDirichlet")
119  {
121  config.config, config.boundary_mesh, dof_table, variable_id,
122  *config.component_id, parameters);
123  }
124  if (type == "HCNonAdvectiveFreeComponentFlowBoundary")
125  {
127  config.config, config.boundary_mesh, dof_table, variable_id,
128  *config.component_id, integration_order, parameters,
129  bulk_mesh.getDimension(), process, shapefunction_order);
130  }
131  if (type == "NormalTraction")
132  {
133  switch (bulk_mesh.getDimension())
134  {
135  case 2:
136  return ProcessLib::NormalTractionBoundaryCondition::
137  createNormalTractionBoundaryCondition<2>(
138  config.config, config.boundary_mesh, dof_table,
139  variable_id, integration_order, shapefunction_order,
140  parameters);
141  case 3:
142  return ProcessLib::NormalTractionBoundaryCondition::
143  createNormalTractionBoundaryCondition<3>(
144  config.config, config.boundary_mesh, dof_table,
145  variable_id, integration_order, shapefunction_order,
146  parameters);
147  default:
148  OGS_FATAL(
149  "NormalTractionBoundaryCondition can not be instantiated "
150  "for mesh dimensions other than two or three. "
151  "{}-dimensional mesh was given.",
152  bulk_mesh.getDimension());
153  }
154  }
155  if (type == "PhaseFieldIrreversibleDamageOracleBoundaryCondition")
156  {
157  return ProcessLib::
160  config.config, dof_table, bulk_mesh, variable_id,
161  *config.component_id);
162  }
163  OGS_FATAL("Unknown boundary condition type: `{:s}'.", type);
164 }
bool isAxiallySymmetric() const
Definition: Mesh.h:126
unsigned getDimension() const
Returns the dimension of the mesh (determined by the maximum dimension over all elements).
Definition: Mesh.h:71
std::size_t getID() const
Get id of the mesh.
Definition: Mesh.h:110
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< 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< 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< 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< HCNonAdvectiveFreeComponentFlowBoundaryCondition > createHCNonAdvectiveFreeComponentFlowBoundaryCondition(BaseLib::ConfigTree const &config, MeshLib::Mesh const &bc_mesh, NumLib::LocalToGlobalIndexMap const &dof_table, int const variable_id, int const component_id, unsigned const integration_order, std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const &parameters, unsigned const global_dim, Process const &process, unsigned const shapefunction_order)
std::unique_ptr< PythonBoundaryCondition > createPythonBoundaryCondition(BaseLib::ConfigTree const &config, MeshLib::Mesh const &boundary_mesh, NumLib::LocalToGlobalIndexMap const &dof_table, std::size_t bulk_mesh_id, int const variable_id, int const component_id, unsigned const integration_order, unsigned const shapefunction_order, unsigned const global_dim)
Creates a new PythonBoundaryCondition object.
std::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< 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)
std::unique_ptr< VariableDependentNeumannBoundaryCondition > createVariableDependentNeumannBoundaryCondition(BaseLib::ConfigTree const &config, MeshLib::Mesh const &bc_mesh, NumLib::LocalToGlobalIndexMap const &dof_table, int const variable_id, int const component_id, unsigned const integration_order, unsigned const shapefunction_order, unsigned const global_dim, std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const &parameters)
std::unique_ptr< NeumannBoundaryCondition > createNeumannBoundaryCondition(BaseLib::ConfigTree const &config, MeshLib::Mesh const &bc_mesh, NumLib::LocalToGlobalIndexMap const &dof_table, int const variable_id, int const component_id, unsigned const integration_order, unsigned const shapefunction_order, unsigned const global_dim, std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const &parameters)
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)

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::getID(), 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 148 of file CentralDifferencesJacobianAssembler.cpp.

149 {
151  config.checkConfigParameter("type", "CentralDifferences");
152 
153  // TODO make non-optional.
155  auto rel_eps = config.getConfigParameterOptional<std::vector<double>>(
156  "relative_epsilons");
158  auto comp_mag = config.getConfigParameterOptional<std::vector<double>>(
159  "component_magnitudes");
160 
161  if (!!rel_eps != !!comp_mag)
162  {
163  OGS_FATAL(
164  "Either both or none of <relative_epsilons> and "
165  "<component_magnitudes> have to be specified.");
166  }
167 
168  std::vector<double> abs_eps;
169 
170  if (rel_eps)
171  {
172  if (rel_eps->size() != comp_mag->size())
173  {
174  OGS_FATAL(
175  "The numbers of components of <relative_epsilons> and "
176  "<component_magnitudes> do not match.");
177  }
178 
179  abs_eps.resize(rel_eps->size());
180  for (std::size_t i = 0; i < rel_eps->size(); ++i)
181  {
182  abs_eps[i] = (*rel_eps)[i] * (*comp_mag)[i];
183  }
184  }
185  else
186  {
187  // By default 1e-8 is used as epsilon for all components.
188  // TODO: remove this default value.
189  abs_eps.emplace_back(1e-8);
190  }
191 
192  return std::make_unique<CentralDifferencesJacobianAssembler>(
193  std::move(abs_eps));
194 }

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

402 {
403  // TODO doc script corner case: Parameter could occur at different
404  // locations.
406  config.checkConfigParameter("type", "CompareJacobians");
407 
408  auto asm1 =
410  createJacobianAssembler(config.getConfigSubtree("jacobian_assembler"));
411 
412  auto asm2 = createJacobianAssembler(
414  config.getConfigSubtree("reference_jacobian_assembler"));
415 
417  auto const abs_tol = config.getConfigParameter<double>("abs_tol");
419  auto const rel_tol = config.getConfigParameter<double>("rel_tol");
420 
422  auto const fail_on_error = config.getConfigParameter<bool>("fail_on_error");
423 
425  auto const log_file = config.getConfigParameter<std::string>("log_file");
426 
427  return std::make_unique<CompareJacobiansJacobianAssembler>(
428  std::move(asm1), std::move(asm2), abs_tol, rel_tol, fail_on_error,
429  log_file);
430 }
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 229 of file ConstraintDirichletBoundaryCondition.cpp.

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

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

std::unique_ptr<DeactivatedSubdomain const> 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 172 of file CreateDeactivatedSubdomain.cpp.

178 {
179  auto const& time_interval_config =
181  config.getConfigSubtreeOptional("time_interval");
182 
183  auto const& curve_name =
185  config.getConfigParameterOptional<std::string>("time_curve");
186  auto time_interval =
187  parseTimeIntervalOrCurve(time_interval_config, curve_name, curves);
188 
189  auto const line_segment_config =
191  config.getConfigSubtreeOptional("line_segment");
192 
193  if (time_interval_config && line_segment_config)
194  {
195  OGS_FATAL(
196  "When using time interval for subdomain deactivation a line "
197  "segment must not be specified.");
198  }
199 
200  if (curve_name && !line_segment_config)
201  {
202  OGS_FATAL(
203  "When using curve for subdomain deactivation a line segment must "
204  "be specified.");
205  }
206 
207  // If time interval was specified then a dummy line segment is used
208  // *internally* because the whole selected material ids subdomain will be
209  // deactivated.
210  std::pair line_segment{Eigen::Vector3d{0, 0, 0}, Eigen::Vector3d{1, 1, 1}};
211 
212  if (curve_name)
213  {
214  line_segment = parseLineSegment(*line_segment_config);
215  }
216 
217  ParameterLib::Parameter<double>* boundary_value_parameter = nullptr;
218  auto boundary_value_parameter_name =
220  config.getConfigParameterOptional<std::string>("boundary_parameter");
221  if (boundary_value_parameter_name)
222  {
223  DBUG("Using parameter {:s}", *boundary_value_parameter_name);
224  boundary_value_parameter = &ParameterLib::findParameter<double>(
225  *boundary_value_parameter_name, parameters, 1, &mesh);
226  }
227 
228  auto deactivated_subdomain_material_ids =
230  config.getConfigParameter("material_ids", std::vector<int>{});
231 
232  if (deactivated_subdomain_material_ids.empty())
233  {
234  OGS_FATAL(
235  "The material IDs of the deactivated subdomains are not given. The "
236  "program terminates now.");
237  }
238 
239  std::sort(deactivated_subdomain_material_ids.begin(),
240  deactivated_subdomain_material_ids.end());
241 
242  auto const* const material_ids = materialIDs(mesh);
243  if (material_ids == nullptr)
244  {
245  OGS_FATAL(
246  "The mesh doesn't contain materialIDs for subdomain deactivation. "
247  "The program terminates now.");
248  }
249 
250  std::vector<std::unique_ptr<DeactivatedSubdomainMesh>>
251  deactivated_subdomain_meshes;
252  deactivated_subdomain_meshes.reserve(
253  deactivated_subdomain_material_ids.size());
254 
255  std::transform(begin(deactivated_subdomain_material_ids),
256  end(deactivated_subdomain_material_ids),
257  back_inserter(deactivated_subdomain_meshes),
258  [&](std::size_t const id)
259  { return createDeactivatedSubdomainMesh(mesh, id); });
260 
261  return std::make_unique<DeactivatedSubdomain const>(
262  std::move(time_interval),
263  line_segment,
264  std::move(deactivated_subdomain_material_ids),
265  std::move(deactivated_subdomain_meshes),
266  boundary_value_parameter);
267 }
PropertyVector< int > const * materialIDs(Mesh const &mesh)
Definition: Mesh.cpp:258
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)
static std::unique_ptr< DeactivatedSubdomainMesh > createDeactivatedSubdomainMesh(MeshLib::Mesh const &mesh, int const material_id)

References createDeactivatedSubdomainMesh(), DBUG(), BaseLib::ConfigTree::getConfigParameter(), BaseLib::ConfigTree::getConfigParameterOptional(), BaseLib::ConfigTree::getConfigSubtreeOptional(), MeshLib::materialIDs(), OGS_FATAL, parseLineSegment(), and parseTimeIntervalOrCurve().

Referenced by createDeactivatedSubdomains().

◆ createDeactivatedSubdomainMesh()

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

Definition at line 64 of file CreateDeactivatedSubdomain.cpp.

66 {
67  // An element is active if its material id matches the selected material id.
68  auto is_active = [material_id, material_ids = *materialIDs(mesh)](
69  MeshLib::Element const* const e)
70  { return material_id == material_ids[e->getID()]; };
71 
72  auto const& elements = mesh.getElements();
73  std::vector<MeshLib::Element*> deactivated_elements;
74  std::copy_if(begin(elements), end(elements),
75  back_inserter(deactivated_elements),
76  [&](auto const e) { return is_active(e); });
77 
78  // Subdomain mesh consisting of deactivated elements.
80  "deactivate_subdomain_" + std::to_string(material_id),
81  MeshLib::cloneElements(deactivated_elements));
82 
83  auto [inner_nodes, outer_nodes] =
84  extractInnerAndOuterNodes(mesh, *sub_mesh, is_active);
85  return std::make_unique<DeactivatedSubdomainMesh>(
86  std::move(sub_mesh), std::move(inner_nodes), std::move(outer_nodes));
87 }
std::unique_ptr< MeshLib::Mesh > createMeshFromElementSelection(std::string mesh_name, std::vector< MeshLib::Element * > const &elements)
Definition: Mesh.cpp:268
std::vector< Element * > cloneElements(std::vector< Element * > const &elements)
Clones a vector of elements using the Element::clone() function.
static std::pair< std::vector< MeshLib::Node * >, std::vector< MeshLib::Node * > > extractInnerAndOuterNodes(MeshLib::Mesh const &mesh, MeshLib::Mesh const &sub_mesh, IsActive is_active)

References MeshLib::cloneElements(), MeshLib::createMeshFromElementSelection(), extractInnerAndOuterNodes(), MeshLib::Mesh::getElements(), and MeshLib::materialIDs().

Referenced by createDeactivatedSubdomain().

◆ createDeactivatedSubdomains()

std::vector< std::unique_ptr< DeactivatedSubdomain const > > 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 270 of file CreateDeactivatedSubdomain.cpp.

277 {
278  std::vector<std::unique_ptr<DeactivatedSubdomain const>>
279  deactivated_subdomains;
280  // Deactivated subdomains
281  if (auto subdomains_config =
283  config.getConfigSubtreeOptional("deactivated_subdomains"))
284  {
285  INFO("There are subdomains being deactivated.");
286 
287  auto const deactivated_subdomain_configs =
289  subdomains_config->getConfigSubtreeList("deactivated_subdomain");
290  std::transform(begin(deactivated_subdomain_configs),
291  end(deactivated_subdomain_configs),
292  back_inserter(deactivated_subdomains),
293  [&](auto const& config) {
295  config, mesh, parameters, curves);
296  });
297  }
298  return deactivated_subdomains;
299 }
std::unique_ptr< DeactivatedSubdomain const > 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 57 of file DirichletBoundaryCondition.cpp.

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

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

◆ 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  {
36  OGS_FATAL(
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  {
50  OGS_FATAL(
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>(
56  "bulk_element_ids", MeshLib::MeshItemType::Cell, 1);
57  auto const bulk_face_ids =
58  bc_mesh.getProperties().template getPropertyVector<std::size_t>(
59  "bulk_face_ids", MeshLib::MeshItemType::Cell, 1);
60 
61  // In case of partitioned mesh the boundary could be empty, i.e. there is no
62  // boundary condition.
63 #ifdef USE_PETSC
64  // This can be extracted to createBoundaryCondition() but then the config
65  // parameters are not read and will cause an error.
66  // TODO (naumov): Add a function to ConfigTree for skipping the tags of the
67  // subtree and move the code up in createBoundaryCondition().
68  if (bc_mesh.getDimension() == 0 && bc_mesh.getNumberOfNodes() == 0 &&
69  bc_mesh.getNumberOfElements() == 0)
70  {
71  return nullptr;
72  }
73 #endif // USE_PETSC
74 
75  return std::make_unique<HCNonAdvectiveFreeComponentFlowBoundaryCondition>(
76  integration_order, shapefunction_order, dof_table, variable_id,
77  component_id, global_dim, bc_mesh,
78  HCNonAdvectiveFreeComponentFlowBoundaryConditionData{
79  boundary_permeability, *bulk_face_ids, *bulk_element_ids, process});
80 }

References MeshLib::Cell, BaseLib::ConfigTree::checkConfigParameter(), DBUG(), 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 20 of file CreateJacobianAssembler.cpp.

22 {
23  if (!config)
24  {
25  return std::make_unique<AnalyticalJacobianAssembler>();
26  }
27 
29  auto const type = config->peekConfigParameter<std::string>("type");
30 
31  if (type == "Analytical")
32  {
33  config->ignoreConfigParameter("type");
34  return std::make_unique<AnalyticalJacobianAssembler>();
35  }
36  if (type == "CentralDifferences")
37  {
39  }
40  if (type == "CompareJacobians")
41  {
43  }
44 
45  OGS_FATAL("Unknown Jacobian assembler type: `{:s}'.", type);
46 }
std::unique_ptr< CompareJacobiansJacobianAssembler > createCompareJacobiansJacobianAssembler(BaseLib::ConfigTree const &config)
std::unique_ptr< CentralDifferencesJacobianAssembler > createCentralDifferencesJacobianAssembler(BaseLib::ConfigTree const &config)

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

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

◆ createLocalAssemblers() [1/2]

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

Creates local assemblers for each element of the given mesh.

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

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

Definition at line 64 of file CreateLocalAssemblers.h.

71 {
72  DBUG("Create local assemblers.");
73 
74  switch (dimension)
75  {
76  case 1:
77  createLocalAssemblers<1, LocalAssemblerImplementation>(
78  dof_table, shapefunction_order, mesh_elements, local_assemblers,
79  std::forward<ExtraCtorArgs>(extra_ctor_args)...);
80  break;
81  case 2:
82  createLocalAssemblers<2, LocalAssemblerImplementation>(
83  dof_table, shapefunction_order, mesh_elements, local_assemblers,
84  std::forward<ExtraCtorArgs>(extra_ctor_args)...);
85  break;
86  case 3:
87  createLocalAssemblers<3, LocalAssemblerImplementation>(
88  dof_table, shapefunction_order, mesh_elements, local_assemblers,
89  std::forward<ExtraCtorArgs>(extra_ctor_args)...);
90  break;
91  default:
92  OGS_FATAL(
93  "Meshes with dimension greater than three are not supported.");
94  }
95 }

References DBUG(), and OGS_FATAL.

◆ createLocalAssemblers() [2/2]

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

Definition at line 23 of file CreateLocalAssemblers.h.

29 {
30  static_assert(
31  GlobalDim == 1 || GlobalDim == 2 || GlobalDim == 3,
32  "Meshes with dimension greater than three are not supported.");
33  // Shape matrices initializer
34  using LocalDataInitializer =
35  LocalDataInitializer<LocalAssemblerInterface,
36  LocalAssemblerImplementation, GlobalDim,
37  ExtraCtorArgs...>;
38 
39  DBUG("Create local assemblers.");
40  // Populate the vector of local assemblers.
41  local_assemblers.resize(mesh_elements.size());
42 
43  LocalDataInitializer initializer(dof_table, shapefunction_order);
44 
45  DBUG("Calling local assembler builder for all mesh elements.");
47  initializer, mesh_elements, local_assemblers,
48  std::forward<ExtraCtorArgs>(extra_ctor_args)...);
49 }
static void transformDereferenced(F const &f, C const &c, Data &data, Args_ &&... args)

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

◆ 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  {
62  OGS_FATAL(
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()

std::unique_ptr< Output > ProcessLib::createOutput ( const BaseLib::ConfigTree config,
std::string const &  output_directory,
std::vector< std::unique_ptr< MeshLib::Mesh >> const &  meshes 
)
Input File Parameter:
prj__time_loop__output__type
Input File Parameter:
prj__time_loop__output__prefix
Input File Parameter:
prj__time_loop__output__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__data_mode
Input File Parameter:
prj__time_loop__output__timesteps
Input File Parameter:
prj__time_loop__output__timesteps__pair
Input File Parameter:
prj__time_loop__output__timesteps__pair__repeat
Input File Parameter:
prj__time_loop__output__timesteps__pair__each_steps
Input File Parameter:
prj__time_loop__output__variables
Input File Parameter:
prj__time_loop__output__variables__variable
Input File Parameter:
prj__time_loop__output__output_extrapolation_residuals
Input File Parameter:
prj__time_loop__output__meshes
Input File Parameter:
prj__time_loop__output__meshes__mesh
Input File Parameter:
prj__time_loop__output__fixed_output_times
Input File Parameter:
prj__time_loop__output__output_iteration_results

Definition at line 25 of file CreateOutput.cpp.

29 {
30  DBUG("Parse output configuration:");
31  OutputType const output_type = [](auto output_type)
32  {
33  try
34  {
35  const std::map<std::string, OutputType> outputType_to_enum = {
36  {"VTK", OutputType::vtk}, {"XDMF", OutputType::xdmf}};
37  auto type = outputType_to_enum.at(output_type);
38 
39  return type;
40  }
41  catch (std::out_of_range&)
42  {
43  OGS_FATAL(
44  "No supported file type provided. Read `{:s}' from <output><type> \
45  in prj File. Supported: VTK, XDMF.",
46  output_type);
47  }
49  }(config.getConfigParameter<std::string>("type"));
50 
51  auto const prefix =
53  config.getConfigParameter<std::string>("prefix", "{:meshname}");
54 
55  auto const suffix =
57  config.getConfigParameter<std::string>("suffix",
58  "_ts_{:timestep}_t_{:time}");
59 
60  auto const compress_output =
62  config.getConfigParameter("compress_output", true);
63 
64  auto const hdf =
66  config.getConfigSubtreeOptional("hdf");
67 
68  auto number_of_files = [&hdf]() -> unsigned int
69  {
70  if (hdf)
71  {
73  return hdf->getConfigParameter<unsigned int>("number_of_files");
74  }
75  else
76  {
77  return 1;
78  }
79  }();
80 
81  auto const data_mode =
83  config.getConfigParameter<std::string>("data_mode", "Appended");
84 
85  // Construction of output times
86  std::vector<Output::PairRepeatEachSteps> repeats_each_steps;
87 
89  if (auto const timesteps = config.getConfigSubtreeOptional("timesteps"))
90  {
92  for (auto pair : timesteps->getConfigSubtreeList("pair"))
93  {
95  auto repeat = pair.getConfigParameter<unsigned>("repeat");
97  auto each_steps = pair.getConfigParameter<unsigned>("each_steps");
98 
99  assert(repeat != 0 && each_steps != 0);
100  repeats_each_steps.emplace_back(repeat, each_steps);
101  }
102 
103  if (repeats_each_steps.empty())
104  {
105  OGS_FATAL(
106  "You have not given any pair (<repeat/>, <each_steps/>) that "
107  "defines at which timesteps output shall be written. "
108  "Aborting.");
109  }
110  }
111  else
112  {
113  repeats_each_steps.emplace_back(1, 1);
114  }
115 
117  auto const out_vars = config.getConfigSubtree("variables");
118 
119  std::set<std::string> output_variables;
120  for (auto out_var :
122  out_vars.getConfigParameterList<std::string>("variable"))
123  {
124  if (output_variables.find(out_var) != output_variables.cend())
125  {
126  OGS_FATAL("output variable `{:s}' specified more than once.",
127  out_var);
128  }
129 
130  DBUG("adding output variable `{:s}'", out_var);
131  output_variables.insert(out_var);
132  }
133 
135  bool const output_residuals = config.getConfigParameter<bool>(
136  "output_extrapolation_residuals", false);
137 
138  OutputDataSpecification output_data_specification{output_variables,
139  output_residuals};
140 
141  std::vector<std::string> mesh_names_for_output;
143  if (auto const meshes_config = config.getConfigSubtreeOptional("meshes"))
144  {
145  if (prefix.find("{:meshname}") == std::string::npos)
146  {
147  OGS_FATAL(
148  "There are multiple meshes defined in the output section of "
149  "the project file, but the prefix doesn't contain "
150  "'{{:meshname}}'. Thus the names for the files, the simulation "
151  "results should be written to, would not be distinguishable "
152  "for different meshes.");
153  }
155  for (auto mesh_config : meshes_config->getConfigParameterList("mesh"))
156  {
157  mesh_names_for_output.push_back(
158  mesh_config.getValue<std::string>());
159  INFO("Configure mesh '{:s}' for output.",
160  mesh_names_for_output.back());
161  }
162  }
163 
164  std::vector<double> fixed_output_times =
166  config.getConfigParameter<std::vector<double>>("fixed_output_times",
167  {});
168  // Remove possible duplicated elements and sort.
169  BaseLib::makeVectorUnique(fixed_output_times);
170 
171  bool const output_iteration_results =
173  config.getConfigParameter<bool>("output_iteration_results", false);
174 
175  return std::make_unique<Output>(
176  output_directory, output_type, prefix, suffix, compress_output,
177  number_of_files, data_mode, output_iteration_results,
178  std::move(repeats_each_steps), std::move(fixed_output_times),
179  std::move(output_data_specification), std::move(mesh_names_for_output),
180  meshes);
181 }
OutputType
std::optional< ConfigTree > getConfigSubtreeOptional(std::string const &root) const
Definition: ConfigTree.cpp:155
T getConfigParameter(std::string const &param) const
ConfigTree getConfigSubtree(std::string const &root) const
Definition: ConfigTree.cpp:146
void makeVectorUnique(std::vector< T > &v)
Definition: Algorithm.h:209

References DBUG(), BaseLib::ConfigTree::getConfigParameter(), BaseLib::ConfigTree::getConfigSubtree(), BaseLib::ConfigTree::getConfigSubtreeOptional(), INFO(), BaseLib::makeVectorUnique(), OGS_FATAL, vtk, and xdmf.

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 
)
Input File Parameter:
prj__time_loop__processes__process
Input File Parameter:
prj__time_loop__processes__process__ref
Input File Parameter:
prj__time_loop__processes__process__nonlinear_solver
Input File Parameter:
prj__time_loop__processes__process__time_discretization
Input File Parameter:
prj__time_loop__processes__process__time_stepping
Input File Parameter:
prj__time_loop__processes__process__convergence_criterion
Input File Parameter:
prj__time_loop__processes__process__compensate_non_equilibrium_initial_residuum
Input File Parameter:
prj__time_loop__processes__process__output

Definition at line 65 of file CreateProcessData.cpp.

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

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

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

◆ createPythonBoundaryCondition()

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

Creates a new PythonBoundaryCondition object.

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

Definition at line 168 of file PythonBoundaryCondition.cpp.

174 {
176  config.checkConfigParameter("type", "Python");
177 
179  auto const bc_object = config.getConfigParameter<std::string>("bc_object");
181  auto const flush_stdout = config.getConfigParameter("flush_stdout", false);
182 
183  // Evaluate Python code in scope of main module
184  pybind11::object scope =
185  pybind11::module::import("__main__").attr("__dict__");
186 
187  if (!scope.contains(bc_object))
188  {
189  OGS_FATAL(
190  "Function `{:s}' is not defined in the python script file, or "
191  "there was no python script file specified.",
192  bc_object);
193  }
194 
195  auto* bc = scope[bc_object.c_str()]
196  .cast<PythonBoundaryConditionPythonSideInterface*>();
197 
198  if (variable_id >= static_cast<int>(dof_table.getNumberOfVariables()) ||
199  component_id >= dof_table.getNumberOfVariableComponents(variable_id))
200  {
201  OGS_FATAL(
202  "Variable id or component id too high. Actual values: ({:d}, "
203  "{:d}), maximum values: ({:d}, {:d}).",
204  variable_id, component_id, dof_table.getNumberOfVariables(),
205  dof_table.getNumberOfVariableComponents(variable_id));
206  }
207 
208  // In case of partitioned mesh the boundary could be empty, i.e. there is no
209  // boundary condition.
210 #ifdef USE_PETSC
211  // This can be extracted to createBoundaryCondition() but then the config
212  // parameters are not read and will cause an error.
213  // TODO (naumov): Add a function to ConfigTree for skipping the tags of the
214  // subtree and move the code up in createBoundaryCondition().
215  if (boundary_mesh.getDimension() == 0 &&
216  boundary_mesh.getNumberOfNodes() == 0 &&
217  boundary_mesh.getNumberOfElements() == 0)
218  {
219  return nullptr;
220  }
221 #endif // USE_PETSC
222 
223  return std::make_unique<PythonBoundaryCondition>(
224  PythonBoundaryConditionData{
225  bc, dof_table, bulk_mesh_id,
226  dof_table.getGlobalComponent(variable_id, component_id),
227  boundary_mesh},
228  integration_order, shapefunction_order, global_dim, flush_stdout);
229 }

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

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

References BaseLib::ConfigTree::checkConfigParameter(), DBUG(), BaseLib::ConfigTree::getConfigParameter(), MeshLib::Mesh::getDimension(), MeshLib::Mesh::getID(), 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  {
30  OGS_FATAL(
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 MaterialPropertyLib::alpha, 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 WARN(char const *fmt, Args const &... args)
Definition: Logging.h:37

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::createThermoRichardsMechanicsProcess(), 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 
)
Input File Parameter:
prj__process_variables__process_variable__source_terms__source_term__type

Definition at line 23 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  {
39  OGS_FATAL(
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>("bulk_node_ids"))
49  {
50  OGS_FATAL(
51  "The required bulk node ids map does not exist in the source term "
52  "mesh '{:s}'.",
53  source_term_mesh.getName());
54  }
55  std::vector<MeshLib::Node*> const& source_term_nodes =
56  source_term_mesh.getNodes();
57  DBUG(
58  "Found {:d} nodes for source term at mesh '{:s}' for the variable {:d} "
59  "and component {:d}",
60  source_term_nodes.size(), source_term_mesh.getName(), variable_id,
61  *config.component_id);
62 
63  MeshLib::MeshSubset source_term_mesh_subset(source_term_mesh,
64  source_term_nodes);
65 
66  if (type == "Nodal")
67  {
68  std::unique_ptr<NumLib::LocalToGlobalIndexMap> dof_table_source_term(
69  dof_table_bulk.deriveBoundaryConstrainedMap(
70  variable_id, {*config.component_id},
71  std::move(source_term_mesh_subset)));
73  config.config, config.mesh, std::move(dof_table_source_term),
74  source_term_mesh.getID(), variable_id, *config.component_id,
75  parameters);
76  }
77 
78  if (type == "Line" || type == "Volumetric")
79  {
80  std::unique_ptr<NumLib::LocalToGlobalIndexMap> dof_table_source_term(
81  dof_table_bulk.deriveBoundaryConstrainedMap(
82  variable_id, {*config.component_id},
83  std::move(source_term_mesh_subset)));
84  auto const& bulk_mesh_dimension =
85  dof_table_bulk.getMeshSubset(variable_id, *config.component_id)
86  .getMesh()
87  .getDimension();
89  config.config, bulk_mesh_dimension, config.mesh,
90  std::move(dof_table_source_term), parameters, integration_order,
91  shapefunction_order);
92  }
93 
94  if (type == "Python")
95  {
96 #ifdef OGS_USE_PYTHON
97  std::unique_ptr<NumLib::LocalToGlobalIndexMap> 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 #else
106  OGS_FATAL("OpenGeoSys has not been built with Python support.");
107 #endif
108  }
109 
110  OGS_FATAL("Unknown source term type: `{:s}'.", type);
111 }
A subset of nodes on a single mesh.
Definition: MeshSubset.h:27
Mesh const & getMesh() const
Definition: MeshSubset.h:106
std::vector< Node * > const & getNodes() const
Get the nodes-vector for the mesh.
Definition: Mesh.h:95
int getNumberOfVariableComponents(int variable_id) const
MeshLib::MeshSubset const & getMeshSubset(int const variable_id, int const component_id) const
LocalToGlobalIndexMap * deriveBoundaryConstrainedMap(int const variable_id, std::vector< int > const &component_ids, MeshLib::MeshSubset &&new_mesh_subset) 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::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)
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)

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

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

◆ createTimeLoop()

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

Builds a TimeLoop from the given configuration.

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

Definition at line 21 of file CreateTimeLoop.cpp.

27 {
28  auto const& coupling_config
30  = config.getConfigSubtreeOptional("global_process_coupling");
31 
32  std::vector<std::unique_ptr<NumLib::ConvergenceCriterion>>
33  global_coupling_conv_criteria;
34  int max_coupling_iterations = 1;
35  if (coupling_config)
36  {
37  max_coupling_iterations
39  = coupling_config->getConfigParameter<int>("max_iter");
40 
41  auto const& coupling_convergence_criteria_config =
43  coupling_config->getConfigSubtree("convergence_criteria");
44 
45  for (
46  auto coupling_convergence_criterion_config :
48  coupling_convergence_criteria_config.getConfigSubtreeList(
49  "convergence_criterion"))
50  {
51  global_coupling_conv_criteria.push_back(
53  coupling_convergence_criterion_config));
54  }
55  }
56 
57  auto output =
59  createOutput(config.getConfigSubtree("output"), output_directory,
60  meshes);
61 
62  auto per_process_data = createPerProcessData(
64  config.getConfigSubtree("processes"), processes, nonlinear_solvers);
65 
66  if (coupling_config)
67  {
68  if (global_coupling_conv_criteria.size() != per_process_data.size())
69  {
70  OGS_FATAL(
71  "The number of convergence criteria of the global staggered "
72  "coupling loop is not identical to the number of the "
73  "processes! Please check the element by tag "
74  "global_process_coupling in the project file.");
75  }
76  }
77 
78  const auto minmax_iter = std::minmax_element(
79  per_process_data.begin(),
80  per_process_data.end(),
81  [](std::unique_ptr<ProcessData> const& a,
82  std::unique_ptr<ProcessData> const& b)
83  { return (a->timestepper->end() < b->timestepper->end()); });
84  const double start_time =
85  per_process_data[minmax_iter.first - per_process_data.begin()]
86  ->timestepper->begin();
87  const double end_time =
88  per_process_data[minmax_iter.second - per_process_data.begin()]
89  ->timestepper->end();
90 
91  return std::make_unique<TimeLoop>(
92  std::move(output), std::move(per_process_data), max_coupling_iterations,
93  std::move(global_coupling_conv_criteria), start_time, end_time);
94 }
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)
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)

References NumLib::createConvergenceCriterion(), createOutput(), createPerProcessData(), BaseLib::ConfigTree::getConfigSubtree(), BaseLib::ConfigTree::getConfigSubtreeOptional(), 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  {
30  OGS_FATAL(
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  {
38  OGS_FATAL(
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 const& 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, dof_table_boundary_other_variable});
101 }

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

◆ extractInnerAndOuterNodes()

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

Definition at line 27 of file CreateDeactivatedSubdomain.cpp.

30 {
31  auto* const bulk_node_ids =
32  sub_mesh.getProperties().template getPropertyVector<std::size_t>(
33  "bulk_node_ids", MeshLib::MeshItemType::Node, 1);
34  if (bulk_node_ids == nullptr)
35  {
36  OGS_FATAL(
37  "Bulk node ids map is not available in the deactivate subdomain "
38  "mesh.");
39  }
40 
41  std::vector<MeshLib::Node*> inner_nodes;
42  // Reserve for more than needed, but not much, because almost all nodes will
43  // be the inner nodes.
44  inner_nodes.reserve(sub_mesh.getNumberOfNodes());
45 
46  std::vector<MeshLib::Node*> outer_nodes;
47 
48  std::partition_copy(
49  begin(sub_mesh.getNodes()), end(sub_mesh.getNodes()),
50  back_inserter(inner_nodes), back_inserter(outer_nodes),
51  [&](MeshLib::Node* const n)
52  {
53  auto const bulk_node = mesh.getNode((*bulk_node_ids)[n->getID()]);
54  const auto& connected_elements =
55  mesh.getElementsConnectedToNode(*bulk_node);
56  // elements. Then it is an inner node, and outer otherwise.
57  return std::all_of(begin(connected_elements),
58  end(connected_elements), is_active);
59  });
60 
61  return {std::move(inner_nodes), std::move(outer_nodes)};
62 }
std::size_t getID() const
Definition: Point3dWithID.h:62

References MeshLib::Mesh::getElementsConnectedToNode(), MathLib::Point3dWithID::getID(), MeshLib::Mesh::getNode(), MeshLib::Mesh::getNodes(), MeshLib::Mesh::getNumberOfNodes(), MeshLib::Mesh::getProperties(), MeshLib::Node, 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 45 of file ProcessUtils.cpp.

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

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

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

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

References DBUG().

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::createThermoRichardsMechanicsProcess(), ProcessLib::TwoPhaseFlowWithPP::createTwoPhaseFlowWithPPProcess(), and ProcessLib::TwoPhaseFlowWithPrho::createTwoPhaseFlowWithPrhoProcess().

◆ findProcessVariables() [2/2]

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

Definition at line 76 of file ProcessUtils.cpp.

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

References anonymous_namespace{ProcessUtils.cpp}::findVariableByName(), 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 32 of file CoupledSolutionsForStaggeredScheme.cpp.

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

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

◆ getEssentialBCValuesLocal()

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

Definition at line 58 of file DirichletBoundaryConditionAuxiliaryFunctions.cpp.

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

References NumLib::LocalToGlobalIndexMap::getGlobalIndex(), MeshLib::Mesh::getID(), 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(), and ProcessLib::SolutionDependentDirichletBoundaryCondition::getEssentialBCValues().

◆ getIntegrationPointDataMaterialStateVariables()

template<typename IntegrationPointData , typename MemberType , typename MaterialStateVariables >
std::vector<double> ProcessLib::getIntegrationPointDataMaterialStateVariables ( std::vector< IntegrationPointData, Eigen::aligned_allocator< IntegrationPointData >> const &  ip_data_vector,
MemberType  member,
std::function< BaseLib::DynamicSpan< double >(MaterialStateVariables &)>  get_values_span,
int const  n_components 
)

Definition at line 141 of file SetOrGetIntegrationPointData.h.

149 {
150  std::vector<double> result;
151  result.reserve(ip_data_vector.size() * n_components);
152 
153  for (auto& ip_data : ip_data_vector)
154  {
155  auto const values_span = get_values_span(*(ip_data.*member));
156  assert(values_span.size == static_cast<std::size_t>(n_components));
157 
158  result.insert(end(result), values_span.data,
159  values_span.data + values_span.size);
160  }
161 
162  return result;
163 }

Referenced by ProcessLib::RichardsMechanics::RichardsMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod, DisplacementDim >::getMaterialStateVariableInternalState().

◆ getIntegrationPointKelvinVectorData() [1/2]

template<int DisplacementDim, typename IntegrationPointData , typename MemberType >
std::vector<double> ProcessLib::getIntegrationPointKelvinVectorData ( std::vector< IntegrationPointData, Eigen::aligned_allocator< IntegrationPointData >> const &  ip_data,
MemberType  member 
)

Definition at line 51 of file SetOrGetIntegrationPointData.h.

55 {
56  constexpr int kelvin_vector_size =
58  auto const n_integration_points = ip_data.size();
59 
60  std::vector<double> ip_kelvin_vector_values;
61  auto cache_mat = MathLib::createZeroedMatrix<Eigen::Matrix<
62  double, Eigen::Dynamic, kelvin_vector_size, Eigen::RowMajor>>(
63  ip_kelvin_vector_values, n_integration_points, kelvin_vector_size);
64 
65  for (unsigned ip = 0; ip < n_integration_points; ++ip)
66  {
67  auto const& ip_member = ip_data[ip].*member;
68  cache_mat.row(ip) =
70  }
71 
72  return ip_kelvin_vector_values;
73 }
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:23
Eigen::Map< Matrix > createZeroedMatrix(std::vector< double > &data, Eigen::MatrixXd::Index rows, Eigen::MatrixXd::Index cols)
Definition: EigenMapTools.h:32

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

◆ getIntegrationPointKelvinVectorData() [2/2]

template<int DisplacementDim, typename IntegrationPointData , typename MemberType >
std::vector<double> const& ProcessLib::getIntegrationPointKelvinVectorData ( std::vector< IntegrationPointData, Eigen::aligned_allocator< IntegrationPointData >> const &  ip_data,
MemberType  member,
std::vector< double > &  cache 
)

Definition at line 25 of file SetOrGetIntegrationPointData.h.

29 {
30  constexpr int kelvin_vector_size =
32  auto const n_integration_points = ip_data.size();
33 
34  cache.clear();
35  auto cache_mat = MathLib::createZeroedMatrix<Eigen::Matrix<
36  double, kelvin_vector_size, Eigen::Dynamic, Eigen::RowMajor>>(
37  cache, kelvin_vector_size, n_integration_points);
38 
39  for (unsigned ip = 0; ip < n_integration_points; ++ip)
40  {
41  auto const& kelvin_vector = ip_data[ip].*member;
42  cache_mat.col(ip) =
44  }
45 
46  return cache;
47 }

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

◆ getIntegrationPointMetaData()

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

Returns integration point meta data for the given field name.

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

Definition at line 108 of file IntegrationPointWriter.cpp.

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

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

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

◆ getIntegrationPointScalarData()

template<typename IntegrationPointData , typename MemberType >
std::vector<double> const& ProcessLib::getIntegrationPointScalarData ( std::vector< IntegrationPointData, Eigen::aligned_allocator< IntegrationPointData >> const &  ip_data,
MemberType  member,
std::vector< double > &  cache 
)

Definition at line 103 of file SetOrGetIntegrationPointData.h.

107 {
108  auto const n_integration_points = ip_data.size();
109 
110  cache.clear();
111  auto cache_mat = MathLib::createZeroedMatrix<
112  Eigen::Matrix<double, 1, Eigen::Dynamic, Eigen::RowMajor>>(
113  cache, 1, n_integration_points);
114 
115  for (unsigned ip = 0; ip < n_integration_points; ++ip)
116  {
117  cache_mat[ip] = ip_data[ip].*member;
118  }
119 
120  return cache;
121 }

References MathLib::createZeroedMatrix().

Referenced by ProcessLib::SmallDeformationNonlocal::SmallDeformationNonlocalLocalAssembler< ShapeFunction, IntegrationMethod, DisplacementDim >::getIntPtDamage(), ProcessLib::RichardsMechanics::RichardsMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod, DisplacementDim >::getIntPtDryDensitySolid(), ProcessLib::ThermoRichardsFlow::ThermoRichardsFlowLocalAssembler< ShapeFunction, IntegrationMethod, GlobalDim >::getIntPtDryDensitySolid(), ProcessLib::ThermoRichardsMechanics::ThermoRichardsMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunction, IntegrationMethod, DisplacementDim >::getIntPtDryDensitySolid(), ProcessLib::TH2M::TH2MLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod, DisplacementDim >::getIntPtEnthalpyGas(), ProcessLib::TH2M::TH2MLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod, DisplacementDim >::getIntPtEnthalpyLiquid(), ProcessLib::TH2M::TH2MLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod, DisplacementDim >::getIntPtEnthalpySolid(), ProcessLib::TH2M::TH2MLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod, DisplacementDim >::getIntPtGasDensity(), ProcessLib::TH2M::TH2MLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod, DisplacementDim >::getIntPtLiquidDensity(), ProcessLib::TH2M::TH2MLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod, DisplacementDim >::getIntPtMassFractionGas(), ProcessLib::TH2M::TH2MLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod, DisplacementDim >::getIntPtMassFractionLiquid(), ProcessLib::RichardsMechanics::RichardsMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod, DisplacementDim >::getIntPtMicroPressure(), ProcessLib::RichardsMechanics::RichardsMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod, DisplacementDim >::getIntPtMicroSaturation(), ProcessLib::TH2M::TH2MLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod, DisplacementDim >::getIntPtMoleFractionGas(), ProcessLib::RichardsMechanics::RichardsMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod, DisplacementDim >::getIntPtPorosity(), ProcessLib::ThermoRichardsFlow::ThermoRichardsFlowLocalAssembler< ShapeFunction, IntegrationMethod, GlobalDim >::getIntPtPorosity(), ProcessLib::ThermoRichardsMechanics::ThermoRichardsMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunction, IntegrationMethod, DisplacementDim >::getIntPtPorosity(), ProcessLib::TH2M::TH2MLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod, DisplacementDim >::getIntPtPorosity(), ProcessLib::TH2M::TH2MLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod, DisplacementDim >::getIntPtRelativePermeabilityGas(), ProcessLib::TH2M::TH2MLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod, DisplacementDim >::getIntPtRelativePermeabilityLiquid(), ProcessLib::RichardsMechanics::RichardsMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod, DisplacementDim >::getIntPtSaturation(), ProcessLib::ThermoRichardsFlow::ThermoRichardsFlowLocalAssembler< ShapeFunction, IntegrationMethod, GlobalDim >::getIntPtSaturation(), ProcessLib::ThermoRichardsMechanics::ThermoRichardsMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunction, IntegrationMethod, DisplacementDim >::getIntPtSaturation(), ProcessLib::TH2M::TH2MLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod, DisplacementDim >::getIntPtSaturation(), ProcessLib::TH2M::TH2MLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod, DisplacementDim >::getIntPtSolidDensity(), ProcessLib::RichardsMechanics::RichardsMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod, DisplacementDim >::getIntPtTransportPorosity(), ProcessLib::ThermoRichardsMechanics::ThermoRichardsMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunction, IntegrationMethod, DisplacementDim >::getIntPtTransportPorosity(), and ProcessLib::TH2M::TH2MLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod, DisplacementDim >::getIntPtVapourPressure().

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

170 {
171  auto const eval_field =
172  [num_components, &extrapolator, &local_assemblers,
173  integration_point_values_method](
174  const double t,
175  std::vector<GlobalVector*> const& x,
176  std::vector<NumLib::LocalToGlobalIndexMap const*> const& dof_table,
177  std::unique_ptr<GlobalVector> & /*result_cache*/
178  ) -> GlobalVector const& {
179  auto const extrapolatables = NumLib::makeExtrapolatable(
180  local_assemblers, integration_point_values_method);
181  extrapolator.extrapolate(num_components, extrapolatables, t, x,
182  dof_table);
183  return extrapolator.getNodalValues();
184  };
185 
186  auto const eval_residuals =
187  [num_components, &extrapolator, &local_assemblers,
188  integration_point_values_method](
189  const double t,
190  std::vector<GlobalVector*> const& x,
191  std::vector<NumLib::LocalToGlobalIndexMap const*> const& dof_table,
192  std::unique_ptr<GlobalVector> & /*result_cache*/
193  ) -> GlobalVector const& {
194  auto const extrapolatables = NumLib::makeExtrapolatable(
195  local_assemblers, integration_point_values_method);
196  extrapolator.calculateResiduals(num_components, extrapolatables, t, x,
197  dof_table);
198  return extrapolator.getElementResiduals();
199  };
200  return {num_components, eval_field, eval_residuals};
201 }
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 >::initializeConcreteProcess(), ProcessLib::TwoPhaseFlowWithPP::TwoPhaseFlowWithPPProcess::initializeConcreteProcess(), ProcessLib::TwoPhaseFlowWithPrho::TwoPhaseFlowWithPrhoProcess::initializeConcreteProcess(), and ProcessLib::TES::TESProcess::initializeSecondaryVariables().

◆ makeOutput()

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

Definition at line 298 of file ProcessOutput.cpp.

300 {
301  // Write output file
302  DBUG("Writing output to '{:s}'.", file_name);
303 
304  // Store floating-point exception handling. Output of NaN's triggers
305  // floating point exceptions. Because we are not debugging VTK (or other
306  // libraries) at this point, the possibly set exceptions are temporary
307  // disabled and restored before end of the function.
308 #ifndef _WIN32
309 #ifndef __APPLE__
310  fenv_t fe_env;
311  fegetenv(&fe_env);
312  fesetenv(FE_DFL_ENV); // Set default environment effectively disabling
313  // exceptions.
314 #endif //_WIN32
315 #endif //__APPLE__
316 
317  MeshLib::IO::VtuInterface vtu_interface(&mesh, data_mode, compress_output);
318  vtu_interface.writeToFile(file_name);
319 
320  // Restore floating-point exception handling.
321 #ifndef _WIN32
322 #ifndef __APPLE__
323  fesetenv(&fe_env);
324 #endif //_WIN32
325 #endif //__APPLE__
326 }
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(), and ProcessLib::Output::outputMesh().

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

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

References OGS_FATAL.

Referenced by createPerProcessData().

◆ 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 142 of file CreateDeactivatedSubdomain.cpp.

144 {
145  DBUG("Constructing line segment");
146  auto const start =
148  config.getConfigParameter<std::vector<double>>("start");
149  if (start.size() != 3)
150  {
151  OGS_FATAL(
152  "For construction of a line segment the start point must be a 3D "
153  "point. Got a vector of size {}.",
154  start.size());
155  }
156 
157  auto const end =
159  config.getConfigParameter<std::vector<double>>("end");
160 
161  if (end.size() != 3)
162  {
163  OGS_FATAL(
164  "For construction of a line segment the end point must be a 3D "
165  "point. Got a vector of size {}.",
166  end.size());
167  }
168  return {Eigen::Vector3d{start[0], start[1], start[2]},
169  Eigen::Vector3d{end[0], end[1], end[2]}};
170 }

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

95 {
96  // Check for the error case first: only one of the configs must be used.
97  if (time_interval_config && curve_name)
98  {
99  OGS_FATAL(
100  "In the deactivate subdomain either a time interval or a curve "
101  "must be given, not both.");
102  }
103 
104  // Parse time interval and return a curve
105  if (time_interval_config)
106  {
107  DBUG("Constructing time interval");
108  auto const start_time =
110  time_interval_config->getConfigParameter<double>("start");
111 
112  auto const end_time =
114  time_interval_config->getConfigParameter<double>("end");
115 
116  // Using very large value for the curve's value, s.t. for any time from
117  // start to end the whole subdomain is deactivated at once.
118  return {{start_time, end_time},
119  {std::numeric_limits<double>::max(),
120  std::numeric_limits<double>::max()},
121  false};
122  }
123 
124  // Try to find the curve.
125  if (curve_name)
126  {
127  DBUG("Using curve '{:s}'", *curve_name);
128  // Return a copy of the curve because the time interval in the other
129  // branch returns a temporary.
130  return *BaseLib::getOrError(curves, *curve_name,
131  "Could not find curve.");
132  }
133 
134  // If we got so far, there is an error: one of the configs must be
135  // available.
136  OGS_FATAL(
137  "In the deactivate subdomain neither a time interval nor a curve are "
138  "given. One of them must be specified.");
139 }

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,
std::vector< std::size_t > &  xdot_vector_ids 
)

Definition at line 103 of file TimeLoop.cpp.

109 {
110  std::vector<GlobalVector*> x_dots;
111  x_dots.reserve(per_process_data.size());
112  xdot_vector_ids.resize(per_process_data.size());
113 
114  std::size_t cnt = 0;
115  for (auto& process_data : per_process_data)
116  {
117  auto const process_id = process_data->process_id;
118  auto const& ode_sys = *process_data->tdisc_ode_sys;
119  auto const& time_discretization = *process_data->time_disc;
120 
121  x_dots.emplace_back(&NumLib::GlobalVectorProvider::provider.getVector(
122  ode_sys.getMatrixSpecifications(process_id), xdot_vector_ids[cnt]));
123  cnt++;
124 
125  time_discretization.getXdot(*process_solutions[process_id],
126  *process_solutions_prev[process_id],
127  *x_dots[process_id]);
128  }
129 
130  // All _per_process_data share the first process.
131  bool const is_staggered_coupling =
132  !isMonolithicProcess(*per_process_data[0]);
133 
134  for (auto& process_data : per_process_data)
135  {
136  auto const process_id = process_data->process_id;
137  auto& pcs = process_data->process;
138 
139  if (is_staggered_coupling)
140  {
141  CoupledSolutionsForStaggeredScheme coupled_solutions(
142  process_solutions);
143  pcs.setCoupledSolutionsForStaggeredScheme(&coupled_solutions);
144  }
145  auto& x_dot = *x_dots[process_id];
146  pcs.computeSecondaryVariable(t, dt, process_solutions, x_dot,
147  process_id);
148  pcs.postTimestep(process_solutions, t, dt, process_id);
149  }
150  for (auto& x_dot : x_dots)
151  {
153  }
154 }
virtual void releaseVector(GlobalVector const &x)=0
bool isMonolithicProcess(ProcessLib::ProcessData const &process_data)
Definition: TimeLoop.cpp:82
static NUMLIB_EXPORT VectorProvider & provider

References anonymous_namespace{TimeLoop.cpp}::isMonolithicProcess(), NumLib::GlobalVectorProvider::provider, and NumLib::VectorProvider::releaseVector().

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

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

94 {
95  for (auto& process_data : per_process_data)
96  {
97  auto const process_id = process_data->process_id;
98  auto& pcs = process_data->process;
99  pcs.preTimestep(_process_solutions, t, dt, process_id);
100  }
101 }

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

◆ 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 
53  py::class_<PythonBoundaryConditionPythonSideInterface,
54  PythonBoundaryConditionPythonSideInterfaceTrampoline>
55  pybc(m, "BoundaryCondition");
56 
57  pybc.def(py::init());
58 
59  pybc.def("getDirichletBCValue",
60  &PythonBoundaryConditionPythonSideInterface::getDirichletBCValue);
61  pybc.def("getFlux", &PythonBoundaryConditionPythonSideInterface::getFlux);
62 }

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

Referenced by PYBIND11_EMBEDDED_MODULE().

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

219 {
220  std::vector<GlobalVector*> process_solutions;
221  std::vector<GlobalVector*> process_solutions_prev;
222 
223  for (auto& process_data : per_process_data)
224  {
225  auto const process_id = process_data->process_id;
226  auto& ode_sys = *process_data->tdisc_ode_sys;
227 
228  // append a solution vector of suitable size
229  process_solutions.emplace_back(
231  ode_sys.getMatrixSpecifications(process_id)));
232  process_solutions_prev.emplace_back(
234  ode_sys.getMatrixSpecifications(process_id)));
235  }
236 
237  for (auto& process_data : per_process_data)
238  {
239  auto& pcs = process_data->process;
240  auto const process_id = process_data->process_id;
241  pcs.setInitialConditions(process_solutions, process_solutions_prev, t0,
242  process_id);
243 
244  auto& time_disc = *process_data->time_disc;
245  time_disc.setInitialState(t0); // push IC
246  }
247 
248  return {process_solutions, process_solutions_prev};
249 }

References NumLib::GlobalVectorProvider::provider.

Referenced by ProcessLib::TimeLoop::initialize(), ProcessLib::HydroMechanics::HydroMechanicsProcess< DisplacementDim >::setInitialConditionsConcreteProcess(), ProcessLib::RichardsMechanics::RichardsMechanicsProcess< DisplacementDim >::setInitialConditionsConcreteProcess(), and ProcessLib::ThermoRichardsMechanics::ThermoRichardsMechanicsProcess< DisplacementDim >::setInitialConditionsConcreteProcess().

◆ setIntegrationPointDataMaterialStateVariables()

template<typename IntegrationPointData , typename MemberType , typename MaterialStateVariables >
std::size_t ProcessLib::setIntegrationPointDataMaterialStateVariables ( double const *  values,
std::vector< IntegrationPointData, Eigen::aligned_allocator< IntegrationPointData >> &  ip_data_vector,
MemberType  member,
std::function< BaseLib::DynamicSpan< double >(MaterialStateVariables &)>  get_values_span 
)

Definition at line 167 of file SetOrGetIntegrationPointData.h.

174 {
175  auto const n_integration_points = ip_data_vector.size();
176 
177  std::size_t position = 0;
178  for (auto& ip_data : ip_data_vector)
179  {
180  auto const values_span = get_values_span(*(ip_data.*member));
181  std::copy_n(values + position, values_span.size, values_span.data);
182  position += values_span.size;
183  }
184  return n_integration_points;
185 }

Referenced by ProcessLib::RichardsMechanics::RichardsMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, IntegrationMethod, DisplacementDim >::setIPDataInitialConditions().

◆ setIntegrationPointKelvinVectorData()

template<int DisplacementDim, typename IntegrationPointData , typename MemberType >
std::size_t ProcessLib::setIntegrationPointKelvinVectorData ( double const *  values,
std::vector< IntegrationPointData, Eigen::aligned_allocator< IntegrationPointData >> &  ip_data,
MemberType  member 
)

Definition at line 77 of file SetOrGetIntegrationPointData.h.

82 {
83  constexpr int kelvin_vector_size =
85  auto const n_integration_points = ip_data.size();
86 
87  auto kelvin_vector_values =
88  Eigen::Map<Eigen::Matrix<double, kelvin_vector_size, Eigen::Dynamic,
89  Eigen::ColMajor> const>(
90  values, kelvin_vector_size, n_integration_points);
91 
92  for (unsigned ip = 0; ip < n_integration_points; ++ip)
93  {
94  ip_data[ip].*member =
96  kelvin_vector_values.col(ip));
97  }
98 
99  return n_integration_points;
100 }
Eigen::Matrix< double, Eigen::MatrixBase< Derived >::RowsAtCompileTime, 1 > symmetricTensorToKelvinVector(Eigen::MatrixBase< Derived > const &v)
Definition: KelvinVector.h:170

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

◆ setIntegrationPointScalarData()

◆ setTimeDiscretizedODESystem() [1/2]

void ProcessLib::setTimeDiscretizedODESystem ( ProcessData process_data)

Definition at line 210 of file TimeLoop.cpp.

211 {
212  setTimeDiscretizedODESystem(process_data, process_data.process);
213 }
void setTimeDiscretizedODESystem(ProcessData &process_data)
Definition: TimeLoop.cpp:210

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

160 {
161  using Tag = NumLib::NonlinearSolverTag;
162  // A concrete Picard solver
163  using NonlinearSolverPicard = NumLib::NonlinearSolver<Tag::Picard>;
164  // A concrete Newton solver
165  using NonlinearSolverNewton = NumLib::NonlinearSolver<Tag::Newton>;
166 
167  if (dynamic_cast<NonlinearSolverPicard*>(&process_data.nonlinear_solver))
168  {
169  // The Picard solver can also work with a Newton-ready ODE,
170  // because the Newton ODESystem derives from the Picard ODESystem.
171  // So no further checks are needed here.
172 
173  process_data.tdisc_ode_sys = std::make_unique<
175  process_data.process_id, ode_sys, *process_data.time_disc);
176  }
177  // TODO (naumov) Provide a function to nonlinear_solver to distinguish the
178  // types. Could be handy, because a nonlinear solver could handle both types
179  // like PETScSNES.
180  else if ((dynamic_cast<NonlinearSolverNewton*>(
181  &process_data.nonlinear_solver) != nullptr)
182 #ifdef USE_PETSC
183  || (dynamic_cast<NumLib::PETScNonlinearSolver*>(
184  &process_data.nonlinear_solver) != nullptr)
185 #endif // USE_PETSC
186  )
187  {
188  // The Newton-Raphson method needs a Newton-ready ODE.
189 
190  using ODENewton = NumLib::ODESystem<ODETag, Tag::Newton>;
191  if (auto* ode_newton = dynamic_cast<ODENewton*>(&ode_sys))
192  {
193  process_data.tdisc_ode_sys = std::make_unique<
195  process_data.process_id, *ode_newton, *process_data.time_disc);
196  }
197  else
198  {
199  OGS_FATAL(
200  "You are trying to solve a non-Newton-ready ODE with the"
201  " Newton-Raphson method. Aborting");
202  }
203  }
204  else
205  {
206  OGS_FATAL("Encountered unknown nonlinear solver type. Aborting");
207  }
208 }

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,
Output output,
std::size_t &  xdot_id 
)
static

Definition at line 685 of file TimeLoop.cpp.

690 {
691  BaseLib::RunTime time_timestep_process;
692  time_timestep_process.start();
693 
694  auto const nonlinear_solver_status = solveOneTimeStepOneProcess(
695  x, x_prev, timestep_id, t, dt, process_data, output, xdot_id);
696 
697  INFO("[time] Solving process #{:d} took {:g} s in time step #{:d} ",
698  process_data.process_id, time_timestep_process.elapsed(), timestep_id);
699 
700  return nonlinear_solver_status;
701 }
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, Output &output_control, std::size_t &xdot_id)
Definition: TimeLoop.cpp:279

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,
Output output_control,
std::size_t &  xdot_id 
)

Definition at line 279 of file TimeLoop.cpp.

284 {
285  auto& process = process_data.process;
286  int const process_id = process_data.process_id;
287  auto& time_disc = *process_data.time_disc;
288  auto& conv_crit = *process_data.conv_crit;
289  auto& ode_sys = *process_data.tdisc_ode_sys;
290  auto& nonlinear_solver = process_data.nonlinear_solver;
291  auto const nl_tag = process_data.nonlinear_solver_tag;
292 
293  setEquationSystem(nonlinear_solver, ode_sys, conv_crit, nl_tag);
294 
295  // Note: Order matters!
296  // First advance to the next timestep, then set known solutions at that
297  // time, afterwards pass the right solution vector and time to the
298  // preTimestep() hook.
299 
300  time_disc.nextTimestep(t, delta_t);
301 
302  auto const post_iteration_callback =
303  [&](int iteration, std::vector<GlobalVector*> const& x)
304  {
305  output_control.doOutputNonlinearIteration(process, process_id, timestep,
306  t, iteration, x);
307  };
308 
309  auto const nonlinear_solver_status =
310  nonlinear_solver.solve(x, x_prev, post_iteration_callback, process_id);
311 
312  if (!nonlinear_solver_status.error_norms_met)
313  {
314  return nonlinear_solver_status;
315  }
316 
318  ode_sys.getMatrixSpecifications(process_id), xdot_id);
319 
320  time_disc.getXdot(*x[process_id], *x_prev[process_id], x_dot);
321 
322  process.postNonLinearSolver(*x[process_id], x_dot, t, delta_t, process_id);
324 
325  return nonlinear_solver_status;
326 }
virtual GlobalVector & getVector(std::size_t &id)=0
Get an uninitialized vector with the given id.

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

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

◆ transposeInPlace()

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

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

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