ESyS-Particle
2.3.4
StressTensorCalculator.h
Go to the documentation of this file.
1
// //
3
// Copyright (c) 2003-2017 by The University of Queensland //
4
// Centre for Geoscience Computing //
5
// http://earth.uq.edu.au/centre-geoscience-computing //
6
// //
7
// Primary Business: Brisbane, Queensland, Australia //
8
// Licensed under the Open Software License version 3.0 //
9
// http://www.apache.org/licenses/LICENSE-2.0 //
10
// //
12
13
14
#ifndef ESYS_LSMSTRESSTENSORCACLULATOR_H
15
#define ESYS_LSMSTRESSTENSORCACLULATOR_H
16
17
#include "
Foundation/vec3.h
"
18
#include "
Foundation/Matrix3.h
"
19
#include "
Tools/StressCalculator/StressTensor.h
"
20
21
#include <vector>
22
#include <map>
23
24
namespace
esys
25
{
26
namespace
lsm
27
{
28
class
IntercentreStressTensorCalculator
29
{
30
public
:
31
32
IntercentreStressTensorCalculator
()
33
{
34
}
35
36
template
<
typename
TmplContactReference>
37
void
updateTensor
(
Matrix3
&tensor,
const
Vec3
&tensorPos, TmplContactReference &contact)
38
{
39
const
Vec3
r = contact.getCentrePos2() - tensorPos;
40
for
(
int
i = 0; i < 3; i++) {
41
for
(
int
j = 0; j < 3; j++) {
42
tensor(i,j) += contact.getForce()[i] * r[j];
43
}
44
}
45
}
46
47
template
<
typename
TmplContactIterator>
48
StressTensor
calculate
(TmplContactIterator &it)
49
{
50
Matrix3
tensor;
51
ParticleData
tensorData;
52
if
(it.hasNext())
53
{
54
tensorData = it.next().getParticle1();
55
updateTensor
(tensor, tensorData.
getPos
(), it.current());
56
}
57
58
while
(it.hasNext())
59
{
60
updateTensor
(tensor, tensorData.
getPos
(), it.next());
61
}
62
return
StressTensor
(tensorData, tensor);
63
}
64
};
65
66
class
ContactPtTensorCalculator
67
{
68
public
:
69
70
ContactPtTensorCalculator
()
71
{
72
}
73
74
template
<
typename
TmplContactReference>
75
void
updateTensor
(
Matrix3
&tensor,
const
Vec3
&tensorPos, TmplContactReference &contact)
76
{
77
const
Vec3
r = contact.getForcePos() - tensorPos;
78
for
(
int
i = 0; i < 3; i++) {
79
for
(
int
j = 0; j < 3; j++) {
80
tensor(i,j) += r[i] * contact.getForce()[j];
81
}
82
}
83
}
84
85
template
<
typename
TmplContactIterator>
86
StressTensor
calculate
(TmplContactIterator &it)
87
{
88
Matrix3
tensor;
89
ParticleData
tensorData;
90
double
volume = 1.0;
91
if
(it.hasNext())
92
{
93
tensorData = it.next().getParticle1();
94
volume = it.current().getVolume1();
95
updateTensor
(tensor, tensorData.
getPos
(), it.current());
96
}
97
while
(it.hasNext())
98
{
99
updateTensor
(tensor, tensorData.
getPos
(), it.next());
100
}
101
return
StressTensor
(tensorData, tensor/volume);
102
}
103
};
104
}
105
}
106
107
#endif
StressTensorCalculator.h
esys::lsm::ContactPtTensorCalculator::ContactPtTensorCalculator
ContactPtTensorCalculator()
Definition:
StressTensorCalculator.h:70
esys::lsm::StressTensor
Definition:
StressTensor.h:72
esys::lsm::IntercentreStressTensorCalculator::calculate
StressTensor calculate(TmplContactIterator &it)
Definition:
StressTensorCalculator.h:48
esys::lsm::ContactPtTensorCalculator::updateTensor
void updateTensor(Matrix3 &tensor, const Vec3 &tensorPos, TmplContactReference &contact)
Definition:
StressTensorCalculator.h:75
esys::lsm::IntercentreStressTensorCalculator::IntercentreStressTensorCalculator
IntercentreStressTensorCalculator()
Definition:
StressTensorCalculator.h:32
esys::lsm::ParticleData
Definition:
Contact.h:26
Matrix3.h
esys::lsm::ParticleData::getPos
const Vec3 & getPos() const
Definition:
Contact.h:41
esys::lsm::ContactPtTensorCalculator::calculate
StressTensor calculate(TmplContactIterator &it)
Definition:
StressTensorCalculator.h:86
esys
Definition:
CheckPointable.cpp:17
esys::lsm::IntercentreStressTensorCalculator
Definition:
StressTensorCalculator.h:29
Vec3
Definition:
vec3.h:47
esys::lsm::ContactPtTensorCalculator
Definition:
StressTensorCalculator.h:67
esys::lsm::IntercentreStressTensorCalculator::updateTensor
void updateTensor(Matrix3 &tensor, const Vec3 &tensorPos, TmplContactReference &contact)
Definition:
StressTensorCalculator.h:37
vec3.h
StressTensor.h
Matrix3
3x3 Matrix
Definition:
Matrix3.h:48
Tools
StressCalculator
StressTensorCalculator.h
Generated by
1.8.20