-
Notifications
You must be signed in to change notification settings - Fork 650
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Removing legacy code and cleaning up logic for real processing of aerosol for mp_physics=28 #1567
Conversation
@gthompsnWRF @pedro-jm could you please have a look at this? Thanks! |
@weiwangncar @dudhia |
Yes, I think so. |
@weiwangncar |
Tim, |
@twjuliano |
@davegill I fixed the merge conflict via the github PR conversation page, but then I merged develop. I think this is wrong. I'm not sure how to fix the conflict without merging develop. I can make this change locally and push a new commit if that would be easier. Thanks. |
Done: wrf-model/WPS#190 |
@twjuliano
This points to a digital filter run-time issue. I'll take a look after some meetings. |
@twjuliano
What is the aerosol climatology field? Is this something that comes in from metgrid? Is it a static look-up file in the WRF run directory? |
@davegill Great to see that it wasn't some cryptic error. That fatal comes from only one place in the code: where we check for the (new) flags, flag_qnwfa_cl and flag_qnifa_cl, which replaced flag_qnwfa and flag_qnifa for the aerosol climatology fields. So yes, this would come in from metgrid. This snag happens early on in the real processing of aerosol, but there is subsequent code that checks for these two new flags, in addition to the (new) flag_p_wif, flag_qnwfa2d, and flag_qnifa2d. Please let me know how we should best deal with this, thanks. |
@twjuliano @weiwangncar @kkeene44 |
@davegill Hi Dave, the climatology aerosol data set is available on the WRF Users page (https://www2.mmm.ucar.edu/wrf/users/physics/mp28_updated.html). It looks like it is also available on glade for those on Cheyenne: /glade/work/wrfhelp/WPS_files. For this PR, we do not modify the .dat file that is processed during metgrid. Thanks. |
@weiwangncar |
@davegill I hope I can run a test next week to see how this works. |
…osol for mp_physics=28 (wrf-model#1567) TYPE: enhancement KEYWORDS: real, Thompson aerosol-aware, microphysics SOURCE: Timothy W. Juliano and Pedro A. Jimenez (NCAR/RAL) DESCRIPTION OF CHANGES: Problem: Several modifications have been made to the Thompson Aerosol-Aware scheme (mp_physics=28) in an effort to clean the logic in dyn_em/module_initialize_real and enable more flexibility when pre-processing first guess aerosol fields (e.g., GEOS-5). These modifications are made in preparation for upcoming enhancements to the Thompson AA scheme related to the addition of black carbon aerosol (anthropogenic and biomass burning) and organic carbon biomass burning aerosol, as well as time-varying surface emissions. Solution: 1. Processing of aerosol in real.exe contained legacy code. Specifically, the monthly qnwfa and qnifa variables (qn?fa_jan, qn?fa_feb, etc.) have been removed from Registry files and dyn_em/module_initialize_real. 2. Modifications have been made to the METGRID.TBL file to simplify the subsequent logic in the real program's dyn_em/module_initialize_real. Specifically, we: * replace FLAG_QNWFA and FLAG_QNIFA with FLAG_QNWFA_CL and FLAG_QNIFA_CL, respectively, in the W_WIF_DEC and I_WIF_DEC entries, where “CL” stands for climatology; * add FLAG_QNWFA and FLAG_QNIFA to the QNWFA and QNIFA entries, respectively, for the first guess aerosol arrays; * add entry P_WIF to give the user the option to interpolate the first guess aerosol using the native pressure levels of the host model; * use num_wif_levels for any z dimension associated with the aerosol field entries (climatology or first guess); * add surface aerosol emission arrays QNWFA2D and QNIFA2D to be processed. The modifications to METGRID.TBL are as follows: ``` ======================================== name=W_WIF_DEC z_dim_name=num_wif_levels interp_option=four_pt+average_4pt flag_in_output=FLAG_QNWFA_CL ======================================== name=I_WIF_DEC z_dim_name=num_wif_levels interp_option=four_pt+average_4pt flag_in_output=FLAG_QNIFA_CL ======================================== name=QNWFA z_dim_name=num_wif_levels interp_option=four_pt+average_4pt flag_in_output=FLAG_QNWFA ======================================== name=QNIFA z_dim_name=num_wif_levels interp_option=four_pt+average_4pt flag_in_output=FLAG_QNIFA ======================================== name=P_WIF z_dim_name=num_wif_levels interp_option=four_pt+average_4pt flag_in_output=FLAG_P_WIF ======================================== name=QNWFA2D interp_option=four_pt+average_4pt flag_in_output=FLAG_QNWFA2D ======================================== name=QNIFA2D interp_option=four_pt+average_4pt flag_in_output=FLAG_QNIFA2D ======================================== ``` 3. At present, if the user sets use_aero_icbc=.true. and does not set num_wif_levels to 30, then the code executes without error, even though the climatological aerosols will not be processed properly. Therefore, we have changed the default value of num_wif_levels from 27 to 30 to prevent unintended errors when the user forgets to set this value in the namelist. We note that with our code modifications, namelist variable num_wif_levels will be used to control both climatology and first guess aerosol processing in dyn_em/module_initialize_real. 4. We have added a new (surrogate) variable, aer_init_opt (integer, default=0), that facilitates much cleaner logic in dyn_em/module_initialize_real while “working in the background” and maintaining backward-compatibility such that namelist options use_aero_icbc and use_rap_aero_icbc may be used in the same manner as before. First, in share/module_check_a_mundo, we check if the user has selected Thompson AA and either use_aero_icbc (aer_init_opt=1) or use_rap_aero_icbc (aer_init_opt=2). Here, we also ensure that if aer_init_opt>0, then wif_input_opt=1. Now, in dyn_em/module_initialize_real, we are able to simplify the logic of processing aerosol fields by using select case on aer_init_opt for both the 3D and 2D (surface emissions) aerosol processing. 5. For the 3D aerosol processing, here is the new workflow. When the user selects use_aero_icbc=.true. (i.e., aer_init_opt=1) for climatology aerosol forcing, we interpolate the aerosol fields to the WRF grid pressure levels as before. No changes have been made to the interpolation routine for use_aero_icbc. However, when the user selects use_rap_aero_icbc=.true. (i.e., aer_init_opt=2) for first guess aerosol forcing, we allow for two possibilities: * the user has pre-processed the first guess aerosol such that they are located at the native pressure levels of the host model. In this case, the user will process pressure variable p_wif during metgrid, and flag_p_wif=1, as defined in the modified METGTRID.TBL file, will be written to the met_em files. In dyn_em/module_initialize_real, we check for flag_p_wif=1 and subsequently interpolate the aerosol fields to the WRF grid pressure levels. At this stage, we do not have a way to check to ensure that the user-defined num_wif_levels in the namelist is equal to num_wif_levels written to the met_em files. For now, the best we can do is write a comment to the rsl.out files. * the user has pre-processed the first guess aerosol such that they are interpolated to the ungrib pressure levels. In this case, the user will set num_wif_levels in the namelist equal to num_metgrid_levels; otherwise, a fatal error will occur. 6. For the 2D aerosol processing, here is the new workflow. When the user selects use_aero_icbc=.true. (i.e., aer_init_opt=1) for climatology aerosol forcing, the surface water-friendly and ice-friendly emissions are processed as before. No changes have been made to these routines. However, when the user selects use_rap_aero_icbc=.true. (i.e., aer_init_opt=2) for first guess aerosol forcing, we check for the surface emission flags for water- and ice-friendly and process if they are there; otherwise, the arrays are set to zero. LIST OF MODIFIED FILES: M Registry/Registry.EM M Registry/Registry.EM_CHEM M Registry/Registry.EM_COMMON M Registry/Registry.tladj M Registry/registry.new3d_wif M dyn_em/module_initialize_real.F M share/module_check_a_mundo.F M share/module_optional_input.F TESTS CONDUCTED: 1. We have tested the logic to ensure that it catches any issues related to namelist options and flags in met_em files. Also, we have tested to make sure that the 3D aerosol fields interpolated to the WRF grid are nearly identical when using either method for aerosol first guess (i.e., interpolating using the native pressure levels of the host model versus the pre-processed aerosol on metgrid levels). 2. Jenkins tests are all PASSING RELEASE NOTE: Code enhancements are introduced to the processing of aerosol information in real.exe for the Thompson Aerosol-Aware microphysics scheme; specifically, legacy code is removed and logic in the real program is improved.
TYPE: enhancement
KEYWORDS: real, Thompson aerosol-aware, microphysics
SOURCE: Timothy W. Juliano and Pedro A. Jimenez (NCAR/RAL)
DESCRIPTION OF CHANGES:
Problem:
Several modifications have been made to the Thompson Aerosol-Aware scheme (mp_physics=28) in an effort to clean the logic in dyn_em/module_initialize_real and enable more flexibility when pre-processing first guess aerosol fields (e.g., GEOS-5). These modifications are made in preparation for upcoming enhancements to the Thompson AA scheme related to the addition of black carbon aerosol (anthropogenic and biomass burning) and organic carbon biomass burning aerosol, as well as time-varying surface emissions.
Solution:
Processing of aerosol in real.exe contained legacy code. Specifically, the monthly qnwfa and qnifa variables (qn?fa_jan, qn?fa_feb, etc.) have been removed from Registry files and dyn_em/module_initialize_real.
Modifications have been made to the METGRID.TBL file to simplify the subsequent logic in the real program's dyn_em/module_initialize_real. Specifically, we:
The modifications to METGRID.TBL are as follows:
At present, if the user sets use_aero_icbc=.true. and does not set num_wif_levels to 30, then the code executes without error, even though the climatological aerosols will not be processed properly. Therefore, we have changed the default value of num_wif_levels from 27 to 30 to prevent unintended errors when the user forgets to set this value in the namelist. We note that with our code modifications, namelist variable num_wif_levels will be used to control both climatology and first guess aerosol processing in dyn_em/module_initialize_real.
We have added a new (surrogate) variable, aer_init_opt (integer, default=0), that facilitates much cleaner logic in dyn_em/module_initialize_real while “working in the background” and maintaining backward-compatibility such that namelist options use_aero_icbc and use_rap_aero_icbc may be used in the same manner as before. First, in
share/module_check_a_mundo, we check if the user has selected Thompson AA and either use_aero_icbc (aer_init_opt=1) or use_rap_aero_icbc (aer_init_opt=2). Here, we also ensure that if aer_init_opt>0, then wif_input_opt=1. Now, in dyn_em/module_initialize_real, we are able to simplify the logic of processing aerosol fields by using select case on aer_init_opt for both the 3D and 2D (surface emissions) aerosol processing.
For the 3D aerosol processing, here is the new workflow. When the user selects use_aero_icbc=.true. (i.e., aer_init_opt=1) for climatology aerosol forcing, we interpolate the aerosol fields to the WRF grid pressure levels as before. No changes have been made to the interpolation routine for use_aero_icbc. However, when the user selects use_rap_aero_icbc=.true. (i.e., aer_init_opt=2) for first guess aerosol forcing, we allow for two possibilities:
For the 2D aerosol processing, here is the new workflow. When the user selects use_aero_icbc=.true. (i.e., aer_init_opt=1) for climatology aerosol forcing, the surface water-friendly and ice-friendly emissions are processed as before. No changes have been made to these routines. However, when the user selects use_rap_aero_icbc=.true. (i.e., aer_init_opt=2) for first guess aerosol forcing, we check for the surface emission flags for water- and ice-friendly and process if they are there; otherwise, the arrays are set to zero.
LIST OF MODIFIED FILES:
M Registry/Registry.EM
M Registry/Registry.EM_CHEM
M Registry/Registry.EM_COMMON
M Registry/Registry.tladj
M Registry/registry.new3d_wif
M dyn_em/module_initialize_real.F
M share/module_check_a_mundo.F
M share/module_optional_input.F
TESTS CONDUCTED:
RELEASE NOTE: Code enhancements are introduced to the processing of aerosol information in real.exe for the Thompson Aerosol-Aware microphysics scheme; specifically, legacy code is removed and logic in the real program is improved.