-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPostProcessors.h
74 lines (64 loc) · 2.83 KB
/
PostProcessors.h
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
62
63
64
65
66
67
68
69
70
71
72
73
74
//
// Created by alhei on 2022/08/11.
//
#ifndef ALE_POSTPROCESSORS_H
#define ALE_POSTPROCESSORS_H
#include <deal.II/numerics/data_out.h>
using namespace dealii;
using namespace std;
template<int dim>
class StrainPostprocessor : public DataPostprocessorTensor<dim> {
public:
StrainPostprocessor()
:
DataPostprocessorTensor<dim>("strain",
update_gradients) {}
void
evaluate_vector_field
(const DataPostprocessorInputs::Vector<dim> &input_data,
std::vector<Vector<double> > &computed_quantities) const override {
AssertDimension (input_data.solution_gradients.size(),
computed_quantities.size());
auto cell = input_data.template get_cell<dim>();
for (unsigned int p = 0; p < input_data.solution_gradients.size(); ++p) {
AssertDimension (computed_quantities[p].size(),
(Tensor<2, dim>::n_independent_components));
for (unsigned int d = 0; d < dim; ++d)
for (unsigned int e = 0; e < dim; ++e)
computed_quantities[p][Tensor<2, dim>::component_to_unrolled_index(TableIndices<2>(d, e))]
= (input_data.solution_gradients[p][d][e]
+
input_data.solution_gradients[p][e][d]
+
input_data.solution_gradients[p][d][e] * input_data.solution_gradients[p][e][d]) / 2;
}
}
};
template<int dim>
class DeformationGradientPostprocessor : public DataPostprocessorTensor<dim> {
public:
DeformationGradientPostprocessor()
:
DataPostprocessorTensor<dim>("F",
update_gradients) {}
void
evaluate_vector_field
(const DataPostprocessorInputs::Vector<dim> &input_data,
std::vector<Vector<double> > &computed_quantities) const override {
AssertDimension (input_data.solution_gradients.size(),
computed_quantities.size());
for (unsigned int p = 0; p < input_data.solution_gradients.size(); ++p) {
AssertDimension (computed_quantities[p].size(),
(Tensor<2, dim>::n_independent_components));
for (unsigned int d = 0; d < dim; ++d)
for (unsigned int e = 0; e < dim; ++e) {
computed_quantities[p][Tensor<2, dim>::component_to_unrolled_index(TableIndices<2>(d, e))]
= input_data.solution_gradients[p][d][e];
if (d == e)
computed_quantities[p][Tensor<2, dim>::component_to_unrolled_index(
TableIndices<2>(d, e))] += 1.;
}
}
}
};
#endif //ALE_POSTPROCESSORS_H