VERB4D
Macros | Functions
VERB4D_Solver.cpp File Reference

Holds main function that solves all of the matrices using the help of the other classes/functions. More...

#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <ctime>
#include <time.h>
#include <math.h>
#include "Logger.h"
#include "Matrix.h"
#include "Diffusion_1D.h"
#include "Diffusion_2D.h"
#include "Diffusion_ADI1.h"
#include "Diffusion_ADI2.h"
#include "Diffusion_ADI3.h"
#include "Convection_2D.h"
#include "ReadInitialData.h"
#include "UpdatableMatrix.h"
#include "Interpolation.h"
#include <omp.h>

Macros

#define min_PSD   1e-10
 
#define min_V   1e-10
 
#define min_Dxx   1e-10
 

Functions

int main (int argc, char *argv[])
 

Detailed Description

Holds main function that solves all of the matrices using the help of the other classes/functions.

Diffusion + convection code, VERB4D.

The code solves the Fokker-Planck equation with convection terms:

\[ \frac{\partial f}{\partial t} = v_{\Phi} \frac{\partial f}{\partial \Pi} + v_{R} \frac{\partial f}{\partial R} + \frac{1}{G} \frac{\partial}{\partial L} G D_{LL} \frac{\partial f}{\partial L} + \frac{1}{G} \frac{\partial}{\partial V} G (D_{VV} \frac{\partial f}{\partial V} + D_{VK} \frac{\partial f}{\partial K}) + \frac{1}{G} \frac{\partial}{\partial K} G (D_{KV} \frac{\partial f}{\partial V} + D_{KK} \frac{\partial f}{\partial K}) + Losses * f + Sources \]

where f is a Phase Space Density (PSD); Φ is MLT angle, R is radial distance from Earth center, $ V≡μ∙(K+0.5)^2 $ is a combination of adiabatic invariants μ and $ K≡ {J}{\sqrt{8μ}} $; L is the third adiabatic invariant; D are bounce-averaged diffusion coefficients; $ v_Φ $, $ v_R $ are drift velocities; G is the Jacobian of the transformation from (μ,J,L) to (V,K,L)

The solver first reads in data using ReadInitialData() then procedes to calculate convection and diffusion based on the data it received. Convection_2D() is calculated followed by Diffusion_1D() and Diffusion_2D(). Lastly, the solver calculates Diffusion in 2 dimensions using one of the 3 defined diffusion_ADI functions. The current solver is set-up to use Diffusion_2D_ADI3() currently.