Gyselalib++
 
Loading...
Searching...
No Matches
CollisionsIntra Class Reference

Class describing the intra-species collision operator. More...

Inheritance diagram for CollisionsIntra:
IRightHandSide

Classes

struct  GhostedVx
 A conditional type representing either a uniform or a non-uniform ghosted vx mesh. More...
 
struct  GhostedVxStaggered
 A conditional type representing either a uniform or a non-uniform ghosted staggered vx mesh. More...
 

Public Types

using IdxRangeSpXVx_ghosted = IdxRange< Species, GridX, GhostedVx >
 A type representing a mesh for species, space and ghosted vx mesh.
 
using IdxRangeSpXVx_ghosted_staggered = IdxRange< Species, GridX, GhostedVxStaggered >
 A type representing a mesh for species, space and ghosted staggered vx mesh.
 
using IdxVx_ghosted = Idx< GhostedVx >
 A type representing a ghosted vx index.
 
using IdxVx_ghosted_staggered = Idx< GhostedVxStaggered >
 A type representing a ghosted staggered vx index.
 
using IdxSpXVx_ghosted = Idx< Species, GridX, GhostedVx >
 A type representing a species, space and ghosted vx index.
 
using IdxSpXVx_ghosted_staggered = Idx< Species, GridX, GhostedVxStaggered >
 A type representing a species, space and ghosted staggered vx index.
 

Public Member Functions

 CollisionsIntra (IdxRangeSpXVx const &mesh, double nustar0)
 The constructor for the operator.
 
DFieldSpXVx operator() (DFieldSpXVx allfdistribu, double dt) const override
 Update the distribution function for intra-species collision.
 
double get_nustar0 () const
 Get the collision coefficient.
 
IdxRange< GhostedVx > const & get_gridvx_ghosted () const
 Get the ghosted vx mesh used for computing finite differences centered derivatives.
 
IdxRange< GhostedVxStaggered > const & get_gridvx_ghosted_staggered () const
 Get the ghosted and staggered vx mesh used for computing finite differences centered derivatives.
 
IdxRange< Species, GridX, GhostedVx > const & get_mesh_ghosted () const
 Get a mesh containing the species, spatial and the ghosted vx mesh.
 
void compute_rhs_vector (DFieldSpXVx RR, DConstFieldSpXVx AA, DConstFieldSpXVx BB, DConstFieldSpXVx CC, DConstFieldSpXVx allfdistribu, double fthresh) const
 Compute the right-hand-side of the collision operator linear system.
 
void compute_matrix_coeff (DFieldSpXVx AA, DFieldSpXVx BB, DFieldSpXVx CC, Field< double, IdxRangeSpXVx_ghosted > Dcoll, Field< double, IdxRangeSpXVx_ghosted_staggered > Dcoll_staggered, Field< double, IdxRangeSpXVx_ghosted > Nucoll, double deltat) const
 Compute the coefficients of the tridiagonal matrix of the collision operator linear system.
 
void fill_matrix_with_coeff (Matrix_Banded &matrix, host_t< DConstFieldVx > AA, host_t< DConstFieldVx > BB, host_t< DConstFieldVx > CC) const
 Fill the tridiagonal matrix of the collision operator linear system with the required coefficients.
 

Detailed Description

Class describing the intra-species collision operator.

The intra-species collision operator can be written as \( C_{aa} = d/dv (Dcoll df_a/dv - Nucoll f_a) \) Where Dcoll and Nucoll are the collision operator diffusion and advection coefficients that depend on the absolute value of the velocity and possibly on space. f_a is the distribution function. The Nucoll and Dcoll coefficients are adjusted at each time and spatial position so that the collision operator conserves the density, momentum and energy of the considered species it acts on.

The evolution equation for the collisions \( df_a/dt = C_{aa} \) is solved using a Crank-Nicolson finite difference scheme adapted for non-uniform meshes. The derivatives are computed using centered second-order finite differences. To use the same derivatives formula at the edges of the vx mesh, we introduce a ghosted vx mesh with additional points at the edges. To further improve the accuracy of the computations of the derivatives, we also introduce another vx mesh that is staggered with respect to the initial mesh. The points of the staggered mesh lie at the middle of the cells of the initial vx mesh (where a cell is defined by two adjacent points). The Crank-Nicolson scheme leads to the formulation of a linear system that needs to be resolved at each spatial position of the simulation box. Note that this linear system depends on the considered spatial position.

The complete description of the operator can be found in rhs docs.

Constructor & Destructor Documentation

◆ CollisionsIntra()

CollisionsIntra::CollisionsIntra ( IdxRangeSpXVx const &  mesh,
double  nustar0 
)

The constructor for the operator.

Parameters
[in]meshThe index range on which the operator will act.
[in]nustar0The normalized collisionality.

Member Function Documentation

◆ operator()()

DFieldSpXVx CollisionsIntra::operator() ( DFieldSpXVx  allfdistribu,
double  dt 
) const
overridevirtual

Update the distribution function for intra-species collision.

Update the distribution function for both electrons and ions to show how it is modified following collisions within various species. This operator only handles collisions between particles of the same species.

Parameters
[in,out]allfdistribuThe distribution function.
[in]dtThe time step over which the collisions occur.
Returns
A field referencing the distribution function passed as argument.

Implements IRightHandSide.

◆ get_nustar0()

double CollisionsIntra::get_nustar0 ( ) const

Get the collision coefficient.

Returns
The collisionality coefficient.

◆ get_gridvx_ghosted()

IdxRange< GhostedVx > const & CollisionsIntra::get_gridvx_ghosted ( ) const

Get the ghosted vx mesh used for computing finite differences centered derivatives.

Returns
The ghosted vx mesh.

◆ get_gridvx_ghosted_staggered()

IdxRange< GhostedVxStaggered > const & CollisionsIntra::get_gridvx_ghosted_staggered ( ) const

Get the ghosted and staggered vx mesh used for computing finite differences centered derivatives.

Returns
The ghosted and staggered vx mesh.

◆ get_mesh_ghosted()

IdxRange< Species, GridX, GhostedVx > const & CollisionsIntra::get_mesh_ghosted ( ) const

Get a mesh containing the species, spatial and the ghosted vx mesh.

Returns
The species, spatial, and ghosted vx mesh.

◆ compute_rhs_vector()

void CollisionsIntra::compute_rhs_vector ( DFieldSpXVx  RR,
DConstFieldSpXVx  AA,
DConstFieldSpXVx  BB,
DConstFieldSpXVx  CC,
DConstFieldSpXVx  allfdistribu,
double  fthresh 
) const

Compute the right-hand-side of the collision operator linear system.

Parameters
[in,out]RRA vector representing the right-hand-side of the system.
[in]AAA vector representing the lower diagonal of the matrix of the linear system.
[in]BBA vector representing the diagonal of the matrix of the linear system.
[in]CCA vector representing the upper diagonal of the matrix of the linear system.
[in]allfdistribuThe distribution function.
[in]fthreshA constant value used for imposing Dirichlet boundary condition to solve the linear system.

◆ compute_matrix_coeff()

void CollisionsIntra::compute_matrix_coeff ( DFieldSpXVx  AA,
DFieldSpXVx  BB,
DFieldSpXVx  CC,
Field< double, IdxRangeSpXVx_ghosted Dcoll,
Field< double, IdxRangeSpXVx_ghosted_staggered Dcoll_staggered,
Field< double, IdxRangeSpXVx_ghosted Nucoll,
double  deltat 
) const

Compute the coefficients of the tridiagonal matrix of the collision operator linear system.

Parameters
[in,out]AAA vector representing the lower diagonal of the matrix of the linear system.
[in,out]BBA vector representing the diagonal of the matrix of the linear system.
[in,out]CCA vector representing the upper diagonal of the matrix of the linear system.
[in]DcollThe velocity-dependent diffusion coefficient of the collision operaror.
[in]Dcoll_staggeredThe velocity-dependent diffusion coefficient of the collision operaror computed on the staggered vx mesh.
[in]NucollThe velocity-dependent advection coefficient of the collision operaror.
[in]deltatThe time step.

◆ fill_matrix_with_coeff()

void CollisionsIntra::fill_matrix_with_coeff ( Matrix_Banded matrix,
host_t< DConstFieldVx >  AA,
host_t< DConstFieldVx >  BB,
host_t< DConstFieldVx >  CC 
) const

Fill the tridiagonal matrix of the collision operator linear system with the required coefficients.

Parameters
[in,out]matrixA banded (tridiagonal) matrix.
[in]AAA vector containing the lower diagonal coefficients of the matrix.
[in]BBA vector containing the diagonal coefficients of the matrix.
[in]CCA vector containing the upper diagonal coefficients of the matrix.

The documentation for this class was generated from the following file: