Loading [MathJax]/extensions/MathMenu.js
OGS
DeactivatedSubdomain.cpp
Go to the documentation of this file.
1
14
15#include <range/v3/algorithm/contains.hpp>
16
17#include "BaseLib/Error.h"
19#include "MeshLib/Node.h"
21
22namespace ProcessLib
23{
25 "zero_for_element_deactivation_approach";
26
28{
29 return time_interval.getSupportMin() <= t &&
31}
32
34 double const time) const
35{
36 auto const& bulk_element_ids = deactivated_subdomain_mesh.bulk_element_ids;
37 if (!bulk_element_ids.contains(element.getID()))
38 {
39 return false;
40 }
41
42 if (line_segment)
43 {
44 auto const& element_center = getCenterOfGravity(element);
45 // Line from a to b.
46 auto const& a = line_segment->first;
47 auto const& b = line_segment->second;
48 // Tangent vector t = (b - a)/|b - a|.
49 Eigen::Vector3d const t = (b - a).normalized();
50
51 // Position r on the line at given time.
52 auto const curve_position = time_interval.getValue(time);
53 Eigen::Vector3d const r = a + t * curve_position;
54
55 // Return true if p is "behind" the plane through r.
56 return (element_center.asEigenVector3d() - r).dot(t) <= 0;
57 }
58
59 if (ball)
60 {
61 auto const& element_center = getCenterOfGravity(element);
62
63 auto const& center = ball->center;
64 // The radius at given time.
65 auto const r_t = time_interval.getValue(time);
66 if (r_t > ball->radius)
67 {
68 return false;
69 }
70
71 double const r_element_center =
72 (element_center.asEigenVector3d() - center).norm();
73
74 return r_element_center < r_t;
75 }
76
77 return true;
78}
79} // namespace ProcessLib
Definition of the Element class.
Definition of the Node class.
double getValue(double pnt_to_interpolate) const
Calculates the interpolation value.
std::size_t getID() const
Returns the ID of the element.
Definition Element.h:89
std::unordered_set< std::size_t > bulk_element_ids
bool isDeactivated(MeshLib::Element const &element, double const time) const
static PROCESSLIB_EXPORT const std::string zero_parameter_name
MathLib::PiecewiseLinearInterpolation time_interval
DeactivatedSubdomainMesh deactivated_subdomain_mesh
bool isInTimeSupportInterval(double const t) const
std::optional< detail::Ball > ball
The shape of the deactivated domain is a ball, which is a disk for 2D.
std::optional< std::pair< Eigen::Vector3d, Eigen::Vector3d > > line_segment