-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwave.cu
More file actions
43 lines (35 loc) · 754 Bytes
/
Copy pathwave.cu
File metadata and controls
43 lines (35 loc) · 754 Bytes
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
#include<thrust/device_vector.h>
#include<math.h>
#include<vector>
#include<iostream>
#include "gpu_flow_sim.h"
int main(void)
{
int nsteps = 300;
int plotevery = 100;
int updatedtevery = 10;
int n = 2000;
float dx = 0.01;
float L = n*dx;
std::vector<float> Q0(n);
std::vector<float> A0(n);
std::vector<float> S(n);
std::vector<float> r(n);
for(int i=0; i<n; i++)
{
Q0[i] = 0;
A0[i] = 1 + 0.2*exp(-5*(i*dx - L/2)*(i*dx - L/2));
S[i] = 0;
r[i] = 0;
}
gpu_flow_sim::gpu_flow_sim simulator(Q0, A0, S, r, dx);
simulator.set_dt();
for (int i = 0; i<nsteps; i++)
{
if (i%plotevery == 0) simulator.output();
if (i%updatedtevery == 0) simulator.set_dt();
simulator.timestep();
}
simulator.output();
return 0;
}