-
Notifications
You must be signed in to change notification settings - Fork 9
/
BodyForce.hh
61 lines (53 loc) · 1.53 KB
/
BodyForce.hh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/* Copyright (c) 2023 - 2024, the adamantine authors.
*
* This file is subject to the Modified BSD License and may not be distributed
* without copyright and license information. Please refer to the file LICENSE
* for the text and further information on this license.
*/
#ifndef BODY_FORCE_HH
#define BODY_FORCE_HH
#include <deal.II/base/point.h>
#include <deal.II/base/tensor.h>
#include <deal.II/grid/tria_accessor.h>
namespace adamantine
{
/**
* Base class that describes the interface that body forces need to implement.
*/
template <int dim>
struct BodyForce
{
/**
* Evaluate the body force given a cell.
*/
virtual dealii::Tensor<1, dim, double>
eval(typename dealii::Triangulation<dim>::active_cell_iterator const
&cell) = 0;
};
// Forward declaration
template <int dim, int p_order, typename MaterialStates,
typename MemorySpaceType>
class MaterialProperty;
/**
* Gravity's body force.
*/
template <int dim, int p_order, typename MaterialStates,
typename MemorySpaceType>
class GravityForce final : public BodyForce<dim>
{
public:
GravityForce(MaterialProperty<dim, p_order, MaterialStates, MemorySpaceType>
&material_properties);
dealii::Tensor<1, dim, double>
eval(typename dealii::Triangulation<dim>::active_cell_iterator const &cell)
final;
private:
/**
* Gravity in \f$m/s^2\f$
*/
static double constexpr g = 9.80665;
MaterialProperty<dim, p_order, MaterialStates, MemorySpaceType>
&_material_properties;
};
} // namespace adamantine
#endif