v0.14.0
Loading...
Searching...
No Matches
MaterialBlocks.hpp
Go to the documentation of this file.
1/** \file MaterialBlocks.hpp
2 * \brief Data structures for Meshset/Blocsk with material data
3 *
4 * Notes:
5 * - use BLOCK_ATTRIBUTES tag to store data structures
6 * - data structures are tags of meshsets
7 */
8
9#ifndef __MATERIALBLOCKS_HPP__
10#define __MATERIALBLOCKS_HPP__
11
12namespace MoFEM {
13
14/*! \struct GenericAttributeData
15 * \brief Generic attribute data structure
16 */
18
19 /**
20 * \brief get data from structure
21 * @param attributes vector of doubles
22 * @return error code
23 */
24 virtual MoFEMErrorCode fill_data(const std::vector<double> &attributes) {
26 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
27 "It makes no sense for the generic attribute type");
29 }
30
31 /**
32 * \brief set data on structure
33 * @param tag_ptr pointer to tag on meshset
34 * @param size size of data in bytes
35 * @return error code
36 */
37 virtual MoFEMErrorCode set_data(void *tag_ptr, unsigned int size) const {
39 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
40 "It makes no sense for the generic attribute type");
42 }
43
44 const CubitBCType tYpe; ///< Type of data (f.e. MAT_ELATIC)
45
46 /**
47 * \brief get data type
48 * @return data type, see CubitBC
49 */
50 virtual const CubitBCType &getType() const { return tYpe; }
51
52 unsigned int minNumberOfAtributes; ///< minimal number of attributes
53
54 /**
55 * \brief get minimal number of attributes which blockset has to have
56 * @return number of minimal data attributes
57 */
58 virtual unsigned int getMinMumberOfAtributes() const {
60 }
61
62 /**
63 * \brief get data structure size
64 * @return size of structure in bytes
65 */
66 virtual std::size_t getSizeOfData() const = 0;
67
68 /**
69 * \brief get pointer to data structure
70 * @return pointer
71 */
72 virtual const void *getDataPtr() const = 0;
73
75 const unsigned int min_number_of_atributes)
76 : tYpe(type), minNumberOfAtributes(min_number_of_atributes) {}
77};
78
79/** \brief Arbitrary block attributes data structure
80 */
82
83 /** \brief generic block attributes
84 *
85 */
86 struct __attribute__((packed)) _data_ {
87 double User1; // User attribute 1
88 double User2; // User attribute 2
89 double User3; // User attribute 3
90 double User4; // User attribute 4
91 double User5; // User attribute 5
92 double User6; // User attribute 6
93 double User7; // User attribute 7
94 double User8; // User attribute 8
95 double User9; // User attribute 9
96 double User10; // User attribute 10
97 };
98
99 _data_ data;
100
101 std::size_t getSizeOfData() const { return sizeof(_data_); }
102 const void *getDataPtr() const { return &data; }
103
105 bzero(&data, sizeof(data));
106 }
107
108 MoFEMErrorCode fill_data(const std::vector<double> &attributes) {
110 if (8 * attributes.size() > sizeof(data)) {
111 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
112 "data inconsistency, please review the number of material "
113 "properties defined");
114 }
115 bzero(&data, sizeof(data));
116 memcpy(&data, &attributes[0], 8 * attributes.size());
118 }
119 MoFEMErrorCode set_data(void *tag_ptr, unsigned int size) const {
121 if (size > sizeof(data)) {
122 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
123 "data inconsistency, please review the number of material "
124 "properties defined");
125 }
126 memcpy(tag_ptr, &data, size);
128 }
129
130 /*! \brief Print data
131 */
132 friend std::ostream &operator<<(std::ostream &os,
133 const BlockSetAttributes &e);
134};
135
136/*! \struct Mat_Elastic
137 * \brief Elastic material data structure
138 */
140
141 /** \brief block tag data structute
142 *
143 */
144 struct __attribute__((packed)) _data_ {
145 double Young; ///< Young's modulus
146 double Poisson; ///< Poisson's ratio
147 double ThermalExpansion; ///< Thermal expansion
148 double User1; // User attribute 2 // For some models is reserved for density
149 double User2; // User attribute 3
150 double User3; // User attribute 4
151 double User4; // User attribute 5
152 double User5; // User attribute 6
153 double User6; // User attribute 7
154 double User7; // User attribute 8
155 };
156
157 _data_ data;
158 std::size_t getSizeOfData() const { return sizeof(data); };
159 const void *getDataPtr() const { return &data; }
160
162 bzero(&data, sizeof(data));
163 };
164
165 MoFEMErrorCode fill_data(const std::vector<double> &attributes) {
167 if (attributes.size() < minNumberOfAtributes) {
168 SETERRQ2(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
169 "Young modulus and/or Poisson ratio is not defined. (top tip: "
170 "check number of ELASTIC block attributes) %d !< %d",
171 attributes.size(), minNumberOfAtributes);
172 }
173 if (8 * attributes.size() > sizeof(data)) {
174 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
175 "data inconsistency, please review the number of material "
176 "properties defined");
177 }
178 bzero(&data, sizeof(data));
179 memcpy(&data, &attributes[0], 8 * attributes.size());
181 }
182 MoFEMErrorCode set_data(void *tag_ptr, unsigned int size) const {
184 if (size > sizeof(data)) {
185 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
186 "data inconsistency, please review the number of material "
187 "properties defined");
188 }
189 memcpy(tag_ptr, &data, size);
191 }
192
193 /*! \brief Print Mat_Elastic data
194 */
195 friend std::ostream &operator<<(std::ostream &os, const Mat_Elastic &e);
196};
197
198/*! \struct Mat_Thermal
199 * \brief Thermal material data structure
200 */
202
203 /** \brief thermal block attributes
204 *
205 */
206 struct __attribute__((packed)) _data_ {
207 double Conductivity; ///< Thermal conductivity
208 double HeatCapacity; ///< Heat Capacity
209 double User2; // User attribute 2
210 double User3; // User attribute 3
211 double User4; // User attribute 4
212 double User5; // User attribute 5
213 double User6; // User attribute 6
214 double User7; // User attribute 7
215 double User8; // User attribute 8
216 double User9; // User attribute 9
217 };
218
219 _data_ data;
220 std::size_t getSizeOfData() const { return sizeof(data); }
221 const void *getDataPtr() const { return &data; }
222
224 bzero(&data, sizeof(data));
225 }
226
227 MoFEMErrorCode fill_data(const std::vector<double> &attributes) {
229 if (attributes.size() < minNumberOfAtributes) {
230 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
231 "Thermal conductivity is not defined. (top tip: check number of "
232 "THERMAL block atributes)");
233 }
234 if (8 * attributes.size() > sizeof(data)) {
235 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
236 "data inconsistency, please review the number of material "
237 "properties defined");
238 }
239 bzero(&data, sizeof(data));
240 memcpy(&data, &attributes[0], 8 * attributes.size());
242 }
243 MoFEMErrorCode set_data(void *tag_ptr, unsigned int size) const {
245 if (size > sizeof(data)) {
246 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
247 "data inconsistency, please review the number of material "
248 "properties defined");
249 }
250 memcpy(tag_ptr, &data, size);
252 }
253
254 /*! \brief Print Mat_Elastic data
255 */
256 friend std::ostream &operator<<(std::ostream &os, const Mat_Thermal &e);
257};
258
259/*! \struct Mat_Moisture
260 * \brief moisture transport material data structure
261 */
262
264
265 /** \brief moisture block attributes
266 *
267 */
268 struct __attribute__((packed)) _data_ {
269 double Diffusivity; ///< moisture diffusivity
270 double Viscosity; ///< Viscosity of water
271 double Permeability; ///< Permeability of material
272 double User3; // User attribute 3
273 double User4; // User attribute 4
274 double User5; // User attribute 5
275 double User6; // User attribute 6
276 double User7; // User attribute 7
277 double User8; // User attribute 8
278 double User9; // User attribute 9
279 };
280
281 _data_ data;
282 std::size_t getSizeOfData() const { return sizeof(data); }
283 const void *getDataPtr() const { return &data; }
284
286 bzero(&data, sizeof(data));
287 }
288
289 MoFEMErrorCode fill_data(const std::vector<double> &attributes) {
291 if (attributes.size() < minNumberOfAtributes) {
292 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
293 "moisture diffusivity is not defined. (top tip: check number of "
294 "MOISTURE block atributes)");
295 }
296 if (8 * attributes.size() > sizeof(data)) {
297 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
298 "data inconsistency, please review the number of material "
299 "properties defined");
300 }
301 bzero(&data, sizeof(data));
302 memcpy(&data, &attributes[0], 8 * attributes.size());
304 }
305
306 /*! \brief Print Mat_Elastic data
307 */
308 friend std::ostream &operator<<(std::ostream &os, const Mat_Moisture &e);
309};
310
311/** \brief Body force data structure
312 */
314
315 /** \brief body forces
316 *
317 */
318 struct __attribute__((packed)) _data_ {
319 double density; ///< material density
320 double acceleration_x; ///< acceleration X
321 double acceleration_y; ///< acceleration Y
322 double acceleration_z; ///< acceleration Z
323 double User4; // User attribute 4
324 double User5; // User attribute 5
325 double User6; // User attribute 6
326 double User7; // User attribute 7
327 double User8; // User attribute 8
328 };
329
330 _data_ data;
331 std::size_t getSizeOfData() const { return sizeof(data); }
332 const void *getDataPtr() const { return &data; }
333
335
336 MoFEMErrorCode fill_data(const std::vector<double> &attributes) {
338 if (attributes.size() < minNumberOfAtributes) {
339 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
340 "Material density and/or acceleration is not defined. (top tip: "
341 "check number of THERMAL block atributes)");
342 }
343 if (8 * attributes.size() > sizeof(data)) {
344 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
345 "data inconsistency, please review the number of material "
346 "properties defined");
347 }
348 bzero(&data, sizeof(data));
349 memcpy(&data, &attributes[0], 8 * attributes.size());
351 }
352 MoFEMErrorCode set_data(void *tag_ptr, unsigned int size) const {
354 if (size > sizeof(data)) {
355 SETERRQ(PETSC_COMM_SELF, 1,
356 "data inconsistency, please review the number of material "
357 "properties defined");
358 }
359 memcpy(tag_ptr, &data, size);
361 }
362
363 /*! \brief Print Mat_Elastic data
364 */
365 friend std::ostream &operator<<(std::ostream &os, const Block_BodyForces &e);
366};
367
368/*! \struct Mat_Elastic_TransIso
369 * \brief Transverse Isotropic material data structure
370 */
372
373 /** \brief transverse isotropic
374 *
375 */
376 struct __attribute__((packed)) _data_ {
377 double Youngp; ///< Young's modulus in xy plane (Ep)
378 double Youngz; ///< Young's modulus in z-direction (Ez)
379 double Poissonp; ///< Poisson's ratio in xy plane (vp)
380 double Poissonpz; ///< Poisson's ratio in z-direction (vpz)
381 double Shearzp; ///< Shear modulus in z-direction (Gzp)
382 };
383
384 _data_ data;
385 std::size_t getSizeOfData() const { return sizeof(data); }
386 const void *getDataPtr() const { return &data; }
387
389 bzero(&data, sizeof(data));
390 }
391
392 MoFEMErrorCode fill_data(const std::vector<double> &attributes) {
394 // Fill data
395 if (attributes.size() < minNumberOfAtributes) {
396 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
397 "All material data not defined");
398 }
399 if (8 * attributes.size() != sizeof(data)) {
400 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
401 "data inconsistency, please review the number of material "
402 "properties defined");
403 }
404 memcpy(&data, &attributes[0], sizeof(data));
405 bzero(&data, sizeof(data));
406 memcpy(&data, &attributes[0], 8 * attributes.size());
407
409 }
410 MoFEMErrorCode set_data(void *tag_ptr, unsigned int size) const {
412 if (size > sizeof(data)) {
413 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
414 "data inconsistency, please review the number of material "
415 "properties defined");
416 }
417 memcpy(tag_ptr, &data, size);
419 }
420
421 /*! \brief Print Mat_Elastic_TransIso data
422 */
423 friend std::ostream &operator<<(std::ostream &os,
424 const Mat_Elastic_TransIso &e);
425};
426
427/*! \struct Mat_Interf
428 * \brief Linear interface data structure
429 */
431
432 /** \brief inteface
433 *
434 */
435 struct __attribute__((packed)) _data_ {
436 double alpha; ///< Elastic modulus multiplier
437 double beta; ///< Damage Coupling multiplier between normal and shear
438 ///< (g=sqrt(gn^2 + beta(gt1^2 + gt2^2)))
439 double ft; ///< Maximum stress of crack
440 double Gf; ///< Fracture Energy
441 };
442
443 _data_ data;
444 std::size_t getSizeOfData() const { return sizeof(data); }
445 const void *getDataPtr() const { return &data; }
446
448 bzero(&data, sizeof(data));
449 }
450
451 virtual MoFEMErrorCode fill_data(const std::vector<double> &attributes) {
453 // Fill data
454 if (8 * attributes.size() != sizeof(data)) {
455 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
456 "data inconsistency, please review the number of material "
457 "properties defined");
458 }
459 memcpy(&data, &attributes[0], sizeof(data));
461 }
462 virtual MoFEMErrorCode set_data(void *tag_ptr, unsigned int size) const {
464 if (size > sizeof(data)) {
465 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
466 "data inconsistency, please review the number of material "
467 "properties defined");
468 }
469 memcpy(tag_ptr, &data, size);
471 }
472
473 /*! \brief Print Mat_Interf data
474 */
475 friend std::ostream &operator<<(std::ostream &os, const Mat_Interf &e);
476};
477
478/** \brief Mat_Elastic with Fibres
479 * \brief Elastic material data structure
480 */
482
483 /** \brief Hotzapler soft tissue
484 *
485 */
486 struct __attribute__((packed)) _data_ {
487 double Young; ///< Young's modulus
488 double Poisson; ///< Poisson's ratio
489 double k1; // User attribute 1
490 double k2; // User attribute 2
491 double a0x; // User attribute 3
492 double a0y; // User attribute 4
493 double a0z; // User attribute 5
494 double a1x; // User attribute 6
495 double a1y; // User attribute 7
496 double a1z; // User attribute 8
497 };
498
499 _data_ data;
500 std::size_t getSizeOfData() const { return sizeof(data); }
501 const void *getDataPtr() const { return &data; }
502
504 bzero(&data, sizeof(data));
505 }
506
507 MoFEMErrorCode fill_data(const std::vector<double> &attributes) {
509 if (attributes.size() < minNumberOfAtributes) {
510 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
511 "All material data not defined");
512 }
513 if (8 * attributes.size() > sizeof(data)) {
514 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
515 "data inconsistency, please review the number of material "
516 "properties defined");
517 }
518 bzero(&data, sizeof(data));
519 memcpy(&data, &attributes[0], 8 * attributes.size());
521 }
522
523 /*! \brief Print Mat_Elastic data
524 */
525 friend std::ostream &operator<<(std::ostream &os,
527};
528
529} // namespace MoFEM
530
531#endif // __MATERIALBLOCKS_HPP__
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:447
@ BODYFORCESSET
block name is "BODY_FORCES"
Definition: definitions.h:162
@ MAT_ELASTICSET
block name is "MAT_ELASTIC"
Definition: definitions.h:159
@ MAT_INTERFSET
Definition: definitions.h:160
@ MAT_THERMALSET
block name is "MAT_THERMAL"
Definition: definitions.h:161
@ MAT_MOISTURESET
block name is "MAT_MOISTURE"
Definition: definitions.h:163
@ BLOCKSET
Definition: definitions.h:148
@ MOFEM_DATA_INCONSISTENCY
Definition: definitions.h:31
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:440
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
Definition: Exceptions.hpp:56
std::bitset< 32 > CubitBCType
Definition: Types.hpp:52
implementation of Data Operators for Forces and Sources
Definition: Common.hpp:10
Body force data structure.
MoFEMErrorCode set_data(void *tag_ptr, unsigned int size) const
set data on structure
struct __attribute__((packed)) _data_
body forces
MoFEMErrorCode fill_data(const std::vector< double > &attributes)
get data from structure
const void * getDataPtr() const
get pointer to data structure
std::size_t getSizeOfData() const
get data structure size
friend std::ostream & operator<<(std::ostream &os, const Block_BodyForces &e)
Print Mat_Elastic data.
Arbitrary block attributes data structure.
MoFEMErrorCode set_data(void *tag_ptr, unsigned int size) const
set data on structure
std::size_t getSizeOfData() const
get data structure size
MoFEMErrorCode fill_data(const std::vector< double > &attributes)
get data from structure
const void * getDataPtr() const
get pointer to data structure
friend std::ostream & operator<<(std::ostream &os, const BlockSetAttributes &e)
Print data.
struct __attribute__((packed)) _data_
generic block attributes
Generic attribute data structure.
const CubitBCType tYpe
Type of data (f.e. MAT_ELATIC)
virtual MoFEMErrorCode fill_data(const std::vector< double > &attributes)
get data from structure
virtual MoFEMErrorCode set_data(void *tag_ptr, unsigned int size) const
set data on structure
virtual const void * getDataPtr() const =0
get pointer to data structure
virtual const CubitBCType & getType() const
get data type
unsigned int minNumberOfAtributes
minimal number of attributes
virtual std::size_t getSizeOfData() const =0
get data structure size
virtual unsigned int getMinMumberOfAtributes() const
get minimal number of attributes which blockset has to have
MoFEMErrorCode fill_data(const std::vector< double > &attributes)
get data from structure
friend std::ostream & operator<<(std::ostream &os, const Mat_Elastic_EberleinHolzapfel1 &e)
Print Mat_Elastic data.
struct __attribute__((packed)) _data_
Hotzapler soft tissue.
const void * getDataPtr() const
get pointer to data structure
std::size_t getSizeOfData() const
get data structure size
Transverse Isotropic material data structure.
friend std::ostream & operator<<(std::ostream &os, const Mat_Elastic_TransIso &e)
Print Mat_Elastic_TransIso data.
const void * getDataPtr() const
get pointer to data structure
std::size_t getSizeOfData() const
get data structure size
MoFEMErrorCode fill_data(const std::vector< double > &attributes)
get data from structure
MoFEMErrorCode set_data(void *tag_ptr, unsigned int size) const
set data on structure
struct __attribute__((packed)) _data_
transverse isotropic
Elastic material data structure.
MoFEMErrorCode set_data(void *tag_ptr, unsigned int size) const
set data on structure
friend std::ostream & operator<<(std::ostream &os, const Mat_Elastic &e)
Print Mat_Elastic data.
const void * getDataPtr() const
get pointer to data structure
std::size_t getSizeOfData() const
get data structure size
struct __attribute__((packed)) _data_
block tag data structute
MoFEMErrorCode fill_data(const std::vector< double > &attributes)
get data from structure
Linear interface data structure.
friend std::ostream & operator<<(std::ostream &os, const Mat_Interf &e)
Print Mat_Interf data.
std::size_t getSizeOfData() const
get data structure size
const void * getDataPtr() const
get pointer to data structure
virtual MoFEMErrorCode fill_data(const std::vector< double > &attributes)
get data from structure
virtual MoFEMErrorCode set_data(void *tag_ptr, unsigned int size) const
set data on structure
struct __attribute__((packed)) _data_
inteface
moisture transport material data structure
friend std::ostream & operator<<(std::ostream &os, const Mat_Moisture &e)
Print Mat_Elastic data.
const void * getDataPtr() const
get pointer to data structure
struct __attribute__((packed)) _data_
moisture block attributes
MoFEMErrorCode fill_data(const std::vector< double > &attributes)
get data from structure
std::size_t getSizeOfData() const
get data structure size
Thermal material data structure.
MoFEMErrorCode set_data(void *tag_ptr, unsigned int size) const
set data on structure
MoFEMErrorCode fill_data(const std::vector< double > &attributes)
get data from structure
struct __attribute__((packed)) _data_
thermal block attributes
friend std::ostream & operator<<(std::ostream &os, const Mat_Thermal &e)
Print Mat_Elastic data.
const void * getDataPtr() const
get pointer to data structure
std::size_t getSizeOfData() const
get data structure size