NetDEM v1.0
Loading...
Searching...
No Matches
membrane.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "utils_math.hpp"
4#include <string>
5
6namespace netdem {
7
15class Membrane {
16public:
18 double radius{0.25};
19
21 double height{1.0};
22
24 double mesh_size{0.1};
25
27 Vec3d center{0, 0, 0};
28
30
35 double neo_k{6.94e5};
36
38 double neo_mu{5.21e5};
39
41 double density{500.0};
42
44 double thickness{0.3e-3};
45
47 double damp_coef{0.7};
48
50 double timestep{1.0e-4};
51
54
57
60
64
68
71
74
78
88 Membrane(double radius, double height);
89
102 Membrane(double radius, double height, double mesh_size);
103
119 Membrane(double radius, double height, double mesh_size, double center_x,
120 double center_y, double center_z);
121
130 void Remesh(double ele_size);
131
138 void Init();
139
160 void SetBCNodalVelocity(int nid, double vx, double vy, double vz,
161 bool use_prescribed_vx, bool use_prescribed_vy,
162 bool use_prescribed_vz);
163
171 void Solve(double dt);
172
181 void SaveAsVTK(std::string const &file_name);
182
189 ~Membrane();
190
191protected:
193 double ref_ele_width{0.1}, ref_ele_height{0.1};
194
196 double ref_ele_area{0.05};
197
200
203
211 void Advance(double dt);
212
214 void InitMesh();
215
218
230 Mat2d GetDeformationGradient(Vec3d const &v0, Vec3d const &v1,
231 Vec3d const &v2);
232
242 Mat2d GetCauchyStress(Mat2d const &def_grad);
243
260 std::tuple<Mat3d, Mat3d> GetGlobalForces(Mat2d const &cauchy_stress,
261 double pressure, Vec3d const &v0,
262 Vec3d const &v1, Vec3d const &v2);
263};
264
265} // namespace netdem
A class that simulates a membrane.
Definition membrane.hpp:15
double radius
The radius of the membrane.
Definition membrane.hpp:18
~Membrane()
Destroys the Membrane object.
Definition membrane.cpp:224
double density
Material properties of the membrane.
Definition membrane.hpp:41
void InitMesh()
Initializes the mesh used to represent the membrane.
Definition membrane.cpp:226
void Remesh(double ele_size)
Remeshes the membrane.
Definition membrane.cpp:28
VecXT< Vec3d > nodal_vels
Nodal velocities for each node in the mesh (used for updating motion using a lumped mass approach).
Definition membrane.hpp:67
void Solve(double dt)
Solves the membrane motion for a given timestep.
Definition membrane.cpp:47
void Advance(double dt)
Advances the membrane motion for a given timestep.
Definition membrane.cpp:59
double damp_coef
Damping coefficient for the membrane motion.
Definition membrane.hpp:47
void InitInitialCondition()
Initializes the initial conditions for the simulation.
Definition membrane.cpp:268
VecXT< VecNT< double, 6 > > bc_nodal_vels
Nodal velocities for the boundary conditions. The last three elements indicate if prescribed velociti...
Definition membrane.hpp:77
VecXT< Vec3d > nodes
Triangle mesh representing the membrane: nodes.
Definition membrane.hpp:53
double neo_mu
Material properties of the membrane (neo-Hookean material model).
Definition membrane.hpp:38
double mesh_size
The size of the elements in the mesh used to represent the membrane.
Definition membrane.hpp:24
VecXT< double > nodal_vols
Nodal volumes for each node in the mesh (used for updating motion using a lumped mass approach).
Definition membrane.hpp:63
VecXT< Vec3d > bc_facet_forces
Facet forces for the boundary conditions.
Definition membrane.hpp:73
double timestep
Timestep for the simulation.
Definition membrane.hpp:50
double ref_ele_area
Reference area of each element.
Definition membrane.hpp:196
Membrane(double radius, double height)
Constructs a new Membrane object with the given radius and height.
Definition membrane.cpp:10
double height
The height of the membrane.
Definition membrane.hpp:21
VecXT< Vec3d > elemental_stress
Elemental stress tensor for each element in the mesh.
Definition membrane.hpp:59
VecXT< Vec3i > elements
Triangle mesh representing the membrane: elements.
Definition membrane.hpp:56
void Init()
Initializes the membrane.
Definition membrane.cpp:33
VecXT< Vec3d > nodal_forces_ext
Nodal external forces.
Definition membrane.hpp:202
double neo_k
Material properties of the membrane (neo-Hookean material model).
Definition membrane.hpp:35
double thickness
Material properties of the membrane.
Definition membrane.hpp:44
double ref_ele_width
Reference width and height of each element.
Definition membrane.hpp:193
Vec3d center
The center of the membrane.
Definition membrane.hpp:27
void SetBCNodalVelocity(int nid, double vx, double vy, double vz, bool use_prescribed_vx, bool use_prescribed_vy, bool use_prescribed_vz)
Sets the nodal velocity and boundary condition for a given node.
Definition membrane.cpp:35
double ref_ele_height
Definition membrane.hpp:193
Mat2d GetDeformationGradient(Vec3d const &v0, Vec3d const &v1, Vec3d const &v2)
Calculates the deformation gradient tensor for an element.
Definition membrane.cpp:301
VecXT< Vec3d > nodal_forces_int
Nodal internal forces.
Definition membrane.hpp:199
Mat2d GetCauchyStress(Mat2d const &def_grad)
Calculates the Cauchy stress tensor for an element.
Definition membrane.cpp:322
VecXT< double > bc_facet_pressure
Facet pressures for the boundary conditions.
Definition membrane.hpp:70
std::tuple< Mat3d, Mat3d > GetGlobalForces(Mat2d const &cauchy_stress, double pressure, Vec3d const &v0, Vec3d const &v1, Vec3d const &v2)
Calculates the global internal and external forces acting on an element.
Definition membrane.cpp:344
void SaveAsVTK(std::string const &file_name)
Saves the current state of the membrane as a VTK file.
Definition membrane.cpp:142
Definition bond_entry.hpp:7
std::vector< T > VecXT
Definition utils_macros.hpp:31
std::array< double, 3 > Vec3d
Definition utils_macros.hpp:18
std::array< std::array< double, 2 >, 2 > Mat2d
Definition utils_macros.hpp:21