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  // Unsteady time-dependent values
337  fcType gt;
338 };
339 
340 /// @brief Structural domain type
341 //
343 {
344  public:
345  // Type of constitutive model (volumetric) for struct/FSI
346  consts::ConstitutiveModelType volType = consts::ConstitutiveModelType::stIso_NA;
347 
348  // Penalty parameter
349  double Kpen = 0.0;
350 
351  // Type of constitutive model (isochoric) for struct/FSI
352  consts::ConstitutiveModelType isoType = consts::ConstitutiveModelType::stIso_NA;
353 
354  // Parameters specific to the constitutive model (isochoric)
355  // NeoHookean model (C10 = mu/2)
356  double C10 = 0.0;
357 
358  // Mooney-Rivlin model (C10, C01)
359  double C01 = 0.0;
360 
361  // Holzapfel model(a, b, aff, bff, ass, bss, afs, bfs, kap)
362  double a = 0.0;
363  double b = 0.0;
364  double aff = 0.0;
365  double bff = 0.0;
366  double ass = 0.0;
367  double bss = 0.0;
368  double afs = 0.0;
369  double bfs = 0.0;
370 
371  // Collagen fiber dispersion parameter (Holzapfel model)
372  double kap = 0.0;
373 
374  // Heaviside function parameter (Holzapfel-Ogden model)
375  double khs = 100.0;
376 
377  // Lee-Sacks model
378  double a0 = 0.0;
379  double b1 = 0.0;
380  double b2 = 0.0;
381  double mu0 = 0.0;
382 
383  // Fiber reinforcement stress
384  fibStrsType Tf;
385 };
386 
387 /// @brief Fluid viscosity model type
388 //
390 {
391  public:
392 
393  // Type of constitutive model for fluid viscosity
394  consts::FluidViscosityModelType viscType = consts::FluidViscosityModelType::viscType_NA;
395 
396  // Limiting zero shear-rate viscosity value
397  double mu_o = 0.0;
398 
399  // Limiting high shear-rate viscosity (asymptotic) value
400  double mu_i = 0.0;
401 
402  // Strain-rate tensor multiplier
403  double lam = 0.0;
404 
405  // Strain-rate tensor exponent
406  double a = 0.0;
407 
408  // Power-law exponent
409  double n = 0.0;
410 };
411 
412 /// @brief Domain type is to keep track with element belong to which domain
413 /// and also different physical quantities
414 //
415 class dmnType
416 {
417  public:
418  dmnType();
419  ~dmnType();
420 
421  // The domain ID. Default includes entire domain
422  int Id = -1;
423 
424  // Which physics must be solved in this domain
425  consts::EquationType phys = consts::EquationType::phys_NA;
426 
427  // The volume of this domain
428  double v = 0.0;
429 
430  // General physical properties such as density, elastic modulus...
431  // FIX davep double prop[maxNProp] ;
432  std::map<consts::PhysicalProperyType,double> prop;
433  //double prop[consts::maxNProp];
434 
435  // Electrophysiology model
436  cepModelType cep;
437 
438  // Structure material model
439  stModelType stM;
440 
441  // Viscosity model for fluids
442  viscModelType visc;
443 };
444 
445 /// @brief Mesh adjacency (neighboring element for each element)
446 //
447 class adjType
448 {
449  public:
450  void destroy();
451 
452  // No of non-zeros
453  int nnz = 0;
454 
455  // Column pointer
456  Vector<int> pcol;
457 
458  // Row pointer
459  Vector<int> prow;
460 
461 };
462 
463 /// @brief Tracer type used for immersed boundaries. Identifies traces of
464 /// nodes and integration points on background mesh elements
465 //
467 {
468  public:
469  // No. of non-zero nodal traces
470  int n = 0;
471 
472  // No. of non-zero integration point traces
473  int nG = 0;
474 
475  // Local to global nodes maping nNo --> tnNo
476  Vector<int> gN;
477 
478  // Self pointer of each trace to the IB integration point and
479  // element ID
480  Array<int> gE;
481 
482  // Nodal trace pointer array stores two values for each trace.
483  // (1) background mesh element to which the trace points to,
484  // (2) mesh ID
485  Array<int> nptr;
486 
487  // Integration point tracer array stores two values for each trace
488  // (1) background mesh element to which the trace points to,
489  // (2) mesh ID
490  Array<int> gptr;
491 
492  // Parametric coordinate for each nodal trace
493  Array<double> xi;
494 
495  // Parametric coordinate for each Gauss point trace
496  Array<double> xiG;
497 };
498 
499 /// @brief The face type containing mesh at boundary
500 //
501 class faceType
502 {
503  public:
504  faceType();
505  ~faceType();
506 
507  void destroy();
508 
509  //faceType& operator=(const faceType& rhs);
510 
511  // Parametric direction normal to this face (NURBS)
512  int d = 0;
513 
514  // Number of nodes (control points) in a single element
515  int eNoN = 0;
516 
517  // Element type
518  consts::ElementType eType = consts::ElementType::NA;
519 
520  // The mesh index that this face belongs to
521  int iM = 0;
522 
523  // Number of elements
524  int nEl = 0;
525 
526  // Global number of elements
527  int gnEl = 0;
528 
529  // Number of function spaces
530  int nFs = 0;
531 
532  // Number of Gauss points for integration
533  int nG = 0;
534 
535  // Number of nodes
536  int nNo = 0;
537 
538  // Global element Ids
539  Vector<int> gE;
540 
541  // Global node Ids
542  Vector<int> gN;
543 
544  // Global to local maping tnNo --> nNo
545  Vector<int> lN;
546 
547  // Connectivity array
548  Array<int> IEN;
549 
550  // EBC array (gE + gIEN)
551  Array<int> gebc;
552 
553  // Surface area
554  double area = 0.0;
555 
556  // Gauss point weights
557  Vector<double> w;
558 
559  // Position coordinates
560  Array<double> x;
561 
562  // Gauss points in parametric space
563  Array<double> xi;
564 
565  // Shape functions at Gauss points
566  Array<double> N;
567 
568  // Normal vector to each nodal point
569  Array<double> nV;
570 
571  // Shape functions derivative at Gauss points
572  // double Nx(:,:,:);
573  Array3<double> Nx;
574 
575  // Second derivatives of shape functions - for shells & IGA
576  // double Nxx(:,:,:);
577  Array3<double> Nxx;
578 
579  // Face name for flux files
580  std::string name;
581 
582  // Face nodal adjacency
583  adjType nAdj;
584 
585  // Face element adjacency
586  adjType eAdj;
587 
588  // Function spaces (basis)
589  std::vector<fsType> fs;
590 
591  // TRI3 quadrature modifier
592  double qmTRI3 = 2.0/3.0;
593 };
594 
595 /// @brief Declared type for outputed variables
596 //
598 {
599  public:
600 
601  // Is this output suppose to be written into VTK, boundary, vol
602  std::vector<bool> wtn{false, false, false};
603 
604  // The group that this belong to (one of outType_*)
605  consts::OutputType grp = consts::OutputType::outGrp_NA;
606  //int grp;
607 
608  // Length of the outputed variable
609  int l = 0;
610 
611  // Offset from the first index
612  int o = 0;
613 
614  // The name to be used for the output and also in input file
615  std::string name;
616 };
617 
618 /// @brief Linear system of equations solver type
619 //
620 class lsType
621 {
622  public:
623 
624  /// @brief LS solver (IN)
625  consts::SolverType LS_type = consts::SolverType::lSolver_NA;
626 
627  /// @brief Successful solving (OUT)
628  bool suc = false;
629 
630  /// @brief Maximum iterations (IN)
631  int mItr = 1000;
632 
633  /// @brief Space dimension (IN)
634  int sD = 0;
635 
636  /// @brief Number of iteration (OUT)
637  int itr = 0;
638 
639  /// @brief Number of Ax multiple (OUT)
640  int cM = 0;
641 
642  /// @brief Number of |x| norms (OUT)
643  int cN = 0;
644 
645  /// @brief Number of <x.y> dot products (OUT)
646  int cD = 0;
647 
648  /// @brief Only for data alignment (-)
649  int reserve = 0;
650 
651  /// @brief Absolute tolerance (IN)
652  double absTol = 1e-08;
653 
654  /// @brief Relative tolerance (IN)
655  double relTol = 0.0;
656 
657  /// @brief Initial norm of residual (OUT)
658  double iNorm = 0.0;
659 
660  /// @brief Final norm of residual (OUT)
661  double fNorm = 0.0;
662 
663  /// @brief Res. rduction in last itr. (OUT)
664  double dB = 0.0;
665 
666  /// @brief Calling duration (OUT)
667  double callD = 0.0;
668 
669  //@brief Configuration file for linear solvers (Trilinos, PETSc)
670  std::string config;
671 };
672 
673 
674 /// @brief Contact model type
675 //
677 {
678  public:
679  // Contact model
680  consts::ContactModelType cType = consts::ContactModelType::cntctM_NA;
681 
682  // Penalty parameter
683  double k = 0.0;
684 
685  // Min depth of penetration
686  double h = 0.0;
687 
688  // Max depth of penetration
689  double c = 0.0;
690 
691  // Min norm of face normals in contact
692  double al = 0.0;
693 
694  // Tolerance
695  double tol = 0.0;
696 };
697 
699 {
700  public:
701  // GenBC_Dir/GenBC_Neu
702  consts::CplBCType bGrp = consts::CplBCType::cplBC_NA;
703 
704  // Pointer to X
705  int Xptr = -1;
706 
707  // Internal genBC use
708  int eqv = 0;
709 
710  // Flow rates at t
711  double Qo = 0.0;
712 
713  // Flow rates at t+dt
714  double Qn = 0.0;
715 
716  // Pressures at t
717  double Po = 0.0;
718 
719  // Pressures at t+dt
720  double Pn = 0.0;
721 
722  // Imposed flow/pressure
723  double y = 0.0;
724 
725  // Name of the face
726  std::string name;
727 
728  // RCR type BC
729  rcrType RCR;
730 };
731 
732 /// @brief For coupled 0D-3D problems
733 //
735 {
736  public:
737  cplBCType();
738  /// @brief Is multi-domain active
739  bool coupled = false;
740 
741  /// @brief Whether to use genBC
742  bool useGenBC = false;
743 
744  // Whether to use svZeroD
745  bool useSvZeroD = false;
746 
747  // Whether to initialize RCR from flow data
748  bool initRCR = false;
749 
750  /// @brief Number of coupled faces
751  int nFa = 0;
752 
753  /// @brief Number of unknowns in the 0D domain
754  int nX = 0;
755 
756  /// @brief Number of output variables addition to nX
757  int nXp = 0;
758 
759  /// @brief Implicit/Explicit/Semi-implicit schemes
760  consts::CplBCType schm = consts::CplBCType::cplBC_NA;
761  //int schm = cplBC_NA;
762 
763  /// @brief Path to the 0D code binary file
764  std::string binPath;
765 
766  /// @brief File name for communication between 0D and 3D
767  std::string commuName;
768  //std::string commuName = ".CPLBC_0D_3D.tmp";
769 
770  /// @brief The name of history file containing "X"
771  std::string saveName;
772  //std::string(LEN=stdL) :: saveName = "LPN.dat";
773 
774  /// @brief New time step unknowns in the 0D domain
776 
777  /// @brief Old time step unknowns in the 0D domain
779 
780  /// @brief Output variables to be printed
782 
783  /// @brief Data structure used for communicating with 0D code
784  std::vector<cplFaceType> fa;
785 };
786 
787 /// @brief This is the container for a mesh or NURBS patch, those specific
788 /// to NURBS are noted
789 //
790 class mshType
791 {
792  public:
793  mshType();
794  std::string dname = "";
795 
796 /*
797  mshType(const mshType &other)
798  {
799  std::cout << "c c c c c mshType copy c c c c c" << std::endl;
800  }
801 
802  mshType& operator = (const mshType &other)
803  {
804  std::cout << "= = = = = mshType assignment = = = = =" << std::endl;
805  return *this;
806  }
807 */
808 
809  ~mshType()
810  {
811  //std::cout << "- - - - - mshType dtor - - - - - dname: " << dname << std::endl;
812  };
813 
814  /// @brief Whether the shape function is linear
815  bool lShpF = false;
816 
817  /// @brief Whether the mesh is shell
818  bool lShl = false;
819 
820  /// @brief Whether the mesh is fibers (Purkinje)
821  bool lFib = false;
822 
823  /// @brief Element type
824  consts::ElementType eType = consts::ElementType::NA;
825  //int eType = eType_NA
826 
827  /// @brief Number of nodes (control points) in a single element
828  int eNoN = 0;
829 
830  /// @brief Global number of elements (knot spans)
831  int gnEl = 0;
832 
833  /// @brief Global number of nodes (control points)
834  int gnNo = 0;
835 
836  /// @brief Number of element face. Used for reading Gambit mesh files
837  int nEf = 0;
838 
839  /// @brief Number of elements (knot spans)
840  int nEl = 0;
841 
842  /// @brief Number of faces
843  int nFa = 0;
844 
845  /// @brief Number of function spaces
846  int nFs = 0;
847 
848  /// @brief Number of Gauss points for integration
849  int nG = 0;
850 
851  /// @brief Number of nodes (control points) for 2D elements?
852  int nNo = 0;
853 
854  /// @brief Number of elements sample points to be outputs (NURBS)
855  int nSl = 0;
856 
857  /// @brief The element type recognized by VTK format
858  int vtkType = 0;
859 
860  /// @brief Number of fiber directions
861  int nFn = 0;
862 
863  /// @brief Mesh scale factor
864  double scF = 0.0;
865 
866  /// @brief IB: Mesh size parameter
867  double dx = 0.0;
868 
869  /// @breif ordering: node ordering for boundaries
870  std::vector<std::vector<int>> ordering;
871 
872  /// @brief Element distribution between processors
874 
875  /// @brief Element domain ID number
877 
878  /// @brief Global nodes maping nNo --> tnNo
880 
881  /// @brief GLobal projected nodes mapping projected -> unprojected mapping
883 
884  /// @brief Global connectivity array mappig eNoN,nEl --> gnNo
885  Array<int> gIEN;
886 
887  /// @brief The connectivity array mapping eNoN,nEl --> nNo
888  Array<int> IEN;
889 
890  /// @brief gIEN mapper from old to new
892 
893  /// @brief Local knot pointer (NURBS)
894  Array<int> INN;
895 
896  /// @brief Global to local maping tnNo --> nNo
898 
899  /// @brief Shells: extended IEN array with neighboring nodes
900  Array<int> eIEN;
901 
902  /// @brief Shells: boundary condition variable
903  Array<int> sbc;
904 
905  /// @brief IB: Whether a cell is a ghost cell or not
907 
908  /// @brief Control points weights (NURBS)
910 
911  /// @brief Gauss weights
913 
914  /// @brief Gauss integration points in parametric space
915  Array<double> xi;
916 
917  /// @brief Bounds on parameteric coordinates
918  Array<double> xib;
919 
920  /// @brief Position coordinates
921  Array<double> x;
922 
923  /// @brief Parent shape function
924  Array<double> N;
925 
926  /// @brief Shape function bounds
927  Array<double> Nb;
928 
929  /// @brief Normal vector to each nodal point (for Shells)
930  Array<double> nV;
931 
932  /// @brief Fiber orientations stored at the element level - used for
933  /// electrophysiology and solid mechanics
934  Array<double> fN;
935 
936  /// @brief Parent shape functions gradient
937  /// double Nx(:,:,:)
939 
940  /// @brief Second derivatives of shape functions - used for shells & IGA
941  /// davep double Nxx(:,:,:)
943 
944  /// @brief Solution field (displacement, velocity, pressure, etc.) for a known, potentially
945  /// time-varying, quantity of interest across a mesh
947 
948  /// @brief Mesh Name
949  std::string name;
950 
951  /// @brief Mesh nodal adjacency
953 
954  /// @brief Mesh element adjacency
956 
957  /// @brief Function spaces (basis)
958  std::vector<fsType> fs;
959 
960  /// @brief BSpline in different directions (NURBS)
961  std::vector<bsType> bs;
962 
963  /// @brief Faces are stored in this variable
964  std::vector<faceType> fa;
965 
966  /// @brief IB: tracers
968 
969  /// @brief TET4 quadrature modifier
970  double qmTET4 = (5.0+3.0*sqrt(5.0))/20.0;
971 
972  private:
973  //mshType(const mshType&);
974  //mshType& operator=(const mshType&);
975 
976 };
977 
978 /// @brief Equation type
979 //
980 class eqType
981 {
982  public:
983  eqType();
984  ~eqType();
985 
986  /// @brief Should be satisfied in a coupled/uncoupled fashion
987  bool coupled = false;
988  //bool coupled = .TRUE.
989 
990  /// @brief Satisfied/not satisfied
991  bool ok = false;
992 
993  /// @brief Use C++ Trilinos framework for the linear solvers
994  bool useTLS = false;
995 
996  /// @brief Use C++ Trilinos framework for assembly and for linear solvers
997  bool assmTLS = false;
998 
999  /// @brief Degrees of freedom
1000  int dof = 0;
1001 
1002  /// @brief Pointer to end of unknown Yo(:,s:e)
1003  int e = -1;
1004 
1005  /// @brief Pointer to start of unknown Yo(:,s:e)
1006  int s = -1;
1007 
1008  /// @brief Number of performed iterations
1009  int itr = 0;
1010 
1011  /// @brief Maximum iteration for this eq.
1012  int maxItr = 5;
1013 
1014  /// @brief Minimum iteration for this eq.
1015  int minItr = 1;
1016 
1017  /// @brief Number of possible outputs
1018  int nOutput = 0;
1019 
1020  /// @brief IB: Number of possible outputs
1021  int nOutIB = 0;
1022 
1023  /// @brief Number of domains
1024  int nDmn = 0;
1025 
1026  /// @brief IB: Number of immersed domains
1027  int nDmnIB = 0;
1028 
1029  /// @brief Number of BCs
1030  int nBc = 0;
1031 
1032  /// @brief Number of BCs on immersed surfaces
1033  int nBcIB = 0;
1034 
1035  /// @brief Number of BFs
1036  int nBf = 0;
1037 
1038  /// @brief Type of equation fluid/heatF/heatS/lElas/FSI
1039  consts::EquationType phys = consts::EquationType::phys_NA;
1040 
1041  // Parameters used for the Generalized α− Method.
1042  //
1043  /// @brief \f$\alpha_f\f$
1044  double af = 0.0;
1045 
1046  /// @brief \f$\alpha_m\f$
1047  ///
1048  /// For second order equations: am = (2.0 - roInf) / (1.0 + roInf)
1049  /// First order equations: am = 0.5 * (3.0 - roInf) / (1.0 + roInf)
1050  //
1051  double am = 0.0;
1052 
1053  /// @brief \f$\beta\f$
1054  double beta = 0.0;
1055 
1056  /// @brief \f$\gamma\f$
1057  double gam = 0.0;
1058 
1059  /// @brief Initial norm of residual
1060  double iNorm = 0.0;
1061 
1062  /// @brief First iteration norm
1063  double pNorm = 0.0;
1064 
1065  /// @brief \f$\rho_{infinity}\f$
1066  double roInf = 0.0;
1067 
1068  /// @brief Accepted relative tolerance
1069  double tol = 0.0;
1070 
1071  /// @brief Equation symbol
1072  std::string sym;
1073  //std::string(LEN=2) :: sym = "NA";
1074 
1075  /// @brief type of linear solver
1077 
1078  /// @brief The type of interface to a numerical linear algebra library.
1079  consts::LinearAlgebraType linear_algebra_type;
1080 
1081  /// @brief The type of assembly interface to a numerical linear algebra library.
1082  consts::LinearAlgebraType linear_algebra_assembly_type;
1083 
1084  /// @brief The type of preconditioner used by the interface to a numerical linear algebra library.
1085  consts::PreconditionerType linear_algebra_preconditioner = consts::PreconditionerType::PREC_FSILS;
1086 
1087  /// @brief Interface to a numerical linear algebra library.
1089 
1090  /// @brief FSILS type of linear solver
1091  fsi_linear_solver::FSILS_lsType FSILS;
1092 
1093  /// @brief BCs associated with this equation;
1094  std::vector<bcType> bc;
1095 
1096  /// @brief IB: BCs associated with this equation on immersed surfaces
1097  std::vector<bcType> bcIB;
1098 
1099  /// @brief domains that this equation must be solved
1100  std::vector<dmnType> dmn;
1101 
1102  /// @brief IB: immersed domains that this equation must be solved
1103  std::vector<dmnType> dmnIB;
1104 
1105  /// @brief Outputs
1106  std::vector<outputType> output;
1107 
1108  /// @brief IB: Outputs
1109  std::vector<outputType> outIB;
1110 
1111  /// @brief Body force associated with this equation
1112  std::vector<bfType> bf;
1113 };
1114 
1115 /// @brief This type will be used to write data in the VTK files.
1116 //
1118 {
1119  public:
1120 
1121  // Element number of nodes
1122  int eNoN = 0;
1123 
1124  // Number of elements
1125  int nEl = 0;
1126 
1127  // Number of nodes
1128  int nNo = 0;
1129 
1130  // vtk type
1131  int vtkType = 0;
1132 
1133  // Connectivity array
1134  Array<int> IEN;
1135 
1136  // Element based variables to be written
1137  Array<double> xe;
1138 
1139  // All the variables after transformation to global format
1140  Array<double> gx;
1141 
1142  // All the variables to be written (including position)
1143  Array<double> x;
1144 };
1145 
1146 
1148 {
1149  public:
1150 
1151  rmshType();
1152 
1153  /// @brief Whether remesh is required for problem or not
1154  bool isReqd = false;
1155 
1156  /// @brief Method for remeshing: 1-TetGen, 2-MeshSim
1157  consts::MeshGeneratorType method = consts::MeshGeneratorType::RMSH_TETGEN;
1158 
1159  /// @brief Counter to track number of remesh done
1160  int cntr = 0;
1161 
1162  /// @brief Time step from which remeshing is done
1163  int rTS = 0;
1164 
1165  /// @brief Time step freq for saving data
1166  int cpVar = 0;
1167 
1168  /// @brief Time step at which forced remeshing is done
1169  int fTS = 1000;
1170 
1171  /// @brief Time step frequency for forced remeshing
1172  int freq = 1000;
1173 
1174  /// @brief Time where remeshing starts
1175  double time = 0.0;
1176 
1177  /// @brief Mesh quality parameters
1178  double minDihedAng = 0.0;
1179  double maxRadRatio = 0.0;
1180 
1181  /// @brief Edge size of mesh
1183 
1184  /// @brief Initial norm of an equation
1186 
1187  /// @brief Copy of solution variables where remeshing starts
1188  Array<double> A0;
1189  Array<double> Y0;
1190  Array<double> D0;
1191 
1192  /// @brief Flag is set if remeshing is required for each mesh
1193  std::vector<bool> flag;
1194 };
1195 
1197 {
1198  public:
1199  /// @brief Num traces (nodes) local to each process
1201 
1202  /// @brief Pointer to global trace (node num) stacked contiguously
1204 
1205  /// @brief Num traces (Gauss points) local to each process
1207 
1208  /// @brief Pointer to global trace (Gauss point) stacked contiguously
1210 };
1211 
1212 
1213 /// @brief Immersed Boundary (IB) data type
1214 //
1215 class ibType
1216 {
1217  public:
1218 
1219  /// @brief Whether any file being saved
1220  bool savedOnce = false;
1221  //bool savedOnce = .FALSE.
1222 
1223  /// @brief IB method
1224  int mthd = 0;
1225  //int mthd = ibMthd_NA;
1226 
1227  /// @brief IB coupling
1228  int cpld = 0;
1229  //int cpld = ibCpld_NA;
1230 
1231  /// @brief IB interpolation method
1232  int intrp = 0;
1233  //int intrp = ibIntrp_NA;
1234 
1235  /// @brief Current IB domain ID
1236  int cDmn = 0;
1237 
1238  /// @brief Current equation
1239  int cEq = 0;
1240 
1241  /// @brief Total number of IB nodes
1242  int tnNo = 0;
1243 
1244  /// @brief Number of IB meshes
1245  int nMsh = 0;
1246 
1247  /// @brief IB call duration (1: total time; 2: update; 3,4: communication)
1248  double callD[4] = {0.0, 0.0, 0.0, 0.0};
1249 
1250  /// @brief IB Domain ID
1252 
1253  /// @brief Row pointer (for sparse LHS matrix storage)
1255 
1256  /// @brief Column pointer (for sparse LHS matrix storage)
1258 
1259  /// @brief IB position coordinates
1260  Array<double> x;
1261 
1262  /// @brief Velocity (new)
1263  Array<double> Yb;
1264 
1265  /// @brief Time derivative of displacement (old)
1266  Array<double> Auo;
1267 
1268  /// @brief Time derivative of displacement (new)
1269  Array<double> Aun;
1270 
1271  /// @brief Time derivative of displacement (n+am)
1272  Array<double> Auk;
1273 
1274  /// @brief Displacement (old)
1275  Array<double> Ubo;
1276 
1277  /// @brief Displacement (new)
1278  Array<double> Ubn;
1279 
1280  /// @brief Displacement (n+af)
1281  Array<double> Ubk;
1282 
1283  /// @brief Displacement (projected on background mesh, old)
1284  Array<double> Uo;
1285 
1286  /// @brief Displacement (projected on background mesh, new, n+af)
1287  Array<double> Un;
1288 
1289  /// @brief Residual (FSI force)
1290  Array<double> R;
1291 
1292  /// @brief Residual (displacement, background mesh)
1293  Array<double> Ru;
1294 
1295  /// @brief Residual (displacement, IB mesh)
1296  Array<double> Rub;
1297 
1298  /// @brief LHS tangent matrix for displacement
1299  Array<double> Ku;
1300 
1301  /// @brief DERIVED class VARIABLES IB meshes;
1302  std::vector<mshType> msh;
1303 
1304  /// @brief IB communicator
1306 };
1307 
1308 /// @brief The ComMod class duplicates the data structures in the Fortran COMMOD module
1309 /// defined in MOD.f.
1310 ///
1311 /// The data members here are the global variables exposed by the COMMOD module.
1312 //
1313 class ComMod {
1314 
1315  public:
1316  ComMod();
1317  ~ComMod();
1318 
1319  //----- bool members -----//
1320 
1321  /// @brief Whether there is a requirement to update mesh and Dn-Do variables
1322  bool dFlag = false;
1323 
1324  /// @brief Whether mesh is moving
1325  bool mvMsh = false;
1326 
1327  /// @brief Whether to averaged results
1328  bool saveAve = false;
1329 
1330  /// @brief Whether to save to VTK files
1331  bool saveVTK = false;
1332 
1333  /// @brief Whether any file being saved
1334  bool savedOnce = false;
1335 
1336  /// @brief Whether to use separator in output
1337  bool sepOutput = false;
1338 
1339  /// @brief Whether start from beginning or from simulations
1340  bool stFileFlag = false;
1341 
1342  /// @brief Whether to overwrite restart file or not
1343  bool stFileRepl = false;
1344 
1345  /// @brief Restart simulation after remeshing
1346  bool resetSim = false;
1347 
1348  /// @brief Check IEN array for initial mesh
1349  bool ichckIEN = false;
1350 
1351  /// @brief Reset averaging variables from zero
1352  bool zeroAve = false;
1353 
1354  /// @brief Whether CMM equation is initialized
1355  bool cmmInit = false;
1356 
1357  /// @brief Whether variable wall properties are used for CMM
1358  bool cmmVarWall = false;
1359 
1360  /// @brief Whether shell equation is being solved
1361  bool shlEq = false;
1362 
1363  /// @brief Whether PRESTRESS is being solved
1364  bool pstEq = false;
1365 
1366  /// @brief Whether velocity-pressure based structural dynamics solver is used
1367  bool sstEq = false;
1368 
1369  /// @brief Whether to detect and apply any contact model
1370  bool iCntct = false;
1371 
1372  /// @brief Whether any Immersed Boundary (IB) treatment is required
1373  bool ibFlag = false;
1374 
1375  /// @brief Postprocess step - convert bin to vtk
1376  bool bin2VTK = false;
1377 
1378  /// @brief Whether to use precomputed state-variable solutions
1379  bool usePrecomp = false;
1380  //----- int members -----//
1381 
1382  /// @brief Current domain
1383  int cDmn = 0;
1384 
1385  /// @brief Current equation
1386  int cEq = 0;
1387 
1388  /// @brief Current time step
1389  int cTS = 0;
1390 
1391  std::array<double,3> timeP;
1392 
1393  /// @brief Starting time step
1394  int startTS = 0;
1395 
1396  /// @brief Current equation degrees of freedom
1397  int dof = 0;
1398 
1399  /// @brief Global total number of nodes, across all meshes (total) and all
1400  /// procs (global)
1401  int gtnNo = 0;
1402 
1403  /// @brief Number of equations
1404  int nEq = 0;
1405 
1406  /// @brief Number of faces in the LHS passed to FSILS
1407  int nFacesLS = 0;
1408 
1409  /// @brief Number of meshes
1410  int nMsh = 0;
1411 
1412  /// @brief Number of spatial dimensions
1413  int nsd = 0;
1414 
1415  /// @brief Number of time steps
1416  int nTS = 0;
1417 
1418  /// @brief Number of initialization time steps
1419  int nITs = 0;
1420 
1421  /// @brief stFiles record length
1422  int recLn = 0;
1423 
1424  /// @brief Start saving after this number of time step
1425  int saveATS = 0;
1426 
1427  /// @brief Increment in saving solutions
1428  int saveIncr = 0;
1429 
1430  /// @brief Stamp ID to make sure simulation is compatible with stFiles
1431  std::array<int,7> stamp;
1432 
1433  /// @brief Increment in saving restart file
1434  int stFileIncr = 0;
1435 
1436  /// @brief Total number of degrees of freedom per node
1437  int tDof = 0;
1438 
1439  /// @brief Total number of nodes (number of nodes on current proc across
1440  /// all meshes)
1441  int tnNo = 0;
1442 
1443  /// @brief Restart Time Step
1444  int rsTS = 0;
1445 
1446  /// @brief Number of stress values to be stored
1447  int nsymd = 0;
1448 
1449 
1450  //----- double members -----//
1451 
1452  /// @brief Time step size
1453  double dt = 0.0;
1454 
1455  /// @brief Time step size of the precomputed state-variables
1456  double precompDt = 0.0;
1457 
1458  /// @brief Time
1459  double time = 0.0;
1460 
1461 
1462  //----- string members -----//
1463 
1464  /// @brief Initialization file path
1465  std::string iniFilePath;
1466 
1467  /// @brief Saved output file name
1468  std::string saveName;
1469 
1470  /// @brief Restart file name
1471  std::string stFileName;
1472 
1473  /// @brief Stop_trigger file name
1474  std::string stopTrigName;
1475 
1476  /// @brief Precomputed state-variable file name
1477  std::string precompFileName;
1478 
1479  /// @brief Precomputed state-variable field name
1480  std::string precompFieldName;
1481  // ALLOCATABLE DATA
1482 
1483  /// @brief Column pointer (for sparse LHS matrix structure)
1484  /// Modified in: lhsa()
1486 
1487  /// @brief Domain ID
1489 
1490  /// @brief Local to global pointer tnNo --> gtnNo
1492 
1493  /// @brief Row pointer (for sparse LHS matrix structure)
1494  /// Modified in: lhsa()
1496 
1497  /// @brief Array that maps global node id to rowN in the matrix
1498  /// Modified in: lhsa()
1500 
1501  /// @brief Boundary nodes set for CMM initialization and for zeroing-out
1502  /// non-wall nodal displacements
1504 
1505  /// @brief IB: iblank used for immersed boundaries (1 => solid, 0 => fluid)
1507 
1508  /// @brief Old time derivative of variables (acceleration)
1509  Array<double> Ao;
1510 
1511  /// @brief New time derivative of variables
1512  Array<double> An;
1513 
1514  /// @brief Old integrated variables (dissplacement)
1515  Array<double> Do;
1516 
1517  /// @brief New integrated variables
1518  Array<double> Dn;
1519 
1520  /// @brief Residual vector
1521  Array<double> R;
1522 
1523  /// @brief LHS matrix
1524  Array<double> Val;
1525 
1526  /// @brief Position vector of mesh nodes (in ref config)
1527  Array<double> x;
1528 
1529  /// @brief Old variables (velocity)
1530  Array<double> Yo;
1531 
1532  /// @brief New variables
1533  Array<double> Yn;
1534 
1535  /// @brief Body force
1536  Array<double> Bf;
1537 
1538  //-----------------------------------------------------
1539  // Additional arrays for velocity-based formulation of
1540  // nonlinear solid mechanics.
1541  //-----------------------------------------------------
1542 
1543  /// @brief Time derivative of displacement
1544  Array<double> Ad;
1545 
1546  /// @brief Residual of the displacement equation
1547  Array<double> Rd;
1548 
1549  /// @brief LHS matrix for displacement equation
1550  Array<double> Kd;
1551 
1552  /// @brief Variables for prestress calculations
1553  Array<double> pS0;
1554  Array<double> pSn;
1555  Vector<double> pSa;
1556 
1557  /// @brief Temporary storage for initializing state variables
1559  Array<double> Vinit;
1560  Array<double> Dinit;
1561 
1562  /// @brief CMM-variable wall properties: 1-thickness, 2-Elasticity modulus
1563  Array<double> varWallProps;
1564 
1565  //------------------------
1566  // DERIVED TYPE VARIABLES
1567  //------------------------
1568 
1569  /// @brief Coupled BCs structures used for multidomain simulations
1571 
1572  /// @brief All data related to equations are stored in this container
1573  std::vector<eqType> eq;
1574 
1575  /// @brief FSILS data structure to produce LHS sparse matrix
1576  fsi_linear_solver::FSILS_lhsType lhs;
1577 
1578  /// @brief All the meshes are stored in this variable
1579  std::vector<mshType> msh;
1580 
1581  /// @brief Input/output to the screen is handled by this structure
1582  chnlType std, err, wrn, dbg;
1583 
1584  /// @brief To group above channels
1586 
1587  /// @brief The general communicator
1589 
1590  /// @brief Remesher type
1592 
1593  /// @brief Contact model type
1595 
1596  /// @brief IB: Immersed boundary data structure
1598 
1599  bool debug_active = false;
1600 
1601  Timer timer;
1602 };
1603 
1604 #endif
1605 
The ComMod class duplicates the data structures in the Fortran COMMOD module defined in MOD....
Definition: ComMod.h:1313
std::string stopTrigName
Stop_trigger file name.
Definition: ComMod.h:1474
ibType ib
IB: Immersed boundary data structure.
Definition: ComMod.h:1597
int stFileIncr
Increment in saving restart file.
Definition: ComMod.h:1434
int nITs
Number of initialization time steps.
Definition: ComMod.h:1419
bool ibFlag
Whether any Immersed Boundary (IB) treatment is required.
Definition: ComMod.h:1373
Vector< int > colPtr
Column pointer (for sparse LHS matrix structure) Modified in: lhsa()
Definition: ComMod.h:1485
bool zeroAve
Reset averaging variables from zero.
Definition: ComMod.h:1352
std::string saveName
Saved output file name.
Definition: ComMod.h:1468
int nMsh
Number of meshes.
Definition: ComMod.h:1410
chnlType std
Input/output to the screen is handled by this structure.
Definition: ComMod.h:1582
bool savedOnce
Whether any file being saved.
Definition: ComMod.h:1334
bool stFileRepl
Whether to overwrite restart file or not.
Definition: ComMod.h:1343
Array< double > varWallProps
CMM-variable wall properties: 1-thickness, 2-Elasticity modulus.
Definition: ComMod.h:1563
Array< double > x
Position vector of mesh nodes (in ref config)
Definition: ComMod.h:1527
bool cmmVarWall
Whether variable wall properties are used for CMM.
Definition: ComMod.h:1358
std::array< int, 7 > stamp
Stamp ID to make sure simulation is compatible with stFiles.
Definition: ComMod.h:1431
Array< double > Ad
Time derivative of displacement.
Definition: ComMod.h:1544
int cTS
Current time step.
Definition: ComMod.h:1389
int dof
Current equation degrees of freedom.
Definition: ComMod.h:1397
int gtnNo
Global total number of nodes, across all meshes (total) and all procs (global)
Definition: ComMod.h:1401
std::string stFileName
Restart file name.
Definition: ComMod.h:1471
int tnNo
Total number of nodes (number of nodes on current proc across all meshes)
Definition: ComMod.h:1441
int nsd
Number of spatial dimensions.
Definition: ComMod.h:1413
int nFacesLS
Number of faces in the LHS passed to FSILS.
Definition: ComMod.h:1407
int nsymd
Number of stress values to be stored.
Definition: ComMod.h:1447
Array< double > Yn
New variables.
Definition: ComMod.h:1533
bool ichckIEN
Check IEN array for initial mesh.
Definition: ComMod.h:1349
std::string iniFilePath
Initialization file path.
Definition: ComMod.h:1465
Vector< int > rowPtr
Row pointer (for sparse LHS matrix structure) Modified in: lhsa()
Definition: ComMod.h:1495
std::string precompFileName
Precomputed state-variable file name.
Definition: ComMod.h:1477
int cEq
Current equation.
Definition: ComMod.h:1386
Vector< int > cmmBdry
Boundary nodes set for CMM initialization and for zeroing-out non-wall nodal displacements.
Definition: ComMod.h:1503
Array< double > Val
LHS matrix.
Definition: ComMod.h:1524
bool bin2VTK
Postprocess step - convert bin to vtk.
Definition: ComMod.h:1376
bool saveAve
Whether to averaged results.
Definition: ComMod.h:1328
bool saveVTK
Whether to save to VTK files.
Definition: ComMod.h:1331
int tDof
Total number of degrees of freedom per node.
Definition: ComMod.h:1437
std::string precompFieldName
Precomputed state-variable field name.
Definition: ComMod.h:1480
bool cmmInit
Whether CMM equation is initialized.
Definition: ComMod.h:1355
Array< double > Rd
Residual of the displacement equation.
Definition: ComMod.h:1547
cplBCType cplBC
Coupled BCs structures used for multidomain simulations.
Definition: ComMod.h:1570
double time
Time.
Definition: ComMod.h:1459
Array< double > Dn
New integrated variables.
Definition: ComMod.h:1518
bool pstEq
Whether PRESTRESS is being solved.
Definition: ComMod.h:1364
bool resetSim
Restart simulation after remeshing.
Definition: ComMod.h:1346
Array< double > An
New time derivative of variables.
Definition: ComMod.h:1512
double dt
Time step size.
Definition: ComMod.h:1453
Array< double > R
Residual vector.
Definition: ComMod.h:1521
rmshType rmsh
Remesher type.
Definition: ComMod.h:1591
int saveIncr
Increment in saving solutions.
Definition: ComMod.h:1428
bool usePrecomp
Whether to use precomputed state-variable solutions.
Definition: ComMod.h:1379
ioType io
To group above channels.
Definition: ComMod.h:1585
cntctModelType cntctM
Contact model type.
Definition: ComMod.h:1594
cmType cm
The general communicator.
Definition: ComMod.h:1588
int startTS
Starting time step.
Definition: ComMod.h:1394
Vector< int > idMap
Array that maps global node id to rowN in the matrix Modified in: lhsa()
Definition: ComMod.h:1499
bool stFileFlag
Whether start from beginning or from simulations.
Definition: ComMod.h:1340
bool sepOutput
Whether to use separator in output.
Definition: ComMod.h:1337
bool shlEq
Whether shell equation is being solved.
Definition: ComMod.h:1361
std::vector< eqType > eq
All data related to equations are stored in this container.
Definition: ComMod.h:1573
bool iCntct
Whether to detect and apply any contact model.
Definition: ComMod.h:1370
double precompDt
Time step size of the precomputed state-variables.
Definition: ComMod.h:1456
Array< double > Do
Old integrated variables (dissplacement)
Definition: ComMod.h:1515
bool dFlag
Whether there is a requirement to update mesh and Dn-Do variables.
Definition: ComMod.h:1322
int cDmn
Current domain.
Definition: ComMod.h:1383
int nTS
Number of time steps.
Definition: ComMod.h:1416
Array< double > Ao
Old time derivative of variables (acceleration)
Definition: ComMod.h:1509
int nEq
Number of equations.
Definition: ComMod.h:1404
Vector< int > iblank
IB: iblank used for immersed boundaries (1 => solid, 0 => fluid)
Definition: ComMod.h:1506
Array< double > Kd
LHS matrix for displacement equation.
Definition: ComMod.h:1550
std::vector< mshType > msh
All the meshes are stored in this variable.
Definition: ComMod.h:1579
int recLn
stFiles record length
Definition: ComMod.h:1422
int rsTS
Restart Time Step.
Definition: ComMod.h:1444
bool mvMsh
Whether mesh is moving.
Definition: ComMod.h:1325
Vector< double > Pinit
Temporary storage for initializing state variables.
Definition: ComMod.h:1558
Vector< int > ltg
Local to global pointer tnNo --> gtnNo.
Definition: ComMod.h:1491
fsi_linear_solver::FSILS_lhsType lhs
FSILS data structure to produce LHS sparse matrix.
Definition: ComMod.h:1576
Array< double > Yo
Old variables (velocity)
Definition: ComMod.h:1530
Array< double > Bf
Body force.
Definition: ComMod.h:1536
Vector< int > dmnId
Domain ID.
Definition: ComMod.h:1488
Array< double > pS0
Variables for prestress calculations.
Definition: ComMod.h:1553
int saveATS
Start saving after this number of time step.
Definition: ComMod.h:1425
bool sstEq
Whether velocity-pressure based structural dynamics solver is used.
Definition: ComMod.h:1367
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:448
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:677
For coupled 0D-3D problems.
Definition: ComMod.h:735
consts::CplBCType schm
Implicit/Explicit/Semi-implicit schemes.
Definition: ComMod.h:760
int nX
Number of unknowns in the 0D domain.
Definition: ComMod.h:754
int nFa
Number of coupled faces.
Definition: ComMod.h:751
Vector< double > xo
Old time step unknowns in the 0D domain.
Definition: ComMod.h:778
bool useGenBC
Whether to use genBC.
Definition: ComMod.h:742
std::string binPath
Path to the 0D code binary file.
Definition: ComMod.h:764
std::string saveName
The name of history file containing "X".
Definition: ComMod.h:771
std::string commuName
File name for communication between 0D and 3D.
Definition: ComMod.h:767
bool coupled
Is multi-domain active.
Definition: ComMod.h:739
std::vector< cplFaceType > fa
Data structure used for communicating with 0D code.
Definition: ComMod.h:784
Vector< double > xp
Output variables to be printed.
Definition: ComMod.h:781
Vector< double > xn
New time step unknowns in the 0D domain.
Definition: ComMod.h:775
int nXp
Number of output variables addition to nX.
Definition: ComMod.h:757
Definition: ComMod.h:699
This type will be used to write data in the VTK files.
Definition: ComMod.h:1118
Domain type is to keep track with element belong to which domain and also different physical quantiti...
Definition: ComMod.h:416
Equation type.
Definition: ComMod.h:981
LinearAlgebra * linear_algebra
Interface to a numerical linear algebra library.
Definition: ComMod.h:1088
double roInf
Definition: ComMod.h:1066
int maxItr
Maximum iteration for this eq.
Definition: ComMod.h:1012
int s
Pointer to start of unknown Yo(:,s:e)
Definition: ComMod.h:1006
int nDmnIB
IB: Number of immersed domains.
Definition: ComMod.h:1027
bool coupled
Should be satisfied in a coupled/uncoupled fashion.
Definition: ComMod.h:987
bool ok
Satisfied/not satisfied.
Definition: ComMod.h:991
int nBcIB
Number of BCs on immersed surfaces.
Definition: ComMod.h:1033
std::string sym
Equation symbol.
Definition: ComMod.h:1072
bool assmTLS
Use C++ Trilinos framework for assembly and for linear solvers.
Definition: ComMod.h:997
lsType ls
type of linear solver
Definition: ComMod.h:1076
std::vector< outputType > outIB
IB: Outputs.
Definition: ComMod.h:1109
double tol
Accepted relative tolerance.
Definition: ComMod.h:1069
bool useTLS
Use C++ Trilinos framework for the linear solvers.
Definition: ComMod.h:994
int itr
Number of performed iterations.
Definition: ComMod.h:1009
double gam
Definition: ComMod.h:1057
int nBc
Number of BCs.
Definition: ComMod.h:1030
int e
Pointer to end of unknown Yo(:,s:e)
Definition: ComMod.h:1003
std::vector< dmnType > dmn
domains that this equation must be solved
Definition: ComMod.h:1100
consts::PreconditionerType linear_algebra_preconditioner
The type of preconditioner used by the interface to a numerical linear algebra library.
Definition: ComMod.h:1085
int nOutIB
IB: Number of possible outputs.
Definition: ComMod.h:1021
double am
Definition: ComMod.h:1051
double iNorm
Initial norm of residual.
Definition: ComMod.h:1060
consts::LinearAlgebraType linear_algebra_assembly_type
The type of assembly interface to a numerical linear algebra library.
Definition: ComMod.h:1082
consts::LinearAlgebraType linear_algebra_type
The type of interface to a numerical linear algebra library.
Definition: ComMod.h:1079
std::vector< bfType > bf
Body force associated with this equation.
Definition: ComMod.h:1112
double pNorm
First iteration norm.
Definition: ComMod.h:1063
double af
Definition: ComMod.h:1044
int nBf
Number of BFs.
Definition: ComMod.h:1036
int nDmn
Number of domains.
Definition: ComMod.h:1024
int nOutput
Number of possible outputs.
Definition: ComMod.h:1018
std::vector< dmnType > dmnIB
IB: immersed domains that this equation must be solved.
Definition: ComMod.h:1103
std::vector< bcType > bc
BCs associated with this equation;.
Definition: ComMod.h:1094
std::vector< bcType > bcIB
IB: BCs associated with this equation on immersed surfaces.
Definition: ComMod.h:1097
int dof
Degrees of freedom.
Definition: ComMod.h:1000
fsi_linear_solver::FSILS_lsType FSILS
FSILS type of linear solver.
Definition: ComMod.h:1091
consts::EquationType phys
Type of equation fluid/heatF/heatS/lElas/FSI.
Definition: ComMod.h:1039
std::vector< outputType > output
Outputs.
Definition: ComMod.h:1106
double beta
Definition: ComMod.h:1054
int minItr
Minimum iteration for this eq.
Definition: ComMod.h:1015
The face type containing mesh at boundary.
Definition: ComMod.h:502
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
Function spaces (basis) type.
Definition: ComMod.h:249
void destroy()
SUBROUTINE DESTROYFS(fs)
Definition: ComMod.cpp:175
Definition: ComMod.h:1197
Vector< int > nG
Num traces (Gauss points) local to each process.
Definition: ComMod.h:1206
Vector< int > n
Num traces (nodes) local to each process.
Definition: ComMod.h:1200
Vector< int > gE
Pointer to global trace (Gauss point) stacked contiguously.
Definition: ComMod.h:1209
Vector< int > gN
Pointer to global trace (node num) stacked contiguously.
Definition: ComMod.h:1203
Immersed Boundary (IB) data type.
Definition: ComMod.h:1216
Array< double > x
IB position coordinates.
Definition: ComMod.h:1260
Array< double > Aun
Time derivative of displacement (new)
Definition: ComMod.h:1269
int cpld
IB coupling.
Definition: ComMod.h:1228
Array< double > Ku
LHS tangent matrix for displacement.
Definition: ComMod.h:1299
int tnNo
Total number of IB nodes.
Definition: ComMod.h:1242
Array< double > Un
Displacement (projected on background mesh, new, n+af)
Definition: ComMod.h:1287
int cEq
Current equation.
Definition: ComMod.h:1239
Array< double > R
Residual (FSI force)
Definition: ComMod.h:1290
int intrp
IB interpolation method.
Definition: ComMod.h:1232
Array< double > Uo
Displacement (projected on background mesh, old)
Definition: ComMod.h:1284
Array< double > Yb
Velocity (new)
Definition: ComMod.h:1263
Array< double > Ubn
Displacement (new)
Definition: ComMod.h:1278
int cDmn
Current IB domain ID.
Definition: ComMod.h:1236
double callD[4]
IB call duration (1: total time; 2: update; 3,4: communication)
Definition: ComMod.h:1248
ibCommType cm
IB communicator.
Definition: ComMod.h:1305
Vector< int > rowPtr
Row pointer (for sparse LHS matrix storage)
Definition: ComMod.h:1254
Array< double > Rub
Residual (displacement, IB mesh)
Definition: ComMod.h:1296
bool savedOnce
Whether any file being saved.
Definition: ComMod.h:1220
Vector< int > dmnID
IB Domain ID.
Definition: ComMod.h:1251
Array< double > Auo
Time derivative of displacement (old)
Definition: ComMod.h:1266
Array< double > Ubk
Displacement (n+af)
Definition: ComMod.h:1281
int nMsh
Number of IB meshes.
Definition: ComMod.h:1245
int mthd
IB method.
Definition: ComMod.h:1224
std::vector< mshType > msh
DERIVED class VARIABLES IB meshes;.
Definition: ComMod.h:1302
Array< double > Ubo
Displacement (old)
Definition: ComMod.h:1275
Vector< int > colPtr
Column pointer (for sparse LHS matrix storage)
Definition: ComMod.h:1257
Array< double > Ru
Residual (displacement, background mesh)
Definition: ComMod.h:1293
Array< double > Auk
Time derivative of displacement (n+am)
Definition: ComMod.h:1272
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:621
double absTol
Absolute tolerance (IN)
Definition: ComMod.h:652
int cN
Number of |x| norms (OUT)
Definition: ComMod.h:643
int cD
Number of <x.y> dot products (OUT)
Definition: ComMod.h:646
double fNorm
Final norm of residual (OUT)
Definition: ComMod.h:661
double callD
Calling duration (OUT)
Definition: ComMod.h:667
int reserve
Only for data alignment (-)
Definition: ComMod.h:649
bool suc
Successful solving (OUT)
Definition: ComMod.h:628
int mItr
Maximum iterations (IN)
Definition: ComMod.h:631
consts::SolverType LS_type
LS solver (IN)
Definition: ComMod.h:625
int itr
Number of iteration (OUT)
Definition: ComMod.h:637
double relTol
Relative tolerance (IN)
Definition: ComMod.h:655
double dB
Res. rduction in last itr. (OUT)
Definition: ComMod.h:664
int sD
Space dimension (IN)
Definition: ComMod.h:634
int cM
Number of Ax multiple (OUT)
Definition: ComMod.h:640
double iNorm
Initial norm of residual (OUT)
Definition: ComMod.h:658
This is the container for a mesh or NURBS patch, those specific to NURBS are noted.
Definition: ComMod.h:791
int nNo
Number of nodes (control points) for 2D elements?
Definition: ComMod.h:852
Vector< double > w
Gauss weights.
Definition: ComMod.h:912
std::vector< std::vector< int > > ordering
@breif ordering: node ordering for boundaries
Definition: ComMod.h:870
Array< double > N
Parent shape function.
Definition: ComMod.h:924
traceType trc
IB: tracers.
Definition: ComMod.h:967
Array3< double > Ys
Solution field (displacement, velocity, pressure, etc.) for a known, potentially time-varying,...
Definition: ComMod.h:946
Vector< int > eDist
Element distribution between processors.
Definition: ComMod.h:873
Vector< int > iGC
IB: Whether a cell is a ghost cell or not.
Definition: ComMod.h:906
adjType nAdj
Mesh nodal adjacency.
Definition: ComMod.h:952
Array< double > xib
Bounds on parameteric coordinates.
Definition: ComMod.h:918
adjType eAdj
Mesh element adjacency.
Definition: ComMod.h:955
int nG
Number of Gauss points for integration.
Definition: ComMod.h:849
int nFa
Number of faces.
Definition: ComMod.h:843
Array< double > x
Position coordinates.
Definition: ComMod.h:921
std::vector< fsType > fs
Function spaces (basis)
Definition: ComMod.h:958
Array3< double > Nxx
Second derivatives of shape functions - used for shells & IGA davep double Nxx(:,:,...
Definition: ComMod.h:942
int gnNo
Global number of nodes (control points)
Definition: ComMod.h:834
double dx
IB: Mesh size parameter.
Definition: ComMod.h:867
bool lShpF
Whether the shape function is linear.
Definition: ComMod.h:815
Vector< int > lN
Global to local maping tnNo --> nNo.
Definition: ComMod.h:897
Vector< int > otnIEN
gIEN mapper from old to new
Definition: ComMod.h:891
int nFn
Number of fiber directions.
Definition: ComMod.h:861
Array< int > eIEN
Shells: extended IEN array with neighboring nodes.
Definition: ComMod.h:900
Vector< int > gN
Global nodes maping nNo --> tnNo.
Definition: ComMod.h:879
bool lFib
Whether the mesh is fibers (Purkinje)
Definition: ComMod.h:821
int eNoN
Number of nodes (control points) in a single element.
Definition: ComMod.h:828
double scF
Mesh scale factor.
Definition: ComMod.h:864
Vector< int > eId
Element domain ID number.
Definition: ComMod.h:876
int gnEl
Global number of elements (knot spans)
Definition: ComMod.h:831
int nSl
Number of elements sample points to be outputs (NURBS)
Definition: ComMod.h:855
Array< double > xi
Gauss integration points in parametric space.
Definition: ComMod.h:915
Array< double > fN
Fiber orientations stored at the element level - used for electrophysiology and solid mechanics.
Definition: ComMod.h:934
int nFs
Number of function spaces.
Definition: ComMod.h:846
Array< int > sbc
Shells: boundary condition variable.
Definition: ComMod.h:903
bool lShl
Whether the mesh is shell.
Definition: ComMod.h:818
Array< double > Nb
Shape function bounds.
Definition: ComMod.h:927
Array< double > nV
Normal vector to each nodal point (for Shells)
Definition: ComMod.h:930
Vector< double > nW
Control points weights (NURBS)
Definition: ComMod.h:909
Array3< double > Nx
Parent shape functions gradient double Nx(:,:,:)
Definition: ComMod.h:938
std::vector< faceType > fa
Faces are stored in this variable.
Definition: ComMod.h:964
Vector< int > gpN
GLobal projected nodes mapping projected -> unprojected mapping.
Definition: ComMod.h:882
Array< int > gIEN
Global connectivity array mappig eNoN,nEl --> gnNo.
Definition: ComMod.h:885
int vtkType
The element type recognized by VTK format.
Definition: ComMod.h:858
int nEl
Number of elements (knot spans)
Definition: ComMod.h:840
consts::ElementType eType
Element type.
Definition: ComMod.h:824
int nEf
Number of element face. Used for reading Gambit mesh files.
Definition: ComMod.h:837
std::string name
Mesh Name.
Definition: ComMod.h:949
std::vector< bsType > bs
BSpline in different directions (NURBS)
Definition: ComMod.h:961
Array< int > IEN
The connectivity array mapping eNoN,nEl --> nNo.
Definition: ComMod.h:888
double qmTET4
TET4 quadrature modifier.
Definition: ComMod.h:970
Array< int > INN
Local knot pointer (NURBS)
Definition: ComMod.h:894
Declared type for outputed variables.
Definition: ComMod.h:598
Definition: ComMod.h:122
Definition: ComMod.h:1148
Vector< double > iNorm
Initial norm of an equation.
Definition: ComMod.h:1185
int rTS
Time step from which remeshing is done.
Definition: ComMod.h:1163
int freq
Time step frequency for forced remeshing.
Definition: ComMod.h:1172
int cpVar
Time step freq for saving data.
Definition: ComMod.h:1166
Array< double > A0
Copy of solution variables where remeshing starts.
Definition: ComMod.h:1188
int cntr
Counter to track number of remesh done.
Definition: ComMod.h:1160
std::vector< bool > flag
Flag is set if remeshing is required for each mesh.
Definition: ComMod.h:1193
double time
Time where remeshing starts.
Definition: ComMod.h:1175
consts::MeshGeneratorType method
Method for remeshing: 1-TetGen, 2-MeshSim.
Definition: ComMod.h:1157
double minDihedAng
Mesh quality parameters.
Definition: ComMod.h:1178
int fTS
Time step at which forced remeshing is done.
Definition: ComMod.h:1169
Vector< double > maxEdgeSize
Edge size of mesh.
Definition: ComMod.h:1182
bool isReqd
Whether remesh is required for problem or not.
Definition: ComMod.h:1154
Structural domain type.
Definition: ComMod.h:343
Tracer type used for immersed boundaries. Identifies traces of nodes and integration points on backgr...
Definition: ComMod.h:467
Fluid viscosity model type.
Definition: ComMod.h:390