Skip to content

Commit

Permalink
🔧 🎯 solve conflict and add phase_id in material_sets
Browse files Browse the repository at this point in the history
  • Loading branch information
bodhinandach committed Jul 24, 2020
1 parent 71dafdc commit e2e18ad
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
13 changes: 8 additions & 5 deletions include/solvers/mpm_base.tcc
Original file line number Diff line number Diff line change
Expand Up @@ -336,17 +336,20 @@ bool mpm::MPMBase<Tdim>::initialise_particles() {
for (const auto& material_set : material_sets) {
unsigned material_id =
material_set["material_id"].template get<unsigned>();
unsigned phase_id = mpm::ParticlePhase::Solid;
if (material_set.contains("phase_id"))
phase_id = material_set["phase_id"].template get<unsigned>();
unsigned pset_id = material_set["pset_id"].template get<unsigned>();
// Update material_id for particles in each pset
mesh_->iterate_over_particle_set(
pset_id,
std::bind(&mpm::ParticleBase<Tdim>::assign_material,
std::placeholders::_1, materials_.at(material_id)));
pset_id, std::bind(&mpm::ParticleBase<Tdim>::assign_material,
std::placeholders::_1,
materials_.at(material_id), phase_id));
}
}
} catch (std::exception& exception) {
console_->warn("{} #{}: Material sets are not specified", __FILE__, __LINE__,
exception.what());
console_->warn("{} #{}: Material sets are not specified", __FILE__,
__LINE__, exception.what());
}

} catch (std::exception& exception) {
Expand Down
3 changes: 2 additions & 1 deletion tests/io/write_mesh_particles.cc
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ bool write_json(unsigned dim, bool resume, const std::string& analysis,
{"density", 2300.},
{"youngs_modulus", 1.5E+6},
{"poisson_ratio", 0.25}}}},
{"material_sets", {{{"material_id", 1}, {"pset_id", 2}}}},
{"material_sets",
{{{"material_id", 1}, {"phase_id", 0}, {"pset_id", 2}}}},
{"external_loading_conditions",
{{"gravity", gravity},
{"particle_surface_traction",
Expand Down

0 comments on commit e2e18ad

Please sign in to comment.