Skip to content

Commit

Permalink
Add diffusion/diag B for aerosol DA and some other needed changes (#2738
Browse files Browse the repository at this point in the history
)

This PR adds in support for computing files needed for the aerosol
analysis **B**. This includes a new task, `aeroanlgenb`. This work was
performed by both me and @andytangborn

Resolves #2501
Resolves #2737

---------

Co-authored-by: Andrew.Tangborn <[email protected]>
Co-authored-by: Walter Kolczynski - NOAA <[email protected]>
  • Loading branch information
3 people authored Aug 29, 2024
1 parent 5ccdd8b commit 7f160f6
Show file tree
Hide file tree
Showing 36 changed files with 809 additions and 201 deletions.
7 changes: 6 additions & 1 deletion env/HERA.env
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,18 @@ elif [[ "${step}" = "atmensanlfv3inc" ]]; then
export NTHREADS_ATMENSANLFV3INC=${NTHREADSmax}
export APRUN_ATMENSANLFV3INC="${APRUN} --cpus-per-task=${NTHREADS_ATMENSANLFV3INC}"

elif [[ "${step}" = "aeroanlrun" ]]; then
elif [[ "${step}" = "aeroanlvar" ]]; then

export APRUNCFP="${launcher} -n \$ncmd ${mpmd_opt}"

export NTHREADS_AEROANL=${NTHREADSmax}
export APRUN_AEROANL="${APRUN} --cpus-per-task=${NTHREADS_AEROANL}"

elif [[ "${step}" = "aeroanlgenb" ]]; then

export NTHREADS_AEROANLGENB=${NTHREADSmax}
export APRUN_AEROANLGENB="${APRUN} --cpus-per-task=${NTHREADS_AEROANLGENB}"

elif [[ "${step}" = "atmanlfv3inc" ]]; then

export NTHREADS_ATMANLFV3INC=${NTHREADSmax}
Expand Down
7 changes: 6 additions & 1 deletion env/HERCULES.env
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,17 @@ case ${step} in
export NTHREADS_ATMENSANLFV3INC=${NTHREADSmax}
export APRUN_ATMENSANLFV3INC="${APRUN} --cpus-per-task=${NTHREADS_ATMENSANLFV3INC}"
;;
"aeroanlrun")
"aeroanlvar")

export APRUNCFP="${launcher} -n \$ncmd ${mpmd_opt}"

export NTHREADS_AEROANL=${NTHREADSmax}
export APRUN_AEROANL="${APRUN} --cpus-per-task=${NTHREADS_AEROANL}"
;;
"aeroanlgenb")

export NTHREADS_AEROANLGENB=${NTHREADSmax}
export APRUN_AEROANLGENB="${APRUN} --cpus-per-task=${NTHREADS_AEROANLGENB}"
;;
"prepobsaero")

Expand Down
11 changes: 8 additions & 3 deletions env/JET.env
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,18 @@ elif [[ "${step}" = "atmensanlfv3inc" ]]; then
export NTHREADS_ATMENSANLFV3INC=${NTHREADSmax}
export APRUN_ATMENSANLFV3INC="${launcher} ${ntasks}"

elif [[ "${step}" = "aeroanlrun" ]]; then

export APRUNCFP="${launcher} -n \$ncmd ${mpmd_opt}"
elif [[ "${step}" = "aeroanlvar" ]]; then

export NTHREADS_AEROANL=${NTHREADSmax}
export APRUN_AEROANL="${APRUN}"

elif [[ "${step}" = "aeroanlgenb" ]]; then

export APRUNCFP="${launcher} -n \$ncmd ${mpmd_opt}"

export NTHREADS_AEROANLGENB=${NTHREADSmax}
export APRUN_AEROANLGENB="${APRUN} --cpus-per-task=${NTHREADS_AEROANLGENB}"

elif [[ "${step}" = "prepobsaero" ]]; then

export NTHREADS_PREPOBSAERO=${NTHREADS1}
Expand Down
7 changes: 6 additions & 1 deletion env/ORION.env
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,18 @@ elif [[ "${step}" = "atmensanlfv3inc" ]]; then
export NTHREADS_ATMENSANLFV3INC=${NTHREADSmax}
export APRUN_ATMENSANLFV3INC="${APRUN} --cpus-per-task=${NTHREADS_ATMENSANLFV3INC}"

elif [[ "${step}" = "aeroanlrun" ]]; then
elif [[ "${step}" = "aeroanlvar" ]]; then

export APRUNCFP="${launcher} -n \$ncmd ${mpmd_opt}"

export NTHREADS_AEROANL=${NTHREADSmax}
export APRUN_AEROANL="${APRUN} --cpus-per-task=${NTHREADS_AEROANL}"

elif [[ "${step}" = "aeroanlgenb" ]]; then

export NTHREADS_AEROANLGENB=${NTHREADSmax}
export APRUN_AEROANLGENB="${APRUN} --cpus-per-task=${NTHREADS_AEROANLGENB}"

elif [[ "${step}" = "prepobsaero" ]]; then

export NTHREADS_PREPOBSAERO=${NTHREADS1}
Expand Down
7 changes: 6 additions & 1 deletion env/S4.env
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,18 @@ elif [[ "${step}" = "atmensanlfv3inc" ]]; then
export NTHREADS_ATMENSANLFV3INC=${NTHREADSmax}
export APRUN_ATMENSANLFV3INC="${APRUN}"

elif [[ "${step}" = "aeroanlrun" ]]; then
elif [[ "${step}" = "aeroanlvar" ]]; then

export APRUNCFP="${launcher} -n \$ncmd ${mpmd_opt}"

export NTHREADS_AEROANL=${NTHREADSmax}
export APRUN_AEROANL="${APRUN}"

elif [[ "${step}" = "aeroanlgenb" ]]; then

export NTHREADS_AEROANLGENB=${NTHREADSmax}
export APRUN_AEROANLGENB="${APRUN} --cpus-per-task=${NTHREADS_AEROANLGENB}"

elif [[ "${step}" = "prepobsaero" ]]; then

export NTHREADS_PREPOBSAERO=${NTHREADS1}
Expand Down
7 changes: 6 additions & 1 deletion env/WCOSS2.env
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,18 @@ elif [[ "${step}" = "atmensanlfv3inc" ]]; then
export NTHREADS_ATMENSANLFV3INC=${NTHREADSmax}
export APRUN_ATMENSANLFV3INC="${APRUN}"

elif [[ "${step}" = "aeroanlrun" ]]; then
elif [[ "${step}" = "aeroanlvar" ]]; then

export APRUNCFP="${launcher} -np \$ncmd ${mpmd_opt}"

export NTHREADS_AEROANL=${NTHREADSmax}
export APRUN_AEROANL="${APRUN}"

elif [[ "${step}" = "aeroanlgenb" ]]; then

export NTHREADS_AEROANLGENB=${NTHREADSmax}
export APRUN_AEROANLGENB="${APRUN}"

elif [[ "${step}" = "prepobsaero" ]]; then

export NTHREADS_PREPOBSAERO=${NTHREADS1}
Expand Down
46 changes: 46 additions & 0 deletions jobs/JGDAS_AERO_ANALYSIS_GENERATE_BMATRIX
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#! /usr/bin/env bash

source "${HOMEgfs}/ush/preamble.sh"
source "${HOMEgfs}/ush/jjob_header.sh" -e "aeroanlgenb" -c "base aeroanl aeroanlgenb"

##############################################
# Set variables used in the script
##############################################

##############################################
# Begin JOB SPECIFIC work
##############################################

# Generate COM variables from templates
YMD=${PDY} HH=${cyc} declare_from_tmpl -rx COMIN_OBS:COM_OBS_TMPL \
COMOUT_CHEM_BMAT:COM_CHEM_BMAT_TMPL \
COMIN_ATMOS_RESTART:COM_ATMOS_RESTART_TMPL

mkdir -p "${COMOUT_CHEM_BMAT}"

###############################################################
# Run relevant script

EXSCRIPT=${GDASAEROBMATPY:-${SCRgfs}/exgdas_aero_analysis_generate_bmatrix.py}
${EXSCRIPT}
status=$?
[[ ${status} -ne 0 ]] && exit "${status}"

##############################################
# End JOB SPECIFIC work
##############################################

##############################################
# Final processing
##############################################
if [[ -e "${pgmout}" ]] ; then
cat "${pgmout}"
fi

##########################################
# Remove the Temporary working directory
##########################################
cd "${DATAROOT}" || exit 1
[[ "${KEEPDATA}" = "NO" ]] && rm -rf "${DATA}"

exit 0
16 changes: 3 additions & 13 deletions jobs/JGLOBAL_AERO_ANALYSIS_FINALIZE
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,15 @@ source "${HOMEgfs}/ush/jjob_header.sh" -e "aeroanlfinal" -c "base aeroanl aeroan
##############################################
# Set variables used in the script
##############################################
# shellcheck disable=SC2153
GDATE=$(date --utc +%Y%m%d%H -d "${PDY} ${cyc} - ${assim_freq} hours")
gPDY=${GDATE:0:8}
gcyc=${GDATE:8:2}
GDUMP="gdas"


##############################################
# Begin JOB SPECIFIC work
##############################################

# Generate COM variables from templates
YMD=${PDY} HH=${cyc} declare_from_tmpl -rx COM_OBS COM_CHEM_ANALYSIS

RUN=${GDUMP} YMD=${gPDY} HH=${gcyc} declare_from_tmpl -rx \
COM_CHEM_ANALYSIS_PREV:COM_CHEM_ANALYSIS_TMPL \
COM_ATMOS_RESTART_PREV:COM_ATMOS_RESTART_TMPL

mkdir -m 775 -p "${COM_CHEM_ANALYSIS}"
YMD=${PDY} HH=${cyc} declare_from_tmpl -rx \
COMOUT_CHEM_ANALYSIS:COM_CHEM_ANALYSIS_TMPL \
COMOUT_ATMOS_RESTART:COM_ATMOS_RESTART_TMPL

###############################################################
# Run relevant script
Expand Down
10 changes: 5 additions & 5 deletions jobs/JGLOBAL_AERO_ANALYSIS_INITIALIZE
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ GDUMP="gdas"
##############################################

# Generate COM variables from templates
YMD=${PDY} HH=${cyc} declare_from_tmpl -rx COM_OBS COM_CHEM_ANALYSIS
YMD=${PDY} HH=${cyc} declare_from_tmpl -rx \
COM_OBS:COM_OBS_TMPL \
COMOUT_CHEM_ANALYSIS:COM_CHEM_ANALYSIS_TMPL

RUN=${GDUMP} YMD=${gPDY} HH=${gcyc} declare_from_tmpl -rx \
COM_CHEM_ANALYSIS_PREV:COM_CHEM_ANALYSIS_TMPL \
COM_ATMOS_RESTART_PREV:COM_ATMOS_RESTART_TMPL

mkdir -m 775 -p "${COM_CHEM_ANALYSIS}"
COMIN_ATMOS_RESTART_PREV:COM_ATMOS_RESTART_TMPL \
COMIN_CHEM_BMAT_PREV:COM_CHEM_BMAT_TMPL

###############################################################
# Run relevant script
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
source "${HOMEgfs}/ush/preamble.sh"
export WIPE_DATA="NO"
export DATA=${DATA:-${DATAROOT}/${RUN}aeroanl_${cyc}}
source "${HOMEgfs}/ush/jjob_header.sh" -e "aeroanlrun" -c "base aeroanl aeroanlrun"
source "${HOMEgfs}/ush/jjob_header.sh" -e "aeroanlvar" -c "base aeroanl aeroanlvar"

##############################################
# Set variables used in the script
Expand All @@ -16,7 +16,7 @@ source "${HOMEgfs}/ush/jjob_header.sh" -e "aeroanlrun" -c "base aeroanl aeroanlr
###############################################################
# Run relevant script

EXSCRIPT=${GDASAERORUNSH:-${SCRgfs}/exglobal_aero_analysis_run.py}
EXSCRIPT=${GDASAEROVARSH:-${SCRgfs}/exglobal_aero_analysis_variational.py}
${EXSCRIPT}
status=$?
[[ ${status} -ne 0 ]] && exit "${status}"
Expand Down
19 changes: 19 additions & 0 deletions jobs/rocoto/aeroanlgenb.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#! /usr/bin/env bash

source "${HOMEgfs}/ush/preamble.sh"

###############################################################
# Source UFSDA workflow modules
. "${HOMEgfs}/ush/load_ufsda_modules.sh"
status=$?
[[ ${status} -ne 0 ]] && exit "${status}"

export job="aeroanlgenb"
export jobid="${job}.$$"

###############################################################

# Execute the JJOB
"${HOMEgfs}/jobs/JGDAS_AERO_ANALYSIS_GENERATE_BMATRIX"
status=$?
exit "${status}"
4 changes: 2 additions & 2 deletions jobs/rocoto/aeroanlrun.sh → jobs/rocoto/aeroanlvar.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ source "${HOMEgfs}/ush/preamble.sh"
status=$?
[[ ${status} -ne 0 ]] && exit "${status}"

export job="aeroanlrun"
export job="aeroanlvar"
export jobid="${job}.$$"

###############################################################
# Execute the JJOB
"${HOMEgfs}/jobs/JGLOBAL_AERO_ANALYSIS_RUN"
"${HOMEgfs}/jobs/JGLOBAL_AERO_ANALYSIS_VARIATIONAL"
status=$?
exit "${status}"
24 changes: 20 additions & 4 deletions parm/config/gfs/config.aeroanl
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,36 @@

echo "BEGIN: config.aeroanl"

export CASE_ANL=${CASE}
# define analysis resolution based on deterministic res
case ${CASE} in
"C1152" | "C768" | "C384" | "C192")
CASE_ANL="C192"
;;
"C96" | "C48")
CASE_ANL=${CASE}
;;
*)
echo "FATAL ERROR: Aerosol DA not supported at ${CASE} resolution"
exit 4
esac
export CASE_ANL
export OBS_LIST="${PARMgfs}/gdas/aero/obs/lists/gdas_aero.yaml.j2"
export STATICB_TYPE='identity'
export STATICB_TYPE='diffusion'
export BERROR_YAML="${PARMgfs}/gdas/aero/berror/staticb_${STATICB_TYPE}.yaml.j2"
export BERROR_DATA_DIR="${FIXgfs}/gdas/bump/aero/${CASE_ANL}/"
export BERROR_DATE="20160630.000000"
export BERROR_DATA_DIR="${FIXgfs}/gdas/aero/clim_b"

export CRTM_FIX_YAML="${PARMgfs}/gdas/aero_crtm_coeff.yaml.j2"
export JEDI_FIX_YAML="${PARMgfs}/gdas/aero_jedi_fix.yaml.j2"

export AERO_STAGE_VARIATIONAL_TMPL="${PARMgfs}/gdas/aero_stage_variational.yaml.j2"
export AERO_FINALIZE_VARIATIONAL_TMPL="${PARMgfs}/gdas/aero_finalize_variational.yaml.j2"

export io_layout_x=@IO_LAYOUT_X@
export io_layout_y=@IO_LAYOUT_Y@

export JEDIEXE="${EXECgfs}/gdas.x"
export BMATEXE="${EXECgfs}/gdasapp_chem_diagb.x"
export DIFFUSIONEXE="${EXECgfs}/gdas_fv3jedi_error_covariance_toolbox.x"

if [[ "${DOIAU}" == "YES" ]]; then
export aero_bkg_times="3,6,9"
Expand Down
29 changes: 29 additions & 0 deletions parm/config/gfs/config.aeroanlgenb
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash -x

########## config.aeroanlgenb ##########
# Aerosol Variance specific

echo "BEGIN: config.aeroanlgenb"

# Get task specific resources
source "${EXPDIR}/config.resources" aeroanlgenb

export BMATYAML="${PARMgfs}/gdas/aero/berror/aero_diagb.yaml.j2"
export DIFFUSIONYAML="${PARMgfs}/gdas/aero/berror/aero_diffusionparm.yaml.j2"
export INTERPYAML="${PARMgfs}/gdas/aero/berror/aero_interp.yaml.j2"
export AERO_BMATRIX_STAGE_TMPL="${PARMgfs}/gdas/aero_stage_bmatrix_bkg.yaml.j2"
export AERO_BMATRIX_FINALIZE_TMPL="${PARMgfs}/gdas/aero_finalize_bmatrix_bkg.yaml.j2"
export aero_diffusion_iter=10
export aero_diffusion_horiz_len=2500e3
export aero_diffusion_fixed_val=1.0
export npx_clim_b=97
export npy_clim_b=97
export aero_diagb_weight=0.9
export aero_staticb_rescaling_factor=2.0
export aero_diagb_rescale=20.0
export aero_diagb_n_halo=4
export aero_diagb_n_neighbors=16
export aero_diagb_smooth_horiz_iter=0
export aero_diagb_smooth_vert_iter=0

echo "END: config.aeroanlgenb"
11 changes: 0 additions & 11 deletions parm/config/gfs/config.aeroanlrun

This file was deleted.

11 changes: 11 additions & 0 deletions parm/config/gfs/config.aeroanlvar
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash -x

########## config.aeroanlvar ##########
# Aerosol Analysis specific

echo "BEGIN: config.aeroanlvar"

# Get task specific resources
source "${EXPDIR}/config.resources" aeroanlvar

echo "END: config.aeroanlvar"
1 change: 1 addition & 0 deletions parm/config/gfs/config.com
Original file line number Diff line number Diff line change
Expand Up @@ -98,5 +98,6 @@ declare -rx COM_ICE_GRIB_GRID_TMPL=${COM_ICE_GRIB_TMPL}'/${GRID}'

declare -rx COM_CHEM_HISTORY_TMPL=${COM_BASE}'/model/chem/history'
declare -rx COM_CHEM_ANALYSIS_TMPL=${COM_BASE}'/analysis/chem'
declare -rx COM_CHEM_BMAT_TMPL=${COM_CHEM_ANALYSIS_TMPL}'/bmatrix'

declare -rx COM_MED_RESTART_TMPL=${COM_BASE}'/model/med/restart'
Loading

0 comments on commit 7f160f6

Please sign in to comment.