#
# $Id: comconst.h 1795 2013-07-18 08:20:28Z emillour $
#
#----------------------------------------------------------------------
import numpy as np

# dtvr: dynamical time step (in s)
# daysec: length (in s) of a standard day
# pi: something like 3.14159....
# dtphys: (s) time step for the physics
# dtdiss: (s) time step for the dissipation
# rad: (m) radius of the planet
# r: Reduced Gas constant r=R/mu
#   with R=8.31.. J.K-1.mol-1, mu: mol mass of atmosphere (kg/mol)
# cpp: Specific heat Cp (J.kg-1.K-1)
# kappa: kappa=R/Cp 
# cotot
# unsim: 1./iim
# g: (m/s2) gravity
# omeg: (rad/s) rotation rate of the planet
# dissip_factz,dissip_deltaz,dissip_zref
## top_bound sponge:
# iflag_top_bound: sponge type
# mode_top_bound: sponge mode
# tau_top_bound: inverse of sponge characteristic time scale (Hz)
# daylen: length of solar day, in 'standard' day length
# year_day: Number of standard days in a year
# molmass: (g/mol) molar mass of the atmosphere
# ihf: (W/m2) Intrinsic heat flux (for giant planets)

planet_type = 'terre'
iflag_phys = 2
daysec = 86400.
preff = 1013250.
pa = 500.

#-----------------------------------------------------------------------
# From suphel

pi = 2.*np.arcsin(1.)
clum = 299792458.
hpla = 6.6260755e-34
kbol = 1.380658e-23
navo = 6.0221367e+23
#
#     ----------------------------------------------------------------
#
#*       2.    define astronomical constants.
#              ------------------------------
#
day = 86400.
ea = 149597870000.
epsm = 0.409093
#
siyea = 365.25*day*2.*pi/6.283076
siday = day/(1.+day/siyea)
omega = 2.*pi/siday
#
#
#     ------------------------------------------------------------------
#
#*       3.    define geoide.
#              --------------
#
g = 9.80665
a = 6371229.
r1sa = np.float(np.float64(1.)/np.float64(a))
#rad = 6371220 
rad = a*1.
omeg = 7.272205e-05

#
#     -----------------------------------------------------------------
#
#*       4.    define radiation constants.
#              ---------------------------
#
# z.x.li      rsigma=2. * rpi**5 * rkbol**4 /(15.* rclum**2 * rhpla**3)
sigma = 2.*pi**5 * (kbol/hpla)**3 * kbol/clum/clum/15.
#
#     -----------------------------------------------------------------
#
#*       5.    define thermodynamic constants, gas phase.
#              ------------------------------------------
#
r = navo*kbol
md = 28.9644
mo3 = 47.9942
mv = 18.0153
rd = 1000.*r/md
rv = 1000.*r/mv
cpd = 3.5*rd
cvd = cpd-rd
cpv = 4.*rv
cvv = cpv-rv
kappa = rd/cpd
etv = rv/rd-1.
cpp = cpd*1.
#
#     ----------------------------------------------------------------
#
#*       6.    define thermodynamic constants, liquid phase.
#              ---------------------------------------------
#
cw = cpv
#     ----------------------------------------------------------------
#
#*       7.    define thermodynamic constants, solid phase.
#              --------------------------------------------
#
cs = cpv
#
#     ----------------------------------------------------------------
#
#*       8.    define thermodynamic constants, transition of phase.
#              ----------------------------------------------------
#
tt = 273.16
lvtt = 2.5008e+6
lstt = 2.8345e+6
lmlt = lstt-lvtt
atm = 100000.
#
#     ----------------------------------------------------------------
#
#*       9.    saturated vapour pressure.
#              --------------------------
#
estt = 611.14
gamw = (cw-cpv)/rv
betw = lvtt/rv+gamw*tt
alpw = np.log(estt)+betw/tt+gamw*np.log(tt)
gams = (cs-cpv)/rv
bets = lstt/rv+gams*tt
alps = np.log(estt)+bets/tt+gams*np.log(tt)
gamd = gams-gamw
betd = bets-betw
alpd = alps-alpw
#
#     ------------------------------------------------------------------
#
# calculer les constantes pour les fonctions thermodynamiques
#
vtmp2 = cpv/cpd-1.
hoh2o = atm/100.
r2es = estt*rd/rv
r3les = 17.269
r3ies = 21.875
r4les = 35.86
r4ies = 7.66
r5les = r3les*(tt-r4les)
r5ies = r3ies*(tt-r4ies)

# For filtreg
#
type_sddu=1
type_sddv=2
type_unsddu=3
type_unsddv=4

# Zoom related
#
fxyhypb = False
nitergdiv = 1
nitergrot = 2
niterh = 2
coefdis = 0.
ysinus = True
