ASCOT5
Loading...
Searching...
No Matches
Macros | Functions
simulate_ml_adaptive.c File Reference

Simulate magnetic field-lines using adaptive time-step. More...

#include <stdio.h>
#include <stdlib.h>
#include <omp.h>
#include <math.h>
#include "../ascot5.h"
#include "../simulate.h"
#include "../particle.h"
#include "../wall.h"
#include "../diag.h"
#include "../B_field.h"
#include "../E_field.h"
#include "simulate_ml_adaptive.h"
#include "step/step_ml_cashkarp.h"
#include "../endcond.h"
#include "../consts.h"

Go to the source code of this file.

Macros

#define MAGNETIC_FIELD_LINE_INISTEP   1.0e-2
 
#define DUMMY_STEP_VAL   100.0
 

Functions

real simulate_ml_adaptive_inidt (sim_data *sim, particle_simd_ml *p, int i)
 Calculates initial time step value.
 
void simulate_ml_adaptive (particle_queue *pq, sim_data *sim)
 Simulates magnetic field-lines using adaptive time-step.
 

Detailed Description

Simulate magnetic field-lines using adaptive time-step.

Definition in file simulate_ml_adaptive.c.

Macro Definition Documentation

◆ MAGNETIC_FIELD_LINE_INISTEP

#define MAGNETIC_FIELD_LINE_INISTEP   1.0e-2

Initial step size in meters

Definition at line 26 of file simulate_ml_adaptive.c.

◆ DUMMY_STEP_VAL

#define DUMMY_STEP_VAL   100.0

Dummy orbit step val in meters

Definition at line 27 of file simulate_ml_adaptive.c.

Function Documentation

◆ simulate_ml_adaptive_inidt()

real simulate_ml_adaptive_inidt ( sim_data * sim,
particle_simd_ml * p,
int i )

Calculates initial time step value.

The time step value (in units of meters) is defined by MAGNETIC_FIELD_LINE_INISTEP

Parameters
simpointer to simulation data struct
pSIMD array of markers
iindex of marker for which time step is assessed
Returns
Calculated time step

Definition at line 234 of file simulate_ml_adaptive.c.

◆ simulate_ml_adaptive()

void simulate_ml_adaptive ( particle_queue * pq,
sim_data * sim )

Simulates magnetic field-lines using adaptive time-step.

The simulation includes:

  • orbit-following with Cash-Karp method

The simulation is carried until all markers have met some end condition or are aborted/rejected. The final state of the markers is stored in the given marker array. Other output is stored in the diagnostic array.

The adaptive time-step is determined by integrator error tolerances as well as user-defined limits for how much marker state can change during a single time-step.

Note that even though we might refer the integration time-step as "time", in reality we are integrating over distance. The time step is therefore step in meters marker orbit is intgerated. Marker does have time in its field, but it is the global time and that is not being changed during the simulation.

Parameters
pqfield lines to be simulated
simsimulation data struct

Definition at line 53 of file simulate_ml_adaptive.c.