ASCOT5
Loading...
Searching...
No Matches
Functions
plasma_1Dt.c File Reference

1D time-dependent plasma with linear interpolation More...

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "../ascot5.h"
#include "../error.h"
#include "../consts.h"
#include "../print.h"
#include "plasma_1Dt.h"

Go to the source code of this file.

Functions

int plasma_1Dt_init_offload (plasma_1Dt_offload_data *offload_data, real **offload_array)
 Initialize 1Dt plasma data and check inputs.
 
void plasma_1Dt_free_offload (plasma_1Dt_offload_data *offload_data, real **offload_array)
 Free offload array and reset parameters.
 
void plasma_1Dt_init (plasma_1Dt_data *pls_data, plasma_1Dt_offload_data *offload_data, real *offload_array)
 Initialize magnetic field data struct on target.
 
a5err plasma_1Dt_eval_temp (real *temp, real rho, real t, int species, plasma_1Dt_data *pls_data)
 Evaluate plasma temperature.
 
a5err plasma_1Dt_eval_dens (real *dens, real rho, real t, int species, plasma_1Dt_data *pls_data)
 Evaluate plasma density.
 
a5err plasma_1Dt_eval_densandtemp (real *dens, real *temp, real rho, real t, plasma_1Dt_data *pls_data)
 Evaluate plasma density and temperature for all species.
 

Detailed Description

1D time-dependent plasma with linear interpolation

Definition in file plasma_1Dt.c.

Function Documentation

◆ plasma_1Dt_init_offload()

int plasma_1Dt_init_offload ( plasma_1Dt_offload_data * offload_data,
real ** offload_array )

Initialize 1Dt plasma data and check inputs.

Before calling this function, the offload struct is expected to be fully initialized.

The offload array is expected to hold plasma data as

  • [n_rho] = electron temperature [J]
  • [n_rho*2] = ion temperature [J]
  • [n_rho*2 + n_rho*n_ions] = electron density [m^-3]
  • [n_rho*2 + n_rho*n_ions + n_rho] = ion density [m^-3]
  • [i_time*n_species*n_rho+i_species*n_rho] =

This function initializes splines to plasma profiles and prints some values as sanity checks.

Parameters
offload_datapointer to offload data struct
offload_arraypointer to pointer to offload array
Returns
zero if initialization succes

Definition at line 36 of file plasma_1Dt.c.

◆ plasma_1Dt_free_offload()

void plasma_1Dt_free_offload ( plasma_1Dt_offload_data * offload_data,
real ** offload_array )

Free offload array and reset parameters.

This function deallocates the offload_array.

Parameters
offload_datapointer to offload data struct
offload_arraypointer to pointer to offload array

Definition at line 103 of file plasma_1Dt.c.

◆ plasma_1Dt_init()

void plasma_1Dt_init ( plasma_1Dt_data * pls_data,
plasma_1Dt_offload_data * offload_data,
real * offload_array )

Initialize magnetic field data struct on target.

This function copies the magnetic field parameters from the offload struct to the struct on target and sets the plasma data pointers to correct offsets in the offload array.

Parameters
pls_datapointer to data struct on target
offload_datapointer to offload data struct
offload_arraypointer to offload array

Definition at line 120 of file plasma_1Dt.c.

◆ plasma_1Dt_eval_temp()

a5err plasma_1Dt_eval_temp ( real * temp,
real rho,
real t,
int species,
plasma_1Dt_data * pls_data )

Evaluate plasma temperature.

This function evaluates the temperature of a plasma species at the given radial coordinate using linear interpolation.

Parameters
temppointer to where evaluated temperature [J] is stored
rhoradial coordinate
ttime instant
speciesindex of plasma species
pls_datapointer to plasma data struct
Returns
zero if evaluation succeeded

Definition at line 153 of file plasma_1Dt.c.

◆ plasma_1Dt_eval_dens()

a5err plasma_1Dt_eval_dens ( real * dens,
real rho,
real t,
int species,
plasma_1Dt_data * pls_data )

Evaluate plasma density.

This function evaluates the density of a plasma species at the given radial coordinate using linear interpolation.

Parameters
denspointer to where evaluated density [m^-3] is stored
rhoradial coordinate
ttime instant
speciesindex of plasma species
pls_datapointer to plasma data struct
Returns
zero if evaluation succeeded

Definition at line 181 of file plasma_1Dt.c.

◆ plasma_1Dt_eval_densandtemp()

a5err plasma_1Dt_eval_densandtemp ( real * dens,
real * temp,
real rho,
real t,
plasma_1Dt_data * pls_data )

Evaluate plasma density and temperature for all species.

This function evaluates the density and temperature of all plasma species at the given radial coordinate using linear interpolation.

Parameters
denspointer to where interpolated densities [m^-3] are stored
temppointer to where interpolated temperatures [J] are stored
rhoradial coordinate
ttime instant
pls_datapointer to plasma data struct
Returns
zero if evaluation succeeded

Definition at line 208 of file plasma_1Dt.c.