-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathchangedt.cpp
56 lines (53 loc) · 1.39 KB
/
changedt.cpp
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
#include "include/traj.h"
int changedt(particles *pt, int cdt, par *par)
{
float inc = 0;
// cout << endl<< cdt << " ";
switch (cdt)
{
case 1: //
inc = decf;
par->dt[0] *= decf;
par->dt[1] *= decf;
// cout << "dt decrease E high B OK \n";
break;
case 4:
inc = decf;
par->dt[0] *= decf;
par->dt[1] *= decf;
// cout << "dt decrease B exceeded E OK\n";
break;
case 5:
inc = decf;
par->dt[0] *= decf;
par->dt[1] *= decf;
// cout << "dt decrease B exceeded and E exceeded\n";
break;
case 6:
inc = decf;
par->dt[0] *= decf;
par->dt[1] *= decf;
// cout << "dt decrease B exceeded and E too low\n";
break;
case 9:
inc = decf;
par->dt[0] *= decf;
par->dt[1] *= decf;
// cout << "dt decrease B too low E too high \n";
break;
case 10:
inc = incf;
par->dt[0] *= incf;
par->dt[1] *= incf;
// cout << "dt: increase B too low E too low\n";
break;
default:
// cout << "no change dt" << endl;
return 0;
}
#pragma omp parallel for simd
for (int n = 0; n < par->n_part[0] * 3 * 2; n++)
pt->pos0[n] = pt->pos1[n] - (pt->pos1[n] - pt->pos0[n]) * inc;
// cout << "dt changed" << endl;
return 1;
}