42int main(
int argc,
char** argv) {
58 "Tag %s\nBranch %s\n\n", GIT_VERSION, GIT_BRANCH);
61 real* nbi_offload_array;
62 real* B_offload_array;
63 real* plasma_offload_array;
64 real* neutral_offload_array;
65 real* wall_offload_array;
66 int* wall_int_offload_array;
67 real* asigma_offload_array;
68 real* diag_offload_array;
73 &B_offload_array, NULL, &plasma_offload_array,
74 &neutral_offload_array, &wall_offload_array,
75 &wall_int_offload_array, NULL, NULL,
76 &asigma_offload_array, &nbi_offload_array,
79 "Input initialization failed\n");
91 "\nFailed to initialize diagnostics.\n"
92 "See stderr for details.\n");
97 *
sizeof(
real) / (1024.0*1024.0);
99 "Initialized diagnostics, %.1f MB.\n", diag_offload_array_size);
109 "\nPreparing output.\n");
112 "\nInitializing output failed.\n"
113 "See stderr for details.\n");
118 strcpy(sim.
qid, qid);
124 &sim, nprt, t1, t2, B_offload_array, plasma_offload_array,
125 neutral_offload_array, wall_offload_array, wall_int_offload_array,
126 asigma_offload_array, nbi_offload_array, &p, diag_offload_array);
133 "Writing marker state failed.\n"
134 "See stderr for details.\n"
139 "\nMarker state written.\n");
142 &sim, diag_offload_array, sim.
hdf5_out);
170 struct option longopts[] = {
171 {
"in", required_argument, 0, 1},
172 {
"out", required_argument, 0, 2},
173 {
"mpi_size", required_argument, 0, 3},
174 {
"mpi_rank", required_argument, 0, 4},
175 {
"d", required_argument, 0, 5},
176 {
"bfield", required_argument, 0, 6},
177 {
"wall", required_argument, 0, 7},
178 {
"plasma", required_argument, 0, 8},
179 {
"nbi", required_argument, 0, 9},
180 {
"n", required_argument, 0, 10},
181 {
"t1", required_argument, 0, 11},
182 {
"t2", required_argument, 0, 12},
210 while((c = getopt_long(argc, argv,
"", longopts, NULL)) != -1) {
215 slen = strlen(optarg);
216 if ( slen > 3 && !strcmp(optarg+slen-3,
".h5") ) {
227 slen = strlen(optarg);
228 if ( slen > 3 && !strcmp(optarg+slen-3,
".h5") ) {
258 *nprt = atoi(optarg);
269 "\nUnrecognized argument. The valid arguments are:\n");
271 "--in input file (default: ascot.h5)\n");
273 "--out output file (default: same as input)\n");
275 "--mpi_size number of independent processes\n");
277 "--mpi_rank rank of independent process\n");
279 "--d run description maximum of 250 characters\n");
281 "--n number of markers to generate (default: 10000)\n");
283 "--t1 time when injectors are turned on (default: 0.0 s)\n");
285 "--t2 time when injectors are turned off (default: 0.0 s)\n");
295 strcpy(sim->
hdf5_in,
"ascot.h5");
300 strcpy(sim->
hdf5_in,
"ascot.h5");
Header file for B_field.c.
Main header file for ASCOT5.
Header file for asigma.c.
void bbnbi_simulate(sim_offload_data *sim, int nprt, real t1, real t2, real *B_offload_array, real *plasma_offload_array, real *neutral_offload_array, real *wall_offload_array, int *wall_int_offload_array, real *asigma_offload_array, real *nbi_offload_array, particle_state **p, real *diag_offload_array)
Simulate NBI injection.
Functions to execute bbnbi externally.
int bbnbi_read_arguments(int argc, char **argv, sim_offload_data *sim, int *nprt, real *t1, real *t2)
Read command line arguments.
int main(int argc, char **argv)
Main function for BBNBI5.
int diag_init_offload(diag_offload_data *data, real **offload_array, int Nmrk)
Initializes offload array from offload data.
Header file for hdf5_helpers.h.
int hdf5_interface_init_results(sim_offload_data *sim, char *qid, char *run)
Initialize run group.
int hdf5_interface_read_input(sim_offload_data *sim, int input_active, real **B_offload_array, real **E_offload_array, real **plasma_offload_array, real **neutral_offload_array, real **wall_offload_array, int **wall_int_offload_array, real **boozer_offload_array, real **mhd_offload_array, real **asigma_offload_array, real **nbi_offload_array, input_particle **p, int *n_markers)
Read and initialize input data.
int hdf5_interface_write_state(char *fn, char *state, integer n, particle_state *p)
Write marker state to HDF5 output.
int hdf5_interface_write_diagnostics(sim_offload_data *sim, real *diag_offload_array, char *out)
Write diagnostics to HDF5 output.
void hdf5_generate_qid(char *qid)
Generate an identification number for a run.
Header file for hdf5_interface.c.
Header file for neutral.c.
Header file for particle.c.
Header file for plasma.c.
Macros for printing console output.
#define print_out(v,...)
Print to standard output.
#define print_out0(v, rank, root,...)
Print to standard output only for root process.
void simulate_init_offload(sim_offload_data *sim)
Initializes simulation settings.
Header file for simulate.c.
size_t offload_array_length
General representation of a marker.
Simulation offload struct.
diag_offload_data diag_offload_data