diff --git a/.github/workflows/make_ics.yml b/.github/workflows/make_ics.yml new file mode 100644 index 0000000000..736dc69bc7 --- /dev/null +++ b/.github/workflows/make_ics.yml @@ -0,0 +1,224 @@ +name: Make MPAS ICs (init_atmosphere) + +on: [push, pull_request, workflow_dispatch] + +############################################################################################# +# Build init_atmosphere_model from this branch and create the static, initial-condition, +# lateral-boundary files for 120 km CONUS test cases (GFS and RAP, with and without lakes, +# and GFS for Noah-MP with 4 and 10 soil layers). +# +# Jobs +# build - make gfortran CORE=init_atmosphere (in the CI container) +# static - one static file per variant (20-class MODIS land use, and 21-class with +# lakes); cached on the init_atmosphere source, the static namelist and the +# inputs release, so it only reruns when one of those changes +# case - init / lbc / sfc_update for each case, sanity checks, artifacts +# +# Cases source date static land use +# conus_gfs gfs 2023031015 20-class MODIS (also makes sfc_update) +# conus_gfs_lake gfs 2023031015 21-class MODIS with lakes (also makes sfc_update) +# conus_gfs_noahmp gfs 2023031015 20-class MODIS; NCAR namelists with 4 soil levels +# for Noah-MP (also makes sfc_update) +# conus_gfs_noahmp10 gfs 2023031015 as conus_gfs_noahmp, with 10 soil layers +# conus_raps rap 2024081518 20-class MODIS +# conus_raps_lake rap 2024081518 21-class MODIS with lakes +# (cases/ also has conus_rapw and conus_rapw_lake for running by hand) +# +# Inputs (mesh, geographic data, ungrib intermediate files, aerosol climatology) come +# from release INPUTS_TAG of this repository (copy them with +# testing_and_setup/ufs-community/ics/copy_inputs_release.sh). Scripts and namelists +# are in testing_and_setup/ufs-community/ics/ (from dustinswales/mpas-ic-factory). +############################################################################################# + +env: + INPUTS_REPO: ${{ github.repository }} + INPUTS_TAG: MPAS-v8.4.2-1.20 + ICS_DIR: testing_and_setup/ufs-community/ics + IMAGE: dustinswales/ufs-community-mpas-ci:gnu + +jobs: + build: + runs-on: ubuntu-22.04 + container: + image: dustinswales/ufs-community-mpas-ci:gnu + defaults: + run: + shell: bash -el {0} + env: + PNETCDF: /opt/pnetcdf + steps: + - uses: actions/checkout@v6 + with: + submodules: recursive + - name: Build init_atmosphere_model + run: | + git config --global --add safe.directory "$GITHUB_WORKSPACE" + make gfortran CORE=init_atmosphere > build.log 2>&1 || { tail -80 build.log; exit 1; } + test -x init_atmosphere_model + mkdir -p bin && cp init_atmosphere_model bin/ + { + echo "code commit: ${{ github.repository }}@${{ github.sha }}" + echo "compiler: $(mpif90 --version | head -1)" + echo "image: $IMAGE" + echo "workflow run: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" + } > bin/build-info.txt + cat bin/build-info.txt + - uses: actions/upload-artifact@v4 + with: + name: init-exe + path: bin/ + retention-days: 7 + + static: + needs: build + runs-on: ubuntu-22.04 + container: + image: dustinswales/ufs-community-mpas-ci:gnu + defaults: + run: + shell: bash -el {0} + strategy: + fail-fast: false + matrix: + include: + - static_key: conus-120km + case: conus_raps + nml_dir: step1_static + - static_key: conus-120km-lakes + case: conus_raps_lake + nml_dir: step1_static_lakes + name: static (${{ matrix.static_key }}) + steps: + - uses: actions/checkout@v6 + - name: Restore static files + id: cache + uses: actions/cache@v4 + with: + path: static/${{ matrix.static_key }} + key: static-v1-${{ matrix.static_key }}-${{ env.INPUTS_TAG }}-${{ hashFiles('src/core_init_atmosphere/**', 'src/framework/**', 'src/operators/**', 'src/external/**', 'src/tools/**', 'Makefile', format('testing_and_setup/ufs-community/ics/case_files/{0}/*', matrix.nml_dir), 'testing_and_setup/ufs-community/ics/scripts/create_case.sh') }} + - uses: actions/download-artifact@v4 + if: steps.cache.outputs.cache-hit != 'true' + with: + name: init-exe + path: bin/ + - name: Fetch mesh and geographic data + if: steps.cache.outputs.cache-hit != 'true' + run: | + df -h . + bash "$ICS_DIR/scripts/fetch_inputs.sh" -r "$INPUTS_REPO" -t "$INPUTS_TAG" -d inputs grids geog + df -h . + - name: Create static file + if: steps.cache.outputs.cache-hit != 'true' + env: + MPIRUN: mpiexec --allow-run-as-root --oversubscribe -np + run: | + chmod +x bin/init_atmosphere_model + DESCRIBE_EXTRA=$PWD/bin/build-info.txt \ + bash "$ICS_DIR/scripts/create_case.sh" -c ${{ matrix.case }} -e bin/init_atmosphere_model \ + -i inputs -o out -n 4 -s static + mkdir -p static/${{ matrix.static_key }} + cp out/*/case_files/mpas.*.nc out/*/case_files/log.static static/${{ matrix.static_key }}/ + ls -l static/${{ matrix.static_key }} + - uses: actions/upload-artifact@v4 + with: + name: static-${{ matrix.static_key }} + path: static/${{ matrix.static_key }}/ + retention-days: 7 + + case: + needs: [build, static] + runs-on: ubuntu-22.04 + container: + image: dustinswales/ufs-community-mpas-ci:gnu + defaults: + run: + shell: bash -el {0} + strategy: + fail-fast: false + matrix: + include: + - case: conus_gfs + source: gfs + static_key: conus-120km + bundles: ungrib-gfs.2023031015 ungrib-sst.2023031015 + lbc_times: 17 + checks: '' + - case: conus_gfs_lake + source: gfs + static_key: conus-120km-lakes + bundles: ungrib-gfs.2023031015 ungrib-sst.2023031015 + lbc_times: 17 + checks: --lakes + - case: conus_gfs_noahmp + source: gfs + static_key: conus-120km + bundles: ungrib-gfs.2023031015 ungrib-sst.2023031015 + lbc_times: 17 + checks: --noahmp + - case: conus_gfs_noahmp10 + source: gfs + static_key: conus-120km + bundles: ungrib-gfs.2023031015 ungrib-sst.2023031015 + lbc_times: 17 + checks: --noahmp --soil-levels 10 + - case: conus_raps + source: rap + static_key: conus-120km + bundles: ungrib-rap.2024081518 + lbc_times: 2 + checks: '' + - case: conus_raps_lake + source: rap + static_key: conus-120km-lakes + bundles: ungrib-rap.2024081518 + lbc_times: 2 + checks: --lakes + name: ${{ matrix.case }} + steps: + - uses: actions/checkout@v6 + - uses: actions/download-artifact@v4 + with: + name: init-exe + path: bin/ + - uses: actions/download-artifact@v4 + with: + name: static-${{ matrix.static_key }} + path: static/ + - name: Fetch inputs + run: | + df -h . + # shellcheck disable=SC2086 + bash "$ICS_DIR/scripts/fetch_inputs.sh" -r "$INPUTS_REPO" -t "$INPUTS_TAG" -d inputs \ + grids aerosols ${{ matrix.bundles }} + df -h . + - name: Create init / lbc / sfc_update files + env: + MPIRUN: mpiexec --allow-run-as-root --oversubscribe -np + run: | + chmod +x bin/init_atmosphere_model + DESCRIBE_EXTRA=$PWD/bin/build-info.txt \ + bash "$ICS_DIR/scripts/create_case.sh" -c ${{ matrix.case }} -e bin/init_atmosphere_model \ + -i inputs -o out -n 4 -S static + case_dir=$(basename out/*) + echo "CASE_DIR=$case_dir" >> "$GITHUB_ENV" + ls -l "out/$case_dir/case_files" + - name: Set up Python (netCDF4) for checks + uses: conda-incubator/setup-miniconda@v4 + with: + python-version: '3.11' + auto-update-conda: true + auto-activate-base: false + environment-file: testing_and_setup/ufs-community/environment.yml + activate-environment: mpas-ci-env + - name: Check files + run: | + python "$ICS_DIR/check_ics.py" "out/$CASE_DIR/case_files" \ + --source ${{ matrix.source }} --lbc-times ${{ matrix.lbc_times }} ${{ matrix.checks }} + - name: Upload files + if: ${{ !cancelled() }} + uses: actions/upload-artifact@v4 + with: + name: ics-${{ matrix.case }} + path: out/ + retention-days: 14 + if-no-files-found: ignore diff --git a/.gitignore b/.gitignore index eba5cabcff..913f305252 100644 --- a/.gitignore +++ b/.gitignore @@ -81,3 +81,7 @@ streams.init_atmosphere # ignore ics and tables generated by get_data.sh testing_and_setup/ufs-community/data/ics/ testing_and_setup/ufs-community/data/tables/ + +# make_ics test namelists (testing_and_setup/ufs-community/ics) are source files +!testing_and_setup/ufs-community/ics/case_files/**/namelist.init_atmosphere +!testing_and_setup/ufs-community/ics/case_files/**/streams.init_atmosphere diff --git a/README.md b/README.md index f4145ad8b1..319337dc53 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -MPAS-v8.4.2-1.19 +MPAS-v8.4.2-2.6 ==== The Model for Prediction Across Scales (MPAS) is a collaborative project for diff --git a/src/core_atmosphere/CMakeLists.txt b/src/core_atmosphere/CMakeLists.txt index 4a43744da4..bec01bfdf4 100644 --- a/src/core_atmosphere/CMakeLists.txt +++ b/src/core_atmosphere/CMakeLists.txt @@ -310,6 +310,7 @@ endif() set(ATMOSPHERE_CORE_PHYSICS_MYNN-EDMF_SOURCES src/module_bl_mynnedmf.F90 src/MPAS/module_bl_mynnedmf_common.F90 + src/module_bl_mynnedmf_diags.F90 src/module_bl_mynnedmf_driver.F90 ) list(TRANSFORM ATMOSPHERE_CORE_PHYSICS_MYNN-EDMF_SOURCES PREPEND physics/physics_noaa/MYNN-EDMF/) diff --git a/src/core_atmosphere/Externals.cfg b/src/core_atmosphere/Externals.cfg index 84dc47d1d8..3f0054f9a4 100644 --- a/src/core_atmosphere/Externals.cfg +++ b/src/core_atmosphere/Externals.cfg @@ -9,7 +9,7 @@ required = True local_path = ./physics_noaa/UGWP protocol = git repo_url = https://github.com/NOAA-GSL/UGWP.git -tag = MPAS_20241223 +tag = MPAS_20261104 required = True [externals_description] diff --git a/src/core_atmosphere/Registry.xml b/src/core_atmosphere/Registry.xml index 3b7137859f..028e610ba4 100644 --- a/src/core_atmosphere/Registry.xml +++ b/src/core_atmosphere/Registry.xml @@ -513,7 +513,9 @@ - + + + @@ -615,16 +617,14 @@ #endif +#ifdef MPAS_UFS_DYCORE + +#endif #ifdef DO_PHYSICS - - - - - @@ -673,6 +673,11 @@ #ifdef DO_PHYSICS + + + + + @@ -745,6 +750,11 @@ #ifdef DO_PHYSICS + + + + + @@ -1250,6 +1260,15 @@ + + + + + + + + + @@ -2998,6 +3017,11 @@ description="configuration of gravity wave drag over orography" possible_values="`suite',`bl_ysu_gwdo',`bl_ugwp_gwdo',`off'"/> + + - + + @@ -3563,43 +3592,43 @@ + packages="bl_mynn_in;bl_mynn_diags3d_in"/> + packages="bl_mynn_in;bl_mynn_diags3d_in"/> + packages="bl_mynn_in;bl_mynn_diags3d_in"/> + packages="bl_mynn_in;bl_mynn_diags3d_in"/> + packages="bl_mynn_in;bl_mynn_diags3d_in"/> + packages="bl_mynn_in;bl_mynn_diags3d_in"/> + packages="bl_mynn_in;bl_mynn_diags3d_in"/> + packages="bl_mynn_in;bl_mynn_diags3d_in"/> + packages="bl_mynn_in;bl_mynn_diags3d_in"/> + packages="bl_mynn_in;bl_mynn_diags3d_in"/> + + + + + + + + + + + + + + + + + + + + diff --git a/src/core_atmosphere/diagnostics/mpas_convective_diagnostics.F b/src/core_atmosphere/diagnostics/mpas_convective_diagnostics.F index 010f3f86eb..1619912d66 100644 --- a/src/core_atmosphere/diagnostics/mpas_convective_diagnostics.F +++ b/src/core_atmosphere/diagnostics/mpas_convective_diagnostics.F @@ -492,6 +492,7 @@ subroutine convective_diagnostics_update(configs, stream_mgr, dt) allocate(wspd(nVertLevels)) do iCell=1, nCellsSolve z_agl(1:nVertLevels) = 0.5*(zgrid(1:nVertLevels,iCell)+zgrid(2:nVertlevelsP1,iCell)) - zgrid(1,iCell) + z_agl(nVertLevelsP1) = zgrid(nVertlevelsP1,iCell) - zgrid(1,iCell) if (column_height_value(refl10cm(:,iCell),z_agl(1:nVertLevels),1000.0_RKIND,nVertLevels) > 20.0_RKIND) then do k=1,nVertLevels wspd(k) = sqrt(uzonal(k,iCell)**2+umeridional(k,iCell)**2) @@ -505,6 +506,7 @@ subroutine convective_diagnostics_update(configs, stream_mgr, dt) if (is_needed_wind02_integral_max) then do iCell=1, nCellsSolve z_agl(1:nVertLevels) = 0.5*(zgrid(1:nVertLevels,iCell)+zgrid(2:nVertlevelsP1,iCell)) - zgrid(1,iCell) + z_agl(nVertLevelsP1) = zgrid(nVertlevelsP1,iCell) - zgrid(1,iCell) if (column_height_value(refl10cm(:,iCell),z_agl(1:nVertLevels),1000.0_RKIND,nVertLevels) > 20.0_RKIND) then ! integral_zstaggered requires all nVertLevelsP1 interface heights. ! z_agl above contains only nVertLevels layer-center heights. diff --git a/src/core_atmosphere/physics/Makefile b/src/core_atmosphere/physics/Makefile index bbc4ceda63..f6de10bf2a 100644 --- a/src/core_atmosphere/physics/Makefile +++ b/src/core_atmosphere/physics/Makefile @@ -176,7 +176,8 @@ mpas_atmphys_driver_microphysics.o: \ mpas_atmphys_init_microphysics.o \ mpas_atmphys_init_tempo.o \ mpas_atmphys_interface.o \ - mpas_atmphys_vars.o + mpas_atmphys_vars.o \ + physics_noaa/TEMPO/module_mp_tempo_cfgs.o mpas_atmphys_driver_oml.o: \ mpas_atmphys_constants.o \ diff --git a/src/core_atmosphere/physics/mpas_atmphys_driver_gwdo.F b/src/core_atmosphere/physics/mpas_atmphys_driver_gwdo.F index a96ba7bf2a..40c947f2b5 100644 --- a/src/core_atmosphere/physics/mpas_atmphys_driver_gwdo.F +++ b/src/core_atmosphere/physics/mpas_atmphys_driver_gwdo.F @@ -708,6 +708,7 @@ subroutine driver_gwdo(itimestep,configs,mesh,sfc_input,ngw_input,diag_physics,t !local variables: character(len=StrKIND),pointer:: gwdo_scheme logical,pointer:: ugwp_diags,ngw_scheme + real(kind=RKIND),pointer:: alpha_fd integer,pointer:: ntau_d1y_ptr,ntau_d2t_ptr real(kind=RKIND),dimension(:),pointer :: days_limb_ptr real(kind=RKIND),dimension(:,:),pointer:: tau_limb_ptr @@ -733,6 +734,7 @@ subroutine driver_gwdo(itimestep,configs,mesh,sfc_input,ngw_input,diag_physics,t call mpas_pool_get_config(configs,'config_gwdo_scheme',gwdo_scheme) call mpas_pool_get_config(configs,'config_ugwp_diags',ugwp_diags) call mpas_pool_get_config(configs,'config_ngw_scheme',ngw_scheme) + call mpas_pool_get_config(configs,'config_alpha_fd',alpha_fd) ! Call up variables needed for NGW scheme if (ngw_scheme) then @@ -804,6 +806,7 @@ subroutine driver_gwdo(itimestep,configs,mesh,sfc_input,ngw_input,diag_physics,t dtaux3d_bl = dtaux3d_bl_p, dtauy3d_bl = dtauy3d_bl_p, & dtaux3d_ss = dtaux3d_ss_p, dtauy3d_ss = dtauy3d_ss_p, & dtaux3d_fd = dtaux3d_fd_p, dtauy3d_fd = dtauy3d_fd_p, & + alpha_fd = alpha_fd, & ugwp_diags = ugwp_diags , ngw_scheme = ngw_scheme , xlatd = xlat_p , & jindx1_tau = jindx1_tau_p, jindx2_tau = jindx2_tau_p, & ddy_j1tau = ddy_j1tau_p , ddy_j2tau = ddy_j2tau_p , r_DoY = curr_julday, & diff --git a/src/core_atmosphere/physics/mpas_atmphys_driver_microphysics.F b/src/core_atmosphere/physics/mpas_atmphys_driver_microphysics.F index 44e0f1f4af..1733547d5e 100644 --- a/src/core_atmosphere/physics/mpas_atmphys_driver_microphysics.F +++ b/src/core_atmosphere/physics/mpas_atmphys_driver_microphysics.F @@ -592,7 +592,7 @@ subroutine driver_microphysics(configs,mesh,state,time_lev,diag,diag_physics,ten case ("mp_tempo") if (allocated(nwfa_p) .and. allocated(nwfa2d_p)) then call tempo_aerosol_surface_emissions(dt=dt_microp, nwfa=nwfa_p, nwfa2d=nwfa2d_p, & - ims=ims, ime=ime, jms=jms, jme=jme, kms=kms, kme=kme, kts=kts) + ims=ims, ime=ime, jms=jms, jme=jme, kms=kms, kme=kme, its=its, ite=ite, jts=jts, jte=jte, kts=kts) endif call mpas_timer_start('mp_tempo') diff --git a/src/core_atmosphere/physics/mpas_atmphys_driver_pbl.F b/src/core_atmosphere/physics/mpas_atmphys_driver_pbl.F index a1f7c6aa46..2e3bd5fa3b 100644 --- a/src/core_atmosphere/physics/mpas_atmphys_driver_pbl.F +++ b/src/core_atmosphere/physics/mpas_atmphys_driver_pbl.F @@ -99,6 +99,7 @@ subroutine allocate_pbl(configs) !local pointers: character(len=StrKIND),pointer:: pbl_scheme + integer,pointer:: config_mynn_diags2d,config_mynn_diags3d !----------------------------------------------------------------------------------------------------------------- @@ -241,7 +242,9 @@ subroutine allocate_pbl(configs) !allocation of additional arrays: if(.not.allocated(pattern_spp_pbl)) allocate(pattern_spp_pbl(ims:ime,kms:kme,jms:jme)) - case("bl_mynnedmf") !GSL version + case("bl_mynnedmf") !GSL version + call mpas_pool_get_config(configs,'config_mynn_diags2d',config_mynn_diags2d) + call mpas_pool_get_config(configs,'config_mynn_diags3d',config_mynn_diags3d) if(.not.allocated(dx_p) ) allocate(dx_p(ims:ime,jms:jme) ) if(.not.allocated(ch_p) ) allocate(ch_p(ims:ime,jms:jme) ) if(.not.allocated(qsfc_p) ) allocate(qsfc_p(ims:ime,jms:jme) ) @@ -256,7 +259,19 @@ subroutine allocate_pbl(configs) if(.not.allocated(maxtkeprod_dd_p))allocate(maxtkeprod_dd_p(ims:ime,jms:jme) ) if(.not.allocated(cldtop_cooling_p))allocate(cldtop_cooling_p(ims:ime,jms:jme) ) if(.not.allocated(ent_eff_p) ) allocate(ent_eff_p(ims:ime,jms:jme) ) - + if(config_mynn_diags2d>0)then + if(.not.allocated(lwpbl_p) ) allocate(lwpbl_p(ims:ime,jms:jme) ) + if(.not.allocated(iwpbl_p) ) allocate(iwpbl_p(ims:ime,jms:jme) ) + if(.not.allocated(swpbl_p) ) allocate(swpbl_p(ims:ime,jms:jme) ) + if(.not.allocated(cldceil_p) ) allocate(cldceil_p(ims:ime,jms:jme) ) + endif + if(config_mynn_diags2d>1)then + if(.not.allocated(wspd10_p) ) allocate(wspd10_p(ims:ime,jms:jme) ) + if(.not.allocated(wspd80_p) ) allocate(wspd80_p(ims:ime,jms:jme) ) + if(.not.allocated(wspd160_p) ) allocate(wspd160_p(ims:ime,jms:jme) ) + if(.not.allocated(maxcldfra_p) ) allocate(maxcldfra_p(ims:ime,jms:jme) ) + if(.not.allocated(maxcldfrabl_p) ) allocate(maxcldfrabl_p(ims:ime,jms:jme) ) + endif if(.not.allocated(cov_p) ) allocate(cov_p(ims:ime,kms:kme,jms:jme) ) if(.not.allocated(qke_p) ) allocate(qke_p(ims:ime,kms:kme,jms:jme) ) if(.not.allocated(qsq_p) ) allocate(qsq_p(ims:ime,kms:kme,jms:jme) ) @@ -273,17 +288,18 @@ subroutine allocate_pbl(configs) if(.not.allocated(qcbl_p) ) allocate(qcbl_p(ims:ime,kms:kme,jms:jme) ) if(.not.allocated(qibl_p) ) allocate(qibl_p(ims:ime,kms:kme,jms:jme) ) if(.not.allocated(cldfrabl_p) ) allocate(cldfrabl_p(ims:ime,kms:kme,jms:jme) ) - if(.not.allocated(edmfa_p) ) allocate(edmfa_p(ims:ime,kms:kme,jms:jme) ) - if(.not.allocated(edmfw_p) ) allocate(edmfw_p(ims:ime,kms:kme,jms:jme) ) - if(.not.allocated(edmfqt_p) ) allocate(edmfqt_p(ims:ime,kms:kme,jms:jme) ) - if(.not.allocated(edmfthl_p) ) allocate(edmfthl_p(ims:ime,kms:kme,jms:jme) ) - if(.not.allocated(edmfent_p) ) allocate(edmfent_p(ims:ime,kms:kme,jms:jme) ) - if(.not.allocated(edmfqc_p) ) allocate(edmfqc_p(ims:ime,kms:kme,jms:jme) ) - if(.not.allocated(subthl_p) ) allocate(subthl_p(ims:ime,kms:kme,jms:jme) ) - if(.not.allocated(subqv_p) ) allocate(subqv_p(ims:ime,kms:kme,jms:jme) ) - if(.not.allocated(detthl_p) ) allocate(detthl_p(ims:ime,kms:kme,jms:jme) ) - if(.not.allocated(detqv_p) ) allocate(detqv_p(ims:ime,kms:kme,jms:jme) ) - + if(config_mynn_diags3d>0)then + if(.not.allocated(edmfa_p) ) allocate(edmfa_p(ims:ime,kms:kme,jms:jme) ) + if(.not.allocated(edmfw_p) ) allocate(edmfw_p(ims:ime,kms:kme,jms:jme) ) + if(.not.allocated(edmfqt_p) ) allocate(edmfqt_p(ims:ime,kms:kme,jms:jme) ) + if(.not.allocated(edmfthl_p) ) allocate(edmfthl_p(ims:ime,kms:kme,jms:jme) ) + if(.not.allocated(edmfent_p) ) allocate(edmfent_p(ims:ime,kms:kme,jms:jme) ) + if(.not.allocated(edmfqc_p) ) allocate(edmfqc_p(ims:ime,kms:kme,jms:jme) ) + if(.not.allocated(subthl_p) ) allocate(subthl_p(ims:ime,kms:kme,jms:jme) ) + if(.not.allocated(subqv_p) ) allocate(subqv_p(ims:ime,kms:kme,jms:jme) ) + if(.not.allocated(detthl_p) ) allocate(detthl_p(ims:ime,kms:kme,jms:jme) ) + if(.not.allocated(detqv_p) ) allocate(detqv_p(ims:ime,kms:kme,jms:jme) ) + endif !additional tendencies: if(.not.allocated(rqsblten_p) ) allocate(rqsblten_p(ims:ime,kms:kme,jms:jme) ) if(.not.allocated(rncblten_p) ) allocate(rncblten_p(ims:ime,kms:kme,jms:jme) ) @@ -328,7 +344,8 @@ subroutine deallocate_pbl(configs) !local pointers: character(len=StrKIND),pointer:: pbl_scheme - + integer,pointer:: config_mynn_diags2d,config_mynn_diags3d + !----------------------------------------------------------------------------------------------------------------- call mpas_pool_get_config(configs,'config_pbl_scheme',pbl_scheme) @@ -450,6 +467,8 @@ subroutine deallocate_pbl(configs) if(allocated(pattern_spp_pbl)) deallocate(pattern_spp_pbl) case("bl_mynnedmf") + call mpas_pool_get_config(configs,'config_mynn_diags2d',config_mynn_diags2d) + call mpas_pool_get_config(configs,'config_mynn_diags3d',config_mynn_diags3d) if(allocated(dx_p) ) deallocate(dx_p ) if(allocated(ch_p) ) deallocate(ch_p ) if(allocated(qsfc_p) ) deallocate(qsfc_p ) @@ -457,14 +476,26 @@ subroutine deallocate_pbl(configs) if(allocated(maxwidthbl_p) ) deallocate(maxwidthbl_p ) if(allocated(maxmfbl_p) ) deallocate(maxmfbl_p ) if(allocated(zbl_plume_p) ) deallocate(zbl_plume_p ) - if(allocated(excessh_p) ) deallocate(excessh_p ) + if(allocated(excessh_p) ) deallocate(excessh_p ) if(allocated(excessq_p) ) deallocate(excessq_p ) if(allocated(maxwidth_dd_p) ) deallocate(maxwidth_dd_p ) if(allocated(maxmf_dd_p) ) deallocate(maxmf_dd_p ) if(allocated(maxtkeprod_dd_p) ) deallocate(maxtkeprod_dd_p ) if(allocated(cldtop_cooling_p)) deallocate(cldtop_cooling_p) if(allocated(ent_eff_p) ) deallocate(ent_eff_p ) - + if(config_mynn_diags2d>0)then + if(allocated(lwpbl_p) ) deallocate(lwpbl_p ) + if(allocated(iwpbl_p) ) deallocate(iwpbl_p ) + if(allocated(swpbl_p) ) deallocate(swpbl_p ) + if(allocated(cldceil_p) ) deallocate(cldceil_p ) + endif + if(config_mynn_diags2d>1)then + if(allocated(wspd10_p) ) deallocate(wspd10_p ) + if(allocated(wspd80_p) ) deallocate(wspd80_p ) + if(allocated(wspd160_p) ) deallocate(wspd160_p ) + if(allocated(maxcldfra_p) ) deallocate(maxcldfra_p ) + if(allocated(maxcldfrabl_p) ) deallocate(maxcldfrabl_p ) + endif if(allocated(cov_p) ) deallocate(cov_p ) if(allocated(qke_p) ) deallocate(qke_p ) if(allocated(qsq_p) ) deallocate(qsq_p ) @@ -481,17 +512,18 @@ subroutine deallocate_pbl(configs) if(allocated(qcbl_p) ) deallocate(qcbl_p ) if(allocated(qibl_p) ) deallocate(qibl_p ) if(allocated(cldfrabl_p) ) deallocate(cldfrabl_p ) - if(allocated(edmfa_p) ) deallocate(edmfa_p ) - if(allocated(edmfw_p) ) deallocate(edmfw_p ) - if(allocated(edmfqt_p) ) deallocate(edmfqt_p ) - if(allocated(edmfthl_p) ) deallocate(edmfthl_p ) - if(allocated(edmfent_p) ) deallocate(edmfent_p ) - if(allocated(edmfqc_p) ) deallocate(edmfqc_p ) - if(allocated(subthl_p) ) deallocate(subthl_p ) - if(allocated(subqv_p) ) deallocate(subqv_p ) - if(allocated(detthl_p) ) deallocate(detthl_p ) - if(allocated(detqv_p) ) deallocate(detqv_p ) - + if(config_mynn_diags3d>0)then + if(allocated(edmfa_p) ) deallocate(edmfa_p ) + if(allocated(edmfw_p) ) deallocate(edmfw_p ) + if(allocated(edmfqt_p) ) deallocate(edmfqt_p ) + if(allocated(edmfthl_p) ) deallocate(edmfthl_p ) + if(allocated(edmfent_p) ) deallocate(edmfent_p ) + if(allocated(edmfqc_p) ) deallocate(edmfqc_p ) + if(allocated(subthl_p) ) deallocate(subthl_p ) + if(allocated(subqv_p) ) deallocate(subqv_p ) + if(allocated(detthl_p) ) deallocate(detthl_p ) + if(allocated(detqv_p) ) deallocate(detqv_p ) + endif !additional tendencies: if(allocated(rqsblten_p) ) deallocate(rqsblten_p ) if(allocated(rncblten_p) ) deallocate(rncblten_p ) @@ -561,7 +593,7 @@ subroutine pbl_from_MPAS(configs,state,mesh,sfc_input,diag_physics,tend_physics, !local pointers for MYNN scheme: real(kind=RKIND),pointer:: len_disp - integer,pointer:: config_mynn_tkebudget,config_mynn_edmf_output + integer,pointer:: config_mynn_tkebudget,config_mynn_diags2d,config_mynn_diags3d real(kind=RKIND),dimension(:),pointer :: meshDensity real(kind=RKIND),dimension(:),pointer :: ch,qsfc,rmol real(kind=RKIND),dimension(:,:),pointer:: cov,qke,qsq,tsq,sh3d,sm3d,tke_pbl,qke_adv,el_pbl @@ -891,7 +923,8 @@ subroutine pbl_from_MPAS(configs,state,mesh,sfc_input,diag_physics,tend_physics, case("bl_mynnedmf") call mpas_pool_get_config(configs,'config_len_disp',len_disp) - call mpas_pool_get_config(configs,'config_mynn_edmf_output',config_mynn_edmf_output) + call mpas_pool_get_config(configs,'config_mynn_diags2d',config_mynn_diags2d) + call mpas_pool_get_config(configs,'config_mynn_diags3d',config_mynn_diags3d) call mpas_pool_get_config(configs,'config_mynn_tkebudget',config_mynn_tkebudget) call mpas_pool_get_array(mesh,'meshDensity',meshDensity) @@ -909,7 +942,7 @@ subroutine pbl_from_MPAS(configs,state,mesh,sfc_input,diag_physics,tend_physics, call mpas_pool_get_array(diag_physics,'cldfrac_bl',cldfrac_bl) call mpas_pool_get_array(diag_physics,'qc_bl' ,qc_bl ) call mpas_pool_get_array(diag_physics,'qi_bl' ,qi_bl ) - if(config_mynn_edmf_output > 0) then + if(config_mynn_diags3d > 0) then call mpas_pool_get_array(diag_physics,'edmf_a' ,edmf_a ) call mpas_pool_get_array(diag_physics,'edmf_ent' ,edmf_ent ) call mpas_pool_get_array(diag_physics,'edmf_qc' ,edmf_qc ) @@ -958,7 +991,7 @@ subroutine pbl_from_MPAS(configs,state,mesh,sfc_input,diag_physics,tend_physics, enddo enddo - if(config_mynn_edmf_output > 0)then + if(config_mynn_diags3d > 0)then do j = jts,jte do k = kts,kte do i = its,ite @@ -1006,6 +1039,28 @@ subroutine pbl_from_MPAS(configs,state,mesh,sfc_input,diag_physics,tend_physics, enddo enddo + if(config_mynn_diags2d >= 1)then + do j = jts,jte + do i = its,ite + lwpbl_p(i,j) = 0._RKIND + iwpbl_p(i,j) = 0._RKIND + swpbl_p(i,j) = 0._RKIND + cldceil_p(i,j) = 0._RKIND + enddo + enddo + endif + if(config_mynn_diags2d >= 2)then + do j = jts,jte + do i = its,ite + wspd10_p(i,j) = 0._RKIND + wspd80_p(i,j) = 0._RKIND + wspd160_p(i,j) = 0._RKIND + maxcldfra_p(i,j) = 0._RKIND + maxcldfrabl_p(i,j) = 0._RKIND + enddo + enddo + endif + case("bl_myj") !input variables: call mpas_pool_get_array(mesh ,'zgrid' ,zgrid) @@ -1107,9 +1162,11 @@ subroutine pbl_to_MPAS(configs,state,diag_physics,tend_physics,its,ite) real(kind=RKIND),dimension(:),pointer :: delta,wstar !local pointers for MYNN scheme: - integer,pointer:: config_mynn_tkebudget,config_mynn_edmf_output + integer,pointer:: config_mynn_tkebudget,config_mynn_diags2d,config_mynn_diags3d real(kind=RKIND),dimension(:),pointer :: maxmf,maxwidth,ztop_plume,excess_h,excess_q real(kind=RKIND),dimension(:),pointer :: maxmf_dd,maxwidth_dd,maxtkeprod_dd,cldtop_cooling,ent_eff + real(kind=RKIND),dimension(:),pointer :: lwp_bl,iwp_bl,swp_bl,cldceil + real(kind=RKIND),dimension(:),pointer :: wspd10,wspd80,wspd160,maxcldfra,maxcldfra_pbl real(kind=RKIND),dimension(:,:),pointer:: cov,qke,qsq,tsq,sh3d,sm3d,tke_pbl,qke_adv,el_pbl,dqke,qbuoy, & qdiss,qshear,qwt real(kind=RKIND),dimension(:,:),pointer:: cldfrac_bl,qc_bl,qi_bl @@ -1330,8 +1387,9 @@ subroutine pbl_to_MPAS(configs,state,diag_physics,tend_physics,its,ite) endif case("bl_mynnedmf") - call mpas_pool_get_config(configs,'config_mynn_edmf_output',config_mynn_edmf_output) call mpas_pool_get_config(configs,'config_mynn_tkebudget',config_mynn_tkebudget) + call mpas_pool_get_config(configs,'config_mynn_diags2d',config_mynn_diags2d) + call mpas_pool_get_config(configs,'config_mynn_diags3d',config_mynn_diags3d) call mpas_pool_get_array(diag_physics,'maxmf' ,maxmf ) call mpas_pool_get_array(diag_physics,'maxwidth' ,maxwidth ) call mpas_pool_get_array(diag_physics,'ztop_plume' ,ztop_plume ) @@ -1360,7 +1418,20 @@ subroutine pbl_to_MPAS(configs,state,diag_physics,tend_physics,its,ite) call mpas_pool_get_array(diag_physics,'cldfrac_bl' ,cldfrac_bl ) call mpas_pool_get_array(diag_physics,'qc_bl' ,qc_bl ) call mpas_pool_get_array(diag_physics,'qi_bl' ,qi_bl ) - if(config_mynn_edmf_output > 0) then + if(config_mynn_diags2d > 0) then + call mpas_pool_get_array(diag_physics,'lwp_bl' ,lwp_bl ) + call mpas_pool_get_array(diag_physics,'iwp_bl' ,iwp_bl ) + call mpas_pool_get_array(diag_physics,'swp_bl' ,swp_bl ) + call mpas_pool_get_array(diag_physics,'cldceil' ,cldceil ) + endif + if(config_mynn_diags2d > 1) then + call mpas_pool_get_array(diag_physics,'wspd10' ,wspd10 ) + call mpas_pool_get_array(diag_physics,'wspd80' ,wspd80 ) + call mpas_pool_get_array(diag_physics,'wspd160' ,wspd160 ) + call mpas_pool_get_array(diag_physics,'maxcldfra' ,maxcldfra ) + call mpas_pool_get_array(diag_physics,'maxcldfra_pbl',maxcldfra_pbl) + endif + if(config_mynn_diags3d > 0) then call mpas_pool_get_array(diag_physics,'edmf_a' ,edmf_a ) call mpas_pool_get_array(diag_physics,'edmf_ent' ,edmf_ent ) call mpas_pool_get_array(diag_physics,'edmf_qc' ,edmf_qc ) @@ -1408,7 +1479,28 @@ subroutine pbl_to_MPAS(configs,state,diag_physics,tend_physics,its,ite) enddo enddo - if(config_mynn_edmf_output > 0)then + if(config_mynn_diags2d > 0)then + do j = jts,jte + do i = its,ite + lwp_bl(i) = lwpbl_p(i,j) + iwp_bl(i) = iwpbl_p(i,j) + swp_bl(i) = swpbl_p(i,j) + cldceil(i) = cldceil_p(i,j) + enddo + enddo + endif + if(config_mynn_diags2d > 1)then + do j = jts,jte + do i = its,ite + wspd10(i) = wspd10_p(i,j) + wspd80(i) = wspd80_p(i,j) + wspd160(i) = wspd160_p(i,j) + maxcldfra(i) = maxcldfra_p(i,j) + maxcldfra_pbl(i)=maxcldfrabl_p(i,j) + enddo + enddo + endif + if(config_mynn_diags3d > 0)then do j = jts,jte do k = kts,kte do i = its,ite @@ -1578,7 +1670,6 @@ subroutine driver_pbl(itimestep,configs,state,mesh,sfc_input,diag_physics,tend_p bl_mynn_edmf_dd, & bl_mynn_edmf_mom, & bl_mynn_edmf_tke, & - bl_mynn_edmf_output, & bl_mynn_mixscalars, & bl_mynn_mixaerosols, & bl_mynn_mixnumcon, & @@ -1586,6 +1677,8 @@ subroutine driver_pbl(itimestep,configs,state,mesh,sfc_input,diag_physics,tend_p bl_mynn_mixqt, & bl_mynn_ess, & bl_mynn_tkebudget, & + bl_mynn_diags2d, & + bl_mynn_diags3d, & spp_pbl real(kind=RKIND),pointer:: bl_mynn_closure @@ -1825,7 +1918,7 @@ subroutine driver_pbl(itimestep,configs,state,mesh,sfc_input,diag_physics,tend_p call mpas_pool_get_config(configs,'config_mynn_edmf_dd' ,bl_mynn_edmf_dd ) call mpas_pool_get_config(configs,'config_mynn_edmf_mom' ,bl_mynn_edmf_mom ) call mpas_pool_get_config(configs,'config_mynn_edmf_tke' ,bl_mynn_edmf_tke ) - call mpas_pool_get_config(configs,'config_mynn_edmf_output',bl_mynn_edmf_output) + call mpas_pool_get_config(configs,'config_mynn_diags3d' ,bl_mynn_diags3d ) call mpas_pool_get_config(configs,'config_mynn_closure' ,bl_mynn_closure ) call mpas_pool_get_config(configs,'config_mynn_mixscalars' ,bl_mynn_mixscalars ) call mpas_pool_get_config(configs,'config_mynn_mixclouds' ,bl_mynn_cloudmix ) @@ -1845,7 +1938,7 @@ subroutine driver_pbl(itimestep,configs,state,mesh,sfc_input,diag_physics,tend_p ! call mpas_log_write('--- config_mynn_edmf_dd = $i',intArgs=(/bl_mynn_edmf_dd/)) ! call mpas_log_write('--- config_mynn_edmf_mom = $i',intArgs=(/bl_mynn_edmf_mom/)) ! call mpas_log_write('--- config_mynn_edmf_tke = $i',intArgs=(/bl_mynn_edmf_tke/)) -! call mpas_log_write('--- config_mynn_edmf_output = $i',intArgs=(/bl_mynn_edmf_output/)) +! call mpas_log_write('--- config_mynn_diags3d = $i',intArgs=(/bl_mynn_diags3d/)) ! call mpas_log_write('--- config_mynn_mixscalars = $i',intArgs=(/bl_mynn_mixscalars/)) ! call mpas_log_write('--- config_mynn_mixclouds = $i',intArgs=(/bl_mynn_cloudmix/)) ! call mpas_log_write('--- config_mynn_mixqt = $i',intArgs=(/bl_mynn_mixqt/)) @@ -1911,7 +2004,7 @@ subroutine driver_pbl(itimestep,configs,state,mesh,sfc_input,diag_physics,tend_p bl_mynn_edmf_dd = bl_mynn_edmf_dd , & bl_mynn_edmf_mom = bl_mynn_edmf_mom , & bl_mynn_edmf_tke = bl_mynn_edmf_tke , & - bl_mynn_output = bl_mynn_edmf_output , & + bl_mynn_output = bl_mynn_diags3d , & bl_mynn_mixscalars = bl_mynn_mixscalars , & bl_mynn_cloudmix = bl_mynn_cloudmix , & bl_mynn_mixqt = bl_mynn_mixqt , & @@ -1931,7 +2024,8 @@ subroutine driver_pbl(itimestep,configs,state,mesh,sfc_input,diag_physics,tend_p call mpas_pool_get_config(configs,'config_mynn_edmf_dd' ,bl_mynn_edmf_dd ) call mpas_pool_get_config(configs,'config_mynn_edmf_mom' ,bl_mynn_edmf_mom ) call mpas_pool_get_config(configs,'config_mynn_edmf_tke' ,bl_mynn_edmf_tke ) - call mpas_pool_get_config(configs,'config_mynn_edmf_output',bl_mynn_edmf_output) + call mpas_pool_get_config(configs,'config_mynn_diags2d' ,bl_mynn_diags2d ) + call mpas_pool_get_config(configs,'config_mynn_diags3d' ,bl_mynn_diags3d ) call mpas_pool_get_config(configs,'config_mynn_closure' ,bl_mynn_closure ) call mpas_pool_get_config(configs,'config_mynn_mixscalars' ,bl_mynn_mixscalars ) call mpas_pool_get_config(configs,'config_mynn_mixaerosols',bl_mynn_mixaerosols) @@ -1952,7 +2046,8 @@ subroutine driver_pbl(itimestep,configs,state,mesh,sfc_input,diag_physics,tend_p ! call mpas_log_write('--- config_mynn_edmf_dd = $i',intArgs=(/bl_mynn_edmf_dd/)) ! call mpas_log_write('--- config_mynn_edmf_mom = $i',intArgs=(/bl_mynn_edmf_mom/)) ! call mpas_log_write('--- config_mynn_edmf_tke = $i',intArgs=(/bl_mynn_edmf_tke/)) -! call mpas_log_write('--- config_mynn_edmf_output = $i',intArgs=(/bl_mynn_edmf_output/)) +! call mpas_log_write('--- config_mynn_diags2d = $i',intArgs=(/bl_mynn_diags2d/)) +! call mpas_log_write('--- config_mynn_diags3d = $i',intArgs=(/bl_mynn_diags3d/)) ! call mpas_log_write('--- config_mynn_mixscalars = $i',intArgs=(/bl_mynn_mixscalars/)) ! call mpas_log_write('--- config_mynn_mixclouds = $i',intArgs=(/bl_mynn_cloudmix/)) ! call mpas_log_write('--- config_mynn_mixqt = $i',intArgs=(/bl_mynn_mixqt/)) @@ -1994,7 +2089,10 @@ subroutine driver_pbl(itimestep,configs,state,mesh,sfc_input,diag_physics,tend_p maxwidth = maxwidthbl_p , maxmf = maxmfbl_p , ztop_plume = zbl_plume_p , & excess_h = excessh_p , excess_q = excessq_p , maxwidth_dd = maxwidth_dd_p , & maxmf_dd = maxmf_dd_p , maxtkeprod = maxtkeprod_dd_p, cldtop_cooling= cldtop_cooling_p , & - ent_eff = ent_eff_p , & + ent_eff = ent_eff_p , lwp = lwpbl_p , iwp = iwpbl_p , & + swp = swpbl_p , cldceil = cldceil_p , wspd10 = wspd10_p , & + wspd80 = wspd80_p , wspd160 = wspd160_p , maxcldfra = maxcldfra_p , & + maxcldfra_pbl = maxcldfrabl_p , & qke = qke_p , qke_adv = qkeadv_p , & tsq = tsq_p , qsq = qsq_p , cov = cov_p , & el_pbl = elpbl_p , rublten = rublten_p , rvblten = rvblten_p , & @@ -2020,7 +2118,8 @@ subroutine driver_pbl(itimestep,configs,state,mesh,sfc_input,diag_physics,tend_p bl_mynn_edmf_dd = bl_mynn_edmf_dd , & bl_mynn_edmf_mom = bl_mynn_edmf_mom , & bl_mynn_edmf_tke = bl_mynn_edmf_tke , & - bl_mynn_output = bl_mynn_edmf_output , & + bl_mynn_diags2d = bl_mynn_diags2d , & + bl_mynn_diags3d = bl_mynn_diags3d , & bl_mynn_mixscalars = bl_mynn_mixscalars , & bl_mynn_mixaerosols= bl_mynn_mixaerosols , & bl_mynn_mixnumcon = bl_mynn_mixnumcon , & diff --git a/src/core_atmosphere/physics/mpas_atmphys_driver_sfclayer.F b/src/core_atmosphere/physics/mpas_atmphys_driver_sfclayer.F index 3d657d2615..dbf0c63c84 100644 --- a/src/core_atmosphere/physics/mpas_atmphys_driver_sfclayer.F +++ b/src/core_atmosphere/physics/mpas_atmphys_driver_sfclayer.F @@ -236,6 +236,8 @@ subroutine allocate_sfclayer(configs) if(.not.allocated(ch_p) ) allocate(ch_p(ims:ime,jms:jme) ) if(.not.allocated(cqs_p) ) allocate(cqs_p(ims:ime,jms:jme) ) if(.not.allocated(qcg_p) ) allocate(qcg_p(ims:ime,jms:jme) ) + if(.not.allocated(uoce_p) ) allocate(uoce_p(ims:ime,jms:jme) ) + if(.not.allocated(voce_p) ) allocate(voce_p(ims:ime,jms:jme) ) if(config_frac_seaice) then if(.not.allocated(ch_sea) ) allocate(ch_sea(ims:ime,jms:jme) ) if(.not.allocated(cqs_sea)) allocate(cqs_sea(ims:ime,jms:jme)) @@ -406,6 +408,8 @@ subroutine deallocate_sfclayer(configs) if(allocated(snowh_p)) deallocate(snowh_p) if(allocated(ch_p) ) deallocate(ch_p ) if(allocated(qcg_p) ) deallocate(qcg_p ) + if(allocated(uoce_p) ) deallocate(uoce_p ) + if(allocated(voce_p) ) deallocate(voce_p ) if(config_frac_seaice) then if(allocated(ch_sea)) deallocate(ch_sea) endif @@ -706,6 +710,8 @@ subroutine sfclayer_from_MPAS(configs,mesh,diag_physics,sfc_input,its,ite) !inout variables: ch_p(i,j) = ch(i) cqs_p(i,j) = cqs(i) + uoce_p(i,j) = 0._RKIND + voce_p(i,j) = 0._RKIND if(config_frac_seaice) then ch_sea(i,j) = ch(i) cqs_sea(i,j) = cqs(i) @@ -1465,9 +1471,9 @@ subroutine driver_sfclayer(itimestep,configs,mesh,diag_physics,sfc_input,its,ite rho3d = rho_p , dz8w = dz_p , & chs = chs_p , chs2 = chs2_p , psfcpa = psfc_p , & cqs = cqs_p , cqs2 = cqs2_p , cpm = cpm_p , & - znt = znt_p , qgh = qgh_p , & + znt = znt_p , uoce = uoce_p , voce = voce_p , & ust = ust_p , pblh = hpbl_p , mavail = mavail_p , & - zol = zol_p , mol = mol_p , & + zol = zol_p , mol = mol_p , qgh = qgh_p , & psim = psim_p , psih = psih_p , xland = xland_p , & hfx = hfx_p , qfx = qfx_p , lh = lh_p , & tsk = tsk_p , flhc = flhc_p , flqc = flqc_p , & @@ -1478,7 +1484,7 @@ subroutine driver_sfclayer(itimestep,configs,mesh,diag_physics,sfc_input,its,ite isfflx = isfflx , dx = dx_p , & ustm = ustm_p , ck = ck_p , cka = cka_p , & cd = cd_p , cda = cda_p , ch = ch_p , & - xice =xice_P , xice_threshold = xice_threshold , & + xice = xice_p , xice_threshold = xice_threshold , & spp_pbl = spp_pbl , & sf_mynn_sfcflux_land = sf_mynn_sfcflux_land , & sf_mynn_sfcflux_water = sf_mynn_sfcflux_water , & @@ -1499,9 +1505,9 @@ subroutine driver_sfclayer(itimestep,configs,mesh,diag_physics,sfc_input,its,ite rho3d = rho_p , dz8w = dz_p , & chs = chs_sea , chs2 = chs2_sea , psfcpa = psfc_p , & cqs = cqs_sea , cqs2 = cqs2_sea , cpm = cpm_sea , & - znt = znt_sea , qgh = qgh_sea , & + znt = znt_sea , uoce = uoce_p , voce = voce_p , & ust = ust_sea , pblh = hpbl_p , mavail = mavail_sea , & - zol = zol_sea , mol = mol_sea , & + zol = zol_sea , mol = mol_sea , qgh = qgh_sea , & psim = psim_sea , psih = psih_sea , xland = xland_sea , & hfx = hfx_sea , qfx = qfx_sea , lh = lh_sea , & tsk = tsk_sea , flhc = flhc_sea , flqc = flqc_sea , & @@ -1512,7 +1518,7 @@ subroutine driver_sfclayer(itimestep,configs,mesh,diag_physics,sfc_input,its,ite isfflx = isfflx , dx = dx_p , & ustm = ustm_sea , ck = ck_sea , cka = cka_sea , & cd = cd_sea , cda = cda_sea , ch = ch_sea , & - xice =xice_P , xice_threshold = xice_threshold , & + xice = xice_p , xice_threshold = xice_threshold , & spp_pbl = spp_pbl , & sf_mynn_sfcflux_land = sf_mynn_sfcflux_land , & sf_mynn_sfcflux_water = sf_mynn_sfcflux_water , & diff --git a/src/core_atmosphere/physics/mpas_atmphys_init.F b/src/core_atmosphere/physics/mpas_atmphys_init.F index 1986db4bf0..27c8e835af 100644 --- a/src/core_atmosphere/physics/mpas_atmphys_init.F +++ b/src/core_atmosphere/physics/mpas_atmphys_init.F @@ -152,6 +152,7 @@ subroutine physics_init(dminfo,stream_manager,clock,configs,mesh,diag,tend,tend_ logical,pointer:: ngw_scheme integer,pointer:: ntau_d1y real(kind=RKIND),pointer:: knob_ugwp_tauamp + real(kind=RKIND),pointer:: alpha_fd real(kind=RKIND),dimension(:),pointer:: ugwp_taulat integer,dimension(:),pointer:: jindx1_tau, jindx2_tau real(kind=RKIND),dimension(:),pointer:: ddy_j1tau, ddy_j2tau @@ -459,6 +460,13 @@ subroutine physics_init(dminfo,stream_manager,clock,configs,mesh,diag,tend,tend_ endif endif +!Output of misc namelist settings related to the UGWP suite + if(trim(gwdo_scheme).eq.'bl_ugwp_gwdo') then + call mpas_pool_get_config(configs,'config_alpha_fd',alpha_fd) + call mpas_log_write('Turbulent orographic form drag coeff. alpha_fd = $r', & + realArgs=(/alpha_fd/),masterOnly=.true.) + endif + !initialization of non-stationary gravity wave drag if(trim(gwdo_scheme).eq.'bl_ugwp_gwdo') then ! Read in ugwp_oro_data diff --git a/src/core_atmosphere/physics/mpas_atmphys_initialize_real.F b/src/core_atmosphere/physics/mpas_atmphys_initialize_real.F index 31d3a7fa2d..5fdb402342 100644 --- a/src/core_atmosphere/physics/mpas_atmphys_initialize_real.F +++ b/src/core_atmosphere/physics/mpas_atmphys_initialize_real.F @@ -324,7 +324,7 @@ subroutine init_soil_layers_depth(mesh, fg, dims, configs) !end select selectcase (config_nsoillevels) - case( 4 ) + case( 4, 10 ) do iCell = 1, nCellsSolve iSoil = 1 zs_fg(iSoil,iCell) = 0.5_RKIND * dzs_fg(iSoil,iCell) @@ -336,10 +336,24 @@ subroutine init_soil_layers_depth(mesh, fg, dims, configs) enddo do iCell = 1, nCellsSolve - dzs(1,iCell) = 0.10_RKIND - dzs(2,iCell) = 0.30_RKIND - dzs(3,iCell) = 0.60_RKIND - dzs(4,iCell) = 1.00_RKIND + if (config_nsoillevels == 10) then + !10-layer set for Noah-MP (5 m total depth): + dzs( 1,iCell) = 0.05_RKIND + dzs( 2,iCell) = 0.10_RKIND + dzs( 3,iCell) = 0.10_RKIND + dzs( 4,iCell) = 0.10_RKIND + dzs( 5,iCell) = 0.30_RKIND + dzs( 6,iCell) = 0.35_RKIND + dzs( 7,iCell) = 0.50_RKIND + dzs( 8,iCell) = 1.00_RKIND + dzs( 9,iCell) = 1.00_RKIND + dzs(10,iCell) = 1.50_RKIND + else + dzs(1,iCell) = 0.10_RKIND + dzs(2,iCell) = 0.30_RKIND + dzs(3,iCell) = 0.60_RKIND + dzs(4,iCell) = 1.00_RKIND + endif iSoil = 1 zs(iSoil,iCell) = 0.5_RKIND * dzs(iSoil,iCell) @@ -458,7 +472,7 @@ subroutine init_soil_layers_properties(mesh, fg, dminfo, dims, configs) endif select case(config_nsoillevels) - case ( 4 ) + case ( 4, 10 ) ! if(config_nsoillevels .ne. 4) & ! call physics_error_fatal('NOAH lsm uses 4 soil layers. Correct config_nsoillevels.') call init_soil_properties_noah(mesh, fg, dminfo, dims, configs) @@ -491,6 +505,7 @@ subroutine init_soil_properties_noah(mesh, fg, dminfo, dims, configs) integer, pointer:: nCellsSolve,nFGSoilLevels,nSoilLevels integer:: num_sm,num_st integer,dimension(:),pointer:: landmask + logical:: found real(kind=RKIND),dimension(:,:),allocatable:: zhave,sm_input,st_input @@ -556,6 +571,7 @@ subroutine init_soil_properties_noah(mesh, fg, dminfo, dims, configs) if(landmask(iCell) .eq. 1) then noah: do iSoil = 1 , nSoilLevels + found = .false. input: do ifgSoil = 1 , nFGSoilLevels+2-1 if(iCell .eq. 1) call mpas_log_write('$i $i $r $r $r', & intArgs=(/iSoil,ifgSoil/), & @@ -580,9 +596,19 @@ subroutine init_soil_properties_noah(mesh, fg, dminfo, dims, configs) sh2o(iSoil,iCell) = 0._RKIND smcrel(iSoil,iCell) = 0._RKIND + found = .true. exit input endif enddo input + !layers centered below the deepest input level (3 m, where the deep soil + !temperature is used; only the 10-layer set goes that deep): use the + !deepest input values. + if(.not. found) then + tslb(iSoil,iCell) = st_input(nFGSoilLevels+2,iCell) + smois(iSoil,iCell) = sm_input(nFGSoilLevels+2,iCell) + sh2o(iSoil,iCell) = 0._RKIND + smcrel(iSoil,iCell) = 0._RKIND + endif if(iCell.eq. 1) call mpas_log_write('') enddo noah @@ -934,7 +960,7 @@ subroutine physics_init_seaice(mesh, input, dims, configs) character(len=StrKIND):: mess integer, pointer:: nCellsSolve,nSoilLevels integer:: iCell,iSoil - integer:: num_seaice_changes + integer:: num_seaice_changes, num_lake_ice integer,dimension(:),pointer:: landmask,isltyp,ivgtyp real(kind=RKIND):: xice_threshold @@ -948,7 +974,8 @@ subroutine physics_init_seaice(mesh, input, dims, configs) logical, pointer :: config_frac_seaice character(len=StrKIND),pointer:: config_landuse_data - integer,pointer:: isice_lu + integer,pointer:: isice_lu, islake_lu + logical:: lake_point !note that this threshold is also defined in module_physics_vars.F.It is defined here to avoid !adding "use module_physics_vars" since this subroutine is only used for the initialization of @@ -967,6 +994,7 @@ subroutine physics_init_seaice(mesh, input, dims, configs) call mpas_pool_get_dimension(dims, 'nSoilLevels', nSoilLevels) call mpas_pool_get_array(mesh, 'isice_lu', isice_lu) + call mpas_pool_get_array(mesh, 'islake_lu', islake_lu) call mpas_pool_get_array(mesh, 'landmask', landmask) call mpas_pool_get_array(mesh, 'lu_index', ivgtyp) call mpas_pool_get_array(mesh, 'soilcat_top', isltyp) @@ -992,6 +1020,7 @@ subroutine physics_init_seaice(mesh, input, dims, configs) call mpas_pool_get_array(input, 'smcrel', smcrel) call mpas_log_write('--- isice_lu = $i', intArgs=(/isice_lu/)) + call mpas_log_write('--- islake_lu = $i', intArgs=(/islake_lu/)) !assign the threshold value for xice as a function of config_frac_seaice: if(.not. config_frac_seaice) then @@ -1011,13 +1040,32 @@ subroutine physics_init_seaice(mesh, input, dims, configs) call mpas_log_write('--- tsk_seaice_threshold : $r', realArgs=(/tsk_seaice_threshold/)) !convert seaice points to land points when the sea-ice fraction is greater than the -!prescribed threshold: +!prescribed threshold. Frozen lakes (lu_index = islake_lu) are the exception: they stay lakes. num_seaice_changes = 0 + num_lake_ice = 0 do iCell = 1, nCellsSolve seaice(iCell) = 0._RKIND + lake_point = (islake_lu > 0 .and. ivgtyp(iCell) == islake_lu) + if(xice(iCell) .ge. xice_threshold .or. & (landmask(iCell).eq.0 .and. skintemp(iCell).lt.tsk_seaice_threshold)) then + if(lake_point) then + !... frozen lakes stay lakes: keep the lake land use category, the water soil category, + ! landmask and xland, and the deep soil temperature; only record the ice state. + ! The lake model handles lake ice itself. + num_lake_ice = num_lake_ice + 1 + seaice(iCell) = 1._RKIND + !cold skin temperature without an ice analysis: treat the lake as fully ice covered. + if(xice(iCell) .lt. xice_threshold) xice(iCell) = 1._RKIND + snoalb(iCell) = 0.75 + vegfra(iCell) = 0._RKIND + !top limit on snow depth on lake ice: 1.2 m or 360 mm swe + snowh(iCell) = min(snowh(iCell),1.2_RKIND) + snow(iCell) = min(snow(iCell),360._RKIND) + cycle + endif + num_seaice_changes = num_seaice_changes + 1 !... sea-ice points are converted to land points: if(landmask(iCell) .eq. 0) tmn(iCell) = 271.4_RKIND @@ -1060,6 +1108,9 @@ subroutine physics_init_seaice(mesh, input, dims, configs) write(mess,fmt='(A,i12)') 'number of seaice cells converted to land cells 2 =', & num_seaice_changes call physics_message(mess) + write(mess,fmt='(A,i12)') 'number of frozen lake cells kept as lakes =', & + num_lake_ice + call physics_message(mess) !call mpas_log_write('--- end physics_init_seaice:') diff --git a/src/core_atmosphere/physics/mpas_atmphys_packages.F b/src/core_atmosphere/physics/mpas_atmphys_packages.F index 3a61e4dda4..bef9d88b5f 100644 --- a/src/core_atmosphere/physics/mpas_atmphys_packages.F +++ b/src/core_atmosphere/physics/mpas_atmphys_packages.F @@ -39,14 +39,15 @@ function atmphys_setup_packages(configs,streamInfo,packages,iocontext) result(ie character(len=StrKIND),pointer:: config_convection_scheme character(len=StrKIND),pointer:: config_pbl_scheme character(len=StrKIND),pointer:: config_lsm_scheme - integer,pointer:: config_mynn_tkebudget,config_mynn_edmf_output + integer,pointer:: config_mynn_tkebudget,config_mynn_diags3d,config_mynn_diags2d logical,pointer:: config_tempo_aerosolaware,config_tempo_hailaware logical,pointer:: mp_kessler_in,mp_thompson_in,mp_thompson_aers_in,mp_wsm6_in,mp_nssl2m_in,nssl3m_in logical,pointer:: mp_tempo_in,tempo_hailaware_in,tempo_aerosolaware_in logical,pointer:: cu_grell_freitas_in,cu_grell_freitas_li_in,cu_kain_fritsch_in,cu_ntiedtke_in logical,pointer:: cu_gfs_sas_in + logical,pointer:: bl_mynnedmf_tkebudget_in,bl_mynn_diags3d_in + logical,pointer:: bl_mynn_diags2d_in,bl_mynn_diags2dextra_in logical,pointer:: bl_mynn_in,bl_mynnedmf_in,bl_tke_edmf_in,bl_ysu_in,bl_myj_in - logical,pointer:: bl_mynnedmf_tkebudget_in,bl_mynnedmf_output_in logical,pointer:: lsm_noah_in,lsm_ruc_in logical,pointer:: sf_noahmp_in @@ -208,8 +209,8 @@ function atmphys_setup_packages(configs,streamInfo,packages,iocontext) result(ie call mpas_pool_get_config(configs,'config_pbl_scheme',config_pbl_scheme) call mpas_pool_get_config(configs,'config_mynn_tkebudget',config_mynn_tkebudget) - call mpas_pool_get_config(configs,'config_mynn_edmf_output',config_mynn_edmf_output) - + call mpas_pool_get_config(configs,'config_mynn_diags2d',config_mynn_diags2d) + call mpas_pool_get_config(configs,'config_mynn_diags3d',config_mynn_diags3d) nullify(bl_mynn_in) call mpas_pool_get_package(packages,'bl_mynn_inActive',bl_mynn_in) @@ -222,9 +223,15 @@ function atmphys_setup_packages(configs,streamInfo,packages,iocontext) result(ie nullify(bl_mynnedmf_tkebudget_in) call mpas_pool_get_package(packages,'bl_mynnedmf_tkebudget_inActive',bl_mynnedmf_tkebudget_in) - nullify(bl_mynnedmf_output_in) - call mpas_pool_get_package(packages,'bl_mynnedmf_output_inActive',bl_mynnedmf_output_in) + nullify(bl_mynn_diags2d_in) + call mpas_pool_get_package(packages,'bl_mynn_diags2d_inActive',bl_mynn_diags2d_in) + nullify(bl_mynn_diags2dextra_in) + call mpas_pool_get_package(packages,'bl_mynn_diags2dextra_inActive',bl_mynn_diags2dextra_in) + + nullify(bl_mynn_diags3d_in) + call mpas_pool_get_package(packages,'bl_mynn_diags3d_inActive',bl_mynn_diags3d_in) + nullify(bl_ysu_in) call mpas_pool_get_package(packages,'bl_ysu_inActive',bl_ysu_in) @@ -234,7 +241,9 @@ function atmphys_setup_packages(configs,streamInfo,packages,iocontext) result(ie if(.not.associated(bl_mynn_in) .or. & .not.associated(bl_mynnedmf_in) .or. & .not.associated(bl_tke_edmf_in) .or. & - .not.associated(bl_mynnedmf_output_in) .or. & + .not.associated(bl_mynn_diags2d_in) .or. & + .not.associated(bl_mynn_diags2dextra_in) .or. & + .not.associated(bl_mynn_diags3d_in) .or. & .not.associated(bl_mynnedmf_tkebudget_in) .or. & .not.associated(bl_ysu_in) .or. & .not.associated(bl_myj_in)) then @@ -248,7 +257,9 @@ function atmphys_setup_packages(configs,streamInfo,packages,iocontext) result(ie bl_mynn_in = .false. bl_mynnedmf_in = .false. bl_tke_edmf_in = .false. - bl_mynnedmf_output_in = .false. + bl_mynn_diags2d_in = .false. + bl_mynn_diags2dextra_in = .false. + bl_mynn_diags3d_in = .false. bl_mynnedmf_tkebudget_in = .false. bl_ysu_in = .false. bl_myj_in = .false. @@ -256,8 +267,10 @@ function atmphys_setup_packages(configs,streamInfo,packages,iocontext) result(ie bl_mynn_in = .true. elseif(config_pbl_scheme == 'bl_mynnedmf') then bl_mynnedmf_in = .true. - if(config_mynn_edmf_output >0) bl_mynnedmf_output_in = .true. - if(config_mynn_tkebudget >0) bl_mynnedmf_tkebudget_in = .true. + if(config_mynn_diags2d >=1) bl_mynn_diags2d_in = .true. + if(config_mynn_diags2d >=2) bl_mynn_diags2dextra_in = .true. + if(config_mynn_diags3d >=1) bl_mynn_diags3d_in = .true. + if(config_mynn_tkebudget ==1) bl_mynnedmf_tkebudget_in = .true. elseif(config_pbl_scheme == 'bl_tke_edmf') then bl_tke_edmf_in = .true. elseif(config_pbl_scheme == 'bl_ysu') then @@ -269,7 +282,9 @@ function atmphys_setup_packages(configs,streamInfo,packages,iocontext) result(ie call mpas_log_write(' bl_mynn_in = $l', logicArgs=(/bl_mynn_in/)) call mpas_log_write(' bl_mynnedmf_in = $l', logicArgs=(/bl_mynnedmf_in/)) call mpas_log_write(' bl_tke_edmf_in = $l', logicArgs=(/bl_tke_edmf_in/)) - call mpas_log_write(' bl_mynnedmf_output_in = $l', logicArgs=(/bl_mynnedmf_output_in/)) + call mpas_log_write(' bl_mynn_diags2d_in = $l', logicArgs=(/bl_mynn_diags2d_in/)) + call mpas_log_write(' bl_mynn_diags2dextra_in = $l', logicArgs=(/bl_mynn_diags2dextra_in/)) + call mpas_log_write(' bl_mynn_diags3d_in = $l', logicArgs=(/bl_mynn_diags3d_in/)) call mpas_log_write(' bl_mynnedmf_tkebudget_in= $l', logicArgs=(/bl_mynnedmf_tkebudget_in/)) call mpas_log_write(' bl_ysu_in = $l', logicArgs=(/bl_ysu_in/)) call mpas_log_write(' bl_myj_in = $l', logicArgs=(/bl_myj_in/)) diff --git a/src/core_atmosphere/physics/mpas_atmphys_vars.F b/src/core_atmosphere/physics/mpas_atmphys_vars.F index e33ad93dd3..894e8aa210 100644 --- a/src/core_atmosphere/physics/mpas_atmphys_vars.F +++ b/src/core_atmosphere/physics/mpas_atmphys_vars.F @@ -344,7 +344,7 @@ module mpas_atmphys_vars f_qc, &!parameter set to true to include the cloud water mixing ratio. f_qr, &!parameter set to true to include the rain mixing ratio. f_qi, &!parameter set to true to include the cloud ice mixing ratio. - f_qs, &!parameter set to true to include the snow minxg ratio. + f_qs, &!parameter set to true to include the snow mixing ratio. f_qg, &!parameter set to true to include the graupel mixing ratio. f_qoz, &!parameter set to true to include the ozone mixing ratio. f_qh @@ -568,7 +568,16 @@ module mpas_atmphys_vars maxmf_dd_p, &!maximum mass flux for downdrafts [m/s] maxtkeprod_dd_p, &!maximum tke prduction in column from downdrafts [m2/s2/hr] cldtop_cooling_p, &!maximum net cooling at boundary layer cloud top [K/hr] - ent_eff_p !entrainment efficiency [-] + ent_eff_p, &!entrainment efficiency + lwpbl_p, &!liquid water path (resolved + bl clouds) [g/m2] + iwpbl_p, &!ice water path (resolved + bl clouds) [g/m2] + swpbl_p, &!snow water path (resolved + bl clouds) [g/m2] + cldceil_p, &!cloud ceiling (using resolved + bl clouds) from MYNN [m] + wspd10_p, &!wind speed interpolated to 10m [m/s] + wspd80_p, &!wind speed interpolated to 80m [m/s] + wspd160_p, &!wind speed interpolated to 160m [m/s] + maxcldfra_p, &!maximum cloud fraction in the column (from MYNN) [-] + maxcldfrabl_p !maximum cloud fraction between surface and pblh + 1km (from MYNN) [-] real(kind=RKIND),dimension(:,:,:),allocatable:: & dqke_p, &! @@ -1139,9 +1148,9 @@ module mpas_atmphys_vars ! is set to true. the arrays below have the same definition as the corresponding "_p" arrays: !================================================================================================================= - real(kind=RKIND),dimension(:,:),allocatable:: br_sea,ch_sea,chs_sea,chs2_sea,cpm_sea,cqs_sea,cqs2_sea, & - flhc_sea,flqc_sea,gz1oz0_sea,hfx_sea,lh_sea,mavail_sea,mol_sea, & - psih_sea,psim_sea,fh_sea,fm_sea,qfx_sea,qgh_sea,qsfc_sea,regime_sea, & + real(kind=RKIND),dimension(:,:),allocatable:: br_sea,ch_sea,chs_sea,chs2_sea,cpm_sea,cqs_sea,cqs2_sea,& + flhc_sea,flqc_sea,gz1oz0_sea,hfx_sea,lh_sea,mavail_sea,mol_sea, & + psih_sea,psim_sea,fh_sea,fm_sea,qfx_sea,qgh_sea,qsfc_sea,regime_sea, & rmol_sea,ust_sea,wspd_sea,znt_sea,zol_sea,tsk_sea,xland_sea real(kind=RKIND),dimension(:,:),allocatable:: t2m_sea,th2m_sea,q2_sea,u10_sea,v10_sea real(kind=RKIND),dimension(:,:),allocatable:: cd_sea,cda_sea,ck_sea,cka_sea,ustm_sea diff --git a/src/core_atmosphere/physics/physics_noaa/MYNN-EDMF b/src/core_atmosphere/physics/physics_noaa/MYNN-EDMF index 0cd8b70d9d..2b2da61b05 160000 --- a/src/core_atmosphere/physics/physics_noaa/MYNN-EDMF +++ b/src/core_atmosphere/physics/physics_noaa/MYNN-EDMF @@ -1 +1 @@ -Subproject commit 0cd8b70d9d78b912cd0feec2160e2df9b0c52b6a +Subproject commit 2b2da61b05a8ef9f9b06795c816dc01e347e0736 diff --git a/src/core_atmosphere/physics/physics_noaa/MYNN-SFC b/src/core_atmosphere/physics/physics_noaa/MYNN-SFC index 13c3d29f7f..a038a9ea35 160000 --- a/src/core_atmosphere/physics/physics_noaa/MYNN-SFC +++ b/src/core_atmosphere/physics/physics_noaa/MYNN-SFC @@ -1 +1 @@ -Subproject commit 13c3d29f7f713610a24be9fa0e393d42a19d228b +Subproject commit a038a9ea35a12f0bf879fac8b64c99a77ffdae1c diff --git a/src/core_atmosphere/physics/physics_noaa/TEMPO b/src/core_atmosphere/physics/physics_noaa/TEMPO index 9adf9ef282..efea80b638 160000 --- a/src/core_atmosphere/physics/physics_noaa/TEMPO +++ b/src/core_atmosphere/physics/physics_noaa/TEMPO @@ -1 +1 @@ -Subproject commit 9adf9ef2827104640125f0c322e1218fce74e94c +Subproject commit efea80b63899c85ac5dc41a885e411890ee63cfc diff --git a/src/core_atmosphere/physics/physics_noaa/UGWP b/src/core_atmosphere/physics/physics_noaa/UGWP index c1c893edcf..4108d49147 160000 --- a/src/core_atmosphere/physics/physics_noaa/UGWP +++ b/src/core_atmosphere/physics/physics_noaa/UGWP @@ -1 +1 @@ -Subproject commit c1c893edcf171af5639af60e3a3a528816f6cc2b +Subproject commit 4108d491470c2576a7c1e97cc6a38bf454590193 diff --git a/src/core_atmosphere/physics/physics_wrf/module_bl_ugwp_gwdo.F b/src/core_atmosphere/physics/physics_wrf/module_bl_ugwp_gwdo.F index d916c4a72f..95c3a66b59 100644 --- a/src/core_atmosphere/physics/physics_wrf/module_bl_ugwp_gwdo.F +++ b/src/core_atmosphere/physics/physics_wrf/module_bl_ugwp_gwdo.F @@ -22,7 +22,7 @@ subroutine gwdo_ugwp(u3d,v3d,t3d,qv3d,p3d,p3di,pi3d,z,pblh,kpbl2d,br1,xland, & dusfc_fd,dvsfc_fd,ugwp_diags,ngw_scheme,xlatd, & jindx1_tau,jindx2_tau,ddy_j1tau,ddy_j2tau,r_DoY, & raincv,rainncv,ntau_d1y,ntau_d2t,days_limb,tau_limb, & - dudt_ngw,dvdt_ngw,dtdt_ngw, & + dudt_ngw,dvdt_ngw,dtdt_ngw,alpha_fd, & var2dls,oc12dls,oa2d1ls,oa2d2ls,oa2d3ls,oa2d4ls,ol2d1ls, & ol2d2ls,ol2d3ls,ol2d4ls,var2dss,oc12dss,oa2d1ss,oa2d2ss, & oa2d3ss,oa2d4ss,ol2d1ss,ol2d2ss,ol2d3ss,ol2d4ss, & @@ -114,6 +114,7 @@ subroutine gwdo_ugwp(u3d,v3d,t3d,qv3d,p3d,p3di,pi3d,z,pblh,kpbl2d,br1,xland, & real(kind=kind_phys),intent(in),dimension(ntau_d1y,ntau_d2t),optional:: & tau_limb real(kind=kind_phys),intent(in) :: r_DoY + real(kind=kind_phys),intent(in) :: alpha_fd real(kind=kind_phys),intent(in),dimension(ims:ime,jms:jme):: & var2dls,var2dss, & @@ -349,6 +350,7 @@ subroutine gwdo_ugwp(u3d,v3d,t3d,qv3d,p3d,p3di,pi3d,z,pblh,kpbl2d,br1,xland, & ,oa2d3ss=oa2d3ss_hv,oa2d4ss=oa2d4ss_hv & ,ol2d1ss=ol2d1ss_hv,ol2d2ss=ol2d2ss_hv & ,ol2d3ss=ol2d3ss_hv,ol2d4ss=ol2d4ss_hv & + ,alpha_fd=alpha_fd & ,g_=g,cp_=cp,rd_=rd,rv_=rv,fv_=ep1,pi_=pi & ,dxmeter=dx_hv,deltim=dt & ,its=its,ite=ite,kte=kte,kme=kte+1 & diff --git a/src/core_init_atmosphere/Registry.xml b/src/core_init_atmosphere/Registry.xml index 5323f44fc8..2705d861d5 100644 --- a/src/core_init_atmosphere/Registry.xml +++ b/src/core_init_atmosphere/Registry.xml @@ -44,7 +44,7 @@ description="The number of prescribed pressure levels in the climatological GOCART data set"/> - @@ -183,7 +183,7 @@ + possible_values="`USGS', `MODIFIED_IGBP_MODIS_NOAH', `MODIFIED_IGBP_MODIS_NOAH_15s', or `MODIFIED_IGBP_MODIS_NOAH_LAKES' (21-class MODIS with lakes as category 21)"/> + + + @@ -607,6 +613,7 @@ + @@ -947,6 +954,9 @@ + + 0.0_RKIND) then + coordinate_smoothing_height = config_coordinate_smoothing_height + else + call mpas_log_write('config_coordinate_smoothing_height must be zero or positive.', messageType=MPAS_LOG_CRIT) + end if + call mpas_log_write(' ') call mpas_log_write(' surfaces will be smoothed, dzmin = $r ',realArgs=(/config_dzmin/)) call mpas_log_write(' base number of smoothing passes = $i ',intArgs=(/config_nsm/)) + call mpas_log_write(' coordinate smoothing height (m) = $r ',realArgs=(/coordinate_smoothing_height/)) call mpas_log_write(' ') call mpas_log_write(' level, smoothing steps, smoothing factor, smallest fractional dz ') @@ -4779,7 +4796,7 @@ subroutine init_atm_case_gfs(block, mesh, nCells, nEdges, nVertLevels, fg, state do i=1,config_nsm + k do iCell=1,nCells - sm = sm0(iCell) * min((3.0*zw(k)/zh)**2.0, 1.0_RKIND) + sm = sm0(iCell) * min((3.0*zw(k)/coordinate_smoothing_height)**2.0, 1.0_RKIND) hs1(iCell) = 0. do j = 1,nEdgesOnCell(iCell) @@ -7212,8 +7229,8 @@ subroutine init_atm_case_gfs(block, mesh, nCells, nEdges, nVertLevels, fg, state call mpas_log_write('min lon $r max lon $r min lat $r max lat $r',realArgs=(/minval(lonPoints),maxval(lonPoints),minval(latPoints),maxval(latPoints)/)) do iCell=1,nCells - lat = latPoints(i)*DEG_PER_RAD - lon = lonPoints(i)*DEG_PER_RAD + lat = latPoints(iCell)*DEG_PER_RAD + lon = lonPoints(iCell)*DEG_PER_RAD ! T sorted_arr(:,:) = -999.0 do k = 1, nfglevels_actual @@ -7946,6 +7963,8 @@ subroutine init_atm_case_lbc(timestamp, block, mesh, nCells, nEdges, nVertLevels extrap_airtemp = 1 else if (trim(config_extrap_airtemp) == 'lapse-rate') then extrap_airtemp = 2 + else if (trim(config_extrap_airtemp) == 'gfs') then + extrap_airtemp = 3 else call mpas_log_write('*************************************************************', messageType=MPAS_LOG_ERR) call mpas_log_write('* Invalid value for namelist variable config_extrap_airtemp *', messageType=MPAS_LOG_ERR) @@ -8016,6 +8035,9 @@ subroutine init_atm_case_lbc(timestamp, block, mesh, nCells, nEdges, nVertLevels ! Chemistry call mpas_pool_get_config(configs, 'config_smoke_scheme', config_smoke_scheme) call mpas_pool_get_config(configs, 'config_dust_scheme', config_dust_scheme) + ! Nullify first: these are only fetched when the scheme is on, and + ! associated() on an undefined pointer is undefined behaviour. + nullify(smoke_fine_fg, dust_fine_fg, dust_coarse_fg) if ( config_smoke_scheme .ne. 'off' ) then call mpas_pool_get_array(fg, 'smoke_fine', smoke_fine_fg) endif diff --git a/src/core_init_atmosphere/mpas_init_atm_static.F b/src/core_init_atmosphere/mpas_init_atm_static.F index 72f2eed783..7074d4a3ad 100644 --- a/src/core_init_atmosphere/mpas_init_atm_static.F +++ b/src/core_init_atmosphere/mpas_init_atm_static.F @@ -158,7 +158,7 @@ subroutine init_atm_static(mesh, dims, configs) real(kind=RKIND),dimension(:,:),allocatable :: maxsnowalb real(kind=RKIND),dimension(:,:,:),allocatable:: vegfra - integer, pointer :: isice_lu, iswater_lu + integer, pointer :: isice_lu, iswater_lu, islake_lu integer :: iswater_soil integer, pointer :: nCells, nCellsSolve, nEdges, nVertices, maxEdges logical, pointer :: on_a_sphere @@ -279,6 +279,7 @@ subroutine init_atm_static(mesh, dims, configs) call mpas_pool_get_array(mesh, 'mminlu', mminlu) call mpas_pool_get_array(mesh, 'isice_lu', isice_lu) call mpas_pool_get_array(mesh, 'iswater_lu', iswater_lu) + call mpas_pool_get_array(mesh, 'islake_lu', islake_lu) call mpas_pool_get_array(mesh, 'soilcat_top', soilcat_top) call mpas_pool_get_array(mesh, 'soilf', soilf) call mpas_pool_get_array(mesh, 'landmask', landmask) @@ -368,14 +369,17 @@ subroutine init_atm_static(mesh, dims, configs) surface_input_select0: select case(trim(config_landuse_data)) case('USGS') write(mminlu,'(a)') 'USGS' - case('MODIFIED_IGBP_MODIS_NOAH', 'MODIFIED_IGBP_MODIS_NOAH_15s') + case('MODIFIED_IGBP_MODIS_NOAH', 'MODIFIED_IGBP_MODIS_NOAH_15s', 'MODIFIED_IGBP_MODIS_NOAH_LAKES') + ! The lakes variant is the same classification with lakes split out as an extra + ! category, so it keeps the MMINLU name (the RUC LSM then selects MODI-RUC). write(mminlu,'(a)') 'MODIFIED_IGBP_MODIS_NOAH' case default call mpas_log_write('*****************************************************************', messageType=MPAS_LOG_ERR) call mpas_log_write('Invalid land use dataset '''//trim(config_landuse_data) & //''' selected for config_landuse_data', messageType=MPAS_LOG_ERR) call mpas_log_write(' Possible options are: ''USGS'', ''MODIFIED_IGBP_MODIS_NOAH''', messageType=MPAS_LOG_ERR) - call mpas_log_write(' ''MODIFIED_IGBP_MODIS_NOAH_15s''', messageType=MPAS_LOG_ERR) + call mpas_log_write(' ''MODIFIED_IGBP_MODIS_NOAH_15s'', ''MODIFIED_IGBP_MODIS_NOAH_LAKES''', & + messageType=MPAS_LOG_ERR) call mpas_log_write('*****************************************************************', messageType=MPAS_LOG_ERR) call mpas_log_write('Please correct the namelist.', messageType=MPAS_LOG_CRIT) end select surface_input_select0 @@ -417,20 +421,31 @@ subroutine init_atm_static(mesh, dims, configs) case('MODIFIED_IGBP_MODIS_NOAH_15s') call mpas_log_write('Using 20-class MODIS 15-arc-second land cover dataset') geog_sub_path = 'modis_landuse_20class_15s/' + case('MODIFIED_IGBP_MODIS_NOAH_LAKES') + call mpas_log_write('Using 21-class MODIS 30-arc-second land cover dataset with lakes') + geog_sub_path = 'modis_landuse_20class_30s_with_lakes/' case default call mpas_log_write('*****************************************************************', messageType=MPAS_LOG_ERR) call mpas_log_write('Invalid land use dataset '''//trim(config_landuse_data) & //''' selected for config_landuse_data', messageType=MPAS_LOG_ERR) call mpas_log_write(' Possible options are: ''USGS'', ''MODIFIED_IGBP_MODIS_NOAH''', messageType=MPAS_LOG_ERR) - call mpas_log_write(' ''MODIFIED_IGBP_MODIS_NOAH_15s''', messageType=MPAS_LOG_ERR) + call mpas_log_write(' ''MODIFIED_IGBP_MODIS_NOAH_15s'', ''MODIFIED_IGBP_MODIS_NOAH_LAKES''', & + messageType=MPAS_LOG_ERR) call mpas_log_write('*****************************************************************', messageType=MPAS_LOG_ERR) call mpas_log_write('Please correct the namelist.', messageType=MPAS_LOG_CRIT) end select surface_input_select1 call mpas_log_write('--- start interpolate LU_INDEX') call interp_landuse(mesh, tree, trim(geog_data_path)//trim(geog_sub_path), isice_lu, iswater_lu, & - supersample_fac=supersample_fac_lu) + supersample_fac=supersample_fac_lu, islake_lu=islake_lu) call mpas_log_write('--- end interpolate LU_INDEX') + call mpas_log_write('--- isice_lu = $i, iswater_lu = $i, islake_lu = $i', intArgs=(/isice_lu, iswater_lu, islake_lu/)) + if (trim(config_landuse_data) == 'MODIFIED_IGBP_MODIS_NOAH_LAKES' .and. islake_lu <= 0) then + call mpas_log_write('config_landuse_data = ''MODIFIED_IGBP_MODIS_NOAH_LAKES'' needs a land use dataset whose', & + messageType=MPAS_LOG_ERR) + call mpas_log_write('index file defines islake, but '//trim(geog_data_path)//trim(geog_sub_path)//' does not.', & + messageType=MPAS_LOG_CRIT) + end if ! ! Interpolate SOILCAT_TOP @@ -465,6 +480,11 @@ subroutine init_atm_static(mesh, dims, configs) ! CORRECT INCONSISTENT SOIL AND LAND USE DATA !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! do iCell = 1,nCells + ! Lake points stay lakes (they are not turned into iswater_lu) but get water soil. + if (islake_lu > 0 .and. lu_index(iCell) == islake_lu) then + soilcat_top(iCell) = iswater_soil + cycle + end if if (lu_index(iCell) == iswater_lu .or. & soilcat_top(iCell) == iswater_soil) then if (lu_index(iCell) /= iswater_lu) then @@ -483,7 +503,7 @@ subroutine init_atm_static(mesh, dims, configs) ! Derive LANDMASK ! call mpas_log_write('--- start interpolate LANDMASK') - call derive_landmask(mesh, dims, iswater_lu) + call derive_landmask(mesh, dims, iswater_lu, islake_lu) call mpas_log_write('--- end interpolate LANDMASK') @@ -1955,7 +1975,7 @@ end subroutine categorical_interp_accumulation !> that isice and iswater are in the dataset's index file. ! !----------------------------------------------------------------------- - subroutine interp_landuse(mesh, kdtree, geog_data_path, isice_lu, iswater_lu, supersample_fac) + subroutine interp_landuse(mesh, kdtree, geog_data_path, isice_lu, iswater_lu, supersample_fac, islake_lu) implicit none @@ -1966,12 +1986,14 @@ subroutine interp_landuse(mesh, kdtree, geog_data_path, isice_lu, iswater_lu, su integer, intent(out) :: isice_lu integer, intent(out) :: iswater_lu integer, intent(in), optional :: supersample_fac + integer, intent(out), optional :: islake_lu ! Local variables type (mpas_geotile_mgr_type) :: mgr integer, pointer :: nCells integer, pointer :: isice_lu_ptr integer, pointer :: iswater_lu_ptr + integer, pointer :: islake_lu_ptr real (kind=RKIND), pointer :: scalefactor real (kind=RKIND), pointer :: landusef(:,:) @@ -1997,6 +2019,18 @@ subroutine interp_landuse(mesh, kdtree, geog_data_path, isice_lu, iswater_lu, su isice_lu = isice_lu_ptr iswater_lu = iswater_lu_ptr + if (present(islake_lu)) then + ! The geotile manager sets islake = -1 when the index file has no islake entry. + call mpas_pool_get_config(mgr % pool, 'islake', islake_lu_ptr) + islake_lu = islake_lu_ptr + end if + + ! landusef is dimensioned by nlcat (from config_landuse_data); it must match the dataset. + if (size(landusef, dim=1) /= category_max - category_min + 1) then + call mpas_log_write('Land use dataset '//trim(geog_data_path)//' has $i categories but nlcat = $i.', & + intArgs=(/category_max - category_min + 1, size(landusef, dim=1)/), messageType=MPAS_LOG_ERR) + call mpas_log_write('Check that config_landuse_data matches the dataset.', messageType=MPAS_LOG_CRIT) + end if allocate(ncat(category_min:category_max, nCells)) ncat(:,:) = 0 @@ -2126,11 +2160,12 @@ end subroutine interp_soilcat !> \details !> Derive the landmask field from lu_index. mesh should be an mpas_pool !> that contains landmask, and lu_index. iswater_lu should be the value that - !> the landuse dataset uses to signify water. Before calling this function, + !> the landuse dataset uses to signify water; lake points (islake_lu, if present + !> and positive) are also water. Before calling this function, !> the landuse dataset will need to be successfully interpolated to lu_index. ! !----------------------------------------------------------------------- - subroutine derive_landmask(mesh, dims, iswater_lu) + subroutine derive_landmask(mesh, dims, iswater_lu, islake_lu) implicit none @@ -2138,9 +2173,11 @@ subroutine derive_landmask(mesh, dims, iswater_lu) type (mpas_pool_type), intent(inout) :: mesh type (mpas_pool_type), intent(in) :: dims integer, intent(in) :: iswater_lu + integer, intent(in), optional :: islake_lu ! Local variables integer :: iCell + integer :: lake integer, pointer :: nCells integer, dimension(:), pointer :: lu_index @@ -2151,9 +2188,12 @@ subroutine derive_landmask(mesh, dims, iswater_lu) ! ! Derive LANDMASK ! + lake = -1 + if (present(islake_lu)) lake = islake_lu + landmask(:) = 0 do iCell=1, nCells - if (lu_index(iCell) /= iswater_lu) landmask(iCell) = 1 + if (lu_index(iCell) /= iswater_lu .and. lu_index(iCell) /= lake) landmask(iCell) = 1 end do end subroutine derive_landmask diff --git a/src/core_init_atmosphere/mpas_init_atm_vinterp.F b/src/core_init_atmosphere/mpas_init_atm_vinterp.F index 164cfac546..20b0dc0cec 100644 --- a/src/core_init_atmosphere/mpas_init_atm_vinterp.F +++ b/src/core_init_atmosphere/mpas_init_atm_vinterp.F @@ -40,7 +40,7 @@ real (kind=RKIND) function vertical_interp(target_z, nz, zf, order, extrap, surf integer :: k, lm, lp real (kind=RKIND) :: wm, wp - real (kind=RKIND) :: slope + real (kind=RKIND) :: slope,z_temp, t_temp, dz_temp integer :: interp_order, extrap_type real (kind=RKIND) :: surface, sealevel @@ -82,6 +82,8 @@ real (kind=RKIND) function vertical_interp(target_z, nz, zf, order, extrap, surf vertical_interp = zf(2,1) + slope * (target_z - zf(1,1)) else if (extrap_type == 2) then vertical_interp = zf(2,1) - (target_z - zf(1,1))*0.0065 + else if (extrap_type == 3) then + vertical_interp = zf(2,1) - (target_z - zf(1,1))*0.0065 end if return end if @@ -92,9 +94,80 @@ real (kind=RKIND) function vertical_interp(target_z, nz, zf, order, extrap, surf slope = (zf(2,nz) - zf(2,nz-1)) / (zf(1,nz) - zf(1,nz-1)) vertical_interp = zf(2,nz) + slope * (target_z - zf(1,nz)) else if (extrap_type == 2) then - call mpas_log_write('extrap_type == 2 not implemented for target_z >= zf(1,nz)', messageType=MPAS_LOG_ERR) - if (present(ierr)) ierr = 1 - return + z_temp = zf(1,nz) + t_temp = zf(2,nz) + + ! Layer 1: Troposphere (up to 11,000 m) + ! Gamma = -6.5 K/km (Cooling) + if (z_temp < 11000.0 .and. target_z > z_temp) then + dz_temp = min(target_z, 11000.0) - z_temp + t_temp = t_temp - 0.0065 * dz_temp + z_temp = z_temp + dz_temp + end if + + ! Layer 2: Lower Stratosphere / Tropopause (11km to 20km) + ! Gamma = 0.0 K/km (Isothermal) + if (z_temp >= 11000.0 .and. z_temp < 20000.0 .and. target_z > z_temp) then + dz_temp = min(target_z, 20000.0) - z_temp + t_temp = t_temp - 0.0 * dz_temp + z_temp = z_temp + dz_temp + end if + + ! Layer 3: Middle Stratosphere (20km to 32km) + ! Gamma = +1.0 K/km (Warming) + if (z_temp >= 20000.0 .and. z_temp < 32000.0 .and. target_z > z_temp) then + dz_temp = min(target_z, 32000.0) - z_temp + t_temp = t_temp - (-0.001) * dz_temp + z_temp = z_temp + dz_temp + end if + + ! Layer 4: Upper Stratosphere (32km to 47km) + ! Gamma = +2.8 K/km (Warming) + if (z_temp >= 32000.0 .and. z_temp < 47000.0 .and. target_z > z_temp) then + dz_temp = min(target_z, 47000.0) - z_temp + t_temp = t_temp - (-0.0028) * dz_temp + z_temp = z_temp + dz_temp + end if + + ! Layer 5: Stratopause (47km to 51km) + ! Gamma = 0.0 K/km (Isothermal) + if (z_temp >= 47000.0 .and. z_temp < 51000.0 .and. target_z > z_temp) then + dz_temp = min(target_z, 51000.0) - z_temp + t_temp = t_temp - 0.0 * dz_temp + z_temp = z_temp + dz_temp + end if + + ! Layer 6: Lower Mesosphere (51km to 71km) + ! Gamma = -2.8 K/km (Cooling) + if (z_temp >= 51000.0 .and. z_temp < 71000.0 .and. target_z > z_temp) then + dz_temp = min(target_z, 71000.0) - z_temp + t_temp = t_temp - 0.0028 * dz_temp + z_temp = z_temp + dz_temp + end if + + ! Layer 7: Upper Mesosphere (71km to 85km) + ! Gamma = -2.0 K/km (Cooling) + if (z_temp >= 71000.0 .and. z_temp < 85000.0 .and. target_z > z_temp) then + dz_temp = min(target_z, 85000.0) - z_temp + t_temp = t_temp - 0.002 * dz_temp + z_temp = z_temp + dz_temp + end if + + ! Extrapolation above 85 km is unsupported in this routine; + + if (z_temp >= 85000.0 .and. target_z > z_temp) then + write(*,'(A,ES12.5,A,ES12.5,A,I10,A)') & + 'vertical_interp: unsupported extrapolation above 85 km: target_z=', target_z, & + ', top_z=', zf(1,nz), ', nz=', nz, & + '. Adjust vertical grid/top-of-model assumptions or extend the extrapolation scheme.' + call mpas_log_write('vertical_interp failed: target_z exceeds the supported extrapolation range above 85 km. See values printed for target_z, zf(1,nz), and nz. Adjust vertical grid/top-of-model assumptions or extend the extrapolation scheme.', messageType=MPAS_LOG_ERR) + if (present(ierr)) ierr = 1 + return + end if + vertical_interp = t_temp + + else if (extrap_type == 3) then + vertical_interp = zf(2,nz) end if return end if diff --git a/testing_and_setup/ufs-community/ics/README.md b/testing_and_setup/ufs-community/ics/README.md new file mode 100644 index 0000000000..f792fba254 --- /dev/null +++ b/testing_and_setup/ufs-community/ics/README.md @@ -0,0 +1,66 @@ +# make_ics: init_atmosphere tests + +`.github/workflows/make_ics.yml` builds `init_atmosphere_model` from the branch under test and creates the static, initial-condition, lateral-boundary (and, for GFS, surface-update) files for six 120 km CONUS cases: + +| case | source | date | static land use | +|---|---|---|---| +| `conus_gfs` | GFS | 2023-03-10 15Z | 20-class MODIS | +| `conus_gfs_lake` | GFS | 2023-03-10 15Z | 21-class MODIS with lakes | +| `conus_gfs_noahmp` | GFS | 2023-03-10 15Z | 20-class MODIS; ICs for Noah-MP (see below) | +| `conus_gfs_noahmp10` | GFS | 2023-03-10 15Z | 20-class MODIS; ICs for Noah-MP with 10 soil layers | +| `conus_raps` | RAP | 2024-08-15 18Z | 20-class MODIS | +| `conus_raps_lake` | RAP | 2024-08-15 18Z | 21-class MODIS with lakes (`config_landuse_data = 'MODIFIED_IGBP_MODIS_NOAH_LAKES'`) | + +`conus_gfs`, `conus_gfs_noahmp`, `conus_gfs_noahmp10` and `conus_raps` share the 20-class static file, and `conus_gfs_lake` and `conus_raps_lake` share the 21-class one, so there are two static jobs. The summer RAP date is used because its inputs are small (1.3 GB of ungrib files, against 16 GB for winter RAP). `cases/` also defines `conus_rapw` and `conus_rapw_lake`, which can be run by hand or added to the workflow matrix. + +`conus_gfs_noahmp` makes ICs for Noah-MP, which needs 4 soil levels (the GSL namelists use 9, for RUC). Its init, LBC and sfc_update namelists are the NCAR ones from barlage/mpas_testcase (55 levels, 30 km model top, `case_files/step*/gfs.2023031015.noahmp`), as used for the `mesoscale_reference_noahmp` run tests. The Noah-MP static fields (`soilcomp`, `soilcl1`-`soilcl4`) are already in every static file, because `config_noahmp_static` defaults to true. A case picks its own init/LBC/sfc_update namelists with `nml_variant` in `cases/.sh`. + +`conus_gfs_noahmp10` is the same with `config_nsoillevels = 10`. `init_atmosphere` sets the 10 layer thicknesses (`dzs` = 0.05, 0.10, 0.10, 0.10, 0.30, 0.35, 0.50, 1.00, 1.00, 1.50 m, 5 m in all) in `src/core_atmosphere/physics/mpas_atmphys_initialize_real.F` and interpolates soil temperature and moisture to them as for 4 layers. GFS soil data and the deep soil temperature reach only 3 m, so the deepest layer (centered at 4.25 m) takes the deepest input values. + +Each case is checked with `check_ics.py`: +- the expected files exist; +- `nlcat` is 21 for the `_lake` cases and 20 for the others; +- `islake_lu` is 21 for the `_lake` cases and -1 for the others; +- in the `_lake` cases the lake points (category 21) exist and all have `landmask` 0; the others have none; +- the init file has 4 soil levels for `conus_gfs_noahmp`, 10 for `conus_gfs_noahmp10` and 9 for the others; +- for the Noah-MP cases, the static and init files hold valid `soilcomp` and `soilcl1`-`soilcl4` values over land, and every soil level of `tslb` and `smois` is plausible over land; +- the main init fields contain no NaN or Inf; +- the LBC file has the expected number of times (17 for GFS over 48 h, 2 for RAP), and GFS has an `sfc_update` file. + +The files are uploaded as `ics-` artifacts. + +The existing `run_mpas*` workflows still use the staged files from `data/get_data.sh` and are unchanged. + +## Layout + +``` +cases/.sh case settings (sourced by create_case.sh) +case_files/ init_atmosphere namelists and streams per step + step1_static/ 20-class static file + step1_static_lakes/ 21-class static file with lakes + step2_init/, step3_lbc/, step4_sst/ per source and date (.[.]) +scripts/create_case.sh runs the steps for one case +scripts/fetch_inputs.sh downloads and unpacks input bundles from a release +check_ics.py sanity checks on one case's files +copy_inputs_release.sh copies the input release from mpas-ic-factory +``` + +`scripts/` and `case_files/` come from [dustinswales/mpas-ic-factory](https://github.com/dustinswales/mpas-ic-factory), with two changes. `create_case.sh` reads `cases/.sh` instead of `cases.yaml`, so it needs no Python. `fetch_inputs.sh` streams bundle parts into `tar` one at a time, which keeps disk use down. + +## Inputs + +The workflow downloads its inputs from the release named by `INPUTS_TAG` in `make_ics.yml` (`v8.4.2-1.19`) of the repository it runs in. Copy them once from the factory release, then do the same for any other repository that runs the workflow, such as ufs-community/MPAS-Model. By default only the bundles the workflow uses are copied (grids, aerosols, geographic data including the lakes dataset, summer RAP, GFS and its SST: about 14 GB). Bundles already in the release are skipped, so re-running adds only what is missing. Add `-a` for every bundle (about 30 GB), or `-b "..."` to choose: + +```bash +bash testing_and_setup/ufs-community/ics/copy_inputs_release.sh dustinswales/MPAS-Model /path/to/work +``` + +## Running by hand + +```bash +bash scripts/fetch_inputs.sh -r dustinswales/MPAS-Model -t v8.4.2-1.19 -d inputs \ + grids geog aerosols ungrib-rap.2024081518 +MPIRUN="mpirun -np" bash scripts/create_case.sh -c conus_raps_lake \ + -e /path/to/init_atmosphere_model -i inputs -o out -n 4 +python check_ics.py out/conus.120km.rap.2024081518.lakes/case_files --source rap --lakes --lbc-times 2 +``` diff --git a/testing_and_setup/ufs-community/ics/case_files/step1_static/namelist.init_atmosphere b/testing_and_setup/ufs-community/ics/case_files/step1_static/namelist.init_atmosphere new file mode 100644 index 0000000000..46a59b5cfd --- /dev/null +++ b/testing_and_setup/ufs-community/ics/case_files/step1_static/namelist.init_atmosphere @@ -0,0 +1,57 @@ +&nhyd_model + config_init_case = 7 + config_start_time = '2023-01-01_00:00:00' + config_stop_time = '2023-01-01_00:00:00' + config_theta_adv_order = 3 + config_coef_3rd_order = 0.25 +/ +&dimensions + config_nvertlevels = 59 + config_nsoillevels = 9 + config_nfglevels = 51 + config_nfgsoillevels = 9 + config_nsoilcat = 16 + config_nvegopt = 2 +/ +&data_sources + config_geog_data_path = './mpas_static/' + config_met_prefix = 'RAP' + config_sfc_prefix = 'SST' + config_fg_interval = 10800 + config_landuse_data = 'MODIFIED_IGBP_MODIS_NOAH' + config_topo_data = 'GMTED2010' + config_vegfrac_data = 'MODIS' + config_albedo_data = 'MODIS' + config_maxsnowalbedo_data = 'MODIS' + config_supersample_factor = 3 + config_30s_supersample_factor = 1 + config_use_spechumd = true +/ +&vertical_grid + config_ztop = 25878.712 + config_nsmterrain = 1 + config_smooth_surfaces = true + config_dzmin = 0.3 + config_nsm = 30 + config_tc_vertical_grid = true + config_blend_bdy_terrain = false +/ +&interpolation_control + config_extrap_airtemp = 'lapse-rate' +/ +&preproc_stages + config_static_interp = true + config_native_gwd_static = true + config_native_gwd_gsl_static = true + config_vertical_grid = false + config_met_interp = false + config_input_sst = false + config_frac_seaice = false +/ +&io + config_pio_num_iotasks = 0 + config_pio_stride = 1 +/ +&decomposition + config_block_decomp_file_prefix = 'graph.info.part.' +/ diff --git a/testing_and_setup/ufs-community/ics/case_files/step1_static/streams.init_atmosphere b/testing_and_setup/ufs-community/ics/case_files/step1_static/streams.init_atmosphere new file mode 100644 index 0000000000..ec9474c4aa --- /dev/null +++ b/testing_and_setup/ufs-community/ics/case_files/step1_static/streams.init_atmosphere @@ -0,0 +1,20 @@ + + + + + + + + diff --git a/testing_and_setup/ufs-community/ics/case_files/step1_static_lakes/namelist.init_atmosphere b/testing_and_setup/ufs-community/ics/case_files/step1_static_lakes/namelist.init_atmosphere new file mode 100644 index 0000000000..95ff3e2d44 --- /dev/null +++ b/testing_and_setup/ufs-community/ics/case_files/step1_static_lakes/namelist.init_atmosphere @@ -0,0 +1,57 @@ +&nhyd_model + config_init_case = 7 + config_start_time = '2023-01-01_00:00:00' + config_stop_time = '2023-01-01_00:00:00' + config_theta_adv_order = 3 + config_coef_3rd_order = 0.25 +/ +&dimensions + config_nvertlevels = 59 + config_nsoillevels = 9 + config_nfglevels = 51 + config_nfgsoillevels = 9 + config_nsoilcat = 16 + config_nvegopt = 2 +/ +&data_sources + config_geog_data_path = './mpas_static/' + config_met_prefix = 'RAP' + config_sfc_prefix = 'SST' + config_fg_interval = 10800 + config_landuse_data = 'MODIFIED_IGBP_MODIS_NOAH_LAKES' + config_topo_data = 'GMTED2010' + config_vegfrac_data = 'MODIS' + config_albedo_data = 'MODIS' + config_maxsnowalbedo_data = 'MODIS' + config_supersample_factor = 3 + config_30s_supersample_factor = 1 + config_use_spechumd = true +/ +&vertical_grid + config_ztop = 25878.712 + config_nsmterrain = 1 + config_smooth_surfaces = true + config_dzmin = 0.3 + config_nsm = 30 + config_tc_vertical_grid = true + config_blend_bdy_terrain = false +/ +&interpolation_control + config_extrap_airtemp = 'lapse-rate' +/ +&preproc_stages + config_static_interp = true + config_native_gwd_static = true + config_native_gwd_gsl_static = true + config_vertical_grid = false + config_met_interp = false + config_input_sst = false + config_frac_seaice = false +/ +&io + config_pio_num_iotasks = 0 + config_pio_stride = 1 +/ +&decomposition + config_block_decomp_file_prefix = 'graph.info.part.' +/ diff --git a/testing_and_setup/ufs-community/ics/case_files/step1_static_lakes/streams.init_atmosphere b/testing_and_setup/ufs-community/ics/case_files/step1_static_lakes/streams.init_atmosphere new file mode 100644 index 0000000000..ec9474c4aa --- /dev/null +++ b/testing_and_setup/ufs-community/ics/case_files/step1_static_lakes/streams.init_atmosphere @@ -0,0 +1,20 @@ + + + + + + + + diff --git a/testing_and_setup/ufs-community/ics/case_files/step2_init/gfs.2023031015.noahmp/namelist.init_atmosphere b/testing_and_setup/ufs-community/ics/case_files/step2_init/gfs.2023031015.noahmp/namelist.init_atmosphere new file mode 100644 index 0000000000..08ca4ebc90 --- /dev/null +++ b/testing_and_setup/ufs-community/ics/case_files/step2_init/gfs.2023031015.noahmp/namelist.init_atmosphere @@ -0,0 +1,53 @@ +&nhyd_model + config_init_case = 7 + config_start_time = '2023-03-10_15:00:00' + config_stop_time = '2023-03-10_15:00:00' + config_theta_adv_order = 3 + config_coef_3rd_order = 0.25 +/ +&dimensions + config_nvertlevels = 55 + config_nsoillevels = 4 + config_nfglevels = 38 + config_nfgsoillevels = 4 +/ +&data_sources + config_geog_data_path = './mpas_static/' + config_met_prefix = 'GFS' + config_sfc_prefix = 'SST' + config_fg_interval = 10800 + config_landuse_data = 'MODIFIED_IGBP_MODIS_NOAH' + config_topo_data = 'GMTED2010' + config_vegfrac_data = 'MODIS' + config_albedo_data = 'MODIS' + config_maxsnowalbedo_data = 'MODIS' + config_supersample_factor = 3 + config_use_spechumd = false +/ +&vertical_grid + config_ztop = 30000.0 + config_nsmterrain = 1 + config_smooth_surfaces = true + config_dzmin = 0.3 + config_nsm = 30 + config_tc_vertical_grid = true + config_blend_bdy_terrain = true +/ +&interpolation_control + config_extrap_airtemp = 'linear' +/ +&preproc_stages + config_static_interp = false + config_native_gwd_static = false + config_vertical_grid = true + config_met_interp = true + config_input_sst = false + config_frac_seaice = true +/ +&io + config_pio_num_iotasks = 0 + config_pio_stride = 1 +/ +&decomposition + config_block_decomp_file_prefix = 'graph.info.part.' +/ diff --git a/testing_and_setup/ufs-community/ics/case_files/step2_init/gfs.2023031015.noahmp/streams.init_atmosphere b/testing_and_setup/ufs-community/ics/case_files/step2_init/gfs.2023031015.noahmp/streams.init_atmosphere new file mode 100644 index 0000000000..12f602304d --- /dev/null +++ b/testing_and_setup/ufs-community/ics/case_files/step2_init/gfs.2023031015.noahmp/streams.init_atmosphere @@ -0,0 +1,14 @@ + + + + + + diff --git a/testing_and_setup/ufs-community/ics/case_files/step2_init/gfs.2023031015.noahmp10/namelist.init_atmosphere b/testing_and_setup/ufs-community/ics/case_files/step2_init/gfs.2023031015.noahmp10/namelist.init_atmosphere new file mode 100644 index 0000000000..987a88a307 --- /dev/null +++ b/testing_and_setup/ufs-community/ics/case_files/step2_init/gfs.2023031015.noahmp10/namelist.init_atmosphere @@ -0,0 +1,53 @@ +&nhyd_model + config_init_case = 7 + config_start_time = '2023-03-10_15:00:00' + config_stop_time = '2023-03-10_15:00:00' + config_theta_adv_order = 3 + config_coef_3rd_order = 0.25 +/ +&dimensions + config_nvertlevels = 55 + config_nsoillevels = 10 + config_nfglevels = 38 + config_nfgsoillevels = 4 +/ +&data_sources + config_geog_data_path = './mpas_static/' + config_met_prefix = 'GFS' + config_sfc_prefix = 'SST' + config_fg_interval = 10800 + config_landuse_data = 'MODIFIED_IGBP_MODIS_NOAH' + config_topo_data = 'GMTED2010' + config_vegfrac_data = 'MODIS' + config_albedo_data = 'MODIS' + config_maxsnowalbedo_data = 'MODIS' + config_supersample_factor = 3 + config_use_spechumd = false +/ +&vertical_grid + config_ztop = 30000.0 + config_nsmterrain = 1 + config_smooth_surfaces = true + config_dzmin = 0.3 + config_nsm = 30 + config_tc_vertical_grid = true + config_blend_bdy_terrain = true +/ +&interpolation_control + config_extrap_airtemp = 'linear' +/ +&preproc_stages + config_static_interp = false + config_native_gwd_static = false + config_vertical_grid = true + config_met_interp = true + config_input_sst = false + config_frac_seaice = true +/ +&io + config_pio_num_iotasks = 0 + config_pio_stride = 1 +/ +&decomposition + config_block_decomp_file_prefix = 'graph.info.part.' +/ diff --git a/testing_and_setup/ufs-community/ics/case_files/step2_init/gfs.2023031015.noahmp10/streams.init_atmosphere b/testing_and_setup/ufs-community/ics/case_files/step2_init/gfs.2023031015.noahmp10/streams.init_atmosphere new file mode 100644 index 0000000000..12f602304d --- /dev/null +++ b/testing_and_setup/ufs-community/ics/case_files/step2_init/gfs.2023031015.noahmp10/streams.init_atmosphere @@ -0,0 +1,14 @@ + + + + + + diff --git a/testing_and_setup/ufs-community/ics/case_files/step2_init/gfs.2023031015/namelist.init_atmosphere b/testing_and_setup/ufs-community/ics/case_files/step2_init/gfs.2023031015/namelist.init_atmosphere new file mode 100644 index 0000000000..9d651ed25a --- /dev/null +++ b/testing_and_setup/ufs-community/ics/case_files/step2_init/gfs.2023031015/namelist.init_atmosphere @@ -0,0 +1,57 @@ +&nhyd_model + config_init_case = 7 + config_start_time = '2023-03-10_15:00:00' + config_stop_time = '2023-03-10_15:00:00' + config_theta_adv_order = 3 + config_coef_3rd_order = 0.25 +/ +&dimensions + config_nvertlevels = 59 + config_nsoillevels = 9 + config_nfglevels = 38 + config_nfgsoillevels = 4 + config_nsoilcat = 16 + config_nvegopt = 1 +/ +&data_sources + config_geog_data_path = './mpas_static/' + config_met_prefix = 'GFS' + config_sfc_prefix = 'SST' + config_fg_interval = 10800 + config_landuse_data = 'MODIFIED_IGBP_MODIS_NOAH' + config_topo_data = 'GMTED2010' + config_vegfrac_data = 'MODIS' + config_albedo_data = 'MODIS' + config_maxsnowalbedo_data = 'MODIS' + config_supersample_factor = 3 + config_30s_supersample_factor = 1 + config_use_spechumd = true +/ +&vertical_grid + config_ztop = 25878.712 + config_nsmterrain = 1 + config_smooth_surfaces = true + config_dzmin = 0.3 + config_nsm = 30 + config_tc_vertical_grid = true + config_blend_bdy_terrain = true +/ +&interpolation_control + config_extrap_airtemp = 'lapse-rate' +/ +&preproc_stages + config_static_interp = false + config_native_gwd_static = false + config_native_gwd_gsl_static = false + config_vertical_grid = true + config_met_interp = true + config_input_sst = false + config_frac_seaice = true +/ +&io + config_pio_num_iotasks = 0 + config_pio_stride = 1 +/ +&decomposition + config_block_decomp_file_prefix = 'graph.info.part.' +/ diff --git a/testing_and_setup/ufs-community/ics/case_files/step2_init/gfs.2023031015/streams.init_atmosphere b/testing_and_setup/ufs-community/ics/case_files/step2_init/gfs.2023031015/streams.init_atmosphere new file mode 100644 index 0000000000..12f602304d --- /dev/null +++ b/testing_and_setup/ufs-community/ics/case_files/step2_init/gfs.2023031015/streams.init_atmosphere @@ -0,0 +1,14 @@ + + + + + + diff --git a/testing_and_setup/ufs-community/ics/case_files/step2_init/rap.2024020218/namelist.init_atmosphere b/testing_and_setup/ufs-community/ics/case_files/step2_init/rap.2024020218/namelist.init_atmosphere new file mode 100644 index 0000000000..0baea2bd3a --- /dev/null +++ b/testing_and_setup/ufs-community/ics/case_files/step2_init/rap.2024020218/namelist.init_atmosphere @@ -0,0 +1,57 @@ +&nhyd_model + config_init_case = 7 + config_start_time = '2024-02-02_18:00:00' + config_stop_time = '2024-02-02_18:00:00' + config_theta_adv_order = 3 + config_coef_3rd_order = 0.25 +/ +&dimensions + config_nvertlevels = 59 + config_nsoillevels = 9 + config_nfglevels = 51 + config_nfgsoillevels = 9 + config_nsoilcat = 16 + config_nvegopt = 2 +/ +&data_sources + config_geog_data_path = './mpas_static/' + config_met_prefix = 'RAP' + config_sfc_prefix = 'SST' + config_fg_interval = 10800 + config_landuse_data = 'MODIFIED_IGBP_MODIS_NOAH' + config_topo_data = 'GMTED2010' + config_vegfrac_data = 'MODIS' + config_albedo_data = 'MODIS' + config_maxsnowalbedo_data = 'MODIS' + config_supersample_factor = 3 + config_30s_supersample_factor = 1 + config_use_spechumd = true +/ +&vertical_grid + config_ztop = 25878.712 + config_nsmterrain = 1 + config_smooth_surfaces = true + config_dzmin = 0.3 + config_nsm = 30 + config_tc_vertical_grid = true + config_blend_bdy_terrain = true +/ +&interpolation_control + config_extrap_airtemp = 'lapse-rate' +/ +&preproc_stages + config_static_interp = false + config_native_gwd_static = false + config_native_gwd_gsl_static = false + config_vertical_grid = true + config_met_interp = true + config_input_sst = false + config_frac_seaice = true +/ +&io + config_pio_num_iotasks = 0 + config_pio_stride = 1 +/ +&decomposition + config_block_decomp_file_prefix = 'graph.info.part.' +/ diff --git a/testing_and_setup/ufs-community/ics/case_files/step2_init/rap.2024020218/streams.init_atmosphere b/testing_and_setup/ufs-community/ics/case_files/step2_init/rap.2024020218/streams.init_atmosphere new file mode 100644 index 0000000000..12f602304d --- /dev/null +++ b/testing_and_setup/ufs-community/ics/case_files/step2_init/rap.2024020218/streams.init_atmosphere @@ -0,0 +1,14 @@ + + + + + + diff --git a/testing_and_setup/ufs-community/ics/case_files/step2_init/rap.2024081518/namelist.init_atmosphere b/testing_and_setup/ufs-community/ics/case_files/step2_init/rap.2024081518/namelist.init_atmosphere new file mode 100644 index 0000000000..c13f456a73 --- /dev/null +++ b/testing_and_setup/ufs-community/ics/case_files/step2_init/rap.2024081518/namelist.init_atmosphere @@ -0,0 +1,57 @@ +&nhyd_model + config_init_case = 7 + config_start_time = '2024-08-15_18:00:00' + config_stop_time = '2024-08-15_18:00:00' + config_theta_adv_order = 3 + config_coef_3rd_order = 0.25 +/ +&dimensions + config_nvertlevels = 59 + config_nsoillevels = 9 + config_nfglevels = 51 + config_nfgsoillevels = 9 + config_nsoilcat = 16 + config_nvegopt = 2 +/ +&data_sources + config_geog_data_path = './mpas_static/' + config_met_prefix = 'RAP' + config_sfc_prefix = 'SST' + config_fg_interval = 10800 + config_landuse_data = 'MODIFIED_IGBP_MODIS_NOAH' + config_topo_data = 'GMTED2010' + config_vegfrac_data = 'MODIS' + config_albedo_data = 'MODIS' + config_maxsnowalbedo_data = 'MODIS' + config_supersample_factor = 3 + config_30s_supersample_factor = 1 + config_use_spechumd = true +/ +&vertical_grid + config_ztop = 25878.712 + config_nsmterrain = 1 + config_smooth_surfaces = true + config_dzmin = 0.3 + config_nsm = 30 + config_tc_vertical_grid = true + config_blend_bdy_terrain = true +/ +&interpolation_control + config_extrap_airtemp = 'lapse-rate' +/ +&preproc_stages + config_static_interp = false + config_native_gwd_static = false + config_native_gwd_gsl_static = false + config_vertical_grid = true + config_met_interp = true + config_input_sst = false + config_frac_seaice = true +/ +&io + config_pio_num_iotasks = 0 + config_pio_stride = 1 +/ +&decomposition + config_block_decomp_file_prefix = 'graph.info.part.' +/ diff --git a/testing_and_setup/ufs-community/ics/case_files/step2_init/rap.2024081518/streams.init_atmosphere b/testing_and_setup/ufs-community/ics/case_files/step2_init/rap.2024081518/streams.init_atmosphere new file mode 100644 index 0000000000..12f602304d --- /dev/null +++ b/testing_and_setup/ufs-community/ics/case_files/step2_init/rap.2024081518/streams.init_atmosphere @@ -0,0 +1,14 @@ + + + + + + diff --git a/testing_and_setup/ufs-community/ics/case_files/step3_lbc/gfs.2023031015.noahmp/namelist.init_atmosphere b/testing_and_setup/ufs-community/ics/case_files/step3_lbc/gfs.2023031015.noahmp/namelist.init_atmosphere new file mode 100644 index 0000000000..7add9adccf --- /dev/null +++ b/testing_and_setup/ufs-community/ics/case_files/step3_lbc/gfs.2023031015.noahmp/namelist.init_atmosphere @@ -0,0 +1,53 @@ +&nhyd_model + config_init_case = 9 + config_start_time = '2023-03-10_15:00:00' + config_stop_time = '2023-03-12_15:00:00' + config_theta_adv_order = 3 + config_coef_3rd_order = 0.25 +/ +&dimensions + config_nvertlevels = 55 + config_nsoillevels = 4 + config_nfglevels = 38 + config_nfgsoillevels = 4 +/ +&data_sources + config_geog_data_path = './mpas_static/' + config_met_prefix = 'GFS' + config_sfc_prefix = 'SST' + config_fg_interval = 10800 + config_landuse_data = 'MODIFIED_IGBP_MODIS_NOAH' + config_topo_data = 'GMTED2010' + config_vegfrac_data = 'MODIS' + config_albedo_data = 'MODIS' + config_maxsnowalbedo_data = 'MODIS' + config_supersample_factor = 3 + config_use_spechumd = false +/ +&vertical_grid + config_ztop = 30000.0 + config_nsmterrain = 1 + config_smooth_surfaces = true + config_dzmin = 0.3 + config_nsm = 30 + config_tc_vertical_grid = true + config_blend_bdy_terrain = true +/ +&interpolation_control + config_extrap_airtemp = 'linear' +/ +&preproc_stages + config_static_interp = false + config_native_gwd_static = false + config_vertical_grid = true + config_met_interp = true + config_input_sst = false + config_frac_seaice = true +/ +&io + config_pio_num_iotasks = 0 + config_pio_stride = 1 +/ +&decomposition + config_block_decomp_file_prefix = 'graph.info.part.' +/ diff --git a/testing_and_setup/ufs-community/ics/case_files/step3_lbc/gfs.2023031015.noahmp/streams.init_atmosphere b/testing_and_setup/ufs-community/ics/case_files/step3_lbc/gfs.2023031015.noahmp/streams.init_atmosphere new file mode 100644 index 0000000000..5856fe52eb --- /dev/null +++ b/testing_and_setup/ufs-community/ics/case_files/step3_lbc/gfs.2023031015.noahmp/streams.init_atmosphere @@ -0,0 +1,15 @@ + + + + + + diff --git a/testing_and_setup/ufs-community/ics/case_files/step3_lbc/gfs.2023031015.noahmp10/namelist.init_atmosphere b/testing_and_setup/ufs-community/ics/case_files/step3_lbc/gfs.2023031015.noahmp10/namelist.init_atmosphere new file mode 100644 index 0000000000..77c50bf914 --- /dev/null +++ b/testing_and_setup/ufs-community/ics/case_files/step3_lbc/gfs.2023031015.noahmp10/namelist.init_atmosphere @@ -0,0 +1,53 @@ +&nhyd_model + config_init_case = 9 + config_start_time = '2023-03-10_15:00:00' + config_stop_time = '2023-03-12_15:00:00' + config_theta_adv_order = 3 + config_coef_3rd_order = 0.25 +/ +&dimensions + config_nvertlevels = 55 + config_nsoillevels = 10 + config_nfglevels = 38 + config_nfgsoillevels = 4 +/ +&data_sources + config_geog_data_path = './mpas_static/' + config_met_prefix = 'GFS' + config_sfc_prefix = 'SST' + config_fg_interval = 10800 + config_landuse_data = 'MODIFIED_IGBP_MODIS_NOAH' + config_topo_data = 'GMTED2010' + config_vegfrac_data = 'MODIS' + config_albedo_data = 'MODIS' + config_maxsnowalbedo_data = 'MODIS' + config_supersample_factor = 3 + config_use_spechumd = false +/ +&vertical_grid + config_ztop = 30000.0 + config_nsmterrain = 1 + config_smooth_surfaces = true + config_dzmin = 0.3 + config_nsm = 30 + config_tc_vertical_grid = true + config_blend_bdy_terrain = true +/ +&interpolation_control + config_extrap_airtemp = 'linear' +/ +&preproc_stages + config_static_interp = false + config_native_gwd_static = false + config_vertical_grid = true + config_met_interp = true + config_input_sst = false + config_frac_seaice = true +/ +&io + config_pio_num_iotasks = 0 + config_pio_stride = 1 +/ +&decomposition + config_block_decomp_file_prefix = 'graph.info.part.' +/ diff --git a/testing_and_setup/ufs-community/ics/case_files/step3_lbc/gfs.2023031015.noahmp10/streams.init_atmosphere b/testing_and_setup/ufs-community/ics/case_files/step3_lbc/gfs.2023031015.noahmp10/streams.init_atmosphere new file mode 100644 index 0000000000..5856fe52eb --- /dev/null +++ b/testing_and_setup/ufs-community/ics/case_files/step3_lbc/gfs.2023031015.noahmp10/streams.init_atmosphere @@ -0,0 +1,15 @@ + + + + + + diff --git a/testing_and_setup/ufs-community/ics/case_files/step3_lbc/gfs.2023031015/namelist.init_atmosphere b/testing_and_setup/ufs-community/ics/case_files/step3_lbc/gfs.2023031015/namelist.init_atmosphere new file mode 100644 index 0000000000..a491e48f41 --- /dev/null +++ b/testing_and_setup/ufs-community/ics/case_files/step3_lbc/gfs.2023031015/namelist.init_atmosphere @@ -0,0 +1,57 @@ +&nhyd_model + config_init_case = 9 + config_start_time = '2023-03-10_15:00:00' + config_stop_time = '2023-03-12_15:00:00' + config_theta_adv_order = 3 + config_coef_3rd_order = 0.25 +/ +&dimensions + config_nvertlevels = 59 + config_nsoillevels = 9 + config_nfglevels = 38 + config_nfgsoillevels = 4 + config_nsoilcat = 16 + config_nvegopt = 1 +/ +&data_sources + config_geog_data_path = './mpas_static/' + config_met_prefix = 'GFS' + config_sfc_prefix = 'SST' + config_fg_interval = 10800 + config_landuse_data = 'MODIFIED_IGBP_MODIS_NOAH' + config_topo_data = 'GMTED2010' + config_vegfrac_data = 'MODIS' + config_albedo_data = 'MODIS' + config_maxsnowalbedo_data = 'MODIS' + config_supersample_factor = 3 + config_30s_supersample_factor = 1 + config_use_spechumd = true +/ +&vertical_grid + config_ztop = 25878.712 + config_nsmterrain = 1 + config_smooth_surfaces = true + config_dzmin = 0.3 + config_nsm = 30 + config_tc_vertical_grid = true + config_blend_bdy_terrain = true +/ +&interpolation_control + config_extrap_airtemp = 'lapse-rate' +/ +&preproc_stages + config_static_interp = false + config_native_gwd_static = false + config_native_gwd_gsl_static = false + config_vertical_grid = true + config_met_interp = true + config_input_sst = false + config_frac_seaice = true +/ +&io + config_pio_num_iotasks = 0 + config_pio_stride = 1 +/ +&decomposition + config_block_decomp_file_prefix = 'graph.info.part.' +/ diff --git a/testing_and_setup/ufs-community/ics/case_files/step3_lbc/gfs.2023031015/streams.init_atmosphere b/testing_and_setup/ufs-community/ics/case_files/step3_lbc/gfs.2023031015/streams.init_atmosphere new file mode 100644 index 0000000000..5856fe52eb --- /dev/null +++ b/testing_and_setup/ufs-community/ics/case_files/step3_lbc/gfs.2023031015/streams.init_atmosphere @@ -0,0 +1,15 @@ + + + + + + diff --git a/testing_and_setup/ufs-community/ics/case_files/step3_lbc/rap.2024020218/namelist.init_atmosphere b/testing_and_setup/ufs-community/ics/case_files/step3_lbc/rap.2024020218/namelist.init_atmosphere new file mode 100644 index 0000000000..16425d018c --- /dev/null +++ b/testing_and_setup/ufs-community/ics/case_files/step3_lbc/rap.2024020218/namelist.init_atmosphere @@ -0,0 +1,57 @@ +&nhyd_model + config_init_case = 9 + config_start_time = '2024-02-02_18:00:00' + config_stop_time = '2024-02-02_21:00:00' + config_theta_adv_order = 3 + config_coef_3rd_order = 0.25 +/ +&dimensions + config_nvertlevels = 59 + config_nsoillevels = 9 + config_nfglevels = 51 + config_nfgsoillevels = 9 + config_nsoilcat = 16 + config_nvegopt = 2 +/ +&data_sources + config_geog_data_path = './mpas_static/' + config_met_prefix = 'RAP' + config_sfc_prefix = 'SST' + config_fg_interval = 10800 + config_landuse_data = 'MODIFIED_IGBP_MODIS_NOAH' + config_topo_data = 'GMTED2010' + config_vegfrac_data = 'MODIS' + config_albedo_data = 'MODIS' + config_maxsnowalbedo_data = 'MODIS' + config_supersample_factor = 3 + config_30s_supersample_factor = 1 + config_use_spechumd = true +/ +&vertical_grid + config_ztop = 25878.712 + config_nsmterrain = 1 + config_smooth_surfaces = true + config_dzmin = 0.3 + config_nsm = 30 + config_tc_vertical_grid = true + config_blend_bdy_terrain = true +/ +&interpolation_control + config_extrap_airtemp = 'lapse-rate' +/ +&preproc_stages + config_static_interp = false + config_native_gwd_static = false + config_native_gwd_gsl_static = false + config_vertical_grid = true + config_met_interp = true + config_input_sst = false + config_frac_seaice = true +/ +&io + config_pio_num_iotasks = 0 + config_pio_stride = 1 +/ +&decomposition + config_block_decomp_file_prefix = 'graph.info.part.' +/ diff --git a/testing_and_setup/ufs-community/ics/case_files/step3_lbc/rap.2024020218/streams.init_atmosphere b/testing_and_setup/ufs-community/ics/case_files/step3_lbc/rap.2024020218/streams.init_atmosphere new file mode 100644 index 0000000000..5856fe52eb --- /dev/null +++ b/testing_and_setup/ufs-community/ics/case_files/step3_lbc/rap.2024020218/streams.init_atmosphere @@ -0,0 +1,15 @@ + + + + + + diff --git a/testing_and_setup/ufs-community/ics/case_files/step3_lbc/rap.2024081518/namelist.init_atmosphere b/testing_and_setup/ufs-community/ics/case_files/step3_lbc/rap.2024081518/namelist.init_atmosphere new file mode 100644 index 0000000000..c752e40c8c --- /dev/null +++ b/testing_and_setup/ufs-community/ics/case_files/step3_lbc/rap.2024081518/namelist.init_atmosphere @@ -0,0 +1,57 @@ +&nhyd_model + config_init_case = 9 + config_start_time = '2024-08-15_18:00:00' + config_stop_time = '2024-08-15_21:00:00' + config_theta_adv_order = 3 + config_coef_3rd_order = 0.25 +/ +&dimensions + config_nvertlevels = 59 + config_nsoillevels = 9 + config_nfglevels = 51 + config_nfgsoillevels = 9 + config_nsoilcat = 16 + config_nvegopt = 2 +/ +&data_sources + config_geog_data_path = './mpas_static/' + config_met_prefix = 'RAP' + config_sfc_prefix = 'SST' + config_fg_interval = 10800 + config_landuse_data = 'MODIFIED_IGBP_MODIS_NOAH' + config_topo_data = 'GMTED2010' + config_vegfrac_data = 'MODIS' + config_albedo_data = 'MODIS' + config_maxsnowalbedo_data = 'MODIS' + config_supersample_factor = 3 + config_30s_supersample_factor = 1 + config_use_spechumd = true +/ +&vertical_grid + config_ztop = 25878.712 + config_nsmterrain = 1 + config_smooth_surfaces = true + config_dzmin = 0.3 + config_nsm = 30 + config_tc_vertical_grid = true + config_blend_bdy_terrain = true +/ +&interpolation_control + config_extrap_airtemp = 'lapse-rate' +/ +&preproc_stages + config_static_interp = false + config_native_gwd_static = false + config_native_gwd_gsl_static = false + config_vertical_grid = true + config_met_interp = true + config_input_sst = false + config_frac_seaice = true +/ +&io + config_pio_num_iotasks = 0 + config_pio_stride = 1 +/ +&decomposition + config_block_decomp_file_prefix = 'graph.info.part.' +/ diff --git a/testing_and_setup/ufs-community/ics/case_files/step3_lbc/rap.2024081518/streams.init_atmosphere b/testing_and_setup/ufs-community/ics/case_files/step3_lbc/rap.2024081518/streams.init_atmosphere new file mode 100644 index 0000000000..5856fe52eb --- /dev/null +++ b/testing_and_setup/ufs-community/ics/case_files/step3_lbc/rap.2024081518/streams.init_atmosphere @@ -0,0 +1,15 @@ + + + + + + diff --git a/testing_and_setup/ufs-community/ics/case_files/step4_sst/gfs.2023031015.noahmp/namelist.init_atmosphere b/testing_and_setup/ufs-community/ics/case_files/step4_sst/gfs.2023031015.noahmp/namelist.init_atmosphere new file mode 100644 index 0000000000..8cf4e3fcea --- /dev/null +++ b/testing_and_setup/ufs-community/ics/case_files/step4_sst/gfs.2023031015.noahmp/namelist.init_atmosphere @@ -0,0 +1,53 @@ +&nhyd_model + config_init_case = 8 + config_start_time = '2023-03-10_15:00:00' + config_stop_time = '2023-03-12_15:00:00' + config_theta_adv_order = 3 + config_coef_3rd_order = 0.25 +/ +&dimensions + config_nvertlevels = 55 + config_nsoillevels = 4 + config_nfglevels = 38 + config_nfgsoillevels = 4 +/ +&data_sources + config_geog_data_path = './mpas_static/' + config_met_prefix = 'GFS' + config_sfc_prefix = 'SST' + config_fg_interval = 10800 + config_landuse_data = 'MODIFIED_IGBP_MODIS_NOAH' + config_topo_data = 'GMTED2010' + config_vegfrac_data = 'MODIS' + config_albedo_data = 'MODIS' + config_maxsnowalbedo_data = 'MODIS' + config_supersample_factor = 3 + config_use_spechumd = false +/ +&vertical_grid + config_ztop = 30000.0 + config_nsmterrain = 1 + config_smooth_surfaces = true + config_dzmin = 0.3 + config_nsm = 30 + config_tc_vertical_grid = true + config_blend_bdy_terrain = true +/ +&interpolation_control + config_extrap_airtemp = 'linear' +/ +&preproc_stages + config_static_interp = false + config_native_gwd_static = false + config_vertical_grid = false + config_met_interp = false + config_input_sst = true + config_frac_seaice = true +/ +&io + config_pio_num_iotasks = 0 + config_pio_stride = 1 +/ +&decomposition + config_block_decomp_file_prefix = 'graph.info.part.' +/ diff --git a/testing_and_setup/ufs-community/ics/case_files/step4_sst/gfs.2023031015.noahmp/streams.init_atmosphere b/testing_and_setup/ufs-community/ics/case_files/step4_sst/gfs.2023031015.noahmp/streams.init_atmosphere new file mode 100644 index 0000000000..edd7713999 --- /dev/null +++ b/testing_and_setup/ufs-community/ics/case_files/step4_sst/gfs.2023031015.noahmp/streams.init_atmosphere @@ -0,0 +1,15 @@ + + + + + + diff --git a/testing_and_setup/ufs-community/ics/case_files/step4_sst/gfs.2023031015.noahmp10/namelist.init_atmosphere b/testing_and_setup/ufs-community/ics/case_files/step4_sst/gfs.2023031015.noahmp10/namelist.init_atmosphere new file mode 100644 index 0000000000..bb99d55de0 --- /dev/null +++ b/testing_and_setup/ufs-community/ics/case_files/step4_sst/gfs.2023031015.noahmp10/namelist.init_atmosphere @@ -0,0 +1,53 @@ +&nhyd_model + config_init_case = 8 + config_start_time = '2023-03-10_15:00:00' + config_stop_time = '2023-03-12_15:00:00' + config_theta_adv_order = 3 + config_coef_3rd_order = 0.25 +/ +&dimensions + config_nvertlevels = 55 + config_nsoillevels = 10 + config_nfglevels = 38 + config_nfgsoillevels = 4 +/ +&data_sources + config_geog_data_path = './mpas_static/' + config_met_prefix = 'GFS' + config_sfc_prefix = 'SST' + config_fg_interval = 10800 + config_landuse_data = 'MODIFIED_IGBP_MODIS_NOAH' + config_topo_data = 'GMTED2010' + config_vegfrac_data = 'MODIS' + config_albedo_data = 'MODIS' + config_maxsnowalbedo_data = 'MODIS' + config_supersample_factor = 3 + config_use_spechumd = false +/ +&vertical_grid + config_ztop = 30000.0 + config_nsmterrain = 1 + config_smooth_surfaces = true + config_dzmin = 0.3 + config_nsm = 30 + config_tc_vertical_grid = true + config_blend_bdy_terrain = true +/ +&interpolation_control + config_extrap_airtemp = 'linear' +/ +&preproc_stages + config_static_interp = false + config_native_gwd_static = false + config_vertical_grid = false + config_met_interp = false + config_input_sst = true + config_frac_seaice = true +/ +&io + config_pio_num_iotasks = 0 + config_pio_stride = 1 +/ +&decomposition + config_block_decomp_file_prefix = 'graph.info.part.' +/ diff --git a/testing_and_setup/ufs-community/ics/case_files/step4_sst/gfs.2023031015.noahmp10/streams.init_atmosphere b/testing_and_setup/ufs-community/ics/case_files/step4_sst/gfs.2023031015.noahmp10/streams.init_atmosphere new file mode 100644 index 0000000000..edd7713999 --- /dev/null +++ b/testing_and_setup/ufs-community/ics/case_files/step4_sst/gfs.2023031015.noahmp10/streams.init_atmosphere @@ -0,0 +1,15 @@ + + + + + + diff --git a/testing_and_setup/ufs-community/ics/case_files/step4_sst/gfs.2023031015/namelist.init_atmosphere b/testing_and_setup/ufs-community/ics/case_files/step4_sst/gfs.2023031015/namelist.init_atmosphere new file mode 100644 index 0000000000..69434933b7 --- /dev/null +++ b/testing_and_setup/ufs-community/ics/case_files/step4_sst/gfs.2023031015/namelist.init_atmosphere @@ -0,0 +1,57 @@ +&nhyd_model + config_init_case = 8 + config_start_time = '2023-03-10_15:00:00' + config_stop_time = '2023-03-12_15:00:00' + config_theta_adv_order = 3 + config_coef_3rd_order = 0.25 +/ +&dimensions + config_nvertlevels = 59 + config_nsoillevels = 9 + config_nfglevels = 38 + config_nfgsoillevels = 4 + config_nsoilcat = 16 + config_nvegopt = 1 +/ +&data_sources + config_geog_data_path = './mpas_static/' + config_met_prefix = 'GFS' + config_sfc_prefix = 'SST' + config_fg_interval = 10800 + config_landuse_data = 'MODIFIED_IGBP_MODIS_NOAH' + config_topo_data = 'GMTED2010' + config_vegfrac_data = 'MODIS' + config_albedo_data = 'MODIS' + config_maxsnowalbedo_data = 'MODIS' + config_supersample_factor = 3 + config_30s_supersample_factor = 1 + config_use_spechumd = true +/ +&vertical_grid + config_ztop = 25878.712 + config_nsmterrain = 1 + config_smooth_surfaces = true + config_dzmin = 0.3 + config_nsm = 30 + config_tc_vertical_grid = true + config_blend_bdy_terrain = true +/ +&interpolation_control + config_extrap_airtemp = 'lapse-rate' +/ +&preproc_stages + config_static_interp = false + config_native_gwd_static = false + config_native_gwd_gsl_static = false + config_vertical_grid = false + config_met_interp = false + config_input_sst = true + config_frac_seaice = true +/ +&io + config_pio_num_iotasks = 0 + config_pio_stride = 1 +/ +&decomposition + config_block_decomp_file_prefix = 'graph.info.part.' +/ diff --git a/testing_and_setup/ufs-community/ics/case_files/step4_sst/gfs.2023031015/streams.init_atmosphere b/testing_and_setup/ufs-community/ics/case_files/step4_sst/gfs.2023031015/streams.init_atmosphere new file mode 100644 index 0000000000..edd7713999 --- /dev/null +++ b/testing_and_setup/ufs-community/ics/case_files/step4_sst/gfs.2023031015/streams.init_atmosphere @@ -0,0 +1,15 @@ + + + + + + diff --git a/testing_and_setup/ufs-community/ics/cases/conus_gfs.sh b/testing_and_setup/ufs-community/ics/cases/conus_gfs.sh new file mode 100644 index 0000000000..8579cefced --- /dev/null +++ b/testing_and_setup/ufs-community/ics/cases/conus_gfs.sh @@ -0,0 +1,11 @@ +# make_ics case conus_gfs (sourced by scripts/create_case.sh) +domain=conus +resolution=120km +mesh=conus.120km +source=gfs +date=2023031015 +case_dir=conus.120km.gfs.2023031015 +static_key=conus-120km +static_variant= +static_nml_dir=step1_static +use_climo_aerosols=true diff --git a/testing_and_setup/ufs-community/ics/cases/conus_gfs_lake.sh b/testing_and_setup/ufs-community/ics/cases/conus_gfs_lake.sh new file mode 100644 index 0000000000..a1242b26f8 --- /dev/null +++ b/testing_and_setup/ufs-community/ics/cases/conus_gfs_lake.sh @@ -0,0 +1,11 @@ +# make_ics case conus_gfs_lake (sourced by scripts/create_case.sh) +domain=conus +resolution=120km +mesh=conus.120km +source=gfs +date=2023031015 +case_dir=conus.120km.gfs.2023031015.lakes +static_key=conus-120km-lakes +static_variant=lakes +static_nml_dir=step1_static_lakes +use_climo_aerosols=true diff --git a/testing_and_setup/ufs-community/ics/cases/conus_gfs_noahmp.sh b/testing_and_setup/ufs-community/ics/cases/conus_gfs_noahmp.sh new file mode 100644 index 0000000000..92d1d1e219 --- /dev/null +++ b/testing_and_setup/ufs-community/ics/cases/conus_gfs_noahmp.sh @@ -0,0 +1,17 @@ +# make_ics case conus_gfs_noahmp (sourced by scripts/create_case.sh) +# GFS ICs for Noah-MP: 4 soil levels (Noah-MP needs 4; the GSL namelists use 9 for RUC). +# The init/lbc/sfc_update namelists are the NCAR ones from barlage/mpas_testcase +# (55 levels, 30 km model top), as used for mesoscale_reference_noahmp. The static +# file is the 20-class one shared with conus_gfs; it already holds the Noah-MP fields +# (soilcomp, soilcl1-4), since config_noahmp_static defaults to true. +domain=conus +resolution=120km +mesh=conus.120km +source=gfs +date=2023031015 +case_dir=conus.120km.gfs.2023031015.noahmp +static_key=conus-120km +static_variant= +static_nml_dir=step1_static +nml_variant=noahmp +use_climo_aerosols=true diff --git a/testing_and_setup/ufs-community/ics/cases/conus_gfs_noahmp10.sh b/testing_and_setup/ufs-community/ics/cases/conus_gfs_noahmp10.sh new file mode 100644 index 0000000000..9b0a411168 --- /dev/null +++ b/testing_and_setup/ufs-community/ics/cases/conus_gfs_noahmp10.sh @@ -0,0 +1,17 @@ +# make_ics case conus_gfs_noahmp10 (sourced by scripts/create_case.sh) +# As conus_gfs_noahmp, with 10 soil layers for Noah-MP instead of 4: +# dzs = 0.05 0.10 0.10 0.10 0.30 0.35 0.50 1.00 1.00 1.50 m (5 m deep), set in +# init_atmosphere (src/core_atmosphere/physics/mpas_atmphys_initialize_real.F) +# when config_nsoillevels = 10. Layers centered below 3 m (the deepest GFS input +# level, where the deep soil temperature is used) take the deepest input values. +domain=conus +resolution=120km +mesh=conus.120km +source=gfs +date=2023031015 +case_dir=conus.120km.gfs.2023031015.noahmp10 +static_key=conus-120km +static_variant= +static_nml_dir=step1_static +nml_variant=noahmp10 +use_climo_aerosols=true diff --git a/testing_and_setup/ufs-community/ics/cases/conus_raps.sh b/testing_and_setup/ufs-community/ics/cases/conus_raps.sh new file mode 100644 index 0000000000..7c3901fed8 --- /dev/null +++ b/testing_and_setup/ufs-community/ics/cases/conus_raps.sh @@ -0,0 +1,11 @@ +# make_ics case conus_raps (sourced by scripts/create_case.sh) +domain=conus +resolution=120km +mesh=conus.120km +source=rap +date=2024081518 +case_dir=conus.120km.rap.2024081518 +static_key=conus-120km +static_variant= +static_nml_dir=step1_static +use_climo_aerosols=true diff --git a/testing_and_setup/ufs-community/ics/cases/conus_raps_lake.sh b/testing_and_setup/ufs-community/ics/cases/conus_raps_lake.sh new file mode 100644 index 0000000000..138fd9bb45 --- /dev/null +++ b/testing_and_setup/ufs-community/ics/cases/conus_raps_lake.sh @@ -0,0 +1,11 @@ +# make_ics case conus_raps_lake (sourced by scripts/create_case.sh) +domain=conus +resolution=120km +mesh=conus.120km +source=rap +date=2024081518 +case_dir=conus.120km.rap.2024081518.lakes +static_key=conus-120km-lakes +static_variant=lakes +static_nml_dir=step1_static_lakes +use_climo_aerosols=true diff --git a/testing_and_setup/ufs-community/ics/cases/conus_rapw.sh b/testing_and_setup/ufs-community/ics/cases/conus_rapw.sh new file mode 100644 index 0000000000..e6e4d8d757 --- /dev/null +++ b/testing_and_setup/ufs-community/ics/cases/conus_rapw.sh @@ -0,0 +1,11 @@ +# make_ics case conus_rapw (sourced by scripts/create_case.sh) +domain=conus +resolution=120km +mesh=conus.120km +source=rap +date=2024020218 +case_dir=conus.120km.rap.2024020218 +static_key=conus-120km +static_variant= +static_nml_dir=step1_static +use_climo_aerosols=true diff --git a/testing_and_setup/ufs-community/ics/cases/conus_rapw_lake.sh b/testing_and_setup/ufs-community/ics/cases/conus_rapw_lake.sh new file mode 100644 index 0000000000..d27d260da6 --- /dev/null +++ b/testing_and_setup/ufs-community/ics/cases/conus_rapw_lake.sh @@ -0,0 +1,11 @@ +# make_ics case conus_rapw_lake (sourced by scripts/create_case.sh) +domain=conus +resolution=120km +mesh=conus.120km +source=rap +date=2024020218 +case_dir=conus.120km.rap.2024020218.lakes +static_key=conus-120km-lakes +static_variant=lakes +static_nml_dir=step1_static_lakes +use_climo_aerosols=true diff --git a/testing_and_setup/ufs-community/ics/check_ics.py b/testing_and_setup/ufs-community/ics/check_ics.py new file mode 100755 index 0000000000..773fcf3d28 --- /dev/null +++ b/testing_and_setup/ufs-community/ics/check_ics.py @@ -0,0 +1,162 @@ +#!/usr/bin/env python3 +"""Sanity checks on the files made by scripts/create_case.sh for one make_ics case. + + check_ics.py CASE_FILES_DIR --source {gfs,rap} [--lakes] [--noahmp] [--soil-levels N] + [--lbc-times N] + +Checks: + - static, ugwp_oro_data, init and lbc files exist (and sfc_update for gfs) + - nlcat is 21 with --lakes, 20 otherwise + - islake_lu is 21 with --lakes, -1 (no lake category) otherwise + - with --lakes: lake points (ivgtyp == 21) exist and are all water (landmask 0); + without: no point has category 21 + - the init file has --soil-levels soil levels (default 4 with --noahmp, 9 otherwise) + - with --noahmp: the Noah-MP static fields (soilcomp, soilcl1-4) are in the static + and init files and hold valid values over land, and every soil level of tslb + and smois holds a plausible value over land (150-350 K, 0-1) + - no NaN/Inf in the main init fields + - the lbc file has --lbc-times time records (when given) +Exit status 1 if any check fails. +""" +import argparse +import glob +import os +import sys + +import numpy as np +from netCDF4 import Dataset + +NOAHMP_FIELDS = ["soilcomp", "soilcl1", "soilcl2", "soilcl3", "soilcl4"] +INIT_FIELDS = ["theta", "rho", "u", "w", "qv", "surface_pressure", "skintemp", "tslb", "smois"] + + +def one(pattern, what, failures): + files = sorted(glob.glob(pattern)) + if len(files) != 1: + failures.append(f"expected one {what} file ({os.path.basename(pattern)}), found {len(files)}") + return None + return files[0] + + +def main(): + p = argparse.ArgumentParser() + p.add_argument("case_files") + p.add_argument("--source", choices=["gfs", "rap"], required=True) + p.add_argument("--lakes", action="store_true") + p.add_argument("--noahmp", action="store_true") + p.add_argument("--soil-levels", type=int) + p.add_argument("--lbc-times", type=int) + a = p.parse_args() + + d = a.case_files + failures = [] + ok = [] + + static = one(f"{d}/mpas.*.static.nc", "static", failures) + one(f"{d}/mpas.*.ugwp_oro_data.nc", "ugwp_oro_data", failures) + init = one(f"{d}/mpas.*.init.*.nc", "init", failures) + lbc = one(f"{d}/mpas.*.lbc.*.nc", "lbc", failures) + if a.source == "gfs": + one(f"{d}/mpas.*.sfc_update.*.nc", "sfc_update", failures) + + want_nlcat = 21 if a.lakes else 20 + want_islake = 21 if a.lakes else -1 + + for path in [x for x in (static, init) if x]: + name = os.path.basename(path) + with Dataset(path) as nc: + nlcat = len(nc.dimensions["nlcat"]) if "nlcat" in nc.dimensions else None + if nlcat != want_nlcat: + failures.append(f"{name}: nlcat = {nlcat}, expected {want_nlcat}") + else: + ok.append(f"{name}: nlcat = {nlcat}") + if "islake_lu" in nc.variables: + islake = int(np.asarray(nc.variables["islake_lu"][...]).ravel()[0]) + if islake != want_islake: + failures.append(f"{name}: islake_lu = {islake}, expected {want_islake}") + else: + ok.append(f"{name}: islake_lu = {islake}") + else: + failures.append(f"{name}: no islake_lu variable") + + lu = np.asarray(nc.variables["ivgtyp"][:]).ravel() + lm = np.asarray(nc.variables["landmask"][:]).ravel() + nlake = int((lu == 21).sum()) + if a.lakes: + if nlake == 0: + failures.append(f"{name}: no lake points (ivgtyp == 21)") + elif np.any(lm[lu == 21] != 0): + failures.append(f"{name}: {int((lm[lu == 21] != 0).sum())} of {nlake} lake points have landmask != 0") + else: + ok.append(f"{name}: {nlake} lake points, all landmask = 0") + elif nlake: + failures.append(f"{name}: {nlake} points with ivgtyp == 21 without the lakes option") + + if a.noahmp: + land = lm == 1 + for v in NOAHMP_FIELDS: + if v not in nc.variables: + failures.append(f"{name}: no {v} variable (Noah-MP static field)") + continue + var = nc.variables[v] + x = np.asarray(var[:], dtype=np.float64) + # land points only: move the nCells axis first, then select + x = np.moveaxis(x, var.dimensions.index("nCells"), 0) + xl = x[land] + if not np.all(np.isfinite(xl)): + failures.append(f"{name}: {v} has NaN/Inf over land") + elif v == "soilcomp" and not np.any((xl > 0) & (xl <= 100)): + failures.append(f"{name}: soilcomp has no values in (0, 100] over land") + elif v != "soilcomp" and not np.any(xl >= 1): + failures.append(f"{name}: {v} has no soil texture class >= 1 over land") + else: + ok.append(f"{name}: {v} valid over land") + + if init: + with Dataset(init) as nc: + want_soil = a.soil_levels or (4 if a.noahmp else 9) + nsoil = len(nc.dimensions["nSoilLevels"]) if "nSoilLevels" in nc.dimensions else None + if nsoil != want_soil: + failures.append(f"{os.path.basename(init)}: nSoilLevels = {nsoil}, expected {want_soil}") + else: + ok.append(f"{os.path.basename(init)}: nSoilLevels = {nsoil}") + if a.noahmp: + land = np.asarray(nc.variables["landmask"][:]).ravel() == 1 + for v, lo, hi in (("tslb", 150.0, 350.0), ("smois", 0.0, 1.0)): + if v not in nc.variables: + continue + var = nc.variables[v] + x = np.moveaxis(np.asarray(var[:], dtype=np.float64), var.dimensions.index("nCells"), 0)[land] + x = x.reshape(x.shape[0], -1) + bad = [k + 1 for k in range(x.shape[1]) if not np.all((x[:, k] >= lo) & (x[:, k] <= hi))] + if bad: + failures.append(f"{os.path.basename(init)}: {v} outside [{lo:g}, {hi:g}] over land at soil level(s) {bad}") + else: + ok.append(f"{os.path.basename(init)}: {v} in [{lo:g}, {hi:g}] over land at all {x.shape[1]} soil levels") + for v in INIT_FIELDS: + if v not in nc.variables: + failures.append(f"{os.path.basename(init)}: missing required init field {v}") + continue + x = np.asarray(nc.variables[v][:], dtype=np.float64) + bad = int((~np.isfinite(x)).sum()) + if bad: + failures.append(f"{os.path.basename(init)}: {v} has {bad} NaN/Inf values") + ok.append(f"{os.path.basename(init)}: no NaN/Inf in {', '.join(v for v in INIT_FIELDS if v in nc.variables)}") + + if lbc and a.lbc_times is not None: + with Dataset(lbc) as nc: + nt = len(nc.dimensions["Time"]) + if nt != a.lbc_times: + failures.append(f"{os.path.basename(lbc)}: {nt} time records, expected {a.lbc_times}") + else: + ok.append(f"{os.path.basename(lbc)}: {nt} time records") + + for line in ok: + print(f" ok {line}") + for line in failures: + print(f" FAIL {line}") + sys.exit(1 if failures else 0) + + +if __name__ == "__main__": + main() diff --git a/testing_and_setup/ufs-community/ics/scripts/create_case.sh b/testing_and_setup/ufs-community/ics/scripts/create_case.sh new file mode 100755 index 0000000000..f594d2e4d4 --- /dev/null +++ b/testing_and_setup/ufs-community/ics/scripts/create_case.sh @@ -0,0 +1,341 @@ +#!/usr/bin/env bash +# +# Create MPAS static / init / lbc / sfc_update files for one case in cases/. +# Copied from dustinswales/mpas-ic-factory (scripts/create_case.sh); case settings +# come from cases/.sh instead of cases.yaml. +# Portable version of barlage/mpas_testcase create_case/create_mpas_testcase_caseNN.sh +# (GSL code and namelists): +# no Slurm, no site paths. Runs on a laptop, a GitHub runner or an HPC node. +# +# Usage: +# scripts/create_case.sh -c CASE -e INIT_ATMOSPHERE_EXE -i INPUT_DIR -o OUTPUT_DIR [options] +# +# Options: +# -c CASE case id: a file cases/CASE.sh (e.g. conus_gfs) +# -e EXE init_atmosphere_model executable +# -i INPUT_DIR input tree (see scripts/fetch_inputs.sh): +# grids/.grid.nc, grids/.graph.info +# geog/mpas_static/... (static step only) +# ungrib/./: +# ungrib/sst./SST: (gfs only) +# aerosols/QNWFA_QNIFA_SIGMA_MONTHLY.dat (use_climo_aerosols) +# -o OUTPUT_DIR final files go to OUTPUT_DIR//case_files +# -n NTASKS MPI tasks (default: nproc) +# -s STEPS comma list from static,init,lbc,sst (default: all that apply) +# -S STATIC_DIR directory holding an existing mpas.*.static.nc (and ugwp_oro_data) +# for this case; used instead of running the static step +# -w WORK_DIR run directories (default: OUTPUT_DIR/) +# -k keep the step run directories (default: remove after success) +# +# Environment: +# MPIRUN launcher prefix, task count appended (default "mpirun -n"; e.g. "srun -n") +# GPMETIS gpmetis executable (default "gpmetis") +# DESCRIBE_EXTRA file whose contents are appended to case_files/description +# +set -euo pipefail + +script_home="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" + +die() { echo "ERROR: $*" >&2; exit 1; } +banner() { + echo + echo "################################################################" + echo "# $*" + echo "################################################################" +} + +case_id="" exe="" input_dir="" output_dir="" ntasks="" steps="" static_dir="" work_root="" keep="false" +while getopts "c:e:i:o:n:s:S:w:kh" opt; do + case $opt in + c) case_id=$OPTARG ;; + e) exe=$OPTARG ;; + i) input_dir=$OPTARG ;; + o) output_dir=$OPTARG ;; + n) ntasks=$OPTARG ;; + s) steps=$OPTARG ;; + S) static_dir=$OPTARG ;; + w) work_root=$OPTARG ;; + k) keep="true" ;; + h) sed -n '2,32p' "$0"; exit 0 ;; + *) die "bad option (see -h)" ;; + esac +done +[ -n "$case_id" ] || die "-c CASE is required" +[ -n "$exe" ] || die "-e EXE is required" +[ -n "$input_dir" ] || die "-i INPUT_DIR is required" +[ -n "$output_dir" ] || die "-o OUTPUT_DIR is required" +[ -x "$exe" ] || die "executable not found: $exe" +exe="$(cd "$(dirname "$exe")" && pwd)/$(basename "$exe")" +input_dir="$(cd "$input_dir" && pwd)" +mkdir -p "$output_dir"; output_dir="$(cd "$output_dir" && pwd)" +ntasks=${ntasks:-$(nproc)} +MPIRUN=${MPIRUN:-"mpirun -n"} +GPMETIS=${GPMETIS:-gpmetis} + +# Case settings: case_id domain resolution source season date mesh case_dir +# static_key use_climo_aerosols; optional static_variant static_nml_dir +# nml_variant (init/lbc/sst namelists from case_files//..) +domain="" resolution="" source="" date="" mesh="" case_dir="" use_climo_aerosols="" +static_variant="" static_nml_dir="step1_static" nml_variant="" +case_file="$script_home/cases/$case_id.sh" +[ -f "$case_file" ] || die "unknown case '$case_id' (no $case_file)" +# shellcheck source=/dev/null +. "$case_file" + +nml_dir="$source.$date${nml_variant:+.$nml_variant}" +yyyy=${date:0:4} mm=${date:4:2} dd=${date:6:2} hh=${date:8:2} +datestring="${yyyy}-${mm}-${dd}_${hh}.00.00" +prefix="mpas.$domain.$resolution" +static_file="$prefix.static.nc" +ugwp_file="$prefix.ugwp_oro_data.nc" +init_file="$prefix.$source.init.$datestring.nc" +lbc_file="$prefix.$source.lbc.$datestring.nc" +sst_file="$prefix.$source.sfc_update.$datestring.nc" + +has_lbc=false; [ "$domain" = "conus" ] && has_lbc=true +has_sst=false; [ "$source" = "gfs" ] && has_sst=true + +if [ -z "$steps" ]; then + steps="init" + [ -z "$static_dir" ] && steps="static,$steps" + $has_lbc && steps="$steps,lbc" + $has_sst && steps="$steps,sst" +fi +want() { [[ ",$steps," == *",$1,"* ]]; } +want lbc && ! $has_lbc && die "lbc step only applies to conus (case $case_id is $domain)" +want sst && ! $has_sst && die "sst step only applies to gfs source (case $case_id is $source)" +if want init && ! want static && [ -z "$static_dir" ]; then + die "init without static: pass -S STATIC_DIR or include the static step" +fi + +case_root="$output_dir/$case_dir" +work=${work_root:-$case_root} +final="$case_root/case_files" +mkdir -p "$work" "$final" +work="$(cd "$work" && pwd)" + +grid_file="$input_dir/grids/$mesh.grid.nc" +graph_file="$input_dir/grids/$mesh.graph.info" +ungrib_met="$input_dir/ungrib/$source.$date" +ungrib_sst="$input_dir/ungrib/sst.$date" +geog_dir="$input_dir/geog/mpas_static" +aerosol_file="$input_dir/aerosols/QNWFA_QNIFA_SIGMA_MONTHLY.dat" + +# Check every input up front so a missing bundle fails before any long step runs. +if want static; then + [ -s "$grid_file" ] || die "missing $grid_file" + [ -d "$geog_dir" ] || die "missing $geog_dir" +fi +if want init || want lbc; then + [ -d "$ungrib_met" ] || die "missing $ungrib_met" + if [ "$use_climo_aerosols" = "true" ]; then + [ -s "$aerosol_file" ] || die "missing $aerosol_file (use_climo_aerosols=true)" + fi +fi +if want sst; then [ -d "$ungrib_sst" ] || die "missing $ungrib_sst"; fi + +# MPAS needs a large stack (the MPAS user guide says "ulimit -s unlimited"); +# the 8 MB default segfaults init_atmosphere on some compilers/inputs. +ulimit -s unlimited 2>/dev/null || ulimit -s "$(ulimit -H -s)" 2>/dev/null || true +export OMP_STACKSIZE=${OMP_STACKSIZE:-512M} + +banner "Configuration settings" +cat </dev/null) \ + || die "gpmetis failed for $mesh with $ntasks parts" + fi + fi + ln -sf "$part" "graph.info.part.$ntasks" +} + +stage_namelist() { # $1 = step directory name, $2 = optional dated subdirectory + local src="$script_home/case_files/$1${2:+/$2}" + [ -d "$src" ] || die "no namelist directory $src" + cp "$src"/namelist.init_atmosphere "$src"/streams.init_atmosphere . +} + +run_init_atmosphere() { # $1 = expected output file + ln -sf "$exe" init_atmosphere_model + rm -f log.init_atmosphere.* + local t0=$SECONDS rc=0 + $MPIRUN "$ntasks" ./init_atmosphere_model || rc=$? + echo "init_atmosphere_model finished in $((SECONDS - t0)) s (rc=$rc)" + local errs=(log.init_atmosphere.*.err) + [ -e "${errs[0]}" ] || errs=() + if [ $rc -ne 0 ] || [ ! -s "$1" ]; then + # Full .out log first, then the warnings/errors, so the cause ends up at the + # bottom of the CI log. ("SEAICE_FRACTIONAL/OMLD file not found" lines are + # informational: those are optional inputs.) + if [ -e log.init_atmosphere.0000.out ]; then + echo "---- tail -80 log.init_atmosphere.0000.out"; tail -80 log.init_atmosphere.0000.out + fi + for f in "${errs[@]}"; do echo "---- $f"; cat "$f"; done + echo "---- ERROR/CRITICAL lines" + grep -hE "ERROR|CRITICAL" log.init_atmosphere.* 2>/dev/null | sort -u || echo "(none in logs)" + [ -s "$1" ] || die "$1 was not created in $PWD (rc=$rc)" + die "init_atmosphere_model exited with $rc in $PWD" + elif [ ${#errs[@]} -gt 0 ]; then + echo "---- warnings (run succeeded)"; cat "${errs[@]}" + fi +} + +save_log() { # $1 = step run dir, $2 = name in case_files + [ -e "$1/log.init_atmosphere.0000.out" ] && cp "$1/log.init_atmosphere.0000.out" "$final/$2" + return 0 +} + +link_aerosols() { + if [ "$use_climo_aerosols" = "true" ]; then + [ -s "$aerosol_file" ] || die "missing $aerosol_file (use_climo_aerosols=true)" + ln -sf "$aerosol_file" . + fi +} + +banner "Start processing time: $(date -u)" + +# ------------------------------------------------------------------ +# step 1: static +# ------------------------------------------------------------------ +static_run="$work/step1_static" +if want static; then + banner "Start creating: $static_file" + [ -s "$grid_file" ] || die "missing $grid_file" + [ -d "$geog_dir" ] || die "missing $geog_dir" + rm -rf "$static_run"; mkdir -p "$static_run"; cd "$static_run" + stage_namelist "$static_nml_dir" + ln -sf "$geog_dir" mpas_static + ln -sf "$grid_file" grid.nc + partition + run_init_atmosphere static.nc + [ -s ugwp_oro_data.nc ] || die "ugwp_oro_data.nc was not created" + cp static.nc "$final/$static_file" + cp ugwp_oro_data.nc "$final/$ugwp_file" + save_log "$static_run" log.static +fi + +# Static file for the later steps. +if want init; then + if [ -n "$static_dir" ]; then + static_src="$static_dir/$static_file" + [ -s "$static_src" ] || die "no $static_file in $static_dir" + cp "$static_src" "$final/$static_file" + [ -s "$static_dir/$ugwp_file" ] || die "no $ugwp_file in $static_dir" + cp "$static_dir/$ugwp_file" "$final/$ugwp_file" + [ -e "$static_dir/log.static" ] && cp "$static_dir/log.static" "$final/log.static" + fi + [ -s "$final/$static_file" ] || die "no static file $final/$static_file" +fi + +# ------------------------------------------------------------------ +# step 2: init +# ------------------------------------------------------------------ +init_run="$work/step2_init" +if want init; then + banner "Start creating: $init_file" + [ -d "$ungrib_met" ] || die "missing $ungrib_met" + rm -rf "$init_run"; mkdir -p "$init_run"; cd "$init_run" + stage_namelist step2_init "$nml_dir" + partition + shopt -s nullglob + met0=("$ungrib_met"/*"${yyyy}-${mm}-${dd}_${hh}") + shopt -u nullglob + [ ${#met0[@]} -gt 0 ] || die "no intermediate file for ${yyyy}-${mm}-${dd}_${hh} in $ungrib_met" + ln -sf "${met0[@]}" . + ln -sf "$final/$static_file" static.nc + link_aerosols + run_init_atmosphere init.nc + mv init.nc "$final/$init_file" + save_log "$init_run" log.init +fi + +# ------------------------------------------------------------------ +# step 3: lbc (conus) +# ------------------------------------------------------------------ +lbc_run="$work/step3_lbc" +if want lbc; then + banner "Start creating: $lbc_file" + [ -s "$final/$init_file" ] || die "lbc needs $final/$init_file" + rm -rf "$lbc_run"; mkdir -p "$lbc_run"; cd "$lbc_run" + stage_namelist step3_lbc "$nml_dir" + partition + ln -sf "$ungrib_met"/* . + ln -sf "$final/$init_file" init.nc + link_aerosols + run_init_atmosphere lbc.nc + mv lbc.nc "$final/$lbc_file" + save_log "$lbc_run" log.lbc +fi + +# ------------------------------------------------------------------ +# step 4: sfc_update (gfs) +# ------------------------------------------------------------------ +sst_run="$work/step4_sst" +if want sst; then + banner "Start creating: $sst_file" + [ -s "$final/$init_file" ] || die "sst needs $final/$init_file" + [ -d "$ungrib_sst" ] || die "missing $ungrib_sst" + rm -rf "$sst_run"; mkdir -p "$sst_run"; cd "$sst_run" + stage_namelist step4_sst "$nml_dir" + partition + ln -sf "$ungrib_sst"/SST* . + ln -sf "$final/$init_file" init.nc + run_init_atmosphere sfc_update.nc + mv sfc_update.nc "$final/$sst_file" + save_log "$sst_run" log.sst +fi + +# ------------------------------------------------------------------ +# provenance +# ------------------------------------------------------------------ +cd "$final" +{ + echo "These files were created with:" + echo "case: $case_id" + echo "created (UTC): $(date -u +%Y-%m-%dT%H:%M:%SZ)" + echo "host: $(hostname)" + echo "executable: $exe" + echo "executable sha256: $(sha256sum "$exe" | cut -d' ' -f1)" + echo "launcher: $MPIRUN $ntasks" + echo "use_climo_aerosols: $use_climo_aerosols" + echo "input dir: $input_dir" + [ -s "$input_dir/INPUTS_TAG" ] && echo "inputs tag: $(cat "$input_dir/INPUTS_TAG")" + [ -n "${DESCRIBE_EXTRA:-}" ] && [ -s "$DESCRIBE_EXTRA" ] && cat "$DESCRIBE_EXTRA" + true +} > description +sha256sum mpas.*.nc > SHA256SUMS + +if [ "$keep" = "false" ]; then + rm -rf "$static_run" "$init_run" "$lbc_run" "$sst_run" "$work/partitions" +fi + +banner "Successful completion of case: $case_dir ($steps)" +ls -l "$final" +banner "End processing time: $(date -u)" diff --git a/testing_and_setup/ufs-community/ics/scripts/fetch_inputs.sh b/testing_and_setup/ufs-community/ics/scripts/fetch_inputs.sh new file mode 100755 index 0000000000..2d37dcc202 --- /dev/null +++ b/testing_and_setup/ufs-community/ics/scripts/fetch_inputs.sh @@ -0,0 +1,98 @@ +#!/usr/bin/env bash +# +# Download input bundles from a GitHub release and unpack them into INPUT_DIR. +# Copied from dustinswales/mpas-ic-factory (scripts/fetch_inputs.sh), with parts +# streamed into tar one at a time to keep disk use down on CI runners. +# +# Usage: +# scripts/fetch_inputs.sh -r OWNER/REPO -t TAG -d INPUT_DIR BUNDLE [BUNDLE ...] +# +# BUNDLE names (assets are BUNDLE.tar.gz, or BUNDLE.tar.gz.part-aa, -ab, ... when split): +# grids -> INPUT_DIR/grids/ +# geog -> INPUT_DIR/geog/mpas_static/ +# (also fetches every geog- bundle in the release, +# see tools/add_geog_dataset.sh) +# aerosols -> INPUT_DIR/aerosols/ +# ungrib-. -> INPUT_DIR/ungrib/./ (e.g. ungrib-gfs.2023031015) +# +# Every asset is checked against MANIFEST.sha256 from the same release. +# Uses the gh CLI when available (GH_TOKEN), otherwise plain https downloads +# (public repositories only). +set -euo pipefail + +die() { echo "ERROR: $*" >&2; exit 1; } + +repo="" tag="" input_dir="" +while getopts "r:t:d:" opt; do + case $opt in + r) repo=$OPTARG ;; + t) tag=$OPTARG ;; + d) input_dir=$OPTARG ;; + *) die "usage: $0 -r OWNER/REPO -t TAG -d INPUT_DIR BUNDLE..." ;; + esac +done +shift $((OPTIND - 1)) +[ -n "$repo" ] && [ -n "$tag" ] && [ -n "$input_dir" ] || die "-r, -t and -d are required" +[ $# -gt 0 ] || die "no bundles requested" + +mkdir -p "$input_dir" +input_dir="$(cd "$input_dir" && pwd)" +dl="$input_dir/.download" +mkdir -p "$dl" + +use_gh=false +if command -v gh >/dev/null 2>&1 && [ -n "${GH_TOKEN:-${GITHUB_TOKEN:-}}" ]; then use_gh=true; fi + +fetch() { # fetch asset names into $dl + if $use_gh; then + local args=() + for a in "$@"; do args+=(-p "$a"); done + gh release download "$tag" -R "$repo" -D "$dl" --clobber "${args[@]}" + else + for a in "$@"; do + curl -fL --retry 5 --retry-delay 10 -sS -o "$dl/$a" \ + "https://github.com/$repo/releases/download/$tag/$a" + done + fi +} + +if [ -e "$input_dir/INPUTS_TAG" ] && [ "$(cat "$input_dir/INPUTS_TAG")" != "$repo@$tag" ]; then + die "$input_dir contains inputs from another release; use a fresh input directory" +fi +echo "$repo@$tag" > "$input_dir/INPUTS_TAG" + +[ -s "$dl/MANIFEST.sha256" ] || fetch MANIFEST.sha256 + +# "geog" also brings in extra datasets added later as geog- bundles. +bundles=("$@") +for b in "$@"; do + if [ "$b" = geog ]; then + mapfile -t extra < <(awk '{print $2}' "$dl/MANIFEST.sha256" \ + | sed -nE 's/^(geog-[^ ]+)\.tar\.gz(\.part-[a-z]+)?$/\1/p' | sort -u) + bundles+=("${extra[@]}") + fi +done + +for bundle in "${bundles[@]}"; do + marker="$input_dir/.done.$bundle" + if [ -e "$marker" ]; then echo "$bundle: already unpacked"; continue; fi + + mapfile -t assets < <(awk '{print $2}' "$dl/MANIFEST.sha256" \ + | grep -E "^${bundle//./\\.}\.tar\.gz(\.part-[a-z]+)?$" | sort) + [ ${#assets[@]} -gt 0 ] || die "bundle '$bundle' not in release $repo@$tag" + + # One part at a time: download, verify, feed to tar, delete. Peak disk use is the + # unpacked data plus one part, instead of every part plus the unpacked data. + echo "$bundle: downloading and unpacking ${#assets[@]} asset(s)" + for a in "${assets[@]}"; do + fetch "$a" >&2 + (cd "$dl" && awk -v f="$a" '$2 == f' MANIFEST.sha256 | sha256sum -c --quiet -) >&2 \ + || { echo "ERROR: $a: checksum mismatch" >&2; exit 1; } + cat "$dl/$a" + rm -f "$dl/$a" + done | tar -xzf - -C "$input_dir" || die "$bundle: download or unpack failed" + touch "$marker" +done + +echo "$repo@$tag" > "$input_dir/INPUTS_TAG" +du -sh "$input_dir"/* 2>/dev/null || true