-
Notifications
You must be signed in to change notification settings - Fork 38
Expand file tree
/
Copy pathPenningTrap.cpp
More file actions
101 lines (76 loc) · 3.12 KB
/
Copy pathPenningTrap.cpp
File metadata and controls
101 lines (76 loc) · 3.12 KB
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
101
// Penning Trap
// Usage:
// srun ./PenningTrap
// <nx> [<ny>...] <Np> <Nt> <stype> <lbthres>
// <t_method> --overallocate <ovfactor> --info 10
// nx = No. cell-centered points in the x-direction
// ny = No. cell-centered points in the y-direction
// nz = No. cell-centered points in the z-direction
// Np = Total no. of macro-particles in the simulation
// Nt = Number of time steps
// stype = Field solver type (FFT, CG, P3M, and OPEN supported)
// lbthres = Load balancing threshold i.e., lbthres*100 is the maximum load imbalance
// percentage which can be tolerated and beyond which
// particle load balancing occurs. A value of 0.01 is good for many typical
// simulations.
// t_method = Time-stepping method used e.g. Leapfrog
// ovfactor = Over-allocation factor for the buffers used in the communication. Typical
// values are 1.0, 2.0. Value 1.0 means no over-allocation.
// Example:
// srun ./PenningTrap 128 128 128 10000 300 FFT 0.01 LeapFrog --overallocate 1.0 --info 10
constexpr unsigned Dim = 3;
using T = double;
const char* TestName = "PenningTrap";
#include "Ippl.h"
#include <Kokkos_MathematicalConstants.hpp>
#include <Kokkos_MathematicalFunctions.hpp>
#include <Kokkos_Random.hpp>
#include <chrono>
#include <iostream>
#include <string>
#include "datatypes.h"
#include "Utility/IpplTimings.h"
#include "Manager/PicManager.h"
#include "PenningTrapManager.h"
#ifdef ENABLE_CATALYST
#include "Stream/InSitu/CatalystAdaptor.h"
#endif
int main(int argc, char* argv[]) {
ippl::initialize(argc, argv);
{
#ifdef ENABLE_CATALYST
CatalystAdaptor::Initialize(argc, argv);
#endif
Inform msg(TestName);
Inform msg2all(TestName, INFORM_ALL_NODES);
static IpplTimings::TimerRef mainTimer = IpplTimings::getTimer("total");
IpplTimings::startTimer(mainTimer);
// Read input parameters, assign them to the corresponding memebers of manager
int arg = 1;
Vector_t<int, Dim> nr;
for (unsigned d = 0; d < Dim; d++) {
nr[d] = std::atoi(argv[arg++]);
}
size_type totalP = std::atoll(argv[arg++]);
int nt = std::atoi(argv[arg++]);
std::string solver = argv[arg++];
double lbt = std::atof(argv[arg++]);
std::string step_method = argv[arg++];
// Create an instance of a manger for the considered application
PenningTrapManager<T, Dim> manager(totalP, nt, nr, lbt, solver, step_method);
// Perform pre-run operations, including creating mesh, particles,...
manager.pre_run();
manager.setTime(0.0);
msg << "Starting iterations ..." << endl;
manager.run(manager.getNt());
msg << "End." << endl;
#ifdef ENABLE_CATALYST
CatalystAdaptor::Finalize();
#endif
IpplTimings::stopTimer(mainTimer);
IpplTimings::print();
IpplTimings::print(std::string("timing.dat"));
}
ippl::finalize();
return 0;
}