forked from CmPA/iPic3D
-
Notifications
You must be signed in to change notification settings - Fork 0
/
iPic3D.cpp
55 lines (37 loc) · 1.22 KB
/
iPic3D.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
#include <iomanip>
#include "iPic3D.h"
using namespace iPic3D;
int main(int argc, char **argv) {
iPic3D::c_Solver KCode;
bool b_err = false;
/* ------------------------------ */
/* 0- Initialize the solver class */
/* ------------------------------ */
KCode.Init(argc, argv);
KCode.InjectBoundaryParticles();
KCode.GatherMoments();
/* ------------ */
/* 1- Main loop */
/* ------------ */
for (int i = KCode.FirstCycle(); i <= KCode.LastCycle(); i++) {
if (KCode.get_myrank() == 0) cout << " ======= Cycle " << i << " ======= " << endl;
/* ----------------------------------------------------- */
/* 2- Calculate fields and move particles */
/* Exit if there is a memory issue with the particles */
/* ----------------------------------------------------- */
KCode.UpdateCycleInfo(i);
KCode.CalculateField();
b_err = KCode.ParticlesMover();
if (!b_err) KCode.CalculateBField();
if (!b_err) KCode.GatherMoments();
if ( b_err) i = KCode.LastCycle() + 1;
/* --------------- */
/* 3- Output files */
/* --------------- */
KCode.WriteOutput(i);
KCode.WriteConserved(i);
KCode.WriteRestart(i);
}
KCode.Finalize();
return 0;
}