import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
def NEMO_tanh(ks, a, kth, acr):
"""A generic tanh used in NEMO"""
return a* np.tanh((ks-kth)/acr)
def NEMO_tanh_integral(ks, a, kth, acr):
"""A generic integrated tanh used in NEMO grid"""
return a*acr*np.log(np.cosh((ks-kth)/acr))
ks = np.arange(27)
ppa0 = 155.3
ppa1 = 146.
pkth = 0.
ppacr = 10.
depths = ppa0*ks + NEMO_tanh_integral(ks, ppa1, ppkth, ppacr)
ppsur = depths[0]
depths = depths - ppsur
print (depths[-1])
plt.plot(ks, depths, 'o')
3117.79416836
[<matplotlib.lines.Line2D at 0x7f6449cfa978>]