VERB_code_2.2  2
 All Classes Namespaces Files Functions Variables Typedefs Macros Pages
VERB_code_2.2 Documentation

The document Algorithms.pdf may be useful for understanding the structure of the code.

This document generated by Doxygen system. It has a description of API, used my main program code which run main() function. If you whant to understand how the VERB code works, please, read the owerview and after read the code and coments itself.

Overview.

The code is designed to solve the Fokker-Planck diffusion equation:

\[ \frac{\partial f}{\partial t} = \frac{1}{p^2} \frac{\partial}{\partial p} p^2 D_{pp} \frac{\partial f}{\partial p}\Big|_{\textrm{const }\alpha, L} + + \frac{1}{\cos(\alpha) \sin(alpha) T(\alpha)} \frac{\partial}{\partial \alpha} \cos(\alpha) \sin(\alpha) T(\alpha) D_{\alpha \alpha} \frac{\partial f}{\partial \alpha}\Big|_{\textrm{const } p, L} + + L^2 \frac{\partial}{\partial L} \frac{1}{L^2} D_{LL} \frac{\partial f}{\partial L}\Big|_{\textrm{const } J_1, J_2} + Q - S \]

, describs the evolution of phase space density (PSD) in time and phase space. It has three diffusion terms: Radial, Energy, and Pitch-angle. Radial diffusion needs different grid, than two other (local, Energy, and Pitch-angle) diffusions. Q - local sources. S - local losses. In the code we split the equation into three parts and solve them one after anouther with interpolation between radial and local grids:

  • Radial diffusion
  • Interpolation from radial grid to local grid.
  • Energy diffusion.
  • Pitch-angle diffusion.
  • Interpolation from local to radial grid.

We have two grids in the code and phase space density arrays on each of them. PSD values and grids are stored in the class PSD. The structure of the classes is following:

  • Matrix3D - basic class describe matrix type of variable to manipulate them. This class has to be considered to understand the logic of the code.
  • PSD - class, holds phase space density values and does diffusions.
  • Grid - grid, in which all that diffusions are (This class stored grid variables). Operate with variables of GridElement class.
    • GridElement. In the code you may find next variables:
      • L( radial ditance),
      • pc ( momentum * speed of light in units of MeV)
      • α (pitch angle in rad)
      • epc( energy in MeV )
    • three GridElements (since we have a 3D grid), and forth one, epc, is a function of pc and is just useful enough to keep it.
  • BoundaryCondition - upper, lower - upper and lower boundary conditions for diffusion on each GridElements

PSD as general class, contains methods to compute diffusion. It keeps PSD values in the parent class Matrix3D. Grid has 3-dimensions, so it has 3 GridElements, and one additional element epc which is just useful for the output. Each GridElements is a 3D-Array of values of coordinates. We have to do it this way, because grids are irregular. BoundaryCondition class is used for the boundary conditions for diffusion calculation.

PSD needs diffusion coefficients, grid, and boundary conditions as an input parameter for diffusion functions PSD::Diffusion_L(), PSD::Diffusion_pc(), PSD::Diffusion_alpha(), PSD::Diffusion_pc_alpha(). Diffusion coefficients for each diffusion are stored inside DiffusionCoefficientsGroup class. The class structure:

  • DiffusionCoefficientsGroup Daa, Dpcpc etc. - summary of diffusion coefficients for one direction. For example, when we have different waves and different Daa coefficients respectively we have to combine them indo one diffusion coefficient for the calculation.

DiffusionCoefficients, produced by each wave type, grouped by directions in the DiffusionCoefficientsGroup class. That class can turn the waves on and off and scale their effect, and store the summation as Daa or Dpp.

Initial conditions defines by PSD::Create_Initial_PSD.

Classes constructions.

The code has empty constructor and functions, like AllocateMemory() and Initialize() which define an object. We also have a constructor, which call these functions during execution, just for shortening of the code. And it is like that for almost each class.

Abbreviations

Todo:
  • make a special page for mail.cpp to describe algoritms and sections
  • specify page on link for parameters
  • why we need load boundary in two different sections? LoadBoundaryCondition | MakeBoundaryCondition
  • is MixTerms in a AM_Block method? - Yes
  • why psdRadialDiffusion - dosn't check for === 0?
  • why local->radial interpolation after write the Output? -(for debug)
  • how to define LAPACK in Doxygen?
  • * - what to exclude from Doxigen about VERB code??
  • how to exclude "Constant groups" from namespace defenition