IPPL (Independent Parallel Particle Layer)
IPPL
Loading...
Searching...
No Matches
BumponTailInstability.cpp
Go to the documentation of this file.
1// Bump on Tail Instability Test Case
2// Usage:
3// srun ./BumponTailInstability
4// <nx> [<ny>...] <Np> <Nt> <stype> <lbthres>
5// <t_method> --overallocate <ovfactor> --info 10
6// nx = No. cell-centered points in the x-direction
7// ny... = No. cell-centered points in the y-, z-, ...-direction
8// Np = Total no. of macro-particles in the simulation
9// Nt = Number of time steps
10// stype = Field solver type (FFT and CG supported)
11// lbthres = Load balancing threshold i.e., lbthres*100 is the maximum load imbalance
12// percentage which can be tolerated and beyond which
13// particle load balancing occurs. A value of 0.01 is good for many typical
14// simulations.
15// t_method = Time-stepping method used e.g. Leapfrog
16// ovfactor = Over-allocation factor for the buffers used in the communication. Typical
17// values are 1.0, 2.0. Value 1.0 means no over-allocation.
18// Example:
19// srun ./BumponTailInstability 128 128 128 10000 10 FFT 0.01 LeapFrog --overallocate 2.0 --info
20// 10
21
22constexpr unsigned Dim = 3;
23using T = double;
24const char* TestName = "BumponTailInstability";
25
26#include "Ippl.h"
27
28#include <Kokkos_MathematicalConstants.hpp>
29#include <Kokkos_MathematicalFunctions.hpp>
30#include <Kokkos_Random.hpp>
31#include <chrono>
32#include <iostream>
33#include <random>
34#include <set>
35#include <string>
36#include <vector>
37
38#include "Manager/datatypes.h"
39
40#include "Utility/IpplTimings.h"
41
43#include "Manager/PicManager.h"
44
45int main(int argc, char* argv[]) {
46 ippl::initialize(argc, argv);
47 {
48 Inform msg(TestName);
50
51 static IpplTimings::TimerRef mainTimer = IpplTimings::getTimer("total");
52 IpplTimings::startTimer(mainTimer);
53
54 // Read input parameters, assign them to the corresponding memebers of manager
55 int arg = 1;
57 for (unsigned d = 0; d < Dim; d++) {
58 nr[d] = std::atoi(argv[arg++]);
59 }
60
61 size_type totalP = std::atoll(argv[arg++]);
62 int nt = std::atoi(argv[arg++]);
63 std::string solver = argv[arg++];
64 double lbt = std::atof(argv[arg++]);
65 std::string step_method = argv[arg++];
66
67 // Create an instance of a manger for the considered application
68 BumponTailInstabilityManager<T, Dim> manager(totalP, nt, nr, lbt, solver, step_method);
69
70 // Perform pre-run operations, including creating mesh, particles,...
71 manager.pre_run();
72
73 manager.setTime(0.0);
74
75 msg << "Starting iterations ..." << endl;
76
77 manager.run(manager.getNt());
78
79 msg << "End." << endl;
80
81 IpplTimings::stopTimer(mainTimer);
83 IpplTimings::print(std::string("timing.dat"));
84 }
86
87 return 0;
88}
int main(int argc, char *argv[])
constexpr unsigned Dim
ippl::detail::size_type size_type
Definition datatypes.h:23
const char * TestName
ippl::Vector< T, Dim > Vector_t
Definition datatypes.h:38
Inform & endl(Inform &inf)
Definition Inform.cpp:42
#define INFORM_ALL_NODES
Definition Inform.h:38
void initialize(int &argc, char *argv[], MPI_Comm comm)
Definition Ippl.cpp:16
void finalize()
Definition Ippl.cpp:94
void run(int nt)
The main for loop fro running a simulation.
Definition BaseManager.h:63
Timing::TimerRef TimerRef
static TimerRef getTimer(const char *nm)
static void stopTimer(TimerRef t)
static void print()
static void startTimer(TimerRef t)
void setTime(double time_)
int getNt() const
void pre_run() override
A method that should be used for setting up the simulation.