include/meltpooldg/particles/obstacle_forces.hpp Source File

Developer Documentation: include/meltpooldg/particles/obstacle_forces.hpp Source File
Developer Documentation
obstacle_forces.hpp
Go to the documentation of this file.
1
2#pragma once
3
4#include <deal.II/base/tensor.h>
5
6#include <deal.II/particles/particle_accessor.h>
7
9
10#include <memory>
11#include <utility>
12
13namespace MeltPoolDG
14{
15 template <int dim, typename number, typename ObstacleType>
16 class ObstacleField;
17
32 template <int dim, typename number, typename ObstacleType>
34 {
35 private:
37 {
38 virtual ~ObstacleLoadConcept() = default;
39
40 virtual void
42 };
43
44 template <typename ObstacleLoadType>
46 {
47 explicit ObstacleLoadModel(ObstacleLoadType &&obstacle_load)
48 : obstacle_load(std::move(obstacle_load))
49 {}
50
51 void
53 {
54 obstacle_load.add_load_to_obstacles(obstacle_field);
55 }
56
57 private:
58 const ObstacleLoadType obstacle_load;
59 };
60
61 std::unique_ptr<ObstacleLoadConcept> obstacle_load_pimpl;
62
63 public:
64 template <typename ObstacleLoadType>
65 explicit ObstacleLoad(ObstacleLoadType &&obstacle_load)
67 std::make_unique<ObstacleLoadModel<ObstacleLoadType>>(std::move(obstacle_load)))
68 {}
69
70 void
72 {
73 obstacle_load_pimpl->add_load_to_obstacles(obstacle_field);
74 }
75 };
76
83 template <int dim, typename number, typename ObstacleType>
85 {
86 public:
95
110 void
112 {
114 obstacle_field.locally_owned_particle_range())
115 {
116 dealii::Tensor<1, dim, number> force;
117 force[dim - 1] = -gravitational_constant * obstacle.mass();
118 obstacle.add_force(force);
119 }
120 }
121
122 private:
124 };
125} // namespace MeltPoolDG
Definition particle_accessor.hpp:20
Definition obstacle_field.hpp:32
std::ranges::subrange< ParticleIterator< dim, number > > locally_owned_particle_range() const
Definition obstacle_field.cpp:205
Interface for a general preconditioner.
Definition boundary_condition_functions.hpp:17
Computes the gravitational force acting on an obstacle.
Definition obstacle_forces.hpp:85
void add_load_to_obstacles(ObstacleField< dim, number, ObstacleType > &obstacle_field) const
Computes the gravitational force acting on all obstacles in the given obstacle field and adds the for...
Definition obstacle_forces.hpp:111
const number gravitational_constant
Definition obstacle_forces.hpp:123
ObstacleGravitationalForce(const number gravitational_constant)
Constructs the gravitational force object with a given gravitational constant.
Definition obstacle_forces.hpp:92
Definition obstacle_forces.hpp:37
virtual void add_load_to_obstacles(ObstacleField< dim, number, ObstacleType > &obstacle_field) const =0
Definition obstacle_forces.hpp:46
const ObstacleLoadType obstacle_load
Definition obstacle_forces.hpp:58
void add_load_to_obstacles(ObstacleField< dim, number, ObstacleType > &obstacle_field) const override
Definition obstacle_forces.hpp:52
ObstacleLoadModel(ObstacleLoadType &&obstacle_load)
Definition obstacle_forces.hpp:47
Interface class for loads acting on obstacles using type erasure.
Definition obstacle_forces.hpp:34
std::unique_ptr< ObstacleLoadConcept > obstacle_load_pimpl
Definition obstacle_forces.hpp:61
ObstacleLoad(ObstacleLoadType &&obstacle_load)
Definition obstacle_forces.hpp:65
void add_load_to_obstacles(ObstacleField< dim, number, ObstacleType > &obstacle_field) const
Definition obstacle_forces.hpp:71