36void sim_monitor(
char* filename,
volatile int* n,
volatile int* finished);
88 n_queue_size = n_particles;
101 print_err(
"Only GO mode ported to GPU. Please set SIM_MODE=1.");
105 print_err(
"RECORD_MODE=1 not ported to GPU. Please disable it.");
109 print_err(
"Atomic not yet ported to GPU. Please set ENABLE_ATOMIC=0.");
113 print_err(
"MHD not yet ported to GPU. Please set ENABLE_MHD=0.");
118 "ENABLE_ORBITWRITE=1 not ported to GPU. Please disable it.");
123 "ENABLE_TRANSCOEF=1 not ported to GPU. Please disable it.");
129 GPU_MAP_TO_DEVICE(sim[0:1])
153 for(
int i = 0; i < n_particles; i++) {
161 for(
int i = 0; i < n_particles; i++) {
162 pq.
p[pq.
next++] = &p[i];
168 omp_get_max_threads());
177 omp_set_max_active_levels(2);
179#if !defined(GPU) && VERBOSE > 1
180 #pragma omp parallel sections num_threads(2)
193 OMP_PARALLEL_CPU_ONLY
197 OMP_PARALLEL_CPU_ONLY
202 OMP_PARALLEL_CPU_ONLY
206 OMP_PARALLEL_CPU_ONLY
210#if !defined(GPU) && VERBOSE > 1
216 char filename[519], outfn[256];
218 outfn[strlen(outfn)-3] =
'\0';
219 sprintf(filename,
"%s_%s.stdout", outfn, sim->
qid);
239 for(
int i = 0; i < pq.
n; i++) {
260 for(
int i = 0; i < pq.
n; i++) {
268#if !defined(GPU) && VERBOSE > 1
269 #pragma omp parallel sections num_threads(2)
274 OMP_PARALLEL_CPU_ONLY
277#if !defined(GPU) && VERBOSE > 1
282 char filename[519], outfn[256];
284 outfn[strlen(outfn)-3] =
'\0';
285 sprintf(filename,
"%s_%s.stdout", outfn, sim->
qid);
334void sim_monitor(
char* filename,
volatile int* n,
volatile int* finished) {
336 FILE *f = fopen(filename,
"w");
339 "Warning. %s could not be opened for progress updates.\n",
346 int n_temp, finished_temp;
350 finished_temp = *finished;
351 real fracprog = ((
real) finished_temp)/n_temp;
354 if(n_temp == finished_temp) {
359 fprintf(f,
"No marker has finished simulation yet. "
360 "Time spent: %.2f h\n", timespent/3600);
363 fprintf(f,
"Progress: %d/%d, %.2f %%. Time spent: %.2f h, "
364 "estimated time to finish: %.2f h\n", finished_temp, n_temp,
365 100*fracprog, timespent/3600, (1/fracprog-1)*timespent/3600);
371 fprintf(f,
"Simulation finished.\n");
void B_field_offload(B_field_data *data)
Offload data to the accelerator.
Header file for B_field.c.
void E_field_offload(E_field_data *data)
Offload data to the accelerator.
Header file for E_field.c.
#define NSIMD
Number of particles simulated simultaneously in a particle group operations.
#define A5_WTIME
Wall time.
void asigma_extrapolate(int extrapolate)
Toggle extrapolation when evaluating cross sections.
void asigma_offload(asigma_data *data)
Offload data to the accelerator.
Header file for asigma.c.
void boozer_offload(boozer_data *data)
Offload data to the accelerator.
Header file for boozer.c.
void diag_offload(diag_data *data)
Offload data to the accelerator.
int diag_init(diag_data *data, int Nmrk)
Initializes diagnostics data.
Header file for endcond.c.
void mccc_init(mccc_data *mdata, int include_energy, int include_pitch, int include_gcdiff)
Set collision operator data.
Header file for mccc package.
void mhd_offload(mhd_data *data)
Offload data to the accelerator.
void neutral_offload(neutral_data *data)
Offload data to the accelerator.
Header file for neutral.c.
Header file for particle.c.
void plasma_offload(plasma_data *data)
Offload data to the accelerator.
Header file for plasma.c.
Macros for printing console output.
#define print_out(v,...)
Print to standard output.
#define print_err(...)
Print to standard error.
Header file for random.c.
#define random_init(data, seed)
void simulate(int n_particles, particle_state *p, sim_data *sim)
Execute marker simulation.
void simulate_init(sim_data *sim)
Initialize simulation data struct.
void sim_monitor(char *filename, volatile int *n, volatile int *finished)
Monitor simulation progress.
Header file for simulate.c.
void simulate_fo_fixed(particle_queue *pq, sim_data *sim, int mrk_array_size)
Simulates particles using fixed time-step.
Header file for simulate_fo_fixed.c.
void simulate_gc_adaptive(particle_queue *pq, sim_data *sim)
Simulates guiding centers using adaptive time-step.
Header file for simulate_gc_adaptive.c.
void simulate_gc_fixed(particle_queue *pq, sim_data *sim)
Simulates guiding centers using fixed time-step.
Header file for simulate_gc_fixed.c.
void simulate_ml_adaptive(particle_queue *pq, sim_data *sim)
Simulates magnetic field-lines using adaptive time-step.
Header file for simulate_ml_adaptive.c.
General representation of a marker.
neutral_data neutral_data
void wall_offload(wall_data *data)
Offload data to the accelerator.
int wall_hit_wall(real r1, real phi1, real z1, real r2, real phi2, real z2, wall_data *w, real *w_coll)
Check if a given directed line segment intersects the wall.