Karamelo  714599e9
Parallel Material Point Method Simulator
material.h
1 /* -*- c++ -*- ----------------------------------------------------------
2  *
3  * *** Karamelo ***
4  * Parallel Material Point Method Simulator
5  *
6  * Copyright (2019) Alban de Vaucorbeil, alban.devaucorbeil@monash.edu
7  * Materials Science and Engineering, Monash University
8  * Clayton VIC 3800, Australia
9 
10  * This software is distributed under the GNU General Public License.
11  *
12  * ----------------------------------------------------------------------- */
13 
14 #ifndef MPM_MATERIAL_H
15 #define MPM_MATERIAL_H
16 
17 #include "damage.h"
18 #include "eos.h"
19 #include "pointers.h"
20 #include "strength.h"
21 #include "temperature.h"
22 #include <vector>
23 
45 class Mat {
46 public:
47  string id;
48  int type;
49  bool rigid = false;
50  class EOS *eos = NULL;
51  class Strength *strength = NULL;
52  class Damage *damage = NULL;
53  class Temperature *temp = NULL;
54  double rho0;
55  double E;
56  double nu;
57  double G;
58  double K;
59  double lambda;
60  double signal_velocity;
61  Mat(string, int, class EOS *, class Strength *, class Damage *,
62  class Temperature *);
63  Mat(string, int, double, double, double);
64  Mat(string, int);
65 };
66 
70 class Material : protected Pointers {
71  public:
72  string id;
73  vector<Mat> materials;
74  vector<class EOS *> EOSs;
75  vector<class Strength *> strengths;
76  vector<class Damage *> damages;
77  vector<class Temperature *> temperatures;
78 
79  Material(class MPM *);
80  virtual ~Material();
81 
82  void add_strength(vector<string>);
83  int find_strength(string);
84  void add_EOS(vector<string>);
85  int find_EOS(string);
86  void add_material(vector<string>);
87  int find_material(string);
88  void add_damage(vector<string>);
89  int find_damage(string);
90  void add_temperature(vector<string>);
91  int find_temperature(string);
92 
93  typedef Strength *(*StrengthCreator)(MPM *,vector<string>);
94  typedef map<string,StrengthCreator> StrengthCreatorMap;
95  StrengthCreatorMap *strength_map;
96 
97  typedef EOS *(*EOSCreator)(MPM *,vector<string>);
98  typedef map<string,EOSCreator> EOSCreatorMap;
99  EOSCreatorMap *EOS_map;
100 
101  typedef Damage *(*DamageCreator)(MPM *,vector<string>);
102  typedef map<string,DamageCreator> DamageCreatorMap;
103  DamageCreatorMap *damage_map;
104 
105  typedef Temperature *(*TemperatureCreator)(MPM *,vector<string>);
106  typedef map<string,TemperatureCreator> TemperatureCreatorMap;
107  TemperatureCreatorMap *temperature_map;
108 
110  LINEAR = 0,
111  NEO_HOOKEAN = 1,
112  SHOCK = 2,
113  RIGID = 3,
114  };
115 
116 private:
117  template <typename T> static Strength *strength_creator(MPM *,vector<string>);
118  template <typename T> static EOS *EOS_creator(MPM *,vector<string>);
119  template <typename T> static Damage *damage_creator(MPM *,vector<string>);
120  template <typename T> static Temperature *temperature_creator(MPM *,vector<string>);
121 
122  const map<string, string> usage = {{"rigid", "Usage: material(material-ID, \033[1;32mrigid\033[0m)\n"},
123  {"linear", "Usage: material(material-ID, \033[1;32mlinear\033[0m, rho, E, nu, optional: damage-ID)\n"},
124  {"neo-hookean", "Usage: material(material-ID, \033[1;32mneo-hookean\033[0m, rho, E, nu, optional: damage-ID)\n"},
125  {"eos-strength", "Usage: material(material-ID, \033[1;32meos-strength\033[0m, eos-ID, strength-ID, optional: damage-ID, optional: temperature-ID)\n"}};
126  const map<string, int> Nargs = {{"rigid", 2},
127  {"linear", 5},
128  {"neo-hookean", 5},
129  {"eos-strength", 4}};
130 };
131 
132 
133 #endif
134 
double lambda
1st Lame parameter
Definition: material.h:59
class EOS * eos
Pointer to the EOS.
Definition: material.h:50
int type
Either RIGID, LINEAR, NEO_HOOKEAN, or SHOCK with values from Material::constitutive_model.
Definition: material.h:48
vector< class EOS * > EOSs
List of defined Equations of State.
Definition: material.h:74
vector< class Damage * > damages
List of defined Damage laws.
Definition: material.h:76
string id
Identification name of the material.
Definition: material.h:47
double nu
Poisson&#39;s ratio .
Definition: material.h:56
Definition: mpm.h:29
string id
Identification name of the material.
Definition: material.h:72
class Strength * strength
Pointer to the Strength (flow stress rule)
Definition: material.h:51
double signal_velocity
Signal velocity in the reference state .
Definition: material.h:60
Definition: eos.h:26
class Damage * damage
Pointer to the Damage law.
Definition: material.h:52
Definition: material.h:70
vector< Mat > materials
List of defined materials.
Definition: material.h:73
vector< class Strength * > strengths
List of defined Strengths.
Definition: material.h:75
constitutive_model
Definition: material.h:109
double rho0
Density in the reference state .
Definition: material.h:54
Definition: material.h:45
Definition: pointers.h:29
vector< class Temperature * > temperatures
List of defined Temperature laws.
Definition: material.h:77
bool rigid
True if the material is rigid, false otherwise.
Definition: material.h:49
Mat(string, int, class EOS *, class Strength *, class Damage *, class Temperature *)
Creates an elasto-plastic material.
Definition: material.cpp:419
double G
Shear modulus.
Definition: material.h:57
double E
Young&#39;s modulus.
Definition: material.h:55
double K
Bulk modulus.
Definition: material.h:58
class Temperature * temp
Pointer to the Temperature law.
Definition: material.h:53