Skip to content

Commit

Permalink
rm safety checks
Browse files Browse the repository at this point in the history
  • Loading branch information
mlee03 authored and mlee03 committed Jan 2, 2024
1 parent a8a7df4 commit 6624a92
Show file tree
Hide file tree
Showing 5 changed files with 132 additions and 24 deletions.
106 changes: 106 additions & 0 deletions tests/main/grid/input/test_config_91.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
#modified version of baroclinic_c12_dp.yaml
stencil_config:
compilation_config:
backend: numpy
rebuild: false
validate_args: true
format_source: false
device_sync: false
grid_config:
type: generated
config:
grid_type: 4
dx_const: 3000.0
dy_const: 3000.0
deglat: 10.0
eta_file: 'tests/main/input/eta91.nc'
initialization:
type: analytic
config:
case: baroclinic
performance_config:
collect_performance: true
experiment_name: c12_baroclinic
nx_tile: 12
nz: 91
dt_atmos: 225
minutes: 15
layout:
- 1
- 1
diagnostics_config:
path: output
output_format: netcdf
names:
- u
- v
- ua
- va
- pt
- delp
- qvapor
- qliquid
- qice
- qrain
- qsnow
- qgraupel
z_select:
- level: 65
names:
- pt
dycore_config:
a_imp: 1.0
beta: 0.
consv_te: 0.
d2_bg: 0.
d2_bg_k1: 0.2
d2_bg_k2: 0.1
d4_bg: 0.15
d_con: 1.0
d_ext: 0.0
dddmp: 0.5
delt_max: 0.002
do_sat_adj: true
do_vort_damp: true
fill: true
hord_dp: 6
hord_mt: 6
hord_tm: 6
hord_tr: 8
hord_vt: 6
hydrostatic: false
k_split: 1
ke_bg: 0.
kord_mt: 9
kord_tm: -9
kord_tr: 9
kord_wz: 9
n_split: 1
nord: 3
nwat: 6
p_fac: 0.05
rf_cutoff: 3000.
rf_fast: true
tau: 10.
vtdm4: 0.06
z_tracer: true
do_qa: true
tau_i2s: 1000.
tau_g2v: 1200.
ql_gen: 0.001
ql_mlt: 0.002
qs_mlt: 0.000001
qi_lim: 1.0
dw_ocean: 0.1
dw_land: 0.15
icloud_f: 0
tau_l2v: 300.
tau_v2l: 90.
fv_sg_adj: 0
n_sponge: 48
u_max: 355.0

physics_config:
hydrostatic: false
nwat: 6
do_qa: true
50 changes: 26 additions & 24 deletions tests/main/grid/test_eta.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,31 +43,33 @@ def test_set_hybrid_pressure_coefficients_79_correct():
if not np.array_equal(bk_answers, bk_results):
raise ValueError("Unexpected value of bk")

driver.safety_checker.clear_all_checks()

# def test_set_hybrid_pressure_coefficients_91_correct():
#
# config_file = "tests/main/grid/input/test_config_91.yaml"
# with open(config_file, "r") as f:
# yaml_config = yaml.safe_load(f)
#
# driver_config = pace.driver.DriverConfig.from_dict(yaml_config)
# driver_config.comm_config = pace.driver.NullCommConfig(rank=0, total_ranks=6)
# driver = pace.driver.Driver(config=driver_config)
#
# p_results = driver.state.grid_data.p.data
# ak_results = driver.state.grid_data.ak.data
# bk_results = driver.state.grid_data.bk.data
# ak_answers, bk_answers = set_answers(config_file)
#
# if ak_answers.size != ak_results.size:
# raise ValueError("Unexpected size of bk")
# if bk_answers.size != bk_results.size:
# raise ValueError("Unexpected size of ak")
#
# if not np.array_equal(ak_answers, ak_results):
# raise ValueError("Unexpected value of ak")
# if not np.array_equal(bk_answers, bk_results):
# raise ValueError("Unexpected value of bk")

def test_set_hybrid_pressure_coefficients_91_correct():

config_file = "tests/main/grid/input/test_config_91.yaml"
with open(config_file, "r") as f:
yaml_config = yaml.safe_load(f)

driver_config = pace.driver.DriverConfig.from_dict(yaml_config)
driver_config.comm_config = pace.driver.NullCommConfig(rank=0, total_ranks=6)
driver = pace.driver.Driver(config=driver_config)

p_results = driver.state.grid_data.p.data
ak_results = driver.state.grid_data.ak.data
bk_results = driver.state.grid_data.bk.data
ak_answers, bk_answers = set_answers(config_file)

if ak_answers.size != ak_results.size:
raise ValueError("Unexpected size of bk")
if bk_answers.size != bk_results.size:
raise ValueError("Unexpected size of ak")

if not np.array_equal(ak_answers, ak_results):
raise ValueError("Unexpected value of ak")
if not np.array_equal(bk_answers, bk_results):
raise ValueError("Unexpected value of bk")


@pytest.mark.xfail
Expand Down
Binary file modified tests/main/input/eta79.nc
Binary file not shown.
Binary file modified tests/main/input/eta79_not_mono.nc
Binary file not shown.
Binary file modified tests/main/input/eta91.nc
Binary file not shown.

0 comments on commit 6624a92

Please sign in to comment.