MPM-Geomechanics
Material Point Method for simulating geo-materials under large deformation conditions
Loading...
Searching...
No Matches
TerrainContact.h
Go to the documentation of this file.
1// SPDX-License-Identifier: MIT
2// Copyright (c) 2021-2025 MPM-Geomechanics Development Team
3
4#ifndef TERRAIN_CONTACT_H
5#define TERRAIN_CONTACT_H
6
7#include "Mesh/STLReader.h"
8#include "Mesh/Mesh.h"
9
12
13private:
14
16
18
19 std::vector<double> densityLevelSet;
20
21 std::vector<std::pair<Particle*, Triangle*>> contactPairs;
22
23 double scalingFactor = 2.0;
24
25 bool usePenaltyContact = false;
26
27 double penaltyStiffness = 0.0;
28
29public:
30
31 TerrainContact(STLReader* mesh, double friction)
32 : stlMesh(mesh), frictionCoefficient(friction) {}
33
37
40 void particleDistanceLevelSet(Mesh* mesh, vector< Particle* >* particles);
41
45 void nodalDensityLevelSet(Mesh* mesh, vector< Particle* >* particles);
46
51
53 void determineContactPotentialPairs(Mesh* mesh, std::vector< Particle* >* particles);
54
57
58 // \brief Compute the contact forces
59 // \f$ f_n = -m_p \frac{v_p^n}{dt} e_n \f$
60 // \f$ f_t = -m_p \frac{v_p - v_p^n e_n}{dt} \f$
61 void computeContactForces(double dt);
62
65 void setDistanceThreshold(double threshold) { scalingFactor = threshold > 0.0 ? threshold : 2.0; };
66
68 void apply(Mesh* mesh, std::vector<Particle*>* particles, double dt);
69
71 void enablePenaltyContact(bool enable);
72
74 void setPenaltyStiffness(double k);
75};
76
77#endif // TERRAINCONTACT_H
Class representing a rectangular grid mesh.
Definition Mesh.h:26
Class to read STL files.
Definition STLReader.h:57
Class to compute terrain contact.
Definition TerrainContact.h:11
void enablePenaltyContact(bool enable)
Enable the penalty contact method.
void nodalDensityLevelSet(Mesh *mesh, vector< Particle * > *particles)
Calculate the nodal density level set function It allows to know the boundary of the body for a cert...
void computeDistanceLevelSetFunction(Mesh *mesh)
compute the distance level set function in nodes It is the distance from the node to the STL mesh
bool usePenaltyContact
Use penalty contact method.
Definition TerrainContact.h:25
void setDistanceThreshold(double threshold)
Set the distance threshold for contact detection.
Definition TerrainContact.h:65
void apply(Mesh *mesh, std::vector< Particle * > *particles, double dt)
Apply the terrain contact algorithm.
double penaltyStiffness
Penalty stiffness for contact forces.
Definition TerrainContact.h:27
STLReader * getSTLMesh()
Get the triangular mesh.
Definition TerrainContact.h:56
STLReader * stlMesh
triangular mesh for terrain contact
Definition TerrainContact.h:15
std::vector< double > densityLevelSet
density level set function interpolated in centroids of triangles
Definition TerrainContact.h:19
void computeContactForces(double dt)
TerrainContact(STLReader *mesh, double friction)
Definition TerrainContact.h:31
std::vector< std::pair< Particle *, Triangle * > > contactPairs
contact potential pairs
Definition TerrainContact.h:21
double scalingFactor
scaling factor for the distance threshold in contact detection
Definition TerrainContact.h:23
void determineContactPotentialPairs(Mesh *mesh, std::vector< Particle * > *particles)
Determine the contact potential pairs.
void particleDistanceLevelSet(Mesh *mesh, vector< Particle * > *particles)
Interpolate distance level set function value of particle .
double frictionCoefficient
Friction coefficient .
Definition TerrainContact.h:17
void trianglesDensityLevelSet(Mesh *mesh)
Interpolate the density level set function in the centroids of triangles It allows to know the bound...
void setPenaltyStiffness(double k)
Set the penalty stiffness for contact forces.