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 41 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 33 of file TimeDecayDirichletBoundaryCondition.cpp.

39 : variable_id_(variable_id),
40 component_id_(component_id),
41 boundary_mesh_(boundary_mesh),
43 variable_id, component_id, boundary_mesh, dof_table_bulk)),
44 time_decay_parameter_(time_decay_parameter),
45 lower_limit_(lower_limit)
46{
47}
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)

References boundary_mesh_, component_id_, ProcessLib::createBoundaryDOFTable(), dof_table_boundary_, lower_limit_, time_decay_parameter_, and variable_id_.

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 76 of file TimeDecayDirichletBoundaryCondition.cpp.

79{
80 DBUG("Apply TimeDecayDirichlet boundary bondition.");
81
83 {
86 if (initial_x_values_.empty())
87 {
88 return; // No node in the boundary.
89 }
90 }
91
92 bc_values.ids.clear();
93 bc_values.values.clear();
94
95 bc_values.ids.reserve(initial_x_values_.size());
96 bc_values.values.reserve(initial_x_values_.size());
97
98 std::size_t idx = 0;
99 for (auto const* node : boundary_mesh_.getNodes())
100 {
101 auto const node_id = node->getID();
102 MeshLib::Location const l{boundary_mesh_.getID(),
104
105 auto const global_index =
107
108 if (global_index == NumLib::MeshComponentMap::nop)
109 {
110 continue;
111 }
112 // For the DDC approach (e.g. with PETSc option), the negative
113 // index of global_index means that the entry by that index is a
114 // ghost one, which should be dropped. Especially for PETSc
115 // routines MatZeroRows and MatZeroRowsColumns, which are called
116 // to apply the Dirichlet BC, the negative index is not accepted
117 // like other matrix or vector PETSc routines. Therefore, the
118 // following if-condition is applied.
119 if (global_index >= 0) [[likely]]
120 {
121 ParameterLib::SpatialPosition pos;
122 pos.setNodeID(node_id);
123 pos.setCoordinates(*node);
124
125 bc_values.values.push_back(
126 time_decay_parameter_(t, pos).front() *
129 bc_values.ids.push_back(global_index);
130 idx++;
131 }
132 }
133}
void DBUG(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:22
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_, NumLib::IndexValueVector< IndexType >::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< IndexType >::values, and variable_id_.

◆ setInitialValues()

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

Definition at line 49 of file TimeDecayDirichletBoundaryCondition.cpp.

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

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

◆ component_id_

int const ProcessLib::TimeDecayDirichletBoundaryCondition::component_id_
private

◆ dof_table_boundary_

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

◆ initial_values_are_set_

bool ProcessLib::TimeDecayDirichletBoundaryCondition::initial_values_are_set_ = false
mutableprivate

Definition at line 99 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 97 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 93 of file TimeDecayDirichletBoundaryCondition.h.

Referenced by TimeDecayDirichletBoundaryCondition(), and 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 90 of file TimeDecayDirichletBoundaryCondition.h.

Referenced by TimeDecayDirichletBoundaryCondition(), and getEssentialBCValues().

◆ variable_id_

int const ProcessLib::TimeDecayDirichletBoundaryCondition::variable_id_
private

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