ASCOT5
Loading...
Searching...
No Matches
Macros | Functions
mccc_coefs.h File Reference

Routines to evaluate coefficients needed to evaluate collisions. More...

#include <math.h>
#include "../../ascot5.h"
#include "../../consts.h"
#include "mccc.h"

Go to the source code of this file.

Macros

#define mccc_coefs_cab(qa, qb, nb, clogab)
 Evaluate collision parameter [kg^2 m^3 / s^4].
 
#define mccc_coefs_Q(ma, qa, mb, qb, nb, vb, clogab, mu0)
 Evaluate non-relativistic drag coefficient [m/s^2].
 
#define mccc_coefs_dQ(ma, qa, mb, qb, nb, vb, clogab, dmu0)
 Evaluate derivative of non-relativistic drag coefficient [m/s^2].
 
#define mccc_coefs_F(ma, qa, mb, qb, nb, vb, clogab, mu0)
 Evaluate non-relativistic friction coefficient [m/s^2].
 
#define mccc_coefs_Dpara(ma, qa, va, qb, nb, vb, clogab, mu0)
 Evaluate non-relativistic parallel diffusion coefficient [m^2/s^3].
 
#define mccc_coefs_dDpara(ma, qa, va, qb, nb, vb, clogab, mu0, dmu0)
 Evaluate derivative of non-relativistic parallel diffusion coefficient [m/s^2].
 
#define mccc_coefs_Dperp(ma, qa, va, qb, nb, vb, clogab, mu1)
 Evaluate non-relativistic perpendicular diffusion coefficient [m^2/s^3].
 
#define mccc_coefs_K(va, Dpara, dDpara, Q)
 Evaluate guiding center drag coefficient [m/s^2].
 
#define mccc_coefs_nu(va, Dperp)
 Evaluate pitch collision frequency [1/s].
 
#define mccc_coefs_DX(xi, Dpara, Dperp, gyrofreq)
 Evaluate spatial diffusion coefficient [m^2/s].
 

Functions

static void mccc_coefs_mufun (real mufun[3], real x, mccc_data *mdata)
 Evaluate special functions needed by collision coefficients.
 
static DECLARE_TARGET_END void mccc_coefs_clog (real *clogab, real ma, real qa, real va, int nspec, const real *mb, const real *qb, const real *nb, const real *Tb)
 Evaluate Coulomb logarithm.
 

Detailed Description

Routines to evaluate coefficients needed to evaluate collisions.

Definition in file mccc_coefs.h.

Macro Definition Documentation

◆ mccc_coefs_cab

#define mccc_coefs_cab ( qa,
qb,
nb,
clogab )
Value:
( \
nb * qa*qa * qb*qb * clogab / ( 4 * CONST_PI * CONST_E0*CONST_E0 ) )
#define CONST_PI
pi
Definition consts.h:11
#define CONST_E0
Electric constant [m^-3*kg^-1*s^4*A^2]
Definition consts.h:41

Evaluate collision parameter [kg^2 m^3 / s^4].

$c_{ab} = \frac{n_b q_a^2q_b^2 \ln\Lambda_{ab}}{4\pi\epsilon_0^2}$

where

  • $q_a$ is test particle charge [C]
  • $q_b$ is plasma species charge [C]
  • $n_b$ is plasma species density [m^-3]
  • $\ln\Lambda_{ab}$ is Coulomb logarithm.

Definition at line 25 of file mccc_coefs.h.

◆ mccc_coefs_Q

#define mccc_coefs_Q ( ma,
qa,
mb,
qb,
nb,
vb,
clogab,
mu0 )
Value:
( \
-mccc_coefs_cab(qa, qb, nb, clogab) * mu0 / ( ma * mb * vb*vb ) )
#define mccc_coefs_cab(qa, qb, nb, clogab)
Evaluate collision parameter [kg^2 m^3 / s^4].
Definition mccc_coefs.h:25

Evaluate non-relativistic drag coefficient [m/s^2].

$Q =-c_{ab}(q_a,q_b,n_b,\ln\Lambda_{ab})\mu_0(v_a/v_b) / (m_a m_b v_b^2)$

where

  • $m_a$ is test particle mass [kg]
  • $q_a$ is test particle charge [C]
  • $m_b$ is plasma species mass [kg]
  • $q_b$ is plasma species charge [C]
  • $n_b$ is plasma species density [m^-3]
  • $v_b$ is plasma species thermal velocity [m/s]
  • $\ln\Lambda_{ab}$ is Coulomb logarithm.

Definition at line 43 of file mccc_coefs.h.

◆ mccc_coefs_dQ

#define mccc_coefs_dQ ( ma,
qa,
mb,
qb,
nb,
vb,
clogab,
dmu0 )
Value:
( \
-mccc_coefs_cab(qa, qb, nb, clogab) * dmu0 / ( ma * mb * vb*vb*vb ) )

Evaluate derivative of non-relativistic drag coefficient [m/s^2].

$Q'=-c_{ab}(q_a,q_b,n_b,\ln\Lambda_{ab})\mu_0'(v_a/v_b) / (m_a m_b v_b^2)$

where

  • $m_a$ is test particle mass [kg]
  • $q_a$ is test particle charge [C]
  • $m_b$ is plasma species mass [kg]
  • $q_b$ is plasma species charge [C]
  • $n_b$ is plasma species density [m^-3]
  • $v_b$ is plasma species thermal velocity [m/s]
  • $\ln\Lambda_{ab}$ is Coulomb logarithm.

Definition at line 61 of file mccc_coefs.h.

◆ mccc_coefs_F

#define mccc_coefs_F ( ma,
qa,
mb,
qb,
nb,
vb,
clogab,
mu0 )
Value:
( \
-( 1/mb + 1/ma ) * mccc_coefs_cab(qa, qb, nb, clogab) * mu0 \
/ ( ma * vb*vb ) )

Evaluate non-relativistic friction coefficient [m/s^2].

$F = -c_{ab}(q_a,q_b,n_b,\ln\Lambda_{ab})\left(m_a^{-1} + m_b^{-1}\right)
\mu0(v_a/v_b) / (m_a v_b^2)$

where

  • $m_a$ is test particle mass [kg]
  • $q_a$ is test particle charge [C]
  • $m_b$ is plasma species mass [kg]
  • $q_b$ is plasma species charge [C]
  • $n_b$ is plasma species density [m^-3]
  • $v_b$ is plasma species thermal velocity [m/s]
  • $\ln\Lambda_{ab}$ is Coulomb logarithm.

Definition at line 80 of file mccc_coefs.h.

◆ mccc_coefs_Dpara

#define mccc_coefs_Dpara ( ma,
qa,
va,
qb,
nb,
vb,
clogab,
mu0 )
Value:
( \
( va > 0 ) ? \
mccc_coefs_cab(qa, qb, nb, clogab) * mu0 / ( 2 * ma*ma * va ) : \
mccc_coefs_cab(qa, qb, nb, clogab) * 4 \
/ ( 6 * CONST_SQRTPI * ma*ma * vb ) )
#define CONST_SQRTPI
sqrt(pi)
Definition consts.h:17

Evaluate non-relativistic parallel diffusion coefficient [m^2/s^3].

$D_\parallel=c_{ab}(q_a,q_b,n_b,\ln\Lambda_{ab})\mu_0(v_a/v_b)
/(2m_a^2v_a)$

or $D_\parallel = 4c_{ab}(q_a,q_b,n_b,\ln\Lambda_{ab})/(6\sqrt{\pi}m_a^2vb)
    \;\mathrm{when}\; v_a=0$

where

  • $m_a$ is test particle mass [kg]
  • $q_a$ is test particle charge [C]
  • $v_a$ is test particle velocity [m/s]
  • $q_b$ is plasma species charge [C]
  • $n_b$ is plasma species density [m^-3]
  • $v_b$ is plasma species thermal velocity [m/s]
  • $\ln\Lambda_{ab}$ is Coulomb logarithm.

Definition at line 103 of file mccc_coefs.h.

◆ mccc_coefs_dDpara

#define mccc_coefs_dDpara ( ma,
qa,
va,
qb,
nb,
vb,
clogab,
mu0,
dmu0 )
Value:
( \
mccc_coefs_cab(qa, qb, nb, clogab) * ( dmu0/vb - mu0/va ) \
/ ( 2 * ma*ma * va ) )

Evaluate derivative of non-relativistic parallel diffusion coefficient [m/s^2].

$D_\parallel'=c_{ab}(q_a,q_b,n_b,\ln\Lambda_{ab})(\mu_0'(v_a/v_b)/v_b
- \mu(v_a/v_b)/v_a)/(2m_a^2v_a)$

where

  • $m_a$ is test particle mass [kg]
  • $q_a$ is test particle charge [C]
  • $v_a$ is test particle velocity [m/s]
  • $q_b$ is plasma species charge [C]
  • $n_b$ is plasma species density [m^-3]
  • $v_b$ is plasma species thermal velocity [m/s]
  • $\ln\Lambda_{ab}$ is Coulomb logarithm.

Definition at line 126 of file mccc_coefs.h.

◆ mccc_coefs_Dperp

#define mccc_coefs_Dperp ( ma,
qa,
va,
qb,
nb,
vb,
clogab,
mu1 )
Value:
( \
( va > 0 ) ? \
mccc_coefs_cab(qa, qb, nb, clogab) * mu1 / ( 2 * ma*ma * va ) : \
mccc_coefs_cab(qa, qb, nb, clogab) * 4 \
/ ( 6 * CONST_SQRTPI * ma*ma * vb ) )

Evaluate non-relativistic perpendicular diffusion coefficient [m^2/s^3].

$D_\perp=c_{ab}(q_a,q_b,n_b,\ln\Lambda_{ab})\mu_1(v_a/v_b)
/(2m_a^2v_a)$

or $D_\perp = 4c_{ab}(q_a,q_b,n_b,\ln\Lambda_{ab})/(6\sqrt{\pi}m_a^2vb)
    \;\mathrm{when}\; v_a=0$

where

  • $m_a$ is test particle mass [kg]
  • $q_a$ is test particle charge [C]
  • $v_a$ is test particle velocity [m/s]
  • $q_b$ is plasma species charge [C]
  • $n_b$ is plasma species density [m^-3]
  • $v_b$ is plasma species thermal velocity [m/s]
  • $\ln\Lambda_{ab}$ is Coulomb logarithm.

Definition at line 150 of file mccc_coefs.h.

◆ mccc_coefs_K

#define mccc_coefs_K ( va,
Dpara,
dDpara,
Q )
Value:
( \
Q + dDpara + 2*Dpara / va )

Evaluate guiding center drag coefficient [m/s^2].

$K = Q + D_\parallel' + 2D_\parallel/va$

where

  • $v_a$ is test particle velocity [m/s]
  • $D_parallel$ is [1/s]
  • $Q$ is [m/s^2]

Definition at line 167 of file mccc_coefs.h.

◆ mccc_coefs_nu

#define mccc_coefs_nu ( va,
Dperp )
Value:
( \
2 * Dperp / ( va * va ) )

Evaluate pitch collision frequency [1/s].

$\nu = 2D_\perp/v_a^2$

where

  • $v_a$ is test particle velocity [m/s]
  • $D_perp$ is []

Definition at line 180 of file mccc_coefs.h.

◆ mccc_coefs_DX

#define mccc_coefs_DX ( xi,
Dpara,
Dperp,
gyrofreq )
Value:
( \
( 0.5 * ( Dpara - Dperp ) * ( 1 - xi*xi ) + Dperp ) \
/ (gyrofreq*gyrofreq) )

Evaluate spatial diffusion coefficient [m^2/s].

$D_X = (\frac{1}{2}(D_\parallel-D_\perp)(1-\xi^2) + D_\perp)/\omega_g^2$

where

  • $xi$ is test particle pitch
  • $D_\parallel$ is parallel diffusion coefficient [m^2/s^3]
  • $D_perp$ is perpendicular diffusion coefficient [m^2/s^3]
  • $\omega_g$ is gyrofrequency [1/s]

Definition at line 195 of file mccc_coefs.h.

Function Documentation

◆ mccc_coefs_mufun()

static void mccc_coefs_mufun ( real mufun[3],
real x,
mccc_data * mdata )
inlinestatic

Evaluate special functions needed by collision coefficients.

This function either evaluates the special functions directly or interpolates them from look-up table which should be initialized with mccc_init() before calling this function.

Special functions are

  • mufun[0] = $\mu_0(x) = (\mathrm{erf}(x) -2 x \pi^{-1/2} e^{-x^2})/x^2$
  • mufun[1] = $\mu_1(x) = \mathrm{erf}(x) - \frac{1}{2}\mu_0(x)$
  • mufun[2] = $\mu_0'(x)$
Parameters
mufunpointer to array where values are stored
xargument for the special functions
mdatapointer to mccc data

Definition at line 275 of file mccc_coefs.h.

◆ mccc_coefs_clog()

static DECLARE_TARGET_END void mccc_coefs_clog ( real * clogab,
real ma,
real qa,
real va,
int nspec,
const real * mb,
const real * qb,
const real * nb,
const real * Tb )
inlinestatic

Evaluate Coulomb logarithm.

Coulomb logarithm is evaluated separately with respect to each plasma species. It is calculated as a logarithm of the ratio of maximum and minimum impact parameters. Maximum impact parameter is the Debye length and minimum impact parameter is either classical particle radius or inverse of De Broglie wavelength.

Parameters
clogabarray where evaluated values for Coulomb logarithm are stored.
matest particle mass [kg]
qatest particle charge [C]
vatest particle velocity [m/s]
nspecnumber of plasma species
mbplasma species masses [kg]
qbplasma species charges [C]
nbplasma species densities [m^-3]
Tbplasma species temperatures [J]

Definition at line 228 of file mccc_coefs.h.