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
11
class
TerrainContact
{
12
13
private
:
14
15
STLReader
*
stlMesh
;
16
17
double
frictionCoefficient
;
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
29
public
:
30
31
TerrainContact
(
STLReader
* mesh,
double
friction)
32
:
stlMesh
(mesh),
frictionCoefficient
(friction) {}
33
36
void
computeDistanceLevelSetFunction
(
Mesh
* mesh);
37
40
void
particleDistanceLevelSet
(
Mesh
* mesh, vector< Particle* >* particles);
41
45
void
nodalDensityLevelSet
(
Mesh
* mesh, vector< Particle* >* particles);
46
50
void
trianglesDensityLevelSet
(
Mesh
* mesh);
51
53
void
determineContactPotentialPairs
(
Mesh
* mesh, std::vector< Particle* >* particles);
54
56
STLReader
*
getSTLMesh
() {
return
stlMesh
; }
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
Mesh.h
STLReader.h
Mesh
Class representing a rectangular grid mesh.
Definition
Mesh.h:26
STLReader
Class to read STL files.
Definition
STLReader.h:57
TerrainContact
Class to compute terrain contact.
Definition
TerrainContact.h:11
TerrainContact::enablePenaltyContact
void enablePenaltyContact(bool enable)
Enable the penalty contact method.
TerrainContact::nodalDensityLevelSet
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...
TerrainContact::computeDistanceLevelSetFunction
void computeDistanceLevelSetFunction(Mesh *mesh)
compute the distance level set function in nodes It is the distance from the node to the STL mesh
TerrainContact::usePenaltyContact
bool usePenaltyContact
Use penalty contact method.
Definition
TerrainContact.h:25
TerrainContact::setDistanceThreshold
void setDistanceThreshold(double threshold)
Set the distance threshold for contact detection.
Definition
TerrainContact.h:65
TerrainContact::apply
void apply(Mesh *mesh, std::vector< Particle * > *particles, double dt)
Apply the terrain contact algorithm.
TerrainContact::penaltyStiffness
double penaltyStiffness
Penalty stiffness for contact forces.
Definition
TerrainContact.h:27
TerrainContact::getSTLMesh
STLReader * getSTLMesh()
Get the triangular mesh.
Definition
TerrainContact.h:56
TerrainContact::stlMesh
STLReader * stlMesh
triangular mesh for terrain contact
Definition
TerrainContact.h:15
TerrainContact::densityLevelSet
std::vector< double > densityLevelSet
density level set function interpolated in centroids of triangles
Definition
TerrainContact.h:19
TerrainContact::computeContactForces
void computeContactForces(double dt)
TerrainContact::TerrainContact
TerrainContact(STLReader *mesh, double friction)
Definition
TerrainContact.h:31
TerrainContact::contactPairs
std::vector< std::pair< Particle *, Triangle * > > contactPairs
contact potential pairs
Definition
TerrainContact.h:21
TerrainContact::scalingFactor
double scalingFactor
scaling factor for the distance threshold in contact detection
Definition
TerrainContact.h:23
TerrainContact::determineContactPotentialPairs
void determineContactPotentialPairs(Mesh *mesh, std::vector< Particle * > *particles)
Determine the contact potential pairs.
TerrainContact::particleDistanceLevelSet
void particleDistanceLevelSet(Mesh *mesh, vector< Particle * > *particles)
Interpolate distance level set function value of particle .
TerrainContact::frictionCoefficient
double frictionCoefficient
Friction coefficient .
Definition
TerrainContact.h:17
TerrainContact::trianglesDensityLevelSet
void trianglesDensityLevelSet(Mesh *mesh)
Interpolate the density level set function in the centroids of triangles It allows to know the bound...
TerrainContact::setPenaltyStiffness
void setPenaltyStiffness(double k)
Set the penalty stiffness for contact forces.
inc
TerrainContact.h
Generated by
1.12.0