TYCHO  1.3.0
 All Data Structures Files Functions Variables Enumerations Enumerator
/home/kapf/tycho_docu/set_boundary.c
Go to the documentation of this file.
1 /*
2  * set_boundary.c
3  *
4  * Author: Wolfgang Kapferer
5  */
6 
7 #include <stdio.h>
8 #include <stdlib.h>
9 #include <math.h>
10 
11 #include "variables_global.h"
12 #include "prototypes.h"
13 
17 int set_boundary(int nmin, int nmax, int flag, int bound_checker, int lefter,
18  double *rho_1D, double *eng_1D, double *pre_1D, double *vx_1D, double *vy_1D, double *vz_1D,
19  double *pressure_solid_1D, double *xa0, double *dx0, double *xa, double *dx, double *rhodown,
20  double *rhoup, double *rhofront, double *rhoback, double *vxdown, double *vxup, double *vxfront,
21  double *vxback, double *vydown, double *vyup, double *vyfront, double *vyback, double *vzdown,
22  double *vzup, double *vzfront, double *vzback, int viscosity_on_off, int dimension) {
23 
24  //* The case with no obstacles in the computational domain
25  if (bound_checker == 0) {
26  if ((bound.down == 5) && (flag == 1))
27  left_boundary_periodic(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D, xa0, dx0, xa, dx, flag,
28  rhodown, rhoup, rhofront, rhoback, vxdown, vxup, vxfront, vxback, vydown, vyup, vyfront, vyback, vzdown, vzup, vzfront, vzback,
29  viscosity_on_off, dimension);
30  if ((bound.down == 4) && (flag == 1))
31  left_boundary_inflow(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D, xa0, dx0, xa, dx, flag,
32  rhodown, rhoup, rhofront, rhoback, vxdown, vxup, vxfront, vxback, vydown, vyup, vyfront, vyback, vzdown, vzup, vzfront, vzback,
33  viscosity_on_off, dimension);
34  if ((bound.down == 3) && (flag == 1))
35  left_boundary_outflow(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D, xa0, dx0, xa, dx, flag,
36  rhodown, rhoup, rhofront, rhoback, vxdown, vxup, vxfront, vxback, vydown, vyup, vyfront, vyback, vzdown, vzup, vzfront, vzback,
37  viscosity_on_off, dimension);
38  if ((bound.down == 2) && (flag == 1))
39  left_boundary_small_padding(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D, xa0, dx0, xa, dx, flag,
40  rhodown, rhoup, rhofront, rhoback, vxdown, vxup, vxfront, vxback, vydown, vyup, vyfront, vyback, vzdown, vzup, vzfront, vzback,
41  viscosity_on_off, dimension);
42  if ((bound.down == 1) && (flag == 1))
43  left_boundary_reflecting(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D, xa0, dx0, xa, dx, flag,
44  rhodown, rhoup, rhofront, rhoback, vxdown, vxup, vxfront, vxback, vydown, vyup, vyfront, vyback, vzdown, vzup, vzfront, vzback,
45  viscosity_on_off, dimension);
46  if ((bound.down == 0) && (flag == 1))
47  left_boundary_zero_gradient(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D, xa0, dx0, xa, dx, flag,
48  rhodown, rhoup, rhofront, rhoback, vxdown, vxup, vxfront, vxback, vydown, vyup, vyfront, vyback, vzdown, vzup, vzfront, vzback,
49  viscosity_on_off, dimension);
50 
51  if ((bound.up == 5) && (flag == 1))
52  right_boundary_periodic(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D, xa0, dx0, xa, dx, flag,
53  rhodown, rhoup, rhofront, rhoback, vxdown, vxup, vxfront, vxback, vydown, vyup, vyfront, vyback, vzdown, vzup, vzfront, vzback,
54  viscosity_on_off, dimension);
55  if ((bound.up == 4) && (flag == 1))
56  right_boundary_inflow(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D, xa0, dx0, xa, dx, flag,
57  rhodown, rhoup, rhofront, rhoback, vxdown, vxup, vxfront, vxback, vydown, vyup, vyfront, vyback, vzdown, vzup, vzfront, vzback,
58  viscosity_on_off, dimension);
59  if ((bound.up == 3) && (flag == 1))
60  right_boundary_outflow(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D, xa0, dx0, xa, dx, flag,
61  rhodown, rhoup, rhofront, rhoback, vxdown, vxup, vxfront, vxback, vydown, vyup, vyfront, vyback, vzdown, vzup, vzfront, vzback,
62  viscosity_on_off, dimension);
63  if ((bound.up == 2) && (flag == 1))
64  right_boundary_small_padding(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D, xa0, dx0, xa, dx, flag,
65  rhodown, rhoup, rhofront, rhoback, vxdown, vxup, vxfront, vxback, vydown, vyup, vyfront, vyback, vzdown, vzup, vzfront, vzback,
66  viscosity_on_off, dimension);
67  if ((bound.up == 1) && (flag == 1))
68  right_boundary_reflecting(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D, xa0, dx0, xa, dx, flag,
69  rhodown, rhoup, rhofront, rhoback, vxdown, vxup, vxfront, vxback, vydown, vyup, vyfront, vyback, vzdown, vzup, vzfront, vzback,
70  viscosity_on_off, dimension);
71  if ((bound.up == 0) && (flag == 1))
72  right_boundary_zero_gradient(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D, xa0, dx0, xa, dx, flag,
73  rhodown, rhoup, rhofront, rhoback, vxdown, vxup, vxfront, vxback, vydown, vyup, vyfront, vyback, vzdown, vzup, vzfront, vzback,
74  viscosity_on_off, dimension);
75 
76  if ((bound.left == 5) && (flag == 0))
77  left_boundary_periodic(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D, xa0, dx0, xa, dx, flag,
78  rhodown, rhoup, rhofront, rhoback, vxdown, vxup, vxfront, vxback, vydown, vyup, vyfront, vyback, vzdown, vzup, vzfront, vzback,
79  viscosity_on_off, dimension);
80  if ((bound.left == 4) && (flag == 0))
81  left_boundary_inflow(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D, xa0, dx0, xa, dx, flag,
82  rhodown, rhoup, rhofront, rhoback, vxdown, vxup, vxfront, vxback, vydown, vyup, vyfront, vyback, vzdown, vzup, vzfront, vzback,
83  viscosity_on_off, dimension);
84  if ((bound.left == 3) && (flag == 0))
85  left_boundary_outflow(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D, xa0, dx0, xa, dx, flag,
86  rhodown, rhoup, rhofront, rhoback, vxdown, vxup, vxfront, vxback, vydown, vyup, vyfront, vyback, vzdown, vzup, vzfront, vzback,
87  viscosity_on_off, dimension);
88  if ((bound.left == 2) && (flag == 0))
89  left_boundary_small_padding(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D, xa0, dx0, xa, dx, flag,
90  rhodown, rhoup, rhofront, rhoback, vxdown, vxup, vxfront, vxback, vydown, vyup, vyfront, vyback, vzdown, vzup, vzfront, vzback,
91  viscosity_on_off, dimension);
92  if ((bound.left == 1) && (flag == 0))
93  left_boundary_reflecting(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D, xa0, dx0, xa, dx, flag,
94  rhodown, rhoup, rhofront, rhoback, vxdown, vxup, vxfront, vxback, vydown, vyup, vyfront, vyback, vzdown, vzup, vzfront, vzback,
95  viscosity_on_off, dimension);
96  if ((bound.left == 0) && (flag == 0))
97  left_boundary_zero_gradient(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D, xa0, dx0, xa, dx, flag,
98  rhodown, rhoup, rhofront, rhoback, vxdown, vxup, vxfront, vxback, vydown, vyup, vyfront, vyback, vzdown, vzup, vzfront, vzback,
99  viscosity_on_off, dimension);
100 
101  if ((bound.right == 5) && (flag == 0))
102  right_boundary_periodic(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D, xa0, dx0, xa, dx, flag,
103  rhodown, rhoup, rhofront, rhoback, vxdown, vxup, vxfront, vxback, vydown, vyup, vyfront, vyback, vzdown, vzup, vzfront, vzback,
104  viscosity_on_off, dimension);
105  if ((bound.right == 4) && (flag == 0))
106  right_boundary_inflow(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D, xa0, dx0, xa, dx, flag,
107  rhodown, rhoup, rhofront, rhoback, vxdown, vxup, vxfront, vxback, vydown, vyup, vyfront, vyback, vzdown, vzup, vzfront, vzback,
108  viscosity_on_off, dimension);
109  if ((bound.right == 3) && (flag == 0))
110  right_boundary_outflow(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D, xa0, dx0, xa, dx, flag,
111  rhodown, rhoup, rhofront, rhoback, vxdown, vxup, vxfront, vxback, vydown, vyup, vyfront, vyback, vzdown, vzup, vzfront, vzback,
112  viscosity_on_off, dimension);
113  if ((bound.right == 2) && (flag == 0))
114  right_boundary_small_padding(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D, xa0, dx0, xa, dx, flag,
115  rhodown, rhoup, rhofront, rhoback, vxdown, vxup, vxfront, vxback, vydown, vyup, vyfront, vyback, vzdown, vzup, vzfront, vzback,
116  viscosity_on_off, dimension);
117  if ((bound.right == 1) && (flag == 0))
118  right_boundary_reflecting(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D, xa0, dx0, xa, dx, flag,
119  rhodown, rhoup, rhofront, rhoback, vxdown, vxup, vxfront, vxback, vydown, vyup, vyfront, vyback, vzdown, vzup, vzfront, vzback,
120  viscosity_on_off, dimension);
121  if ((bound.right == 0) && (flag == 0))
122  right_boundary_zero_gradient(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D, xa0, dx0, xa, dx, flag,
123  rhodown, rhoup, rhofront, rhoback, vxdown, vxup, vxfront, vxback, vydown, vyup, vyfront, vyback, vzdown, vzup, vzfront, vzback,
124  viscosity_on_off, dimension);
125 
126  if ((bound.front == 5) && (flag == 2))
127  left_boundary_periodic(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D, xa0, dx0, xa, dx, flag,
128  rhodown, rhoup, rhofront, rhoback, vxdown, vxup, vxfront, vxback, vydown, vyup, vyfront, vyback, vzdown, vzup, vzfront, vzback,
129  viscosity_on_off, dimension);
130  if ((bound.front == 4) && (flag == 2))
131  left_boundary_inflow(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D, xa0, dx0, xa, dx, flag,
132  rhodown, rhoup, rhofront, rhoback, vxdown, vxup, vxfront, vxback, vydown, vyup, vyfront, vyback, vzdown, vzup, vzfront, vzback,
133  viscosity_on_off, dimension);
134  if ((bound.front == 3) && (flag == 2))
135  left_boundary_outflow(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D, xa0, dx0, xa, dx, flag,
136  rhodown, rhoup, rhofront, rhoback, vxdown, vxup, vxfront, vxback, vydown, vyup, vyfront, vyback, vzdown, vzup, vzfront, vzback,
137  viscosity_on_off, dimension);
138  if ((bound.front == 2) && (flag == 2))
139  left_boundary_small_padding(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D, xa0, dx0, xa, dx, flag,
140  rhodown, rhoup, rhofront, rhoback, vxdown, vxup, vxfront, vxback, vydown, vyup, vyfront, vyback, vzdown, vzup, vzfront, vzback,
141  viscosity_on_off, dimension);
142  if ((bound.front == 1) && (flag == 2))
143  left_boundary_reflecting(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D, xa0, dx0, xa, dx, flag,
144  rhodown, rhoup, rhofront, rhoback, vxdown, vxup, vxfront, vxback, vydown, vyup, vyfront, vyback, vzdown, vzup, vzfront, vzback,
145  viscosity_on_off, dimension);
146  if ((bound.front == 0) && (flag == 2))
147  left_boundary_zero_gradient(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D, xa0, dx0, xa, dx, flag,
148  rhodown, rhoup, rhofront, rhoback, vxdown, vxup, vxfront, vxback, vydown, vyup, vyfront, vyback, vzdown, vzup, vzfront, vzback,
149  viscosity_on_off, dimension);
150 
151  if ((bound.back == 5) && (flag == 2))
152  right_boundary_periodic(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D, xa0, dx0, xa, dx, flag,
153  rhodown, rhoup, rhofront, rhoback, vxdown, vxup, vxfront, vxback, vydown, vyup, vyfront, vyback, vzdown, vzup, vzfront, vzback,
154  viscosity_on_off, dimension);
155  if ((bound.back == 4) && (flag == 2))
156  right_boundary_inflow(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D, xa0, dx0, xa, dx, flag,
157  rhodown, rhoup, rhofront, rhoback, vxdown, vxup, vxfront, vxback, vydown, vyup, vyfront, vyback, vzdown, vzup, vzfront, vzback,
158  viscosity_on_off, dimension);
159  if ((bound.back == 3) && (flag == 2))
160  right_boundary_outflow(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D, xa0, dx0, xa, dx, flag,
161  rhodown, rhoup, rhofront, rhoback, vxdown, vxup, vxfront, vxback, vydown, vyup, vyfront, vyback, vzdown, vzup, vzfront, vzback,
162  viscosity_on_off, dimension);
163  if ((bound.back == 2) && (flag == 2))
164  right_boundary_small_padding(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D, xa0, dx0, xa, dx, flag,
165  rhodown, rhoup, rhofront, rhoback, vxdown, vxup, vxfront, vxback, vydown, vyup, vyfront, vyback, vzdown, vzup, vzfront, vzback,
166  viscosity_on_off, dimension);
167  if ((bound.back == 1) && (flag == 2))
168  right_boundary_reflecting(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D, xa0, dx0, xa, dx, flag,
169  rhodown, rhoup, rhofront, rhoback, vxdown, vxup, vxfront, vxback, vydown, vyup, vyfront, vyback, vzdown, vzup, vzfront, vzback,
170  viscosity_on_off, dimension);
171  if ((bound.back == 0) && (flag == 2))
172  right_boundary_zero_gradient(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D, xa0, dx0, xa, dx, flag,
173  rhodown, rhoup, rhofront, rhoback, vxdown, vxup, vxfront, vxback, vydown, vyup, vyfront, vyback, vzdown, vzup, vzfront, vzback,
174  viscosity_on_off, dimension);
175  } else {
176  // domain with obstacles
177  //the case at one side an obstacle at the other side a boundary of the computational domain is lefter 1 and 2
178  //at both sides of the computational domain an obstacle is lefter 3
179  if ((bound.down == 5) && (flag == 1) && (bound_checker == 1) && (lefter == 1)) {
180  left_boundary_periodic(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D, xa0, dx0, xa, dx, flag,
181  rhodown, rhoup, rhofront, rhoback, vxdown, vxup, vxfront, vxback, vydown, vyup, vyfront, vyback, vzdown, vzup, vzfront, vzback,
182  viscosity_on_off, dimension);
183  right_boundary_reflecting_on_obstacle(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D,
184  pressure_solid_1D, xa0, dx0, xa, dx, flag,
185  rhodown, rhoup, rhofront, rhoback, vxdown, vxup, vxfront, vxback, vydown, vyup, vyfront, vyback, vzdown, vzup, vzfront, vzback,
186  viscosity_on_off, dimension);
187  }
188  if ((bound.down == 4) && (flag == 1) && (bound_checker == 1) && (lefter == 1)) {
189  left_boundary_inflow(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D, xa0, dx0, xa, dx, flag,
190  rhodown, rhoup, rhofront, rhoback, vxdown, vxup, vxfront, vxback, vydown, vyup, vyfront, vyback, vzdown, vzup, vzfront, vzback,
191  viscosity_on_off, dimension);
192  right_boundary_reflecting_on_obstacle(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D,
193  pressure_solid_1D, xa0, dx0, xa, dx, flag,
194  rhodown, rhoup, rhofront, rhoback, vxdown, vxup, vxfront, vxback, vydown, vyup, vyfront, vyback, vzdown, vzup, vzfront, vzback,
195  viscosity_on_off, dimension);
196  }
197  if ((bound.down == 3) && (flag == 1) && (bound_checker == 1) && (lefter == 1)) {
198  left_boundary_outflow(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D, xa0, dx0, xa, dx, flag,
199  rhodown, rhoup, rhofront, rhoback, vxdown, vxup, vxfront, vxback, vydown, vyup, vyfront, vyback, vzdown, vzup, vzfront, vzback,
200  viscosity_on_off, dimension);
201  right_boundary_reflecting_on_obstacle(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D,
202  pressure_solid_1D, xa0, dx0, xa, dx, flag,
203  rhodown, rhoup, rhofront, rhoback, vxdown, vxup, vxfront, vxback, vydown, vyup, vyfront, vyback, vzdown, vzup, vzfront, vzback,
204  viscosity_on_off, dimension);
205  }
206  if ((bound.down == 2) && (flag == 1) && (bound_checker == 1) && (lefter == 1)) {
207  left_boundary_small_padding(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D, xa0, dx0, xa, dx, flag,
208  rhodown, rhoup, rhofront, rhoback, vxdown, vxup, vxfront, vxback, vydown, vyup, vyfront, vyback, vzdown, vzup, vzfront, vzback,
209  viscosity_on_off, dimension);
210  right_boundary_reflecting_on_obstacle(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D,
211  pressure_solid_1D, xa0, dx0, xa, dx, flag,
212  rhodown, rhoup, rhofront, rhoback, vxdown, vxup, vxfront, vxback, vydown, vyup, vyfront, vyback, vzdown, vzup, vzfront, vzback,
213  viscosity_on_off, dimension);
214  }
215  if ((bound.down == 1) && (flag == 1) && (bound_checker == 1) && (lefter == 1)) {
216  left_boundary_reflecting(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D, xa0, dx0, xa, dx, flag,
217  rhodown, rhoup, rhofront, rhoback, vxdown, vxup, vxfront, vxback, vydown, vyup, vyfront, vyback, vzdown, vzup, vzfront, vzback,
218  viscosity_on_off, dimension);
219  right_boundary_reflecting_on_obstacle(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D,
220  pressure_solid_1D, xa0, dx0, xa, dx, flag,
221  rhodown, rhoup, rhofront, rhoback, vxdown, vxup, vxfront, vxback, vydown, vyup, vyfront, vyback, vzdown, vzup, vzfront, vzback,
222  viscosity_on_off, dimension);
223  }
224  if ((bound.down == 0) && (flag == 1) && (bound_checker == 1) && (lefter == 1)) {
225  left_boundary_zero_gradient(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D, xa0, dx0, xa, dx, flag,
226  rhodown, rhoup, rhofront, rhoback, vxdown, vxup, vxfront, vxback, vydown, vyup, vyfront, vyback, vzdown, vzup, vzfront, vzback,
227  viscosity_on_off, dimension);
228  right_boundary_reflecting_on_obstacle(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D,
229  pressure_solid_1D, xa0, dx0, xa, dx, flag,
230  rhodown, rhoup, rhofront, rhoback, vxdown, vxup, vxfront, vxback, vydown, vyup, vyfront, vyback, vzdown, vzup, vzfront, vzback,
231  viscosity_on_off, dimension);
232  }
233 
234  if ((bound.up == 5) && (flag == 1) && (bound_checker == 1) && (lefter == 2)) {
235  right_boundary_periodic(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D, xa0, dx0, xa, dx, flag,
236  rhodown, rhoup, rhofront, rhoback, vxdown, vxup, vxfront, vxback, vydown, vyup, vyfront, vyback, vzdown, vzup, vzfront, vzback,
237  viscosity_on_off, dimension);
238  left_boundary_reflecting_on_obstacle(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D,
239  pressure_solid_1D, xa0, dx0, xa, dx, flag, rhodown, rhoup, rhofront, rhoback, vxdown, vxup, vxfront, vxback, vydown, vyup,
240  vyfront, vyback, vzdown, vzup, vzfront, vzback, viscosity_on_off, dimension);
241  }
242  if ((bound.up == 4) && (flag == 1) && (bound_checker == 1) && (lefter == 2)) {
243  right_boundary_inflow(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D, xa0, dx0, xa, dx, flag, rhodown, rhoup, rhofront, rhoback,
244  vxdown, vxup, vxfront, vxback, vydown, vyup, vyfront, vyback, vzdown, vzup, vzfront, vzback, viscosity_on_off, dimension);
245  left_boundary_reflecting_on_obstacle(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D,
246  pressure_solid_1D, xa0, dx0, xa, dx, flag, rhodown, rhoup, rhofront, rhoback, vxdown, vxup, vxfront, vxback, vydown, vyup, vyfront,
247  vyback, vzdown, vzup, vzfront, vzback, viscosity_on_off, dimension);
248  }
249  if ((bound.up == 3) && (flag == 1) && (bound_checker == 1) && (lefter == 2)) {
250  right_boundary_outflow(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D, xa0, dx0, xa, dx, flag,
251  rhodown, rhoup, rhofront, rhoback, vxdown, vxup, vxfront, vxback, vydown, vyup, vyfront, vyback, vzdown, vzup, vzfront, vzback,
252  viscosity_on_off, dimension);
253  left_boundary_reflecting_on_obstacle(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D,
254  pressure_solid_1D, xa0, dx0, xa, dx, flag, rhodown, rhoup, rhofront, rhoback, vxdown, vxup, vxfront, vxback, vydown, vyup,
255  vyfront, vyback, vzdown, vzup, vzfront, vzback, viscosity_on_off, dimension);
256  }
257  if ((bound.up == 2) && (flag == 1) && (bound_checker == 1) && (lefter == 2)) {
258  right_boundary_small_padding(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D, xa0, dx0, xa, dx, flag,
259  rhodown, rhoup, rhofront, rhoback, vxdown, vxup, vxfront, vxback, vydown, vyup, vyfront, vyback, vzdown, vzup, vzfront, vzback,
260  viscosity_on_off, dimension);
261  left_boundary_reflecting_on_obstacle(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D,
262  pressure_solid_1D, xa0, dx0, xa, dx, flag, rhodown, rhoup, rhofront, rhoback, vxdown, vxup, vxfront, vxback, vydown, vyup, vyfront,
263  vyback, vzdown, vzup, vzfront, vzback, viscosity_on_off, dimension);
264  }
265  if ((bound.up == 1) && (flag == 1) && (bound_checker == 1) && (lefter == 2)) {
266  right_boundary_reflecting(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D, xa0, dx0, xa, dx, flag,
267  rhodown, rhoup, rhofront, rhoback, vxdown, vxup, vxfront, vxback, vydown, vyup, vyfront, vyback, vzdown, vzup, vzfront, vzback,
268  viscosity_on_off, dimension);
269  left_boundary_reflecting_on_obstacle(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D,
270  pressure_solid_1D, xa0, dx0, xa, dx, flag, rhodown, rhoup, rhofront, rhoback, vxdown, vxup, vxfront, vxback, vydown, vyup, vyfront,
271  vyback, vzdown, vzup, vzfront, vzback, viscosity_on_off, dimension);
272  }
273  if ((bound.up == 0) && (flag == 1) && (bound_checker == 1) && (lefter == 2)) {
274  right_boundary_zero_gradient(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D, xa0, dx0, xa, dx, flag,
275  rhodown, rhoup, rhofront, rhoback, vxdown, vxup, vxfront, vxback, vydown, vyup, vyfront, vyback, vzdown, vzup,
276  vzfront, vzback, viscosity_on_off, dimension);
277  left_boundary_reflecting_on_obstacle(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D,
278  pressure_solid_1D, xa0, dx0, xa, dx, flag, rhodown, rhoup, rhofront, rhoback, vxdown, vxup, vxfront, vxback, vydown, vyup, vyfront,
279  vyback, vzdown, vzup, vzfront, vzback, viscosity_on_off, dimension);
280  }
281 
282  if ((bound.left == 5) && (flag == 0) && (bound_checker == 1) && (lefter == 1)) {
283  left_boundary_periodic(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D, xa0, dx0, xa, dx, flag,
284  rhodown, rhoup, rhofront, rhoback, vxdown, vxup, vxfront, vxback, vydown, vyup, vyfront, vyback, vzdown, vzup, vzfront, vzback,
285  viscosity_on_off, dimension);
286  right_boundary_reflecting_on_obstacle(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D,
287  pressure_solid_1D, xa0, dx0, xa, dx, flag, rhodown, rhoup, rhofront, rhoback, vxdown, vxup, vxfront, vxback, vydown, vyup, vyfront,
288  vyback, vzdown, vzup, vzfront, vzback, viscosity_on_off, dimension);
289  }
290  if ((bound.left == 4) && (flag == 0) && (bound_checker == 1) && (lefter == 1)) {
291  left_boundary_inflow(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D, xa0, dx0, xa, dx, flag,
292  rhodown, rhoup, rhofront, rhoback, vxdown, vxup, vxfront, vxback, vydown, vyup, vyfront, vyback, vzdown, vzup, vzfront, vzback,
293  viscosity_on_off, dimension);
294  right_boundary_reflecting_on_obstacle(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D,
295  pressure_solid_1D, xa0, dx0, xa, dx, flag, rhodown, rhoup, rhofront, rhoback, vxdown, vxup, vxfront, vxback, vydown, vyup,
296  vyfront, vyback, vzdown, vzup, vzfront, vzback, viscosity_on_off, dimension);
297  }
298  if ((bound.left == 3) && (flag == 0) && (bound_checker == 1) && (lefter == 1)) {
299  left_boundary_outflow(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D, xa0, dx0, xa, dx, flag,
300  rhodown, rhoup, rhofront, rhoback, vxdown, vxup, vxfront, vxback, vydown, vyup, vyfront, vyback, vzdown, vzup, vzfront, vzback,
301  viscosity_on_off, dimension);
302  right_boundary_reflecting_on_obstacle(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D,
303  pressure_solid_1D, xa0, dx0, xa, dx, flag, rhodown, rhoup, rhofront, rhoback, vxdown, vxup, vxfront, vxback, vydown, vyup, vyfront,
304  vyback, vzdown, vzup, vzfront, vzback, viscosity_on_off, dimension);
305  }
306  if ((bound.left == 2) && (flag == 0) && (bound_checker == 1) && (lefter == 1)) {
307  left_boundary_small_padding(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D, xa0, dx0, xa, dx, flag, rhodown, rhoup, rhofront, rhoback,
308  vxdown, vxup, vxfront, vxback, vydown, vyup, vyfront, vyback, vzdown, vzup, vzfront, vzback, viscosity_on_off, dimension);
309  right_boundary_reflecting_on_obstacle(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D,
310  pressure_solid_1D, xa0, dx0, xa, dx, flag, rhodown, rhoup, rhofront, rhoback, vxdown, vxup, vxfront, vxback, vydown, vyup, vyfront,
311  vyback, vzdown, vzup, vzfront, vzback, viscosity_on_off, dimension);
312  }
313  if ((bound.left == 1) && (flag == 0) && (bound_checker == 1) && (lefter == 1)) {
314  left_boundary_reflecting(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D, xa0, dx0, xa, dx, flag, rhodown, rhoup, rhofront, rhoback,
315  vxdown, vxup, vxfront, vxback, vydown, vyup, vyfront, vyback, vzdown, vzup, vzfront, vzback, viscosity_on_off, dimension);
316  right_boundary_reflecting_on_obstacle(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D,
317  pressure_solid_1D, xa0, dx0, xa, dx, flag, rhodown, rhoup, rhofront, rhoback, vxdown, vxup, vxfront, vxback, vydown, vyup, vyfront,
318  vyback, vzdown, vzup, vzfront, vzback, viscosity_on_off, dimension);
319  }
320  if ((bound.left == 0) && (flag == 0) && (bound_checker == 1) && (lefter == 1)) {
321  left_boundary_zero_gradient(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D, xa0, dx0, xa, dx, flag, rhodown, rhoup, rhofront,
322  rhoback, vxdown, vxup, vxfront, vxback, vydown, vyup, vyfront, vyback, vzdown, vzup, vzfront, vzback, viscosity_on_off,
323  dimension);
324  right_boundary_reflecting_on_obstacle(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D,
325  pressure_solid_1D, xa0, dx0, xa, dx, flag, rhodown, rhoup, rhofront, rhoback, vxdown, vxup, vxfront, vxback, vydown, vyup,
326  vyfront, vyback, vzdown, vzup, vzfront, vzback, viscosity_on_off, dimension);
327  }
328 
329  if ((bound.right == 5) && (flag == 0) && (bound_checker == 1) && (lefter == 2)) {
330  right_boundary_periodic(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D, xa0, dx0, xa, dx, flag, rhodown, rhoup, rhofront, rhoback,
331  vxdown, vxup, vxfront, vxback, vydown, vyup, vyfront, vyback, vzdown, vzup, vzfront, vzback, viscosity_on_off, dimension);
332  left_boundary_reflecting_on_obstacle(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D,
333  pressure_solid_1D, xa0, dx0, xa, dx, flag, rhodown, rhoup, rhofront, rhoback, vxdown, vxup, vxfront, vxback, vydown, vyup, vyfront,
334  vyback, vzdown, vzup, vzfront, vzback, viscosity_on_off, dimension);
335  }
336  if ((bound.right == 4) && (flag == 0) && (bound_checker == 1) && (lefter == 2)) {
337  right_boundary_inflow(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D, xa0, dx0, xa, dx, flag, rhodown, rhoup, rhofront, rhoback,
338  vxdown, vxup, vxfront, vxback, vydown, vyup, vyfront, vyback, vzdown, vzup, vzfront, vzback, viscosity_on_off, dimension);
339  left_boundary_reflecting_on_obstacle(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D,
340  pressure_solid_1D, xa0, dx0, xa, dx, flag, rhodown, rhoup, rhofront, rhoback, vxdown, vxup, vxfront, vxback, vydown, vyup, vyfront,
341  vyback, vzdown, vzup, vzfront, vzback, viscosity_on_off, dimension);
342  }
343  if ((bound.right == 3) && (flag == 0) && (bound_checker == 1) && (lefter == 2)) {
344  right_boundary_outflow(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D, xa0, dx0, xa, dx, flag, rhodown, rhoup, rhofront, rhoback,
345  vxdown, vxup, vxfront, vxback, vydown, vyup, vyfront, vyback, vzdown, vzup, vzfront, vzback, viscosity_on_off, dimension);
346  left_boundary_reflecting_on_obstacle(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D,
347  pressure_solid_1D, xa0, dx0, xa, dx, flag, rhodown, rhoup, rhofront, rhoback, vxdown, vxup, vxfront, vxback, vydown, vyup, vyfront,
348  vyback, vzdown, vzup, vzfront, vzback, viscosity_on_off, dimension);
349  }
350  if ((bound.right == 2) && (flag == 0) && (bound_checker == 1) && (lefter == 2)) {
351  right_boundary_small_padding(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D, xa0, dx0, xa, dx, flag, rhodown, rhoup, rhofront, rhoback,
352  vxdown, vxup, vxfront, vxback, vydown, vyup, vyfront, vyback, vzdown, vzup, vzfront, vzback, viscosity_on_off, dimension);
353  left_boundary_reflecting_on_obstacle(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D,
354  pressure_solid_1D, xa0, dx0, xa, dx, flag, rhodown, rhoup, rhofront, rhoback, vxdown, vxup, vxfront, vxback, vydown, vyup, vyfront, vyback,
355  vzdown, vzup, vzfront, vzback, viscosity_on_off, dimension);
356  }
357  if ((bound.right == 1) && (flag == 0) && (bound_checker == 1) && (lefter == 2)) {
358  right_boundary_reflecting(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D, xa0, dx0, xa, dx, flag, rhodown, rhoup, rhofront, rhoback, vxdown,
359  vxup, vxfront, vxback, vydown, vyup, vyfront, vyback, vzdown, vzup, vzfront, vzback, viscosity_on_off, dimension);
360  left_boundary_reflecting_on_obstacle(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D,
361  pressure_solid_1D, xa0, dx0, xa, dx, flag, rhodown, rhoup, rhofront, rhoback, vxdown, vxup, vxfront, vxback, vydown, vyup, vyfront, vyback,
362  vzdown, vzup, vzfront, vzback, viscosity_on_off, dimension);
363  }
364  if ((bound.right == 0) && (flag == 0) && (bound_checker == 1) && (lefter == 2)) {
365  right_boundary_zero_gradient(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D, xa0, dx0, xa, dx, flag, rhodown, rhoup, rhofront, rhoback,
366  vxdown, vxup, vxfront, vxback, vydown, vyup, vyfront, vyback, vzdown, vzup, vzfront, vzback, viscosity_on_off, dimension);
367  left_boundary_reflecting_on_obstacle(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D,
368  pressure_solid_1D, xa0, dx0, xa, dx, flag, rhodown, rhoup, rhofront, rhoback, vxdown, vxup, vxfront, vxback, vydown, vyup, vyfront, vyback,
369  vzdown, vzup, vzfront, vzback, viscosity_on_off, dimension);
370  }
371 
372  if ((bound.front == 5) && (flag == 2) && (bound_checker == 1) && (lefter == 1)) {
373  left_boundary_periodic(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D, xa0, dx0, xa, dx, flag, rhodown, rhoup, rhofront, rhoback, vxdown,
374  vxup, vxfront, vxback, vydown, vyup, vyfront, vyback, vzdown, vzup, vzfront, vzback, viscosity_on_off, dimension);
375  right_boundary_reflecting_on_obstacle(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D,
376  pressure_solid_1D, xa0, dx0, xa, dx, flag, rhodown, rhoup, rhofront, rhoback, vxdown, vxup, vxfront, vxback, vydown, vyup, vyfront, vyback,
377  vzdown, vzup, vzfront, vzback, viscosity_on_off, dimension);
378  }
379  if ((bound.front == 4) && (flag == 2) && (bound_checker == 1) && (lefter == 1)) {
380  left_boundary_inflow(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D, xa0, dx0, xa, dx, flag, rhodown, rhoup, rhofront, rhoback, vxdown,
381  vxup, vxfront, vxback, vydown, vyup, vyfront, vyback, vzdown, vzup, vzfront, vzback, viscosity_on_off, dimension);
382  right_boundary_reflecting_on_obstacle(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D,
383  pressure_solid_1D, xa0, dx0, xa, dx, flag, rhodown, rhoup, rhofront, rhoback, vxdown, vxup, vxfront, vxback, vydown, vyup, vyfront, vyback,
384  vzdown, vzup, vzfront, vzback, viscosity_on_off, dimension);
385  }
386  if ((bound.front == 3) && (flag == 2) && (bound_checker == 1) && (lefter == 1)) {
387  left_boundary_outflow(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D, xa0, dx0, xa, dx, flag, rhodown, rhoup, rhofront, rhoback, vxdown,
388  vxup, vxfront, vxback, vydown, vyup, vyfront, vyback, vzdown, vzup, vzfront, vzback, viscosity_on_off, dimension);
389  right_boundary_reflecting_on_obstacle(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D,
390  pressure_solid_1D, xa0, dx0, xa, dx, flag, rhodown, rhoup, rhofront, rhoback, vxdown, vxup, vxfront, vxback, vydown, vyup, vyfront, vyback,
391  vzdown, vzup, vzfront, vzback, viscosity_on_off, dimension);
392  }
393  if ((bound.front == 2) && (flag == 2) && (bound_checker == 1) && (lefter == 1)) {
394  left_boundary_small_padding(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D, xa0, dx0, xa, dx, flag, rhodown, rhoup, rhofront, rhoback, vxdown,
395  vxup, vxfront, vxback, vydown, vyup, vyfront, vyback, vzdown, vzup, vzfront, vzback, viscosity_on_off, dimension);
396  right_boundary_reflecting_on_obstacle(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D,
397  pressure_solid_1D, xa0, dx0, xa, dx, flag, rhodown, rhoup, rhofront, rhoback, vxdown, vxup, vxfront, vxback, vydown, vyup, vyfront, vyback,
398  vzdown, vzup, vzfront, vzback, viscosity_on_off, dimension);
399  }
400  if ((bound.front == 1) && (flag == 2) && (bound_checker == 1) && (lefter == 1)) {
401  left_boundary_reflecting(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D, xa0, dx0, xa, dx, flag, rhodown, rhoup, rhofront, rhoback, vxdown,
402  vxup, vxfront, vxback, vydown, vyup, vyfront, vyback, vzdown, vzup, vzfront, vzback, viscosity_on_off, dimension);
403  right_boundary_reflecting_on_obstacle(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D,
404  pressure_solid_1D, xa0, dx0, xa, dx, flag, rhodown, rhoup, rhofront, rhoback, vxdown, vxup, vxfront, vxback, vydown, vyup, vyfront, vyback,
405  vzdown, vzup, vzfront, vzback, viscosity_on_off, dimension);
406  }
407  if ((bound.front == 0) && (flag == 2) && (bound_checker == 1) && (lefter == 1)) {
408  left_boundary_zero_gradient(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D, xa0, dx0, xa, dx, flag, rhodown, rhoup, rhofront, rhoback,
409  vxdown, vxup, vxfront, vxback, vydown, vyup, vyfront, vyback, vzdown, vzup, vzfront, vzback, viscosity_on_off, dimension);
410  right_boundary_reflecting_on_obstacle(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D,
411  pressure_solid_1D, xa0, dx0, xa, dx, flag, rhodown, rhoup, rhofront, rhoback, vxdown, vxup, vxfront, vxback, vydown, vyup, vyfront, vyback,
412  vzdown, vzup, vzfront, vzback, viscosity_on_off, dimension);
413  }
414 
415  if ((bound.back == 5) && (flag == 2) && (bound_checker == 1) && (lefter == 2)) {
416  right_boundary_periodic(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D, xa0, dx0, xa, dx, flag, rhodown, rhoup, rhofront, rhoback, vxdown,
417  vxup, vxfront, vxback, vydown, vyup, vyfront, vyback, vzdown, vzup, vzfront, vzback, viscosity_on_off, dimension);
418  left_boundary_reflecting_on_obstacle(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D,
419  pressure_solid_1D, xa0, dx0, xa, dx, flag, rhodown, rhoup, rhofront, rhoback, vxdown, vxup, vxfront, vxback, vydown, vyup, vyfront, vyback,
420  vzdown, vzup, vzfront, vzback, viscosity_on_off, dimension);
421  }
422  if ((bound.back == 4) && (flag == 2) && (bound_checker == 1) && (lefter == 2)) {
423  right_boundary_inflow(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D, xa0, dx0, xa, dx, flag, rhodown, rhoup, rhofront, rhoback, vxdown, vxup,
424  vxfront, vxback, vydown, vyup, vyfront, vyback, vzdown, vzup, vzfront, vzback, viscosity_on_off, dimension);
425  left_boundary_reflecting_on_obstacle(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D,
426  pressure_solid_1D, xa0, dx0, xa, dx, flag, rhodown, rhoup, rhofront, rhoback, vxdown, vxup, vxfront, vxback, vydown, vyup, vyfront, vyback,
427  vzdown, vzup, vzfront, vzback, viscosity_on_off, dimension);
428  }
429  if ((bound.back == 3) && (flag == 2) && (bound_checker == 1) && (lefter == 2)) {
430  right_boundary_outflow(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D, xa0, dx0, xa, dx, flag, rhodown, rhoup, rhofront, rhoback, vxdown,
431  vxup, vxfront, vxback, vydown, vyup, vyfront, vyback, vzdown, vzup, vzfront, vzback, viscosity_on_off, dimension);
432  left_boundary_reflecting_on_obstacle(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D,
433  pressure_solid_1D, xa0, dx0, xa, dx, flag, rhodown, rhoup, rhofront, rhoback, vxdown, vxup, vxfront, vxback, vydown, vyup, vyfront, vyback,
434  vzdown, vzup, vzfront, vzback, viscosity_on_off, dimension);
435  }
436  if ((bound.back == 2) && (flag == 2) && (bound_checker == 1) && (lefter == 2)) {
437  right_boundary_small_padding(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D, xa0, dx0, xa, dx, flag, rhodown, rhoup, rhofront, rhoback,
438  vxdown, vxup, vxfront, vxback, vydown, vyup, vyfront, vyback, vzdown, vzup, vzfront, vzback, viscosity_on_off, dimension);
439  left_boundary_reflecting_on_obstacle(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D,
440  pressure_solid_1D, xa0, dx0, xa, dx, flag, rhodown, rhoup, rhofront, rhoback, vxdown, vxup, vxfront, vxback, vydown, vyup, vyfront, vyback,
441  vzdown, vzup, vzfront, vzback, viscosity_on_off, dimension);
442  }
443  if ((bound.back == 1) && (flag == 2) && (bound_checker == 1) && (lefter == 2)) {
444  right_boundary_reflecting(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D, xa0, dx0, xa, dx, flag, rhodown, rhoup, rhofront, rhoback, vxdown,
445  vxup, vxfront, vxback, vydown, vyup, vyfront, vyback, vzdown, vzup, vzfront, vzback, viscosity_on_off, dimension);
446  left_boundary_reflecting_on_obstacle(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D,
447  pressure_solid_1D, xa0, dx0, xa, dx, flag, rhodown, rhoup, rhofront, rhoback, vxdown, vxup, vxfront, vxback, vydown, vyup, vyfront, vyback,
448  vzdown, vzup, vzfront, vzback, viscosity_on_off, dimension);
449  }
450  if ((bound.back == 0) && (flag == 2) && (bound_checker == 1) && (lefter == 2)) {
451  right_boundary_zero_gradient(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D, xa0, dx0, xa, dx, flag, rhodown, rhoup, rhofront, rhoback, vxdown,
452  vxup, vxfront, vxback, vydown, vyup, vyfront, vyback, vzdown, vzup, vzfront, vzback, viscosity_on_off, dimension);
453  left_boundary_reflecting_on_obstacle(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D,
454  pressure_solid_1D, xa0, dx0, xa, dx, flag, rhodown, rhoup, rhofront, rhoback, vxdown, vxup, vxfront, vxback, vydown, vyup, vyfront, vyback,
455  vzdown, vzup, vzfront, vzback, viscosity_on_off, dimension);
456  }
457  //if both sides are belonging to an obstacle
458  if ((bound_checker == 1) && (lefter == 3)) {
459  right_boundary_reflecting_on_obstacle(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D,
460  pressure_solid_1D, xa0, dx0, xa, dx, flag, rhodown, rhoup, rhofront, rhoback, vxdown, vxup, vxfront, vxback, vydown, vyup, vyfront, vyback,
461  vzdown, vzup, vzfront, vzback, viscosity_on_off, dimension);
462  left_boundary_reflecting_on_obstacle(nmin, nmax, rho_1D, eng_1D, pre_1D, vx_1D, vy_1D, vz_1D,
463  pressure_solid_1D, xa0, dx0, xa, dx, flag, rhodown, rhoup, rhofront, rhoback, vxdown, vxup, vxfront, vxback, vydown, vyup, vyfront, vyback,
464  vzdown, vzup, vzfront, vzback, viscosity_on_off, dimension);
465  }
466  }
467 
468 
469  return 0;
470 }
471 
475 int left_boundary_zero_gradient(int nmin, int nmax, double *rho_1D, double *eng_1D,
476  double *pre_1D, double *vx_1D, double *vy_1D, double *vz_1D,
477  double *xa0, double *dx0, double *xa, double *dx, int flag, double *rhodown, double *rhoup,
478  double *rhofront, double *rhoback, double *vxdown, double *vxup, double *vxfront,
479  double *vxback, double *vydown, double *vyup, double *vyfront, double *vyback,
480  double *vzdown, double *vzup, double *vzfront, double *vzback, int viscosity_on_off,
481  int dimension) {
482 
483  int n;
484 
485  for (n = 1; n < 7; n++) {
486  rho_1D[nmin - n] = rho_1D[nmin];
487  pre_1D[nmin - n] = pre_1D[nmin];
488  eng_1D[nmin - n] = eng_1D[nmin];
489 
490  vx_1D[nmin - n] = vx_1D[nmin];
491  vy_1D[nmin - n] = vy_1D[nmin];
492  vz_1D[nmin - n] = vz_1D[nmin];
493 
494  dx[nmin - n] = dx[nmin];
495  xa[nmin - n] = xa[nmin - n + 1] - dx[nmin - n];
496  dx0[nmin - n] = dx0[nmin];
497  xa0[nmin - n] = xa0[nmin - n + 1] - dx0[nmin - n];
498 
499  if (viscosity_on_off == 1) {
500  if (dimension > 1) {
501  rhodown[nmin - n] = rhodown[nmin];
502  rhoup[nmin - n] = rhoup[nmin];
503  vxdown[nmin - n] = vxdown[nmin];
504  vxup[nmin - n] = vxup[nmin];
505  vydown[nmin - n] = vydown[nmin];
506  vyup[nmin - n] = vyup[nmin];
507  vzdown[nmin - n] = vzdown[nmin];
508  vzup[nmin - n] = vzup[nmin];
509  }
510  if (dimension > 2) {
511  rhofront[nmin - n] = rhofront[nmin];
512  rhoback[nmin - n] = rhoback[nmin];
513  vxfront[nmin - n] = vxfront[nmin];
514  vxback[nmin - n] = vxback[nmin];
515  vyfront[nmin - n] = vyfront[nmin];
516  vyback[nmin - n] = vyback[nmin];
517  vzfront[nmin - n] = vzfront[nmin];
518  vzback[nmin - n] = vzback[nmin];
519  }
520  }
521 
522  }
523 
524  return 0;
525 }
526 
531 int right_boundary_zero_gradient(int nmin, int nmax, double *rho_1D, double *eng_1D,
532  double *pre_1D, double *vx_1D, double *vy_1D, double *vz_1D,
533  double *xa0, double *dx0, double *xa, double *dx, int flag, double *rhodown, double *rhoup,
534  double *rhofront, double *rhoback, double *vxdown, double *vxup, double *vxfront,
535  double *vxback, double *vydown, double *vyup, double *vyfront, double *vyback,
536  double *vzdown, double *vzup, double *vzfront, double *vzback, int viscosity_on_off,
537  int dimension) {
538 
539  double T0, T, A, rho0, pre0;
540 
541  //T(z)=T_0 + A*(z-z0)
542  T0 = 288.15; //[K]
543  A = -6.5E-3; //[K/m]
544 
545  rho0 = 1.229; // Density at sea level [kg/m^3]
546  pre0 = 1.013E5; //pressure at sea level [N/m^2]
547 
548  int n;
549 
550  if ((strat_const_atmos == 1) && (flag == 1)) {
551  for (n = 1; n < 7; n++) {
552 
553  T = T0 + A * ((ymax / y) * (y + n - 1));
554 
555  rho_1D[nmax + n] = rho0 * pow((T / T0), (-grav_acc / (gasconstant * A) + 1));
556  pre_1D[nmax + n] = pre0 * pow((T / T0), (-grav_acc / (gasconstant * A)));
557  eng_1D[nmax + n] = eng_1D[nmax];
558 
559  vx_1D[nmax + n] = vx_1D[nmax];
560  vy_1D[nmax + n] = vy_1D[nmax];
561  vz_1D[nmax + n] = vz_1D[nmax];
562 
563  dx[nmax + n] = dx[nmax];
564  xa[nmax + n] = xa[nmax + n - 1] + dx[nmax + n - 1];
565  dx0[nmax + n] = dx0[nmax];
566  xa0[nmax + n] = xa0[nmax + n - 1] + dx0[nmax + n - 1];
567 
568  if (viscosity_on_off == 1) {
569  if (dimension > 1) {
570  rhodown[nmax + n] = rhodown[nmax];
571  rhoup[nmax + n] = rhoup[nmax];
572  vxdown[nmax + n] = vxdown[nmax];
573  vxup[nmax + n] = vxup[nmax];
574  vydown[nmax + n] = vydown[nmax];
575  vyup[nmax + n] = vyup[nmax];
576  vzdown[nmax + n] = vzdown[nmax];
577  vzup[nmax + n] = vzup[nmax];
578  }
579  if (dimension > 2) {
580  rhofront[nmax + n] = rhofront[nmax];
581  rhoback[nmax + n] = rhoback[nmax];
582  vxfront[nmax + n] = vxfront[nmax];
583  vxback[nmax + n] = vxback[nmax];
584  vyfront[nmax + n] = vyfront[nmax];
585  vyback[nmax + n] = vyback[nmax];
586  vzfront[nmax + n] = vzfront[nmax];
587  vzback[nmax + n] = vzback[nmax];
588  }
589  }
590 
591 
592  }
593  } else {
594  for (n = 1; n < 7; n++) {
595  rho_1D[nmax + n] = rho_1D[nmax];
596  pre_1D[nmax + n] = pre_1D[nmax];
597  eng_1D[nmax + n] = eng_1D[nmax];
598 
599  vx_1D[nmax + n] = vx_1D[nmax];
600  vy_1D[nmax + n] = vy_1D[nmax];
601  vz_1D[nmax + n] = vz_1D[nmax];
602 
603  dx[nmax + n] = dx[nmax];
604  xa[nmax + n] = xa[nmax + n - 1] + dx[nmax + n - 1];
605  dx0[nmax + n] = dx0[nmax];
606  xa0[nmax + n] = xa0[nmax + n - 1] + dx0[nmax + n - 1];
607 
608  if (viscosity_on_off == 1) {
609  if (dimension > 1) {
610  rhodown[nmax + n] = rhodown[nmax];
611  rhoup[nmax + n] = rhoup[nmax];
612  vxdown[nmax + n] = vxdown[nmax];
613  vxup[nmax + n] = vxup[nmax];
614  vydown[nmax + n] = vydown[nmax];
615  vyup[nmax + n] = vyup[nmax];
616  vzdown[nmax + n] = vzdown[nmax];
617  vzup[nmax + n] = vzup[nmax];
618  }
619  if (dimension > 2) {
620  rhofront[nmax + n] = rhofront[nmax];
621  rhoback[nmax + n] = rhoback[nmax];
622  vxfront[nmax + n] = vxfront[nmax];
623  vxback[nmax + n] = vxback[nmax];
624  vyfront[nmax + n] = vyfront[nmax];
625  vyback[nmax + n] = vyback[nmax];
626  vzfront[nmax + n] = vzfront[nmax];
627  vzback[nmax + n] = vzback[nmax];
628  }
629  }
630  }
631  }
632 
633 
634  return 0;
635 }
636 
640 int left_boundary_reflecting(int nmin, int nmax, double *rho_1D, double *eng_1D,
641  double *pre_1D, double *vx_1D, double *vy_1D, double *vz_1D,
642  double *xa0, double *dx0, double *xa, double *dx, int flag, double *rhodown, double *rhoup,
643  double *rhofront, double *rhoback, double *vxdown, double *vxup, double *vxfront,
644  double *vxback, double *vydown, double *vyup, double *vyfront, double *vyback,
645  double *vzdown, double *vzup, double *vzfront, double *vzback, int viscosity_on_off,
646  int dimension) {
647 
648  int n;
649 
650  for (n = 1; n < 7; n++) {
651  rho_1D[nmin - n] = rho_1D[nmin + n - 1];
652  pre_1D[nmin - n] = pre_1D[nmin + n - 1];
653  eng_1D[nmin - n] = eng_1D[nmin + n - 1];
654 
655  vx_1D[nmin - n] = -1 * vx_1D[nmin + n - 1];
656  vy_1D[nmin - n] = -1 * vy_1D[nmin + n - 1];
657  vz_1D[nmin - n] = -1 * vz_1D[nmin + n - 1];
658 
659  dx[nmin - n] = dx[nmin + n - 1];
660  xa[nmin - n] = xa[nmin - n + 1] - dx[nmin - n];
661  dx0[nmin - n] = dx0[nmin + n - 1];
662  xa0[nmin - n] = xa0[nmin - n + 1] - dx0[nmin - n];
663 
664  if (viscosity_on_off == 1) {
665  if (dimension > 1) {
666  rhodown[nmin - n] = rhodown[nmin + n - 1];
667  rhoup[nmin - n] = rhoup[nmin + n - 1];
668  vxdown[nmin - n] = -vxdown[nmin + n - 1];
669  vxup[nmin - n] = -vxup[nmin + n - 1];
670  vydown[nmin - n] = -vydown[nmin + n - 1];
671  vyup[nmin - n] = -vyup[nmin + n - 1];
672  vzdown[nmin - n] = -vzdown[nmin + n - 1];
673  vzup[nmin - n] = -vzup[nmin + n - 1];
674  }
675  if (dimension > 2) {
676  rhofront[nmin - n] = rhofront[nmin + n - 1];
677  rhoback[nmin - n] = rhoback[nmin + n - 1];
678  vxfront[nmin - n] = -vxfront[nmin + n - 1];
679  vxback[nmin - n] = -vxback[nmin + n - 1];
680  vyfront[nmin - n] = -vyfront[nmin + n - 1];
681  vyback[nmin - n] = -vyback[nmin + n - 1];
682  vzfront[nmin - n] = -vzfront[nmin + n - 1];
683  vzback[nmin - n] = -vzback[nmin + n - 1];
684  }
685  }
686  }
687 
688  return 0;
689 }
690 
694 int left_boundary_reflecting_on_obstacle(int nmin, int nmax, double *rho_1D, double *eng_1D,
695  double *pre_1D, double *vx_1D, double *vy_1D, double *vz_1D,
696  double *pressure_solid_1D, double *xa0, double *dx0, double *xa, double *dx, int flag,
697  double *rhodown, double *rhoup, double *rhofront, double *rhoback, double *vxdown, double *vxup,
698  double *vxfront, double *vxback, double *vydown, double *vyup, double *vyfront,
699  double *vyback, double *vzdown, double *vzup, double *vzfront, double *vzback,
700  int viscosity_on_off, int dimension) {
701 
702  int n, k;
703  k = 1;
704 
705  pressure_solid_1D[nmin] = pre_1D[nmin];
706 
707  for (n = 1; n < 7; n++) {
708 
709  rho_1D[nmin - n] = rho_1D[nmin + n - 1];
710  pre_1D[nmin - n] = pre_1D[nmin + n - 1];
711  eng_1D[nmin - n] = eng_1D[nmin + n - 1];
712 
713  vx_1D[nmin - n] = -1 * vx_1D[nmin + n - 1];
714  vy_1D[nmin - n] = -1 * vy_1D[nmin + n - 1];
715  vz_1D[nmin - n] = -1 * vz_1D[nmin + n - 1];
716 
717  dx[nmin - n] = dx[nmin + n - 1];
718  xa[nmin - n] = xa[nmin - n + 1] - dx[nmin - n];
719  dx0[nmin - n] = dx0[nmin + n - 1];
720  xa0[nmin - n] = xa0[nmin - n + 1] - dx0[nmin - n];
721 
722  if (viscosity_on_off == 1) {
723  if (dimension > 1) {
724  rhodown[nmin - n] = rhodown[nmin + n - 1];
725  rhoup[nmin - n] = rhoup[nmin + n - 1];
726  vxdown[nmin - n] = -vxdown[nmin + n - 1];
727  vxup[nmin - n] = -vxup[nmin + n - 1];
728  vydown[nmin - n] = -vydown[nmin + n - 1];
729  vyup[nmin - n] = -vyup[nmin + n - 1];
730  vzdown[nmin - n] = -vzdown[nmin + n - 1];
731  vzup[nmin - n] = -vzup[nmin + n - 1];
732  }
733  if (dimension > 2) {
734  rhofront[nmin - n] = rhofront[nmin + n - 1];
735  rhoback[nmin - n] = rhoback[nmin + n - 1];
736  vxfront[nmin - n] = -vxfront[nmin + n - 1];
737  vxback[nmin - n] = -vxback[nmin + n - 1];
738  vyfront[nmin - n] = -vyfront[nmin + n - 1];
739  vyback[nmin - n] = -vyback[nmin + n - 1];
740  vzfront[nmin - n] = -vzfront[nmin + n - 1];
741  vzback[nmin - n] = -vzback[nmin + n - 1];
742  }
743  }
744  }
745 
746  return 0;
747 }
748 
752 int right_boundary_reflecting(int nmin, int nmax, double *rho_1D, double *eng_1D,
753  double *pre_1D, double *vx_1D, double *vy_1D, double *vz_1D,
754  double *xa0, double *dx0, double *xa, double *dx, int flag, double *rhodown, double *rhoup,
755  double *rhofront, double *rhoback, double *vxdown, double *vxup, double *vxfront,
756  double *vxback, double *vydown, double *vyup, double *vyfront, double *vyback,
757  double *vzdown, double *vzup, double *vzfront, double *vzback, int viscosity_on_off,
758  int dimension) {
759 
760  int n;
761 
762  for (n = 1; n < 7; n++) {
763 
764  rho_1D[n + nmax] = rho_1D[nmax + 1 - n];
765  pre_1D[n + nmax] = pre_1D[nmax + 1 - n];
766  eng_1D[n + nmax] = eng_1D[nmax + 1 - n];
767 
768  vx_1D[n + nmax] = -vx_1D[nmax + 1 - n];
769  vy_1D[n + nmax] = -vy_1D[nmax + 1 - n];
770  vz_1D[n + nmax] = -vz_1D[nmax + 1 - n];
771 
772  dx[n + nmax] = dx[nmax + 1 - n];
773  xa[n + nmax] = xa[nmax + n - 1] + dx[nmax + n - 1];
774  dx0[n + nmax] = dx0[nmax + 1 - n];
775  xa0[n + nmax] = xa0[nmax + n - 1] + dx0[nmax + n - 1];
776 
777  if (viscosity_on_off == 1) {
778  if (dimension > 1) {
779  rhodown[n + nmax] = rhodown[nmax + 1 - n];
780  rhoup[n + nmax] = rhoup[nmax + 1 - n];
781  vxdown[n + nmax] = -vxdown[nmax + 1 - n];
782  vxup[n + nmax] = -vxup[nmax + 1 - n];
783  vydown[n + nmax] = -vydown[nmax + 1 - n];
784  vyup[n + nmax] = -vyup[nmax + 1 - n];
785  vzdown[n + nmax] = -vzdown[nmax + 1 - n];
786  vzup[n + nmax] = -vzup[nmax + 1 - n];
787  }
788  if (dimension > 2) {
789  rhofront[n + nmax] = rhofront[nmax + 1 - n];
790  rhoback[n + nmax] = rhoback[nmax + 1 - n];
791  vxfront[n + nmax] = -vxfront[nmax + 1 - n];
792  vxback[n + nmax] = -vxback[nmax + 1 - n];
793  vyfront[n + nmax] = -vyfront[nmax + 1 - n];
794  vyback[n + nmax] = -vyback[nmax + 1 - n];
795  vzfront[n + nmax] = -vzfront[nmax + 1 - n];
796  vzback[n + nmax] = -vzback[nmax + 1 - n];
797  }
798  }
799  }
800 
801  return 0;
802 }
803 
807 int right_boundary_reflecting_on_obstacle(int nmin, int nmax, double *rho_1D, double *eng_1D,
808  double *pre_1D, double *vx_1D, double *vy_1D, double *vz_1D,
809  double *pressure_solid_1D, double *xa0, double *dx0, double *xa, double *dx, int flag,
810  double *rhodown, double *rhoup, double *rhofront, double *rhoback, double *vxdown, double *vxup,
811  double *vxfront, double *vxback, double *vydown, double *vyup, double *vyfront,
812  double *vyback, double *vzdown, double *vzup, double *vzfront, double *vzback,
813  int viscosity_on_off, int dimension) {
814 
815  int n;
816 
817  pressure_solid_1D[nmax] = pre_1D[nmax];
818 
819 
820  for (n = 1; n < 7; n++) {
821 
822  rho_1D[n + nmax] = rho_1D[nmax + 1 - n];
823  pre_1D[n + nmax] = pre_1D[nmax + 1 - n];
824  eng_1D[n + nmax] = eng_1D[nmax + 1 - n];
825 
826  vx_1D[n + nmax] = -vx_1D[nmax + 1 - n];
827  vy_1D[n + nmax] = -vy_1D[nmax + 1 - n];
828  vz_1D[n + nmax] = -vz_1D[nmax + 1 - n];
829 
830  dx[n + nmax] = dx[nmax + 1 - n];
831  xa[n + nmax] = xa[nmax + n - 1] + dx[nmax + n - 1];
832  dx0[n + nmax] = dx0[nmax + 1 - n];
833  xa0[n + nmax] = xa0[nmax + n - 1] + dx0[nmax + n - 1];
834 
835  if (viscosity_on_off == 1) {
836  if (dimension > 1) {
837  rhodown[nmax + n] = rhodown[nmax + 1 - n];
838  rhoup[nmax + n] = rhoup[nmax + 1 - n];
839  vxdown[nmax + n] = -vxdown[nmax + 1 - n];
840  vxup[nmax + n] = -vxup[nmax + 1 - n];
841  vydown[nmax + n] = -vydown[nmax + 1 - n];
842  vyup[nmax + n] = -vyup[nmax + 1 - n];
843  vzdown[nmax + n] = -vzdown[nmax + 1 - n];
844  vzup[nmax + n] = -vzup[nmax + 1 - n];
845  }
846  if (dimension > 2) {
847  rhofront[nmax + n] = rhofront[nmax + 1 - n];
848  rhoback[nmax + n] = rhoback[nmax + 1 - n];
849  vxfront[nmax + n] = -vxfront[nmax + 1 - n];
850  vxback[nmax + n] = -vxback[nmax + 1 - n];
851  vyfront[nmax + n] = -vyfront[nmax + 1 - n];
852  vyback[nmax + n] = -vyback[nmax + 1 - n];
853  vzfront[nmax + n] = -vzfront[nmax + 1 - n];
854  vzback[nmax + n] = -vzback[nmax + 1 - n];
855  }
856  }
857  }
858 
859  return 0;
860 }
861 
865 int left_boundary_small_padding(int nmin, int nmax, double *rho_1D, double *eng_1D,
866  double *pre_1D, double *vx_1D, double *vy_1D, double *vz_1D,
867  double *xa0, double *dx0, double *xa, double *dx, int flag,
868  double *rhodown, double *rhoup, double *rhofront, double *rhoback, double *vxdown,
869  double *vxup, double *vxfront, double *vxback, double *vydown, double *vyup,
870  double *vyfront, double *vyback, double *vzdown, double *vzup, double *vzfront,
871  double *vzback, int viscosity_on_off, int dimension) {
872 
873  int n;
874 
875  for (n = 1; n < 7; n++) {
876  rho_1D[nmin - n] = small;
877  pre_1D[nmin - n] = small;
878  eng_1D[nmin - n] = small;
879 
880  vx_1D[nmin - n] = small;
881  vy_1D[nmin - n] = small;
882  vz_1D[nmin - n] = small;
883 
884  dx[nmin - n] = dx[nmin];
885  xa[nmin - n] = xa[nmin - n + 1] - dx[nmin - n];
886  dx0[nmin - n] = dx0[nmin];
887  xa0[nmin - n] = xa0[nmin - n + 1] - dx0[nmin - n];
888 
889  if (viscosity_on_off == 1) {
890  if (dimension > 1) {
891  rhodown[nmin - n] = small;
892  rhoup[nmin - n] = small;
893  vxdown[nmin - n] = small;
894  vxup[nmin - n] = small;
895  vydown[nmin - n] = small;
896  vyup[nmin - n] = small;
897  vzdown[nmin - n] = small;
898  vzup[nmin - n] = small;
899  }
900  if (dimension > 2) {
901  rhofront[nmin - n] = small;
902  rhoback[nmin - n] = small;
903  vxfront[nmin - n] = small;
904  vxback[nmin - n] = small;
905  vyfront[nmin - n] = small;
906  vyback[nmin - n] = small;
907  vzfront[nmin - n] = small;
908  vzback[nmin - n] = small;
909  }
910  }
911  }
912 
913  return 0;
914 }
915 
919 int right_boundary_small_padding(int nmin, int nmax, double *rho_1D, double *eng_1D,
920  double *pre_1D, double *vx_1D, double *vy_1D, double *vz_1D,
921  double *xa0, double *dx0, double *xa, double *dx, int flag,
922  double *rhodown, double *rhoup, double *rhofront, double *rhoback, double *vxdown, double *vxup,
923  double *vxfront, double *vxback, double *vydown, double *vyup, double *vyfront,
924  double *vyback, double *vzdown, double *vzup, double *vzfront, double *vzback,
925  int viscosity_on_off, int dimension) {
926 
927  int n;
928 
929  for (n = 1; n < 7; n++) {
930  rho_1D[n + nmax] = small;
931  pre_1D[n + nmax] = small;
932  eng_1D[n + nmax] = small;
933 
934  vx_1D[n + nmax] = small;
935  vy_1D[n + nmax] = small;
936  vz_1D[n + nmax] = small;
937 
938  dx[nmax + n] = dx[nmax];
939  xa[nmax + n] = xa[nmax + n - 1] + dx[nmax + n - 1];
940  dx0[nmax + n] = dx0[nmax];
941  xa0[nmax + n] = xa0[nmax + n - 1] + dx0[nmax + n - 1];
942 
943  if (viscosity_on_off == 1) {
944  if (dimension > 1) {
945  rhodown[nmax + n] = small;
946  rhoup[nmax + n] = small;
947  vxdown[nmax + n] = small;
948  vxup[nmax + n] = small;
949  vydown[nmax + n] = small;
950  vyup[nmax + n] = small;
951  vzdown[nmax + n] = small;
952  vzup[nmax + n] = small;
953  }
954  if (dimension > 2) {
955  rhofront[nmax + n] = small;
956  rhoback[nmax + n] = small;
957  vxfront[nmax + n] = small;
958  vxback[nmax + n] = small;
959  vyfront[nmax + n] = small;
960  vyback[nmax + n] = small;
961  vzfront[nmax + n] = small;
962  vzback[nmax + n] = small;
963  }
964  }
965  }
966 
967  return 0;
968 }
969 
973 int left_boundary_outflow(int nmin, int nmax, double *rho_1D, double *eng_1D,
974  double *pre_1D, double *vx_1D, double *vy_1D, double *vz_1D,
975  double *xa0, double *dx0, double *xa, double *dx, int flag,
976  double *rhodown, double *rhoup, double *rhofront, double *rhoback, double *vxdown, double *vxup,
977  double *vxfront, double *vxback, double *vydown, double *vyup, double *vyfront,
978  double *vyback, double *vzdown, double *vzup, double *vzfront, double *vzback,
979  int viscosity_on_off, int dimension) {
980 
981  int n;
982 
983  for (n = 1; n < 7; n++) {
984  rho_1D[nmin - n] = rho_1D[nmin];
985  pre_1D[nmin - n] = pre_1D[nmin];
986 
987 
988  if (vx_1D[nmin] > 0) {
989  vx_1D[nmin - n] = small;
990  eng_1D[nmin - n] = pre_1D[nmin] / (rho_1D[nmin] * Gamma) + 0.5 *
991  (pow(vx_1D[nmin], 2) + pow(vy_1D[nmin], 2) + pow(vz_1D[nmin], 2));
992  } else {
993  vx_1D[nmin - n] = vx_1D[nmin];
994  eng_1D[nmin - n] = eng_1D[nmin];
995  }
996 
997  dx[nmin - n] = dx[nmin];
998  xa[nmin - n] = xa[nmin - n + 1] - dx[nmin - n];
999  dx0[nmin - n] = dx0[nmin];
1000  xa0[nmin - n] = xa0[nmin - n + 1] - dx0[nmin - n];
1001 
1002  if (viscosity_on_off == 1) {
1003  if (dimension > 1) {
1004  rhodown[nmin - n] = rhodown[nmin];
1005  rhoup[nmin - n] = rhoup[nmin];
1006  vxdown[nmin - n] = vxdown[nmin];
1007  vxup[nmin - n] = small;
1008  vydown[nmin - n] = small;
1009  vyup[nmin - n] = vyup[nmin];
1010  vzdown[nmin - n] = vzdown[nmin];
1011  vzup[nmin - n] = vzup[nmin];
1012  }
1013  if (dimension > 2) {
1014  rhofront[nmin - n] = rhofront[nmin];
1015  rhoback[nmin - n] = rhoback[nmin];
1016  vxfront[nmin - n] = small;
1017  vxback[nmin - n] = small;
1018  vyfront[nmin - n] = vyfront[nmin];
1019  vyback[nmin - n] = vyback[nmin];
1020  vzfront[nmin - n] = vzfront[nmin];
1021  vzback[nmin - n] = vzback[nmin];
1022  }
1023  }
1024  }
1025 
1026  return 0;
1027 }
1028 
1032 int right_boundary_outflow(int nmin, int nmax, double *rho_1D, double *eng_1D,
1033  double *pre_1D, double *vx_1D, double *vy_1D, double *vz_1D,
1034  double *xa0, double *dx0, double *xa, double *dx, int flag,
1035  double *rhodown, double *rhoup, double *rhofront, double *rhoback, double *vxdown, double *vxup,
1036  double *vxfront, double *vxback, double *vydown, double *vyup, double *vyfront,
1037  double *vyback, double *vzdown, double *vzup, double *vzfront, double *vzback,
1038  int viscosity_on_off, int dimension) {
1039 
1040  int n;
1041 
1042  for (n = 1; n < 7; n++) {
1043  rho_1D[nmax + n] = rho_1D[nmax];
1044  pre_1D[nmax + n] = pre_1D[nmax];
1045 
1046  if (vx_1D[nmax] < 0) {
1047  vx_1D[nmax + n] = small;
1048  eng_1D[nmax + n] = pre_1D[nmax] / (rho_1D[nmax] * Gamma) + 0.5 *
1049  (pow(vx_1D[nmax], 2) + pow(vy_1D[nmax], 2) + pow(vz_1D[nmax], 2));
1050 
1051  } else {
1052  vx_1D[nmax + n] = vx_1D[nmax];
1053  eng_1D[nmax + n] = eng_1D[nmax];
1054 
1055  }
1056 
1057  dx[nmax + n] = dx[nmax];
1058  xa[nmax + n] = xa[nmax + n - 1] + dx[nmax + n - 1];
1059  dx0[nmax + n] = dx0[nmax];
1060  xa0[nmax + n] = xa0[nmax + n - 1] + dx0[nmax + n - 1];
1061 
1062  if (viscosity_on_off == 1) {
1063  if (dimension > 1) {
1064  rhodown[nmax + n] = rhodown[nmax];
1065  rhoup[nmax + n] = rhoup[nmax];
1066  vxdown[nmax + n] = small;
1067  vxup[nmax + n] = small;
1068  vyup[nmax + n] = vyup[nmax];
1069  vzdown[nmax + n] = vzdown[nmax];
1070  vzup[nmax + n] = vzup[nmax];
1071  }
1072  if (dimension > 2) {
1073  rhofront[nmax + n] = rhofront[nmax];
1074  rhoback[nmax + n] = rhoback[nmax];
1075  vxfront[nmax + n] = small;
1076  vxback[nmax + n] = small;
1077  vyfront[nmax + n] = vyfront[nmax];
1078  vyback[nmax + n] = vyback[nmax];
1079  vzfront[nmax + n] = vzfront[nmax];
1080  vzback[nmax + n] = vzback[nmax];
1081  }
1082  }
1083  }
1084 
1085 
1086  return 0;
1087 }
1088 
1092 int left_boundary_inflow(int nmin, int nmax, double *rho_1D, double *eng_1D,
1093  double *pre_1D, double *vx_1D, double *vy_1D, double *vz_1D,
1094  double *xa0, double *dx0, double *xa, double *dx, int flag,
1095  double *rhodown, double *rhoup, double *rhofront, double *rhoback, double *vxdown, double *vxup,
1096  double *vxfront, double *vxback, double *vydown, double *vyup, double *vyfront,
1097  double *vyback, double *vzdown, double *vzup, double *vzfront, double *vzback,
1098  int viscosity_on_off, int dimension) {
1099 
1100  int n;
1101 
1102  for (n = 1; n < 7; n++) {
1103  rho_1D[nmin - n] = inflow_density;
1104  pre_1D[nmin - n] = inflow_temperature * gasconstant*inflow_density;
1105  eng_1D[nmin - n] = (inflow_temperature * gasconstant * inflow_density)
1106  / (inflow_density * Gamma) + 0.5 * (pow(inflow_velocity, 2));
1107 
1108  vx_1D[nmin - n] = inflow_velocity;
1109  vy_1D[nmin - n] = 0.0;
1110  vz_1D[nmin - n] = 0.0;
1111 
1112  dx[nmin - n] = dx[nmin];
1113  xa[nmin - n] = xa[nmin - n + 1] - dx[nmin - n];
1114  dx0[nmin - n] = dx0[nmin];
1115  xa0[nmin - n] = xa0[nmin - n + 1] - dx0[nmin - n];
1116 
1117  if (viscosity_on_off == 1) {
1118  if (dimension > 1) {
1119  rhodown[nmin - n] = inflow_density;
1120  rhoup[nmin - n] = inflow_density;
1121  vxdown[nmin - n] = inflow_velocity;
1122  vxup[nmin - n] = inflow_velocity;
1123  vydown[nmin - n] = 0.0;
1124  vyup[nmin - n] = 0.0;
1125  vzdown[nmin - n] = 0.0;
1126  vzup[nmin - n] = 0.0;
1127  }
1128  if (dimension > 2) {
1129  rhofront[nmin - n] = inflow_density;
1130  rhoback[nmin - n] = inflow_density;
1131  vxfront[nmin - n] = inflow_velocity;
1132  vxback[nmin - n] = inflow_velocity;
1133  vyfront[nmin - n] = 0.0;
1134  vyback[nmin - n] = 0.0;
1135  vzfront[nmin - n] = 0.0;
1136  vzback[nmin - n] = 0.0;
1137  }
1138  }
1139  }
1140 
1141  return 0;
1142 }
1143 
1147 int right_boundary_inflow(int nmin, int nmax, double *rho_1D, double *eng_1D,
1148  double *pre_1D, double *vx_1D, double *vy_1D, double *vz_1D,
1149  double *xa0, double *dx0, double *xa, double *dx, int flag,
1150  double *rhodown, double *rhoup, double *rhofront, double *rhoback, double *vxdown, double *vxup,
1151  double *vxfront, double *vxback, double *vydown, double *vyup, double *vyfront,
1152  double *vyback, double *vzdown, double *vzup, double *vzfront, double *vzback,
1153  int viscosity_on_off, int dimension) {
1154 
1155  int n;
1156 
1157  for (n = 1; n < 7; n++) {
1158  rho_1D[nmax + n] = inflow_density;
1159  pre_1D[nmax + n] = inflow_temperature * gasconstant*inflow_density;
1160  eng_1D[nmax + n] = (inflow_temperature * gasconstant * inflow_density)
1161  / (inflow_density * Gamma) + 0.5 * (pow(inflow_velocity, 2));
1162 
1163  vx_1D[nmax + n] = inflow_velocity;
1164  vy_1D[nmax + n] = 0.0;
1165  vz_1D[nmax + n] = 0.0;
1166 
1167  dx[nmax + n] = dx[nmax];
1168  xa[nmax + n] = xa[nmax + n - 1] + dx[nmax + n - 1];
1169  dx0[nmax + n] = dx0[nmax];
1170  xa0[nmax + n] = xa0[nmax + n - 1] + dx0[nmax + n - 1];
1171 
1172  if (viscosity_on_off == 1) {
1173  if (dimension > 1) {
1174  rhodown[nmax + n] = inflow_density;
1175  rhoup[nmax + n] = inflow_density;
1176  vxdown[nmax + n] = inflow_velocity;
1177  vxup[nmax + n] = inflow_velocity;
1178  vydown[nmax + n] = 0.0;
1179  vyup[nmax + n] = 0.0;
1180  vzdown[nmax + n] = 0.0;
1181  vzup[nmax + n] = 0.0;
1182  }
1183  if (dimension > 2) {
1184  rhofront[nmax + n] = inflow_density;
1185  rhoback[nmax + n] = inflow_density;
1186  vxfront[nmax + n] = inflow_velocity;
1187  vxback[nmax + n] = inflow_velocity;
1188  vyfront[nmax + n] = 0.0;
1189  vyback[nmax + n] = 0.0;
1190  vzfront[nmax + n] = 0.0;
1191  vzback[nmax + n] = 0.0;
1192  }
1193  }
1194  }
1195 
1196 
1197  return 0;
1198 }
1199 
1203 int left_boundary_periodic(int nmin, int nmax, double *rho_1D, double *eng_1D,
1204  double *pre_1D, double *vx_1D, double *vy_1D, double *vz_1D,
1205  double *xa0, double *dx0, double *xa, double *dx, int flag, double *rhodown, double *rhoup,
1206  double *rhofront, double *rhoback, double *vxdown, double *vxup, double *vxfront,
1207  double *vxback, double *vydown, double *vyup, double *vyfront, double *vyback,
1208  double *vzdown, double *vzup, double *vzfront, double *vzback, int viscosity_on_off,
1209  int dimension) {
1210 
1211  int n;
1212 
1213  for (n = 1; n < 7; n++) {
1214  rho_1D[nmin - n] = rho_1D[nmax + 1 - n];
1215  pre_1D[nmin - n] = pre_1D[nmax + 1 - n];
1216  eng_1D[nmin - n] = eng_1D[nmax + 1 - n];
1217 
1218  vx_1D[nmin - n] = vx_1D[nmax + 1 - n];
1219  vy_1D[nmin - n] = vy_1D[nmax + 1 - n];
1220  vz_1D[nmin - n] = vz_1D[nmax + 1 - n];
1221 
1222 
1223  dx[nmin - n] = dx[nmax + 1 - n];
1224  xa[nmin - n] = xa[nmin - n + 1] - dx[nmin - n];
1225  dx0[nmin - n] = dx0[nmax + 1 - n];
1226  xa0[nmin - n] = xa0[nmin - n + 1] - dx0[nmin - n];
1227 
1228  if (viscosity_on_off == 1) {
1229  if (dimension > 1) {
1230  rhodown[nmin - n] = rhodown[nmax + 1 - n];
1231  rhoup[nmin - n] = rhoup[nmax + 1 - n];
1232  vxdown[nmin - n] = vxdown[nmax + 1 - n];
1233  vxup[nmin - n] = vxup[nmax + 1 - n];
1234  vydown[nmin - n] = vydown[nmax + 1 - n];
1235  vyup[nmin - n] = vyup[nmax + 1 - n];
1236  vzdown[nmin - n] = vzdown[nmax + 1 - n];
1237  vzup[nmin - n] = vzup[nmax + 1 - n];
1238  }
1239  if (dimension > 2) {
1240  rhofront[nmin - n] = rhofront[nmax + 1 - n];
1241  rhoback[nmin - n] = rhoback[nmax + 1 - n];
1242  vxfront[nmin - n] = vxfront[nmax + 1 - n];
1243  vxback[nmin - n] = vxback[nmax + 1 - n];
1244  vyfront[nmin - n] = vyfront[nmax + 1 - n];
1245  vyback[nmin - n] = vyback[nmax + 1 - n];
1246  vzfront[nmin - n] = vzfront[nmax + 1 - n];
1247  vzback[nmin - n] = vzback[nmax + 1 - n];
1248  }
1249  }
1250  }
1251 
1252 
1253  return 0;
1254 }
1255 
1259 int right_boundary_periodic(int nmin, int nmax, double *rho_1D, double *eng_1D,
1260  double *pre_1D, double *vx_1D, double *vy_1D, double *vz_1D,
1261  double *xa0, double *dx0, double *xa, double *dx, int flag,
1262  double *rhodown, double *rhoup, double *rhofront, double *rhoback, double *vxdown, double *vxup,
1263  double *vxfront, double *vxback, double *vydown, double *vyup, double *vyfront,
1264  double *vyback, double *vzdown, double *vzup, double *vzfront, double *vzback,
1265  int viscosity_on_off, int dimension) {
1266 
1267  int n;
1268 
1269  for (n = 1; n < 7; n++) {
1270  rho_1D[nmax + n] = rho_1D[nmin + n - 1];
1271  pre_1D[nmax + n] = pre_1D[nmin + n - 1];
1272  eng_1D[nmax + n] = eng_1D[nmin + n - 1];
1273 
1274  vx_1D[nmax + n] = vx_1D[nmin + n - 1];
1275  vy_1D[nmax + n] = vy_1D[nmin + n - 1];
1276  vz_1D[nmax + n] = vz_1D[nmin + n - 1];
1277 
1278  dx[nmax + n] = dx[nmin + n - 1];
1279  xa[nmax + n] = xa[nmax + n - 1] + dx[nmax + n - 1];
1280  dx0[nmax + n] = dx0[nmin + n - 1];
1281  xa0[nmax + n] = xa0[nmax + n - 1] + dx0[nmax + n - 1];
1282 
1283  if (viscosity_on_off == 1) {
1284  if (dimension > 1) {
1285  rhodown[nmax + n] = rhodown[nmin + n - 1];
1286  rhoup[nmax + n] = rhoup[nmin + n - 1];
1287  vxdown[nmax + n] = vxdown[nmin + n - 1];
1288  vxup[nmax + n] = vxup[nmin + n - 1];
1289  vydown[nmax + n] = vydown[nmin + n - 1];
1290  vyup[nmax + n] = vyup[nmin + n - 1];
1291  vzdown[nmax + n] = vzdown[nmin + n - 1];
1292  vzup[nmax + n] = vzup[nmin + n - 1];
1293  }
1294  if (dimension > 2) {
1295  rhofront[nmax + n] = rhofront[nmin + n - 1];
1296  rhoback[nmax + n] = rhoback[nmin + n - 1];
1297  vxfront[nmax + n] = vxfront[nmin + n - 1];
1298  vxback[nmax + n] = vxback[nmin + n - 1];
1299  vyfront[nmax + n] = vyfront[nmin + n - 1];
1300  vyback[nmax + n] = vyback[nmin + n - 1];
1301  vzfront[nmax + n] = vzfront[nmin + n - 1];
1302  vzback[nmax + n] = vzback[nmin + n - 1];
1303  }
1304  }
1305  }
1306 
1307  return 0;
1308 }