bapsf_eigsolver.BOUTppmath

Define finite differencing schemes (same as in BOUT) and useful vector/differential operations for 4D arrays ———————————————————–

def grad_cyl_4D(fval, du): def Div_perp_cyl_4D(vval, du): def advec_cyl_4D(vval, fval, du): def crossProd_4D(v1,v2): def dotProd_4D(v1,v2): def ddt_4D(fval, du): def ddx_4D(fval, du): def ddy_4D(fval, du):

bapsf_eigsolver.BOUTppmath.AGradB(av, bv, x, metric='cart')

Return the vector (A.Grad)B in Cartesian (metric=’cart’) or Cylindrical (metric=’cyl’) coordinates, as a Sympy matrix of functions Input: x – list of coordinates [x,y,z]/[r,theta,z]

bapsf_eigsolver.BOUTppmath.CrossProd(av, bv)

Return the cross product of two vectors

bapsf_eigsolver.BOUTppmath.D2DX2_C4(fc, fm, fp, fmm, fpp)
bapsf_eigsolver.BOUTppmath.D2L1DR1(fc, fm, fp, fmm, fpp)
bapsf_eigsolver.BOUTppmath.DDX_C2(fc, fm, fp, fmm, fpp)
bapsf_eigsolver.BOUTppmath.DDX_C4(fc, fm, fp, fmm, fpp)
bapsf_eigsolver.BOUTppmath.DDX_L1(fc, fm, fp, fmm, fpp)
bapsf_eigsolver.BOUTppmath.DDX_R1(fc, fm, fp, fmm, fpp)
bapsf_eigsolver.BOUTppmath.Delp2(f, x, metric='cart')

Return the Laplacian of f in Cartesian (metric=’cart’) or Cylindrical (metric=’cyl’) coordinates Input: x – list of coordinates [x,y,z]/[r,theta,z]

bapsf_eigsolver.BOUTppmath.Delp2Perp(f, x, metric='cart')

Return the perpendicular (to z) part of Laplacian of f in Cartesian (metric=’cart’) or Cylindrical (metric=’cyl’) coordinates Input: x – list of coordinates [x,y,z]/[r,theta,z]

bapsf_eigsolver.BOUTppmath.Delp2perp_4D(fval, du, order='D2DX2_C4')
bapsf_eigsolver.BOUTppmath.Div(v, x, metric='cart')

Return the divergence of v in Cartesian (metric=’cart’) or Cylindrical (metric=’cyl’) coordinates Input: x – list of coordinates [x,y,z]/[r,theta,z]

bapsf_eigsolver.BOUTppmath.DivPerp(v, x, metric='cart')

Return the perpendicular (to z) part of divergence of v in Cartesian (metric=’cart’) or Cylindrical (metric=’cyl’) coordinates Input: x – list of coordinates [x,y,z]/[r,theta,z]

bapsf_eigsolver.BOUTppmath.Div_perp_cyl_4D(vval, du)
bapsf_eigsolver.BOUTppmath.DotProd(av, bv)

Return the cross product of two vectors

bapsf_eigsolver.BOUTppmath.Grad(f, x, metric='cart')

Return the gradient of f in Cartesian (metric=’cart’) or Cylindrical (metric=’cyl’) coordinates, as a Sympy matrix of functions Input: x – list of coordinates [x,y,z]/[r,theta,z]

bapsf_eigsolver.BOUTppmath.GradPerp(f, x, metric='cart')

Return the perpendicular (to z) part of the gradient of f in Cartesian (metric=’cart’) or Cylindrical (metric=’cyl’) coordinates, as a Sympy matrix of functions Input: x – list of coordinates [x,y,z]/[r,theta,z]

bapsf_eigsolver.BOUTppmath.TriDiagDet(a, b, c)

Calculate the determinant of a tridiagonal complex matrix using the relation

det M_n = a_n * det M_(n-1) - b_(n-1)*c_(n-1) * det M_(n-2)

# a_1 b_1 … # c_1 … … # det( … … … ) = # … … b_(n-1) # … c_(n-1) a_n # # # a_n -b_(n-1) c_(n-1) a_2 -b_1 c_1 a1 0 # ( ) * … * ( ) * ( ) # 1 0 1 0 1 0

Input:

a,b,c – diagonals of the matrix. Respective sizes: N, N-1, N-1 elements

# M – tridiagonal matrix (2D), full storage (not sparse)

bapsf_eigsolver.BOUTppmath.VDDX_C2(vc, fc, fm, fp, fmm, fpp)
bapsf_eigsolver.BOUTppmath.VDDX_C4(vc, fc, fm, fp, fmm, fpp)
bapsf_eigsolver.BOUTppmath.VDDX_U1(vc, fc, fm, fp, fmm, fpp)
bapsf_eigsolver.BOUTppmath.VDDX_U4(vc, fc, fm, fp, fmm, fpp)
bapsf_eigsolver.BOUTppmath.Vector(v)

Return sympy matrix of 3x1 elements with values v[0], v[1], v[2]

bapsf_eigsolver.BOUTppmath.addzguard(fval, du)
bapsf_eigsolver.BOUTppmath.advec_cyl_4D(vval, fval, du, order='VDDX_U1')
bapsf_eigsolver.BOUTppmath.crossProd_4D(v1, v2)
bapsf_eigsolver.BOUTppmath.d2dx2_4D(fval, du, order='D2DX2_C4')
bapsf_eigsolver.BOUTppmath.ddt_4D(fval, du)
bapsf_eigsolver.BOUTppmath.ddx_4D(fval, du, order='DDX_C4')
bapsf_eigsolver.BOUTppmath.ddy_4D_L1(fval, du)
bapsf_eigsolver.BOUTppmath.ddy_4D_R1(fval, du)
bapsf_eigsolver.BOUTppmath.ddz_4D(fval, du)
bapsf_eigsolver.BOUTppmath.deriv_full(fval, h)
bapsf_eigsolver.BOUTppmath.dotProd2(v1, v2)
bapsf_eigsolver.BOUTppmath.dotProd_4D(v1, v2)
bapsf_eigsolver.BOUTppmath.grad_cyl_4D(fval, du)
bapsf_eigsolver.BOUTppmath.grad_perp_cyl_4D(fval, du)
bapsf_eigsolver.BOUTppmath.int0_N(x, w)

Gaussian N(x,w)

bapsf_eigsolver.BOUTppmath.int1_N(x, w)

Int N(x,w) dx

bapsf_eigsolver.BOUTppmath.int2_N(x, w)

Int Int N(x,w) dx

bapsf_eigsolver.BOUTppmath.int3_N(x, w)

Int Int Int N(x,w) dx

bapsf_eigsolver.BOUTppmath.radial_Average(fval, du, order='trapezoid')