diff --git a/.gitmodules b/.gitmodules index 1ee425d..710f790 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,7 +1,7 @@ [submodule "WW3"] path = WW3 url = https://github.com/ESCOMP/WW3.git -fxtag = dev/unified_0.0.14 +fxtag = dev/unified_0.1.0 fxrequired = AlwaysRequired fxDONOTUSEurl = https://github.com/ESCOMP/WW3.git diff --git a/WW3 b/WW3 index 32b667d..cc6f1a3 160000 --- a/WW3 +++ b/WW3 @@ -1 +1 @@ -Subproject commit 32b667de558e7c928f1e6a7baf71e5b5436d178b +Subproject commit cc6f1a35661d0285eb8c6f7c36dcfe4c9bf9505f diff --git a/cime_config/buildnml b/cime_config/buildnml index 680ea17..b9cf573 100755 --- a/cime_config/buildnml +++ b/cime_config/buildnml @@ -36,6 +36,7 @@ def _create_namelists(case, confdir, namelist_infile, nmlgen, data_list_path): run_type = case.get_value("RUN_TYPE") config["runtype"] = run_type config["wav_grid"] = case.get_value("WAV_GRID") + config["ww3_moddef"] = case.get_value("WW3_MODDEF") rundir = case.get_value("RUNDIR") start_date = case.get_value("RUN_STARTDATE") @@ -60,10 +61,25 @@ def _create_namelists(case, confdir, namelist_infile, nmlgen, data_list_path): run_refcase = case.get_value("RUN_REFCASE") run_refdate = case.get_value("RUN_REFDATE") run_tod = case.get_value("RUN_REFTOD") - filename = "%s.ww3.r.%s-%s" %(run_refcase, run_refdate, run_tod) + base = "%s.ww3.r.%s-%s" %(run_refcase, run_refdate, run_tod) + # WW3 writes netCDF restarts by default, so prefer the netCDF reference + # restart. Fall back to a binary restart (backward compatibility) when + # that is what the reference case wrote. + if (os.path.isfile(os.path.join(rundir, base)) + and not os.path.isfile(os.path.join(rundir, base + ".nc"))): + filename = base # binary reference restart (fallback) + else: + filename = base + ".nc" # netCDF reference restart (default) nmlgen.add_default("initfile", value=filename, ignore_abs_path=True) else: - nmlgen.add_default("initfile") + # Initial (and hybrid) runs: an explicit initfile may be supplied via + # user_nl_ww3 (netCDF or binary). With no initfile, WW3 starts from + # in-core calm conditions -- no binary initial-condition file is needed. + user_initfile = nmlgen.get_value("initfile") + if user_initfile and user_initfile.strip().strip("'\"").strip(): + nmlgen.add_default("initfile") + else: + nmlgen.set_value("initfile", "") # error check dtcpl = basedt / int(ncpl) @@ -190,15 +206,14 @@ def _prestage_inputs(case): rundir = case.get_value("RUNDIR") # Create rundir/ww3_moddef_create - filename = "ww3_grid" bldroot = os.path.join(case.get_value("EXEROOT"),"wav","obj") - item = os.path.join(bldroot, filename) - if os.path.isfile(item): + bld_ww3_grid = os.path.join(bldroot, "ww3_grid") # executable to create mod_def.ww3 file + if os.path.isfile(bld_ww3_grid): ww3_moddef_dir = os.path.join(rundir, "ww3_moddef_create") if not os.path.exists(ww3_moddef_dir): os.makedirs(ww3_moddef_dir) - if not os.path.exists(os.path.join(ww3_moddef_dir,filename)): - safe_copy(item, ww3_moddef_dir) + if not os.path.exists(os.path.join(ww3_moddef_dir, "ww3_grid")): + safe_copy(bld_ww3_grid, ww3_moddef_dir) if case.get_value("WW3_MODDEF") == 'unset': # Create output dir ww3_moddef_create if appropriate @@ -208,20 +223,27 @@ def _prestage_inputs(case): # Copy ww3_inp and other needed info to ww3_moddef_create directory input_dir = case.get_value("WW3_GRID_INP_DIR") - files = os.listdir(input_dir) - for filename in files: - if not os.path.isfile(os.path.join(output_dir, filename)): - safe_copy(os.path.join(input_dir, filename), os.path.join(output_dir, filename)) + if os.path.isdir(input_dir): + files = os.listdir(input_dir) + for filename in files: + if not os.path.isfile(os.path.join(output_dir, filename)): + safe_copy(os.path.join(input_dir, filename), os.path.join(output_dir, filename)) # Create mod_def file using ww3_grid and the grid_input files - if os.path.isfile(os.path.join(output_dir,"ww3_grid")): + if not os.path.isfile(os.path.join(output_dir,"ww3_grid")): + logger.warning("ww3_grid file not found. The mod_def.ww3 file will be created after the build phase.") + elif not os.path.isfile(os.path.join(output_dir,"ww3_grid.inp")): + logger.warning("ww3_grid.inp file not found. The file will automatically be downloaded at the ./case.submit phase.") + else: + # Generate mod_def.ww3 file using ww3_grid executable and the grid_input files run_cmd("./ww3_grid > mod_def.ww3.log", from_dir=output_dir) if not os.path.isfile(os.path.join(output_dir,"mod_def.ww3")): raise RuntimeError("mod_def.ww3 was not created, check mod_def.ww3.log for errors.") + # Copy mod_def.ww3 to rundir. No binary initial-condition file is + # generated: WW3 initial runs start from in-core calm conditions + # (or a user-supplied initfile), and restarts are netCDF. shutil.move(os.path.join(output_dir,"mod_def.ww3"), os.path.join(rundir, "mod_def.ww3")) - else: - logger.warning("ww3_grid file not found. The mod_def.ww3 file will be created after the build phase.") - + else: # Use mod_def already created mod_def_in = case.get_value("WW3_MODDEF") diff --git a/cime_config/config_component.xml b/cime_config/config_component.xml index ba99e3c..2019866 100644 --- a/cime_config/config_component.xml +++ b/cime_config/config_component.xml @@ -55,7 +55,7 @@ $DIN_LOC_ROOT/wav/ww3/grid_inp.${WAV_GRID} $DIN_LOC_ROOT/wav/ww3/grid_inp.${WAV_GRID}.231018 - $DIN_LOC_ROOT/wav/ww3/grid_inp.${WAV_GRID}.250428 + $DIN_LOC_ROOT/wav/ww3/grid_inp.${WAV_GRID}.260527 $DIN_LOC_ROOT/wav/ww3/grid_inp.${WAV_GRID}.240722 case_comp diff --git a/cime_config/namelist_definition_ww3.xml b/cime_config/namelist_definition_ww3.xml index a4abb5c..3a9cfac 100644 --- a/cime_config/namelist_definition_ww3.xml +++ b/cime_config/namelist_definition_ww3.xml @@ -35,16 +35,12 @@ "" "" - $DIN_LOC_ROOT/wav/ww3/ww3a.restart.ww3.calm.wwver7.14.220119 - $DIN_LOC_ROOT/wav/ww3/ww3a.restart.ww3.calm.wwver7.14.220119 - $DIN_LOC_ROOT/wav/ww3/wgx3v7.restart.ww3.calm.240722 - $DIN_LOC_ROOT/wav/ww3/wgx3v7.restart.ww3.calm.240722 - $DIN_LOC_ROOT/wav/ww3/wt232.restart.ww3.calm.240722 - $DIN_LOC_ROOT/wav/ww3/wt232.restart.ww3.calm.240722 - ' ' - ' ' - $DIN_LOC_ROOT/wav/ww3/wtnx1v4.restart.ww3.230308 - $DIN_LOC_ROOT/wav/ww3/wtnx1v4.restart.ww3.230308 + "calm_strt.ww3" + "calm_strt.ww3" + ' ' + ' ' + $DIN_LOC_ROOT/wav/ww3/wtnx1v4.restart.ww3.230308 + $DIN_LOC_ROOT/wav/ww3/wtnx1v4.restart.ww3.230308 Initial condition file. @@ -80,6 +76,88 @@ + + char + prestage_only + prestage_only + abs + + UNSET + $WW3_GRID_INP_DIR/ww3a_mapsta.inp + $WW3_GRID_INP_DIR/g37_mapsta.inp + $WW3_GRID_INP_DIR/t232_mapsta.inp + + Grid mask file; listed so check_input_data can download it. + + + + char + prestage_only + prestage_only + abs + + UNSET + $WW3_GRID_INP_DIR/ww3a_bottom.inp + $WW3_GRID_INP_DIR/g37_bottom.inp + $WW3_GRID_INP_DIR/t232_bottom.inp + + Grid bottom depth file; listed so check_input_data can download it. + + + + char + prestage_only + prestage_only + abs + + UNSET + $WW3_GRID_INP_DIR/g37_y.inp + $WW3_GRID_INP_DIR/t232_y.inp + + Grid y-coordinate file; listed so check_input_data can download it. + + + + char + prestage_only + prestage_only + abs + + UNSET + $WW3_GRID_INP_DIR/g37_x.inp + $WW3_GRID_INP_DIR/t232_x.inp + + Grid x-coordinate file; listed so check_input_data can download it. + + + + char + prestage_only + prestage_only + abs + + UNSET + $WW3_GRID_INP_DIR/ww3_grid.inp + $WW3_GRID_INP_DIR/ww3_grid.inp + $WW3_GRID_INP_DIR/ww3_grid.inp + + Grid input file; listed so check_input_data can download it. + + + + char + prestage_only + prestage_only + abs + + UNSET + $WW3_GRID_INP_DIR/ww3_strt.inp + $WW3_GRID_INP_DIR/ww3_strt.inp + $WW3_GRID_INP_DIR/ww3_strt.inp + + Grid strt file; listed so check_input_data can download it. + + real ww3_inparm @@ -157,6 +235,21 @@ + + integer + domain_nml + setup + + WW3 restart/output I/O type. 0 = no dedicated output process, each process + writes its own data (requires a parallel file system); 1 = no dedicated + output process, gather to a single writer (any file system); 2 = single + dedicated output process; 3 = multiple dedicated output processes. + + + 1 + + + char input_nml diff --git a/cime_config/testdefs/testlist_ww3.xml b/cime_config/testdefs/testlist_ww3.xml index aa9fdec..95bdbb1 100644 --- a/cime_config/testdefs/testlist_ww3.xml +++ b/cime_config/testdefs/testlist_ww3.xml @@ -1,6 +1,6 @@ - + @@ -21,10 +21,18 @@ - + + + + + + + + + - +