# Exact solution used in MES runs

We would like to MES the implementation of the sheath boundary condition in $j_{\|}$. In normalized quantites, we have that

$$\left. j_{\|} \right|_{\mathrm{Boundary}} = \left. [n ( u_{i,\|} - \exp(\Lambda - [\phi_0 + \phi]))]\right|_{\mathrm{Boundary}}$$


In [1]:

%matplotlib notebook

from sympy import init_printing
from sympy import S
from sympy import sin, cos, tanh, exp, pi, sqrt, log

from boutdata.mms import x, y, z, t
from boutdata.mms import DDX

import os, sys
# If we add to sys.path, then it must be an absolute path
common_dir = os.path.abspath('./../../../../common')
# Sys path is a list of system paths
sys.path.append(common_dir)
from CELMAPy.MES import make_plot, BOUT_print

init_printing()



## Initialize



In [2]:

folder = '../gaussianWSinAndParabola/'



## Define the variables



In [3]:

# Initialization
the_vars = {}




In [4]:

# We need Lx
from boututils.options import BOUTOptions
myOpts = BOUTOptions(folder)
Lx = eval(myOpts.geom['Lx'])
Ly = eval(myOpts.geom['Ly'])
mu = eval(myOpts.cst['mu']) # Needed for Lambda
Lambda = eval(myOpts.cst['Lambda'])
phiRef = eval(myOpts.cst['phiRef'])




In [5]:

# The potential

# The skew sinus
# In cartesian coordinates we would like a sinus with with a wave-vector in the direction
# 45 degrees with respect to the first quadrant. This can be achieved with a wave vector
# k = [1/sqrt(2), 1/sqrt(2)]
# sin((1/sqrt(2))*(x + y))
# We would like 2 nodes, so we may write
# sin((1/sqrt(2))*(x + y)*(2*pi/(2*Lx)))
the_vars['phi'] = sin((1/sqrt(2))*(x + y)*(2*pi/(2*Lx)))

# The density
the_vars['n'] = 1

# The current
the_vars['uIPar'] = 0

# The parallel electron velocity, given by the sheath boundary condition
the_vars['uEPar'] = exp(Lambda-(phiRef+the_vars['phi']))

# The parallel velocity, given by the sheath boundary condition
the_vars['jPar'] = the_vars['n']*(the_vars['uIPar']-the_vars['uEPar'])



## Plot



In [6]:

#make_plot(folder=folder, the_vars=the_vars, plot2d=True, include_aux=False, direction='y')




In [7]:

BOUT_print(the_vars, rational=False)