Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
82 commits
Select commit Hold shift + click to select a range
93d82dc
start project :tada:
LDTalbot Jul 31, 2023
746fa63
levelset first draft :tada: :construction:
LDTalbot Jan 13, 2024
d84dd21
Merge branch 'master' into levelset
LDTalbot Jan 13, 2024
baafa05
working on constructors :construction:
LDTalbot Jan 18, 2024
4fca077
debugging :bug: and input flow :refactor:
LDTalbot Jan 19, 2024
bc3c8cb
debug virtual classes and is_levelset warnings :bug:
LDTalbot Jan 23, 2024
0ddf0e6
levelset first draft working with debug flags :bug: :construction:
LDTalbot Feb 1, 2024
8f3904c
levelset_mp_radius now directly input and const within contact :recyc…
LDTalbot Feb 1, 2024
9a759a4
tidy for draft PR :bookmark: :construction:
LDTalbot Feb 1, 2024
c905255
bug fixes :bug: and autocalc mp_radius :sparkles:
LDTalbot Feb 10, 2024
c31aa74
remove levelset_mp_radius as input :recycle: :fire:
LDTalbot Feb 10, 2024
fcdc443
small edits :adhesive_bandage:
LDTalbot Mar 12, 2024
1a55ec1
fix 3D tangent special case :bug:
LDTalbot Mar 12, 2024
ff75cee
contact criteria improved (must be accelerating towards levelset) and…
LDTalbot Mar 18, 2024
53f03c1
update contact condition w.r.t velocity :rocket: :bug:
LDTalbot Mar 19, 2024
3397e43
minor changes :adhesive_bandage: :goal_net:
LDTalbot Apr 17, 2024
3f20199
add adhesion and uphill force prevention :sparkles: :rocket: :bug:
LDTalbot Apr 24, 2024
f36c0cb
merge master changes :twisted_rightwards_arrows:
LDTalbot Apr 24, 2024
f89edfa
area and couple updates, contact rule :rocket: :bug:
LDTalbot May 2, 2024
be94707
contact conditions improved :rocket: :bug:
LDTalbot May 13, 2024
d2c7d5e
optional friction smoothing :adhesive_bandage:
LDTalbot May 21, 2024
1e9bb65
added B-Bar compatibility :sparkles:
LDTalbot Aug 4, 2024
85a944b
added couple damping as input :sparkles: :bug:
LDTalbot Aug 4, 2024
753a931
double formatting :adhesive_bandage:
LDTalbot Aug 4, 2024
54c016a
Merge branch 'master' into levelset :twisted_rightwards_arrows:
LDTalbot Aug 6, 2024
5c02da2
add options for contact velocity update scheme and temp off for uphil…
LDTalbot Aug 29, 2024
b259de7
fix bbar compatibility :bug:
LDTalbot Sep 29, 2024
a8ea715
Merge branch 'master' into levelset :twisted_rightwards_arrows:
LDTalbot Oct 9, 2024
6895964
tidy warnings :goal_net: :speech_balloon:
LDTalbot Nov 7, 2024
8fc6f5b
Merge branch 'master' into levelset :twisted_rightwards_arrows:
LDTalbot Nov 7, 2024
fde060a
Merge branch 'master' into levelset :twisted_rightwards_arrows:
LDTalbot Nov 8, 2024
6ba5643
refactor ls appl. check :recycle: :zap:, levelset_couple vtk :monocle…
LDTalbot Dec 12, 2024
83aeb4a
BSpline closed-form w/ bool option :zap: :triangular_flag_on_post:
LDTalbot Dec 12, 2024
675af0b
upper limits fix for BSpline closed-form :bug:
LDTalbot Dec 12, 2024
9a8ca67
fix tests, small refactor for closed-form setter :white_check_mark: :…
LDTalbot Dec 14, 2024
e0af345
minor updates, temporary hard-coded volume for constant mp_radius :ad…
LDTalbot Jan 14, 2025
390a739
refactor for static and time-independent variables :recycle: :zap:
LDTalbot Jan 14, 2025
dfa01ef
Add separate state Mohr-Coulomb
bodhinandach Jan 17, 2025
b4f28c4
small type change :label:
LDTalbot Jan 17, 2025
851083d
resume temporary warning :goal_net: :construction:
LDTalbot Jan 20, 2025
41496c2
optional geometry output; now requires "vtk": ["geometry"] :children_…
LDTalbot Jan 21, 2025
f019901
tidy :bulb: :adhesive_bandage:
LDTalbot Jan 21, 2025
e305e11
refactor + OpenMP compatible :recycle: :zap: :art:
LDTalbot Jan 24, 2025
7eca9af
add levelset to vtk scalar properties :sparkles: :card_file_box:
LDTalbot Feb 13, 2025
64943ea
refactor update_mass_momentum :recycle: :zap:
LDTalbot Feb 13, 2025
128cff4
clang format :art:
LDTalbot Feb 13, 2025
bee85c5
remove friciton smoothing over slip threshold for MPI :fire: :thread:
LDTalbot Feb 19, 2025
882aef3
Refactor levelset parameters
bodhinandach Feb 27, 2025
a98371d
Refactor mp_radius
bodhinandach Feb 27, 2025
4b04978
Add particle type in levelset
bodhinandach Feb 27, 2025
97e8ce6
transfer size
bodhinandach Mar 4, 2025
35916df
Fix vtk output and add id output
bodhinandach Mar 5, 2025
27f82d3
Remove initialise nodal_properties
bodhinandach Mar 5, 2025
4a81f96
tidy, remove resume error :art: :adhesive_bandage:
LDTalbot Mar 7, 2025
3595481
Correct resume size
bodhinandach Apr 9, 2025
20f5f1a
:rocket: square contact area with changing volume; variable name changes
LDTalbot Apr 9, 2025
c2ed6b3
:adhesive_bandage: :bulb: contact_area separate declaration; update c…
LDTalbot Apr 9, 2025
a8333e6
fix leveset typo :pencil2:
LDTalbot Apr 11, 2025
2ec0ed7
write tests :white_check_mark:
LDTalbot Apr 11, 2025
d98969b
remove non-levelset edits in PR :truck: :fire: :bookmark:
LDTalbot Apr 11, 2025
87170d0
merge master :twisted_rightwards_arrows:
LDTalbot Apr 17, 2025
10f820d
:goal_net: :speech_balloon: added MP ID for particle outside mesh domain
LDTalbot May 2, 2025
97f0e32
:speech_balloon: :goal_net: :truck: levelset minimum value check give…
LDTalbot May 2, 2025
bbd5b22
fix error with resume in twophase particle
bodhinandach May 3, 2025
22e267c
fix test levelset values :white_check_mark: :bug:
LDTalbot May 5, 2025
6298034
fix tests 3D :white_check_mark: :bug:
LDTalbot May 5, 2025
fbaaff7
added ParticleLevelsetBbar tests :white_check_mark:
LDTalbot May 5, 2025
f206f87
fix ParticleLevelsetBbar tests :white_check_mark: :bug:
LDTalbot May 6, 2025
49a38b3
fixing ParticleLevelsetBbar tests :white_check_mark: :bug:
LDTalbot May 6, 2025
1c7df8e
remove implicit levelset bbar functions :fire: and tidy tests :white_…
LDTalbot May 7, 2025
d1900c5
Merge branch 'master' into levelset :twisted_rightwards_arrows:
LDTalbot May 7, 2025
da8ab81
add more tests :white_check_mark:
LDTalbot May 7, 2025
b7041e9
levelset violation correction factor w/ json input :sparkles: :constr…
LDTalbot May 8, 2025
6ea35e8
remove debug code :adhesive_bandage: :fire:
LDTalbot May 8, 2025
9fd755a
:chidlren_crossing: levelset input defaults damping=0.05, velocity up…
LDTalbot May 8, 2025
3ef9fd1
Modify size to a scalar
bodhinandach May 14, 2025
cf8c883
update comments :bulb: :pencil2:
LDTalbot May 14, 2025
790d2ba
:label: :thread: put back static levelset variables, alter for MPI co…
LDTalbot Jun 4, 2025
460d609
:art: :recycle: :thread: remove Bcast and add setter for private statics
LDTalbot Jun 11, 2025
c23c102
Merge branch 'master' into levelset :twisted_rightwards_arrows:
LDTalbot Jul 3, 2025
d9c210f
update variable names and comments, couple/coupling force to reaction…
LDTalbot Aug 15, 2025
c1ef57c
:white_check_mark: test fix for input levelset-nodal-values-#d.txt
LDTalbot Aug 15, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@ if(MPM_BUILD_TESTING)
${mpm_SOURCE_DIR}/tests/test_main.cc
${mpm_SOURCE_DIR}/tests/io/write_mesh_particles.cc
${mpm_SOURCE_DIR}/tests/io/write_mesh_particles_unitcell.cc
${mpm_SOURCE_DIR}/tests/solvers/mpm_explicit_levelset_test.cc
${mpm_SOURCE_DIR}/tests/solvers/mpm_explicit_constraint_absorbing_test.cc
${mpm_SOURCE_DIR}/tests/solvers/mpm_explicit_constraint_acceleration_test.cc
${mpm_SOURCE_DIR}/tests/solvers/mpm_explicit_constraint_friction_test.cc
Expand Down
16 changes: 14 additions & 2 deletions include/contacts/contact.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,24 @@ class Contact {
//! Default constructor with mesh class
Contact(const std::shared_ptr<mpm::Mesh<Tdim>>& mesh);

//! Intialize
//! Intialise
virtual inline void initialise(){};

//! Compute contact forces
//! Initialise levelset properties
//! \param[in] levelset_damping Levelset damping factor
//! \param[in] levelset_pic Particle in cell method bool for contact velocity
//! \param[in] levelset_violation_corrector Violation correction factor
virtual inline void initialise_levelset_properties(
double levelset_damping, bool levelset_pic,
double levelset_violation_corrector){};

//! Compute contact reaction forces
virtual inline void compute_contact_forces(){};

//! Compute contact reaction forces
//! \param[in] dt Analysis time step
virtual inline void compute_contact_forces(double dt){};

protected:
//! Mesh object
std::shared_ptr<mpm::Mesh<Tdim>> mesh_;
Expand Down
6 changes: 3 additions & 3 deletions include/contacts/contact_friction.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ class ContactFriction : public Contact<Tdim> {
ContactFriction(const std::shared_ptr<mpm::Mesh<Tdim>>& mesh);

//! Intialize
virtual inline void initialise() override;
void initialise() override;

//! Compute contact forces
virtual inline void compute_contact_forces() override;
//! Compute contact reaction forces
void compute_contact_forces() override;

protected:
//! Mesh object
Expand Down
10 changes: 5 additions & 5 deletions include/contacts/contact_friction.tcc
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ mpm::ContactFriction<Tdim>::ContactFriction(
const std::shared_ptr<mpm::Mesh<Tdim>>& mesh)
: mpm::Contact<Tdim>(mesh) {}

//! Initialize nodal properties
//! Initialise nodal properties
template <unsigned Tdim>
inline void mpm::ContactFriction<Tdim>::initialise() {
void mpm::ContactFriction<Tdim>::initialise() {
// Initialise nodal properties
mesh_->initialise_nodal_properties();

Expand All @@ -16,9 +16,9 @@ inline void mpm::ContactFriction<Tdim>::initialise() {
std::placeholders::_1));
}

//! Compute contact forces
//! Compute contact reaction forces
template <unsigned Tdim>
inline void mpm::ContactFriction<Tdim>::compute_contact_forces() {
void mpm::ContactFriction<Tdim>::compute_contact_forces() {

// Map multimaterial properties from particles to nodes
mesh_->iterate_over_particles(std::bind(
Expand Down Expand Up @@ -49,4 +49,4 @@ inline void mpm::ContactFriction<Tdim>::compute_contact_forces() {
mesh_->iterate_over_nodes(
std::bind(&mpm::NodeBase<Tdim>::compute_multimaterial_normal_unit_vector,
std::placeholders::_1));
}
}
48 changes: 48 additions & 0 deletions include/contacts/contact_levelset.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#ifndef MPM_CONTACT_LEVELSET_H_
#define MPM_CONTACT_LEVELSET_H_

#include "contact.h"
#include "mesh_levelset.h"
#include "particle_levelset.h"

namespace mpm {

//! ContactLevelset class
//! \brief ContactLevelset base class
//! \tparam Tdim Dimension
template <unsigned Tdim>
class ContactLevelset : public Contact<Tdim> {
public:
//! Default constructor with mesh class
ContactLevelset(const std::shared_ptr<mpm::Mesh<Tdim>>& mesh);

//! Initialise levelset properties
//! \param[in] levelset_damping Levelset damping factor
//! \param[in] levelset_pic Particle in cell method bool for contact velocity
//! \param[in] levelset_violation_corrector Violation correction factor
void initialise_levelset_properties(
double levelset_damping, bool levelset_pic,
double levelset_violation_corrector) override;

//! Compute contact reaction forces
//! \param[in] dt Analysis time step
void compute_contact_forces(double dt) override;

//! Mesh levelset object
std::shared_ptr<mpm::MeshLevelset<Tdim>> mesh_levelset_;

protected:
//! levelset_damping_
double levelset_damping_;
//! levelset_pic_
bool levelset_pic_;
//! levelset_violation_corrector_
double levelset_violation_corrector_;
//! Mesh object
using mpm::Contact<Tdim>::mesh_;
}; // ContactLevelset class
} // namespace mpm

#include "contact_levelset.tcc"

#endif // MPM_CONTACT_LEVELSET_H_
25 changes: 25 additions & 0 deletions include/contacts/contact_levelset.tcc
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
//! Constructor of contact with mesh
template <unsigned Tdim>
mpm::ContactLevelset<Tdim>::ContactLevelset(
const std::shared_ptr<mpm::Mesh<Tdim>>& mesh)
: mpm::Contact<Tdim>(mesh) {
// Assign mesh
mesh_ = mesh;
}

//! Initialise levelset properties
template <unsigned Tdim>
void mpm::ContactLevelset<Tdim>::initialise_levelset_properties(
double levelset_damping, bool levelset_pic,
double levelset_violation_corrector) {
mpm::ParticleLevelset<Tdim>::set_levelset_properties(
levelset_damping, levelset_pic, levelset_violation_corrector);
}

//! Compute contact reaction forces
template <unsigned Tdim>
void mpm::ContactLevelset<Tdim>::compute_contact_forces(double dt) {
mesh_->iterate_over_particles(
std::bind(&mpm::ParticleBase<Tdim>::levelset_contact_force,
std::placeholders::_1, dt));
}
13 changes: 9 additions & 4 deletions include/io/io_mesh.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@ class IOMesh {
virtual std::vector<Eigen::Matrix<double, 6, 1>> read_particles_stresses(
const std::string& particles_stresses) = 0;

//! Read particle scalar properties
//! Read scalar properties for particles or nodes
//! \param[in] scalar_file file name with particle scalar properties
//! \retval Vector of particles scalar properties
virtual std::vector<std::tuple<mpm::Index, double>>
read_particles_scalar_properties(const std::string& scalar_file) = 0;
//! \retval Vector of scalar properties for particles or nodes
virtual std::vector<std::tuple<mpm::Index, double>> read_scalar_properties(
const std::string& scalar_file) = 0;

//! Read pressure constraints file
//! \param[in] pressure_constraints_files file name with pressure constraints
Expand Down Expand Up @@ -123,6 +123,11 @@ class IOMesh {
read_adhesion_constraints(
const std::string& adhesion_constraints_file) = 0;

//! Read levelset file
//! \param[in] levelset_input_file file name with levelset values
virtual std::vector<std::tuple<mpm::Index, double, double, double, double>>
read_levelset_input(const std::string& levelset_input_file) = 0;

//! Read forces file
//! \param[in] forces_file file name with nodal concentrated force
virtual std::vector<std::tuple<mpm::Index, unsigned, double>> read_forces(
Expand Down
13 changes: 9 additions & 4 deletions include/io/io_mesh_ascii.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ class IOMeshAscii : public IOMesh<Tdim> {
std::vector<Eigen::Matrix<double, 6, 1>> read_particles_stresses(
const std::string& particles_stresses) override;

//! Read particle scalar properties
//! \param[in] scalar_file file name with particle scalar properties
//! \retval Vector of particles scalar properties
std::vector<std::tuple<mpm::Index, double>> read_particles_scalar_properties(
//! Read scalar properties for particles or nodes
//! \param[in] scalar_file file name with particle or node scalar properties
//! \retval Vector of scalar properties for particles or nodes
std::vector<std::tuple<mpm::Index, double>> read_scalar_properties(
const std::string& scalar_file) override;

//! Read pressure constraints file
Expand Down Expand Up @@ -110,6 +110,11 @@ class IOMeshAscii : public IOMesh<Tdim> {
read_adhesion_constraints(
const std::string& adhesion_constraints_file) override;

//! Read levelset file
//! \param[in] levelset_input_file file name with levelset values
std::vector<std::tuple<mpm::Index, double, double, double, double>>
read_levelset_input(const std::string& levelset_input_file) override;

//! Read traction file
//! \param[in] forces_file file name with nodal concentrated force
std::vector<std::tuple<mpm::Index, unsigned, double>> read_forces(
Expand Down
65 changes: 60 additions & 5 deletions include/io/io_mesh_ascii.tcc
Original file line number Diff line number Diff line change
Expand Up @@ -254,13 +254,13 @@ std::vector<Eigen::Matrix<double, 6, 1>>
return stresses;
}

//! Return particles scalar properties
//! Return scalar properties for particles or nodes
template <unsigned Tdim>
std::vector<std::tuple<mpm::Index, double>>
mpm::IOMeshAscii<Tdim>::read_particles_scalar_properties(
mpm::IOMeshAscii<Tdim>::read_scalar_properties(
const std::string& scalar_file) {

// Particles scalar properties
// Scalar properties for particles or nodes
std::vector<std::tuple<mpm::Index, double>> scalar_properties;

// input file stream
Expand Down Expand Up @@ -293,7 +293,7 @@ std::vector<std::tuple<mpm::Index, double>>
}
file.close();
} catch (std::exception& exception) {
console_->error("Read particle {} #{}: {}\n", __FILE__, __LINE__,
console_->error("Read particle/node {} #{}: {}\n", __FILE__, __LINE__,
exception.what());
file.close();
}
Expand Down Expand Up @@ -641,7 +641,7 @@ std::vector<std::tuple<mpm::Index, unsigned, double>>
return constraints;
}

//! Return friction constraints of particles
//! Return friction constraints
template <unsigned Tdim>
std::vector<std::tuple<mpm::Index, unsigned, int, double>>
mpm::IOMeshAscii<Tdim>::read_friction_constraints(
Expand Down Expand Up @@ -748,6 +748,61 @@ std::vector<std::tuple<mpm::Index, unsigned, int, double, double, int>>
return constraints;
}

//! Return nodal levelset information
template <unsigned Tdim>
std::vector<std::tuple<mpm::Index, double, double, double, double>>
mpm::IOMeshAscii<Tdim>::read_levelset_input(
const std::string& levelset_input_file) {

// Nodal levelset information
std::vector<std::tuple<mpm::Index, double, double, double, double>>
levelset_inputs;
levelset_inputs.clear();

// input file stream
std::fstream file;
file.open(levelset_input_file.c_str(), std::ios::in);

try {
if (file.is_open() && file.good()) {
// Line
std::string line;
while (std::getline(file, line)) {
boost::algorithm::trim(line);
std::istringstream istream(line);
// ignore comment lines (# or !) or blank lines
if ((line.find('#') == std::string::npos) &&
(line.find('!') == std::string::npos) && (line != "")) {
// ID
mpm::Index id;
// Levelset value
double levelset;
// Friction
double levelset_mu;
// Adhesion coefficient
double levelset_alpha;
// Barrier stiffness
double barrier_stiffness;
while (istream.good()) {
// Read stream
istream >> id >> levelset >> levelset_mu >> levelset_alpha >>
barrier_stiffness;
levelset_inputs.emplace_back(std::make_tuple(
id, levelset, levelset_mu, levelset_alpha, barrier_stiffness));
}
}
}
} else {
throw std::runtime_error("File not open or not good!");
}
file.close();
} catch (std::exception& exception) {
console_->error("Read levelset inputs: {}", exception.what());
file.close();
}
return levelset_inputs;
}

//! Return particles force
template <unsigned Tdim>
std::vector<std::tuple<mpm::Index, unsigned, double>>
Expand Down
33 changes: 28 additions & 5 deletions include/mesh/mesh.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ class Mesh {
//! \param[in] cells Node ids of cells
//! \param[in] check_duplicates Parameter to check duplicates
//! \retval status Create cells status
bool create_cells(mpm::Index gnid,
bool create_cells(mpm::Index gcid,
const std::shared_ptr<mpm::Element<Tdim>>& element,
const std::vector<std::vector<mpm::Index>>& cells,
bool check_duplicates = true);
Expand Down Expand Up @@ -263,7 +263,7 @@ class Mesh {
//! Locate particles in a cell
//! Iterate over all cells in a mesh to find the cell in which particles
//! are located.
//! \retval particles Particles which cannot be located in the mesh
//! \retval particles which cannot be located in the mesh
std::vector<std::shared_ptr<mpm::ParticleBase<Tdim>>> locate_particles_mesh();

//! Iterate over particles
Expand Down Expand Up @@ -475,7 +475,7 @@ class Mesh {
//! Create map of vector of particles in sets
//! \param[in] map of particles ids in sets
//! \param[in] check_duplicates Parameter to check duplicates
//! \retval status Status of create particle sets
//! \retval status Status of create particle sets
bool create_particle_sets(
const tsl::robin_map<mpm::Index, std::vector<mpm::Index>>& particle_sets,
bool check_duplicates);
Expand Down Expand Up @@ -518,11 +518,33 @@ class Mesh {
void inject_particles(double current_time);

// Create the nodal properties' map
void create_nodal_properties();
virtual void create_nodal_properties();

// Initialise the nodal properties' map
void initialise_nodal_properties();

/**
* \defgroup Levelset Functions
*/
/**@{*/

//! Assign nodal levelset values
//! \ingroup Levelset
//! \param[in] levelset Levelset value at the particle
//! \param[in] levelset_mu Levelset friction coefficient
//! \param[in] levelset_alpha Levelset adhesion coefficient
//! \param[in] barrier_stiffness Barrier stiffness
virtual bool assign_nodal_levelset_values(
const std::vector<std::tuple<mpm::Index, double, double, double, double>>&
levelset_input_file) {
throw std::runtime_error(
"Calling the base class function (assign_nodal_levelset_values) in "
"Mesh:: illegal operation!");
return false;
};

/**@}*/

/**
* \defgroup MultiPhase Functions dealing with multi-phase MPM
*/
Expand Down Expand Up @@ -673,10 +695,11 @@ class Mesh {
const Json& generator, unsigned pset_id);

// Locate a particle in mesh cells
//! \param[in] particle of interest
bool locate_particle_cells(
const std::shared_ptr<mpm::ParticleBase<Tdim>>& particle);

private:
protected:
//! mesh id
unsigned id_{std::numeric_limits<unsigned>::max()};
//! Isoparametric mesh
Expand Down
Loading