OGS
ProcessLib::PhaseFieldIrreversibleDamageOracleBoundaryCondition Class Referencefinal

Detailed Description

#include <PhaseFieldIrreversibleDamageOracleBoundaryCondition.h>

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

Public Member Functions

 PhaseFieldIrreversibleDamageOracleBoundaryCondition (NumLib::LocalToGlobalIndexMap const &dof_table, MeshLib::Mesh const &mesh, int const variable_id, int const component_id)
 
void getEssentialBCValues (const double t, const GlobalVector &x, NumLib::IndexValueVector< GlobalIndexType > &bc_values) const override
 Writes the values of essential BCs to bc_values. More...
 
void preTimestep (const double t, std::vector< GlobalVector * > const &x, int const process_id) override
 
- Public Member Functions inherited from ProcessLib::BoundaryCondition
virtual void applyNaturalBC (const double, std::vector< GlobalVector * > const &, int const, GlobalMatrix &, GlobalVector &, GlobalMatrix *)
 
virtual void postTimestep (const double, std::vector< GlobalVector * > const &, int const)
 
virtual ~BoundaryCondition ()=default
 

Private Attributes

NumLib::LocalToGlobalIndexMap const & _dof_table
 
MeshLib::Mesh const & _mesh
 
int const _variable_id
 
int const _component_id
 
NumLib::IndexValueVector< GlobalIndexType_bc_values
 

Constructor & Destructor Documentation

◆ PhaseFieldIrreversibleDamageOracleBoundaryCondition()

ProcessLib::PhaseFieldIrreversibleDamageOracleBoundaryCondition::PhaseFieldIrreversibleDamageOracleBoundaryCondition ( NumLib::LocalToGlobalIndexMap const &  dof_table,
MeshLib::Mesh const &  mesh,
int const  variable_id,
int const  component_id 
)
inline

Definition at line 24 of file PhaseFieldIrreversibleDamageOracleBoundaryCondition.h.

28  : _dof_table(dof_table),
29  _mesh(mesh),
30  _variable_id(variable_id),
31  _component_id(component_id)
32  {
33  if (variable_id >= static_cast<int>(dof_table.getNumberOfVariables()) ||
34  component_id >=
35  dof_table.getNumberOfVariableComponents(variable_id))
36  {
37  OGS_FATAL(
38  "Variable id or component id too high. Actual values: ({:d}, "
39  "{:d}), "
40  "maximum values: ({:d}, {:d}).",
41  variable_id, component_id, dof_table.getNumberOfVariables(),
42  dof_table.getNumberOfVariableComponents(variable_id));
43  }
44  }
#define OGS_FATAL(...)
Definition: Error.h:26

References NumLib::LocalToGlobalIndexMap::getNumberOfVariableComponents(), NumLib::LocalToGlobalIndexMap::getNumberOfVariables(), and OGS_FATAL.

Member Function Documentation

◆ getEssentialBCValues()

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

Writes the values of essential BCs to bc_values.

Reimplemented from ProcessLib::BoundaryCondition.

Definition at line 21 of file PhaseFieldIrreversibleDamageOracleBoundaryCondition.cpp.

24 {
25  bc_values.ids.clear();
26  bc_values.values.clear();
27 
28  // convert mesh node ids to global index for the given component
29  bc_values.ids.reserve(bc_values.ids.size() + _bc_values.ids.size());
30  bc_values.values.reserve(bc_values.values.size() +
31  _bc_values.values.size());
32 
33  std::copy(_bc_values.ids.begin(), _bc_values.ids.end(),
34  std::back_inserter(bc_values.ids));
36  std::back_inserter(bc_values.values));
37 }
void copy(PETScVector const &x, PETScVector &y)
Definition: LinAlg.cpp:37
std::vector< IndexType > ids
std::vector< double > values

References _bc_values, MathLib::LinAlg::copy(), NumLib::IndexValueVector< IndexType >::ids, and NumLib::IndexValueVector< IndexType >::values.

◆ preTimestep()

void ProcessLib::PhaseFieldIrreversibleDamageOracleBoundaryCondition::preTimestep ( const double  t,
std::vector< GlobalVector * > const &  x,
int const  process_id 
)
overridevirtual

Reimplemented from ProcessLib::BoundaryCondition.

Definition at line 40 of file PhaseFieldIrreversibleDamageOracleBoundaryCondition.cpp.

43 {
44  // phase-field variable is considered irreversible if it loses more than 95%
45  // of the stiffness, which is a widely used threshold.
46  double irreversibleDamage = 0.05;
47 
48  _bc_values.ids.clear();
49  _bc_values.values.clear();
50 
51  auto const mesh_id = _mesh.getID();
52  auto const& nodes = _mesh.getNodes();
53  for (auto const* n : nodes)
54  {
55  std::size_t node_id = n->getID();
57  const auto g_idx =
59 
60  if ((*x[process_id])[node_id] <= irreversibleDamage)
61  {
62  _bc_values.ids.emplace_back(g_idx);
63  _bc_values.values.emplace_back(0.0);
64  }
65  }
66 }
std::vector< Node * > const & getNodes() const
Get the nodes-vector for the mesh.
Definition: Mesh.h:95
std::size_t getID() const
Get id of the mesh.
Definition: Mesh.h:110
GlobalIndexType getGlobalIndex(MeshLib::Location const &l, int const variable_id, int const component_id) const

References _bc_values, _component_id, _dof_table, _mesh, _variable_id, NumLib::LocalToGlobalIndexMap::getGlobalIndex(), MeshLib::Mesh::getID(), MeshLib::Mesh::getNodes(), NumLib::IndexValueVector< IndexType >::ids, MeshLib::Node, and NumLib::IndexValueVector< IndexType >::values.

Member Data Documentation

◆ _bc_values

NumLib::IndexValueVector<GlobalIndexType> ProcessLib::PhaseFieldIrreversibleDamageOracleBoundaryCondition::_bc_values
private

◆ _component_id

int const ProcessLib::PhaseFieldIrreversibleDamageOracleBoundaryCondition::_component_id
private

Definition at line 57 of file PhaseFieldIrreversibleDamageOracleBoundaryCondition.h.

Referenced by preTimestep().

◆ _dof_table

NumLib::LocalToGlobalIndexMap const& ProcessLib::PhaseFieldIrreversibleDamageOracleBoundaryCondition::_dof_table
private

Definition at line 54 of file PhaseFieldIrreversibleDamageOracleBoundaryCondition.h.

Referenced by preTimestep().

◆ _mesh

MeshLib::Mesh const& ProcessLib::PhaseFieldIrreversibleDamageOracleBoundaryCondition::_mesh
private

Definition at line 55 of file PhaseFieldIrreversibleDamageOracleBoundaryCondition.h.

Referenced by preTimestep().

◆ _variable_id

int const ProcessLib::PhaseFieldIrreversibleDamageOracleBoundaryCondition::_variable_id
private

Definition at line 56 of file PhaseFieldIrreversibleDamageOracleBoundaryCondition.h.

Referenced by preTimestep().


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