svMultiPhysics
Loading...
Searching...
No Matches
consts.h
1// SPDX-FileCopyrightText: Copyright (c) Stanford University, The Regents of the University of California, and others.
2// SPDX-License-Identifier: BSD-3-Clause
3
4#ifndef CONSTS_H
5#define CONSTS_H
6
7#include <iostream>
8#include <limits>
9#include <map>
10#include <set>
11#include <type_traits>
12#include <variant>
13
14// The enums here replicate the PARAMETERs defined
15// in CONSTS.f.
16
17namespace consts {
18
19const int maxNSD = 3;
20
21const int maxNProp = 20;
22
23const int maxOutput = 5;
24
25/// Use inf numeric values to represent a value that is not set.
26const int int_inf = std::numeric_limits<int>::infinity();
27const double double_inf = std::numeric_limits<double>::infinity();
28
29template<typename T>
30int enum_int(T value)
31{
32 return static_cast<int>(value);
33}
34
35/// Check if a value is set to infinity.
36template<typename T>
37bool present(T value)
38{
39 return (value != std::numeric_limits<T>::infinity());
40}
41
42/// @brief Body force types: volumetric (default), traction, Neumann
43/// (pressure based), time dependence (steady, unsteady, spatially
44/// varying, general)
45enum class BodyForceType
46{
47 bfType_vol = 0,
48 bfType_trac = 1,
49 bfType_Neu = 2,
50 bfType_std = 3,
51 bfType_ustd = 4,
52 bfType_spl = 5,
53 bfType_gen = 6
54};
55
56/// @brief Boundary conditions type.
57///
58/// BC types are stored as bitwise values.
59///
60/// boundary conditions types. Items of this list can be combined
61///
62/// - BCs from imposing perspective can be Neu/Dir/per
63///
64/// - BCs time dependence can be std/ustd/cpl/gen/res
65///
66/// - BCs spatial distribution can be flat/para/ud
67///
68/// - Beside these nodes at the boundary perimeter can be set to
69/// zero and flux through surface can be assigned instead of nodal
70/// values.
71///
72/// - Dirichlet, Neumann, Traction, CMM, Robin, steady, unsteady,
73/// coupled, general (combination of ud/ustd), resistance, imposed
74/// flux, zero out perimeter, impose BC on the integral of state
75/// variable or D (instead of Y), flat profile, parabolic profile,
76/// user defined profile, backflow stabilization, BCs for shells
77/// (fixed, hinged, free, symmetric), undeforming Neu, RCR-Neu
78enum class BoundaryConditionType
79{
80 bType_Dir = 0, // Dirichlet
81 bType_Neu = 1, // Neumann
82 bType_trac = 2, // Traction
83 bType_CMM = 3, // CMM
84 bType_Robin = 4, // RObin
85 bType_std = 5, // steady
86 bType_ustd = 6, // unsteady
87 bType_cpl = 7, // coupled
88 bType_gen = 8, // general
89 bType_res = 9, // resistance
90 bType_flx = 10, // imposed flux
91 bType_zp = 11, // zero out perimeter
92 bType_impD = 12, // impose BC on the integral of state variable or D (instead of Y)
93 bType_flat =13, // flat profile
94 bType_para = 14, // parabolic profile
95 bType_ud = 15, // user defined profile
96 bType_bfs = 16, // backflow stabilization
97 bType_fix = 17, // shell fixed
98 bType_hing = 18, // shell hinged
99 bType_free = 19, // shell free
100 bType_symm = 20, // shell symmetric
101 bType_undefNeu = 21, // undeforming Neu
102 bType_RCR = 22, // RCR-Neu
103 bType_Ris0D = 23, // RIS 0D
104 bType_Coupled = 24, // Coupled to 0D
105};
106
107// Define constants using smaller name and integer value (needed for bitwise operations).
108//
109constexpr auto BC_CMM = BoundaryConditionType::bType_CMM;
110constexpr auto iBC_CMM = static_cast<int>(BoundaryConditionType::bType_CMM);
111
112constexpr auto BC_cpl = BoundaryConditionType::bType_cpl;
113constexpr auto iBC_cpl = static_cast<int>(BoundaryConditionType::bType_cpl);
114
115constexpr auto BC_Dir = BoundaryConditionType::bType_Dir;
116constexpr auto iBC_Dir = static_cast<int>(BoundaryConditionType::bType_Dir);
117
118constexpr auto BC_fix = BoundaryConditionType::bType_fix;
119constexpr auto iBC_fix = static_cast<int>(BoundaryConditionType::bType_fix);
120
121constexpr auto BC_flat = BoundaryConditionType::bType_flat;
122constexpr auto iBC_flat = static_cast<int>(BoundaryConditionType::bType_flat);
123
124constexpr auto BC_free = BoundaryConditionType::bType_free;
125constexpr auto iBC_free = static_cast<int>(BoundaryConditionType::bType_free);
126
127constexpr auto BC_gen = BoundaryConditionType::bType_gen;
128constexpr auto iBC_gen = static_cast<int>(BoundaryConditionType::bType_gen);
129
130constexpr auto BC_hing = BoundaryConditionType::bType_hing;
131constexpr auto iBC_hing = static_cast<int>(BoundaryConditionType::bType_hing);
132
133constexpr auto BC_impD = BoundaryConditionType::bType_impD;
134constexpr auto iBC_impD = static_cast<int>(BoundaryConditionType::bType_impD);
135
136constexpr auto BC_Neu = BoundaryConditionType::bType_Neu;
137constexpr auto iBC_Neu = static_cast<int>(BoundaryConditionType::bType_Neu);
138
139constexpr auto BC_Coupled = BoundaryConditionType::bType_Coupled;
140constexpr auto iBC_Coupled = static_cast<int>(BoundaryConditionType::bType_Coupled);
141
142constexpr auto BC_para = BoundaryConditionType::bType_para;
143constexpr auto iBC_para = static_cast<int>(BoundaryConditionType::bType_para);
144
145constexpr auto BC_RCR = BoundaryConditionType::bType_RCR;
146constexpr auto iBC_RCR = static_cast<int>(BoundaryConditionType::bType_RCR);
147
148constexpr auto BC_res = BoundaryConditionType::bType_res;
149constexpr auto iBC_res = static_cast<int>(BoundaryConditionType::bType_res);
150
151constexpr auto BC_Robin = BoundaryConditionType::bType_Robin;
152constexpr auto iBC_Robin = static_cast<int>(BoundaryConditionType::bType_Robin);
153
154constexpr auto BC_std = BoundaryConditionType::bType_std;
155constexpr auto iBC_std = static_cast<int>(BoundaryConditionType::bType_std);
156
157constexpr auto BC_symm = BoundaryConditionType::bType_symm;
158constexpr auto iBC_symm = static_cast<int>(BoundaryConditionType::bType_symm);
159
160constexpr auto BC_trac = BoundaryConditionType::bType_trac;
161constexpr auto iBC_trac = static_cast<int>(BoundaryConditionType::bType_trac);
162
163constexpr auto BC_undefNeu = BoundaryConditionType::bType_undefNeu;
164constexpr auto iBC_undefNeu = static_cast<int>(BoundaryConditionType::bType_undefNeu);
165
166constexpr auto BC_ustd = BoundaryConditionType::bType_ustd;
167constexpr auto iBC_ustd = static_cast<int>(BoundaryConditionType::bType_ustd);
168
169constexpr auto BC_Ris0D = BoundaryConditionType::bType_Ris0D;
170constexpr auto iBC_Ris0D = static_cast<int>(BoundaryConditionType::bType_Ris0D);
171
172//-----------------------
173// ConstitutiveModelType
174//-----------------------
175// Constitutive model (isochoric) type for structure equation:
176//
177enum class ConstitutiveModelType
178{
179 stIso_NA = 600,
180 stIso_StVK = 601,
181 stIso_mStVK = 602,
182 stIso_nHook = 603,
183 stIso_MR = 604,
184 stIso_HGO = 605,
185 stIso_lin = 606,
186 stIso_Gucci = 607,
187 stIso_HO = 608,
188 stIso_HO_ma = 610,
189 stIso_LS = 611,
190 stVol_NA = 650,
191 stVol_Quad = 651,
192 stVol_ST91 = 652,
193 stVol_M94 = 653,
194 stArtificialNeuralNet = 654
195};
196
197/// @brief Map for constitutive_model string to ConstitutiveModelType.
198extern const std::map<std::string,ConstitutiveModelType> constitutive_model_name_to_type;
199
200enum class ContactModelType
201{
202 cntctM_NA = 800,
203 cntctM_penalty = 801,
204 cntctM_potential = 802
205};
206
207/// @brief Map for model type string to ContactModelType.
208extern const std::map<std::string,ContactModelType> contact_model_name_to_type;
209
210/// @brief Differenty type of coupling for cplBC.
211///
212/// \code {.f}
213/// INTEGER(KIND=IKIND), PARAMETER :: cplBC_NA = 400, cplBC_I = 401,
214/// cplBC_SI = 402, cplBC_E = 403
215//
216/// INTEGER(KIND=IKIND), PARAMETER :: cplBC_Dir = 66112, cplBC_Neu = 66113
217/// \endcode
218//
219enum class CplBCType
220{
221 cplBC_NA = 400,
222 cplBC_Dir = 66112, // Dirichlet type coupling
223 cplBC_E = 403, // explicit
224 cplBC_I = 401, // implicit
225 cplBC_Neu = 66113, // Neumann type coupling
226 cplBC_SI = 402, // semi-implicit
227 cplBC_Coupled = 66114, // Coupled
228};
229
230/// @brief Map for cplBC type to CplBCType.
231extern const std::map<std::string,CplBCType> cplbc_name_to_type;
232
233/// @brief Element type replicating eType_NA, eType_PNT, etc.
234//
235enum class ElementType
236{
237 NA = 100,
238 PNT = 101,
239 LIN1 = 102,
240 LIN2 = 103,
241 TRI3 = 104,
242 TRI6 = 105,
243 QUD4 = 106,
244 QUD8 = 107,
245 QUD9 = 108,
246 TET4 = 109,
247 TET10 = 110,
248 HEX8 = 111,
249 HEX20 = 112,
250 HEX27 = 113,
251 WDG = 114,
252 NRB = 115
253};
254
255extern const std::map<ElementType,std::string> element_type_to_string;
256extern const std::map<ElementType,int> element_type_to_elem_nonb;
257extern const std::map<ElementType,int> element_dimension;
258
259// Template for printing ElementType.
260/*
261template<typename T>
262std::ostream& operator<<(typename std::enable_if<std::is_enum<T>::value, std::ostream>::type& stream, const T& e)
263{
264 return stream << static_cast<typename std::underlying_type<T>::type>(e);
265}
266*/
267
268/// @brief Types of equations that are included in this solver.
269///
270/// Fluid equation (Navier-Stokes), nonlinear structure (pure d), heat
271/// equation, linear elasticity, heat in fluid (advection-diffusion),
272/// fluid-structure-interaction, mesh motion, Shell mechanics,
273/// Coupled-Momentum-Method, Cardiac Electro-Physiology,
274/// Nonlinear structure (v-p), Stokes equations
275//
276enum class EquationType
277{
278 phys_NA = 200,
279 phys_fluid = 201,
280 phys_struct = 202, // nonlinear structure (pure d)
281 phys_heatS = 203,
282 phys_lElas = 204,
283 phys_heatF = 205,
284 phys_FSI = 206,
285 phys_mesh = 207, // solves a modified lElas for mesh motion; should be used with FSI
286 phys_shell = 208, // solves nonlinear thin shell mechanics (Kirchhoff-Love theory)
287 phys_CMM = 209,
288 phys_CEP = 210,
289 phys_ustruct = 211, // Nonlinear elastodynamics using mixed VMS-stabilized formulation
290 phys_stokes = 212,
291 phys_darcy = 213
292};
293
294constexpr auto Equation_darcy = EquationType::phys_darcy;
295constexpr auto Equation_CMM = EquationType::phys_CMM;
296constexpr auto Equation_CEP = EquationType::phys_CEP;
297constexpr auto Equation_fluid = EquationType::phys_fluid;
298constexpr auto Equation_FSI = EquationType::phys_FSI;
299constexpr auto Equation_heatF = EquationType::phys_heatF;
300constexpr auto Equation_heatS = EquationType::phys_heatS;
301constexpr auto Equation_lElas = EquationType::phys_lElas;
302constexpr auto Equation_mesh = EquationType::phys_mesh;
303constexpr auto Equation_shell = EquationType::phys_shell;
304constexpr auto Equation_stokes = EquationType::phys_stokes;
305constexpr auto Equation_struct = EquationType::phys_struct;
306constexpr auto Equation_ustruct = EquationType::phys_ustruct;
307
308extern const std::map<std::string,EquationType> equation_name_to_type;
309
310enum class MeshGeneratorType
311{
312 RMSH_TETGEN = 1,
313 RMSH_MESHSIM = 2
314};
315
316/// Map for string to MeshGeneratorType.
317extern const std::map<std::string,MeshGeneratorType> mesh_generator_name_to_type;
318
319enum class OutputNameType {
320 outGrp_NA = 500,
321 outGrp_A = 501,
322 outGrp_Y = 502,
323 outGrp_D = 503,
324 outGrp_I = 504,
325 outGrp_WSS = 505,
326 outGrp_trac = 506,
327 outGrp_vort = 507,
328 outGrp_vortex = 508,
329 outGrp_stInv = 509,
330 outGrp_eFlx = 510,
331 outGrp_hFlx = 511,
332 outGrp_absV = 512,
333 outGrp_fN = 513,
334 outGrp_fA = 514,
335 outGrp_stress = 515,
336 outGrp_cauchy = 516,
337 outGrp_mises = 517,
338 outGrp_J = 518,
339 outGrp_F = 519,
340 outGrp_strain = 520,
341 outGrp_divV = 521,
342 outGrp_Visc = 522,
343 outGrp_fS = 523,
344 outGrp_C = 524,
345 outGrp_I1 = 525,
346 outGrp_ionicState = 526,
347 outGrp_fibStretch = 527,
348 outGrp_fibStretchRate = 528,
349 outGrp_activeTensionFibers = 529,
350 outGrp_activeTensionSheets = 530,
351 outGrp_activeTensionNormal = 531,
352 outGrp_darcyFlux = 532,
353
354 out_velocity = 599,
355 out_pressure = 598,
356 out_temperature = 597,
357 out_voltage = 596,
358 out_acceleration = 595,
359 out_displacement = 594,
360 out_integ = 593,
361 out_WSS = 592,
362 out_traction = 591,
363 out_vorticity = 590,
364 out_vortex = 589,
365 out_strainInv = 588,
366 out_energyFlux = 587,
367 out_heatFlux = 586,
368 out_absVelocity = 585,
369 out_fibDir = 584,
370 out_fibAlign = 583,
371 out_stress = 582,
372 out_cauchy = 581,
373 out_mises = 580,
374 out_jacobian = 579,
375 out_defGrad = 578,
376 out_strain = 577,
377 out_divergence = 576,
378 out_viscosity = 575,
379 out_fibStrn = 574,
380 out_CGstrain = 573,
381 out_CGInv1 = 572,
382 out_fibStretch = 571,
383 out_fibStretchRate = 570,
384 out_activeTensionFibers = 569,
385 out_activeTensionSheets = 568,
386 out_activeTensionNormal = 567,
387 out_darcyPressure = 566,
388 out_darcyFlux = 565
389};
390
391/// @brief Simulation output file types.
392//
393enum class OutputType
394{
395 boundary_integral,
396 spatial,
397 volume_integral
398};
399
400extern const std::map<std::string,OutputType> output_type_name_to_type;
401
402/// @brief Possible physical properties. Current maxNPror is 20.
403//
404enum class PhysicalPropertyType
405{
406 NA = 0,
407 fluid_density = 1,
408 solid_density = 2,
409 elasticity_modulus = 3,
410 poisson_ratio = 4,
411 conductivity = 5,
412 f_x = 6, // internal force x
413 f_y = 7, // internal force y
414 f_z = 8, // internal force z
415 backflow_stab = 9, // stabilization coeff. for backflow divergence
416 source_term = 10, // external source
417 damping = 11,
418 shell_thickness = 12,
419 ctau_M = 13, // stabilization coeffs. for USTRUCT (momentum, continuity)
420 ctau_C = 14,
421 brinkman_inverse_permeability = 15,
422 darcy_permeability = 16,
423 darcy_compressibility = 17,
424 darcy_fluid_viscosity = 18
425};
426
427enum class PreconditionerType
428{
429 PREC_NONE = 700,
430 PREC_FSILS = 701,
431 PREC_TRILINOS_DIAGONAL = 702,
432 PREC_TRILINOS_BLOCK_JACOBI = 703,
433 PREC_TRILINOS_ILU = 704,
434 PREC_TRILINOS_ILUT = 705,
435 PREC_TRILINOS_RILUK0 = 706,
436 PREC_TRILINOS_RILUK1 = 707,
437 PREC_TRILINOS_ML = 708,
438 PREC_RCS = 709,
439 PREC_PETSC_JACOBI = 710,
440 PREC_PETSC_RCS = 711
441};
442
443extern const std::set<PreconditionerType> fsils_preconditioners;
444extern const std::set<PreconditionerType> petsc_preconditioners;
445extern const std::set<PreconditionerType> trilinos_preconditioners;
446extern const std::map<PreconditionerType, std::string> preconditioner_type_to_name;
447
448/// Map for preconditioner type string to PreconditionerType enum.
449extern const std::map<std::string,PreconditionerType> preconditioner_name_to_type;
450
451enum class SolverType
452{
453 lSolver_NA = 799,
454 lSolver_CG = 798,
455 lSolver_GMRES = 797,
456 lSolver_NS = 796,
457 lSolver_BICGS = 795
458};
459
460/// Map for solver type string to SolverType enum.
461extern const std::map<std::string,SolverType> solver_name_to_type;
462
463enum class FluidViscosityModelType
464{
465 viscType_CY = 697,
466 viscType_Cass = 696,
467 viscType_Const = 698,
468 viscType_NA = 699
469};
470
471/// Map for fluid viscosity model string to FluidViscosityModelType.
472extern const std::map<std::string,FluidViscosityModelType> fluid_viscosity_model_name_to_type;
473
474enum class SolidViscosityModelType
475{
476 viscType_NA = 695,
477 viscType_Newtonian = 694,
478 viscType_Potential = 693
479};
480
481/// Map for solid viscosity model string to SolidViscosityModelType.
482extern const std::map<std::string,SolidViscosityModelType> solid_viscosity_model_name_to_type;
483
484/// Template for printing enum class types as an int.
485template<typename T>
486std::ostream& operator<<(typename std::enable_if<std::is_enum<T>::value, std::ostream>::type& stream, const T& e)
487{
488 return stream << static_cast<typename std::underlying_type<T>::type>(e);
489}
490
491//// Mechanical configurations
492enum class MechanicalConfigurationType
493{
494 reference, // reference configuration
495 old_timestep, // old timestep (n) configuration
496 new_timestep // new timestep (n+1) configuration
497};
498
499//-------------------
500// LinearAlgebraType
501//-------------------
502// The type of the numerical linear algebra library.
503//
504enum class LinearAlgebraType {
505 none,
506 fsils,
507 petsc,
508 trilinos
509};
510
511
512};
513
514#endif