-
Notifications
You must be signed in to change notification settings - Fork 0
/
Driver.h
55 lines (46 loc) · 1.47 KB
/
Driver.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
#pragma once
#include <vector>
#include "ChemData.h"
#include "Field.h"
#include "Mesh.h"
#include "Parameter.h"
#include "BoundCond.cuh"
#include "gxl_lib/Time.h"
namespace cfd {
struct DParameter;
class InviscidScheme;
struct ViscousScheme;
struct TemporalScheme;
struct Driver {
Driver(Parameter ¶meter, Mesh &mesh_
#if MULTISPECIES == 1
, ChemData &chem_data
#endif
);
void initialize_computation();
void simulate();
integer myid=0;
gxl::Time time;
const Mesh &mesh;
const Parameter& parameter;
std::vector<Field> field; // The flowfield data of the simulation. Every block is a "Field" object
#ifdef GPU
DParameter *param = nullptr; // The parameters used for GPU simulation, datas are stored on GPU while the pointer is on CPU
DBoundCond bound_cond; // Boundary conditions
InviscidScheme **inviscid_scheme = nullptr;
ViscousScheme **viscous_scheme = nullptr;
TemporalScheme **temporal_scheme = nullptr;
#endif
std::array<real ,4> res{1,1,1,1};
std::array<real ,4> res_scale{1,1,1,1};
private:
void data_communication();
void steady_simulation();
real compute_residual(integer step);
void steady_screen_output(integer step, real err_max);
};
__global__ void setup_schemes(cfd::InviscidScheme **inviscid_scheme, cfd::ViscousScheme **viscous_scheme,
cfd::TemporalScheme **temporal_scheme, cfd::DParameter *param);
template<integer N>
__global__ void reduction_of_dbv_squared(real *arr_to_sum, integer size);
}