OGS
ProcessLib::TimeDecayDirichletBoundaryCondition Class Referencefinal

Detailed Description

Dirichlet boundary condition with time-dependent decay.

This boundary condition imposes the initial values of the specified primary variable at the boundary nodes, scaled by a time-dependent parameter. The scaling parameter should be monotonically decreasing over time, representing progressive removal or reduction of support (e.g., during excavation). Typically, the scaling factor starts at 1 ( \( g(0, \mathbf{x}) = 1 \)) at the initial time and decreases to 0 ( \( g(t_e, \mathbf{x}) = 0 \)) at the end of the process ( \( t_e \)). The value of the boundary condition is given by

\[ g(t, \mathbf{x}) (u_0(\mathbf{x}) - u_{\text{min}}) + u_{\text{min}} \]

, where \( u_0(\mathbf{x}) \) is the initial value of the primary variable at the boundary node \( \mathbf{x} \), and \( u_{\text{min}} \) is the user-defined lower limit of the boundary value.

Definition at line 49 of file TimeDecayDirichletBoundaryCondition.h.

#include <TimeDecayDirichletBoundaryCondition.h>

Inheritance diagram for ProcessLib::TimeDecayDirichletBoundaryCondition:
[legend]
Collaboration diagram for ProcessLib::TimeDecayDirichletBoundaryCondition:
[legend]

Public Member Functions

 TimeDecayDirichletBoundaryCondition (int const variable_id, int const component_id, MeshLib::Mesh const &boundary_mesh, NumLib::LocalToGlobalIndexMap const &dof_table_bulk, ParameterLib::Parameter< double > const &time_decay_parameter, double const lower_limit)
 Constructs a time decay Dirichlet boundary condition.
 
void getEssentialBCValues (const double t, GlobalVector const &x, NumLib::IndexValueVector< GlobalIndexType > &bc_values) const override
 Writes the values of essential BCs to bc_values.
 
- Public Member Functions inherited from ProcessLib::BoundaryCondition
virtual void applyNaturalBC (const double, std::vector< GlobalVector * > const &, int const, GlobalMatrix *, GlobalVector &, GlobalMatrix *)
 
virtual void preTimestep (const double, std::vector< GlobalVector * > const &, int const)
 
virtual void postTimestep (const double, std::vector< GlobalVector * > const &, int const)
 
virtual ~BoundaryCondition ()=default
 

Private Member Functions

void setInitialValues (GlobalVector const &x) const
 

Private Attributes

int const variable_id_
 
int const component_id_
 
MeshLib::Mesh const & boundary_mesh_
 
std::unique_ptr< NumLib::LocalToGlobalIndexMap > const dof_table_boundary_
 
ParameterLib::Parameter< double > const & time_decay_parameter_
 
double const lower_limit_
 The lower limit of the boundary value.
 
std::vector< double > initial_x_values_
 
bool initial_values_are_set_ = false
 

Constructor & Destructor Documentation

◆ TimeDecayDirichletBoundaryCondition()

ProcessLib::TimeDecayDirichletBoundaryCondition::TimeDecayDirichletBoundaryCondition ( int const variable_id,
int const component_id,
MeshLib::Mesh const & boundary_mesh,
NumLib::LocalToGlobalIndexMap const & dof_table_bulk,
ParameterLib::Parameter< double > const & time_decay_parameter,
double const lower_limit )
explicit

Constructs a time decay Dirichlet boundary condition.

Parameters
variable_idThe ID of the variable to which the condition are applied.
component_idThe ID of the variable component to which the condition are applied.
boundary_meshThe mesh representing the boundary where the nodal forces are applied.
dof_table_bulkA unique pointer to the DOF table created from the boundary mesh.
time_decay_parameterA parameter that defines the scaling factor of the initial nodal values. It should be a monotonic decrease parameter, meaning it should decrease over time.
lower_limitThe lower limit of the boundary value.

Definition at line 41 of file TimeDecayDirichletBoundaryCondition.cpp.

47 : variable_id_(variable_id),
48 component_id_(component_id),
49 boundary_mesh_(boundary_mesh),
51 variable_id, component_id, boundary_mesh, dof_table_bulk)),
52 time_decay_parameter_(time_decay_parameter),
53 lower_limit_(lower_limit)
54{
55}
std::unique_ptr< NumLib::LocalToGlobalIndexMap > const dof_table_boundary_
ParameterLib::Parameter< double > const & time_decay_parameter_
double const lower_limit_
The lower limit of the boundary value.
std::unique_ptr< NumLib::LocalToGlobalIndexMap > createBoundaryDOFTable(int const variable_id, int const component_id, MeshLib::Mesh const &boundary_mesh, NumLib::LocalToGlobalIndexMap const &dof_table_bulk)

Member Function Documentation

◆ getEssentialBCValues()

void ProcessLib::TimeDecayDirichletBoundaryCondition::getEssentialBCValues ( const double ,
GlobalVector const & ,
NumLib::IndexValueVector< GlobalIndexType > &  ) const
overridevirtual

Writes the values of essential BCs to bc_values.

Reimplemented from ProcessLib::BoundaryCondition.

Definition at line 84 of file TimeDecayDirichletBoundaryCondition.cpp.

87{
88 DBUG("Apply TimeDecayDirichlet boundary bondition.");
89
91 {
94 if (initial_x_values_.empty())
95 {
96 return; // No node in the boundary.
97 }
98 }
99
100 bc_values.ids.clear();
101 bc_values.values.clear();
102
103 bc_values.ids.reserve(initial_x_values_.size());
104 bc_values.values.reserve(initial_x_values_.size());
105
106 std::size_t idx = 0;
107 for (auto const* node : boundary_mesh_.getNodes())
108 {
109 auto const node_id = node->getID();
112
113 auto const global_index =
115
116 if (global_index == NumLib::MeshComponentMap::nop)
117 {
118 continue;
119 }
120 // For the DDC approach (e.g. with PETSc option), the negative
121 // index of global_index means that the entry by that index is a
122 // ghost one, which should be dropped. Especially for PETSc
123 // routines MatZeroRows and MatZeroRowsColumns, which are called
124 // to apply the Dirichlet BC, the negative index is not accepted
125 // like other matrix or vector PETSc routines. Therefore, the
126 // following if-condition is applied.
127 if (global_index >= 0) [[likely]]
128 {
130 pos.setNodeID(node_id);
131 pos.setCoordinates(*node);
132
133 bc_values.values.push_back(
134 time_decay_parameter_(t, pos).front() *
137 bc_values.ids.push_back(global_index);
138 idx++;
139 }
140 }
141}
void DBUG(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:30
std::vector< Node * > const & getNodes() const
Get the nodes-vector for the mesh.
Definition Mesh.h:108
std::size_t getID() const
Get id of the mesh.
Definition Mesh.h:123
static constexpr NUMLIB_EXPORT GlobalIndexType const nop
void setNodeID(std::size_t node_id)
void setCoordinates(MathLib::Point3d const &coordinates)

References boundary_mesh_, component_id_, DBUG(), dof_table_boundary_, MeshLib::Mesh::getID(), MeshLib::Mesh::getNodes(), NumLib::IndexValueVector< typename >::ids, initial_values_are_set_, initial_x_values_, lower_limit_, MeshLib::Node, NumLib::MeshComponentMap::nop, ParameterLib::SpatialPosition::setCoordinates(), setInitialValues(), ParameterLib::SpatialPosition::setNodeID(), time_decay_parameter_, NumLib::IndexValueVector< typename >::values, and variable_id_.

◆ setInitialValues()

void ProcessLib::TimeDecayDirichletBoundaryCondition::setInitialValues ( GlobalVector const & x) const
private

Definition at line 57 of file TimeDecayDirichletBoundaryCondition.cpp.

59{
60 initial_x_values_.clear();
61 for (auto const& l : MeshLib::views::meshLocations(
63 {
64 auto const global_index =
66 if (global_index == NumLib::MeshComponentMap::nop)
67 {
68 continue;
69 }
70 // For the DDC approach (e.g. with PETSc option), the negative
71 // index of global_index means that the entry by that index is
72 // a ghost one, which should be dropped. Especially for PETSc
73 // routines MatZeroRows and MatZeroRowsColumns, which are
74 // called to apply the Dirichlet BC, the negative index is not
75 // accepted like other matrix or vector PETSc routines.
76 // Therefore, the following if-condition is applied.
77 if (global_index >= 0) [[likely]]
78 {
79 initial_x_values_.push_back(x.get(global_index));
80 }
81 }
82}
auto meshLocations(Mesh const &mesh, MeshItemType const item_type)
Definition Mesh.h:238

References boundary_mesh_, component_id_, dof_table_boundary_, MathLib::EigenVector::get(), initial_x_values_, MeshLib::views::meshLocations(), MeshLib::Node, NumLib::MeshComponentMap::nop, and variable_id_.

Referenced by getEssentialBCValues().

Member Data Documentation

◆ boundary_mesh_

MeshLib::Mesh const& ProcessLib::TimeDecayDirichletBoundaryCondition::boundary_mesh_
private

Definition at line 84 of file TimeDecayDirichletBoundaryCondition.h.

Referenced by getEssentialBCValues(), and setInitialValues().

◆ component_id_

int const ProcessLib::TimeDecayDirichletBoundaryCondition::component_id_
private

Definition at line 82 of file TimeDecayDirichletBoundaryCondition.h.

Referenced by getEssentialBCValues(), and setInitialValues().

◆ dof_table_boundary_

std::unique_ptr<NumLib::LocalToGlobalIndexMap> const ProcessLib::TimeDecayDirichletBoundaryCondition::dof_table_boundary_
private

Definition at line 86 of file TimeDecayDirichletBoundaryCondition.h.

Referenced by getEssentialBCValues(), and setInitialValues().

◆ initial_values_are_set_

bool ProcessLib::TimeDecayDirichletBoundaryCondition::initial_values_are_set_ = false
mutableprivate

Definition at line 107 of file TimeDecayDirichletBoundaryCondition.h.

Referenced by getEssentialBCValues().

◆ initial_x_values_

std::vector<double> ProcessLib::TimeDecayDirichletBoundaryCondition::initial_x_values_
mutableprivate

This vector is used to store the initial values at the boundary nodes before they are scaled by the time decay parameter.

Definition at line 105 of file TimeDecayDirichletBoundaryCondition.h.

Referenced by getEssentialBCValues(), and setInitialValues().

◆ lower_limit_

double const ProcessLib::TimeDecayDirichletBoundaryCondition::lower_limit_
private

The lower limit of the boundary value.

Definition at line 101 of file TimeDecayDirichletBoundaryCondition.h.

Referenced by getEssentialBCValues().

◆ time_decay_parameter_

ParameterLib::Parameter<double> const& ProcessLib::TimeDecayDirichletBoundaryCondition::time_decay_parameter_
private

A monotonically decreasing parameter that defines the scaling factor of the initial values of the specified primary variable. It is a time- and position-dependent release parameter \( g(t, \mathbf{x}) \) representing the progressive removal of support over time, e.g., \( g(0, \mathbf{x}) = 1 \) and \( g(t_e, \mathbf{x}) = 0, \) where \( t_e \) is the end time of decay, and \( \frac{\partial g}{\partial t} < 0 \).

Definition at line 98 of file TimeDecayDirichletBoundaryCondition.h.

Referenced by getEssentialBCValues().

◆ variable_id_

int const ProcessLib::TimeDecayDirichletBoundaryCondition::variable_id_
private

Definition at line 81 of file TimeDecayDirichletBoundaryCondition.h.

Referenced by getEssentialBCValues(), and setInitialValues().


The documentation for this class was generated from the following files: