-
Notifications
You must be signed in to change notification settings - Fork 2
/
engine.h
executable file
·100 lines (84 loc) · 2.61 KB
/
engine.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
#ifndef ENGINE_H__
#define ENGINE_H__
#include <vector>
#include <algorithm>
#include <cmath>
#include "cuda.h"
#include "cuda_runtime.h"
#include <assert.h>
using namespace std;
#define DOUBLE double
#define segment_limit 20
#define PI 3.14159265358979323846
#define powf pow
struct Options{
DOUBLE Tmax, t_start, sediment_start, bed_change_start;
int interval;
bool kenhhepd, kenhhepng;
int M, N;
bool ketdinh, channel, debug, plot;
int total_time;
Options(DOUBLE Tmx, DOUBLE ts, int itv, DOUBLE sds, DOUBLE bcs, bool cohesive, bool kenhng,
bool kenhd, bool db, bool plt){
Tmax = Tmx;
t_start = ts;
interval = itv;
sediment_start = sds;
bed_change_start = bcs;
kenhhepng = kenhng;
kenhhepd = kenhd;
ketdinh = cohesive;
channel = kenhd ^ kenhng;
debug = db;
plot = plt;
}
};
struct Constant_Coeffs{
DOUBLE dX, dY, dT, dXbp, dYbp, dX2, dY2, dTchia2dX, dTchia2dY, HaiChiadT;
DOUBLE QuyDoiTime, QuyDoiPi;
DOUBLE NANGDAY, H_TINH, heso, mu_mn;
DOUBLE kenhhepng, kenhhepd;
DOUBLE Wind, huonggio, Zbandau;
DOUBLE NDnen, NDbphai, NDbtrai, NDbtren, NDbduoi;
DOUBLE Tod, Toe, hstoe, ghtoe , Mbochat;
DOUBLE ro, ros, dm, muy, d90, Dorong, Sx, sohn, soha, sohn1;
DOUBLE CORIOLIS_FORCE, g, Ks;
DOUBLE Windx, Windy, Ufr, Dxr, wss;
};
struct Argument_Pointers {
int M, N;
DOUBLE hmax_u, hmax_d, hmax_l, hmax_r;
int *bienQ;
int* daui, *dauj, *cuoii, *cuoij, *moci, *mocj, *khouot, *boundary_type;
DOUBLE* h, *v, *u, *z, *t_u, *t_v, *t_z, *Htdu, *Htdv, *H_moi, *htaiz, *htaiz_bd;
DOUBLE* ubt, *ubp, *vbt, *vbd; //*vt, *ut;
DOUBLE* hsnham, *VISCOIDX, *Kx1, *Ky1, *Tsyw, *Tsxw;
DOUBLE* bc_up, *bc_down, *bc_left, *bc_right;
DOUBLE* hi;
DOUBLE* FS, *tFS, *CC_u, *CC_d, *CC_l, *CC_r;
DOUBLE *VTH, *Kx, *Ky, *Fw;
DOUBLE* Qbx, *Qby;
DOUBLE* dH;
};
struct Array_Pointers {
DOUBLE* a1, *b1, *c1, *d1, *a2, *c2, *d2;
DOUBLE* f1, *f2, *f3, *f5;
DOUBLE* AA, *BB, *CC, *DD;
DOUBLE* x;
DOUBLE* Ap, *Bp, *ep;
int *SN;
};
struct Host_arrays
{
int M, N, total_time;
vector<DOUBLE> h, hsnham, VISCOIDX, Fw, FS, dH;
vector<DOUBLE> bc_up, bc_down, bc_left, bc_right;
vector<DOUBLE> CC_u, CC_d, CC_l, CC_r;
vector<DOUBLE> u, v, z;
vector<int> khouot, bienQ, boundary_type;
};
void update_boundary_at_t(int M, int N, float t, bool channel, int total_time, Argument_Pointers* d_arg_ptr, Constant_Coeffs* coeffs);
void synch_and_check();
void Hydraulic_Calculation(DOUBLE dT, DOUBLE NANGDAY, Argument_Pointers* d_arg_ptr, Array_Pointers* d_arr_ptr, Constant_Coeffs* coeffs,
Argument_Pointers h_arg_ptr, Options ops);
#endif