Run-time option for climate GHG for radiation#1625
Run-time option for climate GHG for radiation#1625davegill merged 18 commits intowrf-model:developfrom
Conversation
TYPE: enhancement KEYWORDS: GHG, run-time SOURCE: internal DESCRIPTION OF CHANGES: Problem: Currently, you gotta use -DCLWRFGHG. Solution: Make it a run-time option. LIST OF MODIFIED FILES: modified: Registry/Registry.EM_COMMON modified: main/depend.common modified: phys/module_physics_init.F modified: phys/module_ra_cam.F modified: phys/module_ra_clWRF_support.F modified: phys/module_ra_rrtm.F modified: phys/module_ra_rrtmg_lw.F modified: phys/module_ra_rrtmg_lwf.F modified: phys/module_ra_rrtmg_sw.F modified: phys/module_ra_rrtmg_swf.F modified: share/module_check_a_mundo.F TESTS CONDUCTED: Commit 1 1. Using Jan 2000 case, OpenMP (1 vs 4 cores) is bit-for bit after second radiation step (local noon) 2. Using radiation scheme 4. 3. Still building with -DCLWRFGHG. 4. Have the .false. and .true. parts for input of GHG data 99. Jenkins are all passing RELEASE NOTE: We really want this to work.
bit-for-bit 1800 UTC + 30 min with RA LW/SW =1 serial Hmmm, forgot to test OpenMP modified: dyn_em/module_first_rk_step_part1.F modified: phys/module_ra_rrtm.F modified: phys/module_ra_sw.F modified: phys/module_radiation_driver.F
|
After RRTM commits, all pass except for ideal cases. This is OK, since the ideal cases do not link in the CAMtr dataset. There are several RRTM RA tests, so we are bit-for-bit OK. |
1. Also fixed the idealized case failure (I hope) 2. The LW and SW prints are debug level 1 3. Zapped CLWRFGHG ifdefs in the RRTMG LW and SW modified: dyn_em/start_em.F modified: phys/module_physics_init.F modified: phys/module_ra_clWRF_support.F modified: phys/module_ra_rrtmg_lw.F modified: phys/module_ra_rrtmg_sw.F modified: phys/module_radiation_driver.F
1 vs 4 OMP threads: RRTMG LW + RRTMG SW = B4B RRTMG LWF + RRTMG SWF = DIFFS RRTMG LWF + RRTMG SW = DIFFS RRTMG LW + RRTMG SWF = DIFFS Ergo look for troubles in LWF modified: module_ra_rrtmg_lwf.F modified: module_ra_rrtmg_swf.F modified: module_radiation_driver.F
Took all of Ming's module_ra_cam.F, and most of the support file. Getting bit-for-bit OpenMP 1 vs 4 cores with ghg_input=1 with radiation =3 modified: phys/module_ra_cam.F modified: phys/module_ra_cam_support.F modified: phys/module_radiation_driver.F
|
@weiwangncar @smileMchen I used Wei's ifdefs and Ming's code for a guide. I also stole most of Ming's commit message. I would request that we test this PR out to see if it does what it is supposed to do. |
|
jenkins is OK |
|
@davegill |
|
Out of curiosity, is it really necessary to pass |
|
@davegill |
|
@smileMchen Thanks for the tests. If you run the old and new code with dmpar only using GHG, do you get identical results? |
I noticed those also. Those "fatal" messages may have been inside the ifdefs so that that the code could be portable. Maybe? Since this is basically "all WRF" now, I agree that we can remove those extra "if(ghg_input.eq.1)" tests. |
|
@weiwangncar @smileMchen |
|
@davegill @smileMchen I'm ok with interpolating data at every radiation step. |
|
@weiwangncar |
|
@smileMchen Are the tests using OpenMP or MPI? |
I would agree that ghg_input probably won't need to pass into get_aerosol and then vertical interpolation routine. The purpose is not exactly clear. |
|
@weiwangncar |
@smileMchen You're probably correct. I just want to make sure the change from this PR didn't change results. |
|
@davegill I'd like to see the values of these gases printed out at the beginning of the run so that the user know what values are used. Can it be done in phy_init? I see that julday is available, and we probably need to get the year value, from start_of_simulation perhaps? We can also do this possibly from module_ra_rrtmg_sw.F where xtime is available already. |
In phy_init, we have the year and julian day, which gives a good approximation for the values that are interpolated from a list with annual entries. The output is of the form: GHG annual values from CAM trace gas file Year = 2000 , Julian day = 24 CO2 = 3.6827643623706102E-004 volume mixing ratio N2O = 3.1561992003869092E-007 volume mixing ratio CH4 = 1.7503323494141789E-006 volume mixing ratio CFC11 = 3.7251522800792205E-010 volume mixing ratio CFC12 = 5.3623524377057688E-010 volume mixing ratio modified: phys/module_physics_init.F
I left it alone in the CAM routine, but cleaned it up elsewhere. It was ridiculous! |
Shared socio-economic pathway: 2 Representative concentration pathway: 4.5 The period based on historical data reaches 2014 in SSP. An intermediate pathway (e.g. SSP245) could be used as default for past runs since there is not much difference among scenarios in the 2015-2021 period. modified: Makefile
modified: run/README.namelist
|
@weiwangncar @dudhia @smileMchen But in the RRTM scheme, we have a constant for CO2: Is this OK? |
|
@smileMchen |
|
@davegill |
modified: module_ra_rrtm.F
modified: run/README.namelist
modified: output_wrf.F
|
@weiwangncar @smileMchen Folks, |
|
@smileMchen Can you check out this branch and run a pair of tests with ghg_opt = 1 and 0, and provide a few difference plots similar to what you have done before? |
|
I recommend adding a difference plot for a short forecast of T2 and downward LW at the surface to see the difference from the old option. |
|
Agree. I will rerun the cases and save 1-hour outputs. |
TYPE: bug fix KEYWORDS: netcdfpar, Error SOURCE: internal DESCRIPTION OF CHANGES: IMPORTANT: Without these mods, every commit since the parallel netcdf4 IO mods will fail the DA build test in the regression test. For example, at least these commits: ``` fed10f4 Adding the WRF-Solar EPS model (#1547) 0bda5e0 Fix 4dvar build failure after commit 8b5bfe5 (#1652) 8b5bfe5 Thompson AA enhancements: BC aerosol, biomass burning emissions, and … (#1616) 9dc68ca After testing with UFS/GFS/FV-3, some tuning knob changes to Thompson-MP and icloud3 (cloud fraction) scheme (#1626) 96fd889 Update HONO, TERP, and CO2 emissions (#1644) 64fb190 SFCLAY=1, add shallow water roughness calculation (#1543) 609c2fc New module firebrand_spotting for WRF-Fire (#1540) 75bfe6d MYNN PBL clouds in photolysis option 4 (TUV) (#1622) f8c4b13 Fix runtime error when using sf_surface_mosaic = 1 with use_wudapt_lcz = 0 (#1638) b511c70 Run-time option for climate GHG for radiation (#1625) 8194c66 Bug fix for configuration option INTEL:HSW/BDW (#1645) 16c9287 bug fixes for radar_rf_opt=2 (#1642) a82ce24 Sync with NoahMP Github version with all NoahMP updates since v4.3 (#1641) 7b642cc Bug fix for TAMDAR T VarBC (#1632) 92fd706 fix WRFDA build for Parallel netcdf-4 IO (#1634) ``` Problem: With PR #1552 "Parallel netcdf-4 IO option" (SHA1 3cd4713), when then code was built without the new parallel NetCDF4 compression, the build log had an `Error`. ``` > grep Error compile.log Fatal Error: Cannot open module file ‘wrf_data_ncpar.mod’ for reading at (1): No such file or directory make[2]: [diffwrf] Error 1 (ignored) make[2]: [diffwrf] Error 1 (ignored) wrf_io.f:117: Error: Can't open included file 'mpif.h' make[2]: [wrf_io.o] Error 1 (ignored) Fatal Error: Cannot open module file ‘wrf_data_ncpar.mod’ for reading at (1): No such file or directory make[2]: [field_routines.o] Error 1 (ignored) make[2]: [libwrfio_nfpar.a] Error 127 (ignored) make[2]: [libwrfio_nfpar.a] Error 1 (ignored) ``` The problem was related to constructing the object files in the io_netcdfpar directory. When the option is not selected at compile time, then we do not care about errors in the directory that will never be used. Solution: If the NETCDFPAR option is not selected at compile time, then SKIP going into the io_netcdfpar directory all together. LIST OF MODIFIED FILES: m Makefile m arch/Config.pl m arch/configure.defaults m configure TESTS CONDUCTED: 1. Without the NETCDFPAR parameter set, the build for the io_netcdfpar directory is bypassed: ``` cd ../io_netcdfpar ; \ echo SKIPPING make -i -r NETCDFPARPATH="/glade/u/apps/ch/opt/netcdf/4.7.3/gnu/9.1.0" \ cd ../io_netcdfpar ; \ echo SKIPPING make -i -r NETCDFPARPATH="/glade/u/apps/ch/opt/netcdf/4.7.3/gnu/9.1.0" \ ``` 2. When the NETCDFPAR env variable is set, the build includes the io_netcdfpar directory: cd ../io_netcdfpar ; \ make -i -r NETCDFPARPATH="/glade/u/apps/ch/opt/netcdf/4.8.0/gnu/9.1.0" \ cd ../io_netcdfpar ; \ make -i -r NETCDFPARPATH="/glade/u/apps/ch/opt/netcdf/4.8.0/gnu/9.1.0" \ ``` 3. Jenkins tests are all PASS.
TYPE: enhancement KEYWORDS: GHG, run-time, radiation, green house gas SOURCE: internal DESCRIPTION OF CHANGES: This PR improves the way to handle green house gases in radiation schemes (CAM, RRTMG, RRTMGF, RRTM). Previously green house gases (GHGs) were either specified to be constant values or read from historical gas concentration datasets (CAMtr). Note that the latter only worked when the WRF code was compiled with the macro flag `-DCLWRFGHG`. This PR modifies the radiation schemes so that input of GHG concentration from CAMtr becomes a run-time option. The old approach of specifying a time invariant value for the GHG concentrations remains available for backward consistency. This PR is a reworking of "Run-time option of GHG concentration from various climate RCPs" wrf-model#1611. ISSUE: CLWRF tracer gases are not used in RRTMG shortwave code Fixes wrf-model#1597 LIST OF MODIFIED FILES: M Makefile M Registry/Registry.EM_COMMON M clean M dyn_em/module_first_rk_step_part1.F M dyn_em/start_em.F M main/depend.common M phys/module_physics_init.F M phys/module_ra_cam.F M phys/module_ra_cam_support.F M phys/module_ra_clWRF_support.F M phys/module_ra_rrtm.F M phys/module_ra_rrtmg_lw.F M phys/module_ra_rrtmg_lwf.F M phys/module_ra_rrtmg_sw.F M phys/module_ra_rrtmg_swf.F M phys/module_ra_sw.F M phys/module_radiation_driver.F M run/README.namelist M share/module_check_a_mundo.F M share/output_wrf.F TESTS CONDUCTED: After all of the commits, testing conducted by Ming Chen: 1. Shown below are differences in T2, LWDNB and SWDNB between RRTMG runs with GHG_INPUT=1 and GHG_INPUT=0 after 18 hours of integration. This is a case initialized at 00 UTC 23 February 2017. We do see impacts caused by GHG changes. <img width="372" alt="T2" src="https://user-images.githubusercontent.com/17932265/149973558-4f654474-f107-4118-9ec4-132f43efd59b.png"> <img width="399" alt="LWDNB" src="https://user-images.githubusercontent.com/17932265/149973580-fa0415d0-96d5-4fad-9a5f-7c2d70e73969.png"> <img width="343" alt="SWDNB" src="https://user-images.githubusercontent.com/17932265/149973603-0f1fce93-e944-4d53-aaa4-46d3639365df.png"> 2. Results here show the differences in T2 and LWDNB after 1-hour of integration between runs with specified and time-varying greenhouse gases, respectively. This is a case using RRTMG radiation scheme. <img width="435" alt="t2new" src="https://user-images.githubusercontent.com/17932265/150200146-4483eb33-3e3c-452b-a3d7-4dc4e26fda24.png"> <img width="445" alt="lwdnbnew" src="https://user-images.githubusercontent.com/17932265/150200167-fb4ef228-4434-4397-9c30-e17825343b7f.png"> RELEASE NOTE: Climatology green house gas (GHG) concentrations from a number of RCPs and newer SSPs are now a run-time option in the WRFV4.4 (previously, they were a compile-time option). This serves two purposes: 1) Since the data files provide compiled global climatological values for co2, n2o, ch4, cfc11 and cfc12 up to 2006 for RCPs and 2014 for SSPs, they are better estimates for historical and current runs. 2) If users have values of their own, they can be easily added to the data file. The user specifies `ghg_input=1` in the physics namelist record for climatology, which is the default in v4.4, or `ghg_input=0` for constant values for backward compatibility. The default file used is CAMtr_volume_mixing_ratio.SSP245, added to the model via PR#[1553](wrf-model#1553). A simple function for CO2 is now the default when choosing to not use the climo GHG files for RRTM - previously this function is only in RRTMG schemes. This option is only available for radiation schemes of CAM, RRTMG, RRTMGF and RRTM.
TYPE: bug fix KEYWORDS: netcdfpar, Error SOURCE: internal DESCRIPTION OF CHANGES: IMPORTANT: Without these mods, every commit since the parallel netcdf4 IO mods will fail the DA build test in the regression test. For example, at least these commits: ``` fed10f4 Adding the WRF-Solar EPS model (wrf-model#1547) 0bda5e0 Fix 4dvar build failure after commit 8b5bfe5 (wrf-model#1652) 8b5bfe5 Thompson AA enhancements: BC aerosol, biomass burning emissions, and … (wrf-model#1616) 9dc68ca After testing with UFS/GFS/FV-3, some tuning knob changes to Thompson-MP and icloud3 (cloud fraction) scheme (wrf-model#1626) 96fd889 Update HONO, TERP, and CO2 emissions (wrf-model#1644) 64fb190 SFCLAY=1, add shallow water roughness calculation (wrf-model#1543) 609c2fc New module firebrand_spotting for WRF-Fire (wrf-model#1540) 75bfe6d MYNN PBL clouds in photolysis option 4 (TUV) (wrf-model#1622) f8c4b13 Fix runtime error when using sf_surface_mosaic = 1 with use_wudapt_lcz = 0 (wrf-model#1638) b511c70 Run-time option for climate GHG for radiation (wrf-model#1625) 8194c66 Bug fix for configuration option INTEL:HSW/BDW (wrf-model#1645) 16c9287 bug fixes for radar_rf_opt=2 (wrf-model#1642) a82ce24 Sync with NoahMP Github version with all NoahMP updates since v4.3 (wrf-model#1641) 7b642cc Bug fix for TAMDAR T VarBC (wrf-model#1632) 92fd706 fix WRFDA build for Parallel netcdf-4 IO (wrf-model#1634) ``` Problem: With PR wrf-model#1552 "Parallel netcdf-4 IO option" (SHA1 3cd4713), when then code was built without the new parallel NetCDF4 compression, the build log had an `Error`. ``` > grep Error compile.log Fatal Error: Cannot open module file ‘wrf_data_ncpar.mod’ for reading at (1): No such file or directory make[2]: [diffwrf] Error 1 (ignored) make[2]: [diffwrf] Error 1 (ignored) wrf_io.f:117: Error: Can't open included file 'mpif.h' make[2]: [wrf_io.o] Error 1 (ignored) Fatal Error: Cannot open module file ‘wrf_data_ncpar.mod’ for reading at (1): No such file or directory make[2]: [field_routines.o] Error 1 (ignored) make[2]: [libwrfio_nfpar.a] Error 127 (ignored) make[2]: [libwrfio_nfpar.a] Error 1 (ignored) ``` The problem was related to constructing the object files in the io_netcdfpar directory. When the option is not selected at compile time, then we do not care about errors in the directory that will never be used. Solution: If the NETCDFPAR option is not selected at compile time, then SKIP going into the io_netcdfpar directory all together. LIST OF MODIFIED FILES: m Makefile m arch/Config.pl m arch/configure.defaults m configure TESTS CONDUCTED: 1. Without the NETCDFPAR parameter set, the build for the io_netcdfpar directory is bypassed: ``` cd ../io_netcdfpar ; \ echo SKIPPING make -i -r NETCDFPARPATH="/glade/u/apps/ch/opt/netcdf/4.7.3/gnu/9.1.0" \ cd ../io_netcdfpar ; \ echo SKIPPING make -i -r NETCDFPARPATH="/glade/u/apps/ch/opt/netcdf/4.7.3/gnu/9.1.0" \ ``` 2. When the NETCDFPAR env variable is set, the build includes the io_netcdfpar directory: cd ../io_netcdfpar ; \ make -i -r NETCDFPARPATH="/glade/u/apps/ch/opt/netcdf/4.8.0/gnu/9.1.0" \ cd ../io_netcdfpar ; \ make -i -r NETCDFPARPATH="/glade/u/apps/ch/opt/netcdf/4.8.0/gnu/9.1.0" \ ``` 3. Jenkins tests are all PASS.





TYPE: enhancement
KEYWORDS: GHG, run-time, radiation, green house gas
SOURCE: internal
DESCRIPTION OF CHANGES:
This PR improves the way to handle green house gases in radiation schemes (CAM, RRTMG, RRTMGF, RRTM). Previously green house gases (GHGs) were either specified to be constant values or read from historical gas concentration datasets (CAMtr). Note that the latter only worked when the WRF code was compiled with the macro flag
-DCLWRFGHG. This PR modifies the radiation schemes so that input of GHG concentration from CAMtr becomes a run-time option. The old approach of specifying a time invariant value for the GHG concentrations remains available for backward consistency.This PR is a reworking of "Run-time option of GHG concentration from various climate RCPs" #1611.
ISSUE: CLWRF tracer gases are not used in RRTMG shortwave code
Fixes #1597
LIST OF MODIFIED FILES:
M Makefile
M Registry/Registry.EM_COMMON
M clean
M dyn_em/module_first_rk_step_part1.F
M dyn_em/start_em.F
M main/depend.common
M phys/module_physics_init.F
M phys/module_ra_cam.F
M phys/module_ra_cam_support.F
M phys/module_ra_clWRF_support.F
M phys/module_ra_rrtm.F
M phys/module_ra_rrtmg_lw.F
M phys/module_ra_rrtmg_lwf.F
M phys/module_ra_rrtmg_sw.F
M phys/module_ra_rrtmg_swf.F
M phys/module_ra_sw.F
M phys/module_radiation_driver.F
M run/README.namelist
M share/module_check_a_mundo.F
M share/output_wrf.F
TESTS CONDUCTED:
After all of the commits, testing conducted by Ming Chen:
GHG_INPUT=0 after 18 hours of integration. This is a case initialized at 00 UTC 23 February
RELEASE NOTE: Climatology green house gas (GHG) concentrations from a number of RCPs and newer SSPs are now a run-time option in the WRFV4.4 (previously, they were a compile-time option). This serves two purposes: 1) Since the data files provide compiled global climatological values for co2, n2o, ch4, cfc11 and cfc12 up to 2006 for RCPs and 2014 for SSPs, they are better estimates for historical and current runs. 2) If users have values of their own, they can be easily added to the data file. The user specifies
ghg_input=1in the physics namelist record for climatology, which is the default in v4.4, orghg_input=0for constant values for backward compatibility. The default file used is CAMtr_volume_mixing_ratio.SSP245, added to the model via PR#1553. A simple function for CO2 is now the default when choosing to not use the climo GHG files for RRTM - previously this function is only in RRTMG schemes. This option is only available for radiation schemes of CAM, RRTMG, RRTMGF and RRTM.