svFSIplus
ComMod.h
1 /* Copyright (c) Stanford University, The Regents of the University of California, and others.
2  *
3  * All Rights Reserved.
4  *
5  * See Copyright-SimVascular.txt for additional details.
6  *
7  * Permission is hereby granted, free of charge, to any person obtaining
8  * a copy of this software and associated documentation files (the
9  * "Software"), to deal in the Software without restriction, including
10  * without limitation the rights to use, copy, modify, merge, publish,
11  * distribute, sublicense, and/or sell copies of the Software, and to
12  * permit persons to whom the Software is furnished to do so, subject
13  * to the following conditions:
14  *
15  * The above copyright notice and this permission notice shall be included
16  * in all copies or substantial portions of the Software.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
19  * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
21  * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
22  * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
25  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
26  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29  */
30 
31 // The classes defined here duplicate the data structures in the Fortran COMMOD module
32 // defined in MOD.f.
33 //
34 // All of the data structures used for the mesh, boundarsy conditions and solver parameters, etc.
35 // are defined here.
36 
37 #ifndef COMMOD_H
38 #define COMMOD_H
39 
40 #include "Array.h"
41 #include "Array3.h"
42 #include "CepMod.h"
43 #include "ChnlMod.h"
44 #include "CmMod.h"
45 #include "Timer.h"
46 #include "Vector.h"
47 
48 #include "DebugMsg.h"
49 
50 #include "consts.h"
51 
52 #include "fils_struct.hpp"
53 
54 #include <array>
55 #include <iostream>
56 #include <string>
57 #include <vector>
58 
59 class LinearAlgebra;
60 
61 /// @brief Fourier coefficients that are used to specify unsteady BCs
62 //
63 class fcType
64 {
65  public:
66 
67  bool defined() { return n != 0; };
68 
69  // If this is a ramp function
70  bool lrmp = false;
71 
72  // Number of Fourier coefficient
73  int n = 0;
74 
75  // No. of dimensions (scalar or vector)
76  int d = 0;
77 
78  // Initial value
79  Vector<double> qi;
80 
81  // Time derivative of linear part
82  Vector<double> qs;
83 
84  // Period
85  double T = 0.0;
86 
87  // Initial time
88  double ti = 0.0;
89 
90  // Imaginary part of coefficint
91  Array<double> i;
92 
93  // Real part of coefficint
94  Array<double> r;
95 };
96 
97 /// @brief Moving boundary data structure (used for general BC)
98 //
99 class MBType
100 {
101  public:
102 
103  bool defined() { return dof != 0; };
104 
105  // Degrees of freedom of d(:,.,.)
106  int dof = 0;
107 
108  // Number of time points to be read
109  int nTP = 0;
110 
111  // The period of data
112  double period = 0.0;
113 
114  // Time points
115  Vector<double> t;
116 
117  // Displacements at each direction, location, and time point
118  Array3<double> d;
119 };
120 
121 class rcrType
122 {
123  public:
124 
125  // Proximal resistance
126  double Rp = 0.0;
127 
128  // Capacitance
129  double C = 0.0;
130 
131  // Distance resistance
132  double Rd = 0.0;
133 
134  // Distal pressure
135  double Pd = 0.0;
136 
137  // Initial value
138  double Xo = 0.0;
139 };
140 
141 /// @brief Boundary condition data type
142 //
143 class bcType
144 {
145  public:
146 
147  // Strong/Weak application of Dirichlet BC
148  bool weakDir = false;
149 
150  // Whether load vector changes with deformation
151  // (Neu - struct/ustruct only)
152  bool flwP = false;
153 
154  // Robin: apply only in normal direction
155  bool rbnN = false;
156 
157  // Pre/Res/Flat/Para... boundary types
158  //
159  // This stores differnt BCs as bitwise values.
160  //
161  int bType = 0;
162 
163  // Pointer to coupledBC%face
164  int cplBCptr = -1;
165 
166  // The face index that corresponds to this BC
167  int iFa = -1;
168 
169  // The mesh index that corresponds to this BC
170  int iM = -1;
171 
172  // Pointer to FSILS%bc
173  int lsPtr = -1;
174 
175  // Undeforming Neu BC master-slave node parameters.
176  int masN = 0;
177 
178  // Defined steady value
179  double g = 0.0;
180 
181  // Neu: defined resistance
182  double r = 0.0;
183 
184  // Robin: stiffness
185  double k = 0.0;
186 
187  // Robin: damping
188  double c = 0.0;
189 
190  // Penalty parameters for weakly applied Dir BC
191  Vector<double> tauB{0.0, 0.0};
192  //double tauB[2];
193 
194  // Direction vector for imposing the BC
195  Vector<int> eDrn;
196 
197  // Defined steady vector (traction)
198  Vector<double> h;
199 
200  // Spatial dependant BC (profile data)
201  Vector<double> gx;
202 
203  // General BC (unsteady and UD combination)
204  //
205  // This is declare ALLOCATABLE in MOD.f.
206  //
207  MBType gm;
208 
209  // Time dependant BC (Unsteady imposed value);
210  //
211  // This is declare ALLOCATABLE in MOD.f.
212  //
213  fcType gt;
214 
215  // Neu: RCR
216  rcrType RCR;
217 };
218 
219 /// @brief Class storing data for B-Splines.
220 //
221 class bsType
222 {
223  public:
224 
225  // Number of knots (p + nNo + 1)
226  int n = 0;
227 
228  // Number of Gauss points for integration
229  int nG = 0;
230 
231  // Number of knot spans (element)
232  int nEl = 0;
233 
234  // Number of control points (nodes)
235  int nNo = 0;
236 
237  // Number of sample points in each element (for output)
238  int nSl = 0;
239 
240  // The order
241  int p = 0;
242 
243  // Knot vector.
244  Vector<double> xi;
245 };
246 
247 /// @brief Function spaces (basis) type.
248 //
249 class fsType {
250 
251  public:
252 
253  fsType();
254 
255  void destroy();
256 
257  // Whether the basis function is linear
258  bool lShpF = false;
259 
260  // Element type
261  consts::ElementType eType = consts::ElementType::NA;
262 
263  // Number of basis functions, typically equals msh%eNoN
264  int eNoN = 0;
265 
266  // Number of Gauss points for integration
267  int nG = 0;
268 
269  // Gauss weights
270  Vector<double> w;
271 
272  // Gauss integration points in parametric space
273  Array<double> xi;
274 
275  // Bounds on Gauss integration points in parametric space
276  Array<double> xib;
277 
278  // Parent shape function
279  Array<double> N;
280 
281  // Bounds on shape functions
282  Array<double> Nb;
283 
284  // Parent shape functions gradient
285  Array3<double> Nx;
286 
287  // Second derivatives of shape functions - used for shells & IGA
288  Array3<double> Nxx;
289 };
290 
291 //--------
292 // bfType
293 //--------
294 // Body force data structure type
295 //
296 class bfType
297 {
298  public:
299 
300  std::string file_name;
301  std::string mesh_name;
302 
303  // Type of body force applied
304  int bType = 0;
305 
306  // No. of dimensions (1 or nsd)
307  int dof = 0;
308 
309  // Mesh index corresponding to this body force
310  int iM = -1;
311 
312  // Steady value
313  Vector<double> b;
314 
315  // Steady but spatially dependant
316  Array<double> bx;
317 
318  // Time dependant (unsteady imposed value)
319  fcType bt;
320 
321  // General (unsteady and spatially dependent combination)
322  MBType bm;
323 };
324 
325 // Fiber stress type
327 {
328  public:
329 
330  // Type of fiber stress
331  int fType = 0;
332 
333  // Constant steady value
334  double g = 0.0;
335 
336  // Cross fiber stress parameter
337  double eta_s = 0.0;
338 
339  // Unsteady time-dependent values
340  fcType gt;
341 };
342 
343 /// @brief Structural domain type
344 //
346 {
347  public:
348  // Type of constitutive model (volumetric) for struct/FSI
349  consts::ConstitutiveModelType volType = consts::ConstitutiveModelType::stIso_NA;
350 
351  // Penalty parameter
352  double Kpen = 0.0;
353 
354  // Type of constitutive model (isochoric) for struct/FSI
355  consts::ConstitutiveModelType isoType = consts::ConstitutiveModelType::stIso_NA;
356 
357  // Parameters specific to the constitutive model (isochoric)
358  // NeoHookean model (C10 = mu/2)
359  double C10 = 0.0;
360 
361  // Mooney-Rivlin model (C10, C01)
362  double C01 = 0.0;
363 
364  // Holzapfel model(a, b, aff, bff, ass, bss, afs, bfs, kap)
365  double a = 0.0;
366  double b = 0.0;
367  double aff = 0.0;
368  double bff = 0.0;
369  double ass = 0.0;
370  double bss = 0.0;
371  double afs = 0.0;
372  double bfs = 0.0;
373 
374  // Collagen fiber dispersion parameter (Holzapfel model)
375  double kap = 0.0;
376 
377  // Heaviside function parameter (Holzapfel-Ogden model)
378  double khs = 100.0;
379 
380  // Lee-Sacks model
381  double a0 = 0.0;
382  double b1 = 0.0;
383  double b2 = 0.0;
384  double mu0 = 0.0;
385 
386  // Fiber reinforcement stress
387  fibStrsType Tf;
388 };
389 
390 /// @brief Fluid viscosity model type
391 //
393 {
394  public:
395 
396  // Type of constitutive model for fluid viscosity
397  consts::FluidViscosityModelType viscType = consts::FluidViscosityModelType::viscType_NA;
398 
399  // Limiting zero shear-rate viscosity value
400  double mu_o = 0.0;
401 
402  // Limiting high shear-rate viscosity (asymptotic) value (at infinity)
403  double mu_i = 0.0;
404 
405  // Strain-rate tensor multiplier
406  double lam = 0.0;
407 
408  // Strain-rate tensor exponent
409  double a = 0.0;
410 
411  // Power-law exponent
412  double n = 0.0;
413 };
414 
415 /// @brief Fluid viscosity model type
416 //
418 {
419  public:
420 
421  // Type of constitutive model for fluid viscosity
422  consts::SolidViscosityModelType viscType = consts::SolidViscosityModelType::viscType_NA;
423 
424  // Viscosity value
425  double mu = 0.0;
426 };
427 
428 /// @brief Domain type is to keep track with element belong to which domain
429 /// and also different physical quantities
430 //
431 class dmnType
432 {
433  public:
434  dmnType();
435  ~dmnType();
436 
437  // The domain ID. Default includes entire domain
438  int Id = -1;
439 
440  // Which physics must be solved in this domain
441  consts::EquationType phys = consts::EquationType::phys_NA;
442 
443  // The volume of this domain
444  double v = 0.0;
445 
446  // General physical properties such as density, elastic modulus...
447  // FIX davep double prop[maxNProp] ;
448  std::map<consts::PhysicalProperyType,double> prop;
449  //double prop[consts::maxNProp];
450 
451  // Electrophysiology model
452  cepModelType cep;
453 
454  // Structure material model
455  stModelType stM;
456 
457  // Viscosity model for fluids
458  fluidViscModelType fluid_visc;
459 
460  // Viscosity model for solids
461  solidViscModelType solid_visc;
462 };
463 
464 /// @brief Mesh adjacency (neighboring element for each element)
465 //
466 class adjType
467 {
468  public:
469  void destroy();
470 
471  // No of non-zeros
472  int nnz = 0;
473 
474  // Column pointer
475  Vector<int> pcol;
476 
477  // Row pointer
478  Vector<int> prow;
479 
480 };
481 
482 /// @brief Tracer type used for immersed boundaries. Identifies traces of
483 /// nodes and integration points on background mesh elements
484 //
486 {
487  public:
488  // No. of non-zero nodal traces
489  int n = 0;
490 
491  // No. of non-zero integration point traces
492  int nG = 0;
493 
494  // Local to global nodes maping nNo --> tnNo
495  Vector<int> gN;
496 
497  // Self pointer of each trace to the IB integration point and
498  // element ID
499  Array<int> gE;
500 
501  // Nodal trace pointer array stores two values for each trace.
502  // (1) background mesh element to which the trace points to,
503  // (2) mesh ID
504  Array<int> nptr;
505 
506  // Integration point tracer array stores two values for each trace
507  // (1) background mesh element to which the trace points to,
508  // (2) mesh ID
509  Array<int> gptr;
510 
511  // Parametric coordinate for each nodal trace
512  Array<double> xi;
513 
514  // Parametric coordinate for each Gauss point trace
515  Array<double> xiG;
516 };
517 
518 /// @brief The face type containing mesh at boundary
519 //
520 class faceType
521 {
522  public:
523  faceType();
524  ~faceType();
525 
526  void destroy();
527 
528  //faceType& operator=(const faceType& rhs);
529 
530  // Parametric direction normal to this face (NURBS)
531  int d = 0;
532 
533  // Number of nodes (control points) in a single element
534  int eNoN = 0;
535 
536  // Element type
537  consts::ElementType eType = consts::ElementType::NA;
538 
539  // The mesh index that this face belongs to
540  int iM = 0;
541 
542  // Number of elements
543  int nEl = 0;
544 
545  // Global number of elements
546  int gnEl = 0;
547 
548  // Number of function spaces
549  int nFs = 0;
550 
551  // Number of Gauss points for integration
552  int nG = 0;
553 
554  // Number of nodes
555  int nNo = 0;
556 
557  // Global element Ids
558  Vector<int> gE;
559 
560  // Global node Ids
561  Vector<int> gN;
562 
563  // Global to local maping tnNo --> nNo
564  Vector<int> lN;
565 
566  // Connectivity array
567  Array<int> IEN;
568 
569  // EBC array (gE + gIEN)
570  Array<int> gebc;
571 
572  // Surface area
573  double area = 0.0;
574 
575  // Gauss point weights
576  Vector<double> w;
577 
578  // Position coordinates
579  Array<double> x;
580 
581  // Gauss points in parametric space
582  Array<double> xi;
583 
584  // Shape functions at Gauss points
585  Array<double> N;
586 
587  // Normal vector to each nodal point
588  Array<double> nV;
589 
590  // Shape functions derivative at Gauss points
591  // double Nx(:,:,:);
592  Array3<double> Nx;
593 
594  // Second derivatives of shape functions - for shells & IGA
595  // double Nxx(:,:,:);
596  Array3<double> Nxx;
597 
598  // Face name for flux files
599  std::string name;
600 
601  // Face nodal adjacency
602  adjType nAdj;
603 
604  // Face element adjacency
605  adjType eAdj;
606 
607  // Function spaces (basis)
608  std::vector<fsType> fs;
609 
610  // TRI3 quadrature modifier
611  double qmTRI3 = 2.0/3.0;
612 };
613 
614 /// @brief Declared type for outputed variables
615 //
617 {
618  public:
619 
620  // Is this output suppose to be written into VTK, boundary, vol
621  std::vector<bool> wtn{false, false, false};
622 
623  // The group that this belong to (one of outType_*)
624  consts::OutputType grp = consts::OutputType::outGrp_NA;
625  //int grp;
626 
627  // Length of the outputed variable
628  int l = 0;
629 
630  // Offset from the first index
631  int o = 0;
632 
633  // The name to be used for the output and also in input file
634  std::string name;
635 };
636 
637 /// @brief Linear system of equations solver type
638 //
639 class lsType
640 {
641  public:
642 
643  /// @brief LS solver (IN)
644  consts::SolverType LS_type = consts::SolverType::lSolver_NA;
645 
646  /// @brief Successful solving (OUT)
647  bool suc = false;
648 
649  /// @brief Maximum iterations (IN)
650  int mItr = 1000;
651 
652  /// @brief Space dimension (IN)
653  int sD = 0;
654 
655  /// @brief Number of iteration (OUT)
656  int itr = 0;
657 
658  /// @brief Number of Ax multiple (OUT)
659  int cM = 0;
660 
661  /// @brief Number of |x| norms (OUT)
662  int cN = 0;
663 
664  /// @brief Number of <x.y> dot products (OUT)
665  int cD = 0;
666 
667  /// @brief Only for data alignment (-)
668  int reserve = 0;
669 
670  /// @brief Absolute tolerance (IN)
671  double absTol = 1e-08;
672 
673  /// @brief Relative tolerance (IN)
674  double relTol = 0.0;
675 
676  /// @brief Initial norm of residual (OUT)
677  double iNorm = 0.0;
678 
679  /// @brief Final norm of residual (OUT)
680  double fNorm = 0.0;
681 
682  /// @brief Res. rduction in last itr. (OUT)
683  double dB = 0.0;
684 
685  /// @brief Calling duration (OUT)
686  double callD = 0.0;
687 
688  //@brief Configuration file for linear solvers (Trilinos, PETSc)
689  std::string config;
690 };
691 
692 
693 /// @brief Contact model type
694 //
696 {
697  public:
698  // Contact model
699  consts::ContactModelType cType = consts::ContactModelType::cntctM_NA;
700 
701  // Penalty parameter
702  double k = 0.0;
703 
704  // Min depth of penetration
705  double h = 0.0;
706 
707  // Max depth of penetration
708  double c = 0.0;
709 
710  // Min norm of face normals in contact
711  double al = 0.0;
712 
713  // Tolerance
714  double tol = 0.0;
715 };
716 
718 {
719  public:
720  // GenBC_Dir/GenBC_Neu
721  consts::CplBCType bGrp = consts::CplBCType::cplBC_NA;
722 
723  // Pointer to X
724  int Xptr = -1;
725 
726  // Internal genBC use
727  int eqv = 0;
728 
729  // Flow rates at t
730  double Qo = 0.0;
731 
732  // Flow rates at t+dt
733  double Qn = 0.0;
734 
735  // Pressures at t
736  double Po = 0.0;
737 
738  // Pressures at t+dt
739  double Pn = 0.0;
740 
741  // Imposed flow/pressure
742  double y = 0.0;
743 
744  // Name of the face
745  std::string name;
746 
747  // RCR type BC
748  rcrType RCR;
749 };
750 
751 /// @brief For coupled 0D-3D problems
752 //
754 {
755  public:
756  cplBCType();
757  /// @brief Is multi-domain active
758  bool coupled = false;
759 
760  /// @brief Whether to use genBC
761  bool useGenBC = false;
762 
763  // Whether to use svZeroD
764  bool useSvZeroD = false;
765 
766  // Whether to initialize RCR from flow data
767  bool initRCR = false;
768 
769  /// @brief Number of coupled faces
770  int nFa = 0;
771 
772  /// @brief Number of unknowns in the 0D domain
773  int nX = 0;
774 
775  /// @brief Number of output variables addition to nX
776  int nXp = 0;
777 
778  /// @brief Implicit/Explicit/Semi-implicit schemes
779  consts::CplBCType schm = consts::CplBCType::cplBC_NA;
780  //int schm = cplBC_NA;
781 
782  /// @brief Path to the 0D code binary file
783  std::string binPath;
784 
785  /// @brief File name for communication between 0D and 3D
786  std::string commuName;
787  //std::string commuName = ".CPLBC_0D_3D.tmp";
788 
789  /// @brief The name of history file containing "X"
790  std::string saveName;
791  //std::string(LEN=stdL) :: saveName = "LPN.dat";
792 
793  /// @brief New time step unknowns in the 0D domain
795 
796  /// @brief Old time step unknowns in the 0D domain
798 
799  /// @brief Output variables to be printed
801 
802  /// @brief Data structure used for communicating with 0D code
803  std::vector<cplFaceType> fa;
804 };
805 
806 /// @brief This is the container for a mesh or NURBS patch, those specific
807 /// to NURBS are noted
808 //
809 class mshType
810 {
811  public:
812  mshType();
813  std::string dname = "";
814 
815 /*
816  mshType(const mshType &other)
817  {
818  std::cout << "c c c c c mshType copy c c c c c" << std::endl;
819  }
820 
821  mshType& operator = (const mshType &other)
822  {
823  std::cout << "= = = = = mshType assignment = = = = =" << std::endl;
824  return *this;
825  }
826 */
827 
828  ~mshType()
829  {
830  //std::cout << "- - - - - mshType dtor - - - - - dname: " << dname << std::endl;
831  };
832 
833  /// @brief Whether the shape function is linear
834  bool lShpF = false;
835 
836  /// @brief Whether the mesh is shell
837  bool lShl = false;
838 
839  /// @brief Whether the mesh is fibers (Purkinje)
840  bool lFib = false;
841 
842  /// @brief Element type
843  consts::ElementType eType = consts::ElementType::NA;
844  //int eType = eType_NA
845 
846  /// @brief Number of nodes (control points) in a single element
847  int eNoN = 0;
848 
849  /// @brief Global number of elements (knot spans)
850  int gnEl = 0;
851 
852  /// @brief Global number of nodes (control points) on a single mesh
853  int gnNo = 0;
854 
855  /// @brief Number of element face. Used for reading Gambit mesh files
856  int nEf = 0;
857 
858  /// @brief Number of elements (knot spans)
859  int nEl = 0;
860 
861  /// @brief Number of faces
862  int nFa = 0;
863 
864  /// @brief Number of function spaces
865  int nFs = 0;
866 
867  /// @brief Number of Gauss points for integration
868  int nG = 0;
869 
870  /// @brief Number of nodes (control points) for 2D elements?
871  int nNo = 0;
872 
873  /// @brief Number of elements sample points to be outputs (NURBS)
874  int nSl = 0;
875 
876  /// @brief The element type recognized by VTK format
877  int vtkType = 0;
878 
879  /// @brief Number of fiber directions
880  int nFn = 0;
881 
882  /// @brief Mesh scale factor
883  double scF = 0.0;
884 
885  /// @brief IB: Mesh size parameter
886  double dx = 0.0;
887 
888  /// @breif ordering: node ordering for boundaries
889  std::vector<std::vector<int>> ordering;
890 
891  /// @brief Element distribution between processors
893 
894  /// @brief Element domain ID number
896 
897  /// @brief Global nodes maping nNo --> tnNo
899 
900  /// @brief GLobal projected nodes mapping projected -> unprojected mapping
902 
903  /// @brief Global connectivity array mappig eNoN,nEl --> gnNo
904  Array<int> gIEN;
905 
906  /// @brief The connectivity array mapping eNoN,nEl --> nNo
907  Array<int> IEN;
908 
909  /// @brief gIEN mapper from old to new
911 
912  /// @brief Local knot pointer (NURBS)
913  Array<int> INN;
914 
915  /// @brief Global to local maping tnNo --> nNo
917 
918  /// @brief Shells: extended IEN array with neighboring nodes
919  Array<int> eIEN;
920 
921  /// @brief Shells: boundary condition variable
922  Array<int> sbc;
923 
924  /// @brief IB: Whether a cell is a ghost cell or not
926 
927  /// @brief Control points weights (NURBS)
929 
930  /// @brief Gauss weights
932 
933  /// @brief Gauss integration points in parametric space
934  Array<double> xi;
935 
936  /// @brief Bounds on parameteric coordinates
937  Array<double> xib;
938 
939  /// @brief Position coordinates (not always, however, as they get overwritten by read_vtu_pdata())
940  Array<double> x;
941 
942  /// @brief Parent shape function
943  Array<double> N;
944 
945  /// @brief Shape function bounds
946  Array<double> Nb;
947 
948  /// @brief Normal vector to each nodal point (for Shells)
949  Array<double> nV;
950 
951  /// @brief Fiber orientations stored at the element level - used for
952  /// electrophysiology and solid mechanics
953  Array<double> fN;
954 
955  /// @brief Parent shape functions gradient
956  /// double Nx(:,:,:)
958 
959  /// @brief Second derivatives of shape functions - used for shells & IGA
960  /// davep double Nxx(:,:,:)
962 
963  /// @brief Solution field (displacement, velocity, pressure, etc.) for a known, potentially
964  /// time-varying, quantity of interest across a mesh
966 
967  /// @brief Mesh Name
968  std::string name;
969 
970  /// @brief Mesh nodal adjacency
972 
973  /// @brief Mesh element adjacency
975 
976  /// @brief Function spaces (basis)
977  std::vector<fsType> fs;
978 
979  /// @brief BSpline in different directions (NURBS)
980  std::vector<bsType> bs;
981 
982  /// @brief Faces are stored in this variable
983  std::vector<faceType> fa;
984 
985  /// @brief IB: tracers
987 
988  /// @brief TET4 quadrature modifier
989  double qmTET4 = (5.0+3.0*sqrt(5.0))/20.0;
990 
991  private:
992  //mshType(const mshType&);
993  //mshType& operator=(const mshType&);
994 
995 };
996 
997 /// @brief Equation type
998 //
999 class eqType
1000 {
1001  public:
1002  eqType();
1003  ~eqType();
1004 
1005  /// @brief Should be satisfied in a coupled/uncoupled fashion
1006  bool coupled = false;
1007  //bool coupled = .TRUE.
1008 
1009  /// @brief Satisfied/not satisfied
1010  bool ok = false;
1011 
1012  /// @brief Use C++ Trilinos framework for the linear solvers
1013  bool useTLS = false;
1014 
1015  /// @brief Use C++ Trilinos framework for assembly and for linear solvers
1016  bool assmTLS = false;
1017 
1018  /// @brief Degrees of freedom
1019  int dof = 0;
1020 
1021  /// @brief Pointer to end of unknown Yo(:,s:e)
1022  int e = -1;
1023 
1024  /// @brief Pointer to start of unknown Yo(:,s:e)
1025  int s = -1;
1026 
1027  /// @brief Number of performed iterations
1028  int itr = 0;
1029 
1030  /// @brief Maximum iteration for this eq.
1031  int maxItr = 5;
1032 
1033  /// @brief Minimum iteration for this eq.
1034  int minItr = 1;
1035 
1036  /// @brief Number of possible outputs
1037  int nOutput = 0;
1038 
1039  /// @brief IB: Number of possible outputs
1040  int nOutIB = 0;
1041 
1042  /// @brief Number of domains
1043  int nDmn = 0;
1044 
1045  /// @brief IB: Number of immersed domains
1046  int nDmnIB = 0;
1047 
1048  /// @brief Number of BCs
1049  int nBc = 0;
1050 
1051  /// @brief Number of BCs on immersed surfaces
1052  int nBcIB = 0;
1053 
1054  /// @brief Number of BFs
1055  int nBf = 0;
1056 
1057  /// @brief Type of equation fluid/heatF/heatS/lElas/FSI
1058  consts::EquationType phys = consts::EquationType::phys_NA;
1059 
1060  // Parameters used for the Generalized α− Method.
1061  //
1062  /// @brief \f$\alpha_f\f$
1063  double af = 0.0;
1064 
1065  /// @brief \f$\alpha_m\f$
1066  ///
1067  /// For second order equations: am = (2.0 - roInf) / (1.0 + roInf)
1068  /// First order equations: am = 0.5 * (3.0 - roInf) / (1.0 + roInf)
1069  //
1070  double am = 0.0;
1071 
1072  /// @brief \f$\beta\f$
1073  double beta = 0.0;
1074 
1075  /// @brief \f$\gamma\f$
1076  double gam = 0.0;
1077 
1078  /// @brief Initial norm of residual
1079  double iNorm = 0.0;
1080 
1081  /// @brief First iteration norm
1082  double pNorm = 0.0;
1083 
1084  /// @brief \f$\rho_{infinity}\f$
1085  double roInf = 0.0;
1086 
1087  /// @brief Accepted relative tolerance
1088  double tol = 0.0;
1089 
1090  /// @brief Equation symbol
1091  std::string sym;
1092  //std::string(LEN=2) :: sym = "NA";
1093 
1094  /// @brief type of linear solver
1096 
1097  /// @brief The type of interface to a numerical linear algebra library.
1098  consts::LinearAlgebraType linear_algebra_type;
1099 
1100  /// @brief The type of assembly interface to a numerical linear algebra library.
1101  consts::LinearAlgebraType linear_algebra_assembly_type;
1102 
1103  /// @brief The type of preconditioner used by the interface to a numerical linear algebra library.
1104  consts::PreconditionerType linear_algebra_preconditioner = consts::PreconditionerType::PREC_FSILS;
1105 
1106  /// @brief Interface to a numerical linear algebra library.
1108 
1109  /// @brief FSILS type of linear solver
1110  fsi_linear_solver::FSILS_lsType FSILS;
1111 
1112  /// @brief BCs associated with this equation;
1113  std::vector<bcType> bc;
1114 
1115  /// @brief IB: BCs associated with this equation on immersed surfaces
1116  std::vector<bcType> bcIB;
1117 
1118  /// @brief domains that this equation must be solved
1119  std::vector<dmnType> dmn;
1120 
1121  /// @brief IB: immersed domains that this equation must be solved
1122  std::vector<dmnType> dmnIB;
1123 
1124  /// @brief Outputs
1125  std::vector<outputType> output;
1126 
1127  /// @brief IB: Outputs
1128  std::vector<outputType> outIB;
1129 
1130  /// @brief Body force associated with this equation
1131  std::vector<bfType> bf;
1132 };
1133 
1134 /// @brief This type will be used to write data in the VTK files.
1135 //
1137 {
1138  public:
1139 
1140  // Element number of nodes
1141  int eNoN = 0;
1142 
1143  // Number of elements
1144  int nEl = 0;
1145 
1146  // Number of nodes
1147  int nNo = 0;
1148 
1149  // vtk type
1150  int vtkType = 0;
1151 
1152  // Connectivity array
1153  Array<int> IEN;
1154 
1155  // Element based variables to be written
1156  Array<double> xe;
1157 
1158  // All the variables after transformation to global format
1159  Array<double> gx;
1160 
1161  // All the variables to be written (including position)
1162  Array<double> x;
1163 };
1164 
1165 
1167 {
1168  public:
1169 
1170  rmshType();
1171 
1172  /// @brief Whether remesh is required for problem or not
1173  bool isReqd = false;
1174 
1175  /// @brief Method for remeshing: 1-TetGen, 2-MeshSim
1176  consts::MeshGeneratorType method = consts::MeshGeneratorType::RMSH_TETGEN;
1177 
1178  /// @brief Counter to track number of remesh done
1179  int cntr = 0;
1180 
1181  /// @brief Time step from which remeshing is done
1182  int rTS = 0;
1183 
1184  /// @brief Time step freq for saving data
1185  int cpVar = 0;
1186 
1187  /// @brief Time step at which forced remeshing is done
1188  int fTS = 1000;
1189 
1190  /// @brief Time step frequency for forced remeshing
1191  int freq = 1000;
1192 
1193  /// @brief Time where remeshing starts
1194  double time = 0.0;
1195 
1196  /// @brief Mesh quality parameters
1197  double minDihedAng = 0.0;
1198  double maxRadRatio = 0.0;
1199 
1200  /// @brief Edge size of mesh
1202 
1203  /// @brief Initial norm of an equation
1205 
1206  /// @brief Copy of solution variables where remeshing starts
1207  Array<double> A0;
1208  Array<double> Y0;
1209  Array<double> D0;
1210 
1211  /// @brief Flag is set if remeshing is required for each mesh
1212  std::vector<bool> flag;
1213 };
1214 
1216 {
1217  public:
1218  /// @brief Num traces (nodes) local to each process
1220 
1221  /// @brief Pointer to global trace (node num) stacked contiguously
1223 
1224  /// @brief Num traces (Gauss points) local to each process
1226 
1227  /// @brief Pointer to global trace (Gauss point) stacked contiguously
1229 };
1230 
1231 
1232 /// @brief Immersed Boundary (IB) data type
1233 //
1234 class ibType
1235 {
1236  public:
1237 
1238  /// @brief Whether any file being saved
1239  bool savedOnce = false;
1240  //bool savedOnce = .FALSE.
1241 
1242  /// @brief IB method
1243  int mthd = 0;
1244  //int mthd = ibMthd_NA;
1245 
1246  /// @brief IB coupling
1247  int cpld = 0;
1248  //int cpld = ibCpld_NA;
1249 
1250  /// @brief IB interpolation method
1251  int intrp = 0;
1252  //int intrp = ibIntrp_NA;
1253 
1254  /// @brief Current IB domain ID
1255  int cDmn = 0;
1256 
1257  /// @brief Current equation
1258  int cEq = 0;
1259 
1260  /// @brief Total number of IB nodes
1261  int tnNo = 0;
1262 
1263  /// @brief Number of IB meshes
1264  int nMsh = 0;
1265 
1266  /// @brief IB call duration (1: total time; 2: update; 3,4: communication)
1267  double callD[4] = {0.0, 0.0, 0.0, 0.0};
1268 
1269  /// @brief IB Domain ID
1271 
1272  /// @brief Row pointer (for sparse LHS matrix storage)
1274 
1275  /// @brief Column pointer (for sparse LHS matrix storage)
1277 
1278  /// @brief IB position coordinates
1279  Array<double> x;
1280 
1281  /// @brief Velocity (new)
1282  Array<double> Yb;
1283 
1284  /// @brief Time derivative of displacement (old)
1285  Array<double> Auo;
1286 
1287  /// @brief Time derivative of displacement (new)
1288  Array<double> Aun;
1289 
1290  /// @brief Time derivative of displacement (n+am)
1291  Array<double> Auk;
1292 
1293  /// @brief Displacement (old)
1294  Array<double> Ubo;
1295 
1296  /// @brief Displacement (new)
1297  Array<double> Ubn;
1298 
1299  /// @brief Displacement (n+af)
1300  Array<double> Ubk;
1301 
1302  /// @brief Displacement (projected on background mesh, old)
1303  Array<double> Uo;
1304 
1305  /// @brief Displacement (projected on background mesh, new, n+af)
1306  Array<double> Un;
1307 
1308  /// @brief Residual (FSI force)
1309  Array<double> R;
1310 
1311  /// @brief Residual (displacement, background mesh)
1312  Array<double> Ru;
1313 
1314  /// @brief Residual (displacement, IB mesh)
1315  Array<double> Rub;
1316 
1317  /// @brief LHS tangent matrix for displacement
1318  Array<double> Ku;
1319 
1320  /// @brief DERIVED class VARIABLES IB meshes;
1321  std::vector<mshType> msh;
1322 
1323  /// @brief IB communicator
1325 };
1326 
1327 /// @brief The ComMod class duplicates the data structures in the Fortran COMMOD module
1328 /// defined in MOD.f.
1329 ///
1330 /// The data members here are the global variables exposed by the COMMOD module.
1331 //
1332 class ComMod {
1333 
1334  public:
1335  ComMod();
1336  ~ComMod();
1337 
1338  //----- bool members -----//
1339 
1340  /// @brief Whether there is a requirement to update mesh and Dn-Do variables
1341  bool dFlag = false;
1342 
1343  /// @brief Whether mesh is moving
1344  bool mvMsh = false;
1345 
1346  /// @brief Whether to averaged results
1347  bool saveAve = false;
1348 
1349  /// @brief Whether to save to VTK files
1350  bool saveVTK = false;
1351 
1352  /// @brief Whether any file being saved
1353  bool savedOnce = false;
1354 
1355  /// @brief Whether to use separator in output
1356  bool sepOutput = false;
1357 
1358  /// @brief Whether start from beginning or from simulations
1359  bool stFileFlag = false;
1360 
1361  /// @brief Whether to overwrite restart file or not
1362  bool stFileRepl = false;
1363 
1364  /// @brief Restart simulation after remeshing
1365  bool resetSim = false;
1366 
1367  /// @brief Check IEN array for initial mesh
1368  bool ichckIEN = false;
1369 
1370  /// @brief Reset averaging variables from zero
1371  bool zeroAve = false;
1372 
1373  /// @brief Whether CMM equation is initialized
1374  bool cmmInit = false;
1375 
1376  /// @brief Whether variable wall properties are used for CMM
1377  bool cmmVarWall = false;
1378 
1379  /// @brief Whether shell equation is being solved
1380  bool shlEq = false;
1381 
1382  /// @brief Whether PRESTRESS is being solved
1383  bool pstEq = false;
1384 
1385  /// @brief Whether velocity-pressure based structural dynamics solver is used
1386  bool sstEq = false;
1387 
1388  /// @brief Whether to detect and apply any contact model
1389  bool iCntct = false;
1390 
1391  /// @brief Whether any Immersed Boundary (IB) treatment is required
1392  bool ibFlag = false;
1393 
1394  /// @brief Postprocess step - convert bin to vtk
1395  bool bin2VTK = false;
1396 
1397  /// @brief Whether to use precomputed state-variable solutions
1398  bool usePrecomp = false;
1399 
1400  //----- int members -----//
1401 
1402  /// @brief Current domain
1403  int cDmn = 0;
1404 
1405  /// @brief Current equation
1406  int cEq = 0;
1407 
1408  /// @brief Current time step
1409  int cTS = 0;
1410 
1411  std::array<double,3> timeP;
1412 
1413  /// @brief Starting time step
1414  int startTS = 0;
1415 
1416  /// @brief Current equation degrees of freedom
1417  int dof = 0;
1418 
1419  /// @brief Global total number of nodes, across all meshes (total) and all
1420  /// procs (global)
1421  int gtnNo = 0;
1422 
1423  /// @brief Number of equations
1424  int nEq = 0;
1425 
1426  /// @brief Number of faces in the LHS passed to FSILS
1427  int nFacesLS = 0;
1428 
1429  /// @brief Number of meshes
1430  int nMsh = 0;
1431 
1432  /// @brief Number of spatial dimensions
1433  int nsd = 0;
1434 
1435  /// @brief Number of time steps
1436  int nTS = 0;
1437 
1438  /// @brief Number of initialization time steps
1439  int nITs = 0;
1440 
1441  /// @brief stFiles record length
1442  int recLn = 0;
1443 
1444  /// @brief Start saving after this number of time step
1445  int saveATS = 0;
1446 
1447  /// @brief Increment in saving solutions
1448  int saveIncr = 0;
1449 
1450  /// @brief Stamp ID to make sure simulation is compatible with stFiles
1451  std::array<int,7> stamp;
1452 
1453  /// @brief Increment in saving restart file
1454  int stFileIncr = 0;
1455 
1456  /// @brief Total number of degrees of freedom per node
1457  int tDof = 0;
1458 
1459  /// @brief Total number of nodes (total number of nodes on current processor across
1460  /// all meshes)
1461  int tnNo = 0;
1462 
1463  /// @brief Restart Time Step
1464  int rsTS = 0;
1465 
1466  /// @brief Number of stress values to be stored
1467  int nsymd = 0;
1468 
1469 
1470  //----- double members -----//
1471 
1472  /// @brief Time step size
1473  double dt = 0.0;
1474 
1475  /// @brief Time step size of the precomputed state-variables
1476  double precompDt = 0.0;
1477 
1478  /// @brief Time
1479  double time = 0.0;
1480 
1481 
1482  //----- string members -----//
1483 
1484  /// @brief Initialization file path
1485  std::string iniFilePath;
1486 
1487  /// @brief Saved output file name
1488  std::string saveName;
1489 
1490  /// @brief Restart file name
1491  std::string stFileName;
1492 
1493  /// @brief Stop_trigger file name
1494  std::string stopTrigName;
1495 
1496  /// @brief Precomputed state-variable file name
1497  std::string precompFileName;
1498 
1499  /// @brief Precomputed state-variable field name
1500  std::string precompFieldName;
1501  // ALLOCATABLE DATA
1502 
1503  /// @brief Column pointer (for sparse LHS matrix structure)
1504  /// Modified in: lhsa()
1506 
1507  /// @brief Domain ID
1509 
1510  /// @brief Local to global pointer tnNo --> gtnNo
1512 
1513  /// @brief Row pointer (for sparse LHS matrix structure)
1514  /// Modified in: lhsa()
1516 
1517  /// @brief Array that maps global node id to rowN in the matrix
1518  /// Modified in: lhsa()
1520 
1521  /// @brief Boundary nodes set for CMM initialization and for zeroing-out
1522  /// non-wall nodal displacements
1524 
1525  /// @brief IB: iblank used for immersed boundaries (1 => solid, 0 => fluid)
1527 
1528  /// @brief Old time derivative of variables (acceleration); known result at current time step
1529  Array<double> Ao;
1530 
1531  /// @brief New time derivative of variables (acceleration); unknown result at next time step
1532  Array<double> An;
1533 
1534  /// @brief Old integrated variables (displacement)
1535  Array<double> Do;
1536 
1537  /// @brief New integrated variables (displacement)
1538  Array<double> Dn;
1539 
1540  /// @brief Residual vector
1541  Array<double> R;
1542 
1543  /// @brief LHS matrix
1544  Array<double> Val;
1545 
1546  /// @brief Position vector of mesh nodes (in ref config)
1547  Array<double> x;
1548 
1549  /// @brief Old variables (velocity); known result at current time step
1550  Array<double> Yo;
1551 
1552  /// @brief New variables (velocity); unknown result at next time step
1553  Array<double> Yn;
1554 
1555  /// @brief Body force
1556  Array<double> Bf;
1557 
1558  //-----------------------------------------------------
1559  // Additional arrays for velocity-based formulation of
1560  // nonlinear solid mechanics.
1561  //-----------------------------------------------------
1562 
1563  /// @brief Time derivative of displacement
1564  Array<double> Ad;
1565 
1566  /// @brief Residual of the displacement equation
1567  Array<double> Rd;
1568 
1569  /// @brief LHS matrix for displacement equation
1570  Array<double> Kd;
1571 
1572  /// @brief Variables for prestress calculations
1573  Array<double> pS0;
1574  Array<double> pSn;
1575  Vector<double> pSa;
1576 
1577  /// @brief Temporary storage for initializing state variables
1579  Array<double> Vinit;
1580  Array<double> Dinit;
1581 
1582  /// @brief CMM-variable wall properties: 1-thickness, 2-Elasticity modulus
1583  Array<double> varWallProps;
1584 
1585  //------------------------
1586  // DERIVED TYPE VARIABLES
1587  //------------------------
1588 
1589  /// @brief Coupled BCs structures used for multidomain simulations
1591 
1592  /// @brief All data related to equations are stored in this container
1593  std::vector<eqType> eq;
1594 
1595  /// @brief FSILS data structure to produce LHS sparse matrix
1596  fsi_linear_solver::FSILS_lhsType lhs;
1597 
1598  /// @brief All the meshes are stored in this variable
1599  std::vector<mshType> msh;
1600 
1601  /// @brief Input/output to the screen is handled by this structure
1602  chnlType std, err, wrn, dbg;
1603 
1604  /// @brief To group above channels
1606 
1607  /// @brief The general communicator
1609 
1610  /// @brief Remesher type
1612 
1613  /// @brief Contact model type
1615 
1616  /// @brief IB: Immersed boundary data structure
1618 
1619  bool debug_active = false;
1620 
1621  Timer timer;
1622 };
1623 
1624 #endif
1625 
The ComMod class duplicates the data structures in the Fortran COMMOD module defined in MOD....
Definition: ComMod.h:1332
std::string stopTrigName
Stop_trigger file name.
Definition: ComMod.h:1494
ibType ib
IB: Immersed boundary data structure.
Definition: ComMod.h:1617
int stFileIncr
Increment in saving restart file.
Definition: ComMod.h:1454
int nITs
Number of initialization time steps.
Definition: ComMod.h:1439
bool ibFlag
Whether any Immersed Boundary (IB) treatment is required.
Definition: ComMod.h:1392
Vector< int > colPtr
Column pointer (for sparse LHS matrix structure) Modified in: lhsa()
Definition: ComMod.h:1505
bool zeroAve
Reset averaging variables from zero.
Definition: ComMod.h:1371
std::string saveName
Saved output file name.
Definition: ComMod.h:1488
int nMsh
Number of meshes.
Definition: ComMod.h:1430
chnlType std
Input/output to the screen is handled by this structure.
Definition: ComMod.h:1602
bool savedOnce
Whether any file being saved.
Definition: ComMod.h:1353
bool stFileRepl
Whether to overwrite restart file or not.
Definition: ComMod.h:1362
Array< double > varWallProps
CMM-variable wall properties: 1-thickness, 2-Elasticity modulus.
Definition: ComMod.h:1583
Array< double > x
Position vector of mesh nodes (in ref config)
Definition: ComMod.h:1547
bool cmmVarWall
Whether variable wall properties are used for CMM.
Definition: ComMod.h:1377
std::array< int, 7 > stamp
Stamp ID to make sure simulation is compatible with stFiles.
Definition: ComMod.h:1451
Array< double > Ad
Time derivative of displacement.
Definition: ComMod.h:1564
int cTS
Current time step.
Definition: ComMod.h:1409
int dof
Current equation degrees of freedom.
Definition: ComMod.h:1417
int gtnNo
Global total number of nodes, across all meshes (total) and all procs (global)
Definition: ComMod.h:1421
std::string stFileName
Restart file name.
Definition: ComMod.h:1491
int tnNo
Total number of nodes (total number of nodes on current processor across all meshes)
Definition: ComMod.h:1461
int nsd
Number of spatial dimensions.
Definition: ComMod.h:1433
int nFacesLS
Number of faces in the LHS passed to FSILS.
Definition: ComMod.h:1427
int nsymd
Number of stress values to be stored.
Definition: ComMod.h:1467
Array< double > Yn
New variables (velocity); unknown result at next time step.
Definition: ComMod.h:1553
bool ichckIEN
Check IEN array for initial mesh.
Definition: ComMod.h:1368
std::string iniFilePath
Initialization file path.
Definition: ComMod.h:1485
Vector< int > rowPtr
Row pointer (for sparse LHS matrix structure) Modified in: lhsa()
Definition: ComMod.h:1515
std::string precompFileName
Precomputed state-variable file name.
Definition: ComMod.h:1497
int cEq
Current equation.
Definition: ComMod.h:1406
Vector< int > cmmBdry
Boundary nodes set for CMM initialization and for zeroing-out non-wall nodal displacements.
Definition: ComMod.h:1523
Array< double > Val
LHS matrix.
Definition: ComMod.h:1544
bool bin2VTK
Postprocess step - convert bin to vtk.
Definition: ComMod.h:1395
bool saveAve
Whether to averaged results.
Definition: ComMod.h:1347
bool saveVTK
Whether to save to VTK files.
Definition: ComMod.h:1350
int tDof
Total number of degrees of freedom per node.
Definition: ComMod.h:1457
std::string precompFieldName
Precomputed state-variable field name.
Definition: ComMod.h:1500
bool cmmInit
Whether CMM equation is initialized.
Definition: ComMod.h:1374
Array< double > Rd
Residual of the displacement equation.
Definition: ComMod.h:1567
cplBCType cplBC
Coupled BCs structures used for multidomain simulations.
Definition: ComMod.h:1590
double time
Time.
Definition: ComMod.h:1479
Array< double > Dn
New integrated variables (displacement)
Definition: ComMod.h:1538
bool pstEq
Whether PRESTRESS is being solved.
Definition: ComMod.h:1383
bool resetSim
Restart simulation after remeshing.
Definition: ComMod.h:1365
Array< double > An
New time derivative of variables (acceleration); unknown result at next time step.
Definition: ComMod.h:1532
double dt
Time step size.
Definition: ComMod.h:1473
Array< double > R
Residual vector.
Definition: ComMod.h:1541
rmshType rmsh
Remesher type.
Definition: ComMod.h:1611
int saveIncr
Increment in saving solutions.
Definition: ComMod.h:1448
bool usePrecomp
Whether to use precomputed state-variable solutions.
Definition: ComMod.h:1398
ioType io
To group above channels.
Definition: ComMod.h:1605
cntctModelType cntctM
Contact model type.
Definition: ComMod.h:1614
cmType cm
The general communicator.
Definition: ComMod.h:1608
int startTS
Starting time step.
Definition: ComMod.h:1414
Vector< int > idMap
Array that maps global node id to rowN in the matrix Modified in: lhsa()
Definition: ComMod.h:1519
bool stFileFlag
Whether start from beginning or from simulations.
Definition: ComMod.h:1359
bool sepOutput
Whether to use separator in output.
Definition: ComMod.h:1356
bool shlEq
Whether shell equation is being solved.
Definition: ComMod.h:1380
std::vector< eqType > eq
All data related to equations are stored in this container.
Definition: ComMod.h:1593
bool iCntct
Whether to detect and apply any contact model.
Definition: ComMod.h:1389
double precompDt
Time step size of the precomputed state-variables.
Definition: ComMod.h:1476
Array< double > Do
Old integrated variables (displacement)
Definition: ComMod.h:1535
bool dFlag
Whether there is a requirement to update mesh and Dn-Do variables.
Definition: ComMod.h:1341
int cDmn
Current domain.
Definition: ComMod.h:1403
int nTS
Number of time steps.
Definition: ComMod.h:1436
Array< double > Ao
Old time derivative of variables (acceleration); known result at current time step.
Definition: ComMod.h:1529
int nEq
Number of equations.
Definition: ComMod.h:1424
Vector< int > iblank
IB: iblank used for immersed boundaries (1 => solid, 0 => fluid)
Definition: ComMod.h:1526
Array< double > Kd
LHS matrix for displacement equation.
Definition: ComMod.h:1570
std::vector< mshType > msh
All the meshes are stored in this variable.
Definition: ComMod.h:1599
int recLn
stFiles record length
Definition: ComMod.h:1442
int rsTS
Restart Time Step.
Definition: ComMod.h:1464
bool mvMsh
Whether mesh is moving.
Definition: ComMod.h:1344
Vector< double > Pinit
Temporary storage for initializing state variables.
Definition: ComMod.h:1578
Vector< int > ltg
Local to global pointer tnNo --> gtnNo.
Definition: ComMod.h:1511
fsi_linear_solver::FSILS_lhsType lhs
FSILS data structure to produce LHS sparse matrix.
Definition: ComMod.h:1596
Array< double > Yo
Old variables (velocity); known result at current time step.
Definition: ComMod.h:1550
Array< double > Bf
Body force.
Definition: ComMod.h:1556
Vector< int > dmnId
Domain ID.
Definition: ComMod.h:1508
Array< double > pS0
Variables for prestress calculations.
Definition: ComMod.h:1573
int saveATS
Start saving after this number of time step.
Definition: ComMod.h:1445
bool sstEq
Whether velocity-pressure based structural dynamics solver is used.
Definition: ComMod.h:1386
The LinearAlgebra class provides an abstract interface to linear algebra frameworks: FSILS,...
Definition: LinearAlgebra.h:40
Moving boundary data structure (used for general BC)
Definition: ComMod.h:100
Keep track of time.
Definition: Timer.h:40
Mesh adjacency (neighboring element for each element)
Definition: ComMod.h:467
Boundary condition data type.
Definition: ComMod.h:144
Definition: ComMod.h:297
Class storing data for B-Splines.
Definition: ComMod.h:222
Cardiac electrophysiology model type.
Definition: CepMod.h:158
Channel type, used in I/O.
Definition: ChnlMod.h:46
The cmType class stores data and defines methods used for mpi communication.
Definition: CmMod.h:82
Contact model type.
Definition: ComMod.h:696
For coupled 0D-3D problems.
Definition: ComMod.h:754
consts::CplBCType schm
Implicit/Explicit/Semi-implicit schemes.
Definition: ComMod.h:779
int nX
Number of unknowns in the 0D domain.
Definition: ComMod.h:773
int nFa
Number of coupled faces.
Definition: ComMod.h:770
Vector< double > xo
Old time step unknowns in the 0D domain.
Definition: ComMod.h:797
bool useGenBC
Whether to use genBC.
Definition: ComMod.h:761
std::string binPath
Path to the 0D code binary file.
Definition: ComMod.h:783
std::string saveName
The name of history file containing "X".
Definition: ComMod.h:790
std::string commuName
File name for communication between 0D and 3D.
Definition: ComMod.h:786
bool coupled
Is multi-domain active.
Definition: ComMod.h:758
std::vector< cplFaceType > fa
Data structure used for communicating with 0D code.
Definition: ComMod.h:803
Vector< double > xp
Output variables to be printed.
Definition: ComMod.h:800
Vector< double > xn
New time step unknowns in the 0D domain.
Definition: ComMod.h:794
int nXp
Number of output variables addition to nX.
Definition: ComMod.h:776
Definition: ComMod.h:718
This type will be used to write data in the VTK files.
Definition: ComMod.h:1137
Domain type is to keep track with element belong to which domain and also different physical quantiti...
Definition: ComMod.h:432
Equation type.
Definition: ComMod.h:1000
LinearAlgebra * linear_algebra
Interface to a numerical linear algebra library.
Definition: ComMod.h:1107
double roInf
Definition: ComMod.h:1085
int maxItr
Maximum iteration for this eq.
Definition: ComMod.h:1031
int s
Pointer to start of unknown Yo(:,s:e)
Definition: ComMod.h:1025
int nDmnIB
IB: Number of immersed domains.
Definition: ComMod.h:1046
bool coupled
Should be satisfied in a coupled/uncoupled fashion.
Definition: ComMod.h:1006
bool ok
Satisfied/not satisfied.
Definition: ComMod.h:1010
int nBcIB
Number of BCs on immersed surfaces.
Definition: ComMod.h:1052
std::string sym
Equation symbol.
Definition: ComMod.h:1091
bool assmTLS
Use C++ Trilinos framework for assembly and for linear solvers.
Definition: ComMod.h:1016
lsType ls
type of linear solver
Definition: ComMod.h:1095
std::vector< outputType > outIB
IB: Outputs.
Definition: ComMod.h:1128
double tol
Accepted relative tolerance.
Definition: ComMod.h:1088
bool useTLS
Use C++ Trilinos framework for the linear solvers.
Definition: ComMod.h:1013
int itr
Number of performed iterations.
Definition: ComMod.h:1028
double gam
Definition: ComMod.h:1076
int nBc
Number of BCs.
Definition: ComMod.h:1049
int e
Pointer to end of unknown Yo(:,s:e)
Definition: ComMod.h:1022
std::vector< dmnType > dmn
domains that this equation must be solved
Definition: ComMod.h:1119
consts::PreconditionerType linear_algebra_preconditioner
The type of preconditioner used by the interface to a numerical linear algebra library.
Definition: ComMod.h:1104
int nOutIB
IB: Number of possible outputs.
Definition: ComMod.h:1040
double am
Definition: ComMod.h:1070
double iNorm
Initial norm of residual.
Definition: ComMod.h:1079
consts::LinearAlgebraType linear_algebra_assembly_type
The type of assembly interface to a numerical linear algebra library.
Definition: ComMod.h:1101
consts::LinearAlgebraType linear_algebra_type
The type of interface to a numerical linear algebra library.
Definition: ComMod.h:1098
std::vector< bfType > bf
Body force associated with this equation.
Definition: ComMod.h:1131
double pNorm
First iteration norm.
Definition: ComMod.h:1082
double af
Definition: ComMod.h:1063
int nBf
Number of BFs.
Definition: ComMod.h:1055
int nDmn
Number of domains.
Definition: ComMod.h:1043
int nOutput
Number of possible outputs.
Definition: ComMod.h:1037
std::vector< dmnType > dmnIB
IB: immersed domains that this equation must be solved.
Definition: ComMod.h:1122
std::vector< bcType > bc
BCs associated with this equation;.
Definition: ComMod.h:1113
std::vector< bcType > bcIB
IB: BCs associated with this equation on immersed surfaces.
Definition: ComMod.h:1116
int dof
Degrees of freedom.
Definition: ComMod.h:1019
fsi_linear_solver::FSILS_lsType FSILS
FSILS type of linear solver.
Definition: ComMod.h:1110
consts::EquationType phys
Type of equation fluid/heatF/heatS/lElas/FSI.
Definition: ComMod.h:1058
std::vector< outputType > output
Outputs.
Definition: ComMod.h:1125
double beta
Definition: ComMod.h:1073
int minItr
Minimum iteration for this eq.
Definition: ComMod.h:1034
The face type containing mesh at boundary.
Definition: ComMod.h:521
void destroy()
Free memory and reset some data members.
Definition: ComMod.cpp:138
Fourier coefficients that are used to specify unsteady BCs.
Definition: ComMod.h:64
Definition: ComMod.h:327
Fluid viscosity model type.
Definition: ComMod.h:393
Function spaces (basis) type.
Definition: ComMod.h:249
void destroy()
SUBROUTINE DESTROYFS(fs)
Definition: ComMod.cpp:175
Definition: ComMod.h:1216
Vector< int > nG
Num traces (Gauss points) local to each process.
Definition: ComMod.h:1225
Vector< int > n
Num traces (nodes) local to each process.
Definition: ComMod.h:1219
Vector< int > gE
Pointer to global trace (Gauss point) stacked contiguously.
Definition: ComMod.h:1228
Vector< int > gN
Pointer to global trace (node num) stacked contiguously.
Definition: ComMod.h:1222
Immersed Boundary (IB) data type.
Definition: ComMod.h:1235
Array< double > x
IB position coordinates.
Definition: ComMod.h:1279
Array< double > Aun
Time derivative of displacement (new)
Definition: ComMod.h:1288
int cpld
IB coupling.
Definition: ComMod.h:1247
Array< double > Ku
LHS tangent matrix for displacement.
Definition: ComMod.h:1318
int tnNo
Total number of IB nodes.
Definition: ComMod.h:1261
Array< double > Un
Displacement (projected on background mesh, new, n+af)
Definition: ComMod.h:1306
int cEq
Current equation.
Definition: ComMod.h:1258
Array< double > R
Residual (FSI force)
Definition: ComMod.h:1309
int intrp
IB interpolation method.
Definition: ComMod.h:1251
Array< double > Uo
Displacement (projected on background mesh, old)
Definition: ComMod.h:1303
Array< double > Yb
Velocity (new)
Definition: ComMod.h:1282
Array< double > Ubn
Displacement (new)
Definition: ComMod.h:1297
int cDmn
Current IB domain ID.
Definition: ComMod.h:1255
double callD[4]
IB call duration (1: total time; 2: update; 3,4: communication)
Definition: ComMod.h:1267
ibCommType cm
IB communicator.
Definition: ComMod.h:1324
Vector< int > rowPtr
Row pointer (for sparse LHS matrix storage)
Definition: ComMod.h:1273
Array< double > Rub
Residual (displacement, IB mesh)
Definition: ComMod.h:1315
bool savedOnce
Whether any file being saved.
Definition: ComMod.h:1239
Vector< int > dmnID
IB Domain ID.
Definition: ComMod.h:1270
Array< double > Auo
Time derivative of displacement (old)
Definition: ComMod.h:1285
Array< double > Ubk
Displacement (n+af)
Definition: ComMod.h:1300
int nMsh
Number of IB meshes.
Definition: ComMod.h:1264
int mthd
IB method.
Definition: ComMod.h:1243
std::vector< mshType > msh
DERIVED class VARIABLES IB meshes;.
Definition: ComMod.h:1321
Array< double > Ubo
Displacement (old)
Definition: ComMod.h:1294
Vector< int > colPtr
Column pointer (for sparse LHS matrix storage)
Definition: ComMod.h:1276
Array< double > Ru
Residual (displacement, background mesh)
Definition: ComMod.h:1312
Array< double > Auk
Time derivative of displacement (n+am)
Definition: ComMod.h:1291
Only to group four channels, in case I rather have them as one variable.
Definition: ChnlMod.h:77
Linear system of equations solver type.
Definition: ComMod.h:640
double absTol
Absolute tolerance (IN)
Definition: ComMod.h:671
int cN
Number of |x| norms (OUT)
Definition: ComMod.h:662
int cD
Number of <x.y> dot products (OUT)
Definition: ComMod.h:665
double fNorm
Final norm of residual (OUT)
Definition: ComMod.h:680
double callD
Calling duration (OUT)
Definition: ComMod.h:686
int reserve
Only for data alignment (-)
Definition: ComMod.h:668
bool suc
Successful solving (OUT)
Definition: ComMod.h:647
int mItr
Maximum iterations (IN)
Definition: ComMod.h:650
consts::SolverType LS_type
LS solver (IN)
Definition: ComMod.h:644
int itr
Number of iteration (OUT)
Definition: ComMod.h:656
double relTol
Relative tolerance (IN)
Definition: ComMod.h:674
double dB
Res. rduction in last itr. (OUT)
Definition: ComMod.h:683
int sD
Space dimension (IN)
Definition: ComMod.h:653
int cM
Number of Ax multiple (OUT)
Definition: ComMod.h:659
double iNorm
Initial norm of residual (OUT)
Definition: ComMod.h:677
This is the container for a mesh or NURBS patch, those specific to NURBS are noted.
Definition: ComMod.h:810
int nNo
Number of nodes (control points) for 2D elements?
Definition: ComMod.h:871
Vector< double > w
Gauss weights.
Definition: ComMod.h:931
std::vector< std::vector< int > > ordering
@breif ordering: node ordering for boundaries
Definition: ComMod.h:889
Array< double > N
Parent shape function.
Definition: ComMod.h:943
traceType trc
IB: tracers.
Definition: ComMod.h:986
Array3< double > Ys
Solution field (displacement, velocity, pressure, etc.) for a known, potentially time-varying,...
Definition: ComMod.h:965
Vector< int > eDist
Element distribution between processors.
Definition: ComMod.h:892
Vector< int > iGC
IB: Whether a cell is a ghost cell or not.
Definition: ComMod.h:925
adjType nAdj
Mesh nodal adjacency.
Definition: ComMod.h:971
Array< double > xib
Bounds on parameteric coordinates.
Definition: ComMod.h:937
adjType eAdj
Mesh element adjacency.
Definition: ComMod.h:974
int nG
Number of Gauss points for integration.
Definition: ComMod.h:868
int nFa
Number of faces.
Definition: ComMod.h:862
Array< double > x
Position coordinates (not always, however, as they get overwritten by read_vtu_pdata())
Definition: ComMod.h:940
std::vector< fsType > fs
Function spaces (basis)
Definition: ComMod.h:977
Array3< double > Nxx
Second derivatives of shape functions - used for shells & IGA davep double Nxx(:,:,...
Definition: ComMod.h:961
int gnNo
Global number of nodes (control points) on a single mesh.
Definition: ComMod.h:853
double dx
IB: Mesh size parameter.
Definition: ComMod.h:886
bool lShpF
Whether the shape function is linear.
Definition: ComMod.h:834
Vector< int > lN
Global to local maping tnNo --> nNo.
Definition: ComMod.h:916
Vector< int > otnIEN
gIEN mapper from old to new
Definition: ComMod.h:910
int nFn
Number of fiber directions.
Definition: ComMod.h:880
Array< int > eIEN
Shells: extended IEN array with neighboring nodes.
Definition: ComMod.h:919
Vector< int > gN
Global nodes maping nNo --> tnNo.
Definition: ComMod.h:898
bool lFib
Whether the mesh is fibers (Purkinje)
Definition: ComMod.h:840
int eNoN
Number of nodes (control points) in a single element.
Definition: ComMod.h:847
double scF
Mesh scale factor.
Definition: ComMod.h:883
Vector< int > eId
Element domain ID number.
Definition: ComMod.h:895
int gnEl
Global number of elements (knot spans)
Definition: ComMod.h:850
int nSl
Number of elements sample points to be outputs (NURBS)
Definition: ComMod.h:874
Array< double > xi
Gauss integration points in parametric space.
Definition: ComMod.h:934
Array< double > fN
Fiber orientations stored at the element level - used for electrophysiology and solid mechanics.
Definition: ComMod.h:953
int nFs
Number of function spaces.
Definition: ComMod.h:865
Array< int > sbc
Shells: boundary condition variable.
Definition: ComMod.h:922
bool lShl
Whether the mesh is shell.
Definition: ComMod.h:837
Array< double > Nb
Shape function bounds.
Definition: ComMod.h:946
Array< double > nV
Normal vector to each nodal point (for Shells)
Definition: ComMod.h:949
Vector< double > nW
Control points weights (NURBS)
Definition: ComMod.h:928
Array3< double > Nx
Parent shape functions gradient double Nx(:,:,:)
Definition: ComMod.h:957
std::vector< faceType > fa
Faces are stored in this variable.
Definition: ComMod.h:983
Vector< int > gpN
GLobal projected nodes mapping projected -> unprojected mapping.
Definition: ComMod.h:901
Array< int > gIEN
Global connectivity array mappig eNoN,nEl --> gnNo.
Definition: ComMod.h:904
int vtkType
The element type recognized by VTK format.
Definition: ComMod.h:877
int nEl
Number of elements (knot spans)
Definition: ComMod.h:859
consts::ElementType eType
Element type.
Definition: ComMod.h:843
int nEf
Number of element face. Used for reading Gambit mesh files.
Definition: ComMod.h:856
std::string name
Mesh Name.
Definition: ComMod.h:968
std::vector< bsType > bs
BSpline in different directions (NURBS)
Definition: ComMod.h:980
Array< int > IEN
The connectivity array mapping eNoN,nEl --> nNo.
Definition: ComMod.h:907
double qmTET4
TET4 quadrature modifier.
Definition: ComMod.h:989
Array< int > INN
Local knot pointer (NURBS)
Definition: ComMod.h:913
Declared type for outputed variables.
Definition: ComMod.h:617
Definition: ComMod.h:122
Definition: ComMod.h:1167
Vector< double > iNorm
Initial norm of an equation.
Definition: ComMod.h:1204
int rTS
Time step from which remeshing is done.
Definition: ComMod.h:1182
int freq
Time step frequency for forced remeshing.
Definition: ComMod.h:1191
int cpVar
Time step freq for saving data.
Definition: ComMod.h:1185
Array< double > A0
Copy of solution variables where remeshing starts.
Definition: ComMod.h:1207
int cntr
Counter to track number of remesh done.
Definition: ComMod.h:1179
std::vector< bool > flag
Flag is set if remeshing is required for each mesh.
Definition: ComMod.h:1212
double time
Time where remeshing starts.
Definition: ComMod.h:1194
consts::MeshGeneratorType method
Method for remeshing: 1-TetGen, 2-MeshSim.
Definition: ComMod.h:1176
double minDihedAng
Mesh quality parameters.
Definition: ComMod.h:1197
int fTS
Time step at which forced remeshing is done.
Definition: ComMod.h:1188
Vector< double > maxEdgeSize
Edge size of mesh.
Definition: ComMod.h:1201
bool isReqd
Whether remesh is required for problem or not.
Definition: ComMod.h:1173
Fluid viscosity model type.
Definition: ComMod.h:418
Structural domain type.
Definition: ComMod.h:346
Tracer type used for immersed boundaries. Identifies traces of nodes and integration points on backgr...
Definition: ComMod.h:486