ESyS-Particle
2.3.4
SoftBWallInteraction.hpp
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 MODEL_SOFTBWALLINTERACTION_HPP
15
#define MODEL_SOFTBWALLINTERACTION_HPP
16
17
#include "
SoftBWallInteraction.h
"
18
19
template
<
class
T>
20
CSoftBondedWallInteraction<T>::CSoftBondedWallInteraction
(T* p,
CWall
* w,
double
normalK,
double
shearK,
bool
scaling,
bool
iflag):
21
AWallInteraction
<T>(p,w,iflag)
22
{
23
double
scale;
24
25
if
(scaling) {
26
// scale stiffness to particle cross section
27
if
(
CParticle::getDo2dCalculations
()){
// 2D
28
// scale=2.0*this->m_p->getRad();
29
scale=1.0;
30
}
else
{
// 3D
31
// scale=3.1415926536*this->m_p->getRad()*this->m_p->getRad();
32
scale=3.1415926536*this->
m_p
->getRad();
33
}
34
}
35
else
{
36
scale = 1.0;
37
}
38
39
m_normalK
=normalK*scale;
40
m_shearK
=shearK*scale;
41
}
42
46
template
<
class
T>
47
void
CSoftBondedWallInteraction<T>::calcForces
()
48
{
49
const
Vec3
&n = this->m_wall->getNormal();
50
const
Vec3
relDisplacement =
51
(
52
this->m_p->getTotalDisplacement()
53
-
54
this->m_wall->getTotalDisplacement()
55
);
56
57
const
double
normalDist =
dot
(relDisplacement, n)/(n.
norm
());
58
const
Vec3
normalForce = ((m_normalK*normalDist)/n.
norm
())*n;
59
60
/*
61
* Tangent displacement vector is relDisplacement point
62
* projected onto plane.
63
*/
64
const
Vec3
tangentDisplacement =
65
(relDisplacement - ((normalDist/(n.
norm
()))*n));
66
const
Vec3
tangentForce = m_shearK*tangentDisplacement;
67
68
const
Vec3
totalForce = normalForce + tangentForce;
69
this->m_p->applyForce(-1.0*totalForce,this->m_p->getPos());
70
if
(this->m_inner_flag) this->m_wall->addForce(totalForce);
71
}
72
76
template
<
class
T>
77
Vec3
CSoftBondedWallInteraction<T>::getForce
()
78
{
79
const
Vec3
&n = this->m_wall->getNormal();
80
const
Vec3
relDisplacement =
81
(
82
this->m_p->getTotalDisplacement()
83
-
84
this->m_wall->getTotalDisplacement()
85
);
86
87
const
double
normalDist =
dot
(relDisplacement, n)/(n.
norm
());
88
const
Vec3
normalForce = ((m_normalK*normalDist)/n.
norm
())*n;
89
90
/*
91
* Tangent displacement vector is relDisplacement point
92
* projected onto plane.
93
*/
94
const
Vec3
tangentDisplacement =
95
(relDisplacement - ((normalDist/(n.
norm
()))*n));
96
const
Vec3
tangentForce = m_shearK*tangentDisplacement;
97
98
const
Vec3
totalForce = normalForce + tangentForce;
99
100
return
totalForce;
101
}
102
103
104
#endif
CWall
base class for all walls
Definition:
Wall.h:40
dot
VEC3_INLINE double dot(const Vec3 &v1, const Vec3 &v2)
Definition:
vec3.hpp:196
CSoftBondedWallInteraction::CSoftBondedWallInteraction
CSoftBondedWallInteraction()
Vec3::norm
VEC3_INLINE double norm() const
Definition:
vec3.hpp:211
AWallInteraction
Abstract base for all interactions between a particle and a wall.
Definition:
WallInteraction.h:30
SoftBWallInteraction.h
CSoftBondedWallInteraction::m_shearK
double m_shearK
directional spring constants
Definition:
SoftBWallInteraction.h:32
Vec3
Definition:
vec3.h:47
CParticle::getDo2dCalculations
static bool getDo2dCalculations()
Definition:
Particle.h:181
AWallInteraction::m_p
T * m_p
Definition:
WallInteraction.h:32
CSoftBondedWallInteraction::calcForces
virtual void calcForces()
Definition:
SoftBWallInteraction.hpp:47
CSoftBondedWallInteraction::getForce
virtual Vec3 getForce()
Definition:
SoftBWallInteraction.hpp:77
CSoftBondedWallInteraction::m_normalK
double m_normalK
Definition:
SoftBWallInteraction.h:32
Model
SoftBWallInteraction.hpp
Generated by
1.8.20