├── .gitignore
├── README.md
├── Tempest.cbp
├── Tempest.pro
├── bin
├── input_box
├── input_sphere
└── sphere_hex.geo
├── include
├── error.hpp
├── flux.hpp
├── geo.hpp
├── global.hpp
├── input.hpp
├── matrix.hpp
├── output.hpp
├── solver.hpp
└── tempest.hpp
├── makefile
└── src
├── flux.cpp
├── geo.cpp
├── global.cpp
├── input.cpp
├── matrix.cpp
├── output.cpp
├── solver.cpp
├── solver_bounds.cpp
└── tempest.cpp
/.gitignore:
--------------------------------------------------------------------------------
1 | # Compiled Object files
2 | *.slo
3 | *.lo
4 | *.o
5 | *.obj
6 |
7 | # Precompiled Headers
8 | *.gch
9 | *.pch
10 |
11 | # Compiled Dynamic libraries
12 | *.so
13 | *.dylib
14 | *.dll
15 |
16 | # Fortran module files
17 | *.mod
18 |
19 | # Compiled Static libraries
20 | *.lai
21 | *.la
22 | *.a
23 | *.lib
24 |
25 | # Executables
26 | *.exe
27 | *.out
28 | *.app
29 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Tempest
2 | 3D Overset Finite Volume CFD Code
3 |
--------------------------------------------------------------------------------
/Tempest.cbp:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
--------------------------------------------------------------------------------
/Tempest.pro:
--------------------------------------------------------------------------------
1 | TEMPLATE = app
2 | CONFIG += console debug
3 | CONFIG -= qt
4 |
5 | QMAKE_CXXFLAGS += -std=c++11
6 |
7 | INCLUDEPATH += $$PWD/include \
8 | lib/tioga/src
9 |
10 | SOURCES += src/global.cpp \
11 | src/matrix.cpp \
12 | src/input.cpp \
13 | src/ele.cpp \
14 | src/operators.cpp \
15 | src/geo.cpp \
16 | src/output.cpp \
17 | src/face.cpp \
18 | src/flux.cpp \
19 | src/solver.cpp \
20 | lib/tioga/src/ADT.C \
21 | lib/tioga/src/MeshBlock.C \
22 | lib/tioga/src/parallelComm.C \
23 | lib/tioga/src/tioga.C \
24 | lib/tioga/src/tiogaInterface.C \
25 | lib/tioga/src/math.c \
26 | lib/tioga/src/utils.c \
27 | lib/tioga/src/cellVolume.f90 \
28 | lib/tioga/src/computeCellVolume.f90 \
29 | lib/tioga/src/kaiser.f \
30 | lib/tioga/src/median.F90 \
31 | src/solver_bounds.cpp \
32 | src/tempest.cpp
33 |
34 | HEADERS += include/global.hpp \
35 | include/matrix.hpp \
36 | include/input.hpp \
37 | include/geo.hpp \
38 | include/output.hpp \
39 | include/face.hpp \
40 | include/flux.hpp \
41 | include/solver.hpp \
42 | include/error.hpp \
43 | lib/tioga/src/ADT.h \
44 | lib/tioga/src/codetypes.h \
45 | lib/tioga/src/globals.h \
46 | lib/tioga/src/MeshBlock.h \
47 | lib/tioga/src/parallelComm.h \
48 | lib/tioga/src/tioga.h \
49 | lib/tioga/src/tiogaInterface.h \
50 | lib/tioga/src/utils.h \
51 | include/tempest.hpp
52 |
53 | DISTFILES += \
54 | README.md \
55 |
56 | OTHER_FILES += makefile \
57 | lib/tioga/src/makefile
58 |
--------------------------------------------------------------------------------
/bin/input_box:
--------------------------------------------------------------------------------
1 | # =============================================================
2 | # Basic Options
3 | # =============================================================
4 | equation 1 (0: Advection-Diffusion; 1: Euler/Navier-Stokes)
5 | order 1 (Polynomial order to use)
6 | timeType 4 (0: Forward Euler, 4: RK44)
7 | dtType 0 (0: Fixed, 1: CFL-based)
8 | CFL .4
9 | dt .001
10 | iterMax 100
11 |
12 | viscous 0 (0: Inviscid, 1: Viscous)
13 | motion 0 (0: Static, 1: Perturbation test case)
14 | riemannType 0 (Advection: use 0 | N-S: 0: Rusanov, 1: Roe)
15 | testCase 0
16 |
17 | # =============================================================
18 | # Physics Parameters
19 | # =============================================================
20 | # Advection-Diffusion Equation Parameters
21 | advectVx 1 (Wave speed, x-direction)
22 | advectVy 1 (Wave speed, y-direction)
23 | advectVz -1 (Wave speed, z-direction)
24 | lambda 1 (Upwinding Parameter - 0: Central, 1: Upwind)
25 | diffD .1 (Diffusion Coefficient)
26 |
27 | # =============================================================
28 | # Initial Condition
29 | # =============================================================
30 | # Advection: 0-Gaussian, 1-u=x+y+z test case, 2-u=cos(x)*cos(y)*cos(z) test case
31 | # N-S: 0-Uniform flow, 1-Uniform+Vortex
32 | icType 2
33 |
34 | # =============================================================
35 | # Plotting/Output Options
36 | # =============================================================
37 | plotFreq 10 (Frequency to write plot files)
38 | monitorResFreq 1 (Frequency to print residual to terminal)
39 | resType 2 (1: 1-norm, 2: 2-norm, 3: Inf-norm)
40 | dataFileName Box (Filename prefix for output files)
41 | entropySensor 0 (Calculate & plot entropy-error sensor)
42 |
43 | # =============================================================
44 | # Mesh Options
45 | # =============================================================
46 | meshType 0 (0: Read mesh, 1: Create mesh, 2: Overset Mesh)
47 | meshFileName hexbox.msh
48 | # The following parameters are only needed when creating a mesh:
49 | # nDims, nx, ny, nz, xmin, xmax, etc.
50 | nDims 3
51 | nx 20
52 | ny 2
53 | nz 20
54 | xmin 0
55 | xmax 5
56 | ymin 0
57 | ymax 1
58 | zmin 0
59 | zmax 5
60 |
61 | # =============================================================
62 | # Boundary Conditions
63 | # =============================================================
64 | # For creating a cartesian mesh, boundary condition to apply to each face
65 | # (default is periodic)
66 | #create_bcTop char
67 | #create_bcBottom slip_wall ... etc.
68 |
69 | create_bcTop sup_in
70 | create_bcBottom slip_wall
71 | create_bcFront slip_wall
72 | create_bcBack slip_wall
73 | create_bcLeft sup_in
74 | create_bcRight slip_wall
75 |
76 | # Gmsh Boundary Conditions
77 | # List each Gmsh boundary: 'mesh_bound '
78 | # i.e. mesh_bound airfoil slip_wall
79 | #mesh_bound sphere slip_wall
80 | #mesh_bound overset sup_in
81 | mesh_bound fluid fluid
82 |
83 | mesh_bound top sup_out
84 | mesh_bound bottom sup_out
85 | mesh_bound left sup_out
86 | mesh_bound right sup_out
87 | mesh_bound front sup_out
88 | mesh_bound back sup_out
89 |
90 | #mesh_bound top sup_in
91 | #mesh_bound bottom slip_wall
92 | #mesh_bound left sup_in
93 | #mesh_bound right sup_in
94 | #mesh_bound front slip_wall
95 | #mesh_bound back slip_wall
96 |
97 | # =============================================================
98 | # Freestream Boundary Conditions [for all freestream/inlet-type boundaries]
99 | # =============================================================
100 | # Inviscid Flows
101 | rhoBound 1
102 | uBound 2.
103 | vBound 0.
104 | wBound -0.2
105 | pBound .7142857143
106 |
107 | # Viscous Flows
108 | MachBound .2
109 | Re 100
110 | Lref 1.0
111 | TBound 300
112 | nxBound 1
113 | nyBound 0
114 | nzBound 0
115 |
116 | # =============================================================
117 | # Numerics Options
118 | # =============================================================
119 | # Other FR-method parameters
120 | spts_type_quad Legendre
121 |
122 | # Shock Capturing Parameters
123 | shockCapture 0
124 | threshold .1
125 |
--------------------------------------------------------------------------------
/bin/input_sphere:
--------------------------------------------------------------------------------
1 | # =============================================================
2 | # Basic Options
3 | # =============================================================
4 | equation 1 (0: Advection-Diffusion; 1: Euler/Navier-Stokes)
5 | order 1 (Polynomial order to use)
6 | timeType 0 (0: Forward Euler, 4: RK44)
7 | dtType 0 (0: Fixed, 1: CFL-based)
8 | CFL .6
9 | dt .002
10 | iterMax 10000
11 |
12 | viscous 0 (0: Inviscid, 1: Viscous)
13 | motion 0 (0: Static, 1: Perturbation test case)
14 | riemannType 0 (Advection: use 0 | N-S: 0: Rusanov, 1: Roe)
15 | testCase 0
16 |
17 | # =============================================================
18 | # Physics Parameters
19 | # =============================================================
20 | # Advection-Diffusion Equation Parameters
21 | advectVx 1 (Wave speed, x-direction)
22 | advectVy 1 (Wave speed, y-direction)
23 | advectVz -1 (Wave speed, z-direction)
24 | lambda 1 (Upwinding Parameter - 0: Central, 1: Upwind)
25 | diffD .1 (Diffusion Coefficient)
26 |
27 | # =============================================================
28 | # Initial Condition
29 | # =============================================================
30 | # Advection: 0-Gaussian, 1-u=x+y+z test case, 2-u=cos(x)*cos(y)*cos(z) test case
31 | # N-S: 0-Uniform flow, 1-Uniform+Vortex
32 | icType 0
33 |
34 | # =============================================================
35 | # Plotting/Output Options
36 | # =============================================================
37 | plotFreq 1000 (Frequency to write plot files)
38 | monitorResFreq 200 (Frequency to print residual to terminal)
39 | resType 2 (1: 1-norm, 2: 2-norm, 3: Inf-norm)
40 | dataFileName Sphere (Filename prefix for output files)
41 | entropySensor 0 (Calculate & plot entropy-error sensor)
42 |
43 | # =============================================================
44 | # Mesh Options
45 | # =============================================================
46 | meshType 0 (0: Read mesh, 1: Create mesh, 2: Overset Mesh)
47 | meshFileName sphere_hex.msh
48 | oversetGrids 2 sphere_hex.msh HexBox.msh
49 | # The following parameters are only needed when creating a mesh:
50 | # nDims, nx, ny, nz, xmin, xmax, etc.
51 | nDims 3
52 | nx 10
53 | ny 10
54 | nz 10
55 | xmin 0
56 | xmax 3
57 | ymin 0
58 | ymax 3
59 | zmin 0
60 | zmax 3
61 |
62 | # =============================================================
63 | # Boundary Conditions
64 | # =============================================================
65 | # For creating a cartesian mesh, boundary condition to apply to each face
66 | # (default is periodic)
67 | #create_bcTop char
68 | #create_bcBottom slip_wall ... etc.
69 | create_bcTop sup_in
70 | create_bcBottom slip_wall
71 | create_bcFront sup_in
72 | create_bcBack sup_in
73 | create_bcLeft sup_in
74 | create_bcRight sup_in
75 |
76 | # Gmsh Boundary Conditions
77 | # List each Gmsh boundary: 'mesh_bound '
78 | # i.e. mesh_bound airfoil slip_wall
79 | mesh_bound sphere slip_wall
80 | mesh_bound overset sup_in
81 | mesh_bound fluid fluid
82 |
83 | # =============================================================
84 | # Freestream Boundary Conditions [for all freestream/inlet-type boundaries]
85 | # =============================================================
86 | # Inviscid Flows
87 | rhoBound 1
88 | uBound 0.2
89 | vBound 0.
90 | wBound 0.
91 | pBound .7142857143
92 |
93 | # Viscous Flows
94 | MachBound .2
95 | Re 100
96 | Lref 1.0
97 | TBound 300
98 | nxBound 1
99 | nyBound 0
100 | nzBound 0
101 |
102 | # =============================================================
103 | # Numerics Options
104 | # =============================================================
105 | # Other FR-method parameters
106 | spts_type_quad Legendre
107 |
108 | # Shock Capturing Parameters
109 | shockCapture 0
110 | threshold .1
111 |
--------------------------------------------------------------------------------
/bin/sphere_hex.geo:
--------------------------------------------------------------------------------
1 | // Gmsh project
2 | size1 = .3; // .19
3 | size2 = .7; // .55
4 | R1 = .5; // Radius of inner sphere
5 | R2 = 8; // Radius of outer sphere
6 | NN = 7; // Number of points in each direction on each spherical surface
7 | NL = 17; // Number of layers between surfaces
8 | prog1 = 1.15; // Geometric progression factor for layer width
9 |
10 | R1 = Sqrt(R1*R1/3);
11 | R2 = Sqrt(R2*R2/3);
12 |
13 | /* ---- Inner Sphere Surface ---- */
14 |
15 | Point(1) = {0.0,0.0,0.0,size1};
16 |
17 | Point(2) = {-R1, -R1, -R1, size1};
18 | Point(3) = { R1, -R1, -R1, size1};
19 | Point(4) = { R1, R1, -R1, size1};
20 | Point(5) = {-R1, R1, -R1, size1};
21 |
22 | Point(6) = {-R1, -R1, R1, size1};
23 | Point(7) = { R1, -R1, R1, size1};
24 | Point(8) = { R1, R1, R1, size1};
25 | Point(9) = {-R1, R1, R1, size1};
26 |
27 | // 'Bottom' circles
28 | Circle(1) = {2,1,3};
29 | Circle(2) = {3,1,4};
30 | Circle(3) = {4,1,5};
31 | Circle(4) = {5,1,2};
32 |
33 | // 'Top' circles
34 | Circle(5) = {6,1,7};
35 | Circle(6) = {7,1,8};
36 | Circle(7) = {8,1,9};
37 | Circle(8) = {9,1,6};
38 |
39 | // 'Vertical' circles
40 | Circle(9) = {2,1,6};
41 | Circle(10) = {3,1,7};
42 | Circle(11) = {4,1,8};
43 | Circle(12) = {5,1,9};
44 |
45 | Transfinite Line {1:12} = NN Using Progression 1.0;
46 |
47 | Line Loop (1) = {1,2,3,4};
48 | Line Loop (2) = {5,6,7,8};
49 | Line Loop (3) = {4,9,-8,-12};
50 | Line Loop (4) = {2,11,-6,-10};
51 | Line Loop (5) = {1,10,-5,-9};
52 | Line Loop (6) = {3,12,-7,-11};
53 |
54 | Ruled Surface (1) = {1};
55 | Ruled Surface (2) = {2};
56 | Ruled Surface (3) = {3};
57 | Ruled Surface (4) = {4};
58 | Ruled Surface (5) = {5};
59 | Ruled Surface (6) = {6};
60 |
61 | Transfinite Surface {1:6};
62 | Recombine Surface {1:6};
63 |
64 |
65 | /* ---- Outer Sphere Surface ---- */
66 |
67 | Point(11) = {0.0,0.0,0.0,size1};
68 |
69 | Point(12) = {-R2, -R2, -R2, size1};
70 | Point(13) = { R2, -R2, -R2, size1};
71 | Point(14) = { R2, R2, -R2, size1};
72 | Point(15) = {-R2, R2, -R2, size1};
73 |
74 | Point(16) = {-R2, -R2, R2, size1};
75 | Point(17) = { R2, -R2, R2, size1};
76 | Point(18) = { R2, R2, R2, size1};
77 | Point(19) = {-R2, R2, R2, size1};
78 |
79 | // 'Bottom' circles
80 | Circle(21) = {12,11,13};
81 | Circle(22) = {13,11,14};
82 | Circle(23) = {14,11,15};
83 | Circle(24) = {15,11,12};
84 |
85 | // 'Top' circles
86 | Circle(25) = {16,11,17};
87 | Circle(26) = {17,11,18};
88 | Circle(27) = {18,11,19};
89 | Circle(28) = {19,11,16};
90 |
91 | // 'Vertical' circles
92 | Circle(29) = {12,11,16};
93 | Circle(30) = {13,11,17};
94 | Circle(31) = {14,11,18};
95 | Circle(32) = {15,11,19};
96 |
97 | Transfinite Line {21:32} = NN Using Progression 1.0;
98 |
99 | Line Loop (11) = {21,22,23,24};
100 | Line Loop (12) = {25,26,27,28};
101 | Line Loop (13) = {24,29,-28,-32};
102 | Line Loop (14) = {22,31,-26,-30};
103 | Line Loop (15) = {21,30,-25,-29};
104 | Line Loop (16) = {23,32,-27,-31};
105 |
106 | Ruled Surface (11) = {11};
107 | Ruled Surface (12) = {12};
108 | Ruled Surface (13) = {13};
109 | Ruled Surface (14) = {14};
110 | Ruled Surface (15) = {15};
111 | Ruled Surface (16) = {16};
112 |
113 | Transfinite Surface {11:16};
114 | Recombine Surface {11:16};
115 |
116 |
117 | /* ---- Connecting Lines ---- */
118 |
119 | Line(41) = {2,12};
120 | Line(42) = {3,13};
121 | Line(43) = {4,14};
122 | Line(44) = {5,15};
123 | Line(45) = {6,16};
124 | Line(46) = {7,17};
125 | Line(47) = {8,18};
126 | Line(48) = {9,19};
127 |
128 | Transfinite Line {41:48} = NL Using Progression prog1;
129 |
130 | /* ---- Connecting Planes ---- */
131 |
132 | Line Loop (21) = {-1,41,21,-42};
133 | Line Loop (22) = {-2,42,22,-43};
134 | Line Loop (23) = {-3,43,23,-44};
135 | Line Loop (24) = {-4,44,24,-41};
136 |
137 | Line Loop (25) = {5,46,-25,-45};
138 | Line Loop (26) = {6,47,-26,-46};
139 | Line Loop (27) = {7,48,-27,-47};
140 | Line Loop (28) = {8,45,-28,-48};
141 |
142 | Line Loop (29) = {-9,41,29,-45};
143 | Line Loop (30) = {-10,42,30,-46};
144 | Line Loop (31) = {-11,43,31,-47};
145 | Line Loop (32) = {-12,44,32,-48};
146 |
147 | Ruled Surface (31) = {21};
148 | Ruled Surface (32) = {22};
149 | Ruled Surface (33) = {23};
150 | Ruled Surface (34) = {24};
151 | Ruled Surface (35) = {25};
152 | Ruled Surface (36) = {26};
153 | Ruled Surface (37) = {27};
154 | Ruled Surface (38) = {28};
155 | Ruled Surface (39) = {29};
156 | Ruled Surface (40) = {30};
157 | Ruled Surface (41) = {31};
158 | Ruled Surface (42) = {32};
159 |
160 | Transfinite Surface {31:42};
161 | Recombine Surface {31:42};
162 |
163 | /* ---- Construct All Volumes ---- */
164 |
165 | Surface Loop (1) = {1,11,31,32,33,34};
166 | Surface Loop (2) = {2,12,35,36,37,38};
167 | Surface Loop (3) = {5,15,31,35,39,40};
168 | Surface Loop (4) = {4,14,32,36,40,41};
169 | Surface Loop (5) = {6,16,33,37,41,42};
170 | Surface Loop (6) = {3,13,34,38,42,39};
171 |
172 | Volume (1) = {1};
173 | Volume (2) = {2};
174 | Volume (3) = {3};
175 | Volume (4) = {4};
176 | Volume (5) = {5};
177 | Volume (6) = {6};
178 | Transfinite Volume {1:6};
179 |
180 | /* ---- Physical Names (Boundary Names) ---- */
181 |
182 | Physical Volume ("FLUID") = {1:6};
183 | Physical Surface ("OVERSET") = {11:16};
184 | Physical Surface ("SPHERE") = {1:6};
185 |
--------------------------------------------------------------------------------
/include/error.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 | #include
6 |
7 | //! Prints the error message, the stack trace, and exits
8 | #define FatalError(s) { \
9 | printf("Fatal error '%s' at %s:%d\n",s,__FILE__,__LINE__); \
10 | exit(1); }
11 |
--------------------------------------------------------------------------------
/include/flux.hpp:
--------------------------------------------------------------------------------
1 | /*!
2 | * \file flux.hpp
3 | * \brief Header file flux-calculation functions
4 | *
5 | * \author - Jacob Crabill
6 | * Aerospace Computing Laboratory (ACL)
7 | * Aero/Astro Department. Stanford University
8 | *
9 | * \version 0.0.1
10 | *
11 | * Flux Reconstruction in C++ (Flurry++) Code
12 | * Copyright (C) 2014 Jacob Crabill.
13 | *
14 | */
15 | #pragma once
16 |
17 | #include "global.hpp"
18 |
19 | #include "input.hpp"
20 | #include "matrix.hpp"
21 |
22 | /*! Calculate the inviscid portion of the Euler or Navier-Stokes flux vector at a point */
23 | void inviscidFlux(double* U, matrix &F, input *params);
24 |
25 | /*! Calculate the viscous portion of the Navier-Stokes flux vector at a point */
26 | void viscousFlux(double *U, matrix &gradU, matrix &Fvis, input *params);
27 |
28 | /*! Calculate the viscous flux for Advection-Diffusion */
29 | void viscousFluxAD(matrix &gradU, matrix &Fvis, input *params);
30 |
31 | /*! Calculate the common inviscid flux at a point using Roe's method */
32 | void roeFlux(double* uL, double* uR, double *norm, double *Fn, input *params);
33 |
34 | /*! Calculate the common inviscid flux at a point using the Rusanov scalar-diffusion method */
35 | void rusanovFlux(double* UL, double* UR, matrix &FL, matrix &FR, double *norm, double *Fn, double *waveSp, input *params);
36 |
37 | /*! Simple central-difference flux (For advection problems) */
38 | void centralFlux(double* uL, double* uR, double *norm, double *Fn, input *params);
39 |
40 | /*! Simple central-difference flux (For Navier-Stokes problems) */
41 | void centralFlux(matrix &FL, matrix &FR, double* norm, double* Fn, input *params);
42 |
43 | /*! Simple upwinded flux (primarily for advection problems) */
44 | void upwindFlux(double* uL, double* uR, double *norm, double *Fn, input *params);
45 |
46 | /*! Lax-Friedrichs flux (advection-diffusion) */
47 | void laxFriedrichsFlux(double* uL, double* uR, double *norm, double *Fn, input *params);
48 |
49 | /*! Calculate the common viscous flux at a point using the LDG penalty method */
50 | void ldgFlux(double* uL, double* uR, matrix &gradU_L, matrix &gradU_R, double *Fn, input *params);
51 |
--------------------------------------------------------------------------------
/include/geo.hpp:
--------------------------------------------------------------------------------
1 | /*!
2 | * \file geo.hpp
3 | * \brief Header file for geometry class
4 | *
5 | * \author - Jacob Crabill
6 | * Aerospace Computing Laboratory (ACL)
7 | * Aero/Astro Department. Stanford University
8 | *
9 | * \version 0.0.1
10 | *
11 | * Flux Reconstruction in C++ (Flurry++) Code
12 | * Copyright (C) 2014 Jacob Crabill.
13 | *
14 | */
15 | #pragma once
16 |
17 | #include
18 | #include
19 | #include
20 |
21 | #include "global.hpp"
22 |
23 | //class tioga;
24 |
25 | #include "input.hpp"
26 | #include "solver.hpp"
27 | //#include "tioga.h"
28 |
29 | class geo
30 | {
31 | public:
32 | geo();
33 |
34 | ~geo();
35 |
36 | /* === Primay setup routines === */
37 |
38 | //! Setup the geomery using input parameters
39 | void setup(input* params);
40 |
41 | //! Take the basic connectivity data and generate the rest
42 | void processConnectivity();
43 |
44 | /* === Helper Routines === */
45 |
46 | //! Read essential connectivity from a Gmsh mesh file
47 | void readGmsh(string fileName);
48 |
49 | //! Create a simple Cartesian mesh from input parameters
50 | void createMesh();
51 |
52 | //! Get the reference-domain location of the solution points for the given element & polynomial order
53 | vector getLocSpts(int eType, int order);
54 |
55 | //! Get the reference-domain location of the flux points for the given element & polynomial order
56 | vector getLocFpts(int eType, int order);
57 |
58 | //! Get the point locations of the requested type (i.e. Gauss, Lobatto) for the given order
59 | vector getPts1D(string ptsType, int order);
60 |
61 | //! Get the Gauss quadrature weights for the Gauss points of the given order [2D]
62 | vector getQptWeights(int order);
63 |
64 | //! Get the Gauss quadrature weights for the Gauss points of the given order [1D]
65 | vector getQptWeights1D(int order);
66 |
67 | //! Update connectivity / node-blanking for overset grids
68 | void registerGridDataTIOGA();
69 |
70 | /*!
71 | * \brief Call TIOGA to re-process overset connectivity
72 | *
73 | * Called once during pre-processing by default; re-call each iteration
74 | * for moving-mesh cases
75 | */
76 | void updateOversetConnectivity();
77 |
78 | //! Have TIOGA output the mesh along with nodal IBLANK values
79 | void writeOversetConnectivity();
80 |
81 | int nDims, nFields;
82 | int nEles, nVerts, nEdges, nFaces, nIntFaces, nBndFaces, nMpiFaces;
83 | int nBounds; //! Number of boundaries
84 | int meshType;
85 |
86 | // Basic [essential] Connectivity Data
87 | matrix c2v;
88 | matrix xv;
89 |
90 | // Additional Connectivity Data
91 | matrix c2e, c2b, e2c, e2v, v2e, v2v, v2c;
92 | matrix c2f, f2v, f2c, c2c;
93 | vector v2nv, v2nc, c2nv, c2nf, c2ne, c2nc, e2nc, f2nv, ctype;
94 | vector v2b; //! Does vertex lie on a boundary? (0 or 1)
95 | vector e2A; //! Dual-mesh face area for each edge
96 | vector v2vol; //! Dual-mesh element volumes for each vertex
97 | vector intFaces, bndFaces, mpiFaces, mpiCells;
98 | vector nBcFaces; //! Number of faces on each boundary
99 | vector> bcFaceList; //! Global face IDs of faces on each boundary
100 | Array bndNorm; //! Outward unit normal for each boundary point
101 | matrix bndArea; //! Face area for each boundary point
102 | vector c2xc; //! Centroid of each cell in mesh (for creation of dual mesh)
103 | vector bcList; //! List of boundary conditions for each boundary
104 | vector bcTypeF; //! Boundary condition for each boundary face
105 | vector bcTypeE; //! Boundary condition for each boundary edge
106 | matrix bndPts; //! List of node IDs on each boundary
107 | vector nBndPts; //! Number of points on each boudary
108 | vector > bcFaces; //! List of nodes on each face (edge) for each boundary condition
109 | vector nFacesPerBnd; //! List of # of faces on each boundary
110 | vector procR; //! What processor lies to the 'right' of this face
111 | vector locF_R; //! The local mpiFace ID of each mpiFace on the opposite processor
112 | vector gIC_R; //! The global cell ID of the right cell on the opposite processor
113 | vector mpiLocF; //! Element-local face ID of MPI Face in left cell
114 | vector mpiLocF_R; //! Element-local face ID of MPI Face in right cell
115 | vector isBnd; // might want to change this to "int" and have it store WHICH boundary the face is on (-1 for internal)
116 | vector isBndEdge; //! For each edge, flag for "normal" or "boundary"
117 |
118 | /* --- Overset-Related Variables --- */
119 | int nprocPerGrid; //! Number of MPI processes assigned to each (overset) grid block
120 | int gridID; //! Which (overset) grid block is this process handling
121 | int gridRank; //! MPI rank of process *within* the grid block [0 to nprocPerGrid-1]
122 | vector iblank; //! Output of TIOGA: flag for whether vertex is normal, blanked, or receptor
123 | vector iblankCell; //! Output? of TIOGA: flag for whether cell is normal, blanked, or receptor
124 | vector iwall; //! List of nodes on wall boundaries
125 | vector iover; //! List of nodes on overset boundaries
126 |
127 | //tioga* tg; //! Pointer to Tioga object for processing overset grids
128 | int* nodesPerCell; //! Pointer for Tioga to know # of nodes for each element type
129 | array conn; //! Pointer to c2v for each element type [but only 1, so will be size(1)]
130 |
131 | Vec3 getFaceNormalTri(int faceID);
132 | Vec3 getFaceNormalQuad(int faceID);
133 | private:
134 |
135 | input *params;
136 |
137 | /* --- MPI-Related Varialbes (global vs. local data) --- */
138 | matrix c2v_g; //! Global element connectivity
139 | matrix xv_g; //! Global mesh node locations
140 | vector ic2icg; //! Local cell to global cell index
141 | vector iv2ivg; //! Local vertex to global vertex index
142 | vector ctype_g, c2ne_g, c2nv_g; //! Global element info
143 | matrix bndPts_g; //! Global lists of points on boundaries
144 | vector nBndPts_g; //! Global number of points on each boundary
145 | map bcIdMap; //! Map from Gmsh boundary ID to Flurry BC ID
146 | int nEles_g, nVerts_g;
147 |
148 | #ifndef _NO_MPI
149 | MPI_Comm gridComm;
150 | #endif
151 |
152 | void processConnEdges(void);
153 | void processConnFaces(void);
154 | void processConnDual(void);
155 |
156 | //! Match up pairs of periodic boundary faces
157 | void processPeriodicBoundaries(void);
158 |
159 | //! Check if two given periodic edges match up
160 | bool checkPeriodicFaces(int *edge1, int *edge2);
161 | bool checkPeriodicFaces3D(vector &face1, vector &face2);
162 |
163 | //! Compare the orientation (rotation in ref. space) betwen the local faces of 2 elements
164 | int compareOrientation(int ic1, int ic2, int f1, int f2);
165 |
166 | //! Compare the orientation (rotation in ref. space) betwen the local faces of 2 elements across MPI boundary
167 | int compareOrientationMPI(int ic1, int ic2, int f1, int f2);
168 |
169 | //! For MPI runs, partition the mesh across all processors
170 | void partitionMesh(void);
171 |
172 | //! For MPI runs, match internal faces across MPI boundaries
173 | void matchMPIFaces();
174 |
175 | //! Compare two faces [lists of nodes] to see if they match [used for MPI]
176 | bool compareFaces(vector &face1, vector &face2);
177 | };
178 |
--------------------------------------------------------------------------------
/include/global.hpp:
--------------------------------------------------------------------------------
1 | /*!
2 | * \file global.hpp
3 | * \brief Header file for global constants, objects, and variables
4 | *
5 | * \author - Jacob Crabill
6 | * Aerospace Computing Laboratory (ACL)
7 | * Aero/Astro Department. Stanford University
8 | *
9 | * \version 0.0.1
10 | *
11 | * Flux Reconstruction in C++ (Flurry++) Code
12 | * Copyright (C) 2014 Jacob Crabill.
13 | *
14 | */
15 | #pragma once
16 |
17 | #include
18 | #include
19 | #include
20 | #include
21 | #include
22 | #include