OGS
ProcessLib Namespace Reference

Detailed Description

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

Namespaces

 BoundaryConditionAndSourceTerm
 
 ComponentTransport
 
 Deformation
 
 detail
 
 HeatConduction
 
 HeatTransportBHE
 
 HT
 
 HydroMechanics
 
 LIE
 
 LinearBMatrix
 
 LiquidFlow
 
 NormalTractionBoundaryCondition
 
 PhaseField
 
 Reflection
 
 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  MethodNotOverriddenInDerivedClassException
 
struct  PythonBcData
 
class  PythonBoundaryCondition
 A boundary condition whose values are computed by a Python script. More...
 
class  PythonBoundaryConditionLocalAssembler
 
class  PythonBoundaryConditionLocalAssemblerInterface
 
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  ForwardDifferencesJacobianAssembler
 Assembles the Jacobian matrix using forward differences. More...
 
class  HMatrixPolicyType
 
class  LocalAssemblerInterface
 
class  ExtrapolatorData
 
class  Output
 
struct  PairRepeatEachSteps
 
struct  OutputDataSpecification
 Holds information about which variables to write to output files. More...
 
struct  OutputFormat
 
struct  OutputVTKFormat
 
struct  OutputXDMFHDF5Format
 
class  ProcessOutputData
 Holds all data of a process that are needed for output. 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  SurfaceFlux
 
struct  SurfaceFluxData
 
class  SurfaceFluxLocalAssemblerInterface
 
class  SurfaceFluxLocalAssembler
 
class  TimeLoop
 Time loop capable of time-integrating several processes at once. More...
 
struct  GenericLocalAssemblerFactory
 
class  LocalAssemblerBuilderFactory
 
class  LocalAssemblerFactoryForDimGreaterEqualN
 
class  LocalAssemblerBuilderFactoryTaylorHood
 
class  LocalAssemblerFactoryTaylorHood
 
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 EnabledElementTraitsLagrange = decltype(BaseLib::TMP::filter< NumLib::AllElementTraitsLagrange >(detail::isElementEnabled))
 
template<typename LocalAssemblerInterface , template< typename, int > class LocalAssemblerImplementation, NumLib::IntegrationMethodProvider IntegrationMethodProvider, int GlobalDim, typename... ConstructorArgs>
using LocalAssemblerFactory = LocalAssemblerFactoryForDimGreaterEqualN< 1, LocalAssemblerInterface, LocalAssemblerImplementation, IntegrationMethodProvider, GlobalDim, ConstructorArgs... >
 By default processes in OGS are defined in 1D, 2D and 3D. More...
 
template<typename LocalAssemblerInterface , template< typename, int > class LocalAssemblerImplementation, NumLib::IntegrationMethodProvider IntegrationMethodProvider, int GlobalDim, typename... ConstructorArgs>
using LocalAssemblerFactorySD = LocalAssemblerFactoryForDimGreaterEqualN< 2, LocalAssemblerInterface, LocalAssemblerImplementation, IntegrationMethodProvider, GlobalDim, ConstructorArgs... >
 Mechanics processes in OGS are defined in 2D and 3D only. More...
 
template<typename LocalAssemblerInterface , template< typename, typename, int > class LocalAssemblerImplementation, NumLib::IntegrationMethodProvider IntegrationMethodProvider, int GlobalDim, typename... ConstructorArgs>
using LocalAssemblerFactoryHM = LocalAssemblerFactoryTaylorHood< 1, 2, LocalAssemblerInterface, LocalAssemblerImplementation, IntegrationMethodProvider, GlobalDim, ConstructorArgs... >
 HM processes in OGS are defined for linear and higher order elements. More...
 
template<typename LocalAssemblerInterface , template< typename, typename, int > class LocalAssemblerImplementation, NumLib::IntegrationMethodProvider IntegrationMethodProvider, int GlobalDim, typename... ConstructorArgs>
using LocalAssemblerFactoryStokes = LocalAssemblerFactoryTaylorHood< 2, 2, LocalAssemblerInterface, LocalAssemblerImplementation, IntegrationMethodProvider, GlobalDim, ConstructorArgs... >
 Stokes flow in OGS is defined for higher order elements only. More...
 
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, [[maybe_unused]] std::vector< std::reference_wrapper< ProcessVariable >> const &all_process_variables_for_this_process)
 
std::unique_ptr< BoundaryConditioncreateBoundaryCondition (const BoundaryConditionConfig &config, const NumLib::LocalToGlobalIndexMap &dof_table, const MeshLib::Mesh &bulk_mesh, const int variable_id, const unsigned integration_order, const unsigned shapefunction_order, const std::vector< std::unique_ptr< ParameterLib::ParameterBase >> &parameters, const Process &process, std::vector< std::reference_wrapper< ProcessVariable >> const &all_process_variables_for_this_process)
 
std::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, [[maybe_unused]] std::vector< std::reference_wrapper< ProcessVariable >> const &all_process_variables_for_this_process)
 
std::unique_ptr< SourceTermcreateSourceTerm (const SourceTermConfig &config, const NumLib::LocalToGlobalIndexMap &dof_table_bulk, const MeshLib::Mesh &source_term_mesh, const int variable_id, const unsigned integration_order, const unsigned shapefunction_order, std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const &parameters, std::vector< std::reference_wrapper< ProcessVariable >> const &all_process_variables_for_this_process)
 
std::unique_ptr< SourceTermcreateVolumetricSourceTerm (BaseLib::ConfigTree const &config, unsigned const bulk_mesh_dimension, MeshLib::Mesh const &source_term_mesh, std::unique_ptr< NumLib::LocalToGlobalIndexMap > source_term_dof_table, std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const &parameters, unsigned const integration_order, unsigned const shapefunction_order)
 
std::unique_ptr< DirichletBoundaryConditioncreateDirichletBoundaryCondition (BaseLib::ConfigTree const &config, MeshLib::Mesh const &bc_mesh, NumLib::LocalToGlobalIndexMap const &dof_table_bulk, int const variable_id, int const component_id, const std::vector< std::unique_ptr< ParameterLib::ParameterBase >> &parameters)
 
void checkParametersOfDirichletBoundaryCondition (MeshLib::Mesh const &bc_mesh, NumLib::LocalToGlobalIndexMap const &dof_table_bulk, int const variable_id, int const component_id)
 
void getEssentialBCValuesLocal (ParameterLib::Parameter< double > const &parameter, MeshLib::Mesh const &bc_mesh, std::vector< std::size_t > const &nodes_in_bc_mesh, NumLib::LocalToGlobalIndexMap const &dof_table_boundary, int const variable_id, int const component_id, const double t, GlobalVector const &, NumLib::IndexValueVector< GlobalIndexType > &bc_values)
 
void getEssentialBCValuesLocal (ParameterLib::Parameter< double > const &parameter, MeshLib::Mesh const &bc_mesh, NumLib::LocalToGlobalIndexMap const &dof_table_boundary, int const variable_id, int const component_id, const double t, GlobalVector const &x, NumLib::IndexValueVector< GlobalIndexType > &bc_values)
 
std::unique_ptr< HCNonAdvectiveFreeComponentFlowBoundaryConditioncreateHCNonAdvectiveFreeComponentFlowBoundaryCondition (BaseLib::ConfigTree const &config, MeshLib::Mesh const &bc_mesh, NumLib::LocalToGlobalIndexMap const &dof_table, int const variable_id, int const component_id, unsigned const integration_order, std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const &parameters, unsigned const global_dim, Process const &process, unsigned const shapefunction_order)
 
std::unique_ptr< NeumannBoundaryConditioncreateNeumannBoundaryCondition (BaseLib::ConfigTree const &config, MeshLib::Mesh const &bc_mesh, NumLib::LocalToGlobalIndexMap const &dof_table, int const variable_id, int const component_id, unsigned const integration_order, unsigned const shapefunction_order, unsigned const global_dim, std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const &parameters)
 
std::unique_ptr< PhaseFieldIrreversibleDamageOracleBoundaryConditioncreatePhaseFieldIrreversibleDamageOracleBoundaryCondition (BaseLib::ConfigTree const &config, NumLib::LocalToGlobalIndexMap const &dof_table, MeshLib::Mesh const &mesh, int const variable_id, int const component_id)
 
std::unique_ptr< PrimaryVariableConstraintDirichletBoundaryConditioncreatePrimaryVariableConstraintDirichletBoundaryCondition (BaseLib::ConfigTree const &config, MeshLib::Mesh const &bc_mesh, NumLib::LocalToGlobalIndexMap const &dof_table_bulk, int const variable_id, int const component_id, const std::vector< std::unique_ptr< ParameterLib::ParameterBase >> &parameters)
 
template<typename BHEType >
std::unique_ptr< BHEInflowPythonBoundaryCondition< BHEType > > createBHEInflowPythonBoundaryCondition (std::pair< GlobalIndexType, GlobalIndexType > &&in_out_global_indices, BHEType &bhe, BHEInflowPythonBoundaryConditionPythonSideInterface &py_bc_object)
 
void bheInflowpythonBindBoundaryCondition (pybind11::module &m)
 Creates BHE Inflow Python bindings for the Python BC class. 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::vector< std::reference_wrapper< ProcessVariable >> const &all_process_variables_for_this_process)
 
std::unique_ptr< PythonBoundaryConditioncreatePythonBoundaryCondition (BaseLib::ConfigTree const &config, MeshLib::Mesh const &boundary_mesh, NumLib::LocalToGlobalIndexMap const &dof_table_bulk, MeshLib::Mesh const &bulk_mesh, int const variable_id, int const component_id, unsigned const integration_order, unsigned const shapefunction_order, std::vector< std::reference_wrapper< ProcessVariable >> const &all_process_variables_for_this_process)
 Creates a new PythonBoundaryCondition object. 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< std::size_t >, std::vector< std::size_t > > extractInnerAndOuterNodes (MeshLib::Mesh const &mesh, MeshLib::Mesh const &sub_mesh, IsActive is_active)
 
static std::vector< std::vector< std::size_t > > extractElementsAlongOuterNodes (MeshLib::Mesh const &mesh, MeshLib::Mesh const &sub_mesh, std::vector< std::size_t > const &outer_nodes)
 
static DeactivatedSubdomainMesh createDeactivatedSubdomainMesh (MeshLib::Mesh const &mesh, std::vector< int > const &deactivated_subdomain_material_ids)
 
static MathLib::PiecewiseLinearInterpolation parseTimeIntervalOrCurve (std::optional< BaseLib::ConfigTree > const &time_interval_config, std::optional< std::string > const &curve_name, std::map< std::string, std::unique_ptr< MathLib::PiecewiseLinearInterpolation >> const &curves)
 
static std::pair< Eigen::Vector3d, Eigen::Vector3d > parseLineSegment (BaseLib::ConfigTree const &config)
 Returns a line segment represented by its begin and end points. More...
 
DeactivatedSubdomain createDeactivatedSubdomain (BaseLib::ConfigTree const &config, MeshLib::Mesh const &mesh, std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const &parameters, std::map< std::string, std::unique_ptr< MathLib::PiecewiseLinearInterpolation >> const &curves)
 
std::vector< DeactivatedSubdomaincreateDeactivatedSubdomains (BaseLib::ConfigTree const &config, MeshLib::Mesh const &mesh, std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const &parameters, std::map< std::string, std::unique_ptr< MathLib::PiecewiseLinearInterpolation >> const &curves)
 
std::unique_ptr< AbstractJacobianAssemblercreateForwardDifferencesJacobianAssembler (BaseLib::ConfigTree const &config)
 
std::unique_ptr< AbstractJacobianAssemblercreateJacobianAssembler (std::optional< BaseLib::ConfigTree > const &config)
 
static std::unique_ptr< ProcessDatamakeProcessData (std::unique_ptr< NumLib::TimeStepAlgorithm > &&timestepper, NumLib::NonlinearSolverBase &nonlinear_solver, int const process_id, Process &process, std::unique_ptr< NumLib::TimeDiscretization > &&time_disc, std::unique_ptr< NumLib::ConvergenceCriterion > &&conv_crit, bool const compensate_non_equilibrium_initial_residuum)
 
std::vector< std::unique_ptr< ProcessData > > createPerProcessData (BaseLib::ConfigTree const &config, std::vector< std::unique_ptr< Process >> const &processes, std::map< std::string, std::unique_ptr< NumLib::NonlinearSolverBase >> const &nonlinear_solvers, bool const compensate_non_equilibrium_initial_residuum)
 
std::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, bool const compensate_non_equilibrium_initial_residuum)
 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...
 
void addProcessDataToMesh (const double t, std::vector< GlobalVector * > const &xs, int const process_id, ProcessOutputData const &process_output_data, bool const output_secondary_variables, OutputDataSpecification const &process_output)
 
std::unique_ptr< OutputFormatcreateOutputFormat (std::string const &output_directory, OutputType const output_type, std::string prefix, std::string suffix, std::string const &data_mode, bool const compress_output, unsigned int const number_of_files)
 
void parseOutput (const BaseLib::ConfigTree &config, std::string const &output_directory, std::vector< std::unique_ptr< MeshLib::Mesh >> const &meshes, std::vector< Output > &outputs)
 
std::vector< OutputcreateOutput (const BaseLib::ConfigTree &config, std::string const &output_directory, std::vector< std::unique_ptr< MeshLib::Mesh >> const &meshes)
 
std::vector< OutputcreateOutputs (const BaseLib::ConfigTree &output_configs, std::string const &output_directory, std::vector< std::unique_ptr< MeshLib::Mesh >> const &meshes)
 
void createSecondaryVariables (BaseLib::ConfigTree const &config, SecondaryVariableCollection &secondary_variables)
 
void addBulkMeshNodePropertyToSubMesh (MeshLib::Mesh const &bulk_mesh, MeshLib::Mesh &sub_mesh, std::string const &property_name)
 
std::ostream & operator<< (std::ostream &os, Output const &output)
 
std::ostream & operator<< (std::ostream &os, PairRepeatEachSteps const &pair)
 
std::ostream & operator<< (std::ostream &os, OutputDataSpecification const &o)
 
void outputMeshVtk (std::string const &file_name, MeshLib::Mesh const &mesh, bool const compress_output, int const data_mode)
 
void outputMeshVtk (OutputVTKFormat const &output_file, MeshLib::IO::PVDFile &pvd_file, MeshLib::Mesh const &mesh, double const t, int const timestep, int const iteration)
 
std::ostream & operator<< (std::ostream &os, OutputFormat const &of)
 
ProcessOutputData createProcessOutputData (Process const &process, std::size_t const n_processes, MeshLib::Mesh &output_mesh)
 Extracts data necessary for output from the given process. 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)
 
template<typename LocalAssemblerCollection , typename IPDataAccessor >
SecondaryVariableFunctions makeExtrapolator2 (const unsigned num_components, NumLib::Extrapolator &extrapolator, LocalAssemblerCollection const &local_assemblers, IPDataAccessor &&accessor)
 
void setEquationSystem (ProcessData const &process_data)
 
bool parseCompensateNonEquilibriumInitialResiduum (BaseLib::ConfigTree const &config)
 
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, std::vector< Output > const &outputs, std::size_t &xdot_id)
 
std::vector< double > calculateUniqueFixedTimesForAllOutputs (std::vector< Output > const &outputs)
 
static NumLib::NonlinearSolverStatus solveMonolithicProcess (const double t, const double dt, const std::size_t timestep_id, ProcessData const &process_data, std::vector< GlobalVector * > &x, std::vector< GlobalVector * > const &x_prev, std::vector< Output > const &outputs, 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, int > class LocalAssemblerImplementation, typename LocalAssemblerInterface , IntegrationMethodProviderOrIntegrationOrder ProviderOrOrder, typename... ExtraCtorArgs>
void createLocalAssemblers (std::vector< MeshLib::Element * > const &mesh_elements, NumLib::LocalToGlobalIndexMap const &dof_table, std::vector< std::unique_ptr< LocalAssemblerInterface >> &local_assemblers, ProviderOrOrder const &provider_or_order, ExtraCtorArgs &&... extra_ctor_args)
 
template<template< typename, int > class LocalAssemblerImplementation, typename LocalAssemblerInterface , IntegrationMethodProviderOrIntegrationOrder ProviderOrOrder, typename... ExtraCtorArgs>
void createLocalAssemblers (const unsigned dimension, std::vector< MeshLib::Element * > const &mesh_elements, NumLib::LocalToGlobalIndexMap const &dof_table, std::vector< std::unique_ptr< LocalAssemblerInterface >> &local_assemblers, ProviderOrOrder const &provider_or_order, ExtraCtorArgs &&... extra_ctor_args)
 
template<int GlobalDim, template< typename, typename, int > class LocalAssemblerImplementation, typename LocalAssemblerInterface , IntegrationMethodProviderOrIntegrationOrder ProviderOrOrder, typename... ExtraCtorArgs>
void createLocalAssemblersHM (std::vector< MeshLib::Element * > const &mesh_elements, NumLib::LocalToGlobalIndexMap const &dof_table, std::vector< std::unique_ptr< LocalAssemblerInterface >> &local_assemblers, ProviderOrOrder const &provider_or_order, ExtraCtorArgs &&... extra_ctor_args)
 
template<int GlobalDim, template< typename, typename, int > class LocalAssemblerImplementation, typename LocalAssemblerInterface , IntegrationMethodProviderOrIntegrationOrder ProviderOrOrder, typename... ExtraCtorArgs>
void createLocalAssemblersStokes (std::vector< MeshLib::Element * > const &mesh_elements, NumLib::LocalToGlobalIndexMap const &dof_table, std::vector< std::unique_ptr< LocalAssemblerInterface >> &local_assemblers, ProviderOrOrder const &provider_or_order, ExtraCtorArgs &&... extra_ctor_args)
 
ProcessVariablefindProcessVariable (std::vector< ProcessVariable > const &variables, BaseLib::ConfigTree const &pv_config, std::string const &tag)
 
std::vector< std::reference_wrapper< ProcessVariable > > findProcessVariables (std::vector< ProcessVariable > const &variables, BaseLib::ConfigTree const &pv_config, std::initializer_list< std::string > tags)
 
std::vector< std::reference_wrapper< ProcessVariable > > findProcessVariables (std::vector< ProcessVariable > const &variables, BaseLib::ConfigTree const &pv_config, std::string const &tag)
 
std::string removeIPFieldDataNameSuffix (std::string const &name)
 Removes the suffix '_ip' from the passed field name. More...
 
template<typename LocalAssemblersVector >
void setIPDataInitialConditions (std::vector< std::unique_ptr< MeshLib::IntegrationPointWriter >> const &_integration_point_writer, MeshLib::Properties const &mesh_properties, LocalAssemblersVector &local_assemblers, bool const remove_name_suffix=false)
 
template<int DisplacementDim, typename IntegrationPointDataVector , typename IpData , typename MemberType >
std::vector< double > const & getIntegrationPointKelvinVectorData (IntegrationPointDataVector const &ip_data_vector, MemberType IpData::*const member, std::vector< double > &cache)
 
template<int DisplacementDim, typename IntegrationPointDataVector , typename Accessor >
std::vector< double > const & getIntegrationPointKelvinVectorData (IntegrationPointDataVector const &ip_data_vector, Accessor &&accessor, std::vector< double > &cache)
 
template<int DisplacementDim, typename IntegrationPointDataVector , typename MemberType >
std::vector< double > getIntegrationPointKelvinVectorData (IntegrationPointDataVector const &ip_data_vector, MemberType member)
 
template<int DisplacementDim, typename IntegrationPointDataVector , typename IpData , typename MemberType >
std::size_t setIntegrationPointKelvinVectorData (double const *values, IntegrationPointDataVector &ip_data_vector, MemberType IpData::*const member)
 
template<int DisplacementDim, typename IntegrationPointDataVector , typename Accessor >
std::size_t setIntegrationPointKelvinVectorData (double const *values, IntegrationPointDataVector &ip_data_vector, Accessor &&accessor)
 
template<typename IntegrationPointDataVector , typename IpData , typename MemberType >
std::vector< double > const & getIntegrationPointScalarData (IntegrationPointDataVector const &ip_data_vector, MemberType IpData::*const member, std::vector< double > &cache)
 
template<typename IntegrationPointDataVector , typename Accessor >
std::vector< double > const & getIntegrationPointScalarData (IntegrationPointDataVector const &ip_data_vector, Accessor &&accessor, std::vector< double > &cache)
 
template<typename IntegrationPointDataVector , typename IpData , typename MemberType >
std::size_t setIntegrationPointScalarData (double const *values, IntegrationPointDataVector &ip_data_vector, MemberType IpData::*const member)
 
template<typename IntegrationPointDataVector , typename Accessor >
std::size_t setIntegrationPointScalarData (double const *values, IntegrationPointDataVector &ip_data_vector, Accessor &&accessor)
 
template<typename IntegrationPointDataVector , typename MemberType , typename MaterialStateVariables >
std::vector< double > getIntegrationPointDataMaterialStateVariables (IntegrationPointDataVector const &ip_data_vector, MemberType member, std::function< BaseLib::DynamicSpan< double >(MaterialStateVariables &)> get_values_span, int const n_components)
 
template<typename IntegrationPointDataVector , typename MemberType , typename MaterialStateVariables >
std::size_t setIntegrationPointDataMaterialStateVariables (double const *values, IntegrationPointDataVector &ip_data_vector, MemberType member, std::function< BaseLib::DynamicSpan< double >(MaterialStateVariables &)> get_values_span)
 
template<int Components, typename StoreValuesFunction >
std::vector< double > transposeInPlace (StoreValuesFunction const &store_values_function)
 
template<int Components>
void transposeInPlace (std::vector< double > &values)
 
void transposeInPlace (std::vector< double > &values, unsigned const num_components)
 

Variables

static constexpr std::string_view timestepper_cannot_reduce_dt
 
template<typename T >
concept IntegrationMethodProviderOrIntegrationOrder
 

Typedef Documentation

◆ EnabledElementTraitsLagrange

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

Definition at line 119 of file EnabledElements.h.

◆ HCNonAdvectiveFreeComponentFlowBoundaryCondition

◆ LocalAssemblerFactory

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

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

Definition at line 89 of file LocalAssemblerFactoryForDimGreaterEqualN.h.

◆ LocalAssemblerFactoryHM

template<typename LocalAssemblerInterface , template< typename, typename, int > class LocalAssemblerImplementation, NumLib::IntegrationMethodProvider IntegrationMethodProvider, int GlobalDim, typename... ConstructorArgs>
using ProcessLib::LocalAssemblerFactoryHM = typedef LocalAssemblerFactoryTaylorHood<1 , 2 , LocalAssemblerInterface, LocalAssemblerImplementation, IntegrationMethodProvider, GlobalDim, ConstructorArgs...>

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

Definition at line 169 of file LocalAssemblerFactoryTaylorHood.h.

◆ LocalAssemblerFactorySD

template<typename LocalAssemblerInterface , template< typename, int > class LocalAssemblerImplementation, NumLib::IntegrationMethodProvider IntegrationMethodProvider, int GlobalDim, typename... ConstructorArgs>
using ProcessLib::LocalAssemblerFactorySD = typedef LocalAssemblerFactoryForDimGreaterEqualN<2, LocalAssemblerInterface, LocalAssemblerImplementation, IntegrationMethodProvider, GlobalDim, ConstructorArgs...>

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

Definition at line 104 of file LocalAssemblerFactoryForDimGreaterEqualN.h.

◆ LocalAssemblerFactoryStokes

template<typename LocalAssemblerInterface , template< typename, typename, int > class LocalAssemblerImplementation, NumLib::IntegrationMethodProvider IntegrationMethodProvider, int GlobalDim, typename... ConstructorArgs>
using ProcessLib::LocalAssemblerFactoryStokes = typedef LocalAssemblerFactoryTaylorHood<2 , 2 , LocalAssemblerInterface, LocalAssemblerImplementation, IntegrationMethodProvider, GlobalDim, ConstructorArgs...>

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

Definition at line 187 of file LocalAssemblerFactoryTaylorHood.h.

◆ LocalAssemblerTraits

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

Definition at line 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
Enumerator
vtk 
xdmf 

Definition at line 63 of file CreateOutput.cpp.

Function Documentation

◆ addBulkMeshNodePropertyToSubMesh()

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

Definition at line 27 of file Output.cpp.

30 {
31  if (bulk_mesh == sub_mesh)
32  {
33  return;
34  }
35  if (!bulk_mesh.getProperties().existsPropertyVector<double>(
36  property_name, MeshLib::MeshItemType::Node, 1))
37  {
38  return;
39  }
40  if (!sub_mesh.getProperties().existsPropertyVector<std::size_t>(
41  "bulk_node_ids", MeshLib::MeshItemType::Node, 1))
42  {
43  return;
44  }
45 
46  auto const& bulk_mesh_property =
47  *bulk_mesh.getProperties().getPropertyVector<double>(property_name);
48  auto const& bulk_node_ids =
49  *sub_mesh.getProperties().getPropertyVector<std::size_t>(
50  "bulk_node_ids");
51 
52  auto& sub_mesh_property = *MeshLib::getOrCreateMeshProperty<double>(
53  sub_mesh, property_name, MeshLib::MeshItemType::Node, 1);
54 
55  std::transform(std::begin(bulk_node_ids), std::end(bulk_node_ids),
56  std::begin(sub_mesh_property),
57  [&bulk_mesh_property](auto const id)
58  { return bulk_mesh_property[id]; });
59 }
Properties & getProperties()
Definition: Mesh.h:129
PropertyVector< T > const * getPropertyVector(std::string const &name) const
bool existsPropertyVector(std::string const &name) const

References MeshLib::Properties::existsPropertyVector(), MeshLib::Mesh::getProperties(), MeshLib::Properties::getPropertyVector(), and MeshLib::Node.

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

◆ addProcessDataToMesh()

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

Adds output data to a mesh.

Note
The mesh is passed via process_output_data.

Definition at line 362 of file AddProcessDataToMesh.cpp.

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

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

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

◆ bheInflowpythonBindBoundaryCondition()

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

Creates BHE Inflow Python bindings for the Python BC class.

Definition at line 76 of file BHEInflowPythonBoundaryConditionModule.cpp.

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

References ProcessLib::BHEInflowPythonBoundaryConditionPythonSideInterface::tespySolver().

Referenced by PYBIND11_EMBEDDED_MODULE(), and PYBIND11_MODULE().

◆ calculateNonEquilibriumInitialResiduum()

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

Definition at line 206 of file TimeLoop.cpp.

211 {
212  for (auto& process_data : per_process_data)
213  {
214  auto& time_disc = *process_data->time_disc;
215  auto& nonlinear_solver = process_data->nonlinear_solver;
216 
217  setEquationSystem(*process_data);
218  // dummy values to handle the time derivative terms more or less
219  // correctly, i.e. to ignore them.
220  double const t = 0;
221  double const dt = 1;
222  time_disc.nextTimestep(t, dt);
223  nonlinear_solver.calculateNonEquilibriumInitialResiduum(
224  process_solutions, process_solutions_prev,
225  process_data->process_id);
226  }
227 }
void setEquationSystem(ProcessData const &process_data)
Definition: ProcessData.cpp:17

References setEquationSystem(), and MathLib::t.

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

◆ calculateUniqueFixedTimesForAllOutputs()

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

Definition at line 487 of file TimeLoop.cpp.

489 {
490  std::vector<double> fixed_times;
491  for (auto const& output : outputs)
492  {
493  auto const& output_fixed_times = output.getFixedOutputTimes();
494  fixed_times.insert(fixed_times.end(), output_fixed_times.begin(),
495  output_fixed_times.end());
496  }
497  std::sort(fixed_times.begin(), fixed_times.end());
498  auto const it = std::unique(fixed_times.begin(), fixed_times.end());
499  fixed_times.erase(it, fixed_times.end());
500  return fixed_times;
501 }

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

◆ checkParametersOfDirichletBoundaryCondition()

void ProcessLib::checkParametersOfDirichletBoundaryCondition ( MeshLib::Mesh const &  bc_mesh,
NumLib::LocalToGlobalIndexMap const &  dof_table_bulk,
int const  variable_id,
int const  component_id 
)

Definition at line 25 of file DirichletBoundaryConditionAuxiliaryFunctions.cpp.

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

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

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

◆ computeHMatrix()

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

Fills a H-matrix based on given shape function.

Definition at line 53 of file HMatrixUtils.h.

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

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

◆ computeResiduum()

GlobalVector ProcessLib::computeResiduum ( 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:25
void matMult(PETScMatrix const &A, PETScVector const &x, PETScVector &y)
Definition: LinAlg.cpp:142
void matMultAdd(PETScMatrix const &A, PETScVector const &v1, PETScVector const &v2, PETScVector &v3)
Definition: LinAlg.cpp:152
void scale(PETScVector &x, PetscScalar const a)
Definition: LinAlg.cpp:44
void axpy(PETScVector &y, PetscScalar const a, PETScVector const &x)
Definition: LinAlg.cpp:57

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

Referenced by ProcessLib::LiquidFlow::LiquidFlowProcess::assembleConcreteProcess(), ProcessLib::TH2M::TH2MProcess< DisplacementDim >::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 95 of file BHEInflowPythonBoundaryCondition.h.

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

References DBUG(), and OGS_FATAL.

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

◆ createBoundaryCondition() [1/2]

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,
[[maybe_unused] ] std::vector< std::reference_wrapper< ProcessVariable >> const &  all_process_variables_for_this_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 34 of file CreateBoundaryCondition.cpp.

43 {
44  // Surface mesh and bulk mesh must have equal axial symmetry flags!
45  if (config.boundary_mesh.isAxiallySymmetric() !=
46  bulk_mesh.isAxiallySymmetric())
47  {
48  OGS_FATAL(
49  "The boundary mesh {:s} axially symmetric but the bulk mesh {:s}. "
50  "Both must have an equal axial symmetry property.",
51  config.boundary_mesh.isAxiallySymmetric() ? "is" : "is not",
52  bulk_mesh.isAxiallySymmetric() ? "is" : "is not");
53  }
54 
56  auto const type = config.config.peekConfigParameter<std::string>("type");
57 
58  if (type == "Dirichlet")
59  {
61  config.config, config.boundary_mesh, dof_table, variable_id,
62  *config.component_id, parameters);
63  }
64  if (type == "DirichletWithinTimeInterval")
65  {
67  config.config, config.boundary_mesh, dof_table, variable_id,
68  *config.component_id, parameters);
69  }
70  if (type == "Neumann")
71  {
73  config.config, config.boundary_mesh, dof_table, variable_id,
74  *config.component_id, integration_order, shapefunction_order,
75  bulk_mesh.getDimension(), parameters);
76  }
77  if (type == "Robin")
78  {
80  config.config, config.boundary_mesh, dof_table, variable_id,
81  *config.component_id, integration_order, shapefunction_order,
82  bulk_mesh.getDimension(), parameters);
83  }
84  if (type == "VariableDependentNeumann")
85  {
87  config.config, config.boundary_mesh, dof_table, variable_id,
88  *config.component_id, integration_order, shapefunction_order,
89  bulk_mesh.getDimension(), parameters);
90  }
91 
92  if (type == "Python")
93  {
94 #ifdef OGS_USE_PYTHON
96  config.config, config.boundary_mesh, dof_table, bulk_mesh,
97  variable_id, *config.component_id, integration_order,
98  shapefunction_order, all_process_variables_for_this_process);
99 #else
100  OGS_FATAL("OpenGeoSys has not been built with Python support.");
101 #endif
102  }
103 
104  //
105  // Special boundary conditions
106  //
107  if (type == "ConstraintDirichlet")
108  {
110  config.config, config.boundary_mesh, dof_table, variable_id,
111  integration_order, *config.component_id, parameters, process);
112  }
113  if (type == "PrimaryVariableConstraintDirichlet")
114  {
116  config.config, config.boundary_mesh, dof_table, variable_id,
117  *config.component_id, parameters);
118  }
119  if (type == "SolutionDependentDirichlet")
120  {
122  config.config, config.boundary_mesh, dof_table, variable_id,
123  *config.component_id, parameters);
124  }
125  if (type == "HCNonAdvectiveFreeComponentFlowBoundary")
126  {
128  config.config, config.boundary_mesh, dof_table, variable_id,
129  *config.component_id, integration_order, parameters,
130  bulk_mesh.getDimension(), process, shapefunction_order);
131  }
132  if (type == "NormalTraction")
133  {
134  switch (bulk_mesh.getDimension())
135  {
136  case 2:
137  return ProcessLib::NormalTractionBoundaryCondition::
138  createNormalTractionBoundaryCondition<2>(
139  config.config, config.boundary_mesh, dof_table,
140  variable_id, integration_order, shapefunction_order,
141  parameters);
142  case 3:
143  return ProcessLib::NormalTractionBoundaryCondition::
144  createNormalTractionBoundaryCondition<3>(
145  config.config, config.boundary_mesh, dof_table,
146  variable_id, integration_order, shapefunction_order,
147  parameters);
148  default:
149  OGS_FATAL(
150  "NormalTractionBoundaryCondition can not be instantiated "
151  "for mesh dimensions other than two or three. "
152  "{}-dimensional mesh was given.",
153  bulk_mesh.getDimension());
154  }
155  }
156  if (type == "PhaseFieldIrreversibleDamageOracleBoundaryCondition")
157  {
158  return ProcessLib::
161  config.config, dof_table, bulk_mesh, variable_id,
162  *config.component_id);
163  }
164  OGS_FATAL("Unknown boundary condition type: `{:s}'.", type);
165 }
bool isAxiallySymmetric() const
Definition: Mesh.h:132
unsigned getDimension() const
Returns the dimension of the mesh (determined by the maximum dimension over all elements).
Definition: Mesh.h:83
std::unique_ptr< PythonBoundaryCondition > createPythonBoundaryCondition(BaseLib::ConfigTree const &config, MeshLib::Mesh const &boundary_mesh, NumLib::LocalToGlobalIndexMap const &dof_table_bulk, MeshLib::Mesh const &bulk_mesh, int const variable_id, int const component_id, unsigned const integration_order, unsigned const shapefunction_order, std::vector< std::reference_wrapper< ProcessVariable >> const &all_process_variables_for_this_process)
Creates a new PythonBoundaryCondition object.
std::unique_ptr< 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< 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::isAxiallySymmetric(), OGS_FATAL, and BaseLib::ConfigTree::peekConfigParameter().

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

◆ createBoundaryCondition() [2/2]

std::unique_ptr<BoundaryCondition> ProcessLib::createBoundaryCondition ( const BoundaryConditionConfig config,
const NumLib::LocalToGlobalIndexMap dof_table,
const MeshLib::Mesh bulk_mesh,
const int  variable_id,
const unsigned  integration_order,
const unsigned  shapefunction_order,
const std::vector< std::unique_ptr< ParameterLib::ParameterBase >> &  parameters,
const Process process,
std::vector< std::reference_wrapper< ProcessVariable >> const &  all_process_variables_for_this_process 
)

◆ 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 176 of file CentralDifferencesJacobianAssembler.cpp.

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

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

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

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

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(), OGS_FATAL, and MathLib::t.

Referenced by createBoundaryCondition().

◆ createDeactivatedSubdomain()

DeactivatedSubdomain ProcessLib::createDeactivatedSubdomain ( BaseLib::ConfigTree const &  config,
MeshLib::Mesh const &  mesh,
std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const &  parameters,
std::map< std::string, std::unique_ptr< MathLib::PiecewiseLinearInterpolation >> const &  curves 
)
Input File Parameter:
prj__process_variables__process_variable__deactivated_subdomains__deactivated_subdomain__time_interval
Input File Parameter:
prj__process_variables__process_variable__deactivated_subdomains__deactivated_subdomain__time_curve
Input File Parameter:
prj__process_variables__process_variable__deactivated_subdomains__deactivated_subdomain__line_segment
Input File Parameter:
prj__process_variables__process_variable__deactivated_subdomains__deactivated_subdomain__boundary_parameter
Input File Parameter:
prj__process_variables__process_variable__deactivated_subdomains__deactivated_subdomain__material_ids

Definition at line 216 of file CreateDeactivatedSubdomain.cpp.

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

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

Referenced by createDeactivatedSubdomains().

◆ createDeactivatedSubdomainMesh()

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

Definition at line 92 of file CreateDeactivatedSubdomain.cpp.

95 {
96  // An element is active if its material id matches one of the deactivated
97  // subdomain material ids.
98  auto is_active = [deactivated_subdomain_material_ids,
99  material_ids = *materialIDs(mesh)](std::size_t element_id)
100  {
101  int const element_material_id = material_ids[element_id];
102  return std::any_of(begin(deactivated_subdomain_material_ids),
103  end(deactivated_subdomain_material_ids),
104  [&](int const material_id)
105  { return material_id == element_material_id; });
106  };
107 
108  auto const& elements = mesh.getElements();
109  std::vector<MeshLib::Element*> deactivated_elements;
110  ranges::copy_if(elements, back_inserter(deactivated_elements), is_active,
111  [](auto const e) { return e->getID(); });
112 
113  auto bulk_element_ids =
114  deactivated_elements | MeshLib::views::ids | ranges::to<std::vector>;
115 
116  static int mesh_number = 0;
117  // Subdomain mesh consisting of deactivated elements.
119  "deactivate_subdomain_" + std::to_string(mesh_number++),
120  MeshLib::cloneElements(deactivated_elements));
121 
122  auto [inner_nodes, outer_nodes] =
123  extractInnerAndOuterNodes(mesh, *sub_mesh, is_active);
124 
125  auto outer_nodes_elements =
126  extractElementsAlongOuterNodes(mesh, *sub_mesh, outer_nodes);
127 
128  return {std::move(*sub_mesh), std::move(bulk_element_ids),
129  std::move(inner_nodes), std::move(outer_nodes),
130  std::move(outer_nodes_elements)};
131 }
constexpr bool any_of(List const &values)
Checks if any of the elements in the given list is true.
Definition: Algorithm.h:325
constexpr ranges::views::view_closure ids
For an element of a range view return its id.
Definition: Mesh.h:314
std::unique_ptr< MeshLib::Mesh > createMeshFromElementSelection(std::string mesh_name, std::vector< MeshLib::Element * > const &elements)
Definition: Mesh.cpp:279
std::vector< Element * > cloneElements(std::vector< Element * > const &elements)
Clones a vector of elements using the Element::clone() function.
static std::pair< std::vector< std::size_t >, std::vector< std::size_t > > extractInnerAndOuterNodes(MeshLib::Mesh const &mesh, MeshLib::Mesh const &sub_mesh, IsActive is_active)
static std::vector< std::vector< std::size_t > > extractElementsAlongOuterNodes(MeshLib::Mesh const &mesh, MeshLib::Mesh const &sub_mesh, std::vector< std::size_t > const &outer_nodes)

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

Referenced by createDeactivatedSubdomain().

◆ createDeactivatedSubdomains()

std::vector< DeactivatedSubdomain > ProcessLib::createDeactivatedSubdomains ( BaseLib::ConfigTree const &  config,
MeshLib::Mesh const &  mesh,
std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const &  parameters,
std::map< std::string, std::unique_ptr< MathLib::PiecewiseLinearInterpolation >> const &  curves 
)
Input File Parameter:
prj__process_variables__process_variable__deactivated_subdomains
Input File Parameter:
prj__process_variables__process_variable__deactivated_subdomains__deactivated_subdomain

Definition at line 299 of file CreateDeactivatedSubdomain.cpp.

306 {
307  std::vector<DeactivatedSubdomain> deactivated_subdomains;
308  // Deactivated subdomains
309  if (auto subdomains_config =
311  config.getConfigSubtreeOptional("deactivated_subdomains"))
312  {
313  INFO("There are subdomains being deactivated.");
314 
315  auto const deactivated_subdomain_configs =
317  subdomains_config->getConfigSubtreeList("deactivated_subdomain");
318  std::transform(std::begin(deactivated_subdomain_configs),
319  std::end(deactivated_subdomain_configs),
320  std::back_inserter(deactivated_subdomains),
321  [&](auto const& config) {
323  config, mesh, parameters, curves);
324  });
325  }
326  return deactivated_subdomains;
327 }
void INFO(fmt::format_string< Args... > fmt, Args &&... args)
Definition: Logging.h:34
DeactivatedSubdomain createDeactivatedSubdomain(BaseLib::ConfigTree const &config, MeshLib::Mesh const &mesh, std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const &parameters, std::map< std::string, std::unique_ptr< MathLib::PiecewiseLinearInterpolation >> const &curves)

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

◆ createDirichletBoundaryCondition()

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

Definition at line 56 of file DirichletBoundaryCondition.cpp.

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

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

Referenced by createBoundaryCondition().

◆ createDirichletBoundaryConditionWithinTimeInterval()

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

Definition at line 20 of file CreateDirichletBoundaryConditionWithinTimeInterval.cpp.

25 {
26  DBUG(
27  "Constructing DirichletBoundaryConditionWithinTimeInterval from "
28  "config.");
29 
31  config.checkConfigParameter("type", "DirichletWithinTimeInterval");
32 
34  auto const param_name = config.getConfigParameter<std::string>("parameter");
35  DBUG("Using parameter {:s}", param_name);
36 
37  auto& param = ParameterLib::findParameter<double>(param_name, parameters, 1,
38  &bc_mesh);
39 
41  config.peekConfigParameter<std::string>("time_interval");
42  auto time_interval = BaseLib::createTimeInterval(config);
43 
44 // In case of partitioned mesh the boundary could be empty, i.e. there is no
45 // boundary condition.
46 #ifdef USE_PETSC
47  // This can be extracted to createBoundaryCondition() but then the config
48  // parameters are not read and will cause an error.
49  // TODO (naumov): Add a function to ConfigTree for skipping the tags of the
50  // subtree and move the code up in createBoundaryCondition().
51  if (bc_mesh.getDimension() == 0 && bc_mesh.getNumberOfNodes() == 0 &&
52  bc_mesh.getNumberOfElements() == 0)
53  {
54  return nullptr;
55  }
56 #endif // USE_PETSC
57 
58  return std::make_unique<DirichletBoundaryConditionWithinTimeInterval>(
59  std::move(time_interval), param, bc_mesh, dof_table_bulk, variable_id,
60  component_id);
61 }
TimeInterval createTimeInterval(ConfigTree const &config)

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

Referenced by createBoundaryCondition().

◆ createForwardDifferencesJacobianAssembler()

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

Definition at line 19 of file CreateForwardDifferencesJacobianAssembler.cpp.

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

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

Referenced by createJacobianAssembler().

◆ createHCNonAdvectiveFreeComponentFlowBoundaryCondition()

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

Definition at line 19 of file HCNonAdvectiveFreeComponentFlowBoundaryCondition.cpp.

26 {
27  DBUG(
28  "Constructing open boundary for Component Transport process from "
29  "config.");
31  config.checkConfigParameter("type",
32  "HCNonAdvectiveFreeComponentFlowBoundary");
33 
34  if (bc_mesh.getDimension() + 1 != global_dim)
35  {
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 22 of file CreateJacobianAssembler.cpp.

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

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

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

◆ createLocalAssemblers() [1/2]

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

Creates local assemblers for each element of the given mesh.

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

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

Definition at line 74 of file CreateLocalAssemblers.h.

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

References DBUG(), and OGS_FATAL.

◆ createLocalAssemblers() [2/2]

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

Definition at line 27 of file CreateLocalAssemblers.h.

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

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

◆ createLocalAssemblersHM()

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

Definition at line 85 of file CreateLocalAssemblersTaylorHood.h.

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

References ProcessLib::detail::createLocalAssemblersTaylorHood().

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

◆ createLocalAssemblersStokes()

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

Definition at line 106 of file CreateLocalAssemblersTaylorHood.h.

112 {
114  LocalAssemblerFactoryStokes, GlobalDim, LocalAssemblerImplementation,
115  LocalAssemblerInterface>(
116  mesh_elements, dof_table, local_assemblers, provider_or_order,
117  std::forward<ExtraCtorArgs>(extra_ctor_args)...);
118 }
LocalAssemblerFactoryTaylorHood< 2, 2, LocalAssemblerInterface, LocalAssemblerImplementation, IntegrationMethodProvider, GlobalDim, ConstructorArgs... > LocalAssemblerFactoryStokes
Stokes flow in OGS is defined for higher order elements only.

References ProcessLib::detail::createLocalAssemblersTaylorHood().

◆ 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::vector< Output > ProcessLib::createOutput ( const BaseLib::ConfigTree config,
std::string const &  output_directory,
std::vector< std::unique_ptr< MeshLib::Mesh >> const &  meshes 
)

Definition at line 250 of file CreateOutput.cpp.

254 {
255  std::vector<Output> outputs;
256  parseOutput(config, output_directory, meshes, outputs);
257  return outputs;
258 }
void parseOutput(const BaseLib::ConfigTree &config, std::string const &output_directory, std::vector< std::unique_ptr< MeshLib::Mesh >> const &meshes, std::vector< Output > &outputs)

References parseOutput().

Referenced by createTimeLoop().

◆ createOutputFormat()

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

Definition at line 69 of file CreateOutput.cpp.

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

References anonymous_namespace{CreateOutput.cpp}::convertVtkDataMode(), OGS_FATAL, BaseLib::to_underlying(), vtk, and xdmf.

Referenced by parseOutput().

◆ createOutputs()

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

Definition at line 260 of file CreateOutput.cpp.

264 {
265  DBUG("Parse outputs configuration:");
266  std::vector<Output> outputs;
267  for (auto const& output_config :
269  output_configs.getConfigSubtreeList("output"))
270  {
271  parseOutput(output_config, output_directory, meshes, outputs);
272  }
273  if (areOutputNamesUnique(outputs))
274  {
275  return outputs;
276  }
277  else
278  {
279  OGS_FATAL(
280  "Output configuration paths are not unique. This will lead to "
281  "overwritten results or invalid / corrupted data within the "
282  "files.");
283  }
284 }
Range< SubtreeIterator > getConfigSubtreeList(std::string const &root) const
Definition: ConfigTree.cpp:173
bool areOutputNamesUnique(std::vector< ProcessLib::Output > const &outputs)

References anonymous_namespace{CreateOutput.cpp}::areOutputNamesUnique(), DBUG(), BaseLib::ConfigTree::getConfigSubtreeList(), OGS_FATAL, and parseOutput().

Referenced by createTimeLoop().

◆ createPerProcessData()

std::vector< std::unique_ptr< ProcessData > > ProcessLib::createPerProcessData ( BaseLib::ConfigTree const &  config,
std::vector< std::unique_ptr< Process >> const &  processes,
std::map< std::string, std::unique_ptr< NumLib::NonlinearSolverBase >> const &  nonlinear_solvers,
bool const  compensate_non_equilibrium_initial_residuum 
)
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__output

Definition at line 72 of file CreateProcessData.cpp.

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

◆ createProcessOutputData()

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

Extracts data necessary for output from the given process.

Definition at line 143 of file ProcessOutputData.cpp.

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

References anonymous_namespace{ProcessOutputData.cpp}::computeOutputMeshDofTables(), anonymous_namespace{ProcessOutputData.cpp}::getDofTablesOfAllProcesses(), anonymous_namespace{ProcessOutputData.cpp}::getIntegrationPointWriters(), anonymous_namespace{ProcessOutputData.cpp}::getProcessVariablesOfAllProcesses(), and ProcessLib::Process::getSecondaryVariables().

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

◆ createPythonBoundaryCondition()

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

Creates a new PythonBoundaryCondition object.

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

Definition at line 256 of file PythonBoundaryCondition.cpp.

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

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

Referenced by createBoundaryCondition().

◆ createPythonSourceTerm()

std::unique_ptr< SourceTerm > ProcessLib::createPythonSourceTerm ( BaseLib::ConfigTree const &  config,
MeshLib::Mesh const &  source_term_mesh,
std::unique_ptr< NumLib::LocalToGlobalIndexMap dof_table,
int const  variable_id,
int const  component_id,
unsigned const  integration_order,
unsigned const  shapefunction_order,
unsigned const  global_dim,
std::vector< std::reference_wrapper< ProcessVariable >> const &  all_process_variables_for_this_process 
)
Input File Parameter:
prj__process_variables__process_variable__source_terms__source_term__type
Input File Parameter:
prj__process_variables__process_variable__source_terms__source_term__Python__source_term_object
Input File Parameter:
prj__process_variables__process_variable__source_terms__source_term__Python__flush_stdout

Definition at line 23 of file CreatePythonSourceTerm.cpp.

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

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

Referenced by createSourceTerm().

◆ createRobinBoundaryCondition()

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

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

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

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

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

Definition at line 17 of file RobinBoundaryCondition.cpp.

23 {
24  DBUG("Constructing RobinBcConfig from config.");
26  config.checkConfigParameter("type", "Robin");
27 
28  if (bc_mesh.getDimension() >= global_dim)
29  {
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(fmt::format_string< Args... > fmt, Args &&... args)
Definition: Logging.h:39

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 99 of file SolutionDependentDirichletBoundaryCondition.cpp.

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

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

Referenced by createBoundaryCondition().

◆ createSourceTerm() [1/2]

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,
[[maybe_unused] ] std::vector< std::reference_wrapper< ProcessVariable >> const &  all_process_variables_for_this_process 
)
Input File Parameter:
prj__process_variables__process_variable__source_terms__source_term__type

Definition at line 23 of file CreateSourceTerm.cpp.

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

◆ createSourceTerm() [2/2]

std::unique_ptr<SourceTerm> ProcessLib::createSourceTerm ( const SourceTermConfig config,
const NumLib::LocalToGlobalIndexMap dof_table_bulk,
const MeshLib::Mesh source_term_mesh,
const int  variable_id,
const unsigned  integration_order,
const unsigned  shapefunction_order,
std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const &  parameters,
std::vector< std::reference_wrapper< ProcessVariable >> const &  all_process_variables_for_this_process 
)

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

Builds a TimeLoop from the given configuration.

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

Definition at line 23 of file CreateTimeLoop.cpp.

30 {
31  auto const& coupling_config
33  = config.getConfigSubtreeOptional("global_process_coupling");
34 
35  std::vector<std::unique_ptr<NumLib::ConvergenceCriterion>>
36  global_coupling_conv_criteria;
37  int max_coupling_iterations = 1;
38  if (coupling_config)
39  {
40  max_coupling_iterations
42  = coupling_config->getConfigParameter<int>("max_iter");
43 
44  auto const& coupling_convergence_criteria_config =
46  coupling_config->getConfigSubtree("convergence_criteria");
47 
48  for (
49  auto coupling_convergence_criterion_config :
51  coupling_convergence_criteria_config.getConfigSubtreeList(
52  "convergence_criterion"))
53  {
54  global_coupling_conv_criteria.push_back(
56  coupling_convergence_criterion_config));
57  }
58  }
59 
61  auto output_config_tree = config.getConfigSubtreeOptional("output");
62  if (!output_config_tree)
63  {
64  INFO("No output section found.");
65  }
66  auto outputs =
67  output_config_tree
68  ? createOutput(*output_config_tree, output_directory, meshes)
70  : createOutputs(config.getConfigSubtree("outputs"),
71  output_directory, meshes);
72 
73  auto per_process_data = createPerProcessData(
75  config.getConfigSubtree("processes"), processes, nonlinear_solvers,
76  compensate_non_equilibrium_initial_residuum);
77 
78  const bool use_staggered_scheme =
79  ranges::any_of(processes.begin(), processes.end(),
80  [](auto const& process)
81  { return !(process->isMonolithicSchemeUsed()); });
82 
83  if (!use_staggered_scheme && per_process_data.size() > 1)
84  {
85  OGS_FATAL(
86  "The monolithic scheme is used. However more than one process data "
87  "tags (by name \"process\") inside tag \"time_loop\" are defined "
88  "for the staggered scheme. If you want to use staggered scheme, "
89  "please set the element of tag \"<coupling_scheme>\" to "
90  "\"staggered\".");
91  }
92 
93  if (coupling_config)
94  {
95  if (global_coupling_conv_criteria.size() != per_process_data.size())
96  {
97  OGS_FATAL(
98  "The number of convergence criteria of the global staggered "
99  "coupling loop is not identical to the number of the "
100  "processes! Please check the element by tag "
101  "global_process_coupling in the project file.");
102  }
103  }
104 
105  const auto minmax_iter =
106  std::minmax_element(per_process_data.begin(),
107  per_process_data.end(),
108  [](std::unique_ptr<ProcessData> const& a,
109  std::unique_ptr<ProcessData> const& b) {
110  return (a->timestep_algorithm->end() <
111  b->timestep_algorithm->end());
112  });
113  const double start_time =
114  per_process_data[minmax_iter.first - per_process_data.begin()]
115  ->timestep_algorithm->begin();
116  const double end_time =
117  per_process_data[minmax_iter.second - per_process_data.begin()]
118  ->timestep_algorithm->end();
119 
120  return std::make_unique<TimeLoop>(
121  std::move(outputs), std::move(per_process_data),
122  max_coupling_iterations, std::move(global_coupling_conv_criteria),
123  start_time, end_time);
124 }
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< Output > createOutputs(const BaseLib::ConfigTree &output_configs, std::string const &output_directory, std::vector< std::unique_ptr< MeshLib::Mesh >> const &meshes)
std::vector< std::unique_ptr< ProcessData > > createPerProcessData(BaseLib::ConfigTree const &config, std::vector< std::unique_ptr< Process >> const &processes, std::map< std::string, std::unique_ptr< NumLib::NonlinearSolverBase >> const &nonlinear_solvers, bool const compensate_non_equilibrium_initial_residuum)

References BaseLib::any_of(), NumLib::createConvergenceCriterion(), createOutput(), createOutputs(), createPerProcessData(), BaseLib::ConfigTree::getConfigSubtree(), BaseLib::ConfigTree::getConfigSubtreeOptional(), INFO(), 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 dof_table_boundary_other_variable =
78  dof_table.deriveBoundaryConstrainedMap(
79  (variable_id + 1) % 2, {component_id}, std::move(bc_mesh_subset));
80 
81  // In case of partitioned mesh the boundary could be empty, i.e. there is no
82  // boundary condition.
83 #ifdef USE_PETSC
84  // This can be extracted to createBoundaryCondition() but then the config
85  // parameters are not read and will cause an error.
86  // TODO (naumov): Add a function to ConfigTree for skipping the tags of the
87  // subtree and move the code up in createBoundaryCondition().
88  if (bc_mesh.getDimension() == 0 && bc_mesh.getNumberOfNodes() == 0 &&
89  bc_mesh.getNumberOfElements() == 0)
90  {
91  return nullptr;
92  }
93 #endif // USE_PETSC
94 
95  return std::make_unique<VariableDependentNeumannBoundaryCondition>(
96  integration_order, shapefunction_order, dof_table, variable_id,
97  component_id, global_dim, bc_mesh,
98  VariableDependentNeumannBoundaryConditionData{
99  constant, coefficient_current_variable, coefficient_other_variable,
100  coefficient_mixed_variables,
101  std::move(dof_table_boundary_other_variable)});
102 }

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

Referenced by createBoundaryCondition().

◆ createVolumetricSourceTerm()

std::unique_ptr< SourceTerm > ProcessLib::createVolumetricSourceTerm ( BaseLib::ConfigTree const &  config,
unsigned const  bulk_mesh_dimension,
MeshLib::Mesh const &  source_term_mesh,
std::unique_ptr< NumLib::LocalToGlobalIndexMap source_term_dof_table,
std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const &  parameters,
unsigned const  integration_order,
unsigned const  shapefunction_order 
)
Input File Parameter:
prj__process_variables__process_variable__source_terms__source_term__type
Input File Parameter:
prj__process_variables__process_variable__source_terms__source_term__type
Input File Parameter:
prj__process_variables__process_variable__source_terms__source_term__type
Input File Parameter:
prj__process_variables__process_variable__source_terms__source_term__Volumetric__parameter
Input File Parameter:
prj__process_variables__process_variable__source_terms__source_term__Line__parameter

Definition at line 22 of file CreateVolumetricSourceTerm.cpp.

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

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

Referenced by createSourceTerm().

◆ extractElementsAlongOuterNodes()

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

Definition at line 70 of file CreateDeactivatedSubdomain.cpp.

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

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

Referenced by createDeactivatedSubdomainMesh().

◆ extractInnerAndOuterNodes()

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

Definition at line 31 of file CreateDeactivatedSubdomain.cpp.

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

References BaseLib::all_of(), MeshLib::Mesh::getElementsConnectedToNode(), MeshLib::Mesh::getNode(), MeshLib::Mesh::getNodes(), MeshLib::Mesh::getNumberOfNodes(), MeshLib::Mesh::getProperties(), MeshLib::views::ids, 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 47 of file ProcessUtils.cpp.

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

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

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

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

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, DisplacementDim >::computeCrackIntegral(), ProcessLib::PhaseField::PhaseFieldLocalAssembler< ShapeFunction, DisplacementDim >::computeEnergy(), ProcessLib::ComponentTransport::ComponentTransportProcess::getFlux(), ProcessLib::HT::HTProcess::getFlux(), and ProcessLib::HT::StaggeredHTFEM< ShapeFunction, GlobalDim >::getIntPtDarcyVelocity().

◆ getEssentialBCValuesLocal() [1/2]

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

Definition at line 112 of file DirichletBoundaryConditionAuxiliaryFunctions.cpp.

118 {
120  parameter, bc_mesh,
121  bc_mesh.getNodes() | MeshLib::views::ids | ranges::to<std::vector>,
122  dof_table_boundary, variable_id, component_id, t, x, bc_values);
123 }
void getEssentialBCValuesLocal(ParameterLib::Parameter< double > const &parameter, MeshLib::Mesh const &bc_mesh, NumLib::LocalToGlobalIndexMap const &dof_table_boundary, int const variable_id, int const component_id, const double t, GlobalVector const &x, NumLib::IndexValueVector< GlobalIndexType > &bc_values)

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

◆ getEssentialBCValuesLocal() [2/2]

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

Definition at line 68 of file DirichletBoundaryConditionAuxiliaryFunctions.cpp.

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

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

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

◆ getIntegrationPointDataMaterialStateVariables()

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

Definition at line 208 of file SetOrGetIntegrationPointData.h.

214 {
215  std::vector<double> result;
216  result.reserve(ip_data_vector.size() * n_components);
217 
218  for (auto& ip_data : ip_data_vector)
219  {
220  auto const values_span = get_values_span(*(ip_data.*member));
221  assert(values_span.size() == static_cast<std::size_t>(n_components));
222 
223  result.insert(end(result), values_span.begin(), values_span.end());
224  }
225 
226  return result;
227 }

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

◆ getIntegrationPointKelvinVectorData() [1/3]

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

Definition at line 39 of file SetOrGetIntegrationPointData.h.

42 {
43  using AccessorResult = decltype(std::declval<Accessor>()(
44  std::declval<IntegrationPointDataVector>()[0]));
45  static_assert(std::is_lvalue_reference_v<AccessorResult>,
46  "The ip data accessor should return a reference. This check "
47  "prevents accidental copies.");
48 
49  constexpr int kelvin_vector_size =
51  auto const n_integration_points = ip_data_vector.size();
52 
53  cache.clear();
54  auto cache_mat = MathLib::createZeroedMatrix<Eigen::Matrix<
55  double, kelvin_vector_size, Eigen::Dynamic, Eigen::RowMajor>>(
56  cache, kelvin_vector_size, n_integration_points);
57 
58  for (unsigned ip = 0; ip < n_integration_points; ++ip)
59  {
60  auto const& kelvin_vector = accessor(ip_data_vector[ip]);
61  cache_mat.col(ip) =
63  }
64 
65  return cache;
66 }
Eigen::Matrix< double, 4, 1 > kelvinVectorToSymmetricTensor(Eigen::Matrix< double, 4, 1, Eigen::ColMajor, 4, 1 > const &v)
constexpr int kelvin_vector_dimensions(int const displacement_dim)
Kelvin vector dimensions for given displacement dimension.
Definition: KelvinVector.h:24
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/3]

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

Definition at line 25 of file SetOrGetIntegrationPointData.h.

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

◆ getIntegrationPointKelvinVectorData() [3/3]

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

Overload without cache argument.

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

Definition at line 74 of file SetOrGetIntegrationPointData.h.

76 {
77  constexpr int kelvin_vector_size =
79 
80  return transposeInPlace<kelvin_vector_size>(
81  [&](std::vector<double>& values)
82  {
83  return getIntegrationPointKelvinVectorData<DisplacementDim>(
84  ip_data_vector, member, values);
85  ;
86  });
87 }

References MathLib::KelvinVector::kelvin_vector_dimensions().

◆ getIntegrationPointScalarData() [1/2]

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

Definition at line 148 of file SetOrGetIntegrationPointData.h.

151 {
152  using AccessorResult = decltype(std::declval<Accessor>()(
153  std::declval<IntegrationPointDataVector>()[0]));
154  static_assert(std::is_lvalue_reference_v<AccessorResult>,
155  "The ip data accessor should return a reference. This check "
156  "prevents accidental copies.");
157 
158  auto const n_integration_points = ip_data_vector.size();
159 
160  cache.clear();
161  auto cache_mat = MathLib::createZeroedMatrix<
162  Eigen::Matrix<double, 1, Eigen::Dynamic, Eigen::RowMajor>>(
163  cache, 1, n_integration_points);
164 
165  for (unsigned ip = 0; ip < n_integration_points; ++ip)
166  {
167  cache_mat[ip] = accessor(ip_data_vector[ip]);
168  }
169 
170  return cache;
171 }

References MathLib::createZeroedMatrix().

◆ getIntegrationPointScalarData() [2/2]

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

Definition at line 135 of file SetOrGetIntegrationPointData.h.

138 {
140  ip_data_vector,
141  [member](IpData const& ip_data) -> auto const& {
142  return ip_data.*member;
143  },
144  cache);
145 }
std::vector< double > const & getIntegrationPointScalarData(IntegrationPointDataVector const &ip_data_vector, Accessor &&accessor, std::vector< double > &cache)

Referenced by ProcessLib::SmallDeformationNonlocal::SmallDeformationNonlocalLocalAssembler< ShapeFunction, DisplacementDim >::getIntPtDamage(), ProcessLib::RichardsMechanics::RichardsMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::getIntPtDryDensitySolid(), ProcessLib::ThermoRichardsFlow::ThermoRichardsFlowLocalAssembler< ShapeFunction, GlobalDim >::getIntPtDryDensitySolid(), ProcessLib::TH2M::TH2MLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::getIntPtEnthalpyGas(), ProcessLib::TH2M::TH2MLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::getIntPtEnthalpyLiquid(), ProcessLib::TH2M::TH2MLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::getIntPtEnthalpySolid(), ProcessLib::TH2M::TH2MLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::getIntPtGasDensity(), ProcessLib::TH2M::TH2MLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::getIntPtLiquidDensity(), ProcessLib::TH2M::TH2MLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::getIntPtMassFractionGas(), ProcessLib::TH2M::TH2MLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::getIntPtMassFractionLiquid(), ProcessLib::RichardsMechanics::RichardsMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::getIntPtMicroPressure(), ProcessLib::RichardsMechanics::RichardsMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::getIntPtMicroSaturation(), ProcessLib::TH2M::TH2MLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::getIntPtMoleFractionGas(), ProcessLib::RichardsMechanics::RichardsMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::getIntPtPorosity(), ProcessLib::ThermoRichardsFlow::ThermoRichardsFlowLocalAssembler< ShapeFunction, GlobalDim >::getIntPtPorosity(), ProcessLib::TH2M::TH2MLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::getIntPtPorosity(), ProcessLib::TH2M::TH2MLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::getIntPtRelativePermeabilityGas(), ProcessLib::TH2M::TH2MLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::getIntPtRelativePermeabilityLiquid(), ProcessLib::RichardsMechanics::RichardsMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::getIntPtSaturation(), ProcessLib::ThermoRichardsFlow::ThermoRichardsFlowLocalAssembler< ShapeFunction, GlobalDim >::getIntPtSaturation(), ProcessLib::TH2M::TH2MLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::getIntPtSaturation(), ProcessLib::TH2M::TH2MLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::getIntPtSolidDensity(), ProcessLib::RichardsMechanics::RichardsMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::getIntPtTransportPorosity(), and ProcessLib::TH2M::TH2MLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, 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 164 of file SecondaryVariable.h.

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

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

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(), ProcessLib::TES::TESProcess::initializeSecondaryVariables(), and makeExtrapolator2().

◆ makeExtrapolator2()

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

A variant that takes an accessor function as a callback.

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

Definition at line 213 of file SecondaryVariable.h.

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

References makeExtrapolator(), and transposeInPlace().

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

◆ makeProcessData()

static std::unique_ptr<ProcessData> ProcessLib::makeProcessData ( std::unique_ptr< NumLib::TimeStepAlgorithm > &&  timestepper,
NumLib::NonlinearSolverBase nonlinear_solver,
int const  process_id,
Process process,
std::unique_ptr< NumLib::TimeDiscretization > &&  time_disc,
std::unique_ptr< NumLib::ConvergenceCriterion > &&  conv_crit,
bool const  compensate_non_equilibrium_initial_residuum 
)
static

Definition at line 22 of file CreateProcessData.cpp.

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

References OGS_FATAL.

Referenced by createPerProcessData().

◆ operator<<() [1/4]

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

Definition at line 281 of file Output.cpp.

282 {
283  os << "Output::_output_data_specification:\t"
284  << output._output_data_specification;
285  os << "Output::_output_format:\t" << *(output._output_format);
286  return os;
287 }

◆ operator<<() [2/4]

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

Definition at line 90 of file OutputDataSpecification.cpp.

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

References MathLib::LinAlg::copy(), ProcessLib::OutputDataSpecification::fixed_output_times, ProcessLib::OutputDataSpecification::output_residuals, ProcessLib::OutputDataSpecification::output_variables, and ProcessLib::OutputDataSpecification::repeats_each_steps.

◆ operator<<() [3/4]

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

Definition at line 50 of file OutputFormat.h.

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

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

◆ operator<<() [4/4]

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

Definition at line 83 of file OutputDataSpecification.cpp.

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

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

◆ outputMeshVtk() [1/2]

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

Definition at line 57 of file OutputFormat.cpp.

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

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

◆ outputMeshVtk() [2/2]

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

Definition at line 48 of file OutputFormat.cpp.

50 {
51  DBUG("Writing output to '{:s}'.", file_name);
52 
53  MeshLib::IO::VtuInterface vtu_interface(&mesh, data_mode, compress_output);
54  vtu_interface.writeToFile(file_name);
55 }
Reads and writes VtkXMLUnstructuredGrid-files (vtu) to and from OGS data structures....
Definition: VtuInterface.h:38

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

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

◆ parseCompensateNonEquilibriumInitialResiduum()

bool ProcessLib::parseCompensateNonEquilibriumInitialResiduum ( BaseLib::ConfigTree const &  config)
Input File Parameter:
prj__process_variables__process_variable__compensate_non_equilibrium_initial_residuum

Definition at line 96 of file ProcessVariable.cpp.

98 {
99  auto const compensate_non_equilibrium_initial_residuum_ptr =
101  config.getConfigParameterOptional<bool>(
102  "compensate_non_equilibrium_initial_residuum");
103 
104  return (compensate_non_equilibrium_initial_residuum_ptr &&
105  *compensate_non_equilibrium_initial_residuum_ptr);
106 }

References BaseLib::ConfigTree::getConfigParameterOptional().

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

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

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

Referenced by createDeactivatedSubdomain().

◆ parseOutput()

void ProcessLib::parseOutput ( const BaseLib::ConfigTree config,
std::string const &  output_directory,
std::vector< std::unique_ptr< MeshLib::Mesh >> const &  meshes,
std::vector< Output > &  outputs 
)
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 92 of file CreateOutput.cpp.

96 {
97  DBUG("Parse output configuration:");
98  OutputType const output_type = [](auto output_type)
99  {
100  try
101  {
102  const std::map<std::string, OutputType> outputType_to_enum = {
103  {"VTK", OutputType::vtk}, {"XDMF", OutputType::xdmf}};
104  auto type = outputType_to_enum.at(output_type);
105 
106  return type;
107  }
108  catch (std::out_of_range&)
109  {
110  OGS_FATAL(
111  "No supported file type provided. Read `{:s}' from <output><type> \
112  in prj File. Supported: VTK, XDMF.",
113  output_type);
114  }
116  }(config.getConfigParameter<std::string>("type"));
117 
118  auto const prefix =
120  config.getConfigParameter<std::string>("prefix", "{:meshname}");
121 
122  auto const suffix =
124  config.getConfigParameter<std::string>("suffix",
125  "_ts_{:timestep}_t_{:time}");
126 
127  auto const compress_output =
129  config.getConfigParameter("compress_output", true);
130 
131  auto const hdf =
133  config.getConfigSubtreeOptional("hdf");
134 
135  auto number_of_files = [&hdf]() -> unsigned int
136  {
137  if (hdf)
138  {
140  return hdf->getConfigParameter<unsigned int>("number_of_files");
141  }
142  return 1;
143  }();
144 
145  auto const data_mode =
147  config.getConfigParameter<std::string>("data_mode", "Appended");
148 
149  // Construction of output times
150  std::vector<PairRepeatEachSteps> repeats_each_steps;
151 
153  if (auto const timesteps = config.getConfigSubtreeOptional("timesteps"))
154  {
156  for (auto pair : timesteps->getConfigSubtreeList("pair"))
157  {
159  auto repeat = pair.getConfigParameter<unsigned>("repeat");
161  auto each_steps = pair.getConfigParameter<unsigned>("each_steps");
162 
163  assert(repeat != 0 && each_steps != 0);
164  repeats_each_steps.emplace_back(repeat, each_steps);
165  }
166 
167  if (repeats_each_steps.empty())
168  {
169  OGS_FATAL(
170  "You have not given any pair (<repeat/>, <each_steps/>) that "
171  "defines at which timesteps output shall be written. "
172  "Aborting.");
173  }
174  }
175  else
176  {
177  repeats_each_steps.emplace_back(1, 1);
178  }
179 
181  auto const out_vars = config.getConfigSubtree("variables");
182 
183  std::set<std::string> output_variables;
184  for (auto out_var :
186  out_vars.getConfigParameterList<std::string>("variable"))
187  {
188  if (output_variables.find(out_var) != output_variables.cend())
189  {
190  OGS_FATAL("output variable `{:s}' specified more than once.",
191  out_var);
192  }
193 
194  DBUG("adding output variable `{:s}'", out_var);
195  output_variables.insert(out_var);
196  }
197 
199  bool const output_residuals = config.getConfigParameter<bool>(
200  "output_extrapolation_residuals", false);
201 
202  std::vector<std::string> mesh_names_for_output;
204  if (auto const meshes_config = config.getConfigSubtreeOptional("meshes"))
205  {
206  if (prefix.find("{:meshname}") == std::string::npos)
207  {
208  OGS_FATAL(
209  "There are multiple meshes defined in the output section of "
210  "the project file, but the prefix doesn't contain "
211  "'{{:meshname}}'. Thus the names for the files, the simulation "
212  "results should be written to, would not be distinguishable "
213  "for different meshes.");
214  }
216  for (auto mesh_config : meshes_config->getConfigParameterList("mesh"))
217  {
218  // TODO CL check here that meshes name can be found in meshes list?
219  mesh_names_for_output.push_back(
220  mesh_config.getValue<std::string>());
221  INFO("Configure mesh '{:s}' for output.",
222  mesh_names_for_output.back());
223  }
224  }
225 
226  auto output_format = createOutputFormat(
227  output_directory, output_type, std::move(prefix), std::move(suffix),
228  data_mode, compress_output, number_of_files);
229 
230  std::vector<double> fixed_output_times =
232  config.getConfigParameter<std::vector<double>>("fixed_output_times",
233  {});
234  OutputDataSpecification output_data_specification{
235  std::move(output_variables), std::move(fixed_output_times),
236  std::move(repeats_each_steps), output_residuals};
237 
238  // Remove possible duplicated elements and sort.
239  BaseLib::makeVectorUnique(fixed_output_times);
240 
241  bool const output_iteration_results =
243  config.getConfigParameter<bool>("output_iteration_results", false);
244 
245  outputs.emplace_back(std::move(output_format), output_iteration_results,
246  std::move(output_data_specification),
247  std::move(mesh_names_for_output), meshes);
248 }
OutputType
std::optional< ConfigTree > getConfigSubtreeOptional(std::string const &root) const
Definition: ConfigTree.cpp:159
T getConfigParameter(std::string const &param) const
ConfigTree getConfigSubtree(std::string const &root) const
Definition: ConfigTree.cpp:150
std::unique_ptr< OutputFormat > createOutputFormat(std::string const &output_directory, OutputType const output_type, std::string prefix, std::string suffix, std::string const &data_mode, bool const compress_output, unsigned int const number_of_files)

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

Referenced by createOutput(), and createOutputs().

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

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

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

64 {
65  std::vector<GlobalVector*> x_dots;
66  x_dots.reserve(per_process_data.size());
67  xdot_vector_ids.resize(per_process_data.size());
68 
69  std::size_t cnt = 0;
70  for (auto& process_data : per_process_data)
71  {
72  auto const process_id = process_data->process_id;
73  auto const& ode_sys = *process_data->tdisc_ode_sys;
74  auto const& time_discretization = *process_data->time_disc;
75 
76  x_dots.emplace_back(&NumLib::GlobalVectorProvider::provider.getVector(
77  ode_sys.getMatrixSpecifications(process_id), xdot_vector_ids[cnt]));
78  cnt++;
79 
80  time_discretization.getXdot(*process_solutions[process_id],
81  *process_solutions_prev[process_id],
82  *x_dots[process_id]);
83  }
84 
85  // All _per_process_data share the first process.
86  bool const is_staggered_coupling =
87  !isMonolithicProcess(*per_process_data[0]);
88 
89  for (auto& process_data : per_process_data)
90  {
91  auto const process_id = process_data->process_id;
92  auto& pcs = process_data->process;
93 
94  if (is_staggered_coupling)
95  {
96  CoupledSolutionsForStaggeredScheme coupled_solutions(
97  process_solutions);
98  pcs.setCoupledSolutionsForStaggeredScheme(&coupled_solutions);
99  }
100  auto& x_dot = *x_dots[process_id];
101  pcs.computeSecondaryVariable(t, dt, process_solutions, x_dot,
102  process_id);
103  pcs.postTimestep(process_solutions, t, dt, process_id);
104  }
105  for (auto& x_dot : x_dots)
106  {
108  }
109 }
virtual void releaseVector(GlobalVector const &x)=0
bool isMonolithicProcess(ProcessLib::ProcessData const &process_data)
Definition: TimeLoop.cpp:24
static NUMLIB_EXPORT VectorProvider & provider

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

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

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

49 {
50  for (auto& process_data : per_process_data)
51  {
52  auto const process_id = process_data->process_id;
53  auto& pcs = process_data->process;
54  pcs.preTimestep(_process_solutions, t, dt, process_id);
55  }
56 }

References MathLib::t.

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

◆ 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(), and PYBIND11_MODULE().

◆ removeIPFieldDataNameSuffix()

std::string ProcessLib::removeIPFieldDataNameSuffix ( std::string const &  name)
inline

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

Definition at line 20 of file SetIPDataInitialConditions.h.

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

References MaterialPropertyLib::name, and OGS_FATAL.

Referenced by setIPDataInitialConditions().

◆ setEquationSystem()

void ProcessLib::setEquationSystem ( ProcessData const &  process_data)

Definition at line 17 of file ProcessData.cpp.

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

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

Referenced by calculateNonEquilibriumInitialResiduum(), and solveOneTimeStepOneProcess().

◆ setInitialConditions()

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

Definition at line 171 of file TimeLoop.cpp.

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

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 IntegrationPointDataVector , typename MemberType , typename MaterialStateVariables >
std::size_t ProcessLib::setIntegrationPointDataMaterialStateVariables ( double const *  values,
IntegrationPointDataVector &  ip_data_vector,
MemberType  member,
std::function< BaseLib::DynamicSpan< double >(MaterialStateVariables &)>  get_values_span 
)

Definition at line 231 of file SetOrGetIntegrationPointData.h.

237 {
238  auto const n_integration_points = ip_data_vector.size();
239 
240  std::size_t position = 0;
241  for (auto const& ip_data : ip_data_vector)
242  {
243  auto const values_span = get_values_span(*(ip_data.*member));
244  std::copy_n(values + position, values_span.size(), values_span.begin());
245  position += values_span.size();
246  }
247  return n_integration_points;
248 }

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

◆ setIntegrationPointKelvinVectorData() [1/2]

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

Definition at line 104 of file SetOrGetIntegrationPointData.h.

108 {
109  using AccessorResult = decltype(std::declval<Accessor>()(
110  std::declval<IntegrationPointDataVector>()[0]));
111  static_assert(std::is_lvalue_reference_v<AccessorResult>,
112  "The ip data accessor must return a reference.");
113 
114  constexpr int kelvin_vector_size =
116  auto const n_integration_points = ip_data_vector.size();
117 
118  auto kelvin_vector_values =
119  Eigen::Map<Eigen::Matrix<double, kelvin_vector_size, Eigen::Dynamic,
120  Eigen::ColMajor> const>(
121  values, kelvin_vector_size, n_integration_points);
122 
123  for (unsigned ip = 0; ip < n_integration_points; ++ip)
124  {
125  accessor(ip_data_vector[ip]) =
127  kelvin_vector_values.col(ip));
128  }
129 
130  return n_integration_points;
131 }
Eigen::Matrix< double, Eigen::MatrixBase< Derived >::RowsAtCompileTime, 1 > symmetricTensorToKelvinVector(Eigen::MatrixBase< Derived > const &v)
Definition: KelvinVector.h:171

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

◆ setIntegrationPointKelvinVectorData() [2/2]

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

Definition at line 91 of file SetOrGetIntegrationPointData.h.

95 {
96  return setIntegrationPointKelvinVectorData<DisplacementDim>(
97  values, ip_data_vector, [member](IpData & ip_data) -> auto& {
98  return ip_data.*member;
99  });
100 }

◆ setIntegrationPointScalarData() [1/2]

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

Definition at line 187 of file SetOrGetIntegrationPointData.h.

191 {
192  using AccessorResult = decltype(std::declval<Accessor>()(
193  std::declval<IntegrationPointDataVector>()[0]));
194  static_assert(std::is_lvalue_reference_v<AccessorResult>,
195  "The ip data accessor must return a reference.");
196 
197  auto const n_integration_points = ip_data_vector.size();
198 
199  for (unsigned ip = 0; ip < n_integration_points; ++ip)
200  {
201  accessor(ip_data_vector[ip]) = values[ip];
202  }
203  return n_integration_points;
204 }

◆ setIntegrationPointScalarData() [2/2]

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

◆ setIPDataInitialConditions()

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

Definition at line 34 of file SetIPDataInitialConditions.h.

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

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

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

◆ setTimeDiscretizedODESystem() [1/2]

void ProcessLib::setTimeDiscretizedODESystem ( ProcessData process_data)

Definition at line 165 of file TimeLoop.cpp.

166 {
167  setTimeDiscretizedODESystem(process_data, process_data.process);
168 }
void setTimeDiscretizedODESystem(ProcessData &process_data)
Definition: TimeLoop.cpp:165

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

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

References ProcessLib::ProcessData::nonlinear_solver, OGS_FATAL, ProcessLib::ProcessData::process_id, ProcessLib::ProcessData::tdisc_ode_sys, and ProcessLib::ProcessData::time_disc.

Referenced by ProcessLib::TimeLoop::initialize(), and setTimeDiscretizedODESystem().

◆ solveMonolithicProcess()

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

Definition at line 690 of file TimeLoop.cpp.

695 {
696  BaseLib::RunTime time_timestep_process;
697  time_timestep_process.start();
698 
699  auto const nonlinear_solver_status = solveOneTimeStepOneProcess(
700  x, x_prev, timestep_id, t, dt, process_data, outputs, xdot_id);
701 
702  INFO("[time] Solving process #{:d} took {:g} s in time step #{:d} ",
703  process_data.process_id, time_timestep_process.elapsed(), timestep_id);
704 
705  return nonlinear_solver_status;
706 }
Count the running time.
Definition: RunTime.h:29
double elapsed() const
Get the elapsed time in seconds.
Definition: RunTime.h:42
void start()
Start the timer.
Definition: RunTime.h:32
NumLib::NonlinearSolverStatus solveOneTimeStepOneProcess(std::vector< GlobalVector * > &x, std::vector< GlobalVector * > const &x_prev, std::size_t const timestep, double const t, double const delta_t, ProcessData const &process_data, std::vector< Output > const &outputs, std::size_t &xdot_id)
Definition: TimeLoop.cpp:229

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

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

◆ solveOneTimeStepOneProcess()

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

Definition at line 229 of file TimeLoop.cpp.

234 {
235  auto& process = process_data.process;
236  int const process_id = process_data.process_id;
237  auto& time_disc = *process_data.time_disc;
238  auto& ode_sys = *process_data.tdisc_ode_sys;
239  auto& nonlinear_solver = process_data.nonlinear_solver;
240 
241  setEquationSystem(process_data);
242 
243  // Note: Order matters!
244  // First advance to the next timestep, then set known solutions at that
245  // time, afterwards pass the right solution vector and time to the
246  // preTimestep() hook.
247 
248  time_disc.nextTimestep(t, delta_t);
249 
250  auto const post_iteration_callback =
251  [&](int iteration, std::vector<GlobalVector*> const& x)
252  {
253  for (auto const& output : outputs)
254  {
255  output.doOutputNonlinearIteration(process, process_id, timestep, t,
256  iteration, x);
257  }
258  };
259 
260  auto const nonlinear_solver_status =
261  nonlinear_solver.solve(x, x_prev, post_iteration_callback, process_id);
262 
263  if (!nonlinear_solver_status.error_norms_met)
264  {
265  return nonlinear_solver_status;
266  }
267 
269  ode_sys.getMatrixSpecifications(process_id), xdot_id);
270 
271  time_disc.getXdot(*x[process_id], *x_prev[process_id], x_dot);
272 
273  process.postNonLinearSolver(*x[process_id], x_dot, t, delta_t, process_id);
275 
276  return nonlinear_solver_status;
277 }
virtual GlobalVector & getVector(std::size_t &id)=0
Get an uninitialized vector with the given id.

References NumLib::VectorProvider::getVector(), ProcessLib::ProcessData::nonlinear_solver, ProcessLib::ProcessData::process, ProcessLib::ProcessData::process_id, NumLib::GlobalVectorProvider::provider, NumLib::VectorProvider::releaseVector(), setEquationSystem(), MathLib::t, ProcessLib::ProcessData::tdisc_ode_sys, and ProcessLib::ProcessData::time_disc.

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

◆ transposeInPlace() [1/3]

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

Definition at line 41 of file TransposeInPlace.h.

42 {
44  Eigen::Matrix<double, Eigen::Dynamic, Components, Eigen::RowMajor>>(
45  values, values.size() / Components, Components) =
47  Eigen::Matrix<double, Components, Eigen::Dynamic, Eigen::RowMajor>>(
48  values, Components, values.size() / Components)
49  .transpose()
50  .eval();
51 }
Eigen::Map< const Matrix > toMatrix(std::vector< double > const &data, Eigen::MatrixXd::Index rows, Eigen::MatrixXd::Index cols)
Definition: EigenMapTools.h:72

References MathLib::toMatrix().

◆ transposeInPlace() [2/3]

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

Definition at line 53 of file TransposeInPlace.h.

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

References MathLib::toMatrix().

◆ transposeInPlace() [3/3]

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

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

Definition at line 23 of file TransposeInPlace.h.

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

References MathLib::toMatrix().

Referenced by makeExtrapolator2().

Variable Documentation

◆ IntegrationMethodProviderOrIntegrationOrder

template<typename T >
concept ProcessLib::IntegrationMethodProviderOrIntegrationOrder
Initial value:
=
NumLib::IntegrationMethodProvider<T> ||
std::same_as<T, NumLib::IntegrationOrder>

Used for template type checks with createLocalAssemblers... functions.

With this concept the createLocalAssemblers... functions transparently support both OGS's default integration methods (requested via a NumLib::IntegrationOrder argument) and arbitrary NumLib::IntegrationMethodProvider's.

Definition at line 30 of file GenericLocalAssemblerFactory.h.

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

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