Skip to content

Commit

Permalink
Fix problem with Rigid bodies, contacts and TLMPM. Now rigid bodies n…
Browse files Browse the repository at this point in the history
…eed to have their density specified.
  • Loading branch information
adevaucorbeil committed Aug 22, 2024
1 parent 7b5632e commit a342e5a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
9 changes: 6 additions & 3 deletions src/material.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ void Material::add_material(vector<string> args) {
cp, kappa});

} else if (args[1].compare("rigid") == 0) {
materials.push_back(Mat{args[0], RIGID});
materials.push_back(Mat{args[0], RIGID, input->parsev(args[2])});
} else {
// create the Material
int iEOS = material->find_EOS(args[2]);
Expand Down Expand Up @@ -656,7 +656,9 @@ void Material::read_restart(ifstream *ifr) {

materials.push_back(Mat{id, type, rho0, E, nu, cp, kappa});
} else if (type == RIGID) {
materials.push_back(Mat{id, RIGID});
double rho0;
ifr->read(reinterpret_cast<char *>(&rho0), sizeof(double));
materials.push_back(Mat{id, RIGID, rho0});
} else {
error->one(FLERR, "Error: unkown material type" + to_string(type) + ".\n");
}
Expand Down Expand Up @@ -768,8 +770,9 @@ Mat::Mat(string id_, int type_, double rho0_, double E_, double nu_, double cp_,

/*! The arguments are: material ID, material type (see Material::constitutive_model)
*/
Mat::Mat(string id_, int type_) {
Mat::Mat(string id_, int type_, double rho0_) {
type = type_;
id = id_;
rigid = true;
rho0 = rho0_;
}
6 changes: 3 additions & 3 deletions src/material.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class Mat {
Mat(string, int, class EOS *, class Strength *, class Damage *,
class Temperature *); ///< Creates an elasto-plastic material
Mat(string, int, double, double, double, double, double); ///< Creates a linear or Neo-Hookean material
Mat(string, int); ///< Creates a rigid material
Mat(string, int, double); ///< Creates a rigid material
};

/*! Stores all the user defined Equations of State, elasto-plastic, damage, and temperature
Expand Down Expand Up @@ -124,11 +124,11 @@ class Material : protected Pointers {
template <typename T> static Damage *damage_creator(MPM *,vector<string>);
template <typename T> static Temperature *temperature_creator(MPM *,vector<string>);

const map<string, string> usage = {{"rigid", "Usage: material(material-ID, \033[1;32mrigid\033[0m)\n"},
const map<string, string> usage = {{"rigid", "Usage: material(material-ID, \033[1;32mrigid\033[0m, rho)\n"},
{"linear", "Usage: material(material-ID, \033[1;32mlinear\033[0m, rho, E, nu, optional: cp, optional: kappa, optional: damage-ID)\n"},
{"neo-hookean", "Usage: material(material-ID, \033[1;32mneo-hookean\033[0m, rho, E, nu, optional: cp, optional: kappa, optional: damage-ID)\n"},
{"eos-strength", "Usage: material(material-ID, \033[1;32meos-strength\033[0m, eos-ID, strength-ID, optional: damage-ID, optional: temperature-ID)\n"}};
const map<string, int> Nargs = {{"rigid", 2},
const map<string, int> Nargs = {{"rigid", 3},
{"linear", 5},
{"neo-hookean", 5},
{"eos-strength", 4}};
Expand Down
6 changes: 1 addition & 5 deletions src/solid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2022,11 +2022,7 @@ void Solid::populate(vector<string> args)
else
vol_ = delta * delta * delta;

double mass_;
if (mat->rigid)
mass_ = 1;
else
mass_ = mat->rho0 * vol_;
double mass_ = mat->rho0 * vol_;

np_per_cell = (int) input->parsev(args[3]);
double xi = 0.5;
Expand Down

0 comments on commit a342e5a

Please sign in to comment.