26#include "step/step_gc_cashkarp.h"
30DECLARE_TARGET_SIMD_UNIFORM(sim)
33#define DUMMY_TIMESTEP_VAL 1.0
73 real cputime, cputime_last;
78 for(
int i=0; i<
NSIMD; i++) {
87 for(
int i = 0; i <
NSIMD; i++) {
111 while(n_running > 0) {
115 for(
int i = 0; i <
NSIMD; i++) {
126 for(
int i = 0; i <
NSIMD; i++) {
145 for(
int i = 0; i <
NSIMD; i++) {
148 hout_orb[i] = -hout_orb[i];
151 if(p.running[i] && hout_orb[i] < 0){
153 hnext[i] = hout_orb[i];
167 for(
int i = 0; i <
NSIMD; i++) {
168 if(p.running[i] && hout_col[i] < 0){
170 hnext[i] = hout_col[i];
179 for(
int i = 0; i <
NSIMD; i++) {
180 if(p.id[i] > 0 && !p.err[i]) {
186 if(dphi > 1 && dphi > drho) {
187 hnext[i] = -hin[i]/dphi;
189 else if(drho > 1 && drho > dphi) {
190 hnext[i] = -hin[i]/drho;
212 p.mileage[i] += hin[i];
214 if(hnext[i] > hout_orb[i]) {
217 hnext[i] = hout_orb[i];
219 if(hnext[i] > hout_col[i]) {
222 hnext[i] = hout_col[i];
224 if(hnext[i] == 1.0) {
236 p.cputime[i] += cputime - cputime_last;
240 cputime_last = cputime;
253 for(
int i = 0; i <
NSIMD; i++) {
306 real colltime = 1/(100*nu);
307 if(h > colltime) {h=colltime;}
Header file for B_field.c.
Header file for E_field.c.
Main header file for ASCOT5.
#define NSIMD
Number of particles simulated simultaneously in a particle group operations.
#define A5_WTIME
Wall time.
Header file for boozer.c.
Header file containing physical and mathematical constants.
void diag_update_gc(diag_data *data, B_field_data *Bdata, particle_simd_gc *p_f, particle_simd_gc *p_i)
Collects diagnostics when marker represents a guiding center.
void endcond_check_gc(particle_simd_gc *p_f, particle_simd_gc *p_i, sim_data *sim)
Check end conditions for GC markers.
Header file for endcond.c.
#define math_normc(a1, a2, a3)
Calculate norm of 3D vector from its components a1, a2, a3.
Header file for mccc package.
void mccc_gc_milstein(particle_simd_gc *p, real *hin, real *hout, real tol, mccc_wienarr *w, B_field_data *Bdata, plasma_data *pdata, mccc_data *mdata, real *rnd)
Integrate collisions for one time-step.
a5err mccc_wiener_clean(mccc_wienarr *w, real t)
Removes Wiener processes from the array that are no longer required.
void mccc_wiener_initialize(mccc_wienarr *w, real initime)
Initializes a struct that stores generated Wiener processes.
header file for mccc_wiener.c
void particle_copy_gc(particle_simd_gc *p1, int i, particle_simd_gc *p2, int j)
Copy GC struct.
int particle_cycle_gc(particle_queue *q, particle_simd_gc *p, B_field_data *Bdata, int *cycle)
Replace finished GC markers with new ones or dummies.
Header file for particle.c.
Methods to evaluate elementary physical quantities.
#define phys_gyrofreq_ppar(m, q, mu, ppar, B)
Evaluate gyrofrequency [rad/s] from parallel momentum and magnetic moment.
Header file for plasma.c.
#define random_normal_simd(data, n, r)
Header file for simulate.c.
real simulate_gc_adaptive_inidt(sim_data *sim, particle_simd_gc *p, int i)
Calculates time step value.
void simulate_gc_adaptive(particle_queue *pq, sim_data *sim)
Simulates guiding centers using adaptive time-step.
#define DUMMY_TIMESTEP_VAL
Header file for simulate_gc_adaptive.c.
void step_gc_cashkarp_mhd(particle_simd_gc *p, real *h, real *hnext, real tol, B_field_data *Bdata, E_field_data *Edata, boozer_data *boozer, mhd_data *mhd)
Integrate a guiding center step for a struct of markers with MHD.
void step_gc_cashkarp(particle_simd_gc *p, real *h, real *hnext, real tol, B_field_data *Bdata, E_field_data *Edata)
Integrate a guiding center step for a struct of markers.
Struct for storing Wiener processes.
Struct representing NSIMD guiding center markers.