PeriDEM 0.2.0
PeriDEM -- Peridynamics-based high-fidelity model for granular media
Loading...
Searching...
No Matches
material::PdElastic Class Reference

A class providing methods to compute energy density and force of peridynamic material. More...

#include <material.h>

Inheritance diagram for material::PdElastic:
Collaboration diagram for material::PdElastic:

Public Member Functions

 PdElastic (inp::MaterialDeck &deck, const size_t &dim, const double &horizon)
 Constructor.
 
bool isStateActive () const override
 Returns true if state-based potential is active.
 
std::pair< double, double > getBondEF (const double &r, const double &s, bool &fs, const bool &break_bonds) const override
 Returns energy and force between bond due to pairwise interaction.
 
std::pair< double, double > getBondEF (const double &r, const double &s, bool &fs, const double &mx, const double &thetax) const override
 Returns energy and force between bond due to state-based model.
 
util::Point getBondForceDirection (const util::Point &dx, const util::Point &du) const override
 Returns the unit vector along which bond-force acts.
 
double getS (const util::Point &dx, const util::Point &du) const override
 Returns the bond strain.
 
double getSc (const double &r) const override
 Returns critical bond strain.
 
double getDensity () const override
 Returns the density of the material.
 
double getInfFn (const double &r) const override
 Returns the value of influence function.
 
double getMoment (const size_t &i) const override
 Returns the moment of influence function.
 
double getHorizon () const override
 Returns horizon.
 
inp::MatData computeMaterialProperties (const size_t &dim) const override
 Computes elastic and fracture material properties and returns the data.
 
std::string printStr (int nt, int lvl) const override
 Returns the string containing printable information about the object.
 
void print (int nt, int lvl) const override
 Prints the information about the object.
 
void print () const override
 Prints the information about the object.
 
- Public Member Functions inherited from material::Material
 Material (std::string name="")
 Constructor.
 
virtual ~Material ()
 Destructor.
 
std::string name ()
 Returns name of the material.
 
size_t getDimension ()
 Returns dimension of the problem.
 
bool isPlaneStrain ()
 Returns plane-strain condition.
 

Private Member Functions

void computeParameters (inp::MaterialDeck &deck, const size_t &dim)
 Compute material model parameters.
 

Private Attributes

double d_horizon
 Horizon.
 
double d_density
 Density.
 
Material parameters
double d_c
 Parameter C.
 

Detailed Description

A class providing methods to compute energy density and force of peridynamic material.

Definition at line 1025 of file material.h.

Constructor & Destructor Documentation

◆ PdElastic()

material::PdElastic::PdElastic ( inp::MaterialDeck deck,
const size_t &  dim,
const double &  horizon 
)
inline

Constructor.

Parameters
deckInput deck which contains user-specified information
dimDimension
horizonHorizon

Definition at line 1034 of file material.h.

1035 : Material("PDElasticBond"), d_horizon(horizon),
1036 d_density(deck.d_density), d_c(0.) {
1037
1038 // set global fields
1039 if (dimension != dim)
1040 dimension = dim;
1041
1042 if (is_plane_strain != deck.d_isPlaneStrain)
1044
1045 // create influence function
1046 if (deck.d_influenceFnType == 0) {
1047 if (influence_fn == nullptr)
1048 influence_fn = std::make_shared<material::ConstInfluenceFn>(
1049 deck.d_influenceFnParams, dim);
1050 }
1051 else if (deck.d_influenceFnType == 1) {
1052 if (influence_fn == nullptr)
1053 influence_fn = std::make_shared<material::LinearInfluenceFn>(
1054 deck.d_influenceFnParams, dim);
1055 }
1056 else if (deck.d_influenceFnType == 2) {
1057 if (influence_fn == nullptr)
1058 influence_fn = std::make_shared<material::GaussianInfluenceFn>(
1059 deck.d_influenceFnParams, dim);
1060 }
1061 else {
1062 std::cerr << "Error: Influence function type = "
1063 << deck.d_influenceFnType
1064 << " is invalid.\n";
1065 exit(1);
1066 }
1067
1068 // check if we need to compute the material parameters
1070 computeParameters(deck, dim);
1071 else
1072 d_c = deck.d_bondPotentialParams[0];
1073 };
Material(std::string name="")
Constructor.
Definition material.h:83
double d_density
Density.
Definition material.h:1313
double d_horizon
Horizon.
Definition material.h:1310
double d_c
Parameter C.
Definition material.h:1321
void computeParameters(inp::MaterialDeck &deck, const size_t &dim)
Compute material model parameters.
Definition material.h:1257
bool is_plane_strain
Is plane-stress condition active.
Definition material.h:29
size_t dimension
Dimension of the domain.
Definition material.h:26
std::shared_ptr< material::BaseInfluenceFn > influence_fn
Store pointer to influence function globally.
Definition material.h:32
bool d_isPlaneStrain
Indicates if the 2-d simulation is of plane-strain type (thick material) or plane-stress type (thin m...
double d_density
Density of material.
size_t d_influenceFnType
Type of influence function.
std::vector< double > d_bondPotentialParams
List of parameters for pairwise potential.
bool d_computeParamsFromElastic
Compute Peridynamic material properties from elastic properties.
std::vector< double > d_influenceFnParams
List of parameters for influence function.

References computeParameters(), inp::MaterialDeck::d_bondPotentialParams, d_c, inp::MaterialDeck::d_computeParamsFromElastic, inp::MaterialDeck::d_influenceFnParams, inp::MaterialDeck::d_influenceFnType, and inp::MaterialDeck::d_isPlaneStrain.

Here is the call graph for this function:

Member Function Documentation

◆ computeMaterialProperties()

inp::MatData material::PdElastic::computeMaterialProperties ( const size_t &  dim) const
inlineoverridevirtual

Computes elastic and fracture material properties and returns the data.

Parameters
dimDimension of the problem
Returns
Data Material data

Implements material::Material.

Definition at line 1189 of file material.h.

1189 {
1190
1191 auto data = inp::MatData();
1192
1193 // set Poisson's ratio to 1/4
1194 data.d_nu = 0.25;
1195
1196 // compute peridynamic parameters
1197 if (dim == 2) {
1198 data.d_lambda = d_c * (M_PI * std::pow(d_horizon, 3.0)) / 24.0;
1199 data.d_E = data.toELambda(data.d_lambda, data.d_nu);
1200 } else if (dim == 3) {
1201 data.d_lambda = d_c * (M_PI * std::pow(d_horizon, 3.0)) / 24.0;
1202 data.d_E = data.toELambda(data.d_lambda, data.d_nu);
1203 }
1204 data.d_mu = data.d_lambda;
1205 data.d_G = data.d_lambda;
1206 data.d_K =
1207 data.toK(data.d_E, data.d_nu);
1208
1209 return data;
1210 };
Structure for elastic properties and fracture properties.

References d_c, and d_horizon.

◆ computeParameters()

void material::PdElastic::computeParameters ( inp::MaterialDeck deck,
const size_t &  dim 
)
inlineprivate

Compute material model parameters.

Parameters
deckMaterialDeck
dimDimension of the domain

Definition at line 1257 of file material.h.

1257 {
1258 //
1259 // Need following elastic and fracture properties
1260 // 1. E or K
1261 // For bond-based, Poisson's ratio is fixed to 1/4
1262 //
1263 if (util::isLess(deck.d_matData.d_E, 0.) &&
1264 util::isLess(deck.d_matData.d_K, 0.)) {
1265 std::cerr << "Error: Require either Young's modulus E or Bulk modulus K"
1266 " to compute the RNP bond-based peridynamic parameters.\n";
1267 exit(1);
1268 }
1269 if (util::isGreater(deck.d_matData.d_E, 0.) &&
1270 util::isGreater(deck.d_matData.d_K, 0.)) {
1271 std::cout << "Warning: Both Young's modulus E and Bulk modulus K are "
1272 "provided.\n";
1273 std::cout << "Warning: To compute the RNP bond-based peridynamic "
1274 "parameters, we only require one of those.\n";
1275 std::cout
1276 << "Warning: Selecting Young's modulus to compute parameters.\n";
1277 }
1278
1279 // set Poisson's ratio to 1/4
1280 deck.d_matData.d_nu = 0.25;
1281
1282 // compute E if not provided or K if not provided
1283 if (deck.d_matData.d_E > 0.)
1284 deck.d_matData.d_K =
1285 deck.d_matData.toK(deck.d_matData.d_E, deck.d_matData.d_nu);
1286
1287 if (deck.d_matData.d_K > 0. && deck.d_matData.d_E < 0.)
1288 deck.d_matData.d_E =
1289 deck.d_matData.toE(deck.d_matData.d_K, deck.d_matData.d_nu);
1290
1291 // compute lame parameter
1292 deck.d_matData.d_lambda =
1293 deck.d_matData.toLambdaE(deck.d_matData.d_E, deck.d_matData.d_nu);
1294 deck.d_matData.d_G =
1295 deck.d_matData.toGE(deck.d_matData.d_E, deck.d_matData.d_nu);
1296 deck.d_matData.d_mu = deck.d_matData.d_G;
1297
1298 // compute peridynamic parameters
1299 if (dim == 2) {
1300 d_c = 24.0 * deck.d_matData.d_lambda / (M_PI * std::pow(d_horizon, 3.0));
1301 } else if (dim == 3) {
1302 // TODO
1303 // For PdElastic and PmbMaterial, implement correct formula in 3-d
1304 d_c = 24.0 * deck.d_matData.d_lambda / (M_PI * std::pow(d_horizon, 3.0));
1305 }
1306 };
bool isGreater(const double &a, const double &b)
Returns true if a > b.
Definition function.cpp:15
bool isLess(const double &a, const double &b)
Returns true if a < b.
Definition function.cpp:20
double toLambdaE(double E, double nu)
Compute Lame first parameter lambda from Young's modulus E and Poisson's ratio nu.
double d_mu
Lame second parameter.
double toK(double E, double nu)
Compute Bulk modulus K from Young's modulus K and Poisson's ratio nu.
double d_K
Bulk modulus.
double d_lambda
Lame first parameter.
double toGE(double E, double nu)
Compute shear modulus from Young's modulus E and Poisson's ratio nu.
double d_nu
Poisson's ratio.
double d_G
Shear modulus or Lame second parameter.
double d_E
Young's elastic modulus.
double toE(double K, double nu)
Compute Young's modulus E from Bulk modulus K and Poisson's ratio nu.
inp::MatData d_matData
List of elastic and fracture properties.

References d_c, inp::MatData::d_E, inp::MatData::d_G, d_horizon, inp::MatData::d_K, inp::MatData::d_lambda, inp::MaterialDeck::d_matData, inp::MatData::d_mu, inp::MatData::d_nu, util::isGreater(), util::isLess(), inp::MatData::toE(), inp::MatData::toGE(), inp::MatData::toK(), and inp::MatData::toLambdaE().

Referenced by PdElastic().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getBondEF() [1/2]

std::pair< double, double > material::PdElastic::getBondEF ( const double &  r,
const double &  s,
bool &  fs,
const bool &  break_bonds 
) const
inlineoverridevirtual

Returns energy and force between bond due to pairwise interaction.

Parameters
rReference (initial) bond length
sBond strain
fsBond fracture state
break_bondsFlag to specify whether bonds are allowed to break or not
Returns
value Pair of energy and force

Implements material::Material.

Definition at line 1090 of file material.h.

1092 {
1093
1094 return std::make_pair(getInfFn(r) * 0.5 * d_c * s *
1095 s * r,
1096 getInfFn(r) * d_c * s);
1097 };
double getInfFn(const double &r) const override
Returns the value of influence function.
Definition material.h:1158

References d_c, and getInfFn().

Referenced by getBondEF().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getBondEF() [2/2]

std::pair< double, double > material::PdElastic::getBondEF ( const double &  r,
const double &  s,
bool &  fs,
const double &  mx,
const double &  thetax 
) const
inlineoverridevirtual

Returns energy and force between bond due to state-based model.

Parameters
rReference (initial) bond length
sBond strain
fsBond fracture state
mxWeighted volume at node
thetaxDilation
Returns
value Pair of energy and force

Implements material::Material.

Definition at line 1110 of file material.h.

1111 {
1112
1113 return this->getBondEF(r, s, fs, true);
1114 };
std::pair< double, double > getBondEF(const double &r, const double &s, bool &fs, const bool &break_bonds) const override
Returns energy and force between bond due to pairwise interaction.
Definition material.h:1090

References getBondEF().

Here is the call graph for this function:

◆ getBondForceDirection()

util::Point material::PdElastic::getBondForceDirection ( const util::Point dx,
const util::Point du 
) const
inlineoverridevirtual

Returns the unit vector along which bond-force acts.

Parameters
dxReference bond vector
duDifference of displacement
Returns
vector Unit vector

Implements material::Material.

Definition at line 1123 of file material.h.

1124 {
1125 return (dx + du) / (dx + du).length();
1126 };

◆ getDensity()

double material::PdElastic::getDensity ( ) const
inlineoverridevirtual

Returns the density of the material.

Returns
density Density of the material

Implements material::Material.

Definition at line 1150 of file material.h.

1150{ return d_density; };

References d_density.

◆ getHorizon()

double material::PdElastic::getHorizon ( ) const
inlineoverridevirtual

Returns horizon.

Returns
horizon Horizon

Implements material::Material.

Definition at line 1180 of file material.h.

1180{ return d_horizon; };

References d_horizon.

◆ getInfFn()

double material::PdElastic::getInfFn ( const double &  r) const
inlineoverridevirtual

Returns the value of influence function.

Parameters
rReference (initial) bond length
Returns
value Influence function at r

Implements material::Material.

Definition at line 1158 of file material.h.

1158 {
1159 return getGlobalInfFn(r / d_horizon);
1160 };
double getGlobalInfFn(const double &r)
Returns the value of influence function.
Definition material.h:40

References d_horizon.

Referenced by getBondEF().

Here is the caller graph for this function:

◆ getMoment()

double material::PdElastic::getMoment ( const size_t &  i) const
inlineoverridevirtual

Returns the moment of influence function.

If \( J(r) \) is the influence function for \( r\in [0,1)\) then \( i^{th}\) moment is given by

\[ M_i = \int_0^1 J(r) r^i dr. \]

Parameters
iith moment
Returns
value Moment

Implements material::Material.

Definition at line 1171 of file material.h.

1171 {
1172 return getGlobalMoment(i);
1173 };
double getGlobalMoment(const size_t &i)
Returns the moment of influence function.
Definition material.h:53

◆ getS()

double material::PdElastic::getS ( const util::Point dx,
const util::Point du 
) const
inlineoverridevirtual

Returns the bond strain.

Parameters
dxReference bond vector
duDifference of displacement
Returns
strain Bond strain \( S = \frac{du \cdot dx}{|dx|^2} \)

Implements material::Material.

Definition at line 1134 of file material.h.

1134 {
1135 return ((dx + du).length() - dx.length()) / dx.length();
1136 };
double length() const
Computes the Euclidean length of the vector.
Definition point.h:118

References util::Point::length().

Here is the call graph for this function:

◆ getSc()

double material::PdElastic::getSc ( const double &  r) const
inlineoverridevirtual

Returns critical bond strain.

Parameters
rReference length of bond
Returns
strain Critical strain

Implements material::Material.

Definition at line 1144 of file material.h.

1144{ return std::numeric_limits<double>::max(); };

◆ isStateActive()

bool material::PdElastic::isStateActive ( ) const
inlineoverridevirtual

Returns true if state-based potential is active.

Returns
bool True/false

Implements material::Material.

Definition at line 1079 of file material.h.

1079{ return false; };

◆ print() [1/2]

void material::PdElastic::print ( ) const
inlineoverridevirtual

Prints the information about the object.

Reimplemented from material::Material.

Definition at line 1248 of file material.h.

1248{ print(0, 0); };
void print() const override
Prints the information about the object.
Definition material.h:1248

References print().

Referenced by print().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ print() [2/2]

void material::PdElastic::print ( int  nt,
int  lvl 
) const
inlineoverridevirtual

Prints the information about the object.

Parameters
ntNumber of tabs to append before printing
lvlInformation level (higher means more information)

Reimplemented from material::Material.

Definition at line 1243 of file material.h.

1243 {
1244 std::cout << printStr(nt, lvl);
1245 };
std::string printStr(int nt, int lvl) const override
Returns the string containing printable information about the object.
Definition material.h:1219

References printStr().

Here is the call graph for this function:

◆ printStr()

std::string material::PdElastic::printStr ( int  nt,
int  lvl 
) const
inlineoverridevirtual

Returns the string containing printable information about the object.

Parameters
ntNumber of tabs to append before printing
lvlInformation level (higher means more information)
Returns
string String containing printable information about the object

Reimplemented from material::Material.

Definition at line 1219 of file material.h.

1219 {
1220
1221 auto tabS = util::io::getTabS(nt);
1222 std::ostringstream oss;
1223 oss << tabS << "------- particle::PdElastic --------" << std::endl
1224 << std::endl;
1225 oss << tabS << "State active = " << 0 << std::endl;
1226 oss << tabS << "Horizon = " << d_horizon << std::endl;
1227 oss << tabS << "Influence fn address = " << influence_fn.get() << std::endl;
1228 oss << tabS << "Influence fn info: " << std::endl;
1229 oss << influence_fn->printStr(nt + 1, lvl);
1230 oss << tabS << "Peridynamic parameters: " << std::endl;
1231 oss << tabS << " c = " << d_c << std::endl;
1232 oss << tabS << std::endl;
1233
1234 return oss.str();
1235 };
std::string getTabS(int nt)
Returns tab spaces of given size.
Definition io.h:40

References d_c, d_horizon, and util::io::getTabS().

Referenced by print().

Here is the call graph for this function:
Here is the caller graph for this function:

Field Documentation

◆ d_c

double material::PdElastic::d_c
private

Parameter C.

Definition at line 1321 of file material.h.

Referenced by computeMaterialProperties(), computeParameters(), getBondEF(), PdElastic(), and printStr().

◆ d_density

double material::PdElastic::d_density
private

Density.

Definition at line 1313 of file material.h.

Referenced by getDensity().

◆ d_horizon

double material::PdElastic::d_horizon
private

Horizon.

Definition at line 1310 of file material.h.

Referenced by computeMaterialProperties(), computeParameters(), getHorizon(), getInfFn(), and printStr().


The documentation for this class was generated from the following file: