VERB4D
Functions
Diffusion_ADI2.cpp File Reference

Calculating the diffusion in 2D using multidimensional diffusion process - Xiao, F., Z. Su, H. Zheng, and S. Wang (2009) More...

#include "Diffusion_ADI2.h"
#include <iostream>
#include <ctime>
#include <time.h>

Functions

bool Diffusion_2D_ADI2 (Matrix2D< double > &psd, Matrix2D< double > x, Matrix2D< double > y, int x_size, int y_size, Matrix1D< double > x_LBC, Matrix1D< double > x_UBC, Matrix1D< double > y_LBC, Matrix1D< double > y_UBC, string x_LBC_type, string x_UBC_type, string y_LBC_type, string y_UBC_type, Matrix2D< double > Dxx, Matrix2D< double > Dyy, Matrix2D< double > Dxy, Matrix2D< double > Dyx, Matrix2D< double > G, Matrix2D< double > Sources, Matrix2D< double > Losses, double dt)
 

Detailed Description

Calculating the diffusion in 2D using multidimensional diffusion process - Xiao, F., Z. Su, H. Zheng, and S. Wang (2009)

Created on: May 28, 2011 Author: dimath

Function Documentation

bool Diffusion_2D_ADI2 ( Matrix2D< double > &  psd,
Matrix2D< double >  x,
Matrix2D< double >  y,
int  x_size,
int  y_size,
Matrix1D< double >  x_LBC,
Matrix1D< double >  x_UBC,
Matrix1D< double >  y_LBC,
Matrix1D< double >  y_UBC,
string  x_LBC_type,
string  x_UBC_type,
string  y_LBC_type,
string  y_UBC_type,
Matrix2D< double >  Dxx,
Matrix2D< double >  Dyy,
Matrix2D< double >  Dxy,
Matrix2D< double >  Dyx,
Matrix2D< double >  G,
Matrix2D< double >  Sources,
Matrix2D< double >  Losses,
double  dt 
)

Create model matrices and solve the system, The method is from Xiao, F., Z. Su, H. Zheng, and S. Wang (2009), Modeling of outer radiation belt electrons by multidimensional diffusion process, J. Geophys. Res., 114, A03201, doi:10.1029/2008JA013580.

http://onlinelibrary.wiley.com/store/10.1029/2008JA013580/asset/jgra19599.pdf?v=1&t=ic3m61g2&s=334d50627dee2d592de0ae583e755afce42948a9

Todo:
Fix this function - currently results in negative PSD values - using Lapack instead

Method:

For the x direction and then for the y direction

  1. Add boundary conditions AddBoundary()
  2. Add sources and losses
  3. get the seond derivative approximation with diffusion coeficient SecondDerivativeApproximation_2D()
  4. Implicit part (first derivatives) $ \frac{-1}{G} \frac {\partial{(G D_{xy})}}{\partial x} \frac {\partial f}{\partial y} $
  5. solve matrix with tridag()
Parameters
psd- phase space density
x- one dimensional slice
y- one dimensional slice
x_size- size of x slice
y_size- size of y slice
x_LBC- lower boundary condition for param x
x_UBC- upper boundary condition for param x
y_LBC- lower boundary condition for param y
y_UBC- upper boundary condition for param y
x_LBC_type- type of lower boundary condition for param x
x_UBC_type- type of upper boundary condition for param x
y_LBC_type- type of lower boundary condition for param y
y_UBC_type- type of upper boundary condition for param y
Dxx- 2D Diffusion matrix
Dyy- 2D Diffusion matrix
Dxy- 2D Diffusion matrix
Dyx- 2D Diffusion matrix
G- 2D used for Jacobian to normalize matrix
Sources- matrix used for Sources
Losses- Matrix used for Losses (loss cone)
dt- change in time of single time step