OGS
DeactivatedSubdomainDirichlet.cpp
Go to the documentation of this file.
1
10
17
18namespace ProcessLib
19{
23 ParameterLib::Parameter<double> const& parameter,
24 bool const set_outer_nodes_dirichlet_values,
25 DeactivatedSubdomainMesh const& subdomain,
26 NumLib::LocalToGlobalIndexMap const& dof_table_bulk, int const variable_id,
27 int const component_id)
28 : _parameter(parameter),
29 _subdomain(subdomain),
30 _variable_id(variable_id),
31 _component_id(component_id),
32 _time_interval(std::move(time_interval)),
33 _is_active(is_active),
34 _set_outer_nodes_dirichlet_values(set_outer_nodes_dirichlet_values)
35{
36 config(dof_table_bulk);
37}
38
40 NumLib::LocalToGlobalIndexMap const& dof_table_bulk)
41{
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.
51 _variable_id, {_component_id}, std::move(subdomain_mesh_subset));
52}
53
55 const double t, GlobalVector const& x,
57{
58 [[maybe_unused]] auto const& bulk_node_ids =
60 [[maybe_unused]] auto const& bulk_element_ids =
62
63 auto is_inactive_id = [&](std::size_t const bulk_element_id)
64 { return _is_active[bulk_element_id] == 0; };
65
66 auto is_inactive_element = [&](MeshLib::Element const* const e)
67 { return is_inactive_id(bulk_element_ids[e->getID()]); };
68
69 std::vector<std::size_t> inactive_nodes_in_bc_mesh;
70 std::copy_if(begin(_subdomain.inner_nodes), end(_subdomain.inner_nodes),
71 back_inserter(inactive_nodes_in_bc_mesh),
72 [&](std::size_t const n)
73 {
74 const auto& connected_elements =
76
77 return std::all_of(begin(connected_elements),
78 end(connected_elements),
79 is_inactive_element);
80 });
81
83 {
84 std::copy_if(begin(_subdomain.outer_nodes), end(_subdomain.outer_nodes),
85 back_inserter(inactive_nodes_in_bc_mesh),
86 [&](std::size_t const n)
87 {
88 const auto& connected_elements =
90
91 return std::all_of(begin(connected_elements),
92 end(connected_elements),
93 is_inactive_element);
94 });
95 }
96 else
97 {
98 for (std::size_t i = 0; i < _subdomain.outer_nodes.size(); ++i)
99 {
100 auto const& connected_elements = _subdomain.outer_nodes_elements[i];
101 if (std::all_of(begin(connected_elements), end(connected_elements),
102 is_inactive_id))
103 {
104 inactive_nodes_in_bc_mesh.push_back(_subdomain.outer_nodes[i]);
105 }
106 }
107 }
108
109 auto time_interval_contains = [&](double const t)
110 {
111 return _time_interval.getSupportMin() <= t &&
113 };
114 if (time_interval_contains(t))
115 {
117 _parameter, _subdomain.mesh, inactive_nodes_in_bc_mesh,
119 return;
120 }
121
122 bc_values.ids.clear();
123 bc_values.values.clear();
124}
125} // namespace ProcessLib
Defines functions that are shared by DirichletBoundaryCondition and DirichletBoundaryConditionWithinT...
Global vector based on Eigen vector.
Definition EigenVector.h:25
A subset of nodes on a single mesh.
Definition MeshSubset.h:26
std::vector< Node * > const & getNodes() const
Get the nodes-vector for the mesh.
Definition Mesh.h:106
std::vector< Element const * > const & getElementsConnectedToNode(std::size_t node_id) const
Definition Mesh.cpp:256
std::unique_ptr< LocalToGlobalIndexMap > deriveBoundaryConstrainedMap(int const variable_id, std::vector< int > const &component_ids, MeshLib::MeshSubset &&new_mesh_subset) const
DeactivatedSubdomainDirichlet(MeshLib::PropertyVector< unsigned char > const &is_active, 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)
MathLib::PiecewiseLinearInterpolation const _time_interval
void getEssentialBCValues(const double t, GlobalVector const &x, NumLib::IndexValueVector< GlobalIndexType > &bc_values) const override
Writes the values of essential BCs to bc_values.
ParameterLib::Parameter< double > const & _parameter
MeshLib::PropertyVector< unsigned char > const & _is_active
void config(NumLib::LocalToGlobalIndexMap const &dof_table_bulk)
std::unique_ptr< NumLib::LocalToGlobalIndexMap const > _dof_table_boundary
PropertyVector< std::size_t > const * bulkElementIDs(Mesh const &mesh)
Definition Mesh.cpp:300
PropertyVector< std::size_t > const * bulkNodeIDs(Mesh const &mesh)
Definition Mesh.cpp:292
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 checkParametersOfDirichletBoundaryCondition(MeshLib::Mesh const &bc_mesh, NumLib::LocalToGlobalIndexMap const &dof_table_bulk, int const variable_id, int const component_id)
std::vector< IndexType > ids
std::vector< double > values
std::vector< std::vector< std::size_t > > outer_nodes_elements