OGS
ProcessLib::DeactivatedSubdomainDirichlet Class Referencefinal

Detailed Description

Definition at line 37 of file DeactivatedSubdomainDirichlet.h.

#include <DeactivatedSubdomainDirichlet.h>

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

Public Member Functions

 DeactivatedSubdomainDirichlet (std::vector< std::size_t > const *active_element_ids, MathLib::PiecewiseLinearInterpolation time_interval, ParameterLib::Parameter< double > const &parameter, bool const set_outer_nodes_dirichlet_values, DeactivatedSubdomainMesh const &subdomain, NumLib::LocalToGlobalIndexMap const &dof_table_bulk, int const variable_id, int const component_id)
 
void getEssentialBCValues (const double t, GlobalVector const &x, NumLib::IndexValueVector< GlobalIndexType > &bc_values) const override
 Writes the values of essential BCs to bc_values. More...
 
- 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 config (NumLib::LocalToGlobalIndexMap const &dof_table_bulk)
 

Private Attributes

ParameterLib::Parameter< double > const & _parameter
 
DeactivatedSubdomainMesh const & _subdomain
 
std::unique_ptr< NumLib::LocalToGlobalIndexMap const > _dof_table_boundary
 
int const _variable_id
 
int const _component_id
 
MathLib::PiecewiseLinearInterpolation const _time_interval
 
std::vector< std::size_t > const * _active_element_ids = nullptr
 
bool const _set_outer_nodes_dirichlet_values
 

Constructor & Destructor Documentation

◆ DeactivatedSubdomainDirichlet()

ProcessLib::DeactivatedSubdomainDirichlet::DeactivatedSubdomainDirichlet ( std::vector< std::size_t > const *  active_element_ids,
MathLib::PiecewiseLinearInterpolation  time_interval,
ParameterLib::Parameter< double > const &  parameter,
bool const  set_outer_nodes_dirichlet_values,
DeactivatedSubdomainMesh const &  subdomain,
NumLib::LocalToGlobalIndexMap const &  dof_table_bulk,
int const  variable_id,
int const  component_id 
)

Definition at line 20 of file DeactivatedSubdomainDirichlet.cpp.

28  : _parameter(parameter),
29  _subdomain(subdomain),
30  _variable_id(variable_id),
31  _component_id(component_id),
32  _time_interval(std::move(time_interval)),
33  _active_element_ids(active_element_ids),
34  _set_outer_nodes_dirichlet_values(set_outer_nodes_dirichlet_values)
35 {
36  config(dof_table_bulk);
37 }
MathLib::PiecewiseLinearInterpolation const _time_interval
std::vector< std::size_t > const * _active_element_ids
ParameterLib::Parameter< double > const & _parameter
void config(NumLib::LocalToGlobalIndexMap const &dof_table_bulk)

References config().

Member Function Documentation

◆ config()

void ProcessLib::DeactivatedSubdomainDirichlet::config ( NumLib::LocalToGlobalIndexMap const &  dof_table_bulk)
private

Definition at line 39 of file DeactivatedSubdomainDirichlet.cpp.

41 {
43  *_subdomain.mesh, dof_table_bulk, _variable_id, _component_id);
44 
45  std::vector<MeshLib::Node*> const& bc_nodes = _subdomain.mesh->getNodes();
46  MeshLib::MeshSubset subdomain_mesh_subset(*_subdomain.mesh, bc_nodes);
47 
48  // Create local DOF table from the BC mesh subset for the given variable
49  // and component id.
50  _dof_table_boundary.reset(dof_table_bulk.deriveBoundaryConstrainedMap(
51  _variable_id, {_component_id}, std::move(subdomain_mesh_subset)));
52 }
A subset of nodes on a single mesh.
Definition: MeshSubset.h:27
std::unique_ptr< NumLib::LocalToGlobalIndexMap const > _dof_table_boundary
void checkParametersOfDirichletBoundaryCondition(MeshLib::Mesh const &bc_mesh, NumLib::LocalToGlobalIndexMap const &dof_table_bulk, int const variable_id, int const component_id)
std::unique_ptr< MeshLib::Mesh > const mesh

References _component_id, _dof_table_boundary, _subdomain, _variable_id, ProcessLib::checkParametersOfDirichletBoundaryCondition(), NumLib::LocalToGlobalIndexMap::deriveBoundaryConstrainedMap(), and ProcessLib::DeactivatedSubdomainMesh::mesh.

Referenced by DeactivatedSubdomainDirichlet().

◆ getEssentialBCValues()

void ProcessLib::DeactivatedSubdomainDirichlet::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 54 of file DeactivatedSubdomainDirichlet.cpp.

57 {
58  auto const& bulk_element_ids =
59  *_subdomain.mesh->getProperties()
60  .template getPropertyVector<std::size_t>(
61  "bulk_element_ids", MeshLib::MeshItemType::Cell, 1);
62 
63  auto is_inactive = [&](MeshLib::Element const* const e)
64  {
65  return none_of(begin(*_active_element_ids), end(*_active_element_ids),
66  [&](auto const id)
67  { return id == bulk_element_ids[e->getID()]; });
68  };
69 
70  std::vector<MeshLib::Node*> inactive_nodes_in_bc_mesh;
71  std::copy_if(begin(_subdomain.inner_nodes), end(_subdomain.inner_nodes),
72  back_inserter(inactive_nodes_in_bc_mesh),
73  [&](MeshLib::Node* const n)
74  {
75  const auto& connected_elements =
76  _subdomain.mesh->getElementsConnectedToNode(*n);
77 
78  return std::all_of(begin(connected_elements),
79  end(connected_elements), is_inactive);
80  });
81 
83  {
84  std::copy_if(begin(_subdomain.outer_nodes), end(_subdomain.outer_nodes),
85  back_inserter(inactive_nodes_in_bc_mesh),
86  [&](MeshLib::Node* const n)
87  {
88  const auto& connected_elements =
89  _subdomain.mesh->getElementsConnectedToNode(*n);
90 
91  return std::all_of(begin(connected_elements),
92  end(connected_elements),
93  is_inactive);
94  });
95  }
96 
97  auto time_interval_contains = [&](double const t)
98  {
99  return _time_interval.getSupportMin() <= t &&
101  };
102  if (time_interval_contains(t))
103  {
105  _parameter, *_subdomain.mesh, inactive_nodes_in_bc_mesh,
106  *_dof_table_boundary, _variable_id, _component_id, t, x, bc_values);
107  return;
108  }
109 
110  bc_values.ids.clear();
111  bc_values.values.clear();
112 }
void getEssentialBCValuesLocal(ParameterLib::Parameter< double > const &parameter, MeshLib::Mesh const &bc_mesh, std::vector< MeshLib::Node * > const &nodes_in_bc_mesh, NumLib::LocalToGlobalIndexMap const &dof_table_boundary, int const variable_id, int const component_id, const double t, GlobalVector const &, NumLib::IndexValueVector< GlobalIndexType > &bc_values)
std::vector< MeshLib::Node * > const outer_nodes
std::vector< MeshLib::Node * > const inner_nodes

References _active_element_ids, _component_id, _dof_table_boundary, _parameter, _set_outer_nodes_dirichlet_values, _subdomain, _time_interval, _variable_id, MeshLib::Cell, ProcessLib::getEssentialBCValuesLocal(), MathLib::PiecewiseLinearInterpolation::getSupportMax(), MathLib::PiecewiseLinearInterpolation::getSupportMin(), NumLib::IndexValueVector< IndexType >::ids, ProcessLib::DeactivatedSubdomainMesh::inner_nodes, ProcessLib::DeactivatedSubdomainMesh::mesh, ProcessLib::DeactivatedSubdomainMesh::outer_nodes, and NumLib::IndexValueVector< IndexType >::values.

Member Data Documentation

◆ _active_element_ids

std::vector<std::size_t> const* ProcessLib::DeactivatedSubdomainDirichlet::_active_element_ids = nullptr
private

Definition at line 66 of file DeactivatedSubdomainDirichlet.h.

Referenced by getEssentialBCValues().

◆ _component_id

int const ProcessLib::DeactivatedSubdomainDirichlet::_component_id
private

Definition at line 63 of file DeactivatedSubdomainDirichlet.h.

Referenced by config(), and getEssentialBCValues().

◆ _dof_table_boundary

std::unique_ptr<NumLib::LocalToGlobalIndexMap const> ProcessLib::DeactivatedSubdomainDirichlet::_dof_table_boundary
private

Definition at line 61 of file DeactivatedSubdomainDirichlet.h.

Referenced by config(), and getEssentialBCValues().

◆ _parameter

ParameterLib::Parameter<double> const& ProcessLib::DeactivatedSubdomainDirichlet::_parameter
private

Definition at line 57 of file DeactivatedSubdomainDirichlet.h.

Referenced by getEssentialBCValues().

◆ _set_outer_nodes_dirichlet_values

bool const ProcessLib::DeactivatedSubdomainDirichlet::_set_outer_nodes_dirichlet_values
private

Definition at line 68 of file DeactivatedSubdomainDirichlet.h.

Referenced by getEssentialBCValues().

◆ _subdomain

DeactivatedSubdomainMesh const& ProcessLib::DeactivatedSubdomainDirichlet::_subdomain
private

Definition at line 59 of file DeactivatedSubdomainDirichlet.h.

Referenced by config(), and getEssentialBCValues().

◆ _time_interval

MathLib::PiecewiseLinearInterpolation const ProcessLib::DeactivatedSubdomainDirichlet::_time_interval
private

Definition at line 65 of file DeactivatedSubdomainDirichlet.h.

Referenced by getEssentialBCValues().

◆ _variable_id

int const ProcessLib::DeactivatedSubdomainDirichlet::_variable_id
private

Definition at line 62 of file DeactivatedSubdomainDirichlet.h.

Referenced by config(), and getEssentialBCValues().


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