G+Smo  24.08.0
Geometry + Simulation Modules
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
getMaterialMatrix.h
Go to the documentation of this file.
1 
16 #pragma once
17 
23 #include <gsIO/gsOptionList.h>
24 
25 namespace gismo
26 {
27 
28 
29 template<class T>
30 gsMatrix<T> gsCompositeMatrix( const T Exx,
31  const T Eyy,
32  const T Gxy,
33  const T nuxy,
34  const T nuyx
35  )
36 {
37  GISMO_ASSERT(nuyx*Exx == nuxy*Eyy, "No symmetry in material properties for ply! (nu12*E2!=nu21*E1):\n"<<
38  "\tnu12 = "<<nuxy<<"\t E22 = "<<Eyy<<"\t nu12*E22 = "<<nuxy*Eyy<<"\n"
39  <<"\tnu21 = "<<nuyx<<"\t E11 = "<<Exx<<"\t nu21*E11 = "<<nuyx*Exx);
40 
41  gsMatrix<T> G(3,3);
42  G.setZero();
43 
44  G(0,0) = Exx / (1-nuxy*nuyx);
45  G(1,1) = Eyy / (1-nuxy*nuyx);
46  G(2,2) = Gxy;
47  G(0,1) = nuyx*Exx / (1-nuxy*nuyx);
48  G(1,0) = nuxy*Eyy / (1-nuxy*nuyx);
49  G(2,0) = G(0,2) = G(2,1) = G(1,2) = 0.0;
50  return G;
51 }
52 
53 template<class T>
54 gsMatrix<T> gsCompositeMatrixRaw( const T G11,
55  const T G22,
56  const T G33,
57  const T G12,
58  const T G13,
59  const T G23,
60  const T G21,
61  const T G31,
62  const T G32 )
63 {
64  gsMatrix<T> G(3,3);
65  G.setZero();
66 
67  G(0,0) = G11;
68  G(1,1) = G22;
69  G(2,2) = G33;
70  G(1,0) = G12;
71  G(0,1) = G21;
72  G(0,2) = G13;
73  G(2,0) = G31;
74  G(1,2) = G23;
75  G(2,1) = G32;
76  return G;
77 }
78 
79 template<class T>
80 gsMatrix<T> gsCompositeMatrixRaw( const T G11,
81  const T G22,
82  const T G33,
83  const T G12,
84  const T G13,
85  const T G23 )
86 {
87  gsMatrix<T> G(3,3);
88  G.setZero();
89 
90  G(0,0) = G11;
91  G(1,1) = G22;
92  G(2,2) = G33;
93  G(1,0) = G(0,1) = G12;
94  G(0,2) = G(2,0) = G13;
95  G(1,2) = G(2,1) = G23;
96  return G;
97 }
98 
116 template<short_t d, class T>
118  const gsMultiPatch<T> & mp,
119  const gsFunctionSet<T> & thickness,
120  const std::vector<gsFunctionSet<T> *> & parameters,
121  const gsFunctionSet<T> & rho,
122  const gsOptionList & options
123  )
124 {
125  index_t material = options.askInt("Material",0); // SvK by default
126  bool compressibility = options.askSwitch("Compressibility",false);
127  index_t implementation = options.askInt("Implementation",1);
128 
129  enum Material mat = static_cast<enum Material>(material);
130  enum Implementation impl = static_cast<enum Implementation>(implementation);
131 
132  if (mat==Material::SvK)
133  {
134  if (impl==Implementation::Composite)
135  GISMO_ERROR("Construct composite material models using the constructor of gsMaterialMatrixComposite directly.");
136  else
137  return new gsMaterialMatrixLinear<d,T>(mp,thickness,*parameters.at(0),*parameters.at(1),rho);
138  }
139  else
140  {
141  if (impl==Implementation::Composite)
142  GISMO_ERROR("Hyperelastic composites not available");
143  //--------------------------------------NH Incompressible--------------------------------------------------
144  else if ((mat==Material::NH) && (impl==Implementation::Analytical) && (!compressibility))
145  {
147  return new gsMaterialMatrixNonlinear<d,real_t,id,false>(mp,thickness,parameters,rho);
148  }
149  else if ((mat==Material::NH) && (impl==Implementation::Generalized) && (!compressibility))
150  {
152  return new gsMaterialMatrixNonlinear<d,real_t,id,false>(mp,thickness,parameters,rho);
153  }
154  else if ((mat==Material::NH) && (impl==Implementation::Spectral) && (!compressibility))
155  {
157  return new gsMaterialMatrixNonlinear<d,real_t,id,false>(mp,thickness,parameters,rho);
158  }
159  //--------------------------------------NH Compressible--------------------------------------------------
160  else if ((mat==Material::NH) && (impl==Implementation::Analytical) && (compressibility))
161  {
163  return new gsMaterialMatrixNonlinear<d,real_t,id,true>(mp,thickness,parameters,rho);
164  }
165  else if ((mat==Material::NH) && (impl==Implementation::Generalized) && (compressibility))
166  {
168  return new gsMaterialMatrixNonlinear<d,real_t,id,true>(mp,thickness,parameters,rho);
169  }
170  else if ((mat==Material::NH) && (impl==Implementation::Spectral) && (compressibility))
171  {
173  return new gsMaterialMatrixNonlinear<d,real_t,id,true>(mp,thickness,parameters,rho);
174  }
175  //
176  //--------------------------------------NH_ext Incompressible--------------------------------------------------
177  else if ((mat==Material::NH_ext) && (!compressibility))
178  {
179  GISMO_ERROR("Incompressible Extended NH with not available");
180  }
181  //---------------------------------------NH_ext Compressible-------------------------------------------------
182  else if ((mat==Material::NH_ext) && (impl==Implementation::Analytical) && (compressibility))
183  {
185  return new gsMaterialMatrixNonlinear<d,real_t,id,true>(mp,thickness,parameters,rho);
186  }
187  else if ((mat==Material::NH_ext) && (impl==Implementation::Generalized) && (compressibility))
188  {
190  return new gsMaterialMatrixNonlinear<d,real_t,id,true>(mp,thickness,parameters,rho);
191  }
192  else if ((mat==Material::NH_ext) && (impl==Implementation::Spectral) && (compressibility))
193  {
195  return new gsMaterialMatrixNonlinear<d,real_t,id,true>(mp,thickness,parameters,rho);
196  }
197  //
198  //--------------------------------------MR Incompressible--------------------------------------------------
199  else if ((mat==Material::MR) && (impl==Implementation::Analytical) && (!compressibility))
200  {
202  return new gsMaterialMatrixNonlinear<d,real_t,id,false>(mp,thickness,parameters,rho);
203  }
204  else if ((mat==Material::MR) && (impl==Implementation::Generalized) && (!compressibility))
205  {
207  return new gsMaterialMatrixNonlinear<d,real_t,id,false>(mp,thickness,parameters,rho);
208  }
209  else if ((mat==Material::MR) && (impl==Implementation::Spectral) && (!compressibility))
210  {
212  return new gsMaterialMatrixNonlinear<d,real_t,id,false>(mp,thickness,parameters,rho);
213  }
214  //---------------------------------------MR Compressible-------------------------------------------------
215  else if ((mat==Material::MR) && (impl==Implementation::Analytical) && (compressibility))
216  {
218  return new gsMaterialMatrixNonlinear<d,real_t,id,true>(mp,thickness,parameters,rho);
219  }
220  else if ((mat==Material::MR) && (impl==Implementation::Generalized) && (compressibility))
221  {
223  return new gsMaterialMatrixNonlinear<d,real_t,id,true>(mp,thickness,parameters,rho);
224  }
225  else if ((mat==Material::MR) && (impl==Implementation::Spectral) && (compressibility))
226  {
228  return new gsMaterialMatrixNonlinear<d,real_t,id,true>(mp,thickness,parameters,rho);
229  }
230  //
231  //--------------------------------------OG Incompressible--------------------------------------------------
232  else if ((mat==Material::OG) && (impl==Implementation::Analytical) && (!compressibility))
233  {
234  GISMO_ERROR("Incompressible Ogden with analytical implementation not available");
235  }
236  else if ((mat==Material::OG) && (impl==Implementation::Generalized) && (!compressibility))
237  {
238  GISMO_ERROR("Incompressible Ogden with generalized implementation not available");
239  }
240  else if ((mat==Material::OG) && (impl==Implementation::Spectral) && (!compressibility))
241  {
243  return new gsMaterialMatrixNonlinear<d,real_t,id,false>(mp,thickness,parameters,rho);
244  }
245  //---------------------------------------OG Compressible-------------------------------------------------
246  else if ((mat==Material::OG) && (impl==Implementation::Analytical) && (compressibility))
247  {
248  GISMO_ERROR("Compressible Ogden with analytical implementation not available");
249  }
250  else if ((mat==Material::OG) && (impl==Implementation::Generalized) && (compressibility))
251  {
252  GISMO_ERROR("Compressible Ogden with generalized implementation not available");
253  }
254  else if ((mat==Material::OG) && (impl==Implementation::Spectral) && (compressibility))
255  {
257  return new gsMaterialMatrixNonlinear<d,real_t,id,true>(mp,thickness,parameters,rho);
258  }
259  else
260  return NULL;
261  }
262 }
263 
280 template<short_t d, class T>
282  const gsMultiPatch<T> & mp,
283  const gsFunctionSet<T> & thickness,
284  const std::vector<gsFunctionSet<T> *> & parameters,
285  const gsOptionList & options
286  )
287 {
288  index_t material = options.askInt("Material",0); // SvK by default
289  bool compressibility = options.askSwitch("Compressibility",false);
290  index_t implementation = options.askInt("Implementation",1);
291 
292  enum Material mat = static_cast<enum Material>(material);
293  enum Implementation impl = static_cast<enum Implementation>(implementation);
294 
295  if (mat==Material::SvK)
296  {
297  if (impl==Implementation::Composite)
298  GISMO_ERROR("Construct composite material models using the constructor of gsMaterialMatrixComposite directly.");
299  else
300  return new gsMaterialMatrixLinear<d,T>(mp,thickness,*parameters.at(0),*parameters.at(1));
301  }
302  else
303  {
304  if (impl==Implementation::Composite)
305  GISMO_ERROR("Hyperelastic composites not available");
306  //--------------------------------------NH Incompressible--------------------------------------------------
307  else if ((mat==Material::NH) && (impl==Implementation::Analytical) && (!compressibility))
308  {
310  return new gsMaterialMatrixNonlinear<d,real_t,id,false>(mp,thickness,parameters);
311  }
312  else if ((mat==Material::NH) && (impl==Implementation::Generalized) && (!compressibility))
313  {
315  return new gsMaterialMatrixNonlinear<d,real_t,id,false>(mp,thickness,parameters);
316  }
317  else if ((mat==Material::NH) && (impl==Implementation::Spectral) && (!compressibility))
318  {
320  return new gsMaterialMatrixNonlinear<d,real_t,id,false>(mp,thickness,parameters);
321  }
322  //--------------------------------------NH Compressible--------------------------------------------------
323  else if ((mat==Material::NH) && (impl==Implementation::Analytical) && (compressibility))
324  {
326  return new gsMaterialMatrixNonlinear<d,real_t,id,true>(mp,thickness,parameters);
327  }
328  else if ((mat==Material::NH) && (impl==Implementation::Generalized) && (compressibility))
329  {
331  return new gsMaterialMatrixNonlinear<d,real_t,id,true>(mp,thickness,parameters);
332  }
333  else if ((mat==Material::NH) && (impl==Implementation::Spectral) && (compressibility))
334  {
336  return new gsMaterialMatrixNonlinear<d,real_t,id,true>(mp,thickness,parameters);
337  }
338  //
339  //--------------------------------------NH_ext Incompressible--------------------------------------------------
340  else if ((mat==Material::NH_ext) && (!compressibility))
341  {
342  GISMO_ERROR("Incompressible Extended NH with not available");
343  }
344  //---------------------------------------NH_ext Compressible-------------------------------------------------
345  else if ((mat==Material::NH_ext) && (impl==Implementation::Analytical) && (compressibility))
346  {
348  return new gsMaterialMatrixNonlinear<d,real_t,id,true>(mp,thickness,parameters);
349  }
350  else if ((mat==Material::NH_ext) && (impl==Implementation::Generalized) && (compressibility))
351  {
353  return new gsMaterialMatrixNonlinear<d,real_t,id,true>(mp,thickness,parameters);
354  }
355  else if ((mat==Material::NH_ext) && (impl==Implementation::Spectral) && (compressibility))
356  {
358  return new gsMaterialMatrixNonlinear<d,real_t,id,true>(mp,thickness,parameters);
359  }
360  //
361  //--------------------------------------MR Incompressible--------------------------------------------------
362  else if ((mat==Material::MR) && (impl==Implementation::Analytical) && (!compressibility))
363  {
365  return new gsMaterialMatrixNonlinear<d,real_t,id,false>(mp,thickness,parameters);
366  }
367  else if ((mat==Material::MR) && (impl==Implementation::Generalized) && (!compressibility))
368  {
370  return new gsMaterialMatrixNonlinear<d,real_t,id,false>(mp,thickness,parameters);
371  }
372  else if ((mat==Material::MR) && (impl==Implementation::Spectral) && (!compressibility))
373  {
375  return new gsMaterialMatrixNonlinear<d,real_t,id,false>(mp,thickness,parameters);
376  }
377  //---------------------------------------MR Compressible-------------------------------------------------
378  else if ((mat==Material::MR) && (impl==Implementation::Analytical) && (compressibility))
379  {
381  return new gsMaterialMatrixNonlinear<d,real_t,id,true>(mp,thickness,parameters);
382  }
383  else if ((mat==Material::MR) && (impl==Implementation::Generalized) && (compressibility))
384  {
386  return new gsMaterialMatrixNonlinear<d,real_t,id,true>(mp,thickness,parameters);
387  }
388  else if ((mat==Material::MR) && (impl==Implementation::Spectral) && (compressibility))
389  {
391  return new gsMaterialMatrixNonlinear<d,real_t,id,true>(mp,thickness,parameters);
392  }
393  //
394  //--------------------------------------OG Incompressible--------------------------------------------------
395  else if ((mat==Material::OG) && (impl==Implementation::Analytical) && (!compressibility))
396  {
397  GISMO_ERROR("Incompressible Ogden with analytical implementation not available");
398  }
399  else if ((mat==Material::OG) && (impl==Implementation::Generalized) && (!compressibility))
400  {
401  GISMO_ERROR("Incompressible Ogden with generalized implementation not available");
402  }
403  else if ((mat==Material::OG) && (impl==Implementation::Spectral) && (!compressibility))
404  {
406  return new gsMaterialMatrixNonlinear<d,real_t,id,false>(mp,thickness,parameters);
407  }
408  //---------------------------------------OG Compressible-------------------------------------------------
409  else if ((mat==Material::OG) && (impl==Implementation::Analytical) && (compressibility))
410  {
411  GISMO_ERROR("Compressible Ogden with analytical implementation not available");
412  }
413  else if ((mat==Material::OG) && (impl==Implementation::Generalized) && (compressibility))
414  {
415  GISMO_ERROR("Compressible Ogden with generalized implementation not available");
416  }
417  else if ((mat==Material::OG) && (impl==Implementation::Spectral) && (compressibility))
418  {
420  return new gsMaterialMatrixNonlinear<d,real_t,id,true>(mp,thickness,parameters);
421  }
422  else
423  return NULL;
424  }
425 }
426 
427 
428 
429 } // namespace
430 
gsMaterialMatrixBase< T > * getMaterialMatrix(const gsMultiPatch< T > &mp, const gsFunctionSet< T > &thickness, const std::vector< gsFunctionSet< T > * > &parameters, const gsFunctionSet< T > &rho, const gsOptionList &options)
Gets a material matrix based on options.
Definition: getMaterialMatrix.h:117
Provides linear material matrices.
This class defines hyperelastic material matrices.
Definition: gsMaterialMatrixNonlinear.h:47
#define index_t
Definition: gsConfig.h:32
#define GISMO_ASSERT(cond, message)
Definition: gsDebug.h:89
Implementation
This class describes the way material models are implemented.
Definition: gsMaterialMatrixUtils.h:70
This class defines the base class for material matrices.
Definition: gsMaterialMatrixBase.h:32
Provides a list of labeled parameters/options that can be set and accessed easily.
Encodes the material model and implementation.
Definition: gsMaterialMatrixUtils.h:155
This class defines a linear material.
Definition: gsMaterialMatrixLinear.h:39
Interface for the set of functions defined on a domain (the total number of functions in the set equa...
Definition: gsFuncData.h:23
Container class for a set of geometry patches and their topology, that is, the interface connections ...
Definition: gsMultiPatch.h:33
Provides material matrix utilities.
Provides hyperelastic material matrices.
Provides a material matrix for laminates.
index_t askInt(const std::string &label, const index_t &value=0) const
Reads value for option label from options.
Definition: gsOptionList.cpp:117
Provides a base class for material matrices.
#define GISMO_ERROR(message)
Definition: gsDebug.h:118
bool askSwitch(const std::string &label, const bool &value=false) const
Reads value for option label from options.
Definition: gsOptionList.cpp:128
Class which holds a list of parameters/options, and provides easy access to them. ...
Definition: gsOptionList.h:32
Material
This class describes a material model.
Definition: gsMaterialMatrixUtils.h:50