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