Skip to content

Commit e32bf7c

Browse files
committed
Setup peridynamic interaction
1 parent b2f3392 commit e32bf7c

34 files changed

+5404
-77
lines changed

src/core/legacy_enum_definitions/4C_legacy_enum_definitions_materials.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,8 @@ std::string_view Core::Materials::to_string(Core::Materials::MaterialType materi
351351
return "MAT_ParticleDEM";
352352
case m_particle_wall_dem:
353353
return "MAT_ParticleWallDEM";
354+
case m_particle_pd:
355+
return "MAT_ParticlePD";
354356
case m_mixture:
355357
return "MAT_Mixture";
356358
case mix_elasthyper:

src/core/legacy_enum_definitions/4C_legacy_enum_definitions_materials.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ namespace Core::Materials
131131
m_particle_sph_boundary, ///< particle material for SPH boundary
132132
m_particle_dem, ///< particle material for DEM
133133
m_particle_wall_dem, ///< particle wall material for DEM
134+
m_particle_pd, ///< particle material for PD
134135
m_pldruckprag, ///< Plastic linear elastic St.Venant Kirchhoff / Drucker Prager plasticity
135136
m_plgtn, ///< Plastic linear elastic St.Venant Kirchhoff / GTN plasticity
136137
m_plelasthyper, ///< general hyperelastic material for finite strain von-Mises plasticity

src/global_legacy_module/4C_global_legacy_module_validmaterials.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3861,6 +3861,18 @@ std::unordered_map<Core::Materials::MaterialType, Core::IO::InputSpec> Global::v
38613861
{.description = "particle wall material for DEM"});
38623862
}
38633863

3864+
// particle material pd
3865+
{
3866+
known_materials[Core::Materials::m_particle_pd] = group("MAT_ParticlePD",
3867+
{
3868+
parameter<double>("INITRADIUS", {.description = "initial radius"}),
3869+
parameter<double>("INITDENSITY", {.description = "mass density"}),
3870+
parameter<double>("YOUNG", {.description = "Young's modulus"}),
3871+
parameter<double>("CRITICAL_STRETCH", {.description = "critical stretch"}),
3872+
},
3873+
{.description = "particle material for PD"});
3874+
}
3875+
38643876
/*----------------------------------------------------------------------*/
38653877
// General mixture models (used for prestretching and for homogenized constrained mixture models)
38663878
{

src/mat/4C_mat_material_factory.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@
109109
#include "4C_mat_newtonianfluid.hpp"
110110
#include "4C_mat_par_bundle.hpp"
111111
#include "4C_mat_particle_dem.hpp"
112+
#include "4C_mat_particle_pd.hpp"
112113
#include "4C_mat_particle_sph_boundary.hpp"
113114
#include "4C_mat_particle_sph_fluid.hpp"
114115
#include "4C_mat_particle_wall_dem.hpp"
@@ -996,6 +997,10 @@ std::unique_ptr<Core::Mat::PAR::Parameter> Mat::make_parameter(
996997
{
997998
return make_parameter_impl<Mat::PAR::ParticleWallMaterialDEM>(id, type, input_data);
998999
}
1000+
case Core::Materials::m_particle_pd:
1001+
{
1002+
return make_parameter_impl<Mat::PAR::ParticleMaterialPD>(id, type, input_data);
1003+
}
9991004
case Core::Materials::m_superelast:
10001005
{
10011006
return make_parameter_impl<Mat::PAR::SuperElasticSMA>(id, type, input_data);

src/mat/4C_mat_particle_pd.cpp

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
// This file is part of 4C multiphysics licensed under the
2+
// GNU Lesser General Public License v3.0 or later.
3+
//
4+
// See the LICENSE.md file in the top-level for license information.
5+
//
6+
// SPDX-License-Identifier: LGPL-3.0-or-later
7+
8+
#include "4C_mat_particle_pd.hpp"
9+
10+
#include "4C_comm_pack_helpers.hpp"
11+
#include "4C_global_data.hpp"
12+
#include "4C_mat_par_bundle.hpp"
13+
#include "4C_utils_enum.hpp"
14+
15+
FOUR_C_NAMESPACE_OPEN
16+
17+
/*---------------------------------------------------------------------------*
18+
| define static class member |
19+
*---------------------------------------------------------------------------*/
20+
Mat::ParticleMaterialPDType Mat::ParticleMaterialPDType::instance_;
21+
22+
/*---------------------------------------------------------------------------*
23+
| constructor |
24+
*---------------------------------------------------------------------------*/
25+
Mat::PAR::ParticleMaterialPD::ParticleMaterialPD(const Core::Mat::PAR::Parameter::Data& matdata)
26+
: Parameter(matdata),
27+
ParticleMaterialBase(matdata),
28+
young_(matdata.parameters.get<double>("YOUNG")),
29+
critical_stretch_(matdata.parameters.get<double>("CRITICAL_STRETCH"))
30+
{
31+
// empty constructor
32+
}
33+
34+
/*---------------------------------------------------------------------------*
35+
| create material instance of matching type with parameters |
36+
*---------------------------------------------------------------------------*/
37+
std::shared_ptr<Core::Mat::Material> Mat::PAR::ParticleMaterialPD::create_material()
38+
{
39+
return std::make_shared<Mat::ParticleMaterialPD>(this);
40+
}
41+
42+
/*---------------------------------------------------------------------------*
43+
*---------------------------------------------------------------------------*/
44+
Core::Communication::ParObject* Mat::ParticleMaterialPDType::create(
45+
Core::Communication::UnpackBuffer& buffer)
46+
{
47+
Mat::ParticleMaterialPD* particlematpd = new Mat::ParticleMaterialPD();
48+
particlematpd->unpack(buffer);
49+
return particlematpd;
50+
}
51+
52+
/*---------------------------------------------------------------------------*
53+
| constructor (empty material object) |
54+
*---------------------------------------------------------------------------*/
55+
Mat::ParticleMaterialPD::ParticleMaterialPD() : params_(nullptr)
56+
{
57+
// empty constructor
58+
}
59+
60+
/*---------------------------------------------------------------------------*
61+
| constructor (with given material parameters) |
62+
*---------------------------------------------------------------------------*/
63+
Mat::ParticleMaterialPD::ParticleMaterialPD(Mat::PAR::ParticleMaterialPD* params) : params_(params)
64+
{
65+
// empty constructor
66+
}
67+
68+
/*---------------------------------------------------------------------------*
69+
| pack |
70+
*---------------------------------------------------------------------------*/
71+
void Mat::ParticleMaterialPD::pack(Core::Communication::PackBuffer& data) const
72+
{
73+
// pack type of this instance of ParObject
74+
int type = unique_par_object_id();
75+
add_to_pack(data, type);
76+
77+
// matid
78+
int matid = -1;
79+
if (params_ != nullptr) matid = params_->id(); // in case we are in post-process mode
80+
add_to_pack(data, matid);
81+
}
82+
83+
/*---------------------------------------------------------------------------*
84+
| unpack |
85+
*---------------------------------------------------------------------------*/
86+
void Mat::ParticleMaterialPD::unpack(Core::Communication::UnpackBuffer& buffer)
87+
{
88+
Core::Communication::extract_and_assert_id(buffer, unique_par_object_id());
89+
90+
// matid and recover params_
91+
int matid;
92+
extract_from_pack(buffer, matid);
93+
params_ = nullptr;
94+
if (Global::Problem::instance()->materials() != nullptr)
95+
if (Global::Problem::instance()->materials()->num() != 0)
96+
{
97+
// note: dynamic_cast needed due diamond inheritance structure
98+
const int probinst = Global::Problem::instance()->materials()->get_read_from_problem();
99+
Core::Mat::PAR::Parameter* mat =
100+
Global::Problem::instance(probinst)->materials()->parameter_by_id(matid);
101+
if (mat->type() == material_type())
102+
params_ = dynamic_cast<Mat::PAR::ParticleMaterialPD*>(mat);
103+
else
104+
FOUR_C_THROW("Type of parameter material {} does not fit to calling type {}", mat->type(),
105+
material_type());
106+
}
107+
}
108+
109+
FOUR_C_NAMESPACE_CLOSE

src/mat/4C_mat_particle_pd.hpp

Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
// This file is part of 4C multiphysics licensed under the
2+
// GNU Lesser General Public License v3.0 or later.
3+
//
4+
// See the LICENSE.md file in the top-level for license information.
5+
//
6+
// SPDX-License-Identifier: LGPL-3.0-or-later
7+
8+
#ifndef FOUR_C_MAT_PARTICLE_PD_HPP
9+
#define FOUR_C_MAT_PARTICLE_PD_HPP
10+
11+
/*---------------------------------------------------------------------------*
12+
| headers |
13+
*---------------------------------------------------------------------------*/
14+
#include "4C_config.hpp"
15+
16+
#include "4C_comm_parobjectfactory.hpp"
17+
#include "4C_mat_material_factory.hpp"
18+
#include "4C_mat_particle_base.hpp"
19+
#include "4C_material_base.hpp"
20+
#include "4C_material_parameter_base.hpp"
21+
22+
FOUR_C_NAMESPACE_OPEN
23+
24+
/*---------------------------------------------------------------------------*
25+
| class definitions |
26+
*---------------------------------------------------------------------------*/
27+
namespace Mat
28+
{
29+
namespace PAR
30+
{
31+
class ParticleMaterialPD : public ParticleMaterialBase
32+
{
33+
public:
34+
//! constructor
35+
ParticleMaterialPD(const Core::Mat::PAR::Parameter::Data& matdata);
36+
37+
//! create material instance of matching type with parameters
38+
std::shared_ptr<Core::Mat::Material> create_material() override;
39+
40+
//! @name material parameters
41+
//@{
42+
43+
//! Young's modulus
44+
const double young_;
45+
46+
//! critical stretch
47+
const double critical_stretch_;
48+
49+
//@}
50+
};
51+
52+
} // namespace PAR
53+
54+
class ParticleMaterialPDType : public Core::Communication::ParObjectType
55+
{
56+
public:
57+
std::string name() const override { return "ParticleMaterialPDType"; };
58+
59+
static ParticleMaterialPDType& instance() { return instance_; };
60+
61+
Core::Communication::ParObject* create(Core::Communication::UnpackBuffer& buffer) override;
62+
63+
private:
64+
static ParticleMaterialPDType instance_;
65+
};
66+
67+
class ParticleMaterialPD : public Core::Mat::Material
68+
{
69+
public:
70+
//! constructor (empty material object)
71+
ParticleMaterialPD();
72+
73+
//! constructor (with given material parameters)
74+
explicit ParticleMaterialPD(Mat::PAR::ParticleMaterialPD* params);
75+
76+
//! @name Packing and Unpacking
77+
78+
//@{
79+
80+
/*!
81+
\brief Return unique ParObject id
82+
83+
every class implementing ParObject needs a unique id defined at the
84+
top of parobject.H (this file) and should return it in this method.
85+
*/
86+
int unique_par_object_id() const override
87+
{
88+
return ParticleMaterialPDType::instance().unique_par_object_id();
89+
}
90+
91+
/*!
92+
\brief Pack this class so it can be communicated
93+
94+
Resizes the vector data and stores all information of a class in it.
95+
The first information to be stored in data has to be the
96+
unique parobject id delivered by unique_par_object_id() which will then
97+
identify the exact class on the receiving processor.
98+
99+
\param data (in/out): char vector to store class information
100+
*/
101+
void pack(Core::Communication::PackBuffer& data) const override;
102+
103+
/*!
104+
\brief Unpack data from a char vector into this class
105+
106+
The vector data contains all information to rebuild the
107+
exact copy of an instance of a class on a different processor.
108+
The first entry in data has to be an integer which is the unique
109+
parobject id defined at the top of this file and delivered by
110+
unique_par_object_id().
111+
112+
\param data (in) : vector storing all data to be unpacked into this
113+
instance.
114+
*/
115+
void unpack(Core::Communication::UnpackBuffer& buffer) override;
116+
117+
//@}
118+
119+
//! @name Access methods
120+
121+
//@{
122+
123+
//! material type
124+
Core::Materials::MaterialType material_type() const override
125+
{
126+
return Core::Materials::m_particle_pd;
127+
}
128+
129+
//! return copy of this material object
130+
std::shared_ptr<Core::Mat::Material> clone() const override
131+
{
132+
return std::make_shared<ParticleMaterialPD>(*this);
133+
}
134+
135+
//! return quick accessible material parameter data
136+
Core::Mat::PAR::Parameter* parameter() const override { return params_; }
137+
138+
//! return tangential contact friction coefficient
139+
double youngs_modulus() const { return params_->young_; }
140+
141+
//! return rolling contact friction coefficient
142+
double critical_stretch() const { return params_->critical_stretch_; }
143+
144+
//@}
145+
146+
private:
147+
//! my material parameters
148+
Mat::PAR::ParticleMaterialPD* params_;
149+
};
150+
151+
} // namespace Mat
152+
153+
/*---------------------------------------------------------------------------*/
154+
FOUR_C_NAMESPACE_CLOSE
155+
156+
#endif

src/particle/src/4C_particle_input.cpp

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,9 @@ std::vector<Core::IO::InputSpec> Particle::valid_parameters()
121121

122122
parameter<double>("RIGID_BODY_PHASECHANGE_RADIUS",
123123
{.description = "search radius for neighboring rigid bodies in case of phase change",
124-
.default_value = -1.0})},
124+
.default_value = -1.0}),
125+
parameter<bool>("PD_BODY_INTERACTION",
126+
{.description = "consider peridynamic body interaction", .default_value = false})},
125127
{.required = false}));
126128
/*-------------------------------------------------------------------------*
127129
| control parameters for initial/boundary conditions |
@@ -375,10 +377,9 @@ std::vector<Core::IO::InputSpec> Particle::valid_parameters()
375377
"DIRICHLETBOUNDARYTYPE", {.description = "type of dirichlet open boundary",
376378
.default_value = Particle::NoDirichletOpenBoundary}),
377379

378-
parameter<int>("DIRICHLET_FUNCT",
379-
{.description =
380-
"number of function governing velocity condition on dirichlet open boundary",
381-
.default_value = -1}),
380+
parameter<int>("DIRICHLET_FUNCT", {.description = "number of function governing velocity "
381+
"condition on dirichlet open boundary",
382+
.default_value = -1}),
382383

383384
parameter<std::string>("DIRICHLET_OUTWARD_NORMAL",
384385
{.description = "direction of outward normal on dirichlet open boundary",
@@ -550,6 +551,34 @@ std::vector<Core::IO::InputSpec> Particle::valid_parameters()
550551
{.description = "factor to calculate minimum adhesion surface energy",
551552
.default_value = 1.0})},
552553
{.required = false}));
554+
555+
/*-------------------------------------------------------------------------*
556+
| peridynamics (PD) specific control parameters |
557+
*-------------------------------------------------------------------------*/
558+
specs.push_back(group("PARTICLE DYNAMIC/PD",
559+
{
560+
561+
// compact support in peridynamics
562+
parameter<double>(
563+
"INTERACTION_HORIZON", {.description = "peridynamic horizon", .default_value = 0.0}),
564+
565+
// the spatial grid spacing of the peridynamic grid
566+
parameter<double>("PERIDYNAMIC_GRID_SPACING",
567+
{.description = "peridynamic grid spacing", .default_value = 0.0}),
568+
569+
// type of normal contact law
570+
deprecated_selection<NormalContact>("NORMALCONTACTLAW",
571+
{
572+
{"NormalLinearSpring", Particle::NormalLinSpring},
573+
},
574+
{.description = "normal contact law for particles",
575+
.default_value = Particle::NormalLinSpring}),
576+
577+
// type of tangential contact law
578+
parameter<TangentialContact>(
579+
"TANGENTIALCONTACTLAW", {.description = "tangential contact law for particles",
580+
.default_value = Particle::NoTangentialContact})},
581+
{.required = false}));
553582
return specs;
554583
}
555584

src/particle/src/algorithm/4C_particle_algorithm.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,12 @@ void Particle::ParticleAlgorithm::setup()
133133
// build global id to local index map
134134
particleengine_->build_global_id_to_local_index_map();
135135

136-
// build potential neighbor relation
137-
if (particleinteraction_) build_potential_neighbor_relation();
136+
// build potential neighbor relation & build the peridynamic bond list
137+
if (particleinteraction_)
138+
{
139+
build_potential_neighbor_relation();
140+
if (not isrestarted_) particleinteraction_->build_peridynamic_relation();
141+
}
138142

139143
// setup initial states
140144
if (not isrestarted_) setup_initial_states();

0 commit comments

Comments
 (0)