Skip to content

Commit

Permalink
Merge branch 'feature/no_eta' of github.com:fmalatino/NDSL into featu…
Browse files Browse the repository at this point in the history
…re/no_eta
  • Loading branch information
fmalatino committed Aug 27, 2024
2 parents ba28f33 + 104076f commit 20ed73d
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 1 deletion.
5 changes: 4 additions & 1 deletion ndsl/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ class ConstantVersions(Enum):
CV_VAP = 3.0 * RVGAS # Heat capacity of water vapor at constant volume
ZVIR = RVGAS / RDGAS - 1 # con_fvirt in Fortran physics
C_ICE = 1972.0 # Heat capacity of ice at -15 degrees Celsius
C_ICE_0 = 2106.0 # Heat capacity of ice at 0 degrees Celsius
C_LIQ = 4.1855e3 # Heat capacity of water at 15 degrees Celsius
CP_VAP = 4.0 * RVGAS # Heat capacity of water vapor at constant pressure
TICE = 273.16 # Freezing temperature
Expand All @@ -136,6 +137,7 @@ class ConstantVersions(Enum):
D2ICE = DC_VAP + DC_ICE # Isobaric heating / cooling
LI0 = HLF - DC_ICE * TICE
EPS = RDGAS / RVGAS
EPSM1 = EPS - 1.0
LV0 = (
HLV - DC_VAP * TICE
) # 3.13905782e6, evaporation latent heat coefficient at 0 degrees Kelvin
Expand All @@ -145,7 +147,8 @@ class ConstantVersions(Enum):
LI2 = (
LV0 + LI00
) # 2.86799816e6, sublimation latent heat coefficient at 0 degrees Kelvin
E00 = 611.21 # Saturation vapor pressure at 0 degrees Celsius
E00 = 611.21 # Saturation vapor pressure at 0 degrees Celsius (Pa)
PSAT = 610.78 # Saturation vapor pressure at H2O 3pt (Pa)
T_WFR = TICE - 40.0 # homogeneous freezing temperature
TICE0 = TICE - 0.01
T_MIN = 178.0 # Minimum temperature to freeze-dry all water vapor
Expand Down
9 changes: 9 additions & 0 deletions ndsl/dsl/typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,19 @@ def global_set_floating_point_precision():
IntFieldIJ = Field[gtscript.IJ, Int]
IntFieldK = Field[gtscript.K, Int]
BoolField = Field[gtscript.IJK, Bool]
BoolFieldIJ = Field[gtscript.IJ, Bool]

Index3D = Tuple[int, int, int]


def set_4d_field_size(n, dtype):
"""
Defines a 4D field with a given size and type
The extra data dimension is not parallel
"""
return Field[gtscript.IJK, (dtype, (n,))]


def cast_to_index3d(val: Tuple[int, ...]) -> Index3D:
if len(val) != 3:
raise ValueError(f"expected 3d index, received {val}")
Expand Down
32 changes: 32 additions & 0 deletions ndsl/namelist.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,22 @@ class NamelistDefaults:
tice = 273.16 # set tice = 165. to turn off ice - phase phys (kessler emulator)
alin = 842.0 # "a" in lin1983
clin = 4.8 # "c" in lin 1983, 4.8 -- > 6. (to ehance ql -- > qs)
isatmedmf = 0 # which version of satmedmfvdif to use
dspheat = False # flag for tke dissipative heating
xkzm_h = 1.0 # background vertical diffusion for heat q over ocean
xkzm_m = 1.0 # background vertical diffusion for momentum over ocean
xkzm_hl = 1.0 # background vertical diffusion for heat q over land
xkzm_ml = 1.0 # background vertical diffusion for momentum over land
xkzm_hi = 1.0 # background vertical diffusion for heat q over ice
xkzm_mi = 1.0 # background vertical diffusion for momentum over ice
xkzm_s = 1.0 # sigma threshold for background mom. diffusion
xkzm_lim = 0.01 # background vertical diffusion limit
xkzminv = 0.15 # diffusivity in inversion layers
xkgdx = 25.0e3 # background vertical diffusion threshold
rlmn = 30.0 # lower-limter on asymtotic mixing length in satmedmfdiff
rlmx = 300.0 # upper-limter on asymtotic mixing length in satmedmfdiff
do_dk_hb19 = False # flag for using hb19 background diff formula in satmedmfdiff
cap_k0_land = False # flag for applying limter on background diff in inversion layer over land in satmedmfdiff

@classmethod
def as_dict(cls):
Expand Down Expand Up @@ -293,6 +309,22 @@ class Namelist:
tice: float = NamelistDefaults.tice
alin: float = NamelistDefaults.alin
clin: float = NamelistDefaults.clin
isatmedmf: int = NamelistDefaults.isatmedmf
dspheat: bool = NamelistDefaults.dspheat
xkzm_h: float = NamelistDefaults.xkzm_h
xkzm_m: float = NamelistDefaults.xkzm_m
xkzm_hl: float = NamelistDefaults.xkzm_hl
xkzm_ml: float = NamelistDefaults.xkzm_ml
xkzm_hi: float = NamelistDefaults.xkzm_hi
xkzm_mi: float = NamelistDefaults.xkzm_mi
xkzm_s: float = NamelistDefaults.xkzm_s
xkzm_lim: float = NamelistDefaults.xkzm_lim
xkzminv: float = NamelistDefaults.xkzminv
xkgdx: float = NamelistDefaults.xkgdx
rlmn: float = NamelistDefaults.rlmn
rlmx: float = NamelistDefaults.rlmx
do_dk_hb19: bool = NamelistDefaults.do_dk_hb19
cap_k0_land: bool = NamelistDefaults.cap_k0_land
# c0s_shal: Any
# c1_shal: Any
# cal_pre: Any
Expand Down

0 comments on commit 20ed73d

Please sign in to comment.