G+Smo  25.01.0
Geometry + Simulation Modules
 
Loading...
Searching...
No Matches
getMaterialMatrix.h
Go to the documentation of this file.
1
16#pragma once
17
23#include <gsIO/gsOptionList.h>
24
25namespace gismo
26{
27
28
29template<class T>
30gsMatrix<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
53template<class T>
54gsMatrix<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
79template<class T>
80gsMatrix<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
116template<short_t d, class T>
119 const gsMultiPatch<T> & mp,
120 const gsFunctionSet<T> & thickness,
121 const std::vector<gsFunctionSet<T> *> & parameters,
122 const gsFunctionSet<T> & rho,
123 const gsOptionList & options
124 )
125{
126 index_t material = options.askInt("Material",0); // SvK by default
127 bool compressibility = options.askSwitch("Compressibility",false);
128 index_t implementation = options.askInt("Implementation",1);
129
130 enum Material mat = static_cast<enum Material>(material);
131 enum Implementation impl = static_cast<enum Implementation>(implementation);
132
133 if (mat==Material::SvK)
134 {
135 if (impl==Implementation::Composite)
136 GISMO_ERROR("Construct composite material models using the constructor of gsMaterialMatrixComposite directly.");
137 else
138 return memory::make_unique(new gsMaterialMatrixLinear<d,T>(mp,thickness,*parameters.at(0),*parameters.at(1),rho));
139 }
140 else
141 {
142 if (impl==Implementation::Composite)
143 GISMO_ERROR("Hyperelastic composites not available");
144 //--------------------------------------NH Incompressible--------------------------------------------------
145 else if ((mat==Material::NH) && (impl==Implementation::Analytical) && (!compressibility))
146 {
148 return memory::make_unique(new gsMaterialMatrixNonlinear<d,real_t,id,false>(mp,thickness,parameters,rho));
149 }
150 else if ((mat==Material::NH) && (impl==Implementation::Generalized) && (!compressibility))
151 {
153 return memory::make_unique(new gsMaterialMatrixNonlinear<d,real_t,id,false>(mp,thickness,parameters,rho));
154 }
155 else if ((mat==Material::NH) && (impl==Implementation::Spectral) && (!compressibility))
156 {
158 return memory::make_unique(new gsMaterialMatrixNonlinear<d,real_t,id,false>(mp,thickness,parameters,rho));
159 }
160 //--------------------------------------NH Compressible--------------------------------------------------
161 else if ((mat==Material::NH) && (impl==Implementation::Analytical) && (compressibility))
162 {
164 return memory::make_unique(new gsMaterialMatrixNonlinear<d,real_t,id,true>(mp,thickness,parameters,rho));
165 }
166 else if ((mat==Material::NH) && (impl==Implementation::Generalized) && (compressibility))
167 {
169 return memory::make_unique(new gsMaterialMatrixNonlinear<d,real_t,id,true>(mp,thickness,parameters,rho));
170 }
171 else if ((mat==Material::NH) && (impl==Implementation::Spectral) && (compressibility))
172 {
174 return memory::make_unique(new gsMaterialMatrixNonlinear<d,real_t,id,true>(mp,thickness,parameters,rho));
175 }
176 //
177 //--------------------------------------NH_ext Incompressible--------------------------------------------------
178 else if ((mat==Material::NH_ext) && (!compressibility))
179 {
180 GISMO_ERROR("Incompressible Extended NH with not available");
181 }
182 //---------------------------------------NH_ext Compressible-------------------------------------------------
183 else if ((mat==Material::NH_ext) && (impl==Implementation::Analytical) && (compressibility))
184 {
186 return memory::make_unique(new gsMaterialMatrixNonlinear<d,real_t,id,true>(mp,thickness,parameters,rho));
187 }
188 else if ((mat==Material::NH_ext) && (impl==Implementation::Generalized) && (compressibility))
189 {
191 return memory::make_unique(new gsMaterialMatrixNonlinear<d,real_t,id,true>(mp,thickness,parameters,rho));
192 }
193 else if ((mat==Material::NH_ext) && (impl==Implementation::Spectral) && (compressibility))
194 {
196 return memory::make_unique(new gsMaterialMatrixNonlinear<d,real_t,id,true>(mp,thickness,parameters,rho));
197 }
198 //
199 //--------------------------------------MR Incompressible--------------------------------------------------
200 else if ((mat==Material::MR) && (impl==Implementation::Analytical) && (!compressibility))
201 {
203 return memory::make_unique(new gsMaterialMatrixNonlinear<d,real_t,id,false>(mp,thickness,parameters,rho));
204 }
205 else if ((mat==Material::MR) && (impl==Implementation::Generalized) && (!compressibility))
206 {
208 return memory::make_unique(new gsMaterialMatrixNonlinear<d,real_t,id,false>(mp,thickness,parameters,rho));
209 }
210 else if ((mat==Material::MR) && (impl==Implementation::Spectral) && (!compressibility))
211 {
213 return memory::make_unique(new gsMaterialMatrixNonlinear<d,real_t,id,false>(mp,thickness,parameters,rho));
214 }
215 //---------------------------------------MR Compressible-------------------------------------------------
216 else if ((mat==Material::MR) && (impl==Implementation::Analytical) && (compressibility))
217 {
219 return memory::make_unique(new gsMaterialMatrixNonlinear<d,real_t,id,true>(mp,thickness,parameters,rho));
220 }
221 else if ((mat==Material::MR) && (impl==Implementation::Generalized) && (compressibility))
222 {
224 return memory::make_unique(new gsMaterialMatrixNonlinear<d,real_t,id,true>(mp,thickness,parameters,rho));
225 }
226 else if ((mat==Material::MR) && (impl==Implementation::Spectral) && (compressibility))
227 {
229 return memory::make_unique(new gsMaterialMatrixNonlinear<d,real_t,id,true>(mp,thickness,parameters,rho));
230 }
231 //
232 //--------------------------------------OG Incompressible--------------------------------------------------
233 else if ((mat==Material::OG) && (impl==Implementation::Analytical) && (!compressibility))
234 {
235 GISMO_ERROR("Incompressible Ogden with analytical implementation not available");
236 }
237 else if ((mat==Material::OG) && (impl==Implementation::Generalized) && (!compressibility))
238 {
239 GISMO_ERROR("Incompressible Ogden with generalized implementation not available");
240 }
241 else if ((mat==Material::OG) && (impl==Implementation::Spectral) && (!compressibility))
242 {
244 return memory::make_unique(new gsMaterialMatrixNonlinear<d,real_t,id,false>(mp,thickness,parameters,rho));
245 }
246 //---------------------------------------OG Compressible-------------------------------------------------
247 else if ((mat==Material::OG) && (impl==Implementation::Analytical) && (compressibility))
248 {
249 GISMO_ERROR("Compressible Ogden with analytical implementation not available");
250 }
251 else if ((mat==Material::OG) && (impl==Implementation::Generalized) && (compressibility))
252 {
253 GISMO_ERROR("Compressible Ogden with generalized implementation not available");
254 }
255 else if ((mat==Material::OG) && (impl==Implementation::Spectral) && (compressibility))
256 {
258 return memory::make_unique(new gsMaterialMatrixNonlinear<d,real_t,id,true>(mp,thickness,parameters,rho));
259 }
260 else
261 return NULL;
262 }
263}
264
281template<short_t d, class T>
284 const gsMultiPatch<T> & mp,
285 const gsFunctionSet<T> & thickness,
286 const std::vector<gsFunctionSet<T> *> & parameters,
287 const gsOptionList & options
288 )
289{
290 index_t material = options.askInt("Material",0); // SvK by default
291 bool compressibility = options.askSwitch("Compressibility",false);
292 index_t implementation = options.askInt("Implementation",1);
293
294 enum Material mat = static_cast<enum Material>(material);
295 enum Implementation impl = static_cast<enum Implementation>(implementation);
296
297 if (mat==Material::SvK)
298 {
299 if (impl==Implementation::Composite)
300 GISMO_ERROR("Construct composite material models using the constructor of gsMaterialMatrixComposite directly.");
301 else
302 return memory::make_unique(new gsMaterialMatrixLinear<d,T>(mp,thickness,*parameters.at(0),*parameters.at(1)));
303 }
304 else
305 {
306 if (impl==Implementation::Composite)
307 GISMO_ERROR("Hyperelastic composites not available");
308 //--------------------------------------NH Incompressible--------------------------------------------------
309 else if ((mat==Material::NH) && (impl==Implementation::Analytical) && (!compressibility))
310 {
312 return memory::make_unique(new gsMaterialMatrixNonlinear<d,real_t,id,false>(mp,thickness,parameters));
313 }
314 else if ((mat==Material::NH) && (impl==Implementation::Generalized) && (!compressibility))
315 {
317 return memory::make_unique(new gsMaterialMatrixNonlinear<d,real_t,id,false>(mp,thickness,parameters));
318 }
319 else if ((mat==Material::NH) && (impl==Implementation::Spectral) && (!compressibility))
320 {
322 return memory::make_unique(new gsMaterialMatrixNonlinear<d,real_t,id,false>(mp,thickness,parameters));
323 }
324 //--------------------------------------NH Compressible--------------------------------------------------
325 else if ((mat==Material::NH) && (impl==Implementation::Analytical) && (compressibility))
326 {
328 return memory::make_unique(new gsMaterialMatrixNonlinear<d,real_t,id,true>(mp,thickness,parameters));
329 }
330 else if ((mat==Material::NH) && (impl==Implementation::Generalized) && (compressibility))
331 {
333 return memory::make_unique(new gsMaterialMatrixNonlinear<d,real_t,id,true>(mp,thickness,parameters));
334 }
335 else if ((mat==Material::NH) && (impl==Implementation::Spectral) && (compressibility))
336 {
338 return memory::make_unique(new gsMaterialMatrixNonlinear<d,real_t,id,true>(mp,thickness,parameters));
339 }
340 //
341 //--------------------------------------NH_ext Incompressible--------------------------------------------------
342 else if ((mat==Material::NH_ext) && (!compressibility))
343 {
344 GISMO_ERROR("Incompressible Extended NH with not available");
345 }
346 //---------------------------------------NH_ext Compressible-------------------------------------------------
347 else if ((mat==Material::NH_ext) && (impl==Implementation::Analytical) && (compressibility))
348 {
350 return memory::make_unique(new gsMaterialMatrixNonlinear<d,real_t,id,true>(mp,thickness,parameters));
351 }
352 else if ((mat==Material::NH_ext) && (impl==Implementation::Generalized) && (compressibility))
353 {
355 return memory::make_unique(new gsMaterialMatrixNonlinear<d,real_t,id,true>(mp,thickness,parameters));
356 }
357 else if ((mat==Material::NH_ext) && (impl==Implementation::Spectral) && (compressibility))
358 {
360 return memory::make_unique(new gsMaterialMatrixNonlinear<d,real_t,id,true>(mp,thickness,parameters));
361 }
362 //
363 //--------------------------------------MR Incompressible--------------------------------------------------
364 else if ((mat==Material::MR) && (impl==Implementation::Analytical) && (!compressibility))
365 {
367 return memory::make_unique(new gsMaterialMatrixNonlinear<d,real_t,id,false>(mp,thickness,parameters));
368 }
369 else if ((mat==Material::MR) && (impl==Implementation::Generalized) && (!compressibility))
370 {
372 return memory::make_unique(new gsMaterialMatrixNonlinear<d,real_t,id,false>(mp,thickness,parameters));
373 }
374 else if ((mat==Material::MR) && (impl==Implementation::Spectral) && (!compressibility))
375 {
377 return memory::make_unique(new gsMaterialMatrixNonlinear<d,real_t,id,false>(mp,thickness,parameters));
378 }
379 //---------------------------------------MR Compressible-------------------------------------------------
380 else if ((mat==Material::MR) && (impl==Implementation::Analytical) && (compressibility))
381 {
383 return memory::make_unique(new gsMaterialMatrixNonlinear<d,real_t,id,true>(mp,thickness,parameters));
384 }
385 else if ((mat==Material::MR) && (impl==Implementation::Generalized) && (compressibility))
386 {
388 return memory::make_unique(new gsMaterialMatrixNonlinear<d,real_t,id,true>(mp,thickness,parameters));
389 }
390 else if ((mat==Material::MR) && (impl==Implementation::Spectral) && (compressibility))
391 {
393 return memory::make_unique(new gsMaterialMatrixNonlinear<d,real_t,id,true>(mp,thickness,parameters));
394 }
395 //
396 //--------------------------------------OG Incompressible--------------------------------------------------
397 else if ((mat==Material::OG) && (impl==Implementation::Analytical) && (!compressibility))
398 {
399 GISMO_ERROR("Incompressible Ogden with analytical implementation not available");
400 }
401 else if ((mat==Material::OG) && (impl==Implementation::Generalized) && (!compressibility))
402 {
403 GISMO_ERROR("Incompressible Ogden with generalized implementation not available");
404 }
405 else if ((mat==Material::OG) && (impl==Implementation::Spectral) && (!compressibility))
406 {
408 return memory::make_unique(new gsMaterialMatrixNonlinear<d,real_t,id,false>(mp,thickness,parameters));
409 }
410 //---------------------------------------OG Compressible-------------------------------------------------
411 else if ((mat==Material::OG) && (impl==Implementation::Analytical) && (compressibility))
412 {
413 GISMO_ERROR("Compressible Ogden with analytical implementation not available");
414 }
415 else if ((mat==Material::OG) && (impl==Implementation::Generalized) && (compressibility))
416 {
417 GISMO_ERROR("Compressible Ogden with generalized implementation not available");
418 }
419 else if ((mat==Material::OG) && (impl==Implementation::Spectral) && (compressibility))
420 {
422 return memory::make_unique(new gsMaterialMatrixNonlinear<d,real_t,id,true>(mp,thickness,parameters));
423 }
424 else
425 return NULL;
426 }
427}
428
429
430
431} // namespace
432
Interface for the set of functions defined on a domain (the total number of functions in the set equa...
Definition gsFunctionSet.h:219
memory::unique_ptr< gsMaterialMatrixBase > uPtr
Unique pointer for gsGeometry.
Definition gsMaterialMatrixBase.h:44
This class defines a linear material.
Definition gsMaterialMatrixLinear.h:38
This class defines hyperelastic material matrices.
Definition gsMaterialMatrixNonlinear.h:47
Container class for a set of geometry patches and their topology, that is, the interface connections ...
Definition gsMultiPatch.h:100
Class which holds a list of parameters/options, and provides easy access to them.
Definition gsOptionList.h:33
bool askSwitch(const std::string &label, const bool &value=false) const
Reads value for option label from options.
Definition gsOptionList.cpp:128
index_t askInt(const std::string &label, const index_t &value=0) const
Reads value for option label from options.
Definition gsOptionList.cpp:117
Material
This class describes a material model.
Definition gsMaterialMatrixUtils.h:51
Implementation
This class describes the way material models are implemented.
Definition gsMaterialMatrixUtils.h:71
gsMaterialMatrixBase< T >::uPtr 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:118
#define index_t
Definition gsConfig.h:32
#define GISMO_ERROR(message)
Definition gsDebug.h:118
#define GISMO_ASSERT(cond, message)
Definition gsDebug.h:89
Provides a base class for material matrices.
Provides a material matrix for laminates.
Provides linear material matrices.
Provides hyperelastic material matrices.
Provides material matrix utilities.
Provides a list of labeled parameters/options that can be set and accessed easily.
unique_ptr< T > make_unique(T *x)
Definition gsMemory.h:198
The G+Smo namespace, containing all definitions for the library.
Encodes the material model and implementation.
Definition gsMaterialMatrixUtils.h:155