PRISMS-PF Manual
Loading...
Searching...
No Matches
user_constants.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: © 2025 PRISMS Center at the University of Michigan
2// SPDX-License-Identifier: GNU Lesser General Public Version 2.1
3
4#pragma once
5
6#include <deal.II/base/tensor.h>
7#include <deal.II/base/utilities.h>
8
9#include <boost/algorithm/string/predicate.hpp>
10#include <boost/range/algorithm_ext/erase.hpp>
11#include <boost/variant.hpp>
12
16
17#include <prismspf/config.h>
18
19#include <map>
20
22
26template <unsigned int dim>
28{
29public:
30 using InputVariant = boost::variant<double,
31 int,
32 bool,
33 dealii::Tensor<1, dim>,
34 dealii::Tensor<2, dim>,
35 dealii::Tensor<2, (2 * dim) - 1 + (dim / 3)>>;
36
41 construct_user_constant(std::vector<std::string> &model_constants_strings);
42
49 [[nodiscard]] double
50 get_double(const std::string &constant_name) const;
51
58 [[nodiscard]] int
59 get_int(const std::string &constant_name) const;
60
67 [[nodiscard]] bool
68 get_bool(const std::string &constant_name) const;
69
76 [[nodiscard]] dealii::Tensor<1, dim>
77 get_rank_1_tensor(const std::string &constant_name) const;
78
85 [[nodiscard]] dealii::Tensor<2, dim>
86 get_rank_2_tensor(const std::string &constant_name) const;
87
94 [[nodiscard]] dealii::Tensor<2, (2 * dim) - 1 + (dim / 3)>
95 get_elasticity_tensor(const std::string &constant_name) const;
96
100 void
101 add_user_constant(const std::string &constant_name,
102 std::vector<std::string> &model_constants_strings)
103 {
104 model_constants[constant_name] = construct_user_constant(model_constants_strings);
105 };
106
110 void
111 print() const;
112
113private:
117 unsigned int
118 compute_tensor_parentheses(const unsigned int &n_elements,
119 const std::vector<std::string> &tensor_elements);
120
124 void
125 remove_parentheses(std::vector<std::string> &tensor_elements);
126
130 dealii::Tensor<1, dim>
131 compute_rank_1_tensor_constant(const unsigned int &n_elements,
132 const std::vector<std::string> &tensor_elements);
133
137 dealii::Tensor<2, dim>
138 compute_rank_2_tensor_constant(const unsigned int &n_elements,
139 const std::vector<std::string> &tensor_elements);
140
145 primitive_model_constant(std::vector<std::string> &model_constants_strings);
146
147 [[nodiscard]] dealii::Tensor<2, (2 * dim) - 1 + (dim / 3)>
148 get_cij_tensor(std::vector<double> elastic_constants,
149 const std::string &elastic_const_symmetry) const;
150
151 [[nodiscard]] dealii::Tensor<2, (2 * dim) - 1 + (dim / 3)>
152 get_cij_matrix(const ElasticityModel &model,
153 const std::vector<double> &constants) const;
154
158 std::map<std::string, InputVariant> model_constants;
159
163 class VariantPrinter : public boost::static_visitor<>
164 {
165 public:
166 void
167 operator()(double value) const
168 {
170 }
171
172 void
173 operator()(int value) const
174 {
176 }
177
178 void
179 operator()(bool value) const
180 {
181 ConditionalOStreams::pout_summary() << std::boolalpha << value;
182 }
183
184 void
185 operator()(const dealii::Tensor<1, dim> &value) const
186 {
187 ConditionalOStreams::pout_summary() << "Tensor<1, " << dim << ">: ";
188 for (unsigned int i = 0; i < dim; ++i)
189 {
190 ConditionalOStreams::pout_summary() << value[i] << ' ';
191 }
192 }
193
194 void
195 operator()(const dealii::Tensor<2, dim> &value) const
196 {
197 ConditionalOStreams::pout_summary() << "Tensor<2, " << dim << ">: ";
198 for (unsigned int i = 0; i < dim; ++i)
199 {
200 for (unsigned int j = 0; j < dim; ++j)
201 {
202 ConditionalOStreams::pout_summary() << value[i][j] << ' ';
203 }
204 }
205 }
206
207 template <unsigned int D = dim>
208 void
209 operator()(const dealii::Tensor<2, (2 * D) - 1 + (D / 3)> &value) const
210 requires((D != ((2 * D) - 1 + (D / 3))))
211 {
212 constexpr unsigned int dimension = (2 * D) - 1 + (D / 3);
213 ConditionalOStreams::pout_summary() << "Tensor<2, " << dimension << ">: ";
214 for (unsigned int i = 0; i < dimension; ++i)
215 {
216 for (unsigned int j = 0; j < dimension; ++j)
217 {
218 ConditionalOStreams::pout_summary() << value[i][j] << ' ';
219 }
220 }
221 }
222 };
223};
224
225template <unsigned int dim>
226inline double
227UserConstants<dim>::get_double(const std::string &constant_name) const
228{
229 Assert(model_constants.find(constant_name) != model_constants.end(),
230 dealii::ExcMessage(
231 "Mismatch between constants in parameters.prm and CustomPDE.h. The constant "
232 "that you attempted to access was " +
233 constant_name + "."));
234
235 return boost::get<double>(model_constants.at(constant_name));
236}
237
238template <unsigned int dim>
239inline int
240UserConstants<dim>::get_int(const std::string &constant_name) const
241{
242 Assert(model_constants.find(constant_name) != model_constants.end(),
243 dealii::ExcMessage(
244 "Mismatch between constants in parameters.prm and CustomPDE.h. The constant "
245 "that you attempted to access was " +
246 constant_name + "."));
247
248 return boost::get<int>(model_constants.at(constant_name));
249}
250
251template <unsigned int dim>
252inline bool
253UserConstants<dim>::get_bool(const std::string &constant_name) const
254{
255 Assert(model_constants.find(constant_name) != model_constants.end(),
256 dealii::ExcMessage(
257 "Mismatch between constants in parameters.prm and CustomPDE.h. The constant "
258 "that you attempted to access was " +
259 constant_name + "."));
260
261 return boost::get<bool>(model_constants.at(constant_name));
262}
263
264template <unsigned int dim>
265inline dealii::Tensor<1, dim>
266UserConstants<dim>::get_rank_1_tensor(const std::string &constant_name) const
267{
268 Assert(model_constants.find(constant_name) != model_constants.end(),
269 dealii::ExcMessage(
270 " Mismatch between constants in parameters.prm and "
271 "CustomPDE.h. The constant that you attempted to access was " +
272 constant_name + "."));
273
274 return boost::get<dealii::Tensor<1, dim>>(model_constants.at(constant_name));
275}
276
277template <unsigned int dim>
278inline dealii::Tensor<2, dim>
279UserConstants<dim>::get_rank_2_tensor(const std::string &constant_name) const
280{
281 Assert(model_constants.find(constant_name) != model_constants.end(),
282 dealii::ExcMessage(
283 "Mismatch between constants in parameters.prm and CustomPDE.h. The constant "
284 "that you attempted to access was " +
285 constant_name + "."));
286
287 return boost::get<dealii::Tensor<2, dim>>(model_constants.at(constant_name));
288}
289
290template <unsigned int dim>
291inline dealii::Tensor<2, (2 * dim) - 1 + (dim / 3)>
292UserConstants<dim>::get_elasticity_tensor(const std::string &constant_name) const
293{
294 Assert(model_constants.find(constant_name) != model_constants.end(),
295 dealii::ExcMessage(
296 "Mismatch between constants in parameters.prm and CustomPDE.h. The constant "
297 "that you attempted to access was " +
298 constant_name + "."));
299
300 return boost::get<dealii::Tensor<2, (2 * dim) - 1 + (dim / 3)>>(
301 model_constants.at(constant_name));
302}
303
304template <unsigned int dim>
305inline unsigned int
307 const unsigned int &n_elements,
308 const std::vector<std::string> &tensor_elements)
309{
310 unsigned int open_parentheses = 0;
311 unsigned int close_parentheses = 0;
312
313 for (unsigned int element = 0; element < n_elements; element++)
314 {
315 for (const char character : tensor_elements.at(element))
316 {
317 if (character == '(')
318 {
319 ++open_parentheses;
320 }
321 else if (character == ')')
322 {
323 ++close_parentheses;
324 }
325 }
326 }
327
328 if (open_parentheses != close_parentheses)
329 {
330 AssertThrow(false,
331 dealii::ExcMessage("User-defined elastic constant list does not have "
332 "the same number of open and close parentheses."));
333 }
334
335 return open_parentheses;
336}
337
338template <unsigned int dim>
339inline void
340UserConstants<dim>::remove_parentheses(std::vector<std::string> &tensor_elements)
341{
342 for (std::string &element : tensor_elements)
343 {
344 boost::range::remove_erase(element, '(');
345 boost::range::remove_erase(element, ')');
346 }
347}
348
349template <unsigned int dim>
350inline dealii::Tensor<1, dim>
352 const unsigned int &n_elements,
353 const std::vector<std::string> &tensor_elements)
354{
355 AssertThrow(n_elements == 3,
356 dealii::ExcMessage("The columns in user-defined constant tensors must be "
357 "equal to the maximum number of dimensions."));
358
359 dealii::Tensor<1, dim> temp;
360 for (unsigned int i = 0; i < dim; i++)
361 {
362 temp[i] = dealii::Utilities::string_to_double(tensor_elements.at(i));
363 }
364
365 return temp;
366}
367
368template <unsigned int dim>
369inline dealii::Tensor<2, dim>
371 const unsigned int &n_elements,
372 const std::vector<std::string> &tensor_elements)
373{
374 AssertThrow(n_elements == 9,
375 dealii::ExcMessage("User-defined constant tensor does not have the "
376 "correct number of elements, matrices must be 3x3."));
377
378 const unsigned int row_length = 3;
379
380 dealii::Tensor<2, dim> temp;
381 for (unsigned int i = 0; i < dim; i++)
382 {
383 for (unsigned int j = 0; j < dim; j++)
384 {
385 temp[i][j] =
386 dealii::Utilities::string_to_double(tensor_elements.at((i * row_length) + j));
387 }
388 }
389
390 return temp;
391}
392
393template <unsigned int dim>
396 std::vector<std::string> &model_constants_strings)
397{
398 // Ensure that the input includes a value and a type
399 AssertThrow(
400 model_constants_strings.size() > 1,
401 dealii::ExcMessage(
402 "At least two fields are required for user-defined variables (value and type)."));
403
404 std::vector<std::string> model_constants_type_strings =
405 dealii::Utilities::split_string_list(model_constants_strings.at(
406 model_constants_strings.size() - 1),
407 ' ');
408
409 if (model_constants_strings.size() == 2)
410 {
411 return primitive_model_constant(model_constants_strings);
412 }
413
414 if (boost::iequals(model_constants_type_strings.at(0), "tensor"))
415 {
416 const unsigned int n_elements = model_constants_strings.size() - 1;
417
418 const unsigned int open_parentheses =
419 compute_tensor_parentheses(n_elements, model_constants_strings);
420
421 AssertThrow(open_parentheses <= 4,
422 FeatureNotImplemented("3rd rank tensors and above"));
423
424 remove_parentheses(model_constants_strings);
425
426 // Rank 1 tensor
427 if (open_parentheses == 1)
428 {
429 return compute_rank_1_tensor_constant(n_elements, model_constants_strings);
430 }
431 // Rank 2 tensor
432 return compute_rank_2_tensor_constant(n_elements, model_constants_strings);
433 }
434 if (boost::iequals(model_constants_type_strings.at(1), "elastic") &&
435 boost::iequals(model_constants_type_strings.at(2), "constants"))
436 {
437 const unsigned int n_elements = model_constants_strings.size() - 1;
438
439 remove_parentheses(model_constants_strings);
440
441 // Load in the elastic constants as a vector
442 std::vector<double> temp_elastic_constants(n_elements);
443 for (unsigned int i = 0; i < n_elements; i++)
444 {
445 temp_elastic_constants[i] =
446 dealii::Utilities::string_to_double(model_constants_strings.at(i));
447 }
448 const std::string &elastic_const_symmetry = model_constants_type_strings.at(0);
449 dealii::Tensor<2, (2 * dim) - 1 + (dim / 3)> temp =
450 get_cij_tensor(temp_elastic_constants, elastic_const_symmetry);
451 return temp;
452 }
453
454 AssertThrow(false,
455 dealii::ExcMessage(
456 "Only user-defined constant tensors may have multiple elements."));
457 return 0;
458}
459
460template <unsigned int dim>
463 std::vector<std::string> &model_constants_strings)
464{
465 std::vector<std::string> model_constants_type_strings =
466 dealii::Utilities::split_string_list(model_constants_strings.at(
467 model_constants_strings.size() - 1),
468 ' ');
469
470 if (boost::iequals(model_constants_type_strings.at(0), "double"))
471 {
472 return dealii::Utilities::string_to_double(model_constants_strings.at(0));
473 }
474 if (boost::iequals(model_constants_type_strings.at(0), "int"))
475 {
476 return dealii::Utilities::string_to_int(model_constants_strings.at(0));
477 }
478 if (boost::iequals(model_constants_type_strings.at(0), "bool"))
479 {
480 return boost::iequals(model_constants_strings.at(0), "true");
481 }
482
483 AssertThrow(false,
484 dealii::ExcMessage(
485 "The type for user-defined variables must be `double`, `int`, "
486 "`bool`, `tensor`, or `elastic constants`."));
487 return 0;
488}
489
490template <unsigned int dim>
491inline dealii::Tensor<2, (2 * dim) - 1 + (dim / 3)>
492UserConstants<dim>::get_cij_tensor(std::vector<double> elastic_constants,
493 const std::string &elastic_const_symmetry) const
494{
495 // First set the material model
496 ElasticityModel mat_model = Isotropic;
497 if (elastic_const_symmetry == "isotropic")
498 {
499 mat_model = ElasticityModel::Isotropic;
500 }
501 else if (elastic_const_symmetry == "transverse")
502 {
503 mat_model = ElasticityModel::Transverse;
504 }
505 else if (elastic_const_symmetry == "orthotropic")
506 {
508 }
509 else if (elastic_const_symmetry == "anisotropic")
510 {
512 }
513 else
514 {
515 AssertThrow(false, dealii::ExcMessage("Invalid elasticity tensor type"));
516 }
517
518 // If the material model is anisotropic for a 2D calculation but the elastic
519 // constants are given for a 3D calculation, change the elastic constant
520 // vector to the 2D form
521 constexpr unsigned int max_number = 21;
522 if ((mat_model == Anisotropic) && (dim == 2) && elastic_constants.size() == max_number)
523 {
524 std::vector<double> elastic_constants_temp = elastic_constants;
525 elastic_constants.clear();
526 const std::vector<unsigned int> indices_2d = {0, 1, 5, 6, 10, 14};
527 std::transform(indices_2d.begin(),
528 indices_2d.end(),
529 std::back_inserter(elastic_constants),
530 [&elastic_constants_temp](unsigned int index)
531 {
532 return elastic_constants_temp.at(index);
533 });
534 }
535
536 return get_cij_matrix(mat_model, elastic_constants);
537}
538
539template <unsigned int dim>
540inline dealii::Tensor<2, (2 * dim) - 1 + (dim / 3)>
542 const std::vector<double> &constants) const
543{
544 // Initialize compliance tensor
545 dealii::Tensor<2, (2 * dim) - 1 + (dim / 3)> compliance;
546
547 switch (dim)
548 {
549 case 1:
550 {
551 const int xx_dir = 0;
552
553 switch (model)
554 {
555 // For the 1D case, it make little sense to accept anything besides an
556 // isotropic elasticity tensor. One hiccup, is that if a user is debugging
557 // an application and switches to 1D, they will have to modify the
558 // elasticity constants to align with that. While more burdensome, there's
559 // less of a chance of producing spurious behavior.
560 case Isotropic:
561 {
562 const double modulus = constants.at(0);
563
564 compliance[xx_dir][xx_dir] = modulus;
565 break;
566 }
567 default:
568 AssertThrow(false,
569 dealii::ExcMessage(
570 "Invalid elasticity model type for 1D. We only accept "
571 "isotropic elasticity tensors."));
572 }
573 break;
574 }
575 case 2:
576 {
577 // The voigt indexing scheme for 2 dimensions
578 const int xx_dir = 0;
579 const int yy_dir = 1;
580 const int xy_dir = 2;
581
582 switch (model)
583 {
584 // Like the 1D case, it is nonsensical to have transverse or orthotropic
585 // compliance tensors, so we throw an error.
586 case Isotropic:
587 {
588 // For isotropic compliance tensors, we can simplify the computation to
589 // two parameters: $\lambda$ and $\mu$, where $\mu$ is the shear
590 // modulus. In cartesian coordinates,
591 // $$$
592 // c_{ijkl} = \lambda \delta_{ij} \delta_{kl} + \mu (\delta_{ik}
593 // \delta_{jl} + \delta_{il} \delta_{kj})
594 // $$$
595 const double modulus = constants.at(0);
596 const double poisson = constants.at(1);
597
598 const double shear_modulus = modulus / (2 * (1 + poisson));
599 const double lambda =
600 poisson * modulus / ((1 + poisson) * (1 - 2 * poisson));
601
602 compliance[xx_dir][xx_dir] = compliance[yy_dir][yy_dir] =
603 lambda + 2 * shear_modulus;
604 compliance[xy_dir][xy_dir] = shear_modulus;
605 compliance[xx_dir][yy_dir] = compliance[yy_dir][xx_dir] = lambda;
606 break;
607 }
608 case Anisotropic:
609 {
610 // In the anisotropic case, every entry is specified (given the symmetry
611 // constraints). Also, ignore magic numbers because it is simpler to
612 // hardcode this.
613
614 // NOLINTBEGIN(cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers)
615
616 compliance[xx_dir][xx_dir] = constants.at(0);
617 compliance[yy_dir][yy_dir] = constants.at(1);
618 compliance[xy_dir][xy_dir] = constants.at(2);
619 compliance[xx_dir][yy_dir] = compliance[yy_dir][xx_dir] =
620 constants.at(3);
621 compliance[xx_dir][xy_dir] = compliance[xy_dir][xx_dir] =
622 constants.at(4);
623 compliance[yy_dir][xy_dir] = compliance[xy_dir][yy_dir] =
624 constants.at(5);
625
626 // NOLINTEND(cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers)
627 break;
628 }
629 default:
630 AssertThrow(false, dealii::ExcMessage("Invalid elasticity model type"));
631 }
632 break;
633 }
634 case 3:
635 {
636 const int xx_dir = 0;
637 const int yy_dir = 1;
638 const int zz_dir = 2;
639 const int yz_dir = 3;
640 const int xz_dir = 4;
641 const int xy_dir = 5;
642
643 switch (model)
644 {
645 case Isotropic:
646 {
647 // For isotropic compliance tensors, we can simplify the computation to
648 // two parameters: $\lambda$ and $\mu$, where $\mu$ is the shear
649 // modulus. In cartesian coordinates,
650 // $$$
651 // c_{ijkl} = \lambda \delta_{ij} \delta_{kl} + \mu (\delta_{ik}
652 // \delta_{jl} + \delta_{il} \delta_{kj})
653 // $$$
654 const double modulus = constants.at(0);
655 const double poisson = constants.at(1);
656
657 const double shear_modulus = modulus / (2 * (1 + poisson));
658 const double lambda =
659 poisson * modulus / ((1 + poisson) * (1 - 2 * poisson));
660
661 compliance[xx_dir][xx_dir] = compliance[yy_dir][yy_dir] =
662 compliance[zz_dir][zz_dir] = lambda + 2 * shear_modulus;
663 compliance[yz_dir][yz_dir] = compliance[xz_dir][xz_dir] =
664 compliance[xy_dir][xy_dir] = shear_modulus;
665 compliance[xx_dir][yy_dir] = compliance[yy_dir][xx_dir] =
666 compliance[xx_dir][zz_dir] = compliance[zz_dir][xx_dir] =
667 compliance[yy_dir][zz_dir] = compliance[zz_dir][yy_dir] = lambda;
668 break;
669 }
670 case Anisotropic:
671 {
672 // In the anisotropic case, every entry is specified (given the symmetry
673 // constraints). Also, ignore magic numbers because it is simpler to
674 // hardcode this.
675
676 // NOLINTBEGIN(cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers)
677
678 compliance[xx_dir][xx_dir] = constants[0];
679 compliance[yy_dir][yy_dir] = constants[1];
680 compliance[zz_dir][zz_dir] = constants[2];
681 compliance[yz_dir][yz_dir] = constants[3];
682 compliance[xz_dir][xz_dir] = constants[4];
683 compliance[xy_dir][xy_dir] = constants[5];
684 compliance[xx_dir][yy_dir] = compliance[yy_dir][xx_dir] = constants[6];
685 compliance[xx_dir][zz_dir] = compliance[zz_dir][xx_dir] = constants[7];
686 compliance[xx_dir][yz_dir] = compliance[yz_dir][xx_dir] = constants[8];
687 compliance[xx_dir][xz_dir] = compliance[xz_dir][xx_dir] = constants[9];
688 compliance[xx_dir][xy_dir] = compliance[xy_dir][xx_dir] = constants[10];
689 compliance[yy_dir][zz_dir] = compliance[zz_dir][yy_dir] = constants[11];
690 compliance[yy_dir][yz_dir] = compliance[yz_dir][yy_dir] = constants[12];
691 compliance[yy_dir][xz_dir] = compliance[xz_dir][yy_dir] = constants[13];
692 compliance[yy_dir][xy_dir] = compliance[xy_dir][yy_dir] = constants[14];
693 compliance[zz_dir][yz_dir] = compliance[yz_dir][zz_dir] = constants[15];
694 compliance[zz_dir][xz_dir] = compliance[xz_dir][zz_dir] = constants[16];
695 compliance[zz_dir][xy_dir] = compliance[xy_dir][zz_dir] = constants[17];
696 compliance[yz_dir][xz_dir] = compliance[xz_dir][yz_dir] = constants[18];
697 compliance[yz_dir][xy_dir] = compliance[xy_dir][yz_dir] = constants[19];
698 compliance[xz_dir][xy_dir] = compliance[xy_dir][xz_dir] = constants[20];
699
700 // NOLINTEND(cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers)
701 break;
702 }
703 case Transverse:
704 // TODO (landinjm): implement
705 case Orthotropic:
706 // TODO (landinjm): implement
707 default:
708 AssertThrow(false, dealii::ExcMessage("Invalid elasticity model type"));
709 }
710 break;
711 }
712 default:
713 {
714 Assert(false, UnreachableCode());
715 }
716 }
717
718 return compliance;
719}
720
721template <unsigned int dim>
722void
724{
725 if (!model_constants.empty())
726 {
728 << "================================================\n"
729 << " User Constants\n"
730 << "================================================\n";
731
732 for (const auto &[constant_name, variant] : model_constants)
733 {
734 ConditionalOStreams::pout_summary() << constant_name << ": ";
735 boost::apply_visitor(VariantPrinter(), variant);
737 }
738 ConditionalOStreams::pout_summary() << "\n" << std::flush;
739 }
740}
741
742PRISMS_PF_END_NAMESPACE
static dealii::ConditionalOStream & pout_summary()
Log output stream for writing a summary.log file.
Definition conditional_ostreams.cc:35
Class for printing of variant types. This is bad practice and should be fixed.
Definition user_constants.h:164
void operator()(bool value) const
Definition user_constants.h:179
void operator()(int value) const
Definition user_constants.h:173
void operator()(double value) const
Definition user_constants.h:167
void operator()(const dealii::Tensor< 2, dim > &value) const
Definition user_constants.h:195
void operator()(const dealii::Tensor< 2,(2 *D) - 1+(D/3)> &value) const
Definition user_constants.h:209
void operator()(const dealii::Tensor< 1, dim > &value) const
Definition user_constants.h:185
Class the stores and manages user-defined constants.
Definition user_constants.h:28
InputVariant construct_user_constant(std::vector< std::string > &model_constants_strings)
Assign the specified user constant to whatever type.
Definition user_constants.h:395
int get_int(const std::string &constant_name) const
Retrieve the int from the model_constants that are defined from the parameters.prm parser....
Definition user_constants.h:240
dealii::Tensor< 2,(2 *dim) - 1+(dim/3)> get_cij_matrix(const ElasticityModel &model, const std::vector< double > &constants) const
Definition user_constants.h:541
dealii::Tensor< 1, dim > get_rank_1_tensor(const std::string &constant_name) const
Retrieve the rank 1 tensor from the model_constants that are defined from the parameters....
Definition user_constants.h:266
void add_user_constant(const std::string &constant_name, std::vector< std::string > &model_constants_strings)
Print all user-specified constants.
Definition user_constants.h:101
std::map< std::string, InputVariant > model_constants
List of user-defined constants.
Definition user_constants.h:158
boost::variant< double, int, bool, dealii::Tensor< 1, dim >, dealii::Tensor< 2, dim >, dealii::Tensor< 2,(2 *dim) - 1+(dim/3)> > InputVariant
Definition user_constants.h:30
InputVariant primitive_model_constant(std::vector< std::string > &model_constants_strings)
Assign the primitive user constants (e.g., int, double, bool).
Definition user_constants.h:462
double get_double(const std::string &constant_name) const
Retrieve the double from the model_constants that are defined from the parameters....
Definition user_constants.h:227
dealii::Tensor< 2,(2 *dim) - 1+(dim/3)> get_elasticity_tensor(const std::string &constant_name) const
Retrieve the elasticity tensor from the model_constants that are defined from the parameters....
Definition user_constants.h:292
dealii::Tensor< 2, dim > get_rank_2_tensor(const std::string &constant_name) const
Retrieve the rank 2 tensor from the model_constants that are defined from the parameters....
Definition user_constants.h:279
dealii::Tensor< 2,(2 *dim) - 1+(dim/3)> get_cij_tensor(std::vector< double > elastic_constants, const std::string &elastic_const_symmetry) const
Definition user_constants.h:492
dealii::Tensor< 1, dim > compute_rank_1_tensor_constant(const unsigned int &n_elements, const std::vector< std::string > &tensor_elements)
Compute a 1st rank tensor from user inputs .
Definition user_constants.h:351
dealii::Tensor< 2, dim > compute_rank_2_tensor_constant(const unsigned int &n_elements, const std::vector< std::string > &tensor_elements)
Compute a 2nd rank tensor from user inputs .
Definition user_constants.h:370
unsigned int compute_tensor_parentheses(const unsigned int &n_elements, const std::vector< std::string > &tensor_elements)
Compute the number of tensor rows.
Definition user_constants.h:306
void print() const
Print all user-specified constants.
Definition user_constants.h:723
bool get_bool(const std::string &constant_name) const
Retrieve the bool from the model_constants that are defined from the parameters.prm parser....
Definition user_constants.h:253
void remove_parentheses(std::vector< std::string > &tensor_elements)
Remove and leading and trailing parentheses.
Definition user_constants.h:340
Definition conditional_ostreams.cc:20
ElasticityModel
Symmetry of elastic tensor.
Definition type_enums.h:62
@ Transverse
Definition type_enums.h:64
@ Anisotropic
Definition type_enums.h:66
@ Orthotropic
Definition type_enums.h:65
@ Isotropic
Definition type_enums.h:63