11#ifndef MATERIAL_PARTILCE_MATERIAL_H
12#define MATERIAL_PARTILCE_MATERIAL_H
125 virtual std::pair<double, double>
127 const bool &break_bonds)
const = 0;
139 virtual std::pair<double, double>
140 getBondEF(
const double &r,
const double &s,
bool &fs,
const double
141 &mx,
const double &thetax)
const = 0;
167 virtual double getSc(
const double &r)
const = 0;
181 virtual double getInfFn(
const double &r)
const = 0;
217 virtual std::string
printStr(
int nt,
int lvl)
const {
220 std::ostringstream oss;
221 oss << tabS <<
"------- particle::Material --------" << std::endl
223 oss << tabS <<
"Abstract class of peridynamic materials" << std::endl;
224 oss << tabS <<
"See RnpMaterial and PmbMaterial for implementation"
226 oss << tabS << std::endl;
237 virtual void print(
int nt,
int lvl)
const { std::cout <<
printStr(nt, lvl); }
267 if (dimension != dim)
275 if (influence_fn ==
nullptr)
276 influence_fn = std::make_shared<material::ConstInfluenceFn>(
280 if (influence_fn ==
nullptr)
281 influence_fn = std::make_shared<material::LinearInfluenceFn>(
285 if (influence_fn ==
nullptr)
286 influence_fn = std::make_shared<material::GaussianInfluenceFn>(
290 std::cerr <<
"Error: Influence function type = "
301 d_invFactor = std::pow(horizon, 4) * 4. * M_PI / 3.;
342 std::pair<double, double>
getBondEF(
const double &r,
const double &s,
344 const bool &break_bonds)
const override {
355 return std::make_pair(
380 std::pair<double, double>
381 getBondEF(
const double &r,
const double &s,
bool &fs,
const double
382 &mx,
const double &thetax)
const override {
406 return dx.
dot(du) / dx.
dot(dx);
415 double getSc(
const double &r)
const override {
416 return d_rbar / std::sqrt(r);
445 return getGlobalMoment(i);
473 data.d_Gc = 4. * M *
d_C / M_PI;
475 }
else if (dim == 3) {
476 data.d_Gc = 3. * M *
d_C / 2.;
479 data.d_mu = data.d_lambda;
480 data.d_G = data.d_lambda;
481 data.d_E = data.toELambda(data.d_lambda,
484 data.toK(data.d_E, data.d_nu);
485 data.d_KIc = data.toKIc(
486 data.d_Gc, data.d_nu, data.d_E);
498 std::string
printStr(
int nt,
int lvl)
const override {
501 std::ostringstream oss;
502 oss << tabS <<
"------- particle::RnpMaterial --------" << std::endl
504 oss << tabS <<
"State active = " << 0 << std::endl;
505 oss << tabS <<
"Horizon = " <<
d_horizon << std::endl;
506 oss << tabS <<
"Influence fn address = " << influence_fn.get() << std::endl;
507 oss << tabS <<
"Influence fn info: " << std::endl;
508 oss << influence_fn->printStr(nt + 1, lvl);
509 oss << tabS <<
"Peridynamic parameters: " << std::endl;
510 oss << tabS <<
" C = " <<
d_C << std::endl;
511 oss << tabS <<
" beta = " <<
d_beta << std::endl;
512 oss << tabS <<
" r_bar = " <<
d_rbar << std::endl;
513 oss << tabS <<
" inv_factor = " <<
d_invFactor << std::endl;
514 oss << tabS <<
" factor_Sc = " <<
d_factorSc << std::endl;
516 oss << tabS << std::endl;
527 void print(
int nt,
int lvl)
const override {
550 std::cerr <<
"Error: Require either Young's modulus E or Bulk modulus K"
551 " to compute the RNP bond-based peridynamic parameters.\n";
556 std::cout <<
"Warning: Both Young's modulus E and Bulk modulus K are "
558 std::cout <<
"Warning: To compute the RNP bond-based peridynamic "
559 "parameters, we only require one of those.\n";
561 <<
"Warning: Selecting Young's modulus to compute parameters.\n";
566 std::cerr <<
"Error: Require either critical energy release rate Gc or "
567 "critical stress intensity factor KIc to compute the RNP "
568 "bond-based peridynamic parameters.\n";
572 std::cout <<
"Warning: Both critical energy release rate Gc and critical "
573 "stress intensity factor KIc are provided.\n";
574 std::cout <<
"Warning: To compute the RNP bond-based peridynamic "
575 "parameters, we only require one of those.\n";
576 std::cout <<
"Warning: Selecting critical energy release rate Gc to "
577 "compute parameters.\n";
614 }
else if (dim == 3) {
679 if (dimension != dim)
687 if (influence_fn ==
nullptr)
688 influence_fn = std::make_shared<material::ConstInfluenceFn>(
692 if (influence_fn ==
nullptr)
693 influence_fn = std::make_shared<material::LinearInfluenceFn>(
697 if (influence_fn ==
nullptr)
698 influence_fn = std::make_shared<material::GaussianInfluenceFn>(
702 std::cerr <<
"Error: Influence function type = "
732 std::pair<double, double>
getBondEF(
const double &r,
const double &s,
734 const bool &break_bonds)
const override {
737 return std::make_pair(
getInfFn(r) * 0.5 *
d_c * s *
748 return std::make_pair(
getInfFn(r) * 0.5 *
d_c * s *
752 return std::make_pair(
766 std::pair<double, double>
767 getBondEF(
const double &r,
const double &s,
bool &fs,
const double
768 &mx,
const double &thetax)
const override {
782 return (dx + du) / (dx + du).length();
792 return ((dx + du).length() - dx.
length()) / dx.
length();
801 double getSc(
const double &r)
const override {
return d_s0; };
829 return getGlobalMoment(i);
855 data.d_lambda =
d_c * (M_PI * std::pow(
d_horizon, 3.0)) / 24.0;
856 data.d_E = data.toELambda(data.d_lambda, data.d_nu);
858 }
else if (dim == 3) {
859 data.d_lambda =
d_c * (M_PI * std::pow(
d_horizon, 3.0)) / 24.0;
860 data.d_E = data.toELambda(data.d_lambda, data.d_nu);
863 data.d_mu = data.d_lambda;
864 data.d_G = data.d_lambda;
866 data.toK(data.d_E, data.d_nu);
867 data.d_KIc = data.toKIc(
868 data.d_Gc, data.d_nu, data.d_E);
880 std::string
printStr(
int nt,
int lvl)
const override {
883 std::ostringstream oss;
884 oss << tabS <<
"------- particle::PmbMaterial --------" << std::endl
886 oss << tabS <<
"State active = " << 0 << std::endl;
887 oss << tabS <<
"Horizon = " <<
d_horizon << std::endl;
888 oss << tabS <<
"Influence fn address = " << influence_fn.get() << std::endl;
889 oss << tabS <<
"Influence fn info: " << std::endl;
890 oss << influence_fn->printStr(nt + 1, lvl);
891 oss << tabS <<
"Peridynamic parameters: " << std::endl;
892 oss << tabS <<
" c = " <<
d_c << std::endl;
893 oss << tabS <<
" s0 = " <<
d_s0 << std::endl;
894 oss << tabS << std::endl;
905 void print(
int nt,
int lvl)
const override {
928 std::cerr <<
"Error: Require either Young's modulus E or Bulk modulus K"
929 " to compute the RNP bond-based peridynamic parameters.\n";
934 std::cout <<
"Warning: Both Young's modulus E and Bulk modulus K are "
936 std::cout <<
"Warning: To compute the RNP bond-based peridynamic "
937 "parameters, we only require one of those.\n";
939 <<
"Warning: Selecting Young's modulus to compute parameters.\n";
944 std::cerr <<
"Error: Require either critical energy release rate Gc or "
945 "critical stress intensity factor KIc to compute the RNP "
946 "bond-based peridynamic parameters.\n";
950 std::cout <<
"Warning: Both critical energy release rate Gc and critical "
951 "stress intensity factor KIc are provided.\n";
952 std::cout <<
"Warning: To compute the RNP bond-based peridynamic "
953 "parameters, we only require one of those.\n";
954 std::cout <<
"Warning: Selecting critical energy release rate Gc to "
955 "compute parameters.\n";
993 }
else if (dim == 3) {
1039 if (dimension != dim)
1047 if (influence_fn ==
nullptr)
1048 influence_fn = std::make_shared<material::ConstInfluenceFn>(
1052 if (influence_fn ==
nullptr)
1053 influence_fn = std::make_shared<material::LinearInfluenceFn>(
1057 if (influence_fn ==
nullptr)
1058 influence_fn = std::make_shared<material::GaussianInfluenceFn>(
1062 std::cerr <<
"Error: Influence function type = "
1064 <<
" is invalid.\n";
1090 std::pair<double, double>
getBondEF(
const double &r,
const double &s,
1092 const bool &break_bonds)
const override {
1094 return std::make_pair(
getInfFn(r) * 0.5 *
d_c * s *
1109 std::pair<double, double>
1110 getBondEF(
const double &r,
const double &s,
bool &fs,
const double
1111 &mx,
const double &thetax)
const override {
1125 return (dx + du) / (dx + du).length();
1135 return ((dx + du).length() - dx.
length()) / dx.
length();
1144 double getSc(
const double &r)
const override {
return std::numeric_limits<double>::max(); };
1172 return getGlobalMoment(i);
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);
1204 data.d_mu = data.d_lambda;
1205 data.d_G = data.d_lambda;
1207 data.toK(data.d_E, data.d_nu);
1222 std::ostringstream oss;
1223 oss << tabS <<
"------- particle::PdElastic --------" << 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;
1243 void print(
int nt,
int lvl)
const override {
1265 std::cerr <<
"Error: Require either Young's modulus E or Bulk modulus K"
1266 " to compute the RNP bond-based peridynamic parameters.\n";
1271 std::cout <<
"Warning: Both Young's modulus E and Bulk modulus K are "
1273 std::cout <<
"Warning: To compute the RNP bond-based peridynamic "
1274 "parameters, we only require one of those.\n";
1276 <<
"Warning: Selecting Young's modulus to compute parameters.\n";
1301 }
else if (dim == 3) {
1344 if (dimension != dim)
1352 if (influence_fn ==
nullptr)
1353 influence_fn = std::make_shared<material::ConstInfluenceFn>(
1357 if (influence_fn ==
nullptr)
1358 influence_fn = std::make_shared<material::LinearInfluenceFn>(
1362 if (influence_fn ==
nullptr)
1363 influence_fn = std::make_shared<material::GaussianInfluenceFn>(
1367 std::cerr <<
"Error: Influence function type = "
1369 <<
" is invalid.\n";
1398 std::pair<double, double>
getBondEF(
const double &r,
const double &s,
1400 const bool &break_bonds)
const override {
1415 std::pair<double, double>
1416 getBondEF(
const double &r,
const double &s,
bool &fs,
const double
1417 &mx,
const double &thetax)
const override {
1423 double change_length = s * r;
1425 double alpha = 15. *
d_G / mx;
1426 double factor = (3. *
d_K / mx) - alpha / 3.;
1428 return {0., J * (r * thetax * factor + change_length * alpha)};
1440 return (dx + du) / (dx + du).length();
1450 return ((dx + du).length() - dx.
length()) / dx.
length();
1459 double getSc(
const double &r)
const override {
return d_s0; };
1487 return getGlobalMoment(i);
1513 data.d_nu = (3. *
d_K - 2. *
d_G) / (2. * (3. *
d_K +
d_G));
1514 data.d_E = data.toE(
d_K, data.d_nu);
1517 data.d_lambda = data.toLambdaE(data.d_E, data.d_nu);
1526 data.d_KIc = data.toKIc(
1527 data.d_Gc, data.d_nu, data.d_E);
1542 std::ostringstream oss;
1543 oss << tabS <<
"------- particle::PdState --------" << std::endl
1545 oss << tabS <<
"State active = " << 1 << std::endl;
1546 oss << tabS <<
"Horizon = " <<
d_horizon << std::endl;
1547 oss << tabS <<
"Influence fn address = " << influence_fn.get() << std::endl;
1548 oss << tabS <<
"Influence fn info: " << std::endl;
1549 oss << influence_fn->printStr(nt + 1, lvl);
1550 oss << tabS <<
"Peridynamic parameters: " << std::endl;
1551 oss << tabS <<
" K = " <<
d_K << std::endl;
1552 oss << tabS <<
" G = " <<
d_G << std::endl;
1553 oss << tabS <<
" s0 = " <<
d_s0 << std::endl;
1554 oss << tabS << std::endl;
1565 void print(
int nt,
int lvl)
const override {
1586 bool found_E =
false;
1587 bool found_K =
false;
1588 bool found_G =
false;
1589 bool found_nu =
false;
1590 size_t num_props = 0;
1608 if (num_props != 2) {
1609 std::ostringstream oss;
1610 oss <<
"Error: Require two different elastic properties for the "
1611 "PdState material. Pairs supported are (E, K), (E, G), "
1612 "(E, nu), (K, G).\n";
1613 oss << deck.
printStr(0, 0) <<
"\n";
1614 std::cout << oss.str();
1620 std::cerr <<
"Error: Require either critical energy release rate Gc or "
1621 "critical stress intensity factor KIc to compute the RNP "
1622 "bond-based peridynamic parameters.\n";
1626 std::cout <<
"Warning: Both critical energy release rate Gc and critical "
1627 "stress intensity factor KIc are provided.\n";
1628 std::cout <<
"Warning: To compute the RNP bond-based peridynamic "
1629 "parameters, we only require one of those.\n";
1630 std::cout <<
"Warning: Selecting critical energy release rate Gc to "
1631 "compute parameters.\n";
1636 if (found_E and found_G)
1640 if (found_E and found_K)
1645 if (found_G and found_K)
Collection of methods and database related to peridynamic material.
virtual void print(int nt, int lvl) const
Prints the information about the object.
virtual double getHorizon() const =0
Returns horizon.
Material(std::string name="")
Constructor.
virtual std::pair< double, double > getBondEF(const double &r, const double &s, bool &fs, const double &mx, const double &thetax) const =0
Returns energy and force between bond due to state-based model.
virtual void print() const
Prints the information about the object.
virtual double getMoment(const size_t &i) const =0
Returns the moment of influence function.
virtual ~Material()
Destructor.
virtual double getDensity() const =0
Returns the density of the material.
size_t getDimension()
Returns dimension of the problem.
virtual std::pair< double, double > getBondEF(const double &r, const double &s, bool &fs, const bool &break_bonds) const =0
Returns energy and force between bond due to pairwise interaction.
virtual bool isStateActive() const =0
Returns true if state-based potential is active.
bool isPlaneStrain()
Returns plane-strain condition.
virtual inp::MatData computeMaterialProperties(const size_t &dim) const =0
Computes elastic and fracture material properties and returns the data.
std::string name()
Returns name of the material.
std::string d_name
Name of the material.
virtual util::Point getBondForceDirection(const util::Point &dx, const util::Point &du) const =0
Returns the unit vector along which bond-force acts.
virtual double getS(const util::Point &dx, const util::Point &du) const =0
Returns the bond strain.
virtual double getInfFn(const double &r) const =0
Returns the value of influence function.
virtual std::string printStr(int nt, int lvl) const
Returns the string containing printable information about the object.
virtual double getSc(const double &r) const =0
Returns critical bond strain.
A class providing methods to compute energy density and force of peridynamic material.
util::Point getBondForceDirection(const util::Point &dx, const util::Point &du) const override
Returns the unit vector along which bond-force acts.
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.
double getMoment(const size_t &i) const override
Returns the moment of influence function.
double getDensity() const override
Returns the density of the material.
std::string printStr(int nt, int lvl) const override
Returns the string containing printable information about the object.
double getS(const util::Point &dx, const util::Point &du) const override
Returns the bond strain.
PdElastic(inp::MaterialDeck &deck, const size_t &dim, const double &horizon)
Constructor.
inp::MatData computeMaterialProperties(const size_t &dim) const override
Computes elastic and fracture material properties and returns the data.
double getSc(const double &r) const override
Returns critical bond strain.
double getHorizon() const override
Returns horizon.
bool isStateActive() const override
Returns true if state-based potential is active.
double getInfFn(const double &r) const override
Returns the value of influence function.
void print() const override
Prints the information about the object.
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.
void print(int nt, int lvl) const override
Prints the information about the object.
void computeParameters(inp::MaterialDeck &deck, const size_t &dim)
Compute material model parameters.
A class providing methods to compute energy density and force of peridynamic material.
double getS(const util::Point &dx, const util::Point &du) const override
Returns the bond strain.
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.
double getSc(const double &r) const override
Returns critical bond strain.
inp::MatData computeMaterialProperties(const size_t &dim) const override
Computes elastic and fracture material properties and returns the data.
void computeParameters(inp::MaterialDeck &deck, const size_t &dim)
Compute material model parameters.
void print() const override
Prints the information about the object.
double getDensity() const override
Returns the density of the material.
double getHorizon() const override
Returns horizon.
util::Point getBondForceDirection(const util::Point &dx, const util::Point &du) const override
Returns the unit vector along which bond-force acts.
double getMoment(const size_t &i) const override
Returns the moment of influence function.
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.
PdState(inp::MaterialDeck &deck, const size_t &dim, const double &horizon)
Constructor.
double getInfFn(const double &r) const override
Returns the value of influence function.
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.
bool isStateActive() const override
Returns true if state-based potential is active.
double d_s0
Critical stretch.
A class providing methods to compute energy density and force of peridynamic material.
void computeParameters(inp::MaterialDeck &deck, const size_t &dim)
Compute material model parameters.
double getMoment(const size_t &i) const override
Returns the moment of influence function.
void print(int nt, int lvl) const override
Prints the information about the object.
double getDensity() const override
Returns the density of the material.
double getS(const util::Point &dx, const util::Point &du) const override
Returns the bond strain.
double getInfFn(const double &r) const override
Returns the value of influence function.
bool isStateActive() const override
Returns true if state-based potential is active.
double getHorizon() const override
Returns horizon.
PmbMaterial(inp::MaterialDeck &deck, const size_t &dim, const double &horizon)
Constructor.
void print() const override
Prints the information about the object.
util::Point getBondForceDirection(const util::Point &dx, const util::Point &du) const override
Returns the unit vector along which bond-force acts.
inp::MatData computeMaterialProperties(const size_t &dim) const override
Computes elastic and fracture material properties and returns the data.
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.
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.
double getSc(const double &r) const override
Returns critical bond strain.
std::string printStr(int nt, int lvl) const override
Returns the string containing printable information about the object.
A class providing methods to compute energy density and force of peridynamic material.
double getHorizon() const override
Returns horizon.
double getInfFn(const double &r) const override
Returns the value of influence function.
void print(int nt, int lvl) const override
Prints the information about the object.
util::Point getBondForceDirection(const util::Point &dx, const util::Point &du) const override
Returns the unit vector along which bond-force acts.
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.
double d_invFactor
Inverse of factor = .
double getDensity() const override
Returns the density of the material.
RnpMaterial(inp::MaterialDeck &deck, const size_t &dim, const double &horizon)
Constructor.
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.
double getS(const util::Point &dx, const util::Point &du) const override
Returns the bond strain.
void computeParameters(inp::MaterialDeck &deck, const size_t &dim)
Compute material model parameters.
void print() const override
Prints the information about the object.
std::string printStr(int nt, int lvl) const override
Returns the string containing printable information about the object.
double getMoment(const size_t &i) const override
Returns the moment of influence function.
bool d_irrevBondBreak
Flag which indicates if the breaking of bond is irreversible.
double d_rbar
Inflection point of nonlinear function = .
bool isStateActive() const override
Returns true if state-based potential is active.
double d_factorSc
Factor to multiply to critical strain to check if bond is fractured.
inp::MatData computeMaterialProperties(const size_t &dim) const override
Computes elastic and fracture material properties and returns the data.
double getSc(const double &r) const override
Returns critical bond strain.
bool is_plane_strain
Is plane-stress condition active.
double getGlobalInfFn(const double &r)
Returns the value of influence function.
double getGlobalMoment(const size_t &i)
Returns the moment of influence function.
size_t dimension
Dimension of the domain.
std::shared_ptr< material::BaseInfluenceFn > influence_fn
Store pointer to influence function globally.
std::string getTabS(int nt)
Returns tab spaces of given size.
bool isGreater(const double &a, const double &b)
Returns true if a > b.
bool isLess(const double &a, const double &b)
Returns true if a < b.
Structure for elastic properties and fracture properties.
double toGc(double KIc, double nu, double E)
Compute critical energy release rate Gc from critical stress-intensity factor KIc,...
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 toKIc(double Gc, double nu, double E)
Compute critical stress-intensity factor KIc from critical energy release rate Gc,...
double d_KIc
Critical stress intensity factor.
double toK(double E, double nu)
Compute Bulk modulus K from Young's modulus K and Poisson's ratio nu.
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 d_Gc
Critical energy release rate.
double toE(double K, double nu)
Compute Young's modulus E from Bulk modulus K and Poisson's ratio nu.
Structure to read and store material related data.
bool d_isPlaneStrain
Indicates if the 2-d simulation is of plane-strain type (thick material) or plane-stress type (thin m...
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.
inp::MatData d_matData
List of elastic and fracture properties.
std::vector< double > d_influenceFnParams
List of parameters for influence function.
std::string printStr(int nt=0, int lvl=0) const
Returns the string containing printable information about the object.
A structure to represent 3d vectors.
double dot(const Point &b) const
Computes the dot product of this vector with another point.
double length() const
Computes the Euclidean length of the vector.