26#include "step/step_gc_cashkarp.h"
30DECLARE_TARGET_SIMD_UNIFORM(sim)
33#define DUMMY_TIMESTEP_VAL 1.0
74 real cputime, cputime_last;
81 for(
int i=0; i<
NSIMD; i++) {
94 for(
int i = 0; i <
NSIMD; i++) {
119 while(n_running > 0) {
123 for(
int i = 0; i <
NSIMD; i++) {
135 for(
int i = 0; i <
NSIMD; i++) {
155 for(
int i = 0; i <
NSIMD; i++) {
159 hout_orb[i] = -hout_orb[i];
162 if(p.running[i] && hout_orb[i] < 0){
164 hnext[i] = hout_orb[i];
178 for(
int i = 0; i <
NSIMD; i++) {
179 if(p.running[i] && hout_col[i] < 0){
181 hnext[i] = hout_col[i];
188 rfof_resonance_check_and_kick_gc(
193 for(
int i = 0; i <
NSIMD; i++) {
194 if(p.running[i] && hout_rfof[i] < 0){
196 hnext[i] = hout_rfof[i];
205 for(
int i = 0; i <
NSIMD; i++) {
206 if(p.id[i] > 0 && !p.err[i]) {
212 if(dphi > 1 && dphi > drho) {
213 hnext[i] = -hin[i]/dphi;
215 else if(drho > 1 && drho > dphi) {
216 hnext[i] = -hin[i]/drho;
237 p.mileage[i] += hin[i];
240 if(hnext[i] > hout_orb[i]) {
243 hnext[i] = hout_orb[i];
245 if(hnext[i] > hout_col[i]) {
248 hnext[i] = hout_col[i];
250 if(hnext[i] > hout_rfof[i]) {
252 hnext[i] = hout_rfof[i];
254 if(hnext[i] == 1.0) {
266 p.cputime[i] += cputime - cputime_last;
270 cputime_last = cputime;
283 for(
int i = 0; i <
NSIMD; i++) {
292 rfof_clear_history(&rfof_mrk, i);
302 rfof_tear_down(&rfof_mrk);
345 real colltime = 1/(100*nu);
346 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)
Contains the functions to be called from the simulation loop when using ICRH.
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, int aldforce)
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, int aldforce)
Integrate a guiding center step for a struct of markers.
Struct for storing Wiener processes.
Struct representing NSIMD guiding center markers.
Reusable struct for storing marker specific data during the simulation loop.