-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathadvection.h
211 lines (196 loc) · 8.67 KB
/
advection.h
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
///////////////////////////////////////////////////////////////////////////////
///
/// \file advection.h
///
/// \brief Solver for advection step
///
/// \author Mingang Jin, Qingyan Chen
/// Purdue University
/// Wangda Zuo
/// University of Miami
///
/// \date 8/3/2013
///
/// This file provides functions that used for the advection step of FFD method.
/// The advection starts with \c advect(). Then different subroutines are
/// called according to the properties of the variables that are sorted by
/// the location of variables assigned in the control volume.
/// Velocities at X, Y and Z directions are locatted
/// on the surface of the control volume. They are computed using
/// subroutines: \c trace_vx(), \c trace_vy() and \ctrace_vz().
/// Scalar variables are in the center of control volume and they are computed
/// using \c trace_scalar().
///
///////////////////////////////////////////////////////////////////////////////
#ifndef _ADVECTION_H
#define _ADVECTION_H
#endif
#ifndef _DATA_STRUCTURE_H
#define _DATA_STRUCTURE_H
#include "data_structure.h"
#endif
#ifndef _UTILITY_H
#define _UTILITY_H
#include "utility.h"
#endif
#ifndef _BOUNDARY_H
#define _BOUNDARY_H
#include "boundary.h"
#endif
#ifndef _INTERPOLATION_H
#define _INTERPOLATION_H
#include "interpolation.h"
#endif
#ifndef _SOLVER_H
#define _SOLVER_H
#include "solver.h"
#endif
///////////////////////////////////////////////////////////////////////////////
/// Entrance of advection step
///
/// Specific method for advection will be selected according to the variable
/// type.
///
///\param para Pointer to FFD parameters
///\param var Pointer to FFD simulation variables
///\param var_type The type of variable for advection solver
///\param index Index of trace substances or species
///\param d Pointer to the computed variables at previous time step
///\param d0 Pointer to the computed variables for current time step
///\param BINDEX Pointer to boundary index
///
///\return 0 if no error occurred
///////////////////////////////////////////////////////////////////////////////
int advect(PARA_DATA *para, REAL **var, int var_type, int index,
REAL *d, REAL *d0, int **BINDEX);
///////////////////////////////////////////////////////////////////////////////
/// Advection for velocity at X-direction
///
///\param para Pointer to FFD parameters
///\param var Pointer to FFD simulation variables
///\param var_type The type of variable for advection solver
///\param d Pointer to the computed variables at previous time step
///\param d0 Pointer to the computed variables for current time step
///\param BINDEX Pointer to boundary index
///
///\return 0 if no error occurred
///////////////////////////////////////////////////////////////////////////////
int trace_vx(PARA_DATA *para, REAL **var, int var_type, REAL *d, REAL *d0,
int **BINDEX);
///////////////////////////////////////////////////////////////////////////////
/// Advection for velocity at Y-direction
///
///\param para Pointer to FFD parameters
///\param var Pointer to FFD simulation variables
///\param var_type The type of variable for advection solver
///\param d Pointer to the computed variables at previous time step
///\param d0 Pointer to the computed variables for current time step
///\param BINDEX Pointer to boundary index
///
///\return 0 if no error occurred
///////////////////////////////////////////////////////////////////////////////
int trace_vy(PARA_DATA *para, REAL **var, int var_type, REAL *d, REAL *d0,
int **BINDEX);
///////////////////////////////////////////////////////////////////////////////
/// Advection for velocity at Z-direction
///
///\param para Pointer to FFD parameters
///\param var Pointer to FFD simulation variables
///\param var_type The type of variable for advection solver
///\param d Pointer to the computed variables at previous time step
///\param d0 Pointer to the computed variables for current time step
///\param BINDEX Pointer to boundary index
///
///\return 0 if no error occurred
///////////////////////////////////////////////////////////////////////////////
int trace_vz(PARA_DATA *para, REAL **var, int var_type, REAL *d, REAL *d0,
int **BINDEX);
///////////////////////////////////////////////////////////////////////////////
/// Advection for scalar variables located in the center of control volume
///
///\param para Pointer to FFD parameters
///\param var Pointer to FFD simulation variables
///\param var_type The type of variable for advection solver
///\param index Index of trace substances or species
///\param d Pointer to the computed variables at previous time step
///\param d0 Pointer to the computed variables for current time step
///\param BINDEX Pointer to boundary index
///
///\return 0 if no error occurred
///////////////////////////////////////////////////////////////////////////////
int trace_scalar(PARA_DATA *para, REAL **var, int var_type, int index,
REAL *d, REAL *d0, int **BINDEX);
///////////////////////////////////////////////////////////////////////////////
/// Find the X-location and coordinates at previous time step
///
/// Conducting backward tracing for the particle's X-location and
/// corresponding coordinates at the previous time step.
///
///\param para Pointer to FFD parameters
///\param var Pointer to FFD simulation variables
///\param flag Pointer to the property of the cell
///\param x Pointer to the current position x(t) of particle
///\param u0 X-velocity at time (t-1) in location x(t)
///\param i I-index for cell at time t at x(t)
///\param j J-index for cell at time t at x(t)
///\param k K-index for cell at time t at x(t)
///\param OL Pointer to the locations of particle at time (t-1)
///\param OC Pointer to the coordinates of particle at time (t-1)
///\param LOC Pointer to flags recording if tracing back hits the boundary
///\param COOD Pointer to record the status of tracing back process
///
///\return void No return needed
///////////////////////////////////////////////////////////////////////////////
void set_x_location(PARA_DATA *para, REAL **var, REAL *flag, REAL *x, REAL u0,
int i, int j, int k,
REAL *OL, int *OC, int *LOC , int *COOD);
///////////////////////////////////////////////////////////////////////////////
/// Find the Y-location and coordinates at previous time step
///
/// Conducting backward tracing for the particle's Y-location and
/// corresponding coordinates at the previous time step.
///
///\param para Pointer to FFD parameters
///\param var Pointer to FFD simulation variables
///\param flag Pointer to the property of the cell
///\param y Pointer to the current position y(t) of particle
///\param v0 Y-velocity at time (t-1) in location y(t)
///\param i I-index for cell at time t at y(t)
///\param j J-index for cell at time t at y(t)
///\param k K-index for cell at time t at y(t)
///\param OL Pointer to the locations of particle at time (t-1)
///\param OC Pointer to the coordinates of particle at time (t-1)
///\param LOC Pointer to flags recording if tracing back hits the boundary
///\param COOD Pointer to record the status of tracing back process
///
///\return void No return needed
///////////////////////////////////////////////////////////////////////////////
void set_y_location(PARA_DATA *para, REAL **var, REAL *flag, REAL *y, REAL v0,
int i, int j, int k,
REAL *OL, int *OC, int *LOC , int *COOD);
///////////////////////////////////////////////////////////////////////////////
/// Find the Z-location and coordinates at previous time step
///
/// Conducting backward tracing for the particle's Z-location and
/// corresponding coordinates at the previous time step.
///
///\param para Pointer to FFD parameters
///\param var Pointer to FFD simulation variables
///\param flag Pointer to the property of the cell
///\param Z Pointer to the current position y(t) of particle
///\param w0 Z-velocity at time (t-1) in location z(t)
///\param i I-index for cell at time t at z(t)
///\param j J-index for cell at time t at z(t)
///\param k K-index for cell at time t at z(t)
///\param OL Pointer to the locations of particle at time (t-1)
///\param OC Pointer to the coordinates of particle at time (t-1)
///\param LOC Pointer to flags recording if tracing back hits the boundary
///\param COOD Pointer to record the status of tracing back process
///
///\return void No return needed
///////////////////////////////////////////////////////////////////////////////
void set_z_location(PARA_DATA *para, REAL **var, REAL *flag, REAL *z, REAL w0,
int i, int j, int k,
REAL *OL, int *OC, int *LOC , int *COOD);