MPM-Geomechanics
Material Point Method for simulating geo-materials under large deformation conditions
Loading...
Searching...
No Matches
Node.h
Go to the documentation of this file.
1/*
2 * Node.h
3 *
4 * Created on: 14 de abr de 2021
5 * Author: Fabricio Fernandez <fabricio.hmf@gmail.com>
6 */
7
8#ifndef NODE_H_
9#define NODE_H_
10
11#include "Eigen/Core"
12using Eigen::Vector3d;
13
16class Node {
17
18public:
19
22 virtual ~Node();
23
26 Node();
27
30 inline void setId(int node_id) { this->id=node_id; }
31
34 inline void setActive(bool node_activate) { this->active=node_activate; }
35
38 inline void setCoordinates(const Vector3d& nodal_coordinates) { this->coordinates=nodal_coordinates; }
39
42 inline void setVelocity(const Vector3d& nodal_velocity) { this->velocity=nodal_velocity; }
43
46 inline void setMomentum(const Vector3d& nodal_momentum) { this->momentum=nodal_momentum; }
47
50 virtual inline void setMomentumFluid(const Vector3d& nodal_momentum_fluid) { return; }
51
55 inline void setTotalForce(const Vector3d& total_nodal_force) { this->totalForce=total_nodal_force; }
56
60 virtual inline void setTotalForceFluid(const Vector3d& total_nodal_force_fluid) { return; }
61
64 inline int getId() const { return this->id; }
65
68 inline bool getActive() const { return this->active; }
69
72 inline double getMass() const { return this->mass; }
73
76 virtual inline double getMassFluid() const { return 0.0; }
77
81 inline const Vector3d& getCoordinates() const { return this->coordinates; }
82
85 inline const Vector3d& getMomentum() const { return this->momentum; }
86
89 virtual inline const Vector3d* getMomentumFluid() const { return NULL; }
90
93 inline const Vector3d& getInternalForce() const { return this->internalForce; }
94
97 inline const Vector3d& getExternalForce() const { return this->externalForce; }
98
101 inline const Vector3d& getTotalForce() const { return this->totalForce; }
102
105 virtual inline const Vector3d* getTotalForceFluid() const { return NULL; }
106
109 inline const Vector3d& getVelocity() const { return this->velocity; }
110
113 virtual inline const Vector3d* getVelocityFluid() const { return NULL; }
114
117 inline void addMass(double mass_increment) { this->mass+=mass_increment; }
118
121 virtual inline void addMassFluid(double fluid_mass_increment) { return; }
122
125 inline void addMomentum(const Vector3d& momentum_increment) { this->momentum+=momentum_increment; }
126
129 virtual inline void addMomentumFluid(const Vector3d& fluid_momentum_increment) { return; }
130
133 inline void addInternalForce(const Vector3d& internal_force_increment) { this->internalForce+=internal_force_increment; }
134
137 virtual inline void addInternalForceFluid(const Vector3d& internal_force_fluid_increment) { return; }
138
141 inline void addExternalForce(const Vector3d& external_force_increment) { this->externalForce+=external_force_increment; }
142
145 virtual inline void addExternalForceFluid(const Vector3d& external_force_fluid_increment) { return; }
146
149 virtual void resetValues();
150
153 virtual inline void updateTotalForce() { this->totalForce = this->internalForce + this->externalForce + this->dampingForce; }
154
157 virtual void updateDampingForce();
158
161 inline void updateVelocity(){ this->velocity = this->momentum / this->mass; }
162
165 virtual inline void integrateMomentum(double dt) { this->momentum += this->totalForce*dt; }
166
167protected:
168
169 bool active;
170
171 int id;
172
173 double mass;
174
175 Vector3d coordinates;
176 Vector3d momentum;
177 Vector3d velocity;
178 Vector3d externalForce;
179 Vector3d internalForce;
180 Vector3d dampingForce;
181 Vector3d totalForce;
182};
183
184inline Node::Node() {
185
186 active=false;
187 id=0;
188 mass=0.0;
189 coordinates.setZero();
190 momentum.setZero();
191 velocity.setZero();
192 externalForce.setZero();
193 internalForce.setZero();
194 totalForce.setZero();
195 dampingForce.setZero();
196}
197
198inline void Node::resetValues()
199{
200 active=false;
201 mass=0.0;
202 momentum.setZero();
203 externalForce.setZero();
204 internalForce.setZero();
205}
206
207inline Node::~Node() { }
208
209#endif /* NODE_H_ */
Represents a mesh node.
Definition Node.h:16
int getId() const
Return the nodal identification.
Definition Node.h:64
Vector3d momentum
nodal momentum: , or momentum in solid in two-phase calculations:
Definition Node.h:176
Vector3d dampingForce
nodal damping force: , or damping force in solid in two-phase calculations:
Definition Node.h:180
virtual void addMomentumFluid(const Vector3d &fluid_momentum_increment)
Add fluid momentum increment to the nodal momentum of fluid.
Definition Node.h:129
Vector3d velocity
nodal velocity: , or velocity in solid in two-phase calculations:
Definition Node.h:177
virtual const Vector3d * getMomentumFluid() const
Return the nodal momentum of fluid phase.
Definition Node.h:89
void updateVelocity()
Update nodal velocity.
Definition Node.h:161
double getMass() const
Return the nodal mass.
Definition Node.h:72
virtual void updateTotalForce()
Calculate the total nodal force.
Definition Node.h:153
void addMass(double mass_increment)
Add a mass increment to the nodal mass.
Definition Node.h:117
void addInternalForce(const Vector3d &internal_force_increment)
Add a internal force increment to the nodal internal force.
Definition Node.h:133
virtual void integrateMomentum(double dt)
Definition Node.h:165
bool getActive() const
Return the activate state of the node.
Definition Node.h:68
int id
nodal identification
Definition Node.h:171
virtual void resetValues()
Delete all values stored in node.
Definition Node.h:198
const Vector3d & getExternalForce() const
Return the nodal external force.
Definition Node.h:97
double mass
nodal mass: , or solid mass in two-phase calculations:
Definition Node.h:173
virtual void updateDampingForce()
Calculate the damping nodal force.
void setTotalForce(const Vector3d &total_nodal_force)
Configure the total nodal force.
Definition Node.h:55
virtual void setTotalForceFluid(const Vector3d &total_nodal_force_fluid)
Configure the total nodal force in fluid phase.
Definition Node.h:60
virtual void setMomentumFluid(const Vector3d &nodal_momentum_fluid)
Configure the nodal momentum of fluid phase.
Definition Node.h:50
const Vector3d & getVelocity() const
Return the nodal velocity.
Definition Node.h:109
virtual void addInternalForceFluid(const Vector3d &internal_force_fluid_increment)
Add a internal force increment of fluid to the nodal internal force.
Definition Node.h:137
virtual void addMassFluid(double fluid_mass_increment)
Add fluid mass increment to the nodal mass.
Definition Node.h:121
Vector3d coordinates
nodal coordinates:
Definition Node.h:175
bool active
is active node
Definition Node.h:169
void setId(int node_id)
Configure node identification.
Definition Node.h:30
virtual ~Node()
Default destructor.
Definition Node.h:207
void setVelocity(const Vector3d &nodal_velocity)
Configure the nodal velocity.
Definition Node.h:42
virtual double getMassFluid() const
Return the nodal mass of fluid phase.
Definition Node.h:76
Vector3d externalForce
nodal external force: , or external force in solid in two-phase calculations:
Definition Node.h:178
void setCoordinates(const Vector3d &nodal_coordinates)
Configure the nodal coordinates.
Definition Node.h:38
Vector3d totalForce
nodal total force: , or total force in solid in two-phase calculations:
Definition Node.h:181
virtual void addExternalForceFluid(const Vector3d &external_force_fluid_increment)
Add a external force of fluid increment to the nodal external force.
Definition Node.h:145
Vector3d internalForce
nodal internal force: , or internal force in solid in two-phase calculations:
Definition Node.h:179
void setActive(bool node_activate)
Configure the active state on the node.
Definition Node.h:34
const Vector3d & getTotalForce() const
Return the nodal total force.
Definition Node.h:101
const Vector3d & getCoordinates() const
Return the nodal coordinates.
Definition Node.h:81
virtual const Vector3d * getVelocityFluid() const
Return the nodal velocity of fluid phase.
Definition Node.h:113
Node()
Default constructor.
Definition Node.h:184
void addExternalForce(const Vector3d &external_force_increment)
Add a external force increment to the nodal external force.
Definition Node.h:141
const Vector3d & getMomentum() const
Return the nodal momentum.
Definition Node.h:85
const Vector3d & getInternalForce() const
Return the nodal internal force.
Definition Node.h:93
void addMomentum(const Vector3d &momentum_increment)
Add a momentum increment to the nodal momentum.
Definition Node.h:125
void setMomentum(const Vector3d &nodal_momentum)
Configure the nodal momentum.
Definition Node.h:46
virtual const Vector3d * getTotalForceFluid() const
Return the nodal total force of fluid phase.
Definition Node.h:105