From 26de321b1494da9b5ab33807f0cebe29a2f63613 Mon Sep 17 00:00:00 2001 From: junwang-noaa <37633869+junwang-noaa@users.noreply.github.com> Date: Wed, 4 Dec 2019 09:21:01 -0500 Subject: [PATCH 1/7] change ifmin to zero at fh00 for inline POST (#14) --- io/post_gfs.F90 | 1 + 1 file changed, 1 insertion(+) diff --git a/io/post_gfs.F90 b/io/post_gfs.F90 index 3ea19c555..9f3a0a80f 100644 --- a/io/post_gfs.F90 +++ b/io/post_gfs.F90 @@ -133,6 +133,7 @@ subroutine post_run_gfs(wrt_int_state,mypei,mpicomp,lead_write, & ! ifhr = mynfhr ifmin = mynfmin + if (ifhr == 0 ) ifmin = 0 if(mype==0) print *,'bf set_postvars,ifmin=',ifmin,'ifhr=',ifhr call set_postvars_gfs(wrt_int_state,mpicomp,setvar_atmfile, & setvar_sfcfile) From 8a567812866a80d8320ecb8d946c894a91c8047c Mon Sep 17 00:00:00 2001 From: Dusan Jovic <48258889+DusanJovic-NOAA@users.noreply.github.com> Date: Tue, 10 Dec 2019 09:04:10 -0500 Subject: [PATCH 2/7] Add support for cmake build system (#20) --- .gitignore | 1 + CMakeLists.txt | 130 +++++++++++++++++ ccpp/driver/CMakeLists.txt | 27 ++++ cpl/CMakeLists.txt | 12 ++ gfsphysics/CMakeLists.txt | 228 ++++++++++++++++++++++++++++++ io/CMakeLists.txt | 33 +++++ ipd/CMakeLists.txt | 26 ++++ namphysics/CMakeLists.txt | 107 ++++++++++++++ stochastic_physics/CMakeLists.txt | 56 ++++++++ 9 files changed, 620 insertions(+) create mode 100644 CMakeLists.txt create mode 100644 ccpp/driver/CMakeLists.txt create mode 100644 cpl/CMakeLists.txt create mode 100644 gfsphysics/CMakeLists.txt create mode 100644 io/CMakeLists.txt create mode 100644 ipd/CMakeLists.txt create mode 100644 namphysics/CMakeLists.txt create mode 100644 stochastic_physics/CMakeLists.txt diff --git a/.gitignore b/.gitignore index 1d3fb332c..ac5fcf245 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ *.o *.mod *.a +*.pyc diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 000000000..fdcc5bc49 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,130 @@ +if( NOT DEFINED PHYS) + set(PHYS gfs) +endif() + +if (PHYS MATCHES "nam") + add_definitions(-DNAM_phys) +endif() + +if(CCPP) + add_definitions(-DCCPP) + if(STATIC) + add_definitions(-DSTATIC) + endif() +endif() + +add_subdirectory(cpl) +add_subdirectory(${PHYS}physics) +add_subdirectory(ipd) +add_subdirectory(io) + +# fv3core library + +if(NOT CCPP) +set(FAST_PHYSICS_SRCS_F90 atmos_cubed_sphere/model/fv_cmp.F90) +endif() + +add_library( + fv3core + + atmos_cubed_sphere/model/a2b_edge.F90 + atmos_cubed_sphere/model/multi_gases.F90 + atmos_cubed_sphere/model/boundary.F90 + atmos_cubed_sphere/model/dyn_core.F90 + atmos_cubed_sphere/model/fv_arrays.F90 + ${FAST_PHYSICS_SRCS_F90} + atmos_cubed_sphere/model/fv_control.F90 + atmos_cubed_sphere/model/fv_dynamics.F90 + atmos_cubed_sphere/model/fv_fill.F90 + atmos_cubed_sphere/model/fv_grid_utils.F90 + atmos_cubed_sphere/model/fv_mapz.F90 + atmos_cubed_sphere/model/fv_nesting.F90 + atmos_cubed_sphere/model/fv_regional_bc.F90 + atmos_cubed_sphere/model/fv_sg.F90 + atmos_cubed_sphere/model/fv_tracer2d.F90 + atmos_cubed_sphere/model/fv_update_phys.F90 + atmos_cubed_sphere/model/sw_core.F90 + atmos_cubed_sphere/model/tp_core.F90 + atmos_cubed_sphere/model/nh_core.F90 + atmos_cubed_sphere/model/nh_utils.F90 + atmos_cubed_sphere/tools/external_ic.F90 + atmos_cubed_sphere/tools/external_sst.F90 + atmos_cubed_sphere/tools/fv_diagnostics.F90 + atmos_cubed_sphere/tools/fv_eta.F90 + atmos_cubed_sphere/tools/fv_grid_tools.F90 + atmos_cubed_sphere/tools/fv_io.F90 + atmos_cubed_sphere/tools/fv_mp_mod.F90 + atmos_cubed_sphere/tools/fv_nudge.F90 + atmos_cubed_sphere/tools/fv_treat_da_inc.F90 + atmos_cubed_sphere/tools/fv_iau_mod.F90 + atmos_cubed_sphere/tools/fv_restart.F90 + atmos_cubed_sphere/tools/fv_surf_map.F90 + atmos_cubed_sphere/tools/fv_timing.F90 + atmos_cubed_sphere//tools/init_hydro.F90 + atmos_cubed_sphere/tools/sim_nc_mod.F90 + atmos_cubed_sphere/tools/sorted_index.F90 + atmos_cubed_sphere/tools/test_cases.F90 + atmos_cubed_sphere/driver/fvGFS/DYCORE_typedefs.F90 + atmos_cubed_sphere/driver/fvGFS/fv_nggps_diag.F90 + atmos_cubed_sphere/driver/fvGFS/atmosphere.F90 +) + +set_property(SOURCE atmos_cubed_sphere/model/nh_utils.F90 APPEND_STRING PROPERTY COMPILE_FLAGS "${FAST}") +set_property(SOURCE atmos_cubed_sphere/model/fv_mapz.F90 APPEND_STRING PROPERTY COMPILE_FLAGS "${FAST}") + +target_link_libraries(fv3core PRIVATE fms) +target_link_libraries(fv3core PRIVATE ${PHYS}physics) +target_link_libraries(fv3core PRIVATE ipd) + +target_include_directories(fv3core PRIVATE ${ESMF_MOD}) + +# end of fv3core + +############################################################################### +### ccpp +############################################################################### +if(CCPP) + add_subdirectory(ccpp) + add_subdirectory(ccpp/driver) + add_dependencies(${PHYS}physics ccpp ccppphys) + add_dependencies(ccppdriver ccpp ccppphys) + add_dependencies(ccppphys ccpp) + + target_include_directories(fv3core PRIVATE ${CMAKE_BINARY_DIR}/FV3/ccpp/framework/src) + target_include_directories(fv3core PRIVATE ${CMAKE_BINARY_DIR}/FV3/ccpp/driver) +endif() + +set_target_properties(fv3core PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/mod) +target_include_directories(fv3core PUBLIC ${CMAKE_CURRENT_BINARY_DIR}/mod) + +# When specifying an out-of-tree source a binary directory must be explicitly specified. +#add_subdirectory(../stochastic_physics stochastic_physics) +add_subdirectory(stochastic_physics) + +add_library( + fv3cap + + atmos_model.F90 + fv3_cap.F90 + module_fv3_config.F90 + module_fcst_grid_comp.F90 + time_utils.F90 +) + +if(CCPP) +target_include_directories(fv3cap PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/ccpp/driver/mod) +endif() +target_include_directories(fv3cap PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/stochastic_physics) +target_compile_definitions(fv3cap PRIVATE -DESMF_VERSION_MAJOR=${ESMF_VERSION_MAJOR}) +target_include_directories(fv3cap PRIVATE ${ESMF_MOD}) + +target_link_libraries(fv3cap PRIVATE fms) +target_link_libraries(fv3cap PRIVATE fv3cpl) +target_link_libraries(fv3cap PRIVATE ${PHYS}physics) +target_link_libraries(fv3cap PRIVATE ipd) +target_link_libraries(fv3cap PRIVATE io) +target_link_libraries(fv3cap PRIVATE fv3core) +target_link_libraries(fv3cap PRIVATE stochastic_physics) + +set_target_properties(fv3cap PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/mod) +target_include_directories(fv3cap PUBLIC ${CMAKE_CURRENT_BINARY_DIR}/mod) diff --git a/ccpp/driver/CMakeLists.txt b/ccpp/driver/CMakeLists.txt new file mode 100644 index 000000000..d1e36ac34 --- /dev/null +++ b/ccpp/driver/CMakeLists.txt @@ -0,0 +1,27 @@ + +if(NOT DYN32) +remove_definitions(-DOVERLOAD_R8) +remove_definitions(-DOVERLOAD_R4) +endif() + +message ("Force 64 bits in CCPP_layer") +if(CMAKE_Fortran_COMPILER_ID MATCHES "Intel") + string (REPLACE "-i4 -real-size 32" "-i4 -real-size 64 -no-prec-div -no-prec-sqrt" CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS}") +elseif(CMAKE_Fortran_COMPILER_ID MATCHES "GNU") + set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fdefault-real-8") +endif() + +add_library( + ccppdriver + + CCPP_driver.F90 +) + +target_link_libraries(ccppdriver ${PHYS}physics) +target_link_libraries(ccppdriver ccpp) +target_link_libraries(ccppdriver ccppphys) + +target_include_directories(ccppdriver PRIVATE ${CMAKE_BINARY_DIR}/FV3/ccpp/framework/src) + +set_target_properties(ccppdriver PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/mod) +target_include_directories(ccppdriver PUBLIC ${CMAKE_CURRENT_BINARY_DIR}/mod) diff --git a/cpl/CMakeLists.txt b/cpl/CMakeLists.txt new file mode 100644 index 000000000..c810ed1b3 --- /dev/null +++ b/cpl/CMakeLists.txt @@ -0,0 +1,12 @@ + +add_library( + fv3cpl + + module_cplfields.F90 + module_cap_cpl.F90 +) + +target_include_directories(fv3cpl PRIVATE ${ESMF_MOD}) + +set_target_properties(fv3cpl PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/mod) +target_include_directories(fv3cpl PUBLIC ${CMAKE_CURRENT_BINARY_DIR}/mod) diff --git a/gfsphysics/CMakeLists.txt b/gfsphysics/CMakeLists.txt new file mode 100644 index 000000000..6c2a23625 --- /dev/null +++ b/gfsphysics/CMakeLists.txt @@ -0,0 +1,228 @@ + +if(32BIT) +remove_definitions(-DOVERLOAD_R4) +remove_definitions(-DOVERLOAD_R8) +message ("Force 64 bits in gfsphysics") +if(CMAKE_Fortran_COMPILER_ID MATCHES "Intel") + if(REPRO) + string (REPLACE "-i4 -real-size 32" "-i4 -real-size 64" CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS}") + else() + string (REPLACE "-i4 -real-size 32" "-i4 -real-size 64 -no-prec-div -no-prec-sqrt" CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS}") + endif() +elseif(CMAKE_Fortran_COMPILER_ID MATCHES "GNU") + set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fdefault-real-8 -fdefault-double-8") +endif() +endif() + +set(CCPP_SOURCES + physics/mersenne_twister.f + physics/namelist_soilveg.f + physics/physparam.f + physics/radlw_param.f + physics/radsw_param.f + physics/set_soilveg.f + + physics/noahmp_tables.f90 + + physics/machine.F + + physics/GFDL_parse_tracers.F90 + physics/physcons.F90 + + CCPP_layer/CCPP_typedefs.F90 + CCPP_layer/CCPP_data.F90 + ${CMAKE_BINARY_DIR}/FV3/ccpp/physics/ccpp_static_api.F90 + + GFS_layer/GFS_abstraction_layer.F90 + GFS_layer/GFS_diagnostics.F90 + GFS_layer/GFS_driver.F90 + GFS_layer/GFS_restart.F90 + GFS_layer/GFS_typedefs.F90 +) + +set(IPD_SOURCES + + physics/cnvc90.f + physics/co2hc.f + physics/date_def.f + physics/dcyc2.f + physics/dcyc2.pre.rad.f + physics/efield.f + physics/get_prs.f + physics/gocart_tracer_config_stub.f + physics/gscond.f + physics/gscondp.f + physics/gwdc.f + physics/gwdps.f + physics/ugwp_driver_v0.f + physics/cires_orowam2017.f + physics/h2o_def.f + physics/h2oc.f + physics/h2ohdc.f + physics/h2ophys.f + physics/ideaca.f + physics/idea_co2.f + physics/idea_composition.f + physics/idea_dissipation.f + physics/idea_h2o.f + physics/idea_ion.f + physics/idea_o2_o3.f + physics/idea_phys.f + physics/idea_solar_heating.f + physics/idea_tracer.f + physics/iounitdef.f + physics/lrgsclr.f + physics/mersenne_twister.f + physics/mfpbl.f + physics/mfpblt.f + physics/mfpbltq.f + physics/mfscu.f + physics/mfscuq.f + physics/module_bfmicrophysics.f + physics/moninedmf.f + physics/moninedmf_hafs.f + physics/moninp.f + physics/moninp1.f + physics/moninq.f + physics/moninq1.f + physics/moninshoc.f + physics/mstadb.f + physics/mstadbtn.f + physics/mstadbtn2.f + physics/mstcnv.f + physics/namelist_soilveg.f + physics/ozne_def.f + physics/iccn_def.f + physics/aerclm_def.f + physics/ozphys.f + physics/ozphys_2015.f + physics/physparam.f + physics/precpd.f + physics/precpd_shoc.f + physics/precpdp.f + physics/precpd_shoc.f + physics/progt2.f + physics/progtm_module.f + physics/rad_initialize.f + physics/radiation_aerosols.f + physics/radiation_astronomy.f + physics/radiation_clouds.f + physics/radiation_gases.f + physics/radiation_surface.f + physics/radlw_datatb.f + physics/radlw_main.f + physics/radlw_param.f + physics/radsw_datatb.f + physics/radsw_main.f + physics/radsw_param.f + physics/rascnvv2.f + physics/rayleigh_damp.f + physics/rayleigh_damp_mesopause.f + physics/samfaerosols.f + physics/samfdeepcnv.f + physics/samfshalcnv.f + physics/sascnv.f + physics/sascnvn.f + physics/satmedmfvdif.f + physics/satmedmfvdifq.f + physics/set_soilveg.f + physics/sfc_cice.f + physics/sfc_diag.f + physics/sfc_diff.f + physics/sfc_drv.f + physics/sfc_noahmp_drv.f + physics/sfc_nst.f + physics/sfc_ocean.f + physics/sfc_sice.f + physics/sflx.f + physics/shalcnv.f + physics/shalcv.f + physics/shalcv_1lyr.f + physics/shalcv_fixdp.f + physics/shalcv_opr.f + physics/tracer_const_h.f + physics/tridi2t3.f + + physics/calpreciptype.f90 + physics/funcphys.f90 + physics/gcm_shoc.f90 + physics/get_prs_fv3.f90 + physics/h2ointerp.f90 + physics/module_nst_model.f90 + physics/module_nst_parameters.f90 + physics/module_nst_water_prop.f90 + physics/ozinterp.f90 + physics/module_wrf_utl.f90 + physics/noahmp_tables.f90 + physics/module_sf_noahmplsm.f90 + physics/module_sf_noahmp_glacier.f90 + physics/iccninterp.f90 + physics/aerinterp.f90 + physics/wam_f107_kp_mod.f90 + + physics/aer_cloud.F + physics/cldmacro.F + physics/cldwat2m_micro.F + physics/gfs_phy_tracer_config.F + physics/machine.F + physics/num_parthds.F + physics/sfcsub.F + physics/wv_saturation.F + + physics/GFDL_parse_tracers.F90 + physics/gcycle.F90 + physics/cires_ugwp_initialize.F90 + physics/cires_ugwp_module.F90 + physics/cires_ugwp_utils.F90 + physics/cires_ugwp_triggers.F90 + physics/cires_ugwp_solvers.F90 + physics/cires_vert_lsatdis.F90 + physics/cires_vert_orodis.F90 + physics/cires_vert_wmsdis.F90 + physics/gfdl_cloud_microphys.F90 + physics/micro_mg_utils.F90 + physics/micro_mg2_0.F90 + physics/micro_mg3_0.F90 + physics/m_micro_driver.F90 + physics/cs_conv.F90 + physics/module_mp_radar.F90 + physics/module_mp_thompson_gfs.F90 + physics/module_mp_wsm6_fv3.F90 + physics/physcons.F90 + physics/surface_perturbation.F90 + + GFS_layer/GFS_abstraction_layer.F90 + GFS_layer/GFS_diagnostics.F90 + GFS_layer/GFS_driver.F90 + GFS_layer/GFS_physics_driver.F90 + GFS_layer/GFS_radiation_driver.F90 + GFS_layer/GFS_restart.F90 + GFS_layer/GFS_typedefs.F90 +) + +if(CCPP) + add_definitions(-DCCPP) + if(DYN32) + add_definitions(-DOVERLOAD_R4) + endif() + add_library(gfsphysics ${CCPP_SOURCES}) + target_include_directories(gfsphysics PRIVATE ${CMAKE_BINARY_DIR}/FV3/ccpp/framework/src) + target_include_directories(gfsphysics PRIVATE ${CMAKE_BINARY_DIR}/FV3/ccpp/physics) +else() + add_library(gfsphysics ${IPD_SOURCES}) +endif() + +if(CMAKE_Fortran_COMPILER_ID MATCHES "Intel") + if(CMAKE_Platform MATCHES "jet") + set_property(SOURCE physics/radiation_aerosols.f APPEND_STRING PROPERTY COMPILE_FLAGS "-axSSE4.2,AVX,CORE-AVX-I") + else() + set_property(SOURCE physics/radiation_aerosols.f APPEND_STRING PROPERTY COMPILE_FLAGS "-xCORE-AVX-I") + endif() +endif() +set_property(SOURCE GFS_layer/GFS_diagnostics.F90 APPEND_STRING PROPERTY COMPILE_FLAGS "-O0") + +target_compile_definitions(gfsphysics PRIVATE -DNEMS_GSM) +target_include_directories(gfsphysics PRIVATE ${NETCDF_INC_DIR}) + +set_target_properties(gfsphysics PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/mod) +target_include_directories(gfsphysics PUBLIC ${CMAKE_CURRENT_BINARY_DIR}/mod) diff --git a/io/CMakeLists.txt b/io/CMakeLists.txt new file mode 100644 index 000000000..5eecdd9ea --- /dev/null +++ b/io/CMakeLists.txt @@ -0,0 +1,33 @@ +if(INLINE_POST) + set(POST_SRC post_gfs.F90 post_nems_routines.F90) +else() + set(POST_SRC post_gfs_stub.F90) + add_definitions(-DNO_INLINE_POST) +endif() + +add_library( + io + + ffsync.F90 + FV3GFS_io.F90 + module_write_nemsio.F90 + module_write_netcdf.F90 + module_fv3_io_def.F90 + module_write_internal_state.F90 + module_wrt_grid_comp.F90 + ${POST_SRC} +) + +set_source_files_properties(post_gfs.F90 post_nems_routines.F90 + PROPERTIES + COMPILE_FLAGS "-I${POST_INC}") + +target_link_libraries(io fms) +target_link_libraries(io ${PHYS}physics) +target_link_libraries(io ipd) + +target_include_directories(io PRIVATE ${ESMF_MOD}) +target_include_directories(io PRIVATE ${NEMSIO_INC}) + +set_target_properties(io PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/mod) +target_include_directories(io PUBLIC ${CMAKE_CURRENT_BINARY_DIR}/mod) diff --git a/ipd/CMakeLists.txt b/ipd/CMakeLists.txt new file mode 100644 index 000000000..490ad35f8 --- /dev/null +++ b/ipd/CMakeLists.txt @@ -0,0 +1,26 @@ + +if(32BIT) +remove_definitions(-DOVERLOAD_R4) +remove_definitions(-DOVERLOAD_R8) +message ("Force 64 bits in ipd") +if(CMAKE_Fortran_COMPILER_ID MATCHES "Intel") + if(REPRO) + string (REPLACE "-i4 -real-size 32" "-i4 -real-size 64" CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS}") + else() + string (REPLACE "-i4 -real-size 32" "-i4 -real-size 64 -no-prec-div -no-prec-sqrt" CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS}") + endif() +elseif(CMAKE_Fortran_COMPILER_ID MATCHES "GNU") + set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fdefault-real-8") +endif() +endif() + +add_library( + ipd + + IPD_driver.F90 + IPD_typedefs.F90 +) +target_link_libraries(ipd ${PHYS}physics) + +set_target_properties(ipd PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/mod) +target_include_directories(ipd PUBLIC ${CMAKE_CURRENT_BINARY_DIR}/mod) diff --git a/namphysics/CMakeLists.txt b/namphysics/CMakeLists.txt new file mode 100644 index 000000000..dd584f891 --- /dev/null +++ b/namphysics/CMakeLists.txt @@ -0,0 +1,107 @@ + +if(32BIT) +remove_definitions(-DOVERLOAD_R4) +remove_definitions(-DOVERLOAD_R8) +message ("Force 64 bits in namphysics") +if(CMAKE_Fortran_COMPILER_ID MATCHES "Intel") + if(REPRO) + string (REPLACE "-i4 -real-size 32" "-i4 -real-size 64" CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS}") + else() + string (REPLACE "-i4 -real-size 32" "-i4 -real-size 64 -no-prec-div -no-prec-sqrt" CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS}") + endif() +elseif(CMAKE_Fortran_COMPILER_ID MATCHES "GNU") + set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fdefault-real-8") +endif() +endif() + +add_library( + namphysics + + physics/grrad_nmmb.f + physics/gscond.f + physics/iounitdef.f + physics/mersenne_twister.f + physics/mfdeepcnv.f + physics/mfpbl.f + physics/mfshalcnv.f + physics/moninedmf.f + physics/moninq.f + physics/namelist_soilveg.f + physics/ozne_def.f + physics/physparam.f + physics/precpd_nmmb.f + physics/rad_initialize_nmmb.f + physics/radiation_aerosols_nmmb.f + physics/radiation_astronomy_nmmb.f + physics/radiation_clouds_nmmb.f + physics/radiation_gases_nmmb.f + physics/radiation_surface_nmmb.f + physics/radlw_datatb.f + physics/radlw_main_nmmb.f + physics/radlw_param.f + physics/radsw_datatb.f + physics/radsw_main_nmmb.f + physics/radsw_param.f + physics/sascnvn.f + physics/h2o_def.f + physics/shalcnv.f + + physics/machine.F + + physics/funcphys.f90 + physics/physcons.f90 + physics/noahmp_tables.f90 + + physics/module_BL_GFSPBL.F90 + physics/module_BL_GFSPBLEDMFHUR.F90 + physics/module_BL_GFSPBLHUR.F90 + physics/module_BL_MYJPBL.F90 + physics/module_CONSTANTS.F90 + physics/module_CONTROL.F90 + physics/module_CONVECTION.F90 + physics/module_CU_BMJ.F90 + physics/module_CU_SAS.F90 + physics/module_CU_SASHUR.F90 + physics/module_CU_SCALE.F90 + physics/module_DIAGNOSE.F90 + physics/module_GWD.F90 + physics/module_KINDS.F90 + physics/module_LS_LISS.F90 + physics/module_LS_NOAHLSM.F90 + physics/module_MICROPHYSICS.F90 + physics/module_MP_ETANEW.F90 + physics/module_MP_FER_HIRES.F90 + physics/module_MP_GFS.F90 + physics/module_MP_WSM6.F90 + physics/module_RADIATION.F90 + physics/module_RA_GFDL.F90 + physics/module_RA_RRTM.F90 + physics/module_SF_GFDL.F90 + physics/module_SF_JSFC.F90 + physics/module_SF_URBAN.F90 + physics/module_TURBULENCE.F90 + physics/module_mp_radar.F90 + physics/module_mp_thompson.F90 + physics/GFDL_parse_tracers.F90 + physics/gfdl_cloud_microphys.F90 + + NAM_layer/module_SOLVER_GRID_COMP.F90 + NAM_layer/NAM_abstraction_layer.F90 + NAM_layer/NAM_diagnostics.F90 + NAM_layer/NAM_driver.F90 + NAM_layer/NAM_radiation_driver.F90 + NAM_layer/NAM_restart.F90 + NAM_layer/NAM_typedefs.F90 +) + +set_property(SOURCE physics/grrad_nmmb.f APPEND_STRING PROPERTY COMPILE_FLAGS "-free -r8") +set_property(SOURCE physics/radiation_astronomy_nmmb.f APPEND_STRING PROPERTY COMPILE_FLAGS "-free -r8") +set_property(SOURCE physics/radiation_clouds_nmmb.f APPEND_STRING PROPERTY COMPILE_FLAGS "-free -r8") +set_property(SOURCE physics/radsw_main_nmmb.f APPEND_STRING PROPERTY COMPILE_FLAGS "-free -r8") + +set_property(SOURCE NAM_layer/NAM_diagnostics.F90 APPEND_STRING PROPERTY COMPILE_FLAGS "-O0") + +target_include_directories(namphysics PRIVATE ${ESMF_MOD}) + +set_target_properties(namphysics PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/mod) +target_include_directories(namphysics PUBLIC ${CMAKE_CURRENT_BINARY_DIR}/mod) diff --git a/stochastic_physics/CMakeLists.txt b/stochastic_physics/CMakeLists.txt new file mode 100644 index 000000000..5c52ec863 --- /dev/null +++ b/stochastic_physics/CMakeLists.txt @@ -0,0 +1,56 @@ + +if(32BIT) +remove_definitions(-DOVERLOAD_R4) +remove_definitions(-DOVERLOAD_R8) +message ("Force 64 bits in stochastic_physics") +if(CMAKE_Fortran_COMPILER_ID MATCHES "Intel") + if(REPRO) + string (REPLACE "-i4 -real-size 32" "-i4 -real-size 64" CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS}") + else() + string (REPLACE "-i4 -real-size 32" "-i4 -real-size 64 -no-prec-div -no-prec-sqrt" CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS}") + endif() +elseif(CMAKE_Fortran_COMPILER_ID MATCHES "GNU") + set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fdefault-real-8") +endif() +endif() + +add_library( + stochastic_physics + + ../../stochastic_physics/cellular_automata.f90 + ../../stochastic_physics/update_ca.f90 + ../../stochastic_physics/plumes.f90 + + ../../stochastic_physics/stochy_gg_def.f + ../../stochastic_physics/stochy_resol_def.f + ../../stochastic_physics/stochy_layout_lag.f + ../../stochastic_physics/four_to_grid_stochy.F + ../../stochastic_physics/glats_stochy.f + ../../stochastic_physics/sumfln_stochy.f + ../../stochastic_physics/gozrineo_stochy.f + ../../stochastic_physics/num_parthds_stochy.f + ../../stochastic_physics/get_ls_node_stochy.f + ../../stochastic_physics/get_lats_node_a_stochy.f + ../../stochastic_physics/setlats_a_stochy.f + ../../stochastic_physics/setlats_lag_stochy.f + ../../stochastic_physics/epslon_stochy.f + ../../stochastic_physics/getcon_lag_stochy.f + ../../stochastic_physics/pln2eo_stochy.f + ../../stochastic_physics/dozeuv_stochy.f + ../../stochastic_physics/dezouv_stochy.f + + ../../stochastic_physics/spectral_layout.F90 + ../../stochastic_physics/getcon_spectral.F90 + ../../stochastic_physics/stochy_namelist_def.F90 + ../../stochastic_physics/compns_stochy.F90 + ../../stochastic_physics/stochy_internal_state_mod.F90 + ../../stochastic_physics/stochastic_physics.F90 + ../../stochastic_physics/stochy_patterngenerator.F90 + ../../stochastic_physics/stochy_data_mod.F90 + ../../stochastic_physics/get_stochy_pattern.F90 + ../../stochastic_physics/initialize_spectral_mod.F90 +) + +target_link_libraries(stochastic_physics fms) +target_link_libraries(stochastic_physics ${PHYS}physics) +target_link_libraries(stochastic_physics fv3core) From 869374c057e71b9289eba638daacc35290219bb7 Mon Sep 17 00:00:00 2001 From: junwang-noaa <37633869+junwang-noaa@users.noreply.github.com> Date: Thu, 26 Dec 2019 08:41:16 -0500 Subject: [PATCH 3/7] updates in inline post and restart files and bug fix in ugwd (#27) * add fh00 post control file, add restart output at specified forecast hours, ugwd bug fixes * fv3atm #15:Add support for GEFS-Aerosols restart capability * remove comment prints * fix RunDuration in atmos fcst side * update post_gfs with new post changes * comment out print line * point fv3 dycore to the latest NOAA-EMC dev/emc branch --- atmos_cubed_sphere | 2 +- atmos_model.F90 | 34 +++++- fv3_cap.F90 | 18 ++- gfsphysics/GFS_layer/GFS_driver.F90 | 2 +- gfsphysics/GFS_layer/GFS_physics_driver.F90 | 8 +- gfsphysics/GFS_layer/GFS_radiation_driver.F90 | 38 ++++-- gfsphysics/physics/sflx.f | 1 + gfsphysics/physics/ugwp_driver_v0.f | 4 +- io/FV3GFS_io.F90 | 4 +- io/post_gfs.F90 | 81 ++++++++++--- module_fcst_grid_comp.F90 | 109 ++++++++++++------ module_fv3_config.F90 | 7 +- 12 files changed, 229 insertions(+), 79 deletions(-) diff --git a/atmos_cubed_sphere b/atmos_cubed_sphere index 452333aff..0e84f88b4 160000 --- a/atmos_cubed_sphere +++ b/atmos_cubed_sphere @@ -1 +1 @@ -Subproject commit 452333aff37f4c4348504bb9d485d98072e984e5 +Subproject commit 0e84f88b494b9e0a4097da50abe6b143330e8a2f diff --git a/atmos_model.F90 b/atmos_model.F90 index 23e30e76c..34e1a6c99 100644 --- a/atmos_model.F90 +++ b/atmos_model.F90 @@ -113,7 +113,8 @@ module atmos_model_mod FV3GFS_diag_register, FV3GFS_diag_output, & DIAG_SIZE use fv_iau_mod, only: iau_external_data_type,getiauforcing,iau_initialize -use module_fv3_config, only: output_1st_tstep_rst, first_kdt, nsout +use module_fv3_config, only: output_1st_tstep_rst, first_kdt, nsout, & + frestart, restart_endfcst !----------------------------------------------------------------------- @@ -221,7 +222,8 @@ module atmos_model_mod logical,parameter :: flip_vc = .true. #endif - real(kind=IPD_kind_phys), parameter :: zero=0.0, one=1.0 + real(kind=IPD_kind_phys), parameter :: zero = 0.0_IPD_kind_phys, & + one = 1.0_IPD_kind_phys contains @@ -944,7 +946,7 @@ end subroutine update_atmos_model_state subroutine atmos_model_end (Atmos) type (atmos_data_type), intent(inout) :: Atmos !---local variables - integer :: idx + integer :: idx, seconds #ifdef CCPP integer :: ierr #endif @@ -952,9 +954,11 @@ subroutine atmos_model_end (Atmos) !----------------------------------------------------------------------- !---- termination routine for atmospheric model ---- - call atmosphere_end (Atmos % Time, Atmos%grid) - call FV3GFS_restart_write (IPD_Data, IPD_Restart, Atm_block, & - IPD_Control, Atmos%domain) + call atmosphere_end (Atmos % Time, Atmos%grid, restart_endfcst) + if(restart_endfcst) then + call FV3GFS_restart_write (IPD_Data, IPD_Restart, Atm_block, & + IPD_Control, Atmos%domain) + endif #ifdef CCPP ! Fast physics (from dynamics) are finalized in atmosphere_end above; @@ -1457,6 +1461,24 @@ subroutine update_atmos_chemistry(state, rc) enddo enddo + ! -- zero out accumulated fields +!$OMP parallel do default (none) & +!$OMP shared (nj, ni, Atm_block, IPD_Control, IPD_Data) & +!$OMP private (j, jb, i, ib, nb, ix) + do j = 1, nj + jb = j + Atm_block%jsc - 1 + do i = 1, ni + ib = i + Atm_block%isc - 1 + nb = Atm_block%blkno(ib,jb) + ix = Atm_block%ixp(ib,jb) + IPD_Data(nb)%coupling%rainc_cpl(ix) = zero + if (.not.IPD_Control%cplflx) then + IPD_Data(nb)%coupling%rain_cpl(ix) = zero + IPD_Data(nb)%coupling%snow_cpl(ix) = zero + end if + enddo + enddo + if (IPD_Control%debug) then ! -- diagnostics write(6,'("update_atmos: prsi - min/max/avg",3g16.6)') minval(prsi), maxval(prsi), sum(prsi)/size(prsi) diff --git a/fv3_cap.F90 b/fv3_cap.F90 index d04abdce2..a099ae32e 100644 --- a/fv3_cap.F90 +++ b/fv3_cap.F90 @@ -30,7 +30,7 @@ module fv3gfs_cap_mod calendar, calendar_type, cpl, & force_date_from_configure, & cplprint_flag,output_1st_tstep_rst, & - first_kdt + first_kdt,num_restart_interval use module_fv3_io_def, only: num_pes_fcst,write_groups,app_domain, & num_files, filename_base, & @@ -278,9 +278,16 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) CALL ESMF_ConfigLoadFile(config=CF ,filename='model_configure' ,rc=RC) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! - CALL ESMF_ConfigGetAttribute(config=CF,value=restart_interval, & - label ='restart_interval:',rc=rc) + num_restart_interval = ESMF_ConfigGetLen(config=CF, label ='restart_interval:',rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + if(mype == 0) print *,'af nems config,num_restart_interval=',num_restart_interval + if (num_restart_interval<=0) num_restart_interval = 1 + allocate(restart_interval(num_restart_interval)) + restart_interval = 0 + CALL ESMF_ConfigGetAttribute(CF,valueList=restart_interval,label='restart_interval:', & + count=num_restart_interval, rc=RC) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + if(mype == 0) print *,'af nems config,restart_interval=',restart_interval ! CALL ESMF_ConfigGetAttribute(config=CF,value=calendar, & label ='calendar:',rc=rc) @@ -326,9 +333,8 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) label ='app_domain:',rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return - if(mype == 0) print *,'af nems config,restart_interval=',restart_interval, & - 'quilting=',quilting,'write_groups=',write_groups,wrttasks_per_group, & - 'calendar=',trim(calendar),'calendar_type=',calendar_type + if(mype == 0) print *,'af nems config,quilting=',quilting,'write_groups=', & + write_groups,wrttasks_per_group,'calendar=',trim(calendar),'calendar_type=',calendar_type ! CALL ESMF_ConfigGetAttribute(config=CF,value=num_files, & label ='num_files:',rc=rc) diff --git a/gfsphysics/GFS_layer/GFS_driver.F90 b/gfsphysics/GFS_layer/GFS_driver.F90 index 3b6a94336..05f97bde8 100644 --- a/gfsphysics/GFS_layer/GFS_driver.F90 +++ b/gfsphysics/GFS_layer/GFS_driver.F90 @@ -422,7 +422,7 @@ subroutine GFS_initialize (Model, Statein, Stateout, Sfcprop, & call cires_ugwp_init(Model%me, Model%master, Model%nlunit, Init_parm%logunit, & Model%fn_nml, Model%lonr, Model%latr, Model%levs, & Init_parm%ak, Init_parm%bk, p_ref, Model%dtp, & - Model%cdmbgwd, Model%cgwf, Model%prslrd0, Model%ral_ts) + Model%cdmbgwd(1:2), Model%cgwf, Model%prslrd0, Model%ral_ts) endif #endif diff --git a/gfsphysics/GFS_layer/GFS_physics_driver.F90 b/gfsphysics/GFS_layer/GFS_physics_driver.F90 index 5b67f7faa..19c40bf24 100644 --- a/gfsphysics/GFS_layer/GFS_physics_driver.F90 +++ b/gfsphysics/GFS_layer/GFS_physics_driver.F90 @@ -3184,9 +3184,13 @@ subroutine GFS_physics_driver & dtdt(1:im,:) = Stateout%gt0(1:im,:) endif ! end if_ldiag3d/cnvgwd - if (Model%ldiag3d) then + if (Model%ldiag3d .or. Model%cplchm) then dqdt(1:im,:,1) = Stateout%gq0(1:im,:,1) - endif ! end if_ldiag3d + endif ! end if_ldiag3d/cplchm + + if (Model%cplchm) then + Coupling%dqdti(1:im,:) = zero + endif ! end if_cplchm #ifdef GFS_HYDRO call get_phi(im, ix, levs, ntrac, Stateout%gt0, Stateout%gq0, & diff --git a/gfsphysics/GFS_layer/GFS_radiation_driver.F90 b/gfsphysics/GFS_layer/GFS_radiation_driver.F90 index c7323d6bb..5215f1b2b 100644 --- a/gfsphysics/GFS_layer/GFS_radiation_driver.F90 +++ b/gfsphysics/GFS_layer/GFS_radiation_driver.F90 @@ -2116,18 +2116,40 @@ subroutine GFS_radiation_driver & Diag%fluxr(i,11-j) = Diag%fluxr(i,11-j) + tem0d * Statein%prsi(i,itop+kt) Diag%fluxr(i,14-j) = Diag%fluxr(i,14-j) + tem0d * Statein%prsi(i,ibtc+kb) Diag%fluxr(i,17-j) = Diag%fluxr(i,17-j) + tem0d * Statein%tgrs(i,itop) + enddo + enddo ! Anning adds optical depth and emissivity output - tem1 = 0. - tem2 = 0. - do k=ibtc,itop - tem1 = tem1 + cldtausw(i,k) ! approx .55 mu channel - tem2 = tem2 + cldtaulw(i,k) ! approx 10. mu channel + if (Model%lsswr .and. (nday > 0)) then + do j = 1, 3 + do i = 1, IM + tem0d = raddt * cldsa(i,j) + itop = mtopa(i,j) - kd + ibtc = mbota(i,j) - kd + tem1 = 0. + do k=ibtc,itop + tem1 = tem1 + cldtausw(i,k) ! approx .55 um channel + enddo + Diag%fluxr(i,43-j) = Diag%fluxr(i,43-j) + tem0d * tem1 enddo - Diag%fluxr(i,43-j) = Diag%fluxr(i,43-j) + tem0d * tem1 - Diag%fluxr(i,46-j) = Diag%fluxr(i,46-j) + tem0d * (1.0-exp(-tem2)) enddo - enddo + endif + + if (Model%lslwr) then + do j = 1, 3 + do i = 1, IM + tem0d = raddt * cldsa(i,j) + itop = mtopa(i,j) - kd + ibtc = mbota(i,j) - kd + tem2 = 0. + do k=ibtc,itop + tem2 = tem2 + cldtaulw(i,k) ! approx 10. um channel + enddo + Diag%fluxr(i,46-j) = Diag%fluxr(i,46-j) + tem0d * (1.0-exp(-tem2)) + enddo + enddo + endif + endif endif ! end_if_lssav diff --git a/gfsphysics/physics/sflx.f b/gfsphysics/physics/sflx.f index 29467fe37..f84006be9 100644 --- a/gfsphysics/physics/sflx.f +++ b/gfsphysics/physics/sflx.f @@ -251,6 +251,7 @@ subroutine sflx & runoff2 = 0.0 runoff3 = 0.0 snomlt = 0.0 + rc = 0.0 ! --- ... define local variable ice to achieve: ! sea-ice case, ice = 1 diff --git a/gfsphysics/physics/ugwp_driver_v0.f b/gfsphysics/physics/ugwp_driver_v0.f index 804bbac19..0ca37e818 100644 --- a/gfsphysics/physics/ugwp_driver_v0.f +++ b/gfsphysics/physics/ugwp_driver_v0.f @@ -46,7 +46,9 @@ subroutine cires_ugwp_driver_v0(me, master, &, rain real(kind=kind_phys), intent(in), dimension(im,levs) :: ugrs - &, vgrs, tgrs, qgrs, prsi, prsl, prslk, phii, phil, del + &, vgrs, tgrs, qgrs, prsl, prslk, phil, del + real(kind=kind_phys), intent(in), dimension(im,levs+1) :: prsi + &, phii ! real(kind=kind_phys), intent(in) :: oro_stat(im,nmtvr) real(kind=kind_phys), intent(in), dimension(im) :: hprime, oc diff --git a/io/FV3GFS_io.F90 b/io/FV3GFS_io.F90 index 4b2d1e426..e8c980f4d 100644 --- a/io/FV3GFS_io.F90 +++ b/io/FV3GFS_io.F90 @@ -157,10 +157,10 @@ subroutine FV3GFS_restart_write (IPD_Data, IPD_Restart, Atm_block, Model, fv_dom type(domain2d), intent(in) :: fv_domain character(len=32), optional, intent(in) :: timestamp - !--- read in surface data from chgres + !--- write surface data from chgres call sfc_prop_restart_write (IPD_Data%Sfcprop, Atm_block, Model, fv_domain, timestamp) - !--- read in physics restart data + !--- write physics restart data call phys_restart_write (IPD_Restart, Atm_block, Model, fv_domain, timestamp) end subroutine FV3GFS_restart_write diff --git a/io/post_gfs.F90 b/io/post_gfs.F90 index 9f3a0a80f..98d4fef50 100644 --- a/io/post_gfs.F90 +++ b/io/post_gfs.F90 @@ -12,6 +12,7 @@ module post_gfs include 'mpif.h' integer mype, nbdl + logical setvar_atmfile, setvar_sfcfile, read_postcntrl public post_run_gfs, post_getattr_gfs contains @@ -28,9 +29,10 @@ subroutine post_run_gfs(wrt_int_state,mypei,mpicomp,lead_write, & ! use ctlblk_mod, only : komax,ifhr,ifmin,modelname,datapd,fld_info, & npset,grib,gocart_on,icount_calmict, jsta, & - jend,im, nsoil + jend,im, nsoil, filenameflat use gridspec_mod, only : maptype, gridtype use grib2_module, only : gribit2,num_pset,nrecout,first_grbtbl + use xml_perl_data,only : paramset ! !----------------------------------------------------------------------- ! @@ -53,9 +55,8 @@ subroutine post_run_gfs(wrt_int_state,mypei,mpicomp,lead_write, & integer n,nwtpg,ieof,lcntrl,ierr,i,j,k,jts,jte,mynsoil integer,allocatable :: jstagrp(:),jendgrp(:) integer,save :: kpo,kth,kpv + logical,save :: log_postalct=.false. real,dimension(komax),save :: po, th, pv - logical,save :: log_postalct=.false. - logical,save :: setvar_atmfile=.false.,setvar_sfcfile=.false. logical :: Log_runpost character(255) :: post_fname*255 @@ -124,6 +125,7 @@ subroutine post_run_gfs(wrt_int_state,mypei,mpicomp,lead_write, & ! log_postalct = .true. first_grbtbl = .true. + read_postcntrl = .true. ! ENDIF ! @@ -135,6 +137,8 @@ subroutine post_run_gfs(wrt_int_state,mypei,mpicomp,lead_write, & ifmin = mynfmin if (ifhr == 0 ) ifmin = 0 if(mype==0) print *,'bf set_postvars,ifmin=',ifmin,'ifhr=',ifhr + setvar_atmfile=.false. + setvar_sfcfile=.false. call set_postvars_gfs(wrt_int_state,mpicomp,setvar_atmfile, & setvar_sfcfile) @@ -145,8 +149,28 @@ subroutine post_run_gfs(wrt_int_state,mypei,mpicomp,lead_write, & ! 20190807 no need to call microinit for GFDLMP ! call MICROINIT ! - if(grib=="grib2" .and. first_grbtbl) then - call read_xml() + if(grib=="grib2" .and. read_postcntrl) then + if (ifhr == 0) then + filenameflat = 'postxconfig-NT_FH00.txt' + call read_xml() + if(mype==0) print *,'af read_xml at fh00,name=',trim(filenameflat) + else if(ifhr > 0) then + filenameflat = 'postxconfig-NT.txt' + if(size(paramset)>0) then + do i=1,size(paramset) + if (size(paramset(i)%param)>0) then + deallocate(paramset(i)%param) + nullify(paramset(i)%param) + endif + enddo + deallocate(paramset) + nullify(paramset) + endif + num_pset = 0 + call read_xml() + if(mype==0) print *,'af read_xml,name=',trim(filenameflat),'ifhr=',ifhr + read_postcntrl = .false. + endif endif ! IEOF = 0 @@ -181,9 +205,6 @@ subroutine post_run_gfs(wrt_int_state,mypei,mpicomp,lead_write, & endif ! enddo -! - setvar_atmfile = .false. - setvar_sfcfile = .false. ! endif @@ -335,7 +356,7 @@ subroutine set_postvars_gfs(wrt_int_state,mpicomp,setvar_atmfile, & avgetrans, avgesnow, avgprec_cont, avgcprate_cont,& avisbeamswin, avisdiffswin, airbeamswin, airdiffswin, & alwoutc, alwtoac, aswoutc, aswtoac, alwinc, aswinc,& - avgpotevp, snoavg, si, cuppt + avgpotevp, snoavg, ti, si, cuppt use soil, only: sldpth, sh2o, smc, stc use masks, only: lmv, lmh, htm, vtm, gdlat, gdlon, dx, dy, hbm2, sm, sice use ctlblk_mod, only: im, jm, lm, lp1, jsta, jend, jsta_2l, jend_2u, jsta_m,jend_m, & @@ -477,6 +498,7 @@ subroutine set_postvars_gfs(wrt_int_state,mpicomp,setvar_atmfile, & qs(i,j) = SPVAL twbs(i,j) = SPVAL qwbs(i,j) = SPVAL + ths(i,j) = SPVAL enddo enddo @@ -1122,9 +1144,30 @@ subroutine set_postvars_gfs(wrt_int_state,mpicomp,setvar_atmfile, & !$omp parallel do private(i,j) do j=jsta,jend do i=ista, iend - sr(i,j) = arrayr42d(i,j) + if (arrayr42d(i,j) /= spval) then + !set range within (0,1) + sr(i,j) = min(1.,max(0.,sr(i,j))) + else + sr(i,j) = spval + endif + enddo + enddo + endif + + ! sea ice skin temperature + if(trim(fieldname)=='tisfc') then + !$omp parallel do private(i,j) + do j=jsta,jend + do i=1,im + if (arrayr42d(i,j) /= spval) then + ti(i,j) = arrayr42d(i,j) + if (sice(i,j) == spval .or. sice(i,j) == 0.) ti(i,j)=spval + else + ti(i,j) = spval + endif enddo enddo +! print *,'in gfs_post, get tisfc=',maxval(ti), minval(ti) endif ! vegetation fraction @@ -1237,7 +1280,8 @@ subroutine set_postvars_gfs(wrt_int_state,mpicomp,setvar_atmfile, & do j=jsta,jend do i=ista, iend stc(i,j,1) = arrayr42d(i,j) - if (sm(i,j) /= 0.0) stc(i,j,1) = spval + !mask open water areas, combine with sea ice tmp + if (sm(i,j) /= 0.0 .and. sice(i,j) ==0.) stc(i,j,1) = spval enddo enddo endif @@ -1248,7 +1292,8 @@ subroutine set_postvars_gfs(wrt_int_state,mpicomp,setvar_atmfile, & do j=jsta,jend do i=ista, iend stc(i,j,2) = arrayr42d(i,j) - if (sm(i,j) /= 0.0) stc(i,j,2) = spval + !mask open water areas, combine with sea ice tmp + if (sm(i,j) /= 0.0 .and. sice(i,j) ==0.) stc(i,j,2) = spval enddo enddo endif @@ -1259,7 +1304,8 @@ subroutine set_postvars_gfs(wrt_int_state,mpicomp,setvar_atmfile, & do j=jsta,jend do i=ista, iend stc(i,j,3) = arrayr42d(i,j) - if (sm(i,j) /= 0.0) stc(i,j,3) = spval + !mask open water areas, combine with sea ice tmp + if (sm(i,j) /= 0.0 .and. sice(i,j) ==0.) stc(i,j,3) = spval enddo enddo endif @@ -1270,7 +1316,8 @@ subroutine set_postvars_gfs(wrt_int_state,mpicomp,setvar_atmfile, & do j=jsta,jend do i=ista, iend stc(i,j,4) = arrayr42d(i,j) - if (sm(i,j) /= 0.0) stc(i,j,4) = spval + !mask open water areas, combine with sea ice tmp + if (sm(i,j) /= 0.0 .and. sice(i,j) ==0.) stc(i,j,4) = spval enddo enddo endif @@ -2313,6 +2360,12 @@ subroutine set_postvars_gfs(wrt_int_state,mpicomp,setvar_atmfile, & !$omp parallel do private(i,j) do j=jsta,jend do i=ista, iend + !assign sst + if (sm(i,j) /= 0.0 .and. ths(i,j) /= spval) then + sst(i,j) = ths(i,j) + else + sst(i,j) = spval + endif if (ths(i,j) /= spval) then ths(i,j) = ths(i,j)* (p1000/pint(i,j,lp1))**capa thz0(i,j) = ths(i,j) diff --git a/module_fcst_grid_comp.F90 b/module_fcst_grid_comp.F90 index 6ff1f39c7..fef9698ab 100644 --- a/module_fcst_grid_comp.F90 +++ b/module_fcst_grid_comp.F90 @@ -22,11 +22,12 @@ module module_fcst_grid_comp ! use time_manager_mod, only: time_type, set_calendar_type, set_time, & set_date, days_in_month, month_name, & - operator(+), operator (<), operator (>), & - operator (/=), operator (/), operator (==),& - operator (*), THIRTY_DAY_MONTHS, JULIAN, & - NOLEAP, NO_CALENDAR, date_to_string, & - get_date + operator(+), operator(-), operator (<), & + operator (>), operator (/=), operator (/), & + operator (==), operator (*), & + THIRTY_DAY_MONTHS, JULIAN, NOLEAP, & + NO_CALENDAR, date_to_string, get_date, & + get_time use atmos_model_mod, only: atmos_model_init, atmos_model_end, & get_atmos_model_ungridded_dim, & @@ -70,7 +71,8 @@ module module_fcst_grid_comp iau_offset use module_fv3_config, only: dt_atmos, calendar, restart_interval, & quilting, calendar_type, cpl, & - cplprint_flag, force_date_from_configure + cplprint_flag, force_date_from_configure, & + num_restart_interval, frestart, restart_endfcst ! !----------------------------------------------------------------------- ! @@ -88,7 +90,8 @@ module module_fcst_grid_comp type(atmos_data_type) :: Atm type(time_type) :: Time_atmos, Time_init, Time_end, & Time_step_atmos, Time_step_ocean, & - Time_restart, Time_step_restart + Time_restart, Time_step_restart, & + Time_atstart integer :: num_atmos_calls, ret, intrm_rst end type @@ -179,12 +182,11 @@ subroutine fcst_initialize(fcst_comp, importState, exportState, clock, rc) integer :: Run_length integer,dimension(6) :: date, date_end - integer :: res_intvl integer :: mpi_comm_comp ! logical,save :: first=.true. character(len=9) :: month - integer :: initClock, unit, nfhour + integer :: initClock, unit, nfhour, total_inttime integer :: mype, ntasks character(3) cfhour character(4) dateSY @@ -203,7 +205,8 @@ subroutine fcst_initialize(fcst_comp, importState, exportState, clock, rc) real(ESMF_KIND_R8),parameter :: dtor = 180.0_ESMF_KIND_R8 / 3.1415926535897931_ESMF_KIND_R8 integer :: jsc, jec, isc, iec, nlev type(domain2D) :: domain - integer :: n, fcstNpes + integer :: n, fcstNpes, tmpvar + logical :: single_restart integer, allocatable, dimension(:) :: isl, iel, jsl, jel integer, allocatable, dimension(:,:,:) :: deBlockList @@ -271,8 +274,9 @@ subroutine fcst_initialize(fcst_comp, importState, exportState, clock, rc) !----------------------------------------------------------------------- ! call ESMF_ClockGet(clock, CurrTime=CurrTime, StartTime=StartTime, & - StopTime=StopTime, RunDuration=RunDuration, rc=rc) + StopTime=StopTime, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + RunDuration = StopTime - CurrTime date_init = 0 call ESMF_TimeGet (StartTime, & @@ -317,16 +321,46 @@ subroutine fcst_initialize(fcst_comp, importState, exportState, clock, rc) ! atm_int_state%Time_step_atmos = set_time (dt_atmos,0) atm_int_state%num_atmos_calls = Run_length / dt_atmos + atm_int_state%Time_atstart = atm_int_state%Time_atmos if (mype == 0) write(0,*)'num_atmos_calls=',atm_int_state%num_atmos_calls,'time_init=', & date_init,'time_atmos=',date,'time_end=',date_end,'dt_atmos=',dt_atmos, & 'Run_length=',Run_length - res_intvl = restart_interval*3600 - atm_int_state%Time_step_restart = set_time (res_intvl, 0) - atm_int_state%Time_restart = atm_int_state%Time_atmos + atm_int_state%Time_step_restart - atm_int_state%intrm_rst = 0 - if (res_intvl>0) atm_int_state%intrm_rst = 1 - atm_int_state%Atm%iau_offset = iau_offset -! + frestart = 0 + single_restart = .false. + call get_time(atm_int_state%Time_end - atm_int_state%Time_atstart,total_inttime) + if(num_restart_interval == 2) then + if(restart_interval(2)== -1) single_restart = .true. + endif + if(single_restart) then + frestart(1) = restart_interval(1) * 3600 + elseif ( num_restart_interval == 1) then + if(restart_interval(1) == 0) then + frestart(1) = total_inttime + else if(restart_interval(1) > 0) then + tmpvar = restart_interval(1) * 3600 + frestart(1) = tmpvar + atm_int_state%Time_step_restart = set_time (tmpvar, 0) + atm_int_state%Time_restart = atm_int_state%Time_atstart + atm_int_state%Time_step_restart + i = 2 + do while ( atm_int_state%Time_restart < atm_int_state%Time_end ) + frestart(i) = frestart(i-1) + tmpvar + atm_int_state%Time_restart = atm_int_state%Time_restart + atm_int_state%Time_step_restart + i = i + 1 + enddo + endif + else if(num_restart_interval > 1) then + do i=1,num_restart_interval + frestart(i) = restart_interval(i) * 3600 + enddo + endif + restart_endfcst = .false. + if ( ANY(frestart(:) == total_inttime) ) restart_endfcst = .true. + if (mype == 0) print *,'frestart=',frestart(1:10)/3600, 'restart_endfcst=',restart_endfcst, & + 'total_inttime=',total_inttime + + atm_int_state%intrm_rst = 0 + if (frestart(1)>0) atm_int_state%intrm_rst = 1 + atm_int_state%Atm%iau_offset = iau_offset ! !----- write time stamps (for start time and end time) ------ @@ -737,9 +771,10 @@ subroutine fcst_run_phase_2(fcst_comp, importState, exportState,clock,rc) !----------------------------------------------------------------------- !*** local variables ! - integer :: i,j, mype, na, date(6) + integer :: i,j, mype, na, date(6), seconds character(20) :: compname - + + type(time_type) :: restart_inctime type(ESMF_Time) :: currtime integer(kind=ESMF_KIND_I8) :: ntimestep_esmf character(len=64) :: timestamp @@ -776,13 +811,16 @@ subroutine fcst_run_phase_2(fcst_comp, importState, exportState,clock,rc) !--- intermediate restart if (atm_int_state%intrm_rst>0) then - if ((na /= atm_int_state%num_atmos_calls) .and. & - (atm_int_state%Time_atmos == atm_int_state%Time_restart)) then - timestamp = date_to_string (atm_int_state%Time_restart) - call atmos_model_restart(atm_int_state%Atm, timestamp) - - call wrt_atmres_timestamp(atm_int_state,timestamp) - atm_int_state%Time_restart = atm_int_state%Time_restart + atm_int_state%Time_step_restart + if (na /= atm_int_state%num_atmos_calls-1) then + call get_time(atm_int_state%Time_atmos - atm_int_state%Time_atstart, seconds) + if (ANY(frestart(:) == seconds)) then + restart_inctime = set_time(seconds, 0) + atm_int_state%Time_restart = atm_int_state%Time_atstart + restart_inctime + timestamp = date_to_string (atm_int_state%Time_restart) + call atmos_model_restart(atm_int_state%Atm, timestamp) + + call wrt_atmres_timestamp(atm_int_state,timestamp) + endif endif endif ! @@ -847,20 +885,21 @@ subroutine fcst_finalize(fcst_comp, importState, exportState,clock,rc) 'final time does not match expected ending time', WARNING) !*** write restart file - - call get_date (atm_int_state%Time_atmos, date(1), date(2), date(3), & + if( restart_endfcst ) then + call get_date (atm_int_state%Time_atmos, date(1), date(2), date(3), & date(4), date(5), date(6)) - call mpp_open( unit, 'RESTART/coupler.res', nohdrs=.TRUE. ) - if (mpp_pe() == mpp_root_pe())then - write( unit, '(i6,8x,a)' )calendar_type, & + call mpp_open( unit, 'RESTART/coupler.res', nohdrs=.TRUE. ) + if (mpp_pe() == mpp_root_pe())then + write( unit, '(i6,8x,a)' )calendar_type, & '(Calendar: no_calendar=0, thirty_day_months=1, julian=2, gregorian=3, noleap=4)' - write( unit, '(6i6,8x,a)' )date_init, & + write( unit, '(6i6,8x,a)' )date_init, & 'Model start time: year, month, day, hour, minute, second' - write( unit, '(6i6,8x,a)' )date, & + write( unit, '(6i6,8x,a)' )date, & 'Current model time: year, month, day, hour, minute, second' + endif + call mpp_close(unit) endif - call mpp_close(unit) ! call diag_manager_end(atm_int_state%Time_atmos ) diff --git a/module_fv3_config.F90 b/module_fv3_config.F90 index eb1bb2036..2e0fd8883 100644 --- a/module_fv3_config.F90 +++ b/module_fv3_config.F90 @@ -13,11 +13,10 @@ module module_fv3_config implicit none ! - - integer :: restart_interval -! integer :: nfhout, nfhout_hf, nsout, dt_atmos integer :: nfhmax, nfhmax_hf, first_kdt + integer :: num_restart_interval + integer :: frestart(1000) type(ESMF_Alarm) :: alarm_output_hf, alarm_output type(ESMF_TimeInterval) :: output_hfmax type(ESMF_TimeInterval) :: output_interval,output_interval_hf @@ -25,7 +24,9 @@ module module_fv3_config logical :: cpl, cplprint_flag logical :: quilting, output_1st_tstep_rst logical :: force_date_from_configure + logical :: restart_endfcst ! + integer,dimension(:),allocatable :: restart_interval character(esmf_maxstr),dimension(:),allocatable :: filename_base character(17) :: calendar=' ' integer :: calendar_type = -99 From b1ddd67b83bd170160c1ebcca7010172335f120b Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Fri, 10 Jan 2020 07:36:41 -0700 Subject: [PATCH 4/7] Update EMC dev/emc from NCAR dtc/develop 2019/12/17 (#30) * add new suite definition files for GFSv15p2, GFSv16beta * update existing suite definition files because of the interstitial code rearrangement (NCAR/ccpp-physics#372) * clean up CCPP compiler flags, add -Wall for GNU in DEBUG mode * add satmedmfvifq, shalcnv, sascnvn, Ferrier-Aligo microphysics and dependencies to CCPP prebuild config * bug fixes for ugwp and noahmp * move previous-timestep precipitation variables from Tbd to Sfcprop (as recommended by @HelinWei-NOAA, see NCAR/ccpp-physics#319) * fix compiler warnings about non-existent include directories * cleanup of old comments in GFS_physics_driver.F90 (see NCAR#4, NCAR#16, and NCAR/ccpp-physics#319 * CCPP annotations in GFS_driver.F90, GFS_radiation_driver.F90, GFS_physics_driver.F90 (comments that describe where code blocks ended up in the CCPP interstitial code) * capability to coldstart FV3 with GSD physics from RAP/HRRR initial conditions (required for FV3 SAR) * new suite definition file for coupled model --- atmos_cubed_sphere | 2 +- ccpp/CMakeLists.txt | 43 +- ccpp/build_ccpp.sh | 2 +- ccpp/config/ccpp_prebuild_config.py | 21 +- ccpp/framework | 2 +- ccpp/physics | 2 +- ccpp/suites/suite_FV3_CPT_v0.xml | 2 +- ccpp/suites/suite_FV3_GFS_2017.xml | 2 +- ccpp/suites/suite_FV3_GFS_2017_coupled.xml | 88 ++++ ccpp/suites/suite_FV3_GFS_2017_csawmg.xml | 2 +- ccpp/suites/suite_FV3_GFS_2017_csawmgshoc.xml | 1 + ccpp/suites/suite_FV3_GFS_2017_gfdlmp.xml | 2 +- .../suite_FV3_GFS_2017_gfdlmp_noahmp.xml | 3 +- .../suite_FV3_GFS_2017_gfdlmp_regional.xml | 2 +- ...uite_FV3_GFS_2017_gfdlmp_regional_c768.xml | 1 + ccpp/suites/suite_FV3_GFS_2017_h2ophys.xml | 2 +- ccpp/suites/suite_FV3_GFS_2017_myj.xml | 2 +- ccpp/suites/suite_FV3_GFS_2017_ntiedtke.xml | 1 + .../suites/suite_FV3_GFS_2017_ozphys_2015.xml | 2 +- ccpp/suites/suite_FV3_GFS_2017_sas.xml | 93 ++++ ccpp/suites/suite_FV3_GFS_2017_satmedmf.xml | 2 +- ccpp/suites/suite_FV3_GFS_2017_satmedmfq.xml | 89 ++++ ccpp/suites/suite_FV3_GFS_2017_shinhong.xml | 2 +- ccpp/suites/suite_FV3_GFS_2017_stretched.xml | 2 +- ccpp/suites/suite_FV3_GFS_2017_ysu.xml | 2 +- ccpp/suites/suite_FV3_GFS_v15.xml | 2 +- ccpp/suites/suite_FV3_GFS_v15_gf.xml | 1 + ccpp/suites/suite_FV3_GFS_v15_gf_thompson.xml | 1 + ccpp/suites/suite_FV3_GFS_v15_mynn.xml | 2 +- ccpp/suites/suite_FV3_GFS_v15_thompson.xml | 2 +- .../suite_FV3_GFS_v15_thompson_mynn.xml | 2 +- ccpp/suites/suite_FV3_GFS_v15p2.xml | 94 ++++ ccpp/suites/suite_FV3_GFS_v15plus.xml | 2 +- ccpp/suites/suite_FV3_GFS_v16beta.xml | 94 ++++ ccpp/suites/suite_FV3_GSD_SAR.xml | 83 +++ ccpp/suites/suite_FV3_GSD_noah.xml | 1 + ccpp/suites/suite_FV3_GSD_v0.xml | 1 + ccpp/suites/suite_FV3_GSD_v0_drag_suite.xml | 4 +- .../suite_FV3_HAFS_ferhires_update_moist.xml | 87 ++++ gfsphysics/GFS_layer/GFS_diagnostics.F90 | 13 + gfsphysics/GFS_layer/GFS_driver.F90 | 70 ++- gfsphysics/GFS_layer/GFS_physics_driver.F90 | 490 ++++++++++++++---- gfsphysics/GFS_layer/GFS_radiation_driver.F90 | 31 +- gfsphysics/GFS_layer/GFS_restart.F90 | 10 +- gfsphysics/GFS_layer/GFS_typedefs.F90 | 323 +++++++++--- gfsphysics/GFS_layer/GFS_typedefs.meta | 379 ++++++++++---- gfsphysics/physics/ugwp_driver_v0.f | 6 +- io/FV3GFS_io.F90 | 55 +- makefile | 8 +- 49 files changed, 1783 insertions(+), 350 deletions(-) create mode 100644 ccpp/suites/suite_FV3_GFS_2017_coupled.xml create mode 100644 ccpp/suites/suite_FV3_GFS_2017_sas.xml create mode 100644 ccpp/suites/suite_FV3_GFS_2017_satmedmfq.xml create mode 100644 ccpp/suites/suite_FV3_GFS_v15p2.xml create mode 100644 ccpp/suites/suite_FV3_GFS_v16beta.xml create mode 100644 ccpp/suites/suite_FV3_GSD_SAR.xml create mode 100644 ccpp/suites/suite_FV3_HAFS_ferhires_update_moist.xml diff --git a/atmos_cubed_sphere b/atmos_cubed_sphere index 0e84f88b4..a56907a44 160000 --- a/atmos_cubed_sphere +++ b/atmos_cubed_sphere @@ -1 +1 @@ -Subproject commit 0e84f88b494b9e0a4097da50abe6b143330e8a2f +Subproject commit a56907a44461c7151e0ba266e160c8f1a1685882 diff --git a/ccpp/CMakeLists.txt b/ccpp/CMakeLists.txt index 5b903352c..0e638c37f 100644 --- a/ccpp/CMakeLists.txt +++ b/ccpp/CMakeLists.txt @@ -62,17 +62,22 @@ elseif (${CMAKE_BUILD_TYPE} MATCHES "Release") set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS_RELEASE}") elseif (${CMAKE_BUILD_TYPE} MATCHES "Bitforbit") if (${CMAKE_Fortran_COMPILER_ID} MATCHES "PGI") - set (CMAKE_C_FLAGS_RELEASE "-O1 -fPIC" CACHE STRING "" FORCE) - set (CMAKE_CXX_FLAGS_RELEASE "-O1 -fPIC" CACHE STRING "" FORCE) - set (CMAKE_Fortran_FLAGS_RELEASE "-O1 -fPIC" CACHE STRING "" FORCE) + set (CMAKE_C_FLAGS_BITFORBIT "-O1 -g -fPIC" CACHE STRING "" FORCE) + set (CMAKE_CXX_FLAGS_BITFORBIT "-O1 -g -fPIC" CACHE STRING "" FORCE) + set (CMAKE_Fortran_FLAGS_BITFORBIT "-O1 -g -fPIC" CACHE STRING "" FORCE) + elseif (APPLE AND ${CMAKE_Fortran_COMPILER_ID} MATCHES "GNU") + set (CMAKE_C_FLAGS_BITFORBIT "-O0 -g -fPIC" CACHE STRING "" FORCE) + set (CMAKE_CXX_FLAGS_BITFORBIT "-O0 -g -fPIC" CACHE STRING "" FORCE) + set (CMAKE_Fortran_FLAGS_BITFORBIT "-O0 -g -fPIC" CACHE STRING "" FORCE) + # For Intel on all platforms and for GNU on all platforms except macOS else (${CMAKE_Fortran_COMPILER_ID} MATCHES "PGI") - set (CMAKE_C_FLAGS_RELEASE "-O2 -fPIC" CACHE STRING "" FORCE) - set (CMAKE_CXX_FLAGS_RELEASE "-O2 -fPIC" CACHE STRING "" FORCE) - set (CMAKE_Fortran_FLAGS_RELEASE "-O2 -fPIC" CACHE STRING "" FORCE) + set (CMAKE_C_FLAGS_BITFORBIT "-O2 -g -fPIC" CACHE STRING "" FORCE) + set (CMAKE_CXX_FLAGS_BITFORBIT "-O2 -g -fPIC" CACHE STRING "" FORCE) + set (CMAKE_Fortran_FLAGS_BITFORBIT "-O2 -g -fPIC" CACHE STRING "" FORCE) endif (${CMAKE_Fortran_COMPILER_ID} MATCHES "PGI") - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS_RELEASE}") - set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_RELEASE}") - set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS_RELEASE}") + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS_BITFORBIT}") + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_BITFORBIT}") + set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS_BITFORBIT}") endif (${CMAKE_BUILD_TYPE} MATCHES "Debug") # Set compiler-specific options, depending on build type; some optimization flags may only be used @@ -84,12 +89,12 @@ if (${CMAKE_Fortran_COMPILER_ID} MATCHES "GNU") set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fcray-pointer -ffree-line-length-none -fno-range-check") set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fbacktrace -cpp") if (${CMAKE_BUILD_TYPE} MATCHES "Debug") + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall") + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fno-unsafe-math-optimizations -frounding-math -fsignaling-nans") - set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -ffpe-trap=invalid,zero,overflow -fcheck=bounds -fbacktrace -fno-range-check") + set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -ffpe-trap=invalid,zero,overflow -fcheck=bounds -fbacktrace -fno-range-check -Wall") elseif (${CMAKE_BUILD_TYPE} MATCHES "Bitforbit") - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g") - set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g") - set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -g") + set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS}") endif (${CMAKE_BUILD_TYPE} MATCHES "Debug") set (CMAKE_Fortran_FLAGS_DEFAULT_PREC "-fdefault-real-8 -fdefault-double-8") elseif (${CMAKE_Fortran_COMPILER_ID} MATCHES "PGI") @@ -114,9 +119,9 @@ elseif (${CMAKE_Fortran_COMPILER_ID} MATCHES "Intel") set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fstack-protector-all -fpe0 -traceback -debug -ftrapuv") elseif (${CMAKE_BUILD_TYPE} MATCHES "Bitforbit") if(LEGACY_INTEL) - set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -debug minimal -fp-model strict -qoverride-limits -g -traceback") + set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -debug minimal -fp-model strict -qoverride-limits -traceback") else(LEGACY_INTEL) - set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -debug minimal -fp-model consistent -qoverride-limits -g -traceback") + set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -debug minimal -fp-model consistent -qoverride-limits -traceback") endif (LEGACY_INTEL) elseif (${CMAKE_BUILD_TYPE} MATCHES "Release") # Specify aggressive optimization flags (to be overwritten for individual files in ccpp-physics' CMakeLists.txt) @@ -254,12 +259,20 @@ endif(MKL_DIR) #------------------------------------------------------------------------------ # Set netCDF flags for preprocessor, compiler and linker (if defined) +# Legacy settings for old make build if(NETCDF_DIR) set (NETCDF_INC "-I${NETCDF_DIR}/include") set (NETCDF_LIB "-L${NETCDF_DIR}/lib -lnetcdff -lnetcdf") set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${NETCDF_INC} ${NETCDF_LIB}") ADD_DEFINITIONS(-DNETCDF) message (STATUS "Enable netCDF support") +# Settings for new cmake build +elseif (NETCDF_INC_DIR AND NETCDF_LIBDIR) + set (NETCDF_INC "-I${NETCDF_INC_DIR}") + set (NETCDF_LIB "-L${NETCDF_LIBDIR} -lnetcdff -lnetcdf") + set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${NETCDF_INC} ${NETCDF_LIB}") + ADD_DEFINITIONS(-DNETCDF) + message (STATUS "Enable netCDF support") else(NETCDF_DIR) message (STATUS "Disable netCDF support") endif(NETCDF_DIR) diff --git a/ccpp/build_ccpp.sh b/ccpp/build_ccpp.sh index a0e40203b..f6bec6ff9 100755 --- a/ccpp/build_ccpp.sh +++ b/ccpp/build_ccpp.sh @@ -219,7 +219,7 @@ else CCPP_LINK_OBJS="-L${PATH_CCPP_LIB} -lccpp ${CCPP_XML2_LIB}" fi fi -echo "ESMF_DEP_INCPATH=-I${PATH_CCPP_INC}" > ${CCPP_MK} +echo "ESMF_DEP_INCPATH=${PATH_CCPP_INC}" > ${CCPP_MK} echo "ESMF_DEP_LINK_OBJS=${CCPP_LINK_OBJS}" >> ${CCPP_MK} if [ $clean_after = YES ]; then diff --git a/ccpp/config/ccpp_prebuild_config.py b/ccpp/config/ccpp_prebuild_config.py index b1738d633..54b49d726 100755 --- a/ccpp/config/ccpp_prebuild_config.py +++ b/ccpp/config/ccpp_prebuild_config.py @@ -93,6 +93,7 @@ 'FV3/ccpp/physics/physics/module_mp_radar.F90', 'FV3/ccpp/physics/physics/module_mp_thompson.F90', 'FV3/ccpp/physics/physics/module_mp_thompson_make_number_concentrations.F90', + 'FV3/ccpp/physics/physics/module_MP_FER_HIRES.F90', 'FV3/ccpp/physics/physics/module_bl_mynn.F90', 'FV3/ccpp/physics/physics/module_sf_mynn.F90', 'FV3/ccpp/physics/physics/module_SF_JSFC.F90', @@ -111,7 +112,9 @@ 'FV3/ccpp/physics/physics/cires_vert_wmsdis.F90', 'FV3/ccpp/physics/physics/namelist_soilveg.f', 'FV3/ccpp/physics/physics/mfpblt.f', + 'FV3/ccpp/physics/physics/mfpbltq.f', 'FV3/ccpp/physics/physics/mfscu.f', + 'FV3/ccpp/physics/physics/mfscuq.f', 'FV3/ccpp/physics/physics/noahmp_tables.f90', 'FV3/ccpp/physics/physics/num_parthds.F', 'FV3/ccpp/physics/physics/ozne_def.f', @@ -188,6 +191,8 @@ 'FV3/ccpp/physics/physics/h2ophys.f' : [ 'slow_physics' ], 'FV3/ccpp/physics/physics/samfdeepcnv.f' : [ 'slow_physics' ], 'FV3/ccpp/physics/physics/samfshalcnv.f' : [ 'slow_physics' ], + 'FV3/ccpp/physics/physics/sascnvn.F' : [ 'slow_physics' ], + 'FV3/ccpp/physics/physics/shalcnv.F' : [ 'slow_physics' ], 'FV3/ccpp/physics/physics/maximum_hourly_diagnostics.F90' : [ 'slow_physics' ], 'FV3/ccpp/physics/physics/m_micro.F90' : [ 'slow_physics' ], 'FV3/ccpp/physics/physics/m_micro_interstitial.F90' : [ 'slow_physics' ], @@ -197,6 +202,7 @@ 'FV3/ccpp/physics/physics/moninedmf.f' : [ 'slow_physics' ], 'FV3/ccpp/physics/physics/moninshoc.f' : [ 'slow_physics' ], 'FV3/ccpp/physics/physics/satmedmfvdif.F' : [ 'slow_physics' ], + 'FV3/ccpp/physics/physics/satmedmfvdifq.F' : [ 'slow_physics' ], 'FV3/ccpp/physics/physics/shinhongvdif.F90' : [ 'slow_physics' ], 'FV3/ccpp/physics/physics/ysuvdif.F90' : [ 'slow_physics' ], 'FV3/ccpp/physics/physics/module_MYNNPBL_wrapper.F90' : [ 'slow_physics' ], @@ -225,15 +231,20 @@ 'FV3/ccpp/physics/physics/sfc_cice.f' : [ 'slow_physics' ], 'FV3/ccpp/physics/physics/sfc_diff.f' : [ 'slow_physics' ], 'FV3/ccpp/physics/physics/sfc_drv.f' : [ 'slow_physics' ], - 'FV3/ccpp/physics/physics/sfc_noahmp_pre.F90' : [ 'slow_physics' ], 'FV3/ccpp/physics/physics/sfc_noahmp_drv.f' : [ 'slow_physics' ], 'FV3/ccpp/physics/physics/sfc_nst.f' : [ 'slow_physics' ], 'FV3/ccpp/physics/physics/sfc_ocean.F' : [ 'slow_physics' ], 'FV3/ccpp/physics/physics/sfc_sice.f' : [ 'slow_physics' ], + # HAFS FER_HIRES + 'FV3/ccpp/physics/physics/mp_fer_hires.F90' : [ 'slow_physics' ], # for testing the and sections 'FV3/ccpp/physics/physics/GFS_suite_init_finalize_test.F90' : [ 'slow_physics' ], } +# Default build dir, relative to current working directory, +# if not specified as command-line argument +DEFAULT_BUILD_DIR = 'FV3' + # Auto-generated makefile/cmakefile snippets that contain all schemes SCHEMES_MAKEFILE = '{build_dir}/ccpp/physics/CCPP_SCHEMES.mk' SCHEMES_CMAKEFILE = '{build_dir}/ccpp/physics/CCPP_SCHEMES.cmake' @@ -317,6 +328,14 @@ 'tendency_of_ice_friendly_aerosols_at_surface', ], }, + 'mp_fer_hires' : { + 'mp_fer_hires_init' : [ + 'fraction_of_ice_water_cloud', + 'fraction_of_rain_water_cloud', + 'rime_factor', + ], + }, + #'subroutine_name_1' : 'all', #'subroutine_name_2' : 'none', #'subroutine_name_2' : [ 'var1', 'var3'], diff --git a/ccpp/framework b/ccpp/framework index 28fdedec6..7ab419eee 160000 --- a/ccpp/framework +++ b/ccpp/framework @@ -1 +1 @@ -Subproject commit 28fdedec637b3a11a90aa3d816aff9dd56a9dc5e +Subproject commit 7ab419eeebe133e706d9825d14c5bdc5d190e60d diff --git a/ccpp/physics b/ccpp/physics index 904a43354..39981891a 160000 --- a/ccpp/physics +++ b/ccpp/physics @@ -1 +1 @@ -Subproject commit 904a43354bc5922558dffc9b88acbc854c20e605 +Subproject commit 39981891a5b84e0f08acdf4d9e72d31c0c07aa82 diff --git a/ccpp/suites/suite_FV3_CPT_v0.xml b/ccpp/suites/suite_FV3_CPT_v0.xml index 618c16106..8eed8e78c 100644 --- a/ccpp/suites/suite_FV3_CPT_v0.xml +++ b/ccpp/suites/suite_FV3_CPT_v0.xml @@ -64,6 +64,7 @@ GFS_GWD_generic_pre cires_ugwp cires_ugwp_post + GFS_GWD_generic_post rayleigh_damp GFS_suite_stateout_update ozphys_2015 @@ -77,7 +78,6 @@ GFS_DCNV_generic_post GFS_SCNV_generic_pre samfshalcnv - samfshalcnv_post GFS_SCNV_generic_post GFS_suite_interstitial_4 cnvc90 diff --git a/ccpp/suites/suite_FV3_GFS_2017.xml b/ccpp/suites/suite_FV3_GFS_2017.xml index d42d5fb8a..fc1739bd5 100644 --- a/ccpp/suites/suite_FV3_GFS_2017.xml +++ b/ccpp/suites/suite_FV3_GFS_2017.xml @@ -59,6 +59,7 @@ GFS_GWD_generic_pre cires_ugwp cires_ugwp_post + GFS_GWD_generic_post rayleigh_damp GFS_suite_stateout_update ozphys @@ -69,7 +70,6 @@ GFS_DCNV_generic_post GFS_SCNV_generic_pre samfshalcnv - samfshalcnv_post GFS_SCNV_generic_post GFS_suite_interstitial_4 cnvc90 diff --git a/ccpp/suites/suite_FV3_GFS_2017_coupled.xml b/ccpp/suites/suite_FV3_GFS_2017_coupled.xml new file mode 100644 index 000000000..d67ce3116 --- /dev/null +++ b/ccpp/suites/suite_FV3_GFS_2017_coupled.xml @@ -0,0 +1,88 @@ + + + + + + + GFS_time_vary_pre + GFS_rrtmg_setup + GFS_rad_time_vary + GFS_phys_time_vary + + + + + GFS_suite_interstitial_rad_reset + GFS_rrtmg_pre + rrtmg_sw_pre + rrtmg_sw + rrtmg_sw_post + rrtmg_lw_pre + rrtmg_lw + rrtmg_lw_post + GFS_rrtmg_post + + + + + GFS_suite_interstitial_phys_reset + GFS_suite_stateout_reset + get_prs_fv3 + GFS_suite_interstitial_1 + GFS_surface_generic_pre + GFS_surface_composites_pre + dcyc2t3 + GFS_surface_composites_inter + GFS_suite_interstitial_2 + + + + sfc_diff + GFS_surface_loop_control_part1 + sfc_ocean + lsm_noah + sfc_cice + sfc_sice + GFS_surface_loop_control_part2 + + + + GFS_surface_composites_post + dcyc2t3_post + sfc_diag + sfc_diag_post + GFS_surface_generic_post + GFS_PBL_generic_pre + hedmf + GFS_PBL_generic_post + GFS_GWD_generic_pre + cires_ugwp + cires_ugwp_post + GFS_GWD_generic_post + rayleigh_damp + GFS_suite_stateout_update + ozphys + GFS_DCNV_generic_pre + get_phi_fv3 + GFS_suite_interstitial_3 + samfdeepcnv + GFS_DCNV_generic_post + GFS_SCNV_generic_pre + samfshalcnv + GFS_SCNV_generic_post + GFS_suite_interstitial_4 + cnvc90 + GFS_MP_generic_pre + zhaocarr_gscond + zhaocarr_precpd + GFS_MP_generic_post + maximum_hourly_diagnostics + + + + + GFS_stochastics + + + + diff --git a/ccpp/suites/suite_FV3_GFS_2017_csawmg.xml b/ccpp/suites/suite_FV3_GFS_2017_csawmg.xml index 587dd3c49..fec7f373e 100644 --- a/ccpp/suites/suite_FV3_GFS_2017_csawmg.xml +++ b/ccpp/suites/suite_FV3_GFS_2017_csawmg.xml @@ -59,6 +59,7 @@ GFS_GWD_generic_pre cires_ugwp cires_ugwp_post + GFS_GWD_generic_post rayleigh_damp GFS_suite_stateout_update ozphys_2015 @@ -72,7 +73,6 @@ GFS_DCNV_generic_post GFS_SCNV_generic_pre samfshalcnv - samfshalcnv_post GFS_SCNV_generic_post GFS_suite_interstitial_4 cnvc90 diff --git a/ccpp/suites/suite_FV3_GFS_2017_csawmgshoc.xml b/ccpp/suites/suite_FV3_GFS_2017_csawmgshoc.xml index 0e993dbda..9fc0b6dae 100644 --- a/ccpp/suites/suite_FV3_GFS_2017_csawmgshoc.xml +++ b/ccpp/suites/suite_FV3_GFS_2017_csawmgshoc.xml @@ -59,6 +59,7 @@ GFS_GWD_generic_pre cires_ugwp cires_ugwp_post + GFS_GWD_generic_post rayleigh_damp GFS_suite_stateout_update ozphys_2015 diff --git a/ccpp/suites/suite_FV3_GFS_2017_gfdlmp.xml b/ccpp/suites/suite_FV3_GFS_2017_gfdlmp.xml index 0fe2ee81a..35fdd9143 100644 --- a/ccpp/suites/suite_FV3_GFS_2017_gfdlmp.xml +++ b/ccpp/suites/suite_FV3_GFS_2017_gfdlmp.xml @@ -64,6 +64,7 @@ GFS_GWD_generic_pre cires_ugwp cires_ugwp_post + GFS_GWD_generic_post rayleigh_damp GFS_suite_stateout_update ozphys @@ -74,7 +75,6 @@ GFS_DCNV_generic_post GFS_SCNV_generic_pre samfshalcnv - samfshalcnv_post GFS_SCNV_generic_post GFS_suite_interstitial_4 cnvc90 diff --git a/ccpp/suites/suite_FV3_GFS_2017_gfdlmp_noahmp.xml b/ccpp/suites/suite_FV3_GFS_2017_gfdlmp_noahmp.xml index 4e27dbc21..55dedad57 100644 --- a/ccpp/suites/suite_FV3_GFS_2017_gfdlmp_noahmp.xml +++ b/ccpp/suites/suite_FV3_GFS_2017_gfdlmp_noahmp.xml @@ -47,7 +47,6 @@ sfc_nst_pre sfc_nst sfc_nst_post - sfc_noahmp_pre noahmpdrv sfc_sice GFS_surface_loop_control_part2 @@ -65,6 +64,7 @@ GFS_GWD_generic_pre cires_ugwp cires_ugwp_post + GFS_GWD_generic_post rayleigh_damp GFS_suite_stateout_update ozphys @@ -75,7 +75,6 @@ GFS_DCNV_generic_post GFS_SCNV_generic_pre samfshalcnv - samfshalcnv_post GFS_SCNV_generic_post GFS_suite_interstitial_4 cnvc90 diff --git a/ccpp/suites/suite_FV3_GFS_2017_gfdlmp_regional.xml b/ccpp/suites/suite_FV3_GFS_2017_gfdlmp_regional.xml index fba2dc00e..20f91469f 100644 --- a/ccpp/suites/suite_FV3_GFS_2017_gfdlmp_regional.xml +++ b/ccpp/suites/suite_FV3_GFS_2017_gfdlmp_regional.xml @@ -59,6 +59,7 @@ GFS_GWD_generic_pre cires_ugwp cires_ugwp_post + GFS_GWD_generic_post rayleigh_damp GFS_suite_stateout_update ozphys @@ -69,7 +70,6 @@ GFS_DCNV_generic_post GFS_SCNV_generic_pre samfshalcnv - samfshalcnv_post GFS_SCNV_generic_post GFS_suite_interstitial_4 cnvc90 diff --git a/ccpp/suites/suite_FV3_GFS_2017_gfdlmp_regional_c768.xml b/ccpp/suites/suite_FV3_GFS_2017_gfdlmp_regional_c768.xml index e1e189170..2e208f6e7 100644 --- a/ccpp/suites/suite_FV3_GFS_2017_gfdlmp_regional_c768.xml +++ b/ccpp/suites/suite_FV3_GFS_2017_gfdlmp_regional_c768.xml @@ -59,6 +59,7 @@ GFS_GWD_generic_pre cires_ugwp cires_ugwp_post + GFS_GWD_generic_post rayleigh_damp GFS_suite_stateout_update ozphys diff --git a/ccpp/suites/suite_FV3_GFS_2017_h2ophys.xml b/ccpp/suites/suite_FV3_GFS_2017_h2ophys.xml index f32e6a7b7..3e6acbc98 100644 --- a/ccpp/suites/suite_FV3_GFS_2017_h2ophys.xml +++ b/ccpp/suites/suite_FV3_GFS_2017_h2ophys.xml @@ -59,6 +59,7 @@ GFS_GWD_generic_pre cires_ugwp cires_ugwp_post + GFS_GWD_generic_post rayleigh_damp GFS_suite_stateout_update ozphys @@ -70,7 +71,6 @@ GFS_DCNV_generic_post GFS_SCNV_generic_pre samfshalcnv - samfshalcnv_post GFS_SCNV_generic_post GFS_suite_interstitial_4 cnvc90 diff --git a/ccpp/suites/suite_FV3_GFS_2017_myj.xml b/ccpp/suites/suite_FV3_GFS_2017_myj.xml index 8fc295020..7a193a10b 100644 --- a/ccpp/suites/suite_FV3_GFS_2017_myj.xml +++ b/ccpp/suites/suite_FV3_GFS_2017_myj.xml @@ -64,6 +64,7 @@ GFS_GWD_generic_pre cires_ugwp cires_ugwp_post + GFS_GWD_generic_post rayleigh_damp GFS_suite_stateout_update ozphys_2015 @@ -75,7 +76,6 @@ GFS_DCNV_generic_post GFS_SCNV_generic_pre samfshalcnv - samfshalcnv_post GFS_SCNV_generic_post GFS_suite_interstitial_4 cnvc90 diff --git a/ccpp/suites/suite_FV3_GFS_2017_ntiedtke.xml b/ccpp/suites/suite_FV3_GFS_2017_ntiedtke.xml index 5f95229b1..0331483c6 100644 --- a/ccpp/suites/suite_FV3_GFS_2017_ntiedtke.xml +++ b/ccpp/suites/suite_FV3_GFS_2017_ntiedtke.xml @@ -64,6 +64,7 @@ GFS_GWD_generic_pre cires_ugwp cires_ugwp_post + GFS_GWD_generic_post rayleigh_damp GFS_suite_stateout_update ozphys diff --git a/ccpp/suites/suite_FV3_GFS_2017_ozphys_2015.xml b/ccpp/suites/suite_FV3_GFS_2017_ozphys_2015.xml index 0e2a3d068..4e382886c 100644 --- a/ccpp/suites/suite_FV3_GFS_2017_ozphys_2015.xml +++ b/ccpp/suites/suite_FV3_GFS_2017_ozphys_2015.xml @@ -59,6 +59,7 @@ GFS_GWD_generic_pre cires_ugwp cires_ugwp_post + GFS_GWD_generic_post rayleigh_damp GFS_suite_stateout_update ozphys_2015 @@ -69,7 +70,6 @@ GFS_DCNV_generic_post GFS_SCNV_generic_pre samfshalcnv - samfshalcnv_post GFS_SCNV_generic_post GFS_suite_interstitial_4 cnvc90 diff --git a/ccpp/suites/suite_FV3_GFS_2017_sas.xml b/ccpp/suites/suite_FV3_GFS_2017_sas.xml new file mode 100644 index 000000000..1c52ac2cd --- /dev/null +++ b/ccpp/suites/suite_FV3_GFS_2017_sas.xml @@ -0,0 +1,93 @@ + + + + + + + fv_sat_adj + + + + + GFS_time_vary_pre + GFS_rrtmg_setup + GFS_rad_time_vary + GFS_phys_time_vary + + + + + GFS_suite_interstitial_rad_reset + GFS_rrtmg_pre + rrtmg_sw_pre + rrtmg_sw + rrtmg_sw_post + rrtmg_lw_pre + rrtmg_lw + rrtmg_lw_post + GFS_rrtmg_post + + + + + GFS_suite_interstitial_phys_reset + GFS_suite_stateout_reset + get_prs_fv3 + GFS_suite_interstitial_1 + GFS_surface_generic_pre + GFS_surface_composites_pre + dcyc2t3 + GFS_surface_composites_inter + GFS_suite_interstitial_2 + + + + sfc_diff + GFS_surface_loop_control_part1 + sfc_nst_pre + sfc_nst + sfc_nst_post + lsm_noah + sfc_sice + GFS_surface_loop_control_part2 + + + + GFS_surface_composites_post + dcyc2t3_post + sfc_diag + sfc_diag_post + GFS_surface_generic_post + GFS_PBL_generic_pre + hedmf + GFS_PBL_generic_post + GFS_GWD_generic_pre + cires_ugwp + cires_ugwp_post + GFS_GWD_generic_post + rayleigh_damp + GFS_suite_stateout_update + ozphys + GFS_DCNV_generic_pre + get_phi_fv3 + GFS_suite_interstitial_3 + sascnvn + GFS_DCNV_generic_post + GFS_SCNV_generic_pre + shalcnv + GFS_SCNV_generic_post + GFS_suite_interstitial_4 + cnvc90 + GFS_MP_generic_pre + gfdl_cloud_microphys + GFS_MP_generic_post + maximum_hourly_diagnostics + + + + + GFS_stochastics + + + + diff --git a/ccpp/suites/suite_FV3_GFS_2017_satmedmf.xml b/ccpp/suites/suite_FV3_GFS_2017_satmedmf.xml index c598a76e1..af93678ac 100644 --- a/ccpp/suites/suite_FV3_GFS_2017_satmedmf.xml +++ b/ccpp/suites/suite_FV3_GFS_2017_satmedmf.xml @@ -59,6 +59,7 @@ GFS_GWD_generic_pre cires_ugwp cires_ugwp_post + GFS_GWD_generic_post rayleigh_damp GFS_suite_stateout_update ozphys @@ -69,7 +70,6 @@ GFS_DCNV_generic_post GFS_SCNV_generic_pre samfshalcnv - samfshalcnv_post GFS_SCNV_generic_post GFS_suite_interstitial_4 cnvc90 diff --git a/ccpp/suites/suite_FV3_GFS_2017_satmedmfq.xml b/ccpp/suites/suite_FV3_GFS_2017_satmedmfq.xml new file mode 100644 index 000000000..a975c9235 --- /dev/null +++ b/ccpp/suites/suite_FV3_GFS_2017_satmedmfq.xml @@ -0,0 +1,89 @@ + + + + + + + GFS_time_vary_pre + GFS_rrtmg_setup + GFS_rad_time_vary + GFS_phys_time_vary + + + + + GFS_suite_interstitial_rad_reset + GFS_rrtmg_pre + rrtmg_sw_pre + rrtmg_sw + rrtmg_sw_post + rrtmg_lw_pre + rrtmg_lw + rrtmg_lw_post + GFS_rrtmg_post + + + + + GFS_suite_interstitial_phys_reset + GFS_suite_stateout_reset + get_prs_fv3 + GFS_suite_interstitial_1 + GFS_surface_generic_pre + GFS_surface_composites_pre + dcyc2t3 + GFS_surface_composites_inter + GFS_suite_interstitial_2 + + + + sfc_diff + GFS_surface_loop_control_part1 + sfc_nst_pre + sfc_nst + sfc_nst_post + lsm_noah + sfc_sice + GFS_surface_loop_control_part2 + + + + GFS_surface_composites_post + dcyc2t3_post + sfc_diag + sfc_diag_post + GFS_surface_generic_post + GFS_PBL_generic_pre + satmedmfvdifq + GFS_PBL_generic_post + GFS_GWD_generic_pre + cires_ugwp + cires_ugwp_post + GFS_GWD_generic_post + rayleigh_damp + GFS_suite_stateout_update + ozphys + GFS_DCNV_generic_pre + get_phi_fv3 + GFS_suite_interstitial_3 + samfdeepcnv + GFS_DCNV_generic_post + GFS_SCNV_generic_pre + samfshalcnv + GFS_SCNV_generic_post + GFS_suite_interstitial_4 + cnvc90 + GFS_MP_generic_pre + zhaocarr_gscond + zhaocarr_precpd + GFS_MP_generic_post + maximum_hourly_diagnostics + + + + + GFS_stochastics + + + + diff --git a/ccpp/suites/suite_FV3_GFS_2017_shinhong.xml b/ccpp/suites/suite_FV3_GFS_2017_shinhong.xml index a690a90ba..756695e65 100644 --- a/ccpp/suites/suite_FV3_GFS_2017_shinhong.xml +++ b/ccpp/suites/suite_FV3_GFS_2017_shinhong.xml @@ -63,6 +63,7 @@ GFS_GWD_generic_pre cires_ugwp cires_ugwp_post + GFS_GWD_generic_post rayleigh_damp GFS_suite_stateout_update ozphys @@ -73,7 +74,6 @@ GFS_DCNV_generic_post GFS_SCNV_generic_pre samfshalcnv - samfshalcnv_post GFS_SCNV_generic_post GFS_suite_interstitial_4 cnvc90 diff --git a/ccpp/suites/suite_FV3_GFS_2017_stretched.xml b/ccpp/suites/suite_FV3_GFS_2017_stretched.xml index 8e8fbf2da..6bef91b06 100644 --- a/ccpp/suites/suite_FV3_GFS_2017_stretched.xml +++ b/ccpp/suites/suite_FV3_GFS_2017_stretched.xml @@ -64,6 +64,7 @@ GFS_GWD_generic_pre cires_ugwp cires_ugwp_post + GFS_GWD_generic_post GFS_suite_stateout_update ozphys GFS_DCNV_generic_pre @@ -73,7 +74,6 @@ GFS_DCNV_generic_post GFS_SCNV_generic_pre samfshalcnv - samfshalcnv_post GFS_SCNV_generic_post GFS_suite_interstitial_4 cnvc90 diff --git a/ccpp/suites/suite_FV3_GFS_2017_ysu.xml b/ccpp/suites/suite_FV3_GFS_2017_ysu.xml index 9f14cd457..baeb11c22 100644 --- a/ccpp/suites/suite_FV3_GFS_2017_ysu.xml +++ b/ccpp/suites/suite_FV3_GFS_2017_ysu.xml @@ -63,6 +63,7 @@ GFS_GWD_generic_pre cires_ugwp cires_ugwp_post + GFS_GWD_generic_post rayleigh_damp GFS_suite_stateout_update ozphys @@ -73,7 +74,6 @@ GFS_DCNV_generic_post GFS_SCNV_generic_pre samfshalcnv - samfshalcnv_post GFS_SCNV_generic_post GFS_suite_interstitial_4 cnvc90 diff --git a/ccpp/suites/suite_FV3_GFS_v15.xml b/ccpp/suites/suite_FV3_GFS_v15.xml index 672c39280..efd5fc97b 100644 --- a/ccpp/suites/suite_FV3_GFS_v15.xml +++ b/ccpp/suites/suite_FV3_GFS_v15.xml @@ -64,6 +64,7 @@ GFS_GWD_generic_pre cires_ugwp cires_ugwp_post + GFS_GWD_generic_post rayleigh_damp GFS_suite_stateout_update ozphys_2015 @@ -75,7 +76,6 @@ GFS_DCNV_generic_post GFS_SCNV_generic_pre samfshalcnv - samfshalcnv_post GFS_SCNV_generic_post GFS_suite_interstitial_4 cnvc90 diff --git a/ccpp/suites/suite_FV3_GFS_v15_gf.xml b/ccpp/suites/suite_FV3_GFS_v15_gf.xml index 8e7a209ad..0d56e54c8 100644 --- a/ccpp/suites/suite_FV3_GFS_v15_gf.xml +++ b/ccpp/suites/suite_FV3_GFS_v15_gf.xml @@ -64,6 +64,7 @@ GFS_GWD_generic_pre cires_ugwp cires_ugwp_post + GFS_GWD_generic_post rayleigh_damp GFS_suite_stateout_update ozphys_2015 diff --git a/ccpp/suites/suite_FV3_GFS_v15_gf_thompson.xml b/ccpp/suites/suite_FV3_GFS_v15_gf_thompson.xml index 4ff6a7acf..1e51e5a13 100644 --- a/ccpp/suites/suite_FV3_GFS_v15_gf_thompson.xml +++ b/ccpp/suites/suite_FV3_GFS_v15_gf_thompson.xml @@ -59,6 +59,7 @@ GFS_GWD_generic_pre cires_ugwp cires_ugwp_post + GFS_GWD_generic_post rayleigh_damp GFS_suite_stateout_update ozphys_2015 diff --git a/ccpp/suites/suite_FV3_GFS_v15_mynn.xml b/ccpp/suites/suite_FV3_GFS_v15_mynn.xml index 4f299719c..8fffa33e8 100644 --- a/ccpp/suites/suite_FV3_GFS_v15_mynn.xml +++ b/ccpp/suites/suite_FV3_GFS_v15_mynn.xml @@ -64,6 +64,7 @@ GFS_GWD_generic_pre cires_ugwp cires_ugwp_post + GFS_GWD_generic_post rayleigh_damp GFS_suite_stateout_update ozphys_2015 @@ -75,7 +76,6 @@ GFS_DCNV_generic_post GFS_SCNV_generic_pre samfshalcnv - samfshalcnv_post GFS_SCNV_generic_post GFS_suite_interstitial_4 cnvc90 diff --git a/ccpp/suites/suite_FV3_GFS_v15_thompson.xml b/ccpp/suites/suite_FV3_GFS_v15_thompson.xml index cd69334f6..a436c11c8 100644 --- a/ccpp/suites/suite_FV3_GFS_v15_thompson.xml +++ b/ccpp/suites/suite_FV3_GFS_v15_thompson.xml @@ -59,6 +59,7 @@ GFS_GWD_generic_pre cires_ugwp cires_ugwp_post + GFS_GWD_generic_post rayleigh_damp GFS_suite_stateout_update ozphys_2015 @@ -70,7 +71,6 @@ GFS_DCNV_generic_post GFS_SCNV_generic_pre samfshalcnv - samfshalcnv_post GFS_SCNV_generic_post GFS_suite_interstitial_4 cnvc90 diff --git a/ccpp/suites/suite_FV3_GFS_v15_thompson_mynn.xml b/ccpp/suites/suite_FV3_GFS_v15_thompson_mynn.xml index 92637bd84..3de52fa45 100644 --- a/ccpp/suites/suite_FV3_GFS_v15_thompson_mynn.xml +++ b/ccpp/suites/suite_FV3_GFS_v15_thompson_mynn.xml @@ -59,6 +59,7 @@ GFS_GWD_generic_pre cires_ugwp cires_ugwp_post + GFS_GWD_generic_post rayleigh_damp GFS_suite_stateout_update ozphys_2015 @@ -70,7 +71,6 @@ GFS_DCNV_generic_post GFS_SCNV_generic_pre samfshalcnv - samfshalcnv_post GFS_SCNV_generic_post GFS_suite_interstitial_4 cnvc90 diff --git a/ccpp/suites/suite_FV3_GFS_v15p2.xml b/ccpp/suites/suite_FV3_GFS_v15p2.xml new file mode 100644 index 000000000..b4907bb1b --- /dev/null +++ b/ccpp/suites/suite_FV3_GFS_v15p2.xml @@ -0,0 +1,94 @@ + + + + + + + fv_sat_adj + + + + + GFS_time_vary_pre + GFS_rrtmg_setup + GFS_rad_time_vary + GFS_phys_time_vary + + + + + GFS_suite_interstitial_rad_reset + GFS_rrtmg_pre + rrtmg_sw_pre + rrtmg_sw + rrtmg_sw_post + rrtmg_lw_pre + rrtmg_lw + rrtmg_lw_post + GFS_rrtmg_post + + + + + GFS_suite_interstitial_phys_reset + GFS_suite_stateout_reset + get_prs_fv3 + GFS_suite_interstitial_1 + GFS_surface_generic_pre + GFS_surface_composites_pre + dcyc2t3 + GFS_surface_composites_inter + GFS_suite_interstitial_2 + + + + sfc_diff + GFS_surface_loop_control_part1 + sfc_nst_pre + sfc_nst + sfc_nst_post + lsm_noah + sfc_sice + GFS_surface_loop_control_part2 + + + + GFS_surface_composites_post + dcyc2t3_post + sfc_diag + sfc_diag_post + GFS_surface_generic_post + GFS_PBL_generic_pre + hedmf + GFS_PBL_generic_post + GFS_GWD_generic_pre + cires_ugwp + cires_ugwp_post + GFS_GWD_generic_post + rayleigh_damp + GFS_suite_stateout_update + ozphys_2015 + h2ophys + GFS_DCNV_generic_pre + get_phi_fv3 + GFS_suite_interstitial_3 + samfdeepcnv + GFS_DCNV_generic_post + GFS_SCNV_generic_pre + samfshalcnv + GFS_SCNV_generic_post + GFS_suite_interstitial_4 + cnvc90 + GFS_MP_generic_pre + gfdl_cloud_microphys + GFS_MP_generic_post + maximum_hourly_diagnostics + + + + + GFS_stochastics + + + + diff --git a/ccpp/suites/suite_FV3_GFS_v15plus.xml b/ccpp/suites/suite_FV3_GFS_v15plus.xml index 3ea9ec743..837cba69f 100644 --- a/ccpp/suites/suite_FV3_GFS_v15plus.xml +++ b/ccpp/suites/suite_FV3_GFS_v15plus.xml @@ -64,6 +64,7 @@ GFS_GWD_generic_pre cires_ugwp cires_ugwp_post + GFS_GWD_generic_post rayleigh_damp GFS_suite_stateout_update ozphys_2015 @@ -75,7 +76,6 @@ GFS_DCNV_generic_post GFS_SCNV_generic_pre samfshalcnv - samfshalcnv_post GFS_SCNV_generic_post GFS_suite_interstitial_4 cnvc90 diff --git a/ccpp/suites/suite_FV3_GFS_v16beta.xml b/ccpp/suites/suite_FV3_GFS_v16beta.xml new file mode 100644 index 000000000..7f53d7f6f --- /dev/null +++ b/ccpp/suites/suite_FV3_GFS_v16beta.xml @@ -0,0 +1,94 @@ + + + + + + + fv_sat_adj + + + + + GFS_time_vary_pre + GFS_rrtmg_setup + GFS_rad_time_vary + GFS_phys_time_vary + + + + + GFS_suite_interstitial_rad_reset + GFS_rrtmg_pre + rrtmg_sw_pre + rrtmg_sw + rrtmg_sw_post + rrtmg_lw_pre + rrtmg_lw + rrtmg_lw_post + GFS_rrtmg_post + + + + + GFS_suite_interstitial_phys_reset + GFS_suite_stateout_reset + get_prs_fv3 + GFS_suite_interstitial_1 + GFS_surface_generic_pre + GFS_surface_composites_pre + dcyc2t3 + GFS_surface_composites_inter + GFS_suite_interstitial_2 + + + + sfc_diff + GFS_surface_loop_control_part1 + sfc_nst_pre + sfc_nst + sfc_nst_post + lsm_noah + sfc_sice + GFS_surface_loop_control_part2 + + + + GFS_surface_composites_post + dcyc2t3_post + sfc_diag + sfc_diag_post + GFS_surface_generic_post + GFS_PBL_generic_pre + satmedmfvdifq + GFS_PBL_generic_post + GFS_GWD_generic_pre + cires_ugwp + cires_ugwp_post + GFS_GWD_generic_post + rayleigh_damp + GFS_suite_stateout_update + ozphys_2015 + h2ophys + GFS_DCNV_generic_pre + get_phi_fv3 + GFS_suite_interstitial_3 + samfdeepcnv + GFS_DCNV_generic_post + GFS_SCNV_generic_pre + samfshalcnv + GFS_SCNV_generic_post + GFS_suite_interstitial_4 + cnvc90 + GFS_MP_generic_pre + gfdl_cloud_microphys + GFS_MP_generic_post + maximum_hourly_diagnostics + + + + + GFS_stochastics + + + + diff --git a/ccpp/suites/suite_FV3_GSD_SAR.xml b/ccpp/suites/suite_FV3_GSD_SAR.xml new file mode 100644 index 000000000..e563301c4 --- /dev/null +++ b/ccpp/suites/suite_FV3_GSD_SAR.xml @@ -0,0 +1,83 @@ + + + + + + + GFS_time_vary_pre + GFS_rrtmg_setup + GFS_rad_time_vary + GFS_phys_time_vary + + + + + GFS_suite_interstitial_rad_reset + GFS_rrtmg_pre + rrtmg_sw_pre + mynnrad_pre + rrtmg_sw + rrtmg_sw_post + rrtmg_lw_pre + rrtmg_lw + mynnrad_post + rrtmg_lw_post + GFS_rrtmg_post + + + + + GFS_suite_interstitial_phys_reset + GFS_suite_stateout_reset + get_prs_fv3 + GFS_suite_interstitial_1 + GFS_surface_generic_pre + GFS_surface_composites_pre + dcyc2t3 + GFS_surface_composites_inter + GFS_suite_interstitial_2 + + + + sfc_diff + GFS_surface_loop_control_part1 + sfc_nst_pre + sfc_nst + sfc_nst_post + lsm_ruc + lsm_ruc_sfc_sice_pre + sfc_sice + lsm_ruc_sfc_sice_post + GFS_surface_loop_control_part2 + + + + GFS_surface_composites_post + dcyc2t3_post + sfc_diag + sfc_diag_post + GFS_surface_generic_post + mynnedmf_wrapper + GFS_GWD_generic_pre + cires_ugwp + cires_ugwp_post + GFS_GWD_generic_post + rayleigh_damp + GFS_suite_stateout_update + ozphys_2015 + h2ophys + GFS_MP_generic_pre + mp_thompson_pre + mp_thompson + mp_thompson_post + GFS_MP_generic_post + maximum_hourly_diagnostics + + + + + GFS_stochastics + + + + diff --git a/ccpp/suites/suite_FV3_GSD_noah.xml b/ccpp/suites/suite_FV3_GSD_noah.xml index 56f421e82..e9795b6ef 100644 --- a/ccpp/suites/suite_FV3_GSD_noah.xml +++ b/ccpp/suites/suite_FV3_GSD_noah.xml @@ -59,6 +59,7 @@ GFS_GWD_generic_pre cires_ugwp cires_ugwp_post + GFS_GWD_generic_post rayleigh_damp GFS_suite_stateout_update ozphys_2015 diff --git a/ccpp/suites/suite_FV3_GSD_v0.xml b/ccpp/suites/suite_FV3_GSD_v0.xml index e46467857..3f83b5dc5 100644 --- a/ccpp/suites/suite_FV3_GSD_v0.xml +++ b/ccpp/suites/suite_FV3_GSD_v0.xml @@ -61,6 +61,7 @@ GFS_GWD_generic_pre cires_ugwp cires_ugwp_post + GFS_GWD_generic_post rayleigh_damp GFS_suite_stateout_update ozphys_2015 diff --git a/ccpp/suites/suite_FV3_GSD_v0_drag_suite.xml b/ccpp/suites/suite_FV3_GSD_v0_drag_suite.xml index 0ca9cd610..8c56c07e5 100644 --- a/ccpp/suites/suite_FV3_GSD_v0_drag_suite.xml +++ b/ccpp/suites/suite_FV3_GSD_v0_drag_suite.xml @@ -58,9 +58,9 @@ sfc_diag_post GFS_surface_generic_post mynnedmf_wrapper - drag_suite_pre + GFS_GWD_generic_pre drag_suite - drag_suite_post + GFS_GWD_generic_post rayleigh_damp GFS_suite_stateout_update ozphys_2015 diff --git a/ccpp/suites/suite_FV3_HAFS_ferhires_update_moist.xml b/ccpp/suites/suite_FV3_HAFS_ferhires_update_moist.xml new file mode 100644 index 000000000..375e9972d --- /dev/null +++ b/ccpp/suites/suite_FV3_HAFS_ferhires_update_moist.xml @@ -0,0 +1,87 @@ + + + + + + + GFS_time_vary_pre + GFS_rrtmg_setup + GFS_rad_time_vary + GFS_phys_time_vary + + + + + GFS_suite_interstitial_rad_reset + GFS_rrtmg_pre + rrtmg_sw_pre + rrtmg_sw + rrtmg_sw_post + rrtmg_lw_pre + rrtmg_lw + rrtmg_lw_post + GFS_rrtmg_post + + + + + GFS_suite_interstitial_phys_reset + GFS_suite_stateout_reset + get_prs_fv3 + GFS_suite_interstitial_1 + GFS_surface_generic_pre + GFS_surface_composites_pre + dcyc2t3 + GFS_surface_composites_inter + GFS_suite_interstitial_2 + + + + sfc_diff + GFS_surface_loop_control_part1 + sfc_nst_pre + sfc_nst + sfc_nst_post + lsm_noah + sfc_sice + GFS_surface_loop_control_part2 + + + + GFS_surface_composites_post + dcyc2t3_post + sfc_diag + sfc_diag_post + GFS_surface_generic_post + GFS_PBL_generic_pre + hedmf + GFS_PBL_generic_post + GFS_GWD_generic_pre + cires_ugwp + cires_ugwp_post + GFS_GWD_generic_post + rayleigh_damp + GFS_suite_stateout_update + ozphys + GFS_DCNV_generic_pre + get_phi_fv3 + GFS_suite_interstitial_3 + + GFS_DCNV_generic_post + GFS_SCNV_generic_pre + GFS_SCNV_generic_post + GFS_suite_interstitial_4 + cnvc90 + GFS_MP_generic_pre + mp_fer_hires + GFS_MP_generic_post + maximum_hourly_diagnostics + + + + + GFS_stochastics + + + + diff --git a/gfsphysics/GFS_layer/GFS_diagnostics.F90 b/gfsphysics/GFS_layer/GFS_diagnostics.F90 index ec6c1233b..95f7f51e7 100644 --- a/gfsphysics/GFS_layer/GFS_diagnostics.F90 +++ b/gfsphysics/GFS_layer/GFS_diagnostics.F90 @@ -2804,6 +2804,19 @@ subroutine GFS_externaldiag_populate (ExtDiag, Model, Statein, Stateout, Sfcprop enddo #ifdef CCPP + if (Model%rdlai) then + idx = idx + 1 + ExtDiag(idx)%axes = 2 + ExtDiag(idx)%name = 'xlaixy' + ExtDiag(idx)%desc = 'leaf area index' + ExtDiag(idx)%unit = 'number' + ExtDiag(idx)%mod_name = 'gfs_sfc' + allocate (ExtDiag(idx)%data(nblks)) + do nb = 1,nblks + ExtDiag(idx)%data(nb)%var2 => sfcprop(nb)%xlaixy(:) + enddo + endif + if (Model%lsm == Model%lsm_ruc) then do num = 1,Model%lsoil_lsm write (xtra,'(i1)') num diff --git a/gfsphysics/GFS_layer/GFS_driver.F90 b/gfsphysics/GFS_layer/GFS_driver.F90 index 05f97bde8..28695eb5e 100644 --- a/gfsphysics/GFS_layer/GFS_driver.F90 +++ b/gfsphysics/GFS_layer/GFS_driver.F90 @@ -105,6 +105,11 @@ module GFS_driver !-------------- ! GFS initialze !-------------- +!## CCPP ## For the CCPP, much (*but not all*) of the code in this routine has been +! put into CCPP interstitial schemes, especially their init stages. Where this has been +! done, the code is wrapped in both preprocessor directives and comments describing the +! location of the code for CCPP execution. Lines in this routine that are not wrapped in +! a CCPP comment are still executed through this subroutine. subroutine GFS_initialize (Model, Statein, Stateout, Sfcprop, & Coupling, Grid, Tbd, Cldprop, Radtend, & #ifdef CCPP @@ -197,6 +202,11 @@ subroutine GFS_initialize (Model, Statein, Stateout, Sfcprop, & #endif ) +!## CCPP ##* These are called automatically in GFS_phys_time_vary.fv3.F90/GFS_phys_time_vary_init +! as part of CCPP physics init stage. The reason why these are in GFS_phys_time_vary_init and not +! in ozphys/h2ophys is that the ozone and h2o interpolation of the data read here is done in +! GFS_phys_time_vary_run, i.e. all work related to the ozone/h2o input data is in GFS_phys_time_vary, +! while ozphys/h2ophys are applying ozone/h2o forcing to the model state. #ifndef CCPP call read_o3data (Model%ntoz, Model%me, Model%master) call read_h2odata (Model%h2o_phys, Model%me, Model%master) @@ -207,6 +217,7 @@ subroutine GFS_initialize (Model, Statein, Stateout, Sfcprop, & call read_cidata ( Model%me, Model%master) endif #endif +!*## CCPP ## do nb = 1,nblks ix = Init_parm%blksz(nb) @@ -227,12 +238,12 @@ subroutine GFS_initialize (Model, Statein, Stateout, Sfcprop, & call Diag (nb)%create (ix, Model) enddo -#ifdef CCPP -! This logic deals with non-uniform block sizes for CCPP. When non-uniform block sizes +!## CCPP ##* This logic deals with non-uniform block sizes for CCPP. When non-uniform block sizes ! are used, it is required that only the last block has a different (smaller) size than ! all other blocks. This is the standard in FV3. If this is the case, set non_uniform_blocks ! to .true. and initialize nthreads+1 elements of the interstitial array. The extra element ! will be used by the thread that runs over the last, smaller block. +#ifdef CCPP if (minval(Init_parm%blksz)==maxval(Init_parm%blksz)) then non_uniform_blocks = .false. @@ -258,10 +269,13 @@ subroutine GFS_initialize (Model, Statein, Stateout, Sfcprop, & call Interstitial (nthrds+1)%create (Init_parm%blksz(nblks), Model) end if #endif +!*## CCPP ## !--- populate the grid components call GFS_grid_populate (Grid, Init_parm%xlon, Init_parm%xlat, Init_parm%area) +!## CCPP ##* GFS_phys_time_vary.fv3.F90/GFS_phys_time_vary_init; Note: this is run +! automatically during the CCPP physics initialization stage. #ifndef CCPP !--- read in and initialize ozone and water if (Model%ntoz > 0) then @@ -297,15 +311,20 @@ subroutine GFS_initialize (Model, Statein, Stateout, Sfcprop, & enddo endif #endif +!*## CCPP ## +!## CCPP ##* GFS_time_vary_pre.fv3.F90/GFS_time_vary_pre_init; Note: This is called +! during the CCPP physics initialization stage. #ifndef CCPP !--- Call gfuncphys (funcphys.f) to compute all physics function tables. call gfuncphys () #endif +!*## CCPP ## ! call gsmconst (Model%dtp, Model%me, .TRUE.) ! This is for Ferrier microphysics - notused - moorthi #ifndef CCPP +!## CCPP ##* GFS_typedefs.F90/control_initialize !--- define sigma level for radiation initialization !--- The formula converting hybrid sigma pressure coefficients to sigma coefficients follows Eckermann (2009, MWR) !--- ps is replaced with p0. The value of p0 uses that in http://www.emc.ncep.noaa.gov/officenotes/newernotes/on461.pdf @@ -313,13 +332,17 @@ subroutine GFS_initialize (Model, Statein, Stateout, Sfcprop, & allocate(si(Model%levr+1)) si = (Init_parm%ak + Init_parm%bk * p_ref - Init_parm%ak(Model%levr+1)) & / (p_ref - Init_parm%ak(Model%levr+1)) +!*## CCPP ## +!## CCPP ##* This functionality is now in GFS_rrtmg_setup.F90/GFS_rrtmg_setup_init; Note: it is automatically +! called during the CCPP physics initialization stage. call rad_initialize (si, Model%levr, Model%ictm, Model%isol, & Model%ico2, Model%iaer, Model%ialb, Model%iems, & Model%ntcw, Model%num_p2d, Model%num_p3d, Model%npdf3d, & Model%ntoz, Model%iovr_sw, Model%iovr_lw, Model%isubc_sw, & Model%isubc_lw, Model%icliq_sw, Model%crick_proof, Model%ccnorm,& Model%imp_physics, Model%norad_precip, Model%idate, Model%iflip, Model%me) +!*## CCPP ## deallocate (si) #endif @@ -328,6 +351,8 @@ subroutine GFS_initialize (Model, Statein, Stateout, Sfcprop, & if (Model%imp_physics == Model%imp_physics_mg) then !--- initialize Morrison-Gettelman microphysics #ifndef CCPP +!## CCPP ##* m_micro.F90/m_micro_init; Note: This is automatically called during the +! CCPP physics initialization stage. if (Model%fprcp <= 0) then call ini_micro (Model%mg_dcs, Model%mg_qcvar, Model%mg_ts_auto_ice(1)) elseif (Model%fprcp == 1) then @@ -364,6 +389,7 @@ subroutine GFS_initialize (Model, Statein, Stateout, Sfcprop, & endif call aer_cloud_init () +!*## CCPP ## #endif ! elseif (Model%imp_physics == Model%imp_physics_thompson) then !--- initialize Thompson Cloud microphysics @@ -371,13 +397,16 @@ subroutine GFS_initialize (Model, Statein, Stateout, Sfcprop, & print *,'SHOC is not currently compatible with Thompson MP -- shutting down' stop endif +!## CCPP ##* mp_thompson.F90/mp_thompson_init; Note: This is automatically called during the +! CCPP physics initialization stage. The check for SHOC is not included in the initialization +! (it is only performed above as part of the current routine). #ifndef CCPP call thompson_init() !--- add aerosol version later if(Model%ltaerosol) then print *,'Aerosol awareness is not included in this version of Thompson MP -- shutting down' stop endif -! +!*## CCPP ## elseif(Model%imp_physics == Model%imp_physics_wsm6) then !--- initialize WSM6 Cloud microphysics if(Model%do_shoc) then print *,'SHOC is not currently compatible with WSM6 -- shutting down' @@ -387,6 +416,8 @@ subroutine GFS_initialize (Model, Statein, Stateout, Sfcprop, & #endif ! else if(Model%imp_physics == Model%imp_physics_gfdl) then !--- initialize GFDL Cloud microphysics +!## CCPP ##* gfdl_cloud_microphys.F90/gfdl_cloud_microphys_init; Note: This is automatically called during the +! CCPP physics initialization stage. The check for SHOC is included in the GFDL microphysics initialization routine. #ifndef CCPP if(Model%do_shoc) then print *,'SHOC is not currently compatible with GFDL MP -- shutting down' @@ -395,6 +426,7 @@ subroutine GFS_initialize (Model, Statein, Stateout, Sfcprop, & call gfdl_cloud_microphys_init (Model%me, Model%master, Model%nlunit, Model%input_nml_file, & Init_parm%logunit, Model%fn_nml) #endif +!*## CCPP ## endif #ifndef CCPP @@ -402,8 +434,14 @@ subroutine GFS_initialize (Model, Statein, Stateout, Sfcprop, & if (Model%ras) call ras_init (Model%levs, Model%me) #endif +!## CCPP ##* sfc_drv.f/lsm_noah_init and sfc_noahmp_drv.f/noahmpdrv_init; Note: This is +! automatically called during the CCPP physics initialization stage. +#if 1 +!ifndef CCPP !--- initialize soil vegetation call set_soilveg(Model%me, Model%isot, Model%ivegsrc, Model%nlunit) +#endif +!*## CCPP ## !--- lsidea initialization if (Model%lsidea) then @@ -472,6 +510,7 @@ subroutine GFS_time_vary_step (Model, Statein, Stateout, Sfcprop, Coupling, & integer :: iw3jdn real(kind=kind_phys), parameter :: cn_hr = 3600._kind_phys +!## CCPP ##* GFS_time_vary_pre.fv3.F90/GFS_time_vary_pre_run nblks = size(blksz) !--- Model%jdat is being updated directly inside of FV3GFS_cap.F90 !--- update calendars and triggers @@ -552,12 +591,18 @@ subroutine GFS_time_vary_step (Model, Statein, Stateout, Sfcprop, Coupling, & print *,' phour ', Model%phour print *,' solhr ', Model%solhr endif +!*## CCPP ## +!## CCPP ##* All functionality except for the call to radupdate is now in +! GFS_rad_time_vary.fv3.F90/GFS_rad_time_vary_run. The call to radupdate is now +! in GFS_rrtmg_setup.F90/GFS_rrtmg_setup_run. !--- radiation time varying routine if (Model%lsswr .or. Model%lslwr) then call GFS_rad_time_vary (Model, Statein, Tbd, sec) endif +!*## CCPP ## +!## CCPP ##* All functionality is now in GFS_phys_time_vary.fv3.F90/GFS_phys_time_vary_run !--- physics time varying routine call GFS_phys_time_vary (Model, Grid, Tbd, Statein) @@ -593,7 +638,8 @@ subroutine GFS_time_vary_step (Model, Statein, Stateout, Sfcprop, Coupling, & enddo endif endif -! +!*## CCPP ## +!## CCPP ## This is not yet in the CCPP if (Model%iau_offset > 0) then kdt_iau = nint(Model%iau_offset*con_hr/Model%dtp) if (Model%kdt == kdt_iau+1) then @@ -605,6 +651,7 @@ subroutine GFS_time_vary_step (Model, Statein, Stateout, Sfcprop, Coupling, & if(Model%me == Model%master) print *,'in gfs_driver, at iau_center, zero out rad/phys accumulated diag fields, kdt=',Model%kdt,'kdt_iau=',kdt_iau,'iau_offset=',Model%iau_offset endif endif +!*## CCPP ## ! kludge for output if (Model%do_skeb) then @@ -629,10 +676,10 @@ subroutine GFS_time_vary_step (Model, Statein, Stateout, Sfcprop, Coupling, & enddo enddo endif - +!*## CCPP ## end subroutine GFS_time_vary_step - +!## CCPP ##* GFS_stochastics.F90/GFS_stochastics_run !------------------------------------------------------------------------- ! GFS stochastic_driver !------------------------------------------------------------------------- @@ -795,7 +842,7 @@ subroutine GFS_stochastic_driver (Model, Statein, Stateout, Sfcprop, Coupling, & endif end subroutine GFS_stochastic_driver - +!*## CCPP ## !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -804,6 +851,8 @@ end subroutine GFS_stochastic_driver ! !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +!## CCPP ##* GFS_rad_time_vary.fv3.F90/GFS_rad_time_vary_run except for the call to +! radupdate, which is in GFS_rrtmg_setup.F90/GFS_rrtmg_setup_run !----------------------------------------------------------------------- ! GFS_rad_time_vary !----------------------------------------------------------------------- @@ -869,8 +918,9 @@ subroutine GFS_rad_time_vary (Model, Statein, Tbd, sec) endif end subroutine GFS_rad_time_vary +!*## CCPP ## - +!## CCPP ## GFS_phys_time_vary.fv3.F90/GFS_phys_time_vary_run !----------------------------------------------------------------------- ! GFS_phys_time_vary !----------------------------------------------------------------------- @@ -985,8 +1035,9 @@ subroutine GFS_phys_time_vary (Model, Grid, Tbd, Statein) end subroutine GFS_phys_time_vary #endif +!*## CCPP ## - +!## CCPP ##* This is not in the CCPP !------------------ ! GFS_grid_populate !------------------ @@ -1027,6 +1078,7 @@ subroutine GFS_grid_populate (Grid, xlon, xlat, area) enddo end subroutine GFS_grid_populate +!*## CCPP ## end module GFS_driver diff --git a/gfsphysics/GFS_layer/GFS_physics_driver.F90 b/gfsphysics/GFS_layer/GFS_physics_driver.F90 index 19c40bf24..36266aab8 100644 --- a/gfsphysics/GFS_layer/GFS_physics_driver.F90 +++ b/gfsphysics/GFS_layer/GFS_physics_driver.F90 @@ -474,6 +474,13 @@ subroutine GFS_physics_driver & type(GFS_diag_type), intent(inout) :: Diag #endif ! +!## CCPP ## Note: Variables defined locally in this file for temporary calculations +! or transfer of data between schemes are defined in gfsphysics/GFS_layer/GFS_typedefs.F90 +! in the GFS_interstitial_type datatype. Type-bound procedures create, rad_reset, +! phys_reset, and mprint exist to allocate memory, to reset variables used in GFS_radiation_driver.F90, +! to reset variables used in GFS_physics_driver.F90, and to print the contents of the +! data type to the console + ! --- local variables !--- INTEGER VARIABLES @@ -569,10 +576,6 @@ subroutine GFS_physics_driver & real(kind=kind_phys), allocatable, dimension(:,:) :: & savet, saveq, saveu, savev -!--- pass precip type from MP to Noah MP - real(kind=kind_phys), dimension(size(Grid%xlon,1)) :: & - rainn_mp, rainc_mp, snow_mp, graupel_mp, ice_mp - !--- GFDL modification for FV3 real(kind=kind_phys), dimension(size(Grid%xlon,1),Model%levs+1) ::& @@ -692,22 +695,27 @@ subroutine GFS_physics_driver & !Stateout%gv0(:,:) = Statein%vgrs(:,:) !Stateout%gq0(:,:,:) = Statein%qgrs(:,:,:) +!## CCPP ## Note: Setting local variables from the Model DDT (without additional +! logic attached) is not necessary with the CCPP interstitial schemes with exceptions +! noted below. + !===> ... begin here ldiag_ugwp = Model%ldiag_ugwp ! !===> master = Model%master - me = Model%me - ix = size(Grid%xlon,1) - im = size(Grid%xlon,1) - ipr = min(im,10) + me = Model%me + ix = size(Grid%xlon,1) !## CCPP ## set in GFS_typedefs.F90/interstitial_create + im = size(Grid%xlon,1) !## CCPP ## set in GFS_typedefs.F90/interstitial_create + ipr = min(im,10) !## CCPP ## set in GFS_typedefs.F90/interstitial_create levs = Model%levs lsoil = Model%lsoil ntrac = Model%ntrac dtf = Model%dtf dtp = Model%dtp +!## CCPP ##* this block not yet in CCPP !------- ! For COORDE-2019 averaging with fwindow, it was done before ! 3Diag fixes and averaging ingested using "fdaily"-factor @@ -722,9 +730,11 @@ subroutine GFS_physics_driver & print *, 'VAY Model%fhzero = 0., Bad Averaged-diagnostics ' endif !------- +!*## CCPP ## kdt = Model%kdt lprnt = Model%lprnt +!## CCPP ## see GFS_typedefs.F90/interstitial_setup_tracers for logic for setting nvdiff nvdiff = ntrac ! vertical diffusion of all tracers! ntcw = Model%ntcw ntoz = Model%ntoz @@ -748,6 +758,7 @@ subroutine GFS_physics_driver & imp_physics = Model%imp_physics +!## CCPP ##* GFS_typedefs.F90/interstitial_setup_tracers nncl = ncld ! perform aerosol convective transport and PBL diffusion @@ -806,11 +817,12 @@ subroutine GFS_physics_driver & if (trans_aero) nvdiff = nvdiff + Model%ntchm if (ntke > 0) nvdiff = nvdiff + 1 ! adding tke to the list endif +!*## CCPP ## ! - ! For CCPP, this is in GFS_Interstitial%phys_reset(Model) in GFS_typedefs.F90 - +!## CCPP ##* GFS_typedefs.F90/interstitial_phys_reset kdtminus1 = kdt - 1 reset = mod(kdtminus1, nint(Model%avg_max_length/dtp)) == 0 +!*## CCPP ## ! !------------------------------------------------------------------------------------------- @@ -847,8 +859,10 @@ subroutine GFS_physics_driver & frain = dtf / dtp +!## CCPP ##* GFS_typedefs.F90/interstitial_create skip_macro = .false. - +!*## CCPP ## +!## CCPP ##* GFS_typedefs.F90/interstitial_setup_tracers if (ntiw > 0) then if (ntclamt > 0) then nn = ntrac - 2 @@ -860,8 +874,11 @@ subroutine GFS_physics_driver & else nn = ntrac + 1 endif +!*## CCPP ## +!## CCPP ##* GFS_typedefs.F90/interstitial_create allocate (clw(ix,levs,nn)) - +!*## CCPP ## +!## CCPP ##* GFS_typedefs.F90/interstitial_create Note: cnvc and cnvw are always allocated and initialized regardless of test condition if (Model%imfdeepcnv >= 0 .or. Model%imfshalcnv > 0 .or. & (Model%npdf3d == 3 .and. Model%num_p3d == 4) .or. & (Model%npdf3d == 0 .and. Model%ncnvcld3d == 1) ) then @@ -872,6 +889,8 @@ subroutine GFS_physics_driver & cnvw(i,k) = zero enddo enddo +!*## CCPP ## +!## CCPP ##* GFS_typedefs.F90/control_initialize Note: these are calculated regardless of test condition if (Model%npdf3d == 3 .and. Model%num_p3d == 4) then num2 = Model%num_p3d + 2 num3 = num2 + 1 @@ -881,32 +900,9 @@ subroutine GFS_physics_driver & !CCPP: num2 = Model%ncnvw !CCPP: num3 = Model%ncnvc endif -! -! --- initization for those precip type used in Noah MP -! - if (Model%lsm == Model%lsm_noahmp) then - do i=1,im - rainn_mp(i) = zero - rainc_mp(i) = zero - snow_mp(i) = zero - graupel_mp(i) = zero - ice_mp(i) = zero - enddo -! --- get the amount of different precip type for Noah MP -! --- convert from m/dtp to mm/s - if (Model%imp_physics == Model%imp_physics_mg .or. & - Model%imp_physics == Model%imp_physics_gfdl) then - tem = one / (dtp*con_p001) - do i=1,im - rainn_mp(i) = tem * (Diag%rain(i)-Diag%rainc(i)) - rainc_mp(i) = tem * Diag%rainc(i) - snow_mp(i) = tem * Diag%snow(i) - graupel_mp(i) = tem * Diag%graupel(i) - ice_mp(i) = tem * Diag%ice(i) - enddo - endif - endif ! if (Model%lsm == Model%lsm_noahmp) +!*## CCPP ## +!## CCPP ##* GFS_surface_generic.F90/GFS_surface_generic_pre_run ! --- set initial quantities for stochastic physics deltas if (Model%do_sppt) then Tbd%dtdtr = zero @@ -919,6 +915,8 @@ subroutine GFS_physics_driver & ! mg, sfc-perts ! --- scale random patterns for surface perturbations with perturbation size ! --- turn vegetation fraction pattern into percentile pattern +!## CCPP ##* Note: initialzations to zero are not needed in GFS_surface_generic.F90/GFS_surface_generic_pre_run +! since this function occurs in GFS_typedefs.F90/interstitial_phys_reset do i=1,im z01d(i) = zero zt1d(i) = zero @@ -956,7 +954,9 @@ subroutine GFS_physics_driver & enddo endif endif +!*## CCPP ## ! +!## CCPP ##* GFS_typedefs.F90/interstitial_create if (Model%do_shoc) then allocate (qrn(im,levs), qsnw(im,levs), & ncpl(im,levs), ncpi(im,levs)) @@ -969,7 +969,7 @@ subroutine GFS_physics_driver & enddo enddo endif -! +!## CCPP ##* GFS_typedefs.F90/coupling_create ## if (imp_physics == Model%imp_physics_thompson) then if(Model%ltaerosol) then allocate(ice00(im,levs)) @@ -979,7 +979,8 @@ subroutine GFS_physics_driver & allocate(ice00(im,levs)) endif endif - +!*## CCPP ## +!## CCPP ##* allocated in GFS_typedefs.F90/interstitial_create; initialized in GFS_typedefs.F90/interstitial_phys_reset if (imp_physics == Model%imp_physics_mg) then ! For MGB double moment microphysics allocate (qlcn(im,levs), qicn(im,levs), w_upi(im,levs), & cf_upi(im,levs), CNV_MFD(im,levs), & @@ -1001,12 +1002,14 @@ subroutine GFS_physics_driver & ncgl(i,k) = zero enddo enddo -! +!*## CCPP ## +!## CCPP ##* These variables are currently being allocated fully (im,levs) in GFS_typedefs.F90/interstitial_create else allocate (qlcn(1,1), qicn(1,1), w_upi(1,1), cf_upi(1,1), & CNV_MFD(1,1), CNV_DQLDT(1,1), & ! CNV_MFD(1,1), CNV_PRC3(1,1), CNV_DQLDT(1,1), & clcn(1,1), cnv_fice(1,1), cnv_ndrop(1,1), cnv_nice(1,1)) +!## CCPP ##* The following variables are local to gfdl_cloud_microphys.F90/gfdl_cloud_microphys_run if (imp_physics == Model%imp_physics_gfdl) then ! GFDL MP allocate (delp(im,1,levs), dz(im,1,levs), uin(im,1,levs), & vin(im,1,levs), pt(im,1,levs), qv1(im,1,levs), ql1(im,1,levs), & @@ -1017,7 +1020,9 @@ subroutine GFS_physics_driver & qg_dt(im,1,levs), p123(im,1,levs), refl(im,1,levs), den(im,levs)) endif endif +!*## CCPP ## +!## CCPP ## Only get_prs_fv3.F90/get_prs_fv3_run is a scheme (GFS_HYDRO is assumed to be undefined) #ifdef GFS_HYDRO call get_prs(im, ix, levs, ntrac, Statein%tgrs, Statein%qgrs, & Model%thermodyn_id, Model%sfcpress_id, & @@ -1028,7 +1033,9 @@ subroutine GFS_physics_driver & call get_prs_fv3 (ix, levs, ntrac, Statein%phii, Statein%prsi, & Statein%tgrs, Statein%qgrs, del, del_gz) #endif +!*## CCPP ## +!## CCPP ##* GFS_surface_generic.F90/GFS_surface_generic_pre_run do i = 1, IM sigmaf(i) = max( Sfcprop%vfrac(i),0.01 ) islmsk(i) = nint(Sfcprop%slmsk(i)) @@ -1053,9 +1060,13 @@ subroutine GFS_physics_driver & if (vegtype(i) < 1) vegtype(i) = 17 if (slopetyp(i) < 1) slopetyp(i) = 1 endif +!*## CCPP ## ! --- ... xw: transfer ice thickness & concentration from global to local variables +!## CCPP ## global to local variable transfer not necessary for these two zice(i) = Sfcprop%hice(i) fice(i) = Sfcprop%fice(i) ! ice fraction of lake/ocean wrt whole cell +!*## CCPP ##* +!## CCPP ##* GFS_surface_composites.F90/GFS_surface_composites_pre_run tice(i) = Sfcprop%tisfc(i) ! !GFDL work1(i) = (log(coslat(i) / (nlons(i)*latr)) - dxmin) * dxinv @@ -1065,23 +1076,34 @@ subroutine GFS_physics_driver & work1(i) = max(zero, min(one, work1(i))) work2(i) = one - work1(i) Diag%psurf(i) = Statein%pgr(i) +!*## CCPP ## +!## CCPP ##* GFS_surface_generic.F90/GFS_surface_generic_pre_run work3(i) = Statein%prsik(i,1) / Statein%prslk(i,1) +!*## CCPP ## !GFDL tem1 = con_rerth * (con_pi+con_pi)*coslat(i)/nlons(i) !GFDL tem2 = con_rerth * con_pi / latr !GFDL garea(i) = tem1 * tem2 +!## CCPP ## global to local variable transfer not necessary for these variables tem1 = Grid%dx(i) tem2 = Grid%dx(i) garea(i) = Grid%area(i) +!*## CCPP ## +!## CCPP ##* gwdc.f/gwdc_pre_run dlength(i) = sqrt( tem1*tem1+tem2*tem2 ) cldf(i) = Model%cgwf(1) * work1(i) + Model%cgwf(2) * work2(i) +!*## CCPP ## +!## CCPP ##* cs_conv.F90/cs_conv_pre_run wcbmax(i) = Model%cs_parm(1) * work1(i) + Model%cs_parm(2) * work2(i) -! +!*## CCPP ## +!## CCPP ##* GFS_typedefs.F90/interstitial_phys_reset dry(i) = .false. icy(i) = .false. wet(i) = .false. flag_cice(i) = .false. +!*## CCPP ## enddo ! +!## CCPP ##* GFS_surface_generic.F90/GFS_surface_generic_pre_run if (Model%cplflx) then do i=1,im islmsk_cice(i) = nint(Coupling%slimskin_cpl(i)) @@ -1096,8 +1118,9 @@ subroutine GFS_physics_driver & endif enddo endif +!*## CCPP ## -! DH* In CCPP, this is in GFS_surface_composites_pre +!## CCPP ##* GFS_surface_composites.F90/GFS_surface_composites_pre if (Model%frac_grid) then ! here Sfcprop%fice is fraction of the whole grid that is ice do i = 1, IM frland(i) = Sfcprop%landfrac(i) @@ -1189,7 +1212,6 @@ subroutine GFS_physics_driver & enddo enddo -! DH* In CCPP, this is in GFS_surface_composites_pre if (.not. Model%cplflx .or. .not. Model%frac_grid) then do i=1,im Sfcprop%zorll(i) = Sfcprop%zorl(i) @@ -1231,9 +1253,9 @@ subroutine GFS_physics_driver & semis3(i,2) = 0.95d0 endif enddo -! *DH +!*## CCPP ## -! +!## CCPP ## global to local variable transfer not necessary for these variables ! --- ... transfer soil moisture and temperature from global to local variables do k=1,lsoil do i=1,im @@ -1242,6 +1264,7 @@ subroutine GFS_physics_driver & slsoil(i,k) = Sfcprop%slc(i,k) !! clu: slc -> slsoil enddo enddo +!*## CCPP ## do k=1,levs do i=1,im @@ -1250,6 +1273,7 @@ subroutine GFS_physics_driver & dtdt(i,k) = zero dtdtc(i,k) = zero +!## CCPP ##* GFS_typedefs.F90/interstitial_phys_reset !vay-2018 ! Pure tendency arrays w/o accumulation of Phys-tendencies from each ! chain of GFS-physics (later add container for species) @@ -1265,9 +1289,10 @@ subroutine GFS_physics_driver & gw_dvdt(i,k) = zero gw_dtdt(i,k) = zero gw_kdis(i,k) = zero -! *DH +!*## CCPP ## enddo enddo +!## CCPP ##* GFS_suite_interstitial.F90/GFS_suite_interstitial_1_run do n=1,ntrac do k=1,levs do i=1,im @@ -1275,7 +1300,9 @@ subroutine GFS_physics_driver & enddo enddo enddo +!*## CCPP ## +!## CCPP ##* This block is not yet in CCPP. !----------------------------------------------- !vay-2018-19 ORO/UGWP process-oriented diagnostics ! @@ -1381,6 +1408,7 @@ subroutine GFS_physics_driver & endif endif !===========================Above Phys-tend Diag for COORDE ====================== +!*## CCPP ## ! --- ... initialize dtdt with heating rate from dcyc2 @@ -1388,7 +1416,7 @@ subroutine GFS_physics_driver & ! faster model time steps. ! sw: using cos of zenith angle as scaling factor ! lw: using surface air skin temperature as scaling factor - +!## CCPP ##* This is not in the CCPP yet. if (Model%pre_rad) then call dcyc2t3_pre_rad & ! --- inputs: @@ -1408,7 +1436,8 @@ subroutine GFS_physics_driver & ) else - +!*## CCPP ## +!** CCPP ## dcyc2.f/dcyc2t3_run Note: Check for Model%pre_rad was omitted, so this option is broken in CCPP call dcyc2t3 & ! --- inputs: ( Model%solhr, Model%slag, Model%sdec, Model%cdec, Grid%sinlat, & @@ -1429,15 +1458,17 @@ subroutine GFS_physics_driver & adjnirbmu, adjnirdfu, adjvisbmu, adjvisdfu, & adjnirbmd, adjnirdfd, adjvisbmd, adjvisdfd & ) - +!*## CCPP ## ! ! save temp change due to radiation - need for sttp stochastic physics !--------------------------------------------------------------------- endif ! +!## CCPP ##* This is not in the CCPP yet. if (Model%lsidea) then !idea jw dtdt(:,:) = zero endif +!*## CCPP ## ! --- convert lw fluxes for land/ocean/sea-ice models ! note: for sw: adjsfcdsw and adjsfcnsw are zenith angle adjusted downward/net fluxes. @@ -1457,12 +1488,15 @@ subroutine GFS_physics_driver & ! --- ... define the downward lw flux absorbed by ground +!## CCPP ##* GFS_surface_composites.F90/GFS_surface_composites_pre_run do i=1,im if (dry(i)) gabsbdlw3(i,1) = semis3(i,1) * adjsfcdlw(i) if (icy(i)) gabsbdlw3(i,2) = semis3(i,2) * adjsfcdlw(i) if (wet(i)) gabsbdlw3(i,3) = semis3(i,3) * adjsfcdlw(i) enddo +!*## CCPP ## +!## CCPP ##* GFS_suite_interstitial.F90/GFS_suite_interstitial_2_run if (Model%lssav) then ! --- ... accumulate/save output variables ! --- ... sunshine duration time is defined as the length of time (in mdl output @@ -1550,8 +1584,8 @@ subroutine GFS_physics_driver & endif ! end if_lssav_block do i=1,im - kcnv(i) = 0 - kinver(i) = levs + kcnv(i) = 0 !## CCPP ## GFS_typedefs.F90/interstitial_phys_reset + kinver(i) = levs !## CCPP ## GFS_typedefs.F90/interstitial_phys_reset invrsn(i) = .false. tx1(i) = zero tx2(i) = 10.0 @@ -1600,10 +1634,11 @@ subroutine GFS_physics_driver & enddo enddo endif - +!*## CCPP ## ! --- ... lu: initialize flag_guess, flag_iter, tsurf +!## CCPP ##* These initializations are done in GFS_typedefs.F90/interstitial_phys_reset except for as noted below do i=1,im ! tsurf(i) = Sfcprop%tsfc(i) flag_guess(i) = .false. @@ -1628,16 +1663,19 @@ subroutine GFS_physics_driver & Statein%vgrs(i,1)*Statein%vgrs(i,1)) & + max(zero, min(Tbd%phy_f2d(i,Model%num_p2d), 30.0)), one) enddo +!*## CCPP ## ! --- ... lu: iter-loop over (sfc_diff,sfc_drv,sfc_ocean,sfc_sice) - +!## CCPP ##* This loop is implemented using the subcycle/iteration capability in the CCPP SDF do iter=1,2 +!*## CCPP ## ! --- ... surface exchange coefficients ! ! if (lprnt) write(0,*)' tsfc=',Sfcprop%tsfc(ipr),' tsurf=',tsurf(ipr),'iter=', & ! iter ,'wet=',wet(ipr),'dry=',dry(ipr),' icy=',icy(ipr) +!## CCPP ##* sfc_diff.f/sfc_diff_run call sfc_diff & ! --- inputs: (im, Statein%pgr, & @@ -1655,13 +1693,16 @@ subroutine GFS_physics_driver & ! cd3, cdq3, rb3, stress3, ffmm3, ffhh3, fm103, fh23, wind, lprnt, ipr) ! ! --- ... lu: update flag_guess - +!*## CCPP ## +!## CCPP ##* GFS_surface_loop_control/GFS_surface_loop_control_part1_run do i=1,im if (iter == 1 .and. wind(i) < 2.0) then flag_guess(i) = .true. endif enddo - +!*## CCPP ## +!## CCPP ##* sfc_nst.f/sfc_nst_pre_run Note: the conditional is not included in the CCPP scheme, so calling +! this code is controlled by its presence in the active CCPP SDF if (Model%nstf_name(1) > 0) then do i=1,im if (wet(i)) then @@ -1692,7 +1733,8 @@ subroutine GFS_physics_driver & endif ! if (lprnt) write(0,*)' bef nst tseal=',tseal(ipr) & ! ,' tsfc3=',tsfc3(ipr,3),' tsurf3=',tsurf3(ipr,3),' tem=',tem - +!*## CCPP ## +!## CCPP ##* sfc_nst.f/sfc_nst_run call sfc_nst & ! --- inputs: (im, Statein%pgr, Statein%ugrs(:,1), Statein%vgrs(:,1), & @@ -1713,6 +1755,8 @@ subroutine GFS_physics_driver & ! --- outputs: qss3(:,3), gflx3(:,3), cmm3(:,3), chh3(:,3), evap3(:,3), & hflx3(:,3), ep1d3(:,3)) +!*## CCPP ## +!## CCPP ##* sfc_nst.f/sfc_nst_post_run ! do i=1,im !! if (wet(i) .and. .not.icy(i)) then @@ -1741,14 +1785,15 @@ subroutine GFS_physics_driver & endif enddo endif - +!*## CCPP ## ! if (lprnt) print *,' tseaz2=',Sfcprop%tsfc(ipr),' tref=',tref(ipr), & ! & ' dt_cool=',dt_cool(ipr),' dt_warm=',dt_warm(ipr),' kdt=',kdt +!## CCPP ## Note: This conditional is replaced by whether the sfc_ocean scheme is in the CCPP SDF else ! --- ... surface energy balance over ocean - +!## CCPP ##* sfc_ocean.F/sfc_ocean_run call sfc_ocean & ! --- inputs: (im, Statein%pgr, & @@ -1758,6 +1803,7 @@ subroutine GFS_physics_driver & ! --- outputs: qss3(:,3), cmm3(:,3), chh3(:,3), gflx3(:,3), evap3(:,3), & hflx3(:,3), ep1d3(:,3)) +!*## CCPP ## endif ! if nstf_name(1) > 0 @@ -1768,12 +1814,16 @@ subroutine GFS_physics_driver & ! --- ... surface energy balance over land ! +!## CCPP ##* Note: the conditional is not included in the CCPP, so calling +! the LSM scheme is controlled by its presence in the active CCPP SDF if (Model%lsm == Model%lsm_noah) then ! noah lsm call +!*## CCPP ## ! if (lprnt) write(0,*)' tseal=',tseal(ipr),' tsurf=',tsurf(ipr),iter & ! ,' stsoil0=',stsoil(ipr,:) ! &,' pgr=',pgr(ipr),' sfcemis=',sfcemis(ipr) +!## CCPP ##* sfc_drv.f/lsm_noah_run call sfc_drv & ! --- inputs: (im, lsoil, Statein%pgr, & @@ -1795,12 +1845,14 @@ subroutine GFS_physics_driver & hflx3(:,1), ep1d3(:,1), runof, & cmm3(:,1), chh3(:,1), evbs, evcw, sbsno, snowc, Diag%soilm, & snohf, Diag%smcwlt2, Diag%smcref2, Diag%wet1) +!*## CCPP ## ! if (lprnt) write(0,*)' tseae=',tseal(ipr),' tsurf=',tsurf(ipr),iter& ! ,' phy_f2d=',phy_f2d(ipr,num_p2d) ! if (lprnt) write(0,*)' hflx3=',hflx3(ipr,:),' evap3=',evap3(i,:) +!## CCPP ##* sfc_noahmp_drv.f/noahmpdrv_run ! Noah MP call ! elseif (Model%lsm == Model%lsm_noahmp) then @@ -1820,8 +1872,8 @@ subroutine GFS_physics_driver & Model%iopt_inf, Model%iopt_rad, Model%iopt_alb, & Model%iopt_snf, Model%iopt_tbot, Model%iopt_stc, & grid%xlat, xcosz, Model%yearlen, Model%julian, Model%imn,& - rainn_mp, rainc_mp, snow_mp, graupel_mp, ice_mp, & - + Sfcprop%drainncprv, Sfcprop%draincprv, Sfcprop%dsnowprv, & + Sfcprop%dgraupelprv, Sfcprop%diceprv, & ! --- in/outs: weasd3(:,1), snowd3(:,1), tsfc3(:,1), tprcp3(:,1), & Sfcprop%srflag, smsoil, stsoil, slsoil, Sfcprop%canopy, & @@ -1846,6 +1898,7 @@ subroutine GFS_physics_driver & ! if (lprnt) write(0,*)' tseae=',tsea(ipr),' tsurf=',tsurf(ipr),iter & ! &,' phy_f2d=',phy_f2d(ipr,num_p2d) +!*## CCPP ## elseif (Model%lsm == Model%lsm_ruc) then write (0,*) 'RUC LSM is available only in CCPP' @@ -1858,14 +1911,16 @@ subroutine GFS_physics_driver & ! &,' stsoil=',stsoil(ipr,:) ! --- ... surface energy balance over seaice - +!## CCPP ##* sfc_sice.f/sfc_sice_run (local adjustment to avoid resetting islmsk after call to sfc_sice_run) if (Model%cplflx) then do i=1,im if (flag_cice(i)) then islmsk (i) = islmsk_cice(i) endif enddo +!*## CCPP ## +!## CCPP ##* sfc_cice.f/sfc_cice_run ! call sfc_cice for sea ice points in the coupled model (i.e. islmsk=4) ! call sfc_cice & @@ -1879,10 +1934,12 @@ subroutine GFS_physics_driver & qss3(:,2), cmm3(:,2), chh3(:,2), evap3(:,2), hflx3(:,2), & stress3(:,2)) endif +!*## CCPP ## ! ! call sfc_sice for lake ice and for the uncoupled case, sea ice (i.e. islmsk=2) ! +!## CCPP ##* sfc_sice.f/sfc_sice_run call sfc_sice & ! --- inputs: (im, lsoil, Statein%pgr, & @@ -1898,7 +1955,8 @@ subroutine GFS_physics_driver & ! --- outputs: snowd3(:,2), qss3(:,2), snowmt, gflx3(:,2), cmm3(:,2), chh3(:,2), & evap3(:,2), hflx3(:,2)) - +!*## CCPP ## +!## CCPP ##* This section is not needed for CCPP. if (Model%cplflx) then do i = 1, im if (flag_cice(i)) then @@ -1906,12 +1964,13 @@ subroutine GFS_physics_driver & endif enddo endif +!*## CCPP ## ! if (lprnt) write(0,*)' tseaafticemodel =',tsfc3(ipr,2),' me=',me & ! &, ' kdt=',kdt,' iter=',iter,' fice=',fice(ipr) ! --- ... lu: update flag_iter and flag_guess - +!## CCPP ##* GFS_surface_loop_control.F90/GFS_surface_loop_control_part_2 do i=1,im flag_iter(i) = .false. flag_guess(i) = .false. @@ -1924,12 +1983,14 @@ subroutine GFS_physics_driver & endif enddo +!*## CCPP ## enddo ! end iter_loop ! --- generate ocean/land/ice composites +!## CCPP ##* GFS_surface_compoistes.F90/GFS_surface_composites_post_run if (Model%frac_grid) then do i=1, im ! @@ -2072,32 +2133,43 @@ subroutine GFS_physics_driver & endif enddo endif ! if (Model%frac_grid) +!*## CCPP ## ! --- compositing done ! if (lprnt) write(0,*) 'tisfc=',Sfcprop%tisfc(ipr),'tice=',tice(ipr),' kdt=',kdt do i=1,im +!## CCPP ##* GFS_surface_generic.F90/GFS_surface_generic_post_run Diag%epi(i) = ep1d(i) +!*## CCPP ## Diag%dlwsfci(i) = adjsfcdlw(i) Diag%ulwsfci(i) = adjsfculw(i) +!## CCPP ##* dcyc2.f/dcyc2t3_post_run Diag%uswsfci(i) = adjsfcdsw(i) - adjsfcnsw(i) +!*## CCPP ## Diag%dswsfci(i) = adjsfcdsw(i) +!## CCPP ##* GFS_surface_generic.F90/GFS_surface_generic_post_run Diag%gfluxi(i) = gflx(i) Diag%t1(i) = Statein%tgrs(i,1) Diag%q1(i) = Statein%qgrs(i,1,1) Diag%u1(i) = Statein%ugrs(i,1) Diag%v1(i) = Statein%vgrs(i,1) +!*## CCPP ## enddo ! --- ... update near surface fields +!## CCPP ##* sfc_diag.f/sfc_diag_run call sfc_diag (im, Statein%pgr, Statein%ugrs(:,1), Statein%vgrs(:,1), & Statein%tgrs(:,1), Statein%qgrs(:,1,1), work3, evap, & Sfcprop%ffmm, Sfcprop%ffhh, fm10, fh2, Sfcprop%tsfc, qss, & Sfcprop%f10m, Diag%u10m, Diag%v10m, Sfcprop%t2m, Sfcprop%q2m) +!*## CCPP ## +!## CCPP ##* This block is not in the CCPP Tbd%phy_f2d(:,Model%num_p2d) = zero +!*## CCPP ## if (Model%lsm == Model%lsm_noahmp) then do i=1,im @@ -2186,7 +2258,8 @@ subroutine GFS_physics_driver & Diag%snowca(i) = Diag%snowca(i) + snowc(i) * dtf Diag%snohfa(i) = Diag%snohfa(i) + snohf(i) * dtf Diag%ep(i) = Diag%ep(i) + ep1d(i) * dtf - +!*## CCPP ## +!## CCPP ##* sfc_diag_post.F90/sfc_diag_post_run Diag%tmpmax(i) = max(Diag%tmpmax(i), Sfcprop%t2m(i)) Diag%tmpmin(i) = min(Diag%tmpmin(i), Sfcprop%t2m(i)) @@ -2209,6 +2282,7 @@ subroutine GFS_physics_driver & enddo endif +!*## CCPP ## !!!!!!!!!!!!!!!!!Commented by Moorthi on July 18, 2012 !!!!!!!!!!!!!!!!!!! ! do i=1,im @@ -2247,6 +2321,8 @@ subroutine GFS_physics_driver & ! write(0,*)' before monsho hflx=',hflx,' me=',me ! write(0,*)' before monsho evap=',evap,' me=',me +!## CCPP ##* Note: In the CCPP, the vdftra array is prepared in GFS_PBL_generic.F90/GFS_PBL_generic_pre_run +! regardless of the following conditions. Therefore, this block is redundant in the CCPP and is not included. if (nvdiff == ntrac .or. Model%do_ysu .or. Model%shinhong) then ! ntiwx = 0 @@ -2271,6 +2347,7 @@ subroutine GFS_physics_driver & else if (Model%satmedmf) then if (Model%isatmedmf == 0) then ! initial version of satmedmfvdif (Nov 2018) +!## CCPP ##* satmedmfvdif.F/satmedmfvdif_run Note: The conditional above is checked in satmedmfvdif_init call satmedmfvdif(ix, im, levs, nvdiff, ntcw, ntiw, ntke, & dvdt, dudt, dtdt, dqdt, & Statein%ugrs, Statein%vgrs, Statein%tgrs, Statein%qgrs, & @@ -2281,7 +2358,9 @@ subroutine GFS_physics_driver & Statein%prslk, Statein%phii, Statein%phil, dtp, & Model%dspheat, dusfc1, dvsfc1, dtsfc1, dqsfc1, Diag%hpbl, & kinver, Model%xkzm_m, Model%xkzm_h, Model%xkzm_s) +!*## CCPP ## elseif (Model%isatmedmf == 1) then ! updated version of satmedmfvdif (May 2019) +!## CCPP ##* satmedmfvdifq.F/satmedmfvdifq_run Note: The conditional above is checked in satmedmfvdifq_init call satmedmfvdifq(ix, im, levs, nvdiff, ntcw, ntiw, ntke, & dvdt, dudt, dtdt, dqdt, & Statein%ugrs, Statein%vgrs, Statein%tgrs, Statein%qgrs, & @@ -2293,6 +2372,7 @@ subroutine GFS_physics_driver & Model%dspheat, dusfc1, dvsfc1, dtsfc1, dqsfc1, Diag%hpbl, & kinver, Model%xkzm_m, Model%xkzm_h, Model%xkzm_s, & Model%dspfac, Model%bl_upfr, Model%bl_dnfr) +!*## CCPP ## endif elseif (Model%hybedmf) then if (Model%moninq_fac > 0) then @@ -2366,10 +2446,15 @@ subroutine GFS_physics_driver & endif ! end if_hybedmf endif ! end if_do_shoc else +!*## CCPP ## +!## CCPP ## These variables are allocated in GFS_typedefs.F90/interstitial_create and +! initialized in GFS_typedefs.F90/interstitial_phys_reset; ntiwx is set in +! GFS_typedef.F90/interstitial_setup_tracers allocate(vdftra(ix,levs,nvdiff), dvdftra(im,levs,nvdiff)) dvdftra(:,:,:) = zero ntiwx = 0 ! +!## CCPP ##* GFS_PBL_generic.F90/GFS_PBL_generic_pre_run (ntiwx is set in GFS_typedef.F90/interstitial_setup_tracers) if (imp_physics == Model%imp_physics_wsm6) then ! WSM6 do k=1,levs @@ -2495,10 +2580,12 @@ subroutine GFS_physics_driver & enddo enddo endif -! +!*## CCPP ## ! for SHOC nvdiff=ntrac, so the following is not needed unless cplchm is true ! ----------------------------------------------------- if (Model%do_shoc) then +!## CCPP ##* moninshoc.f/moninshoc_run Note: The conditional above is not checked in the CCPP scheme; +! therefore the use of this scheme is controlled via the CCPP SDF call moninshoc(ix, im, levs, nvdiff, ntcw, nncl, dvdt, dudt, dtdt, dvdftra, & Statein%ugrs, Statein%vgrs, Statein%tgrs, vdftra, & Tbd%phy_f3d(1,1,ntot3d-1), prnum, ntkev, & @@ -2509,9 +2596,11 @@ subroutine GFS_physics_driver & dvsfc1, dtsfc1, dqsfc1, dkt, Diag%hpbl, kinver, & Model%xkzm_m, Model%xkzm_h, Model%xkzm_s, Model%xkzminv, & lprnt, ipr, me) +!*## CCPP ## else if (Model%satmedmf) then if (Model%isatmedmf == 0) then ! initial version of satmedmfvdif (Nov 2018) +!## CCPP ##* satmedmfvdif.F/satmedmfvdif_run Note: The conditional above is checked in satmedmfvdif_init call satmedmfvdif(ix, im, levs, nvdiff, ntcw, ntiwx, ntkev, & dvdt, dudt, dtdt, dvdftra, & Statein%ugrs, Statein%vgrs, Statein%tgrs, vdftra, & @@ -2522,7 +2611,9 @@ subroutine GFS_physics_driver & Statein%prslk, Statein%phii, Statein%phil, dtp, & Model%dspheat, dusfc1, dvsfc1, dtsfc1, dqsfc1, Diag%hpbl, & kinver, Model%xkzm_m, Model%xkzm_h, Model%xkzm_s) +!*## CCPP ## elseif (Model%isatmedmf == 1) then ! updated version of satmedmfvdif (May 2019) +!## CCPP ##* satmedmfvdifq.F/satmedmfvdifq_run Note: The conditional above is checked in satmedmfvdifq_init call satmedmfvdifq(ix, im, levs, nvdiff, ntcw, ntiwx, ntkev, & dvdt, dudt, dtdt, dvdftra, & Statein%ugrs, Statein%vgrs, Statein%tgrs, vdftra, & @@ -2534,8 +2625,11 @@ subroutine GFS_physics_driver & Model%dspheat, dusfc1, dvsfc1, dtsfc1, dqsfc1, Diag%hpbl, & kinver, Model%xkzm_m, Model%xkzm_h, Model%xkzm_s, & Model%dspfac, Model%bl_upfr, Model%bl_dnfr) +!*## CCPP ## endif elseif (Model%hybedmf) then +!## CCPP ## moninedmf.f/hedmf_run Note: The conditional above is not checked in the CCPP scheme; +! therefore the use of this scheme is controlled via the CCPP SDF if ( Model%moninq_fac > 0 ) then call moninedmf(ix, im, levs, nvdiff, ntcw, dvdt, dudt, dtdt, dvdftra, & Statein%ugrs, Statein%vgrs, Statein%tgrs, vdftra, & @@ -2548,6 +2642,8 @@ subroutine GFS_physics_driver & gamt, gamq, dkt, kinver, Model%xkzm_m, Model%xkzm_h, & Model%xkzm_s, lprnt, ipr, & Model%xkzminv, Model%moninq_fac) +!*## CCPP ## +!## CCPP ##* The following schemes are not in the CCPP yet. else call moninedmf_hafs(ix, im, levs, nvdiff, ntcw, dvdt, dudt, dtdt, dvdftra, & Statein%ugrs, Statein%vgrs, Statein%tgrs, vdftra, & @@ -2594,7 +2690,8 @@ subroutine GFS_physics_driver & endif ! end if_satmedmf endif ! end if_do_shoc -! +!*## CCPP ## +!## CCPP ## GFS_PBL_generic.F90/GFS_PBL_generic_post_run if (ntke > 0) then do k=1,levs do i=1,im @@ -2708,7 +2805,9 @@ subroutine GFS_physics_driver & deallocate(vdftra, dvdftra) endif +!*## CCPP ## +!## CCPP ##* GFS_PBL_generic.F90/GFS_PBL_generic_post_run if (Model%cplchm) then do i = 1, im tem1 = max(Diag%q1(i), 1.e-8) @@ -2770,7 +2869,9 @@ subroutine GFS_physics_driver & endif ! Ocean only, NO LAKES enddo endif +!*## CCPP ## !-------------------------------------------------------lssav if loop ---------- +!## CCPP ## GFS_PBL_generic.F90/GFS_PBL_generic_post_run if (Model%lssav) then do i=1,im Diag%dusfc (i) = Diag%dusfc(i) + dusfc1(i)*dtf @@ -2809,7 +2910,9 @@ subroutine GFS_physics_driver & endif endif ! end if_lssav +!*## CCPP ## +!## CCPP ##* This block not yet in CCPP. ! if (ldiag_ugwp) then ! @@ -2836,12 +2939,14 @@ subroutine GFS_physics_driver & enddo endif endif +!*## CCPP ## !============================================================= GW-physics start ! ! Orographic gravity wave drag parameterization ! --------------------------------------------- +!## CCPP ##* GFS_GWD_generic.F90/GFS_GWD_generic_pre_run if (nmtvr == 14) then ! current operational - as of 2014 do i=1,im ! vay-2018 @@ -2897,7 +3002,9 @@ subroutine GFS_physics_driver & gamma = zero ; sigma = zero ; elvmax = zero endif ! end if_nmtvr +!*## CCPP ## +!## CCPP ##* cires_ugwp.F90/cires_ugwp_run - only V0 is implemented ! !===== UGWP-start: two versions V0 (knob_ugwp_version=0) and V1(knob_ugwp_version=1) ! @@ -3043,6 +3150,8 @@ subroutine GFS_physics_driver & !! enddo !! endif +!## CCPP ##* rayleigh_damp.f/rayleigh_damp_run Note: Conditional IS checked +! within the scheme (returns from scheme if condition is not met) ! Rayleigh damping near the model top if( .not. Model%lsidea .and. Model%ral_ts > zero) then call rayleigh_damp(im, ix, im, levs, dvdt, dudt, dtdt, & @@ -3059,6 +3168,9 @@ subroutine GFS_physics_driver & ! Standard accum-Update before "moist physics" by "PBL + GWP + RF" as in GFS/GSM ! +!## CCPP ##* GFS_suite_interstitial.F90/GFS_suite_stateout_update Note: Terms +! containing gw_* are related to the CIRES UGWP code and are not currently in +! this scheme. do k=1,levs do i=1,im Stateout%gt0(i,k) = Statein%tgrs(i,k) + dtdt(i,k) * dtp @@ -3067,10 +3179,9 @@ subroutine GFS_physics_driver & enddo enddo Stateout%gq0(1:im,:,:) = Statein%qgrs(1:im,:,:) + dqdt(1:im,:,:) * dtp +!*## CCPP ## -! *DH - -! DH* this block not yet in CCPP +!## CCPP ##* This is not in the CCPP yet. !================================================================================ ! above: updates of the state by UGWP oro-GWS and RF-damp ! Diag%tav_ugwp & Diag%uav_ugwp(i,k)-Updated U-T state before moist/micro ! physics @@ -3085,24 +3196,30 @@ subroutine GFS_physics_driver & enddo enddo endif +!*## CCPP ## !================================================================================ ! It is not clear Do we need it, "ideaca_up", having stability check inside UGWP-module - +!## CCPP ##* This is not in the CCPP yet. if (Model%lsidea) then ! idea convective adjustment call ideaca_up(Statein%prsi,Stateout%gt0,ix,im,levs+1) endif +!*## CCPP ## ! --- ... ozone physics if (ntoz > 0 .and. ntrac >= ntoz) then if (oz_coeff > 4) then +!## CCPP ##* ozphys_2015.f/ozphys_2015_run Note: The conditionals above are not +! checked in the scheme. The scheme's use is controlled by its presense in the +! CCPP SDF call ozphys_2015 (ix, im, levs, levozp, dtp, & Stateout%gq0(1,1,ntoz), & Stateout%gq0(1,1,ntoz), & Stateout%gt0, oz_pres, Statein%prsl, & Tbd%ozpl, oz_coeff, del, Model%ldiag3d, & dq3dt_loc(1,1,6), me) +!*## CCPP ## ! if (Model%ldiag3d) then ! do k=1,levs ! do i=1,im @@ -3114,12 +3231,14 @@ subroutine GFS_physics_driver & ! enddo ! endif else +!## CCPP ##* ozphys.f/ozphys_run call ozphys (ix, im, levs, levozp, dtp, & Stateout%gq0(1,1,ntoz), & Stateout%gq0(1,1,ntoz), & Stateout%gt0, oz_pres, Statein%prsl, & Tbd%ozpl, oz_coeff, del, Model%ldiag3d, & dq3dt_loc(1,1,6), me) +!*## CCPP ## ! if (Model%ldiag3d) then ! do k=1,levs ! do i=1,im @@ -3134,10 +3253,13 @@ subroutine GFS_physics_driver & endif if (Model%h2o_phys) then +!## CCPP ## h2ophys.f/h2ophys_run Note: The conditional is not checked within +! the scheme. The scheme's use is controlled via the CCPP SDF. call h2ophys (ix, im, levs, levh2o, dtp, Stateout%gq0(1,1,1), & Stateout%gq0(1,1,1), h2o_pres, Statein%prsl, & Tbd%h2opl, h2o_coeff, Model%ldiag3d, & dq3dt_loc(1,1,1), me) +!*## CCPP ## endif ! --- ... to side-step the ozone physics @@ -3172,6 +3294,7 @@ subroutine GFS_physics_driver & ! &,' lat=',lat,' kdt=',kdt,' me=',me ! if (lprnt) write(7000,*)' bef convection gv0=',gv0(ipr,:) +!## CCPP ## GFS_DCNV_generic.F90/GFS_DCNV_generic_pre_run if (Model%ldiag3d) then do k=1,levs do i=1,im @@ -3191,7 +3314,9 @@ subroutine GFS_physics_driver & if (Model%cplchm) then Coupling%dqdti(1:im,:) = zero endif ! end if_cplchm +!*## CCPP ## +!## CCPP ## Only get_prs_fv3.F90/get_phi_fv3_run is a scheme (GFS_HYDRO is assumed to be undefined) #ifdef GFS_HYDRO call get_phi(im, ix, levs, ntrac, Stateout%gt0, Stateout%gq0, & Model%thermodyn_id, Model%sfcpress_id, & @@ -3202,7 +3327,10 @@ subroutine GFS_physics_driver & call get_phi_fv3 (ix, levs, ntrac, Stateout%gt0, Stateout%gq0, & del_gz, Statein%phii, Statein%phil) #endif +!*## CCPP ## +!## CCPP ## These variables are initialized every physics time step through +! GFS_typedefs.F90/interstitial_phys_reset do k=1,levs do i=1,im clw(i,k,1) = zero @@ -3218,16 +3346,20 @@ subroutine GFS_physics_driver & ice00 (:,:) = zero endif endif - +!*## CCPP ## ! --- ... for convective tracer transport (while using ras, csaw, or samf) ! (the code here implicitly assumes that ntiw=ntcw+1) +!## CCPP ## Most of this code block is in GFS_typedefs.F90/interstitial_setup_tracers except +! for code that needs to be executed every time step (noted below). For those lines, +! they are in GFS_suite_interstitial.F90/GFS_suite_interstitial_3_run. ntk = 0 tottracer = 0 if (Model%cscnv .or. Model%satmedmf .or. Model%trans_trac ) then otspt(:,:) = .true. ! otspt is used only for cscnv otspt(1:3,:) = .false. ! this is for sp.hum, ice and liquid water +!## CCPP ##* GFS_suite_interstitial.F90/GFS_suite_interstitial_3_run tracers = 2 do n=2,ntrac if ( n /= ntcw .and. n /= ntiw .and. n /= ntclamt .and. & @@ -3239,6 +3371,7 @@ subroutine GFS_physics_driver & clw(i,k,tracers) = Stateout%gq0(i,k,n) enddo enddo +!*## CCPP ## if (ntke == n ) then otspt(tracers+1,1) = .false. ntk = tracers @@ -3252,19 +3385,21 @@ subroutine GFS_physics_driver & enddo tottracer = tracers - 2 endif ! end if_ras or cfscnv or samf +!*## CCPP ## ! if (kdt == 1 .and. me == 0) & ! write(0,*)' trans_trac=',Model%trans_trac,' tottracer=', & ! & tottracer,' kdt=',kdt,' ntk=',ntk - +!## CCPP ##* These variables are initialized in GFS_typedefs.F90/interstitial_phys_reset do i=1,im ktop(i) = 1 kbot(i) = levs enddo +!*## CCPP ## ! --- ... calling condensation/precipitation processes ! -------------------------------------------- - +!## CCPP ## GFS_suite_interstitial.F90/GFS_suite_interstitial_3_run if (ntcw > 0) then ! if (imp_physics == Model%imp_physics_mg .and. .not. Model%do_shoc) then ! compute rhc for GMAO macro physics cloud pdf if (imp_physics == Model%imp_physics_mg .and. Model%crtrh(2) < 0.5) then ! compute rhc for GMAO macro physics cloud pdf @@ -3311,13 +3446,17 @@ subroutine GFS_physics_driver & enddo endif endif ! ntcw > 0 +!*## CCPP ## ! if (imp_physics == Model%imp_physics_zhao_carr .or. & imp_physics == Model%imp_physics_zhao_carr_pdf) then ! zhao-carr microphysics +!## CCPP ##* precpd.f/zhaocarr_precpd_run do i=1,im psautco_l(i) = Model%psautco(1)*work1(i) + Model%psautco(2)*work2(i) prautco_l(i) = Model%prautco(1)*work1(i) + Model%prautco(2)*work2(i) enddo +!*## CCPP ## +!## CCPP ##* GFS_suite_interstitial.F90/GFS_suite_interstitial_3_run do k=1,levs do i=1,im clw(i,k,1) = Stateout%gq0(i,k,ntcw) @@ -3346,24 +3485,39 @@ subroutine GFS_physics_driver & clw(i,k,2) = Stateout%gq0(i,k,ntcw) ! water enddo enddo +!*## CCPP ## +!## CCPP ## These lines are not in the CCPP since it appeared that they were +! not needed. These variables are only ever used if (imp_physics == 99 .or. imp_physics == 98) +! which is handled by the first if statement. else do i=1,im psautco_l(i) = Model%psautco(1)*work1(i) + Model%psautco(2)*work2(i) prautco_l(i) = Model%prautco(1)*work1(i) + Model%prautco(2)*work2(i) enddo +!*## CCPP ## +!## CCPP ##* GFS_suite_interstitial.F90/GFS_suite_interstitial_3_run rhc(:,:) = one +!*## CCPP ## endif ! ! Call SHOC if do_shoc is true and shocaftcnv is false ! +!## CCPP ##* gcm_shoc.F90/shoc_run Note: do_shoc is not checked in the scheme, so +! using this scheme is controlled via the CCPP SDF. if (Model%do_shoc .and. .not. Model%shocaftcnv) then if (imp_physics == Model%imp_physics_mg) then do k=1,levs do i=1,im +!## CCPP ##* These lines are commented out in gcm_shoc.F90/shoc_run since they are +! previously executed in GFS_suite_interstitial.F90/GFS_suite_interstitial_3_run ! clw(i,k,1) = Stateout%gq0(i,k,ntiw) ! ice ! clw(i,k,2) = Stateout%gq0(i,k,ntcw) ! water +!*## CCPP ## +!## CCPP ##* These lines are commented out in gcm_shoc.F90/shoc_run since it is +! not necessary to copy global variables to local variables ncpl(i,k) = Stateout%gq0(i,k,ntlnc) ncpi(i,k) = Stateout%gq0(i,k,ntinc) +!*## CCPP ## enddo enddo if (abs(Model%fprcp) == 1 .or. mg3_as_mg2) then @@ -3475,6 +3629,7 @@ subroutine GFS_physics_driver & ! &, Stateout%gq0(1:ix,1:levs,1),clw(1,1,2),clw(1,1,1) & ! &, ' shoc ', grid%xlon(1:im), grid%xlat(1:im)) +!## CCPP ## this is in CCPP's gcm_shoc (but commented out because not needed) if (imp_physics == Model%imp_physics_mg) then do k=1,levs do i=1,im @@ -3483,7 +3638,7 @@ subroutine GFS_physics_driver & enddo enddo endif - +!*## CCPP ## ! do k=1,levs ! do i=1,im ! sgs_cld(i,k) = sgs_cld(i,k) + shoc_cld(i,k) @@ -3506,6 +3661,7 @@ subroutine GFS_physics_driver & ! write(0,*)' aft shoc gq0=',gq0(1,:,1),' lat=',lat ! write(0,*)' aft shoc gu0=',gu0(1,:),' lat=',lat ! +!*## CCPP ## endif ! if(do_shoc) ! @@ -3513,6 +3669,9 @@ subroutine GFS_physics_driver & ! ----------------------------------- if (Model%do_deep) then +!## CCPP ## GFS_DCNV_generic.F90/GFS_DCNV_generic_pre_run Note: The conditional +! above is not checked within the scheme, so the execution of the code below +! is controlled via its presence in the CCPP SDF. if (Model%do_ca) then do k=1,levs do i=1,im @@ -3532,10 +3691,11 @@ subroutine GFS_physics_driver & enddo enddo endif - +!*## CCPP ## if (.not. Model%ras .and. .not. Model%cscnv) then if (Model%imfdeepcnv == 1) then ! no random cloud top +!## CCPP ##* sascnvn.F/sascnvn_run call sascnvn (im, ix, levs, Model%jcap, dtp, del, & Statein%prsl, Statein%pgr, Statein%phil, clw(:,:,1:2), & Stateout%gq0(:,:,1), Stateout%gt0, Stateout%gu0, & @@ -3549,12 +3709,16 @@ subroutine GFS_physics_driver & Model%c1_deep, Model%betal_deep, Model%betas_deep, & Model%evfact_deep, Model%evfactl_deep, & Model%pgcon_deep) +!*## CCPP ## elseif (Model%imfdeepcnv == 2) then +!## CCPP ##* GFS_typedefs.f90/interstitial_setup_tracers if(.not. Model%satmedmf .and. .not. Model%trans_trac) then nsamftrac = 0 else nsamftrac = tottracer endif +!*## CCPP ## +!## CCPP ##* samfdeepcnv.f/samfdeepcnv_run call samfdeepcnv(im, ix, levs, dtp, itc, Model%ntchm, ntk, nsamftrac, & del, Statein%prsl, Statein%pgr, Statein%phil, clw, & Stateout%gq0(:,:,1), Stateout%gt0, & @@ -3570,6 +3734,7 @@ subroutine GFS_physics_driver & Model%c1_deep, Model%betal_deep, Model%betas_deep, & Model%evfact_deep, Model%evfactl_deep, & Model%pgcon_deep, Model%asolfac_deep) +!*## CCPP ## ! if (lprnt) print *,' rain1=',rain1(ipr) !elseif (Model%imfdeepcnv == 3) then ! if (Model%me==0) then @@ -3582,6 +3747,7 @@ subroutine GFS_physics_driver & ! stop ! end if elseif (Model%imfdeepcnv == 0) then ! random cloud top +!## CCPP ##* This is not in the CCPP yet. call sascnv (im, ix, levs, Model%jcap, dtp, del, & Statein%prsl, Statein%pgr, Statein%phil, clw(:,:,1:2), & Stateout%gq0(:,:,1), Stateout%gt0, Stateout%gu0, & @@ -3592,9 +3758,10 @@ subroutine GFS_physics_driver & ! QLCN, QICN, w_upi,cf_upi, CNV_MFD, CNV_PRC3, & CNV_DQLDT,CLCN,CNV_FICE,CNV_NDROP,CNV_NICE,imp_physics ) ! if (lprnt) print *,' rain1=',rain1(ipr),' rann=',rann(ipr,1) +!*## CCPP ## endif -! +!## CCPP ##* GFS_DCNV_generic.F90/GFS_DCNV_generic_post_run if (Model%npdf3d == 3 .and. Model%num_p3d == 4) then do k=1,levs do i=1,im @@ -3616,9 +3783,10 @@ subroutine GFS_physics_driver & if(Model%do_ca) then Coupling%cape(:) = cld1d(:) endif - +!*## CCPP ## ! else ! ras or cscnv +!## CCPP ## cs_conv.F90/cs_conv_pre_run fscav(:) = zero if (Model%cscnv) then ! Chikira-Sugiyama convection scheme (via CSU) @@ -3633,6 +3801,7 @@ subroutine GFS_physics_driver & ! dqdt(i,k,3) = clw(i,k,1) ! enddo ! enddo +!*## CCPP ## ! ! JLS NOTE: The convective mass fluxes (dt_mf, dd_mf and ud_mf) passed in and out of cs_conv have not been multiplied by @@ -3648,6 +3817,7 @@ subroutine GFS_physics_driver & ! JLS NOTE: The variable rain1 output from cs_convr (called prec inside the subroutine) is a precipitation flux (kg/m2/sec), ! not meters LWE like the other schemes. It is converted to m after the call to cs_convr. +!## CCPP ## cs_conv.F90/cs_conv_run call cs_convr (ix, im, levs, ntrac+1, nn, tottracer+3, & Model%nctp, otspt(1:ntrac+1,1:2), 1, & kdt, Stateout%gt0, Stateout%gq0(:,:,1:1), rain1, & @@ -3662,7 +3832,7 @@ subroutine GFS_physics_driver & w_upi, cf_upi, CNV_MFD, CNV_DQLDT, & ! w_upi, cf_upi, CNV_MFD, CNV_PRC3, CNV_DQLDT, & CLCN, CNV_FICE, CNV_NDROP, CNV_NICE, imp_physics) - +!*## CCPP ## ! if (lprnt) write(0,*)'aftcsgt0=',Stateout%gt0(ipr,:) ! if (lprnt) write(0,*)'aftcstke=',clw(ipr,1:25,ntk) @@ -3676,8 +3846,9 @@ subroutine GFS_physics_driver & ! &, Stateout%gq0(1:ix,1:levs,1),clw(1,1,2),clw(1,1,1) & ! &, ' cs_conv', grid%xlon(1:im), grid%xlat(1:im)) - +!## CCPP ##* Not in the CCPP. TODO: Does this need to be in cs_conv_post_run? rain1(:) = rain1(:) * (dtp*0.001) +!## CCPP ##* cs_conv.F90/cs_conv_post_run if (Model%do_aw) then do k=1,levs kk = min(k+1,levs) ! assuming no cloud top reaches the model top @@ -3686,7 +3857,7 @@ subroutine GFS_physics_driver & enddo enddo endif - +!*## CCPP ## ! if (lprnt) then ! write(0,*)' gt01=',stateout%gt0(ipr,:),' kdt=',kdt ! write(0,*)' gq01=',stateout%gq0(ipr,:,1),' kdt=',kdt @@ -3698,7 +3869,7 @@ subroutine GFS_physics_driver & else ! ras version 2 -! DH* this code not yet in CCPP (belongs to GFS_DCNV_generic_pre?) +!## CCPP ##* This code not yet in CCPP Note: Likely belongs in rascnv_pre. if (Model%ccwf(1) >= zero .or. Model%ccwf(2) >= 0) then do i=1,im ccwfac(i) = Model%ccwf(1)*work1(i) + Model%ccwf(2)*work2(i) @@ -3730,14 +3901,14 @@ subroutine GFS_physics_driver & ! if (ncld ==2) revap = .false. trcmin(:) = -999999.0 if (ntk-2 > 0) trcmin(ntk-2) = 1.0e-4 - +!*## CCPP ## ! if (lprnt) write(0,*)' gt04bras=',Stateout%gt0(ipr,:) ! if (lprnt) write(0,*)' gq04bras=',Stateout%gq0(ipr,:,1) ! if (lprnt) write(0,*)'befrasclw1=',clw(ipr,:,1) ! if (lprnt) write(0,*)'befrasclw2=',clw(ipr,:,2) ! if (lprnt) write(0,*)'befrastke=',clw(ipr,:,ntk) ! if (lprnt) write(0,*)'trcmin=',trcmin(ntk-2),' ntk=',ntk - +!## CCPP ## Not in CCPP yet. call rascnv (im, ix, levs, dtp, dtf, Tbd%rann, Stateout%gt0, & Stateout%gq0, Stateout%gu0, Stateout%gv0, clw, & tottracer, fscav, Statein%prsi, Statein%prsl, & @@ -3753,6 +3924,7 @@ subroutine GFS_physics_driver & CLCN, CNV_FICE, CNV_NDROP, CNV_NICE, imp_physics, & ! trcmin) trcmin, ntk) +!*## CCPP ## ! if (lprnt) write(0,*)' gt04=',Stateout%gt0(ipr,1:60) ! if (lprnt) write(0,*)' gq04=',Stateout%gq0(ipr,1:60,1) @@ -3772,10 +3944,13 @@ subroutine GFS_physics_driver & ! &,' cnv_prc3sum=',sum(cnv_prc3(ipr,1:levs)) ! if (lprnt) write(0,*)' gt04=',gt0(ipr,1:10) +!## CCPP ##* Not in CCPP yet. cld1d = 0 +!*## CCPP ## endif ! end if_not_ras +!## CCPP ##* GFS_DCNV_generic.F90/GFS_DCNV_generic_post if(Model%isppt_deep)then do k=1,levs do i=1,im @@ -3787,13 +3962,16 @@ subroutine GFS_physics_driver & enddo deallocate(savet, saveq, saveu, savev) endif - +!*## CCPP ## else ! no parameterized deep convection +!## CCPP ##* GFS_typedefs.F90/interstitial_phys_reset Note: These are only zeroed out +! initially, prior to calling physics. cld1d = zero rain1 = zero ud_mf = zero dd_mf = zero dt_mf = zero +!*## CCPP ## endif ! if (lprnt) then @@ -3803,6 +3981,7 @@ subroutine GFS_physics_driver & ! write(0,*)' aftcnvgq1=',(stateout%gq0(ipr,k,ntcw),k=1,levs) ! endif ! +!## CCPP ## GFS_DCNV_generic.F90/GFS_DCNV_generic_post_run do i=1,im Diag%rainc(i) = frain * rain1(i) enddo @@ -3828,7 +4007,9 @@ subroutine GFS_physics_driver & endif ! if (ldiag3d) endif ! end if_lssav +!*## CCPP ## ! +!## CCPP ##* This block not yet in CCPP. if (ldiag_ugwp) then tem = frain/dtp do k=1,levs @@ -3858,6 +4039,7 @@ subroutine GFS_physics_driver & ! from previous time step we need: LH-release + cld_top/bot + precip ! ! endif +!*## CCPP ## ! if (lprnt) write(7000,*)' bef cnvgwd gu0=',gu0(ipr,:) ! &,' lat=',lat,' kdt=',kdt,' me=',me @@ -3865,7 +4047,9 @@ subroutine GFS_physics_driver & ! !----------------Convective gravity wave drag parameterization starting -------- -! DH* this block is in gwdc_pre +!## CCPP ##* gwdc.f/gwdc_pre Note: The conditional above is not in the scheme, so +! the execution of the code below is controlled by its presence in the CCPP SDF +! --- ... calculate maximum convective heating rate if (Model%do_cnvgwd) then ! call convective gravity wave drag allocate(gwdcu(im,levs), gwdcv(im,levs)) @@ -3887,6 +4071,7 @@ subroutine GFS_physics_driver & do i=1,im if (work4(i) > zero) cumabs(i) = cumabs(i) / (dtp*work4(i)) enddo +!*## CCPP ## ! DH* 20180817 - note: the above non-CCPP code modifies work3, which until then was defined ! as the ratio of the exner function between midlayer and interface at lowest model layer: @@ -3965,6 +4150,9 @@ subroutine GFS_physics_driver & ! --- ... end check print ******************************************** +!## CCPP ##* gwdc.f/gwdc_run Note: The conditional above is not in the scheme, so +! the execution of the code below is controlled by its presence in the CCPP SDF + !GFDL replacing lat with "1" ! call gwdc(im, ix, im, levs, lat, gu0, gv0, gt0, gq0, dtp, & call gwdc (im, ix, im, levs, 1, Statein%ugrs, Statein%vgrs, & @@ -3995,7 +4183,7 @@ subroutine GFS_physics_driver & ! endif ! --- ... write out cloud top stress and wind tendencies - +!## CCPP ## gwdc.f/gwdc_post_run if (Model%lssav) then do i=1,im Diag%dugwd(i) = Diag%dugwd(i) + dusfcg(i)*dtf @@ -4026,6 +4214,7 @@ subroutine GFS_physics_driver & ! &gwdcu(ipr,k), ' gv0=', gv0(ipr,k),' gwdcv=',gwdcv(ipr,k) ! &,' k=',k enddo +!*## CCPP ## ! if (lprnt) then ! if (fhour >= fhourpr) then @@ -4055,6 +4244,7 @@ subroutine GFS_physics_driver & ! &,' lat=',lat,' kdt=',kdt,' me=',me !----------------Convective gravity wave drag parameterization over -------- +!## CCPP ## GFS_SCNV_generic.F90/GFS_SCNV_generic_pre_run if (Model%ldiag3d) then do k=1,levs do i=1,im @@ -4062,6 +4252,7 @@ subroutine GFS_physics_driver & enddo enddo endif +!*## CCPP ## if (.not. Model%do_shoc) then @@ -4069,6 +4260,7 @@ subroutine GFS_physics_driver & ! -------------------------------------- if (Model%imfshalcnv == 1) then ! opr option now at 2014 !----------------------- +!## CCPP ##* shalcnv.F/shalcnv_run call shalcnv (im, ix, levs, Model%jcap, dtp, del, Statein%prsl, & Statein%pgr, Statein%phil, clw, Stateout%gq0, & Stateout%gt0, Stateout%gu0, Stateout%gv0, rain1, & @@ -4076,7 +4268,9 @@ subroutine GFS_physics_driver & Diag%hpbl, hflx, evap, ud_mf, dt_mf, cnvw, cnvc, & Model%clam_shal, Model%c0s_shal, Model%c1_shal, & Model%pgcon_shal) +!*## CCPP ## +!## CCPP ##* GFS_SCNV_generic.F90/GFS_SCNV_generic_post_run do i=1,im Diag%rainc(i) = Diag%rainc(i) + frain * rain1(i) enddo @@ -4095,13 +4289,17 @@ subroutine GFS_physics_driver & enddo enddo endif +!*## CCPP ## elseif (Model%imfshalcnv == 2) then +!## CCPP ##* GFS_typedef.F90/interstitial_setup_tracers if(.not. Model%satmedmf .and. .not. Model%trans_trac) then nsamftrac = 0 else nsamftrac = tottracer endif +!*## CCPP ## +!## CCPP ##* samfshalcnv.f/samfshalcnv_run call samfshalcnv (im, ix, levs, dtp, itc, Model%ntchm, ntk, nsamftrac, & del, Statein%prsl, Statein%pgr, Statein%phil, clw, & Stateout%gq0(:,:,1), Stateout%gt0, & @@ -4111,7 +4309,8 @@ subroutine GFS_physics_driver & dt_mf, cnvw, cnvc, & Model%clam_shal, Model%c0s_shal, Model%c1_shal, & Model%pgcon_shal, Model%asolfac_shal) - +!*## CCPP ## +!## CCPP ##* GFS_SCNV_generic.F90/GFS_SCNV_generic_post_run do i=1,im Diag%rainc(i) = Diag%rainc(i) + frain * rain1(i) enddo @@ -4130,6 +4329,7 @@ subroutine GFS_physics_driver & enddo enddo endif +!*## CCPP ## !elseif (Model%imfshalcnv == 3) then !if (Model%me==0) write(0,*) "CCPP DEBUG: shallow convection of GF is called in gf_driver" @@ -4139,6 +4339,7 @@ subroutine GFS_physics_driver & elseif (Model%imfshalcnv == 0) then ! modified Tiedtke Shallow convecton !----------------------------------- +!## CCPP ## This block is not in the CCPP yet. levshc(:) = 0 do k=2,levs do i=1,im @@ -4167,8 +4368,10 @@ subroutine GFS_physics_driver & ! if (lprnt) print *,' levshcm=',levshcm,' gt0sha=',gt0(ipr,:) endif ! end if_imfshalcnv +!*## CCPP ## endif ! end if_shal_cnv +!## CCPP ## GFS_SCNV_generic.F90/GFS_SCNV_generic_post_run if (Model%lssav) then if (Model%ldiag3d) then do k=1,levs @@ -4194,7 +4397,7 @@ subroutine GFS_physics_driver & if (clw(i,k,2) <= -999.0) clw(i,k,2) = zero enddo enddo - +!*## CCPP ## ! if (lprnt) then ! write(0,*)' prsl=',prsl(ipr,:) ! write(0,*) ' del=',del(ipr,:) @@ -4202,6 +4405,7 @@ subroutine GFS_physics_driver & ! write(0,*) ' befshgq0=',gq0(ipr,:,1) ! endif +!## CCPP ##* gcm_shoc.F90/shoc_run elseif (Model%shocaftcnv) then ! if do_shoc is true and shocaftcnv is true call shoc if (imp_physics == Model%imp_physics_mg) then do k=1,levs @@ -4290,6 +4494,7 @@ subroutine GFS_physics_driver & ! write(0,*)' aft shoc gq0=',gq0(1,:,1),' lat=',lat ! write(0,*)' aft shoc gu0=',gu0(1,:),' lat=',lat ! +!*## CCPP ## endif ! if( .not. do_shoc) ! ! if (lprnt) then @@ -4299,6 +4504,7 @@ subroutine GFS_physics_driver & ! write(0,*) ' aftshgq0=',gq0(ipr,:,1) ! endif ! +!## CCPP ##* GFS_suite_interstitial.F90/GFS_suite_interstitial_4_run !------------------------------------------------------------------------------ ! --- update the tracers due to deep & shallow cumulus convective transport ! (except for suspended water and ice) @@ -4369,12 +4575,15 @@ subroutine GFS_physics_driver & enddo enddo endif ! end if_ntcw +!*## CCPP ## ! Legacy routine which determines convectve clouds - should be removed at some point - +!## CCPP ## cnvc90.f/cnvc90_run call cnvc90 (Model%clstp, im, ix, Diag%rainc, kbot, ktop, levs, Statein%prsi, & Tbd%acv, Tbd%acvb, Tbd%acvt, Cldprop%cv, Cldprop%cvb, Cldprop%cvt) +!*## CCPP ## +!## CCPP ##* This is not in the CCPP yet. if (Model%moist_adj) then ! moist convective adjustment ! --------------------------- ! @@ -4413,7 +4622,8 @@ subroutine GFS_physics_driver & ! endif ! endif endif ! moist convective adjustment over -! +!*## CCPP ## +!## CCPP ## GFS_MP_generic.F90/GFS_MP_generic_pre_run if (Model%ldiag3d .or. Model%do_aw) then do k=1,levs do i=1,im @@ -4425,8 +4635,10 @@ subroutine GFS_physics_driver & dqdt(1:im,:,n) = Stateout%gq0(1:im,:,n) enddo endif - +!*## CCPP ## ! dqdt_v : instaneous moisture tendency (kg/kg/sec) +!## CCPP ##* GFS_suite_interstitial.F90/GFS_suite_interstitial_4_run +! Note: ( these lines are relevant for shallow and deep convection) if (Model%cplchm) then do k=1,levs do i=1,im @@ -4434,15 +4646,16 @@ subroutine GFS_physics_driver & enddo enddo endif +!*## CCPP ## ! ! grid-scale condensation/precipitations and microphysics parameterization ! ------------------------------------------------------------------------ - +!## CCPP ##* This is not in the CCPP yet. if (ncld == 0) then ! no cloud microphysics call lrgscl (ix, im, levs, dtp, Stateout%gt0, Stateout%gq0, & Statein%prsl, del, Statein%prslk, rain1, clw) - +!*## CCPP ## else ! all microphysics if (imp_physics == Model%imp_physics_zhao_carr) then ! call zhao/carr/sundqvist microphysics ! ------------ @@ -4456,23 +4669,28 @@ subroutine GFS_physics_driver & ! write(0,*) ' beflsgw0=',gq0(ipr,:,3),' kdt=',kdt ! endif ! ------------------ +!## CCPP ##* This is not in the CCPP yet. if (Model%do_shoc) then call precpd_shoc (im, ix, levs, dtp, del, Statein%prsl, & Stateout%gq0(1,1,1), Stateout%gq0(1,1,ntcw), & Stateout%gt0, rain1, Diag%sr, rainp, rhc, & psautco_l, prautco_l, Model%evpco, Model%wminco, & Tbd%phy_f3d(1,1,ntot3d-2), lprnt, ipr) +!*## CCPP ## else +!## CCPP ##* gscond.f/zhaocarr_gscond_run call gscond (im, ix, levs, dtp, dtf, Statein%prsl, Statein%pgr, & Stateout%gq0(1,1,1), Stateout%gq0(1,1,ntcw), & Stateout%gt0, Tbd%phy_f3d(1,1,1), Tbd%phy_f3d(1,1,2), & Tbd%phy_f2d(1,1), Tbd%phy_f3d(1,1,3), & Tbd%phy_f3d(1,1,4), Tbd%phy_f2d(1,2), rhc,lprnt, ipr) - +!*## CCPP ## +!## CCPP ##* precpd.f/zhaocarr_precpd_run call precpd (im, ix, levs, dtp, del, Statein%prsl, & Stateout%gq0(1,1,1), Stateout%gq0(1,1,ntcw), & Stateout%gt0, rain1, Diag%sr, rainp, rhc, psautco_l, & prautco_l, Model%evpco, Model%wminco, lprnt, ipr) +!*## CCPP ## endif ! if (lprnt) then ! write(0,*)' prsl=',prsl(ipr,:) @@ -4485,6 +4703,7 @@ subroutine GFS_physics_driver & deallocate(rainp) elseif (imp_physics == Model%imp_physics_zhao_carr_pdf) then ! with pdf clouds +!## CCPP ##* These schemes are not in the CCPP yet. allocate(rainp(im,levs)) call gscondp (im, ix, levs, dtp, dtf, Statein%prsl, & Statein%pgr, Stateout%gq0(1,1,1), & @@ -4502,11 +4721,13 @@ subroutine GFS_physics_driver & Tbd%phy_f3d(1,1,Model%num_p3d+1), psautco_l, & prautco_l, Model%evpco, Model%wminco, lprnt, ipr) deallocate(rainp) +!*## CCPP ## ! if (lprnt) write(0,*) ' rain1=',rain1(ipr),' rainc=',rainc(ipr),' lat=',lat elseif (imp_physics == Model%imp_physics_thompson) then ! Thompson MP ! ------------ +!## CCPP ##* mp_thompson.F90/mp_thompson_run ims = 1 ; ime = ix ; kms = 1 ; kme = levs ; its = 1 ; ite = ix ; kts = 1 ; kte = levs if (Model%ltaerosol) then @@ -4545,9 +4766,9 @@ subroutine GFS_physics_driver & Diag%refl_10cm, Model%lradar, & Tbd%phy_f3d(:,:,1),Tbd%phy_f3d(:,:,2),Tbd%phy_f3d(:,:,3),me,Statein%phii) endif - +!*## CCPP ## elseif (imp_physics == Model%imp_physics_wsm6) then ! WSM6 - ! ----- +!## CCPP ##* This is not in the CCPP yet. ! ----- ims = 1 ; ime = ix ; kms = 1 ; kme = levs ; its = 1 ; ite = ix ; kts = 1 ; kte = levs call wsm6(Stateout%gt0, Statein%phii(1:im,1:levs+1), & @@ -4563,18 +4784,19 @@ subroutine GFS_physics_driver & Tbd%phy_f3d(:,:,1),Tbd%phy_f3d(:,:,2),Tbd%phy_f3d(:,:,3), & ims,ime, kms,kme, & its,ite, kts,kte) -! +!*## CCPP ## elseif (imp_physics == Model%imp_physics_mg) then ! MGB double-moment microphysics ! ------------------------------ - +!## CCPP ##* GFS_typedefs.F90/control_initialize kk = 5 if (Model%fprcp >= 2) kk = 6 - +!*## CCPP ## ! Acheng used clw here for other code to run smoothly and minimum change ! to make the code work. However, the nc and clw should be treated ! in other procceses too. August 28/2015; Hope that can be done next ! year. I believe this will make the physical interaction more reasonable ! Anning 12/5/2015 changed ntcw hold liquid only +!## CCPP ##* m_micro_insterstitial.F90/m_micro_pre_run if (Model%do_shoc) then skip_macro = Model%do_shoc if (Model%fprcp == 0) then @@ -4655,6 +4877,7 @@ subroutine GFS_physics_driver & Tbd%phy_f3d(i,k,1) = min(one, Tbd%phy_f3d(i,k,1) + clcn(i,k)) enddo enddo +!*## CCPP ## ! notice clw ix instead of im ! call m_micro_driver(im,ix,levs,flipv,del,dtp,prsl,prsi, @@ -4676,7 +4899,7 @@ subroutine GFS_physics_driver & ! do k=1,levs ! write(1000+me,*)' maxwatncb=',maxval(Stateout%gq0(1:im,k,ntlnc)),' k=',k,' kdt',kdt ! enddo - +!## CCPP ##* m_micro.F90/m_micro_run call m_micro_driver (im, ix, levs, Model%flipv, dtp, Statein%prsl, & Statein%prsi, Statein%phil, Statein%phii, & Statein%vvl, clw(1,1,2), QLCN, clw(1,1,1), QICN, & @@ -4701,6 +4924,7 @@ subroutine GFS_physics_driver & ! ipr, kdt, Grid%xlat, Grid%xlon) Model%mg_alf, Model%mg_qcmin, Model%pdfflag, & ipr, kdt, Grid%xlat, Grid%xlon, rhc) +!*## CCPP ## ! do k=1,levs ! write(1000+me,*)' maxwatnca=',maxval(Stateout%gq0(1:im,k,ntlnc)),' k=',k,' kdt=',kdt ! enddo @@ -4728,7 +4952,7 @@ subroutine GFS_physics_driver & ! if (lprnt) write(0,*)' qrna=',qrn(ipr,:),' kdt=',kdt ! if (lprnt) write(0,*)' qsnwa=',qsnw(ipr,:),' kdt=',kdt ! if (lprnt) write(0,*)' qglba',qgl(ipr,:),' kdt=',kdt - +!## CCPP ##* m_micro_interstitial.F90/m_micro_post_run tem = dtp * con_p001 / con_day if (abs(Model%fprcp) == 1 .or. mg3_as_mg2) then do k=1,levs @@ -4764,7 +4988,7 @@ subroutine GFS_physics_driver & Diag%snow(i) = tem * qsnw(i,1) Diag%graupel(i) = tem * qgl(i,1) enddo - +!*## CCPP ## endif ! if (lprnt) write(0,*)' cloudsm=',tbd%phy_f3d(ipr,:,1)*100,' kdt=',kdt @@ -4777,8 +5001,11 @@ subroutine GFS_physics_driver & elseif (imp_physics == Model%imp_physics_gfdl) then ! GFDL MP ! ------- do i = 1, im +!## CCPP ##* Not necessary in the CCPP. land (i,1) = frland(i) area (i,1) = Grid%area(i) +!*## CCPP ## +!## CCPP ##* gfdl_cloud_microphys.F90/gfdl_cloud_microphys_run rain0 (i,1) = zero snow0 (i,1) = zero ice0 (i,1) = zero @@ -4891,6 +5118,8 @@ subroutine GFS_physics_driver & enddo endif enddo +!*## CCPP ## +!## CCPP ##* maximum_hourly_diagnostics.F90/maximum_hourly_diagnsostics_run !Calculate hourly max 1-km agl and -10C reflectivity if (Model%lradar .and. & (imp_physics == Model%imp_physics_gfdl .or. & @@ -4911,7 +5140,8 @@ subroutine GFS_physics_driver & deallocate (refd) deallocate (refd263k) endif -! +!*## CCPP ## +!## CCPP ##* gfdl_cloud_microphys.F90/gfdl_cloud_microphys_run if(Model%effr_in) then call cloud_diagnosis (1, im, 1, levs, den(1:im,1:levs), & del(1:im,1:levs), islmsk(1:im), & @@ -4922,7 +5152,7 @@ subroutine GFS_physics_driver & Tbd%phy_f3d(1:im,1:levs,1), Tbd%phy_f3d(1:im,1:levs,2), & Tbd%phy_f3d(1:im,1:levs,3), Tbd%phy_f3d(1:im,1:levs,4), & Tbd%phy_f3d(1:im,1:levs,5)) - +!*## CCPP ## ! do k = 1, levs ! do i=1,im ! @@ -4957,6 +5187,9 @@ subroutine GFS_physics_driver & ! adjust sfc rainrate for conservation ! vertically integrate reduction of water increments, reduce precip by that amount +!## CCPP ##* cs_conv_aw_adj.F90/cs_conv_aw_adj_run Note: The conditional above +! is not checked in the scheme, so the control of the code below is through its +! inclusion in a CCPP SDF temrain1(:) = zero do k = 1,levs @@ -4995,9 +5228,34 @@ subroutine GFS_physics_driver & rain1(i) = max(rain1(i) - temrain1(i)*0.001, 0.0_kind_phys) enddo endif - +!*## CCPP ## +!## CCPP ##* GFS_MP_generic.F90/GFS_MP_generic_post_run Diag%rain(:) = Diag%rainc(:) + frain * rain1(:) - + +! --- get the amount of different precip type for Noah MP +! --- convert from m/dtp to mm/s + if (Model%lsm==Model%lsm_noahmp) then + if (Model%imp_physics == Model%imp_physics_mg .or. & + Model%imp_physics == Model%imp_physics_gfdl) then + !GJF: Should all precipitation rates have the same denominator below? + ! It appears that Diag%rain and Diag%rainc are on the dynamics time step, + ! but Diag%snow,graupel,ice are on the physics time step? This doesn't + ! matter as long as dtp=dtf (frain=1). + tem = 1.0 / (dtp*con_p001) + Sfcprop%draincprv(:) = tem * Diag%rainc(:) + Sfcprop%drainncprv(:) = tem * (frain * rain1(:)) + Sfcprop%dsnowprv(:) = tem * Diag%snow(:) + Sfcprop%dgraupelprv(:) = tem * Diag%graupel(:) + Sfcprop%diceprv(:) = tem * Diag%ice(:) + else + Sfcprop%draincprv(:) = 0.0 + Sfcprop%drainncprv(:) = 0.0 + Sfcprop%dsnowprv(:) = 0.0 + Sfcprop%dgraupelprv(:) = 0.0 + Sfcprop%diceprv(:) = 0.0 + endif + end if ! if (Model%lsm == Model%lsm_noahmp) + if (Model%cal_pre) then ! hchuang: add dominant precipitation type algorithm ! call calpreciptype (kdt, Model%nrcm, im, ix, levs, levs+1, & @@ -5064,7 +5322,8 @@ subroutine GFS_physics_driver & enddo endif endif - +!*## CCPP ## +!## CCPP ##* this block not yet in CCPP !-------------------------------- ! vay-2018 for Dycore-Tendencies save Stateout%X => Diag%dX3dt_cgw ! @@ -5074,6 +5333,8 @@ subroutine GFS_physics_driver & Diag%du3dt_cgw = Stateout%gu0 endif !-------------------------------- +!*## CCPP ## +!## CCPP ##* GFS_MP_generic.F90/GFS_MP_generic_post_run ! --- ... estimate t850 for rain-snow decision @@ -5162,9 +5423,10 @@ subroutine GFS_physics_driver & Coupling%rainc_cpl(i) = Coupling%rainc_cpl(i) + Diag%rainc(i) enddo endif - +!*## CCPP ## ! --- ... end coupling insertion +!## CCPP ##* GFS_surface_generic.F90/GFS_surface_generic_post_run ! --- ... total runoff is composed of drainage into water table and ! runoff at the surface and is accumulated in unit of meters if (Model%lssav) then @@ -5173,7 +5435,9 @@ subroutine GFS_physics_driver & Diag%srunoff(i) = Diag%srunoff(i) + runof(i) * dtf enddo endif - +!*## CCPP ## +!## CCPP ##* This block is not in the CCPP because data transfer between global +! and local variables is not necessary in the CCPP. ! --- ... return updated smsoil and stsoil to global arrays if (Model%frac_grid) then do k=1,lsoil @@ -5194,6 +5458,7 @@ subroutine GFS_physics_driver & enddo enddo endif +!*## CCPP ## ! --- ... calculate column precipitable water "pwat" Diag%pwat(:) = zero @@ -5250,7 +5515,8 @@ subroutine GFS_physics_driver & endif enddo endif - +!*## CCPP ## +!## CCPP ##* This block is not in the CCPP since it is not needed in the CCPP. deallocate (clw) if (allocated(cnvc)) deallocate(cnvc) if (allocated(cnvw)) deallocate(cnvw) @@ -5292,6 +5558,8 @@ subroutine GFS_physics_driver & w, qv_dt, ql_dt, qr_dt, qi_dt, qs_dt, qg_dt,p123,refl) deallocate (den) endif +!*## CCPP ## +!## CCPP ##* maximum_hourly_diagnostics.F90/maximum_hourly_diagnostics_run if (allocated(tke)) deallocate (tke) if (Model%cscnv) then deallocate (sigmatot, sigmafrac) @@ -5331,7 +5599,7 @@ subroutine GFS_physics_driver & Diag%T02MAX(I) = MAX(Diag%T02MAX(I), Sfcprop%t2m(i)) !<--- Hourly max 2m T Diag%T02MIN(I) = MIN(Diag%T02MIN(I), Sfcprop%t2m(i)) !<--- Hourly min 2m T enddo - +!*## CCPP ## ! if (kdt > 2 ) stop return !................................... diff --git a/gfsphysics/GFS_layer/GFS_radiation_driver.F90 b/gfsphysics/GFS_layer/GFS_radiation_driver.F90 index 5215f1b2b..8df014231 100644 --- a/gfsphysics/GFS_layer/GFS_radiation_driver.F90 +++ b/gfsphysics/GFS_layer/GFS_radiation_driver.F90 @@ -412,6 +412,7 @@ module module_radiation_driver ! contains ! ================= +!## CCPP ## This is now a private subroutine in GFS_rrtmg_setup.F90/radinit. !> This subroutine initialize a model's radiation process through !! calling of specific initialization subprograms that directly !! related to radiation calculations. This subroutine needs to be @@ -652,6 +653,7 @@ end subroutine radinit !----------------------------------- !> @} +!## CCPP ## This is now a private subroutine in GFS_rrtmg_setup.F90/radupdate. !> This subroutine checks and updates time sensitive data used by !! radiation computations. This subroutine needs to be placed inside !! the time advancement loop but outside of the horizontal grid loop. @@ -1256,7 +1258,8 @@ subroutine GFS_radiation_driver & ! !--- only call GFS_radiation_driver at radiation time step - +!## CCPP ##* GFS_rrtmg_pre.F90/GFS_rrtmg_pre_run for code required to run before +! SW and LW. if (.not. (Model%lsswr .or. Model%lslwr )) return !--- set commonly used integers @@ -1544,9 +1547,10 @@ subroutine GFS_radiation_driver & ! enddo enddo endif ! end_if_ivflip +!*## CCPP ## !> - Check for daytime points for SW radiation. - +!## CCPP ##* rrtmg_sw_pre.F90/rrtmg_sw_pre_run nday = 0 do i = 1, IM if (Radtend%coszen(i) >= 0.0001) then @@ -1554,12 +1558,13 @@ subroutine GFS_radiation_driver & idxday(nday) = i endif enddo +!*## CCPP ## !> - Call module_radiation_aerosols::setaer(),to setup aerosols !! property profile for radiation. !check print *,' in grrad : calling setaer ' - +!## CCPP ##* GFS_rrtmg_pre.F90/GFS_rrtmg_pre_run call setaer (plvl, plyr, prslk1, tvly, rhly, Sfcprop%slmsk, & ! --- inputs tracer1, Grid%xlon, Grid%xlat, IM, LMK, LMP, & Model%lsswr,Model%lslwr, & @@ -1843,9 +1848,9 @@ subroutine GFS_radiation_driver & endif endif ! mg, sfc-perts +!*## CCPP ## - - +!## CCPP ##* rrtmg_sw_pre.F90/rrtmg_sw_pre_run; Note: includes check for lsswr in scheme !> -# Start SW radiation calculations if (Model%lsswr) then @@ -1863,7 +1868,10 @@ subroutine GFS_radiation_driver & !> -# Approximate mean surface albedo from vis- and nir- diffuse values. Radtend%sfalb(:) = max(0.01, 0.5 * (sfcalb(:,2) + sfcalb(:,4))) +!*## CCPP ## +!## CCPP ##* radsw_main.f/rrtmg_sw_run; Note: The checks for nday and lsswr are included in the scheme (returns if +! nday <= 0 or lsswr == F). Optional arguments are used to handle the different calls below. if (nday > 0) then !> - Call module_radsw_main::swrad(), to compute SW heating rates and @@ -1889,7 +1897,9 @@ subroutine GFS_radiation_driver & cldtausw, & FDNCMP=scmpsw) ! --- optional endif +!*## CCPP ## +!## CCPP ##* rrtmg_sw_post.F90/rrtmg_sw_post_run do k = 1, LM k1 = k + kd Radtend%htrsw(1:im,k) = htswc(1:im,k1) @@ -1964,7 +1974,9 @@ subroutine GFS_radiation_driver & enddo endif ! end_if_lsswr +!*## CCPP ## +!## CCPP ## rrtmg_lw_pre.F90/rrtmg_lw_pre_run; Note: scheme includes check for lslwr. !> -# Start LW radiation calculations if (Model%lslwr) then @@ -1975,11 +1987,14 @@ subroutine GFS_radiation_driver & Sfcprop%snowd, Sfcprop%sncovr, Sfcprop%zorl, & tsfg, tsfa, Sfcprop%hprime(:,1), IM, & Radtend%semis) ! --- outputs +!*## CCPP ## !> - Call module_radlw_main::lwrad(), to compute LW heating rates and !! fluxes. ! print *,' in grrad : calling lwrad' +!## CCPP ##* radlw_main.f/rrtmg_lw_run; Note: The check lslwr is included in the scheme (returns if +! lslwr == F). Optional arguments are used to handle the different calls below. if (Model%lwhtr) then call lwrad (plyr, plvl, tlyr, tlvl, qlyr, olyr, gasvmr, & ! --- inputs clouds, Tbd%icsdlw, faerlw, Radtend%semis, & @@ -1994,7 +2009,9 @@ subroutine GFS_radiation_driver & IM, LMK, LMP, Model%lprnt, & htlwc, Diag%topflw, Radtend%sfcflw, cldtaulw) ! --- outputs endif +!*## CCPP ## +!## CCPP ## rrtmg_lw_post.F90/rrtmg_lw_post_run; Note: includes check for lslwr. !> -# Save calculation results !> - Save surface air temp for diurnal adjustment at model t-steps Radtend%tsflw (:) = tsfa(:) @@ -2027,7 +2044,9 @@ subroutine GFS_radiation_driver & Coupling%sfcdlw(:) = Radtend%sfcflw(:)%dnfxc endif ! end_if_lslwr +!*## CCPP ## +!## CCPP ## GFS_rrtmg_post.F90/GFS_rrtmg_post_run !> - For time averaged output quantities (including total-sky and !! clear-sky SW and LW fluxes at TOA and surface; conventional !! 3-domain cloud amount, cloud top and base pressure, and cloud top @@ -2153,7 +2172,7 @@ subroutine GFS_radiation_driver & endif endif ! end_if_lssav -! +!*## CCPP ## return !........................................ end subroutine GFS_radiation_driver diff --git a/gfsphysics/GFS_layer/GFS_restart.F90 b/gfsphysics/GFS_layer/GFS_restart.F90 index a24cc0fc6..8e80f6f99 100644 --- a/gfsphysics/GFS_layer/GFS_restart.F90 +++ b/gfsphysics/GFS_layer/GFS_restart.F90 @@ -200,27 +200,27 @@ subroutine GFS_restart_populate (Restart, Model, Statein, Stateout, Sfcprop, & num = num + 1 Restart%name2d(num) = 'ruc_2d_raincprv' do nb = 1,nblks - Restart%data(nb,num)%var2p => Tbd(nb)%raincprv(:) + Restart%data(nb,num)%var2p => Sfcprop(nb)%raincprv(:) enddo num = num + 1 Restart%name2d(num) = 'ruc_2d_rainncprv' do nb = 1,nblks - Restart%data(nb,num)%var2p => Tbd(nb)%rainncprv(:) + Restart%data(nb,num)%var2p => Sfcprop(nb)%rainncprv(:) enddo num = num + 1 Restart%name2d(num) = 'ruc_2d_iceprv' do nb = 1,nblks - Restart%data(nb,num)%var2p => Tbd(nb)%iceprv(:) + Restart%data(nb,num)%var2p => Sfcprop(nb)%iceprv(:) enddo num = num + 1 Restart%name2d(num) = 'ruc_2d_snowprv' do nb = 1,nblks - Restart%data(nb,num)%var2p => Tbd(nb)%snowprv(:) + Restart%data(nb,num)%var2p => Sfcprop(nb)%snowprv(:) enddo num = num + 1 Restart%name2d(num) = 'ruc_2d_graupelprv' do nb = 1,nblks - Restart%data(nb,num)%var2p => Tbd(nb)%graupelprv(:) + Restart%data(nb,num)%var2p => Sfcprop(nb)%graupelprv(:) enddo endif ! MYNN SFC diff --git a/gfsphysics/GFS_layer/GFS_typedefs.F90 b/gfsphysics/GFS_layer/GFS_typedefs.F90 index 39520b0d4..09ab1da2d 100644 --- a/gfsphysics/GFS_layer/GFS_typedefs.F90 +++ b/gfsphysics/GFS_layer/GFS_typedefs.F90 @@ -6,7 +6,7 @@ module GFS_typedefs #ifdef CCPP use physcons, only: con_cp, con_fvirt, con_g, & con_hvap, con_hfus, con_pi, con_rd, con_rv, & - con_t0c, con_cvap, con_cliq, con_eps, & + con_t0c, con_cvap, con_cliq, con_eps, con_epsq, & con_epsm1, con_ttp, rlapse, con_jcal, con_rhw0, & con_sbc, con_tice, cimin, con_p0, rhowater use module_radsw_parameters, only: topfsw_type, sfcfsw_type, cmpfsw_type, NBDSW @@ -372,6 +372,20 @@ module GFS_typedefs real (kind=kind_phys), pointer :: lh(:) => null() !latent heating at the surface #endif + !---- precipitation amounts from previous time step for RUC LSM/NoahMP LSM + real (kind=kind_phys), pointer :: raincprv (:) => null() !< explicit rainfall from previous timestep + real (kind=kind_phys), pointer :: rainncprv (:) => null() !< convective_precipitation_amount from previous timestep + real (kind=kind_phys), pointer :: iceprv (:) => null() !< ice amount from previous timestep + real (kind=kind_phys), pointer :: snowprv (:) => null() !< snow amount from previous timestep + real (kind=kind_phys), pointer :: graupelprv(:) => null() !< graupel amount from previous timestep + + !---- precipitation rates from previous time step for NoahMP LSM + real (kind=kind_phys), pointer :: draincprv (:) => null() !< convective precipitation rate from previous timestep + real (kind=kind_phys), pointer :: drainncprv (:) => null() !< explicit rainfall rate from previous timestep + real (kind=kind_phys), pointer :: diceprv (:) => null() !< ice precipitation rate from previous timestep + real (kind=kind_phys), pointer :: dsnowprv (:) => null() !< snow precipitation rate from previous timestep + real (kind=kind_phys), pointer :: dgraupelprv(:) => null() !< graupel precipitation rate from previous timestep + contains procedure :: create => sfcprop_create !< allocate array data end type GFS_sfcprop_type @@ -645,6 +659,7 @@ module GFS_typedefs integer :: imp_physics_zhao_carr = 99 !< choice of Zhao-Carr microphysics scheme integer :: imp_physics_zhao_carr_pdf = 98 !< choice of Zhao-Carr microphysics scheme with PDF clouds integer :: imp_physics_mg = 10 !< choice of Morrison-Gettelman microphysics scheme + integer :: imp_physics_fer_hires = 15 !< choice of Ferrier-Aligo microphysics scheme !--- Z-C microphysical parameters real(kind=kind_phys) :: psautco(2) !< [in] auto conversion coeff from ice to snow real(kind=kind_phys) :: prautco(2) !< [in] auto conversion coeff from cloud to rain @@ -714,6 +729,7 @@ module GFS_typedefs integer :: lsoil_lsm !< number of soil layers internal to land surface model integer :: lsnow_lsm !< maximum number of snow layers internal to land surface model integer :: lsnow_lsm_lbound!< lower bound for snow arrays, depending on lsnow_lsm + logical :: rdlai #endif integer :: ivegsrc !< ivegsrc = 0 => USGS, !< ivegsrc = 1 => IGBP (20 category) @@ -754,6 +770,10 @@ module GFS_typedefs logical :: moist_adj !< flag for moist convective adjustment logical :: cscnv !< flag for Chikira-Sugiyama convection logical :: cal_pre !< flag controls precip type algorithm +#ifdef CCPP + real(kind=kind_phys) :: rhgrd !< fer_hires microphysics only + logical :: spec_adv !< flag for individual cloud species advected +#endif logical :: do_aw !< AW scale-aware option in cs convection logical :: do_awdd !< AW scale-aware option in cs convection logical :: flx_form !< AW scale-aware option in cs convection @@ -784,16 +804,36 @@ module GFS_typedefs !< 1: July 2010 version of mass-flux shallow conv scheme !< current operational version as of 2016 !< 2: scale- & aerosol-aware mass-flux shallow conv scheme (2017) + !< 3: scale- & aerosol-aware Grell-Freitas scheme (GSD) + !< 4: New Tiedtke scheme (CAPS) !< 0: modified Tiedtke's eddy-diffusion shallow conv scheme !< -1: no shallow convection used +#ifdef CCPP + integer :: imfshalcnv_sas = 1 !< flag for SAS mass-flux shallow convection scheme + integer :: imfshalcnv_samf = 2 !< flag for SAMF scale- & aerosol-aware mass-flux shallow convection scheme + integer :: imfshalcnv_gf = 3 !< flag for scale- & aerosol-aware Grell-Freitas scheme (GSD) + integer :: imfshalcnv_ntiedtke = 4 !< flag for new Tiedtke scheme (CAPS) +#endif integer :: imfdeepcnv !< flag for mass-flux deep convection scheme !< 1: July 2010 version of SAS conv scheme !< current operational version as of 2016 !< 2: scale- & aerosol-aware mass-flux deep conv scheme (2017) + !< 3: scale- & aerosol-aware Grell-Freitas scheme (GSD) + !< 4: New Tiedtke scheme (CAPS) !< 0: old SAS Convection scheme before July 2010 - integer :: isatmedmf !< flag for scale-aware TKE-based moist edmf scheme +#ifdef CCPP + integer :: imfdeepcnv_sas = 1 !< flag for SAS mass-flux deep convection scheme + integer :: imfdeepcnv_samf = 2 !< flag for SAMF scale- & aerosol-aware mass-flux deep convection scheme + integer :: imfdeepcnv_gf = 3 !< flag for scale- & aerosol-aware Grell-Freitas scheme (GSD) + integer :: imfdeepcnv_ntiedtke = 4 !< flag for new Tiedtke scheme (CAPS) +#endif + integer :: isatmedmf !< flag for scale-aware TKE-based moist edmf scheme !< 0: initial version of satmedmf (Nov. 2018) !< 1: updated version of satmedmf (as of May 2019) +#ifdef CCPP + integer :: isatmedmf_vdif = 0 !< flag for initial version of satmedmf (Nov. 2018) + integer :: isatmedmf_vdifq = 1 !< flag for updated version of satmedmf (as of May 2019) +#endif integer :: nmtvr !< number of topographic variables such as variance etc !< used in the GWD parameterization integer :: jcap !< number of spectral wave trancation used only by sascnv shalcnv @@ -944,6 +984,7 @@ module GFS_typedefs #ifdef CCPP integer :: ntracp1 !< number of tracers plus one integer :: ntqv !< tracer index for water vapor (specific humidity) + integer :: nqrimef !< tracer index for mass weighted rime factor #endif integer :: ntoz !< tracer index for ozone mixing ratio integer :: ntcw !< tracer index for cloud condensate (or liquid water) @@ -1165,20 +1206,6 @@ module GFS_typedefs real (kind=kind_phys), pointer :: prevst (:,:) => null() !< real (kind=kind_phys), pointer :: prevsq (:,:) => null() !< integer, pointer :: cactiv (:) => null() !< convective activity memory contour - - !---- precipitation amounts from previous time step for RUC LSM - real (kind=kind_phys), pointer :: raincprv (:) => null() !< explicit rainfall from previous timestep - real (kind=kind_phys), pointer :: rainncprv (:) => null() !< convective_precipitation_amount from previous timestep - real (kind=kind_phys), pointer :: iceprv (:) => null() !< ice amount from previous timestep - real (kind=kind_phys), pointer :: snowprv (:) => null() !< snow amount from previous timestep - real (kind=kind_phys), pointer :: graupelprv(:) => null() !< graupel amount from previous timestep - - !---- precipitation rates from previous time step for NoahMP LSM - real (kind=kind_phys), pointer :: draincprv (:) => null() !< convective precipitation rate from previous timestep - real (kind=kind_phys), pointer :: drainncprv (:) => null() !< explicit rainfall rate from previous timestep - real (kind=kind_phys), pointer :: diceprv (:) => null() !< ice precipitation rate from previous timestep - real (kind=kind_phys), pointer :: dsnowprv (:) => null() !< snow precipitation rate from previous timestep - real (kind=kind_phys), pointer :: dgraupelprv(:) => null() !< graupel precipitation rate from previous timestep !--- MYNN prognostic variables that can't be in the Intdiag or Interstitial DDTs real (kind=kind_phys), pointer :: CLDFRA_BL (:,:) => null() ! @@ -1442,6 +1469,10 @@ module GFS_typedefs real (kind=kind_phys), pointer :: dwn_mf (:,:) => null() !< instantaneous convective downdraft mass flux real (kind=kind_phys), pointer :: det_mf (:,:) => null() !< instantaneous convective detrainment mass flux real (kind=kind_phys), pointer :: cldcov (:,:) => null() !< instantaneous 3D cloud fraction +!--- F-A MP scheme +#ifdef CCPP + real (kind=kind_phys), pointer :: TRAIN (:,:) => null() !< accumulated stratiform T tendency (K s-1) +#endif !--- MP quantities for 3D diagnositics real (kind=kind_phys), pointer :: refl_10cm(:,:) => null() !< instantaneous refl_10cm @@ -1861,6 +1892,22 @@ module GFS_typedefs real (kind=kind_phys), pointer :: dudt_ogw(:,:) => null() !< daily aver u-wind tend due to orographic gravity wave drag real (kind=kind_phys), pointer :: dudt_tms(:,:) => null() !< daily aver u-wind tend due to TMS + !-- HWRF physics: dry mixing ratios + real (kind=kind_phys), pointer :: qv_r(:,:) => null() !< + real (kind=kind_phys), pointer :: qc_r(:,:) => null() !< + real (kind=kind_phys), pointer :: qi_r(:,:) => null() !< + real (kind=kind_phys), pointer :: qr_r(:,:) => null() !< + real (kind=kind_phys), pointer :: qs_r(:,:) => null() !< + real (kind=kind_phys), pointer :: qg_r(:,:) => null() !< + + + !-- Ferrier-Aligo MP scheme + real (kind=kind_phys), pointer :: f_rain (:,:) => null() !< + real (kind=kind_phys), pointer :: f_ice (:,:) => null() !< + real (kind=kind_phys), pointer :: f_rimef (:,:) => null() !< + real (kind=kind_phys), pointer :: cwm (:,:) => null() !< + + contains procedure :: create => interstitial_create !< allocate array data procedure :: rad_reset => interstitial_rad_reset !< reset array data for radiation @@ -2160,7 +2207,18 @@ subroutine sfcprop_create (Sfcprop, IM, Model) Sfcprop%dt_cool = zero Sfcprop%qrain = zero endif - + if (Model%lsm == Model%lsm_ruc .or. Model%lsm == Model%lsm_noahmp) then + allocate(Sfcprop%raincprv (IM)) + allocate(Sfcprop%rainncprv (IM)) + allocate(Sfcprop%iceprv (IM)) + allocate(Sfcprop%snowprv (IM)) + allocate(Sfcprop%graupelprv(IM)) + Sfcprop%raincprv = clear_val + Sfcprop%rainncprv = clear_val + Sfcprop%iceprv = clear_val + Sfcprop%snowprv = clear_val + Sfcprop%graupelprv = clear_val + end if ! Noah MP allocate and init when used ! if (Model%lsm == Model%lsm_noahmp ) then @@ -2243,7 +2301,19 @@ subroutine sfcprop_create (Sfcprop, IM, Model) Sfcprop%tsnoxy = clear_val Sfcprop%smoiseq = clear_val Sfcprop%zsnsoxy = clear_val - + + allocate(Sfcprop%draincprv (IM)) + allocate(Sfcprop%drainncprv (IM)) + allocate(Sfcprop%diceprv (IM)) + allocate(Sfcprop%dsnowprv (IM)) + allocate(Sfcprop%dgraupelprv(IM)) + + Sfcprop%draincprv = clear_val + Sfcprop%drainncprv = clear_val + Sfcprop%diceprv = clear_val + Sfcprop%dsnowprv = clear_val + Sfcprop%dgraupelprv = clear_val + endif #ifdef CCPP @@ -2278,6 +2348,12 @@ subroutine sfcprop_create (Sfcprop, IM, Model) Sfcprop%tsnow = clear_val Sfcprop%snowfallac = clear_val Sfcprop%acsnow = clear_val + ! + if (Model%rdlai) then + allocate (Sfcprop%xlaixy (IM)) + Sfcprop%xlaixy = clear_val + end if + end if if (Model%do_mynnsfclay) then ! For MYNN surface layer scheme @@ -2303,10 +2379,11 @@ subroutine sfcprop_create (Sfcprop, IM, Model) Sfcprop%cqs2 = clear_val Sfcprop%lh = clear_val end if - if (Model%imfdeepcnv == 3) then + if (Model%imfdeepcnv == Model%imfdeepcnv_gf) then allocate (Sfcprop%conv_act(IM)) Sfcprop%conv_act = zero end if + #endif end subroutine sfcprop_create @@ -2697,7 +2774,11 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, & real(kind=kind_phys) :: wminco(2) = (/1.0d-5,1.0d-5/) !< [in] water and ice minimum threshold for Zhao !---Max hourly real(kind=kind_phys) :: avg_max_length = 3600. !< reset value in seconds for max hourly. - +!--- Ferrier-Aligo microphysical parameters +#ifdef CCPP + real(kind=kind_phys) :: rhgrd = 0.98 !< fer_hires microphysics only + logical :: spec_adv = .true. !< Individual cloud species advected +#endif !--- M-G microphysical parameters integer :: fprcp = 0 !< no prognostic rain and snow (MG) integer :: pdfflag = 4 !< pdf flag for MG macro physics @@ -2752,6 +2833,7 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, & #ifdef CCPP integer :: lsoil_lsm = -1 !< number of soil layers internal to land surface model; -1 use lsoil integer :: lsnow_lsm = 3 !< maximum number of snow layers internal to land surface model + logical :: rdlai = .false. #endif integer :: ivegsrc = 2 !< ivegsrc = 0 => USGS, !< ivegsrc = 1 => IGBP (20 category) @@ -3034,7 +3116,8 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, & avg_max_length, & !--- land/surface model control #ifdef CCPP - lsm, lsoil, lsoil_lsm, lsnow_lsm, nmtvr, ivegsrc, use_ufo, & + lsm, lsoil, lsoil_lsm, lsnow_lsm, rdlai, & + nmtvr, ivegsrc, use_ufo, & #else lsm, lsoil, nmtvr, ivegsrc, use_ufo, & #endif @@ -3063,6 +3146,10 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, & do_sppt, do_shum, do_skeb, do_sfcperts, & !--- Rayleigh friction prslrd0, ral_ts, ldiag_ugwp, do_ugwp, do_tofd, & + ! --- Ferrier-Aligo +#ifdef CCPP + spec_adv, rhgrd, & +#endif !--- mass flux deep convection clam_deep, c0s_deep, c1_deep, betal_deep, & betas_deep, evfact_deep, evfactl_deep, pgcon_deep, & @@ -3316,6 +3403,12 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, & Model%ltaerosol = ltaerosol Model%lradar = lradar Model%ttendlim = ttendlim +!--- F-A MP parameters +#ifdef CCPP + Model%rhgrd = rhgrd + Model%spec_adv = spec_adv +#endif + !--- gfdl MP parameters Model%lgfdlmprad = lgfdlmprad !--- Thompson,GFDL MP parameter @@ -3330,6 +3423,12 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, & write(0,*) 'Logic error: RUC LSM cannot be used with surface data cycling at this point (fhcyc>0)' stop end if + ! Flag to read leaf area index from input files (initial conditions) + Model%rdlai = rdlai + if (Model%rdlai .and. .not. Model%lsm == Model%lsm_ruc) then + write(0,*) 'Logic error: rdlai = .true. only works with RUC LSM' + stop + end if ! Set surface layers for CCPP physics if (lsoil_lsm==-1) then Model%lsoil_lsm = lsoil @@ -3582,6 +3681,9 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, & Model%ntsnc = get_tracer_index(Model%tracer_names, 'snow_nc', Model%me, Model%master, Model%debug) Model%ntgnc = get_tracer_index(Model%tracer_names, 'graupel_nc', Model%me, Model%master, Model%debug) Model%ntke = get_tracer_index(Model%tracer_names, 'sgs_tke', Model%me, Model%master, Model%debug) +#ifdef CCPP + Model%nqrimef = get_tracer_index(Model%tracer_names, 'q_rimef', Model%me, Model%master, Model%debug) +#endif Model%ntwa = get_tracer_index(Model%tracer_names, 'liq_aero', Model%me, Model%master, Model%debug) Model%ntia = get_tracer_index(Model%tracer_names, 'ice_aero', Model%me, Model%master, Model%debug) Model%ntchm = 0 @@ -3877,8 +3979,8 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, & #ifdef CCPP ! Consistency check for NTDK convection: deep and shallow convection are bundled ! and cannot be combined with any other deep or shallow convection scheme - if ( (Model%imfdeepcnv == 4 .or. Model%imfshalcnv == 4) .and. & - .not. (Model%imfdeepcnv == 4 .and. Model%imfshalcnv == 4) ) then + if ( (Model%imfdeepcnv == Model%imfdeepcnv_ntiedtke .or. Model%imfshalcnv == Model%imfshalcnv_ntiedtke) .and. & + .not. (Model%imfdeepcnv == Model%imfdeepcnv_ntiedtke .and. Model%imfshalcnv == Model%imfshalcnv_ntiedtke) ) then write(0,*) "Logic error: if NTDK deep convection is used, must also use NTDK shallow convection (and vice versa)" stop end if @@ -3898,14 +4000,21 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, & else if (Model%imfdeepcnv == 0) then print *,' old SAS Convection scheme before July 2010 used' - elseif(Model%imfdeepcnv == 1) then +#ifdef CCPP + elseif(Model%imfdeepcnv == Model%imfdeepcnv_sas) then print *,' July 2010 version of SAS conv scheme used' - elseif(Model%imfdeepcnv == 2) then + elseif(Model%imfdeepcnv == Model%imfdeepcnv_samf) then print *,' scale & aerosol-aware mass-flux deep conv scheme' - elseif(Model%imfdeepcnv == 3) then + elseif(Model%imfdeepcnv == Model%imfdeepcnv_gf) then print *,' Grell-Freitas scale & aerosol-aware mass-flux deep conv scheme' - elseif(Model%imfdeepcnv == 4) then + elseif(Model%imfdeepcnv == Model%imfdeepcnv_ntiedtke) then print *,' New Tiedtke cumulus scheme' +#else + elseif(Model%imfdeepcnv == 1) then + print *,' July 2010 version of SAS conv scheme used' + elseif(Model%imfdeepcnv == 2) then + print *,' scale & aerosol-aware mass-flux deep conv scheme' +#endif endif endif else @@ -3921,16 +4030,19 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, & print*, ' Deep convection scheme disabled' endif if (Model%satmedmf) then +#ifdef CCPP + if (Model%isatmedmf == Model%isatmedmf_vdif) then + print *,' initial version (Nov 2018) of sale-aware TKE-based moist EDMF scheme used' + elseif(Model%isatmedmf == Model%isatmedmf_vdifq) then + print *,' update version (May 2019) of sale-aware TKE-based moist EDMF scheme used' + endif +#else if (Model%isatmedmf == 0) then print *,' initial version (Nov 2018) of sale-aware TKE-based moist EDMF scheme used' elseif(Model%isatmedmf == 1) then -#ifdef CCPP - print *,' Error: updated version (May 2019) of sale-aware TKE-based moist EDMF scheme not yet available in CCPP' - stop -#else print *,' update version (May 2019) of sale-aware TKE-based moist EDMF scheme used' -#endif endif +#endif elseif (Model%hybedmf) then print *,' scale-aware hybrid edmf PBL scheme used' elseif (Model%old_monin) then @@ -3948,14 +4060,21 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, & else if (Model%imfshalcnv == 0) then print *,' modified Tiedtke eddy-diffusion shallow conv scheme used' - elseif (Model%imfshalcnv == 1) then +#ifdef CCPP + elseif (Model%imfshalcnv == Model%imfshalcnv_sas) then print *,' July 2010 version of mass-flux shallow conv scheme used' - elseif (Model%imfshalcnv == 2) then + elseif (Model%imfshalcnv == Model%imfshalcnv_samf) then print *,' scale- & aerosol-aware mass-flux shallow conv scheme (2017)' - elseif (Model%imfshalcnv == 3) then + elseif (Model%imfshalcnv == Model%imfshalcnv_gf) then print *,' Grell-Freitas scale- & aerosol-aware mass-flux shallow conv scheme (2013)' - elseif (Model%imfshalcnv == 4) then + elseif (Model%imfshalcnv == Model%imfshalcnv_ntiedtke) then print *,' New Tiedtke cumulus scheme' +#else + elseif (Model%imfshalcnv == 1) then + print *,' July 2010 version of mass-flux shallow conv scheme used' + elseif (Model%imfshalcnv == 2) then + print *,' scale- & aerosol-aware mass-flux shallow conv scheme (2017)' +#endif else print *,' unknown mass-flux scheme in use - defaulting to no shallow convection' Model%imfshalcnv = -1 @@ -4020,9 +4139,23 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, & Model%ncnd = 1 if (Model%me == Model%master) print *,'Using Zhao/Carr/Sundqvist Microphysics with PDF Cloud' - else if (Model%imp_physics == 5) then ! F-A goes here - print *,' Ferrier Microphysics scheme has been deprecated - job aborted' - stop + !else if (Model%imp_physics == 5) then ! F-A goes here + ! print *,' Ferrier Microphysics scheme has been deprecated - job aborted' + ! stop + else if (Model%imp_physics == Model%imp_physics_fer_hires) then ! Ferrier-Aligo scheme + Model%npdf3d = 0 + Model%num_p3d = 3 + Model%num_p2d = 1 + Model%pdfcld = .false. + Model%shcnvcw = .false. + Model%ncnd = 5 + Model%nleffr = 1 + Model%nieffr = 2 + Model%nseffr = 3 + if (Model%me == Model%master) print *,' Using Ferrier-Aligo MP scheme', & + ' microphysics', & + ' lradar =',Model%lradar + elseif (Model%imp_physics == Model%imp_physics_wsm6) then !WSM6 microphysics Model%npdf3d = 0 @@ -4187,7 +4320,9 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, & Model%lmfshal = (Model%shal_cnv .and. Model%imfshalcnv > 0) #ifdef CCPP - Model%lmfdeep2 = (Model%imfdeepcnv == 2 .or. Model%imfdeepcnv == 3 .or. Model%imfdeepcnv == 4) + Model%lmfdeep2 = (Model%imfdeepcnv == Model%imfdeepcnv_samf & + .or. Model%imfdeepcnv == Model%imfdeepcnv_gf & + .or. Model%imfdeepcnv == Model%imfdeepcnv_ntiedtke) #else Model%lmfdeep2 = (Model%imfdeepcnv == 2) #endif @@ -4339,11 +4474,19 @@ subroutine control_print(Model) print *, ' lrefres : ', Model%lrefres print *, ' ' endif - +#ifdef CCPP + if (Model%imp_physics == Model%imp_physics_fer_hires) then + print *, ' Ferrier-Aligo microphysical parameters' + print *, ' spec_adv : ', Model%spec_adv + print *, ' rhgrd : ', Model%rhgrd + print *, ' ' + endif +#endif print *, 'land/surface model parameters' print *, ' lsm : ', Model%lsm print *, ' lsoil : ', Model%lsoil #ifdef CCPP + print *, ' rdlai : ', Model%rdlai print *, ' lsoil_lsm : ', Model%lsoil_lsm print *, ' lsnow_lsm : ', Model%lsnow_lsm #endif @@ -4399,6 +4542,7 @@ subroutine control_print(Model) print *, ' redrag : ', Model%redrag print *, ' hybedmf : ', Model%hybedmf print *, ' satmedmf : ', Model%satmedmf + print *, ' isatmedmf : ', Model%isatmedmf print *, ' shinhong : ', Model%shinhong print *, ' do_ysu : ', Model%do_ysu print *, ' dspheat : ', Model%dspheat @@ -4500,6 +4644,7 @@ subroutine control_print(Model) print *, ' ntrac : ', Model%ntrac #ifdef CCPP print *, ' ntqv : ', Model%ntqv + print *, ' nqrimef : ', Model%nqrimef #endif print *, ' ntoz : ', Model%ntoz print *, ' ntcw : ', Model%ntcw @@ -4744,7 +4889,7 @@ subroutine tbd_create (Tbd, IM, Model) Tbd%htswc = clear_val Tbd%htsw0 = clear_val - if (Model%imfdeepcnv == 3 .or. Model%imfdeepcnv == 4) then + if (Model%imfdeepcnv == Model%imfdeepcnv_gf .or. Model%imfdeepcnv == Model%imfdeepcnv_ntiedtke) then allocate(Tbd%forcet(IM, Model%levs)) allocate(Tbd%forceq(IM, Model%levs)) allocate(Tbd%prevst(IM, Model%levs)) @@ -4755,37 +4900,11 @@ subroutine tbd_create (Tbd, IM, Model) Tbd%prevsq = clear_val end if - if (Model%imfdeepcnv == 3) then + if (Model%imfdeepcnv == Model%imfdeepcnv_gf) then allocate(Tbd%cactiv(IM)) Tbd%cactiv = zero end if - if (Model%lsm == Model%lsm_ruc) then - allocate(Tbd%raincprv (IM)) - allocate(Tbd%rainncprv (IM)) - allocate(Tbd%iceprv (IM)) - allocate(Tbd%snowprv (IM)) - allocate(Tbd%graupelprv(IM)) - Tbd%raincprv = clear_val - Tbd%rainncprv = clear_val - Tbd%iceprv = clear_val - Tbd%snowprv = clear_val - Tbd%graupelprv = clear_val - end if - - if (Model%lsm == Model%lsm_noahmp) then - allocate(Tbd%draincprv (IM)) - allocate(Tbd%drainncprv (IM)) - allocate(Tbd%diceprv (IM)) - allocate(Tbd%dsnowprv (IM)) - allocate(Tbd%dgraupelprv(IM)) - Tbd%draincprv = clear_val - Tbd%drainncprv = clear_val - Tbd%diceprv = clear_val - Tbd%dsnowprv = clear_val - Tbd%dgraupelprv = clear_val - end if - !--- MYNN variables: if (Model%do_mynnedmf) then !print*,"Allocating all MYNN-EDMF variables:" @@ -5027,6 +5146,13 @@ subroutine diag_create (Diag, IM, Model) allocate (Diag%shum_wts(IM,Model%levs)) allocate (Diag%zmtnblck(IM)) + ! F-A MP scheme +#ifdef CCPP + if (Model%imp_physics == Model%imp_physics_fer_hires) then + allocate (Diag%TRAIN (IM,Model%levs)) + end if +#endif + allocate (Diag%ca_out (IM)) allocate (Diag%ca_deep (IM)) allocate (Diag%ca_turb (IM)) @@ -5319,6 +5445,12 @@ subroutine diag_phys_zero (Diag, Model, linit, iauwindow_center) Diag%sppt_wts = zero Diag%shum_wts = zero Diag%zmtnblck = zero + +#ifdef CCPP + if (Model%imp_physics == Model%imp_physics_fer_hires) then + Diag%TRAIN = zero + end if +#endif Diag%totprcpb = zero Diag%cnvprcpb = zero Diag%toticeb = zero @@ -5816,6 +5948,21 @@ subroutine interstitial_create (Interstitial, IM, Model) allocate (Interstitial%cnv_ndrop (IM,Model%levs)) allocate (Interstitial%cnv_nice (IM,Model%levs)) end if + if (Model%imp_physics == Model%imp_physics_fer_hires) then + !--- if HWRF physics? + allocate (Interstitial%qv_r (IM,Model%levs)) + allocate (Interstitial%qc_r (IM,Model%levs)) + allocate (Interstitial%qi_r (IM,Model%levs)) + allocate (Interstitial%qr_r (IM,Model%levs)) + allocate (Interstitial%qs_r (IM,Model%levs)) + allocate (Interstitial%qg_r (IM,Model%levs)) + + !--- Ferrier-Aligo MP scheme + allocate (Interstitial%f_ice (IM,Model%levs)) + allocate (Interstitial%f_rain (IM,Model%levs)) + allocate (Interstitial%f_rimef (IM,Model%levs)) + allocate (Interstitial%cwm (IM,Model%levs)) + end if if (Model%do_shoc) then if (.not. associated(Interstitial%qrn)) allocate (Interstitial%qrn (IM,Model%levs)) if (.not. associated(Interstitial%qsnw)) allocate (Interstitial%qsnw (IM,Model%levs)) @@ -5860,7 +6007,7 @@ subroutine interstitial_create (Interstitial, IM, Model) Interstitial%phys_hydrostatic = .true. ! ! Reset all other variables - call Interstitial%rad_reset () + call Interstitial%rad_reset (Model) call Interstitial%phys_reset (Model) ! end subroutine interstitial_create @@ -5939,6 +6086,9 @@ subroutine interstitial_setup_tracers(Interstitial, Model) endif elseif (Model%imp_physics == Model%imp_physics_gfdl) then Interstitial%ntiwx = 3 + ! F-A MP scheme + elseif (Model%imp_physics == Model%imp_physics_fer_hires) then + Interstitial%ntiwx = 3 ! total ice or total condensate elseif (Model%imp_physics == Model%imp_physics_mg) then Interstitial%ntiwx = 3 else @@ -6014,11 +6164,12 @@ subroutine interstitial_setup_tracers(Interstitial, Model) end subroutine interstitial_setup_tracers - subroutine interstitial_rad_reset (Interstitial) + subroutine interstitial_rad_reset (Interstitial, Model) ! implicit none ! class(GFS_interstitial_type) :: Interstitial + type(GFS_control_type), intent(in) :: Model ! Interstitial%aerodp = clear_val Interstitial%alb1d = clear_val @@ -6055,6 +6206,23 @@ subroutine interstitial_rad_reset (Interstitial) Interstitial%tlyr = clear_val Interstitial%tsfa = clear_val Interstitial%tsfg = clear_val + +! F-A scheme + if (Model%imp_physics == Model%imp_physics_fer_hires) then + Interstitial%qv_r = clear_val + Interstitial%qc_r = clear_val + Interstitial%qi_r = clear_val + Interstitial%qr_r = clear_val + Interstitial%qs_r = clear_val + Interstitial%qg_r = clear_val + if(Model%spec_adv) then + Interstitial%f_ice = clear_val + Interstitial%f_rain = clear_val + Interstitial%f_rimef = clear_val + Interstitial%cwm = clear_val + end if + end if + ! end subroutine interstitial_rad_reset @@ -6305,6 +6473,12 @@ subroutine interstitial_phys_reset (Interstitial, Model) Interstitial%cnv_ndrop = clear_val Interstitial%cnv_nice = clear_val end if + if (Model%imp_physics == Model%imp_physics_fer_hires .and. Model%spec_adv) then + Interstitial%f_ice = clear_val + Interstitial%f_rain = clear_val + Interstitial%f_rimef = clear_val + Interstitial%cwm = clear_val + end if if (Model%do_shoc) then Interstitial%qrn = clear_val Interstitial%qsnw = clear_val @@ -6620,6 +6794,13 @@ subroutine interstitial_print(Interstitial, Model, mpirank, omprank, blkno) write (0,*) 'sum(Interstitial%icemp ) = ', sum(Interstitial%icemp ) write (0,*) 'sum(Interstitial%rainmp ) = ', sum(Interstitial%rainmp ) write (0,*) 'sum(Interstitial%snowmp ) = ', sum(Interstitial%snowmp ) + !F-A scheme + else if (Model%imp_physics == Model%imp_physics_fer_hires) then + write (0,*) 'Interstitial_print: values specific to F-A microphysics' + write (0,*) 'sum(Interstitial%f_ice ) = ', sum(Interstitial%f_ice ) + write (0,*) 'sum(Interstitial%f_rain ) = ', sum(Interstitial%f_rain ) + write (0,*) 'sum(Interstitial%f_rimef ) = ', sum(Interstitial%f_rimef ) + write (0,*) 'sum(Interstitial%cwm ) = ', sum(Interstitial%cwm ) else if (Model%imp_physics == Model%imp_physics_mg) then write (0,*) 'Interstitial_print: values specific to MG microphysics' write (0,*) 'sum(Interstitial%ncgl ) = ', sum(Interstitial%ncgl ) diff --git a/gfsphysics/GFS_layer/GFS_typedefs.meta b/gfsphysics/GFS_layer/GFS_typedefs.meta index 79ab00129..f84e6d095 100644 --- a/gfsphysics/GFS_layer/GFS_typedefs.meta +++ b/gfsphysics/GFS_layer/GFS_typedefs.meta @@ -368,6 +368,13 @@ dimensions = (horizontal_dimension,vertical_dimension) type = real kind = kind_phys +[gq0(:,:,index_for_mass_weighted_rime_factor)] + standard_name = mass_weighted_rime_factor_updated_by_physics + long_name = mass weighted rime factor updated by physics + units = kg kg-1 + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys [gq0(:,:,index_for_water_friendly_aerosols)] standard_name = water_friendly_aerosol_number_concentration_updated_by_physics long_name = number concentration of water-friendly aerosols updated by physics @@ -1262,6 +1269,76 @@ dimensions = (horizontal_dimension) type = real kind = kind_phys +[raincprv] + standard_name = lwe_thickness_of_convective_precipitation_amount_from_previous_timestep + long_name = convective_precipitation_amount from previous timestep + units = m + dimensions = (horizontal_dimension) + type = real + kind = kind_phys +[rainncprv] + standard_name = lwe_thickness_of_explicit_rainfall_amount_from_previous_timestep + long_name = explicit rainfall from previous timestep + units = m + dimensions = (horizontal_dimension) + type = real + kind = kind_phys +[iceprv] + standard_name = lwe_thickness_of_ice_amount_from_previous_timestep + long_name = ice amount from previous timestep + units = m + dimensions = (horizontal_dimension) + type = real + kind = kind_phys +[snowprv] + standard_name = lwe_thickness_of_snow_amount_from_previous_timestep + long_name = snow amount from previous timestep + units = m + dimensions = (horizontal_dimension) + type = real + kind = kind_phys +[graupelprv] + standard_name = lwe_thickness_of_graupel_amount_from_previous_timestep + long_name = graupel amount from previous timestep + units = m + dimensions = (horizontal_dimension) + type = real + kind = kind_phys +[draincprv] + standard_name = convective_precipitation_rate_from_previous_timestep + long_name = convective precipitation rate from previous timestep + units = mm s-1 + dimensions = (horizontal_dimension) + type = real + kind = kind_phys +[drainncprv] + standard_name = explicit_rainfall_rate_from_previous_timestep + long_name = explicit rainfall rate previous timestep + units = mm s-1 + dimensions = (horizontal_dimension) + type = real + kind = kind_phys +[diceprv] + standard_name = ice_precipitation_rate_from_previous_timestep + long_name = ice precipitation rate from previous timestep + units = mm s-1 + dimensions = (horizontal_dimension) + type = real + kind = kind_phys +[dsnowprv] + standard_name = snow_precipitation_rate_from_previous_timestep + long_name = snow precipitation rate from previous timestep + units = mm s-1 + dimensions = (horizontal_dimension) + type = real + kind = kind_phys +[dgraupelprv] + standard_name = graupel_precipitation_rate_from_previous_timestep + long_name = graupel precipitation rate from previous timestep + units = mm s-1 + dimensions = (horizontal_dimension) + type = real + kind = kind_phys ######################################################################## [ccpp-arg-table] @@ -2162,6 +2239,12 @@ units = flag dimensions = () type = integer +[imp_physics_fer_hires] + standard_name = flag_for_fer_hires_microphysics_scheme + long_name = choice of Ferrier-Aligo microphysics scheme + units = flag + dimensions = () + type = integer [imp_physics_gfdl] standard_name = flag_for_gfdl_microphysics_scheme long_name = choice of GFDL microphysics scheme @@ -2543,6 +2626,12 @@ units = count dimensions = () type = integer +[rdlai] + standard_name = flag_for_reading_leaf_area_index_from_input + long_name = flag for reading leaf area index from initial conditions for RUC LSM + units = flag + dimensions = () + type = logical [ivegsrc] standard_name = vegetation_type_dataset_choice long_name = land use dataset choice @@ -2555,6 +2644,19 @@ units = index dimensions = () type = integer +[spec_adv] + standard_name = flag_for_individual_cloud_species_advected + long_name = flag for individual cloud species advected + units = flag + dimensions = () + type = logical +[flgmin] + standard_name = minimum_large_ice_fraction + long_name = minimum large ice fraction in F-A mp scheme + units = frac + dimensions = (2) + type = real + kind = kind_phys [iopt_dveg] standard_name = flag_for_dynamic_vegetation_option long_name = choice for dynamic vegetation option (see noahmp module for definition) @@ -2639,6 +2741,13 @@ units = flag dimensions = () type = logical +[rhgrd] + standard_name = fa_threshold_relative_humidity_for_onset_of_condensation + long_name = relative humidity threshold parameter for condensation for FA scheme + units = none + dimensions = () + type = real + kind = kind_phys [flipv] standard_name = flag_flip long_name = vertical flip logical @@ -2777,18 +2886,90 @@ units = flag dimensions = () type = integer +[imfshalcnv_sas] + standard_name = flag_for_sas_shallow_convection_scheme + long_name = flag for SAS shallow convection scheme + units = flag + dimensions = () + type = integer +[imfshalcnv_samf] + standard_name = flag_for_samf_shallow_convection_scheme + long_name = flag for SAMF shallow convection scheme + units = flag + dimensions = () + type = integer +[imfshalcnv_gf] + standard_name = flag_for_gf_shallow_convection_scheme + long_name = flag for Grell-Freitas shallow convection scheme + units = flag + dimensions = () + type = integer +[imfshalcnv_gf] + standard_name = flag_for_ntiedtke_shallow_convection_scheme + long_name = flag for new Tiedtke shallow convection scheme + units = flag + dimensions = () + type = integer [imfdeepcnv] standard_name = flag_for_mass_flux_deep_convection_scheme long_name = flag for mass-flux deep convection scheme units = flag dimensions = () type = integer +[imfdeepcnv_sas] + standard_name = flag_for_sas_deep_convection_scheme + long_name = flag for SAS deep convection scheme + units = flag + dimensions = () + type = integer +[imfdeepcnv_samf] + standard_name = flag_for_samf_deep_convection_scheme + long_name = flag for SAMF deep convection scheme + units = flag + dimensions = () + type = integer +[imfdeepcnv_gf] + standard_name = flag_for_gf_deep_convection_scheme + long_name = flag for Grell-Freitas deep convection scheme + units = flag + dimensions = () + type = integer +[imfdeepcnv_ntiedtke] + standard_name = flag_for_ntiedtke_deep_convection_scheme + long_name = flag for new Tiedtke deep convection scheme + units = flag + dimensions = () + type = integer +[isatmedmf] + standard_name = choice_of_scale_aware_TKE_moist_EDMF_PBL + long_name = choice of scale-aware TKE moist EDMF PBL scheme + units = none + dimensions = () + type = integer +[isatmedmf_vdif] + standard_name = choice_of_original_scale_aware_TKE_moist_EDMF_PBL + long_name = choice of original scale-aware TKE moist EDMF PBL scheme + units = none + dimensions = () + type = integer +[isatmedmf_vdifq] + standard_name = choice_of_updated_scale_aware_TKE_moist_EDMF_PBL + long_name = choice of updated scale-aware TKE moist EDMF PBL scheme + units = none + dimensions = () + type = integer [nmtvr] standard_name = number_of_statistical_measures_of_subgrid_orography long_name = number of topographic variables in GWD units = count dimensions = () type = integer +[jcap] + standard_name = number_of_spectral_wave_trancation_for_sas + long_name = number of spectral wave trancation used only by sascnv and shalcnv + units = count + dimensions = () + type = integer [cs_parm(1)] standard_name = updraft_velocity_tunable_parameter_1_CS long_name = tunable parameter 1 for Chikira-Sugiyama convection @@ -2896,91 +3077,91 @@ kind = kind_phys [c0s_deep] standard_name = rain_conversion_parameter_deep_convection - long_name = convective rain conversion parameter for deep conv. + long_name = convective rain conversion parameter for deep convection units = m-1 dimensions = () type = real kind = kind_phys [c1_deep] standard_name = detrainment_conversion_parameter_deep_convection - long_name = convective detrainment conversion parameter for deep conv. + long_name = convective detrainment conversion parameter for deep convection units = m-1 dimensions = () type = real kind = kind_phys [betal_deep] standard_name = downdraft_fraction_reaching_surface_over_land_deep_convection - long_name = downdraft fraction reaching surface over land for deep conv. + long_name = downdraft fraction reaching surface over land for deep convection units = frac dimensions = () type = real kind = kind_phys [betas_deep] standard_name = downdraft_fraction_reaching_surface_over_ocean_deep_convection - long_name = downdraft fraction reaching surface over ocean for deep conv. + long_name = downdraft fraction reaching surface over ocean for deep convection units = frac dimensions = () type = real kind = kind_phys [evfact_deep] standard_name = rain_evaporation_coefficient_deep_convection - long_name = convective rain evaporation coefficient for deep conv. + long_name = convective rain evaporation coefficient for deep convection units = frac dimensions = () type = real kind = kind_phys [evfactl_deep] standard_name = rain_evaporation_coefficient_over_land_deep_convection - long_name = convective rain evaporation coefficient over land for deep conv. + long_name = convective rain evaporation coefficient over land for deep convection units = frac dimensions = () type = real kind = kind_phys [pgcon_deep] standard_name = momentum_transport_reduction_factor_pgf_deep_convection - long_name = reduction factor in momentum transport due to deep conv. induced pressure gradient force + long_name = reduction factor in momentum transport due to deep convection induced pressure gradient force units = frac dimensions = () type = real kind = kind_phys [asolfac_deep] standard_name = aerosol_aware_parameter_deep_convection - long_name = aerosol-aware parameter inversely proportional to CCN number concentraion from Lim (2011) for deep conv. + long_name = aerosol-aware parameter inversely proportional to CCN number concentraion from Lim (2011) for deep convection units = none dimensions = () type = real kind = kind_phys [clam_shal] standard_name = entrainment_rate_coefficient_shallow_convection - long_name = entrainment rate coefficient for shal conv. + long_name = entrainment rate coefficient for shallow convection units = none dimensions = () type = real kind = kind_phys [c0s_shal] standard_name = rain_conversion_parameter_shallow_convection - long_name = convective rain conversion parameter for shal conv. + long_name = convective rain conversion parameter for shallow convection units = m-1 dimensions = () type = real kind = kind_phys [c1_shal] standard_name = detrainment_conversion_parameter_shallow_convection - long_name = convective detrainment conversion parameter for shal conv. + long_name = convective detrainment conversion parameter for shallow convection units = m-1 dimensions = () type = real kind = kind_phys [pgcon_shal] standard_name = momentum_transport_reduction_factor_pgf_shallow_convection - long_name = reduction factor in momentum transport due to shal conv. induced pressure gradient force + long_name = reduction factor in momentum transport due to shallow convection induced pressure gradient force units = frac dimensions = () type = real kind = kind_phys [asolfac_shal] standard_name = aerosol_aware_parameter_shallow_convection - long_name = aerosol-aware parameter inversely proportional to CCN number concentraion from Lim (2011) for shal conv. + long_name = aerosol-aware parameter inversely proportional to CCN number concentraion from Lim (2011) for shallow convection units = none dimensions = () type = real @@ -3346,6 +3527,12 @@ units = index dimensions = () type = integer +[nqrimef] + standard_name = index_for_mass_weighted_rime_factor + long_name = tracer index for mass weighted rime factor + units = index + dimensions = () + type = integer [ntwa] standard_name = index_for_water_friendly_aerosols long_name = tracer index for water friendly aerosol @@ -4175,76 +4362,6 @@ units = none dimensions = (horizontal_dimension) type = integer -[raincprv] - standard_name = lwe_thickness_of_convective_precipitation_amount_from_previous_timestep - long_name = convective_precipitation_amount from previous timestep - units = m - dimensions = (horizontal_dimension) - type = real - kind = kind_phys -[rainncprv] - standard_name = lwe_thickness_of_explicit_rainfall_amount_from_previous_timestep - long_name = explicit rainfall from previous timestep - units = m - dimensions = (horizontal_dimension) - type = real - kind = kind_phys -[iceprv] - standard_name = lwe_thickness_of_ice_amount_from_previous_timestep - long_name = ice amount from previous timestep - units = m - dimensions = (horizontal_dimension) - type = real - kind = kind_phys -[snowprv] - standard_name = lwe_thickness_of_snow_amount_from_previous_timestep - long_name = snow amount from previous timestep - units = m - dimensions = (horizontal_dimension) - type = real - kind = kind_phys -[graupelprv] - standard_name = lwe_thickness_of_graupel_amount_from_previous_timestep - long_name = graupel amount from previous timestep - units = m - dimensions = (horizontal_dimension) - type = real - kind = kind_phys -[draincprv] - standard_name = convective_precipitation_rate_from_previous_timestep - long_name = convective precipitation rate from previous timestep - units = mm s-1 - dimensions = (horizontal_dimension) - type = real - kind = kind_phys -[drainncprv] - standard_name = explicit_rainfall_rate_from_previous_timestep - long_name = explicit rainfall rate previous timestep - units = mm s-1 - dimensions = (horizontal_dimension) - type = real - kind = kind_phys -[diceprv] - standard_name = ice_precipitation_rate_from_previous_timestep - long_name = ice precipitation rate from previous timestep - units = mm s-1 - dimensions = (horizontal_dimension) - type = real - kind = kind_phys -[dsnowprv] - standard_name = snow_precipitation_rate_from_previous_timestep - long_name = snow precipitation rate from previous timestep - units = mm s-1 - dimensions = (horizontal_dimension) - type = real - kind = kind_phys -[dgraupelprv] - standard_name = graupel_precipitation_rate_from_previous_timestep - long_name = graupel precipitation rate from previous timestep - units = mm s-1 - dimensions = (horizontal_dimension) - type = real - kind = kind_phys [CLDFRA_BL] standard_name = subgrid_cloud_fraction_pbl long_name = subgrid cloud fraction from PBL scheme @@ -4781,6 +4898,13 @@ dimensions = (horizontal_dimension) type = real kind = kind_phys +[train] + standard_name = accumulated_change_of_air_temperature_due_to_FA_scheme + long_name = accumulated change of air temperature due to FA MP scheme + units = K + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys [gflux] standard_name = cumulative_surface_ground_heat_flux_multiplied_by_timestep long_name = cumulative groud conductive heat flux multiplied by timestep @@ -5294,14 +5418,14 @@ kind = kind_phys [dt3dt(:,:,4)] standard_name = cumulative_change_in_temperature_due_to_deep_convection - long_name = cumulative change in temperature due to deep conv. + long_name = cumulative change in temperature due to deep convection units = K dimensions = (horizontal_dimension,vertical_dimension) type = real kind = kind_phys [dt3dt(:,:,5)] standard_name = cumulative_change_in_temperature_due_to_shal_convection - long_name = cumulative change in temperature due to shal conv. + long_name = cumulative change in temperature due to shallow convection units = K dimensions = (horizontal_dimension,vertical_dimension) type = real @@ -5329,14 +5453,14 @@ kind = kind_phys [dq3dt(:,:,2)] standard_name = cumulative_change_in_water_vapor_specific_humidity_due_to_deep_convection - long_name = cumulative change in water vapor specific humidity due to deep conv. + long_name = cumulative change in water vapor specific humidity due to deep convection units = kg kg-1 dimensions = (horizontal_dimension,vertical_dimension) type = real kind = kind_phys [dq3dt(:,:,3)] standard_name = cumulative_change_in_water_vapor_specific_humidity_due_to_shal_convection - long_name = cumulative change in water vapor specific humidity due to shal conv. + long_name = cumulative change in water vapor specific humidity due to shallow convection units = kg kg-1 dimensions = (horizontal_dimension,vertical_dimension) type = real @@ -5692,6 +5816,76 @@ [ccpp-arg-table] name = GFS_interstitial_type type = ddt +[qv_r] + standard_name = humidity_mixing_ratio + long_name = the ratio of the mass of water vapor to the mass of dry air + units = kg kg-1 + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys +[qc_r] + standard_name = cloud_liquid_water_mixing_ratio + long_name = the ratio of the mass of liquid water to the mass of dry air + units = kg kg-1 + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys +[qr_r] + standard_name = cloud_rain_water_mixing_ratio + long_name = the ratio of the mass rain water to the mass of dry air + units = kg kg-1 + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys +[qi_r] + standard_name = cloud_ice_mixing_ratio + long_name = the ratio of the mass of ice to the mass of dry air + units = kg kg-1 + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys +[qs_r] + standard_name = cloud_snow_mixing_ratio + long_name = the ratio of the mass of snow to mass of dry air + units = kg kg-1 + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys +[qg_r] + standard_name = mass_weighted_rime_factor_mixing_ratio + long_name = the ratio of the mass of rime factor to mass of dry air + units = kg kg-1 + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys +[f_ice] + standard_name = fraction_of_ice_water_cloud + long_name = fraction of ice water cloud + units = frac + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys +[f_rain] + standard_name = fraction_of_rain_water_cloud + long_name = fraction of rain water cloud + units = frac + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys +[f_rimef] + standard_name = rime_factor + long_name = rime factor + units = frac + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys +[cwm] + standard_name = total_cloud_condensate_mixing_ratio_updated_by_physics + long_name = total cloud condensate mixing ratio (except water vapor) updated by physics + units = kg kg-1 + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys [adjsfculw_ocean] standard_name = surface_upwelling_longwave_flux_over_ocean_interstitial long_name = surface upwelling longwave flux at current time over ocean (temporary use as interstitial) @@ -7103,7 +7297,7 @@ kind = kind_phys [ncstrac] standard_name = number_of_tracers_for_CS - long_name = number of convectively transported tracers in Chikira-Sugiyama deep conv. scheme + long_name = number of convectively transported tracers in Chikira-Sugiyama deep convection scheme units = count dimensions = () type = integer @@ -7157,7 +7351,7 @@ type = integer [ntiwx] standard_name = index_for_ice_cloud_condensate_vertical_diffusion_tracer - long_name = index for ice cloud condensate n the vertically diffused tracer array + long_name = index for ice cloud condensate in the vertically diffused tracer array units = index dimensions = () type = integer @@ -8245,6 +8439,13 @@ dimensions = () type = real kind = kind_phys +[con_epsq] + standard_name = minimum_value_of_specific_humidity + long_name = floor value for specific humidity + units = kg kg-1 + dimensions = () + type = real + kind = kind_phys [con_epsm1] standard_name = ratio_of_dry_air_to_water_vapor_gas_constants_minus_one long_name = (rd/rv) - 1 diff --git a/gfsphysics/physics/ugwp_driver_v0.f b/gfsphysics/physics/ugwp_driver_v0.f index 0ca37e818..41193aad0 100644 --- a/gfsphysics/physics/ugwp_driver_v0.f +++ b/gfsphysics/physics/ugwp_driver_v0.f @@ -1993,8 +1993,8 @@ subroutine edmix_ugwp_v0(im, levs, dtp, Km(1:levs) = ksum(1:levs) * rho(1:levs)* rho(1:levs) do j=1, nstab - call diff_1d_wtend(levs, dtstab, Fw, Fw1, levs, - & del(i,:), Sw, Sw1) + call diff_1d_wtend(levs, dtstab, Fw, Fw1, Km, + & rdp, rdpm, Sw, Sw1) Fw = Sw Fw1 = Sw1 enddo @@ -2006,7 +2006,7 @@ subroutine edmix_ugwp_v0(im, levs, dtp, Kpt = Km*iPr_pt Fw(1:levs) = pdTdt(i, 1:levs)*Ptmap(1:levs) do j=1, nstab - call diff_1d_ptend(levs, dtstab, Fw, Kpt, del(i,:), Sw) + call diff_1d_ptend(levs, dtstab, Fw, Kpt, rdp, rdpm, Sw) Fw = Sw enddo ed_dtdt(i,1:levs) = Sw(1:levs)/Ptmap(1:levs) diff --git a/io/FV3GFS_io.F90 b/io/FV3GFS_io.F90 index e8c980f4d..1ac6eae7b 100644 --- a/io/FV3GFS_io.F90 +++ b/io/FV3GFS_io.F90 @@ -512,10 +512,18 @@ subroutine sfc_prop_restart_read (Sfcprop, Atm_block, Model, fv_domain) nvar_s2o = 18 #ifdef CCPP if (Model%lsm == Model%lsm_ruc .and. warm_start) then - nvar_s2r = 6 + if(Model%rdlai) then + nvar_s2r = 7 + else + nvar_s2r = 6 + end if nvar_s3 = 5 else - nvar_s2r = 0 + if(Model%rdlai) then + nvar_s2r = 1 + else + nvar_s2r = 0 + endif nvar_s3 = 3 endif #else @@ -758,6 +766,11 @@ subroutine sfc_prop_restart_read (Sfcprop, Atm_block, Model, fv_domain) sfc_name2(nvar_s2m+22) = 'tsnow' sfc_name2(nvar_s2m+23) = 'snowfall_acc' sfc_name2(nvar_s2m+24) = 'swe_snowfall_acc' + if (Model%rdlai) then + sfc_name2(nvar_s2m+25) = 'lai' + endif + else if (Model%lsm == Model%lsm_ruc .and. Model%rdlai) then + sfc_name2(nvar_s2m+19) = 'lai' #endif endif @@ -956,6 +969,11 @@ subroutine sfc_prop_restart_read (Sfcprop, Atm_block, Model, fv_domain) Sfcprop(nb)%tsnow(ix) = sfc_var2(i,j,nvar_s2m+22) Sfcprop(nb)%snowfallac(ix) = sfc_var2(i,j,nvar_s2m+23) Sfcprop(nb)%acsnow(ix) = sfc_var2(i,j,nvar_s2m+24) + if (Model%rdlai) then + Sfcprop(nb)%xlaixy(ix) = sfc_var2(i,j,nvar_s2m+25) + endif + else if (Model%lsm == Model%lsm_ruc .and. Model%rdlai) then + Sfcprop(nb)%xlaixy(ix) = sfc_var2(i,j,nvar_s2m+19) elseif (Model%lsm == Model%lsm_noahmp) then !--- Extra Noah MP variables #else @@ -1447,7 +1465,11 @@ subroutine sfc_prop_restart_write (Sfcprop, Atm_block, Model, fv_domain, timesta nvar2o = 18 #ifdef CCPP if (Model%lsm == Model%lsm_ruc) then - nvar2r = 6 + if (Model%rdlai) then + nvar2r = 7 + else + nvar2r = 6 + endif nvar3 = 5 else nvar2r = 0 @@ -1474,7 +1496,10 @@ subroutine sfc_prop_restart_write (Sfcprop, Atm_block, Model, fv_domain, timesta #ifdef CCPP if (Model%lsm == Model%lsm_ruc) then if (allocated(sfc_name2)) then - if (size(sfc_var3,dim=3).ne.Model%lsoil_lsm) then + ! Re-allocate if one or more of the dimensions don't match + if (size(sfc_name2).ne.nvar2m+nvar2o+nvar2mp+nvar2r .or. & + size(sfc_name3).ne.nvar3+nvar3mp .or. & + size(sfc_var3,dim=3).ne.Model%lsoil_lsm) then !--- deallocate containers and free restart container deallocate(sfc_name2) deallocate(sfc_name3) @@ -1581,6 +1606,9 @@ subroutine sfc_prop_restart_write (Sfcprop, Atm_block, Model, fv_domain, timesta sfc_name2(nvar2m+22) = 'tsnow' sfc_name2(nvar2m+23) = 'snowfall_acc' sfc_name2(nvar2m+24) = 'swe_snowfall_acc' + if (Model%rdlai) then + sfc_name2(nvar2m+25) = 'lai' + endif else if(Model%lsm == Model%lsm_noahmp) then #else ! Only needed when Noah MP LSM is used - 29 2D @@ -1654,17 +1682,19 @@ subroutine sfc_prop_restart_write (Sfcprop, Atm_block, Model, fv_domain, timesta #ifdef CCPP if (Model%lsm == Model%lsm_noah .or. Model%lsm == Model%lsm_noahmp) then - !--- names of the 2D variables to save + !--- names of the 3D variables to save sfc_name3(1) = 'stc' sfc_name3(2) = 'smc' sfc_name3(3) = 'slc' - sfc_name3(4) = 'snicexy' - sfc_name3(5) = 'snliqxy' - sfc_name3(6) = 'tsnoxy' - sfc_name3(7) = 'smoiseq' - sfc_name3(8) = 'zsnsoxy' + if (Model%lsm == Model%lsm_noahmp) then + sfc_name3(4) = 'snicexy' + sfc_name3(5) = 'snliqxy' + sfc_name3(6) = 'tsnoxy' + sfc_name3(7) = 'smoiseq' + sfc_name3(8) = 'zsnsoxy' + endif else if (Model%lsm == Model%lsm_ruc) then - !--- names of the 2D variables to save + !--- names of the 3D variables to save sfc_name3(1) = 'tslb' sfc_name3(2) = 'smois' sfc_name3(3) = 'sh2o' @@ -1783,6 +1813,9 @@ subroutine sfc_prop_restart_write (Sfcprop, Atm_block, Model, fv_domain, timesta sfc_var2(i,j,nvar2m+22) = Sfcprop(nb)%tsnow(ix) sfc_var2(i,j,nvar2m+23) = Sfcprop(nb)%snowfallac(ix) sfc_var2(i,j,nvar2m+24) = Sfcprop(nb)%acsnow(ix) + if (Model%rdlai) then + sfc_var2(i,j,nvar2m+25) = Sfcprop(nb)%xlaixy(ix) + endif else if (Model%lsm == Model%lsm_noahmp) then #else diff --git a/makefile b/makefile index ff09a48f8..f0f84c4b4 100644 --- a/makefile +++ b/makefile @@ -47,7 +47,7 @@ libs: $(MAKE) -C atmos_cubed_sphere $(MAKE_OPTS) FMS_DIR=$(FMS_DIR) $(MAKE) -C ../stochastic_physics $(MAKE_OPTS) FMS_DIR=$(FMS_DIR) 32BIT=N # force gfs physics to 64bit -$(FV3_EXE): atmos_model.o coupler_main.o ccpp/driver/libccppdriver.a atmos_cubed_sphere/libfv3core.a io/libfv3io.a ipd/libipd.a $(PHYSP)physics/lib$(PHYSP)phys.a ../stochastic_physics/libstochastic_physics.a cpl/libfv3cpl.a fms/libfms.a +$(FV3_EXE): atmos_model.o coupler_main.o ccpp/driver/libccppdriver.a atmos_cubed_sphere/libfv3core.a io/libfv3io.a ipd/libipd.a $(PHYSP)physics/lib$(PHYSP)phys.a ../stochastic_physics/libstochastic_physics.a cpl/libfv3cpl.a $(LD) -o $@ $^ $(NCEPLIBS) $(LDFLAGS) else @@ -59,7 +59,7 @@ libs: $(MAKE) -C atmos_cubed_sphere $(MAKE_OPTS) FMS_DIR=$(FMS_DIR) $(MAKE) -C ../stochastic_physics $(MAKE_OPTS) FMS_DIR=$(FMS_DIR) 32BIT=N # force gfs physics to 64bit -$(FV3_EXE): atmos_model.o coupler_main.o atmos_cubed_sphere/libfv3core.a io/libfv3io.a ipd/libipd.a $(PHYSP)physics/lib$(PHYSP)phys.a ../stochastic_physics/libstochastic_physics.a cpl/libfv3cpl.a fms/libfms.a +$(FV3_EXE): atmos_model.o coupler_main.o atmos_cubed_sphere/libfv3core.a io/libfv3io.a ipd/libipd.a $(PHYSP)physics/lib$(PHYSP)phys.a ../stochastic_physics/libstochastic_physics.a cpl/libfv3cpl.a $(LD) -o $@ $^ $(NCEPLIBS) $(LDFLAGS) endif @@ -100,7 +100,7 @@ esmf_make_fragment: @echo "ESMF_DEP_FRONT = fv3gfs_cap_mod" >> fv3.mk # additional include files needed for PGI #@echo "ESMF_DEP_INCPATH = $(PWD)/nems_dir" >> fv3.mk - @echo "ESMF_DEP_INCPATH = $(PWD) $(addprefix $(PWD)/, nems_dir ccpp/driver atmos_cubed_sphere io fms gfsphysics cpl ipd ../stochastic_physics)" >> fv3.mk + @echo "ESMF_DEP_INCPATH = $(PWD) $(addprefix $(PWD)/, nems_dir ccpp/driver atmos_cubed_sphere io gfsphysics cpl ipd ../stochastic_physics)" >> fv3.mk @echo "ESMF_DEP_CMPL_OBJS =" >> fv3.mk @echo "ESMF_DEP_LINK_OBJS = $(addprefix $(PWD)/nems_dir/, libfv3cap.a libccppdriver.a libfv3core.a libfv3io.a libipd.a lib$(PHYSP)phys.a libfv3cpl.a libstochastic_physics.a) $(SIONLIB_LINK_FLAGS)" >> fv3.mk @echo "ESMF_DEP_SHRD_PATH =" >> fv3.mk @@ -119,7 +119,7 @@ esmf_make_fragment: @echo "ESMF_DEP_FRONT = fv3gfs_cap_mod" >> fv3.mk # additional include files needed for PGI #@echo "ESMF_DEP_INCPATH = $(PWD)/nems_dir" >> fv3.mk - @echo "ESMF_DEP_INCPATH = $(PWD) $(addprefix $(PWD)/, nems_dir atmos_cubed_sphere io fms gfsphysics cpl ipd ../stochastic_physics)" >> fv3.mk + @echo "ESMF_DEP_INCPATH = $(PWD) $(addprefix $(PWD)/, nems_dir atmos_cubed_sphere io gfsphysics cpl ipd ../stochastic_physics)" >> fv3.mk @echo "ESMF_DEP_CMPL_OBJS =" >> fv3.mk @echo "ESMF_DEP_LINK_OBJS = $(addprefix $(PWD)/nems_dir/, libfv3cap.a libfv3core.a libfv3io.a libipd.a lib$(PHYSP)phys.a libfv3cpl.a libstochastic_physics.a)" >> fv3.mk @echo "ESMF_DEP_SHRD_PATH =" >> fv3.mk From 7ffe6471c20404091fbbf8f321fbb9ee84a4f36d Mon Sep 17 00:00:00 2001 From: Dusan Jovic <48258889+DusanJovic-NOAA@users.noreply.github.com> Date: Fri, 24 Jan 2020 17:47:02 -0500 Subject: [PATCH 5/7] GFSv16 netcdf post ficein cpl (#48) * fv3atm issue #37: fix the real(8) lat/lon in netcdf file * fv3atm #35: Reducing background vertical diffusivities in the inversion layers * fv3atm #24: bug in gfsphysics/physics/moninedmf_hafs.f * fv3atm #18: Optimize netcdf write component and bugfix for post and samfdeepcnv.f * set (0-1) bounds for ficein_cpl * remove cache_size due to lower netcdf verion 4.5.1 on mars * Change ice falling to 0.9 in gfsphysics/physics/gfdl_cloud_microphys.F90 --- .gitmodules | 2 + atmos_model.F90 | 2 +- ccpp/framework | 2 +- ccpp/physics | 2 +- gfsphysics/physics/gfdl_cloud_microphys.F90 | 2 +- .../physics/module_sf_noahmp_glacier.f90 | 0 gfsphysics/physics/module_sf_noahmplsm.f90 | 0 gfsphysics/physics/module_wrf_utl.f90 | 0 gfsphysics/physics/moninedmf_hafs.f | 6 +- gfsphysics/physics/noahmp_tables.f90 | 0 gfsphysics/physics/samfdeepcnv.f | 28 ++--- gfsphysics/physics/satmedmfvdifq.f | 11 +- gfsphysics/physics/sfc_noahmp_drv.f | 0 io/FV3GFS_io.F90 | 2 +- io/module_write_nemsio.F90 | 2 +- io/module_write_netcdf.F90 | 115 ++++++++++-------- io/module_wrt_grid_comp.F90 | 64 ++++++---- io/post_gfs.F90 | 14 ++- 18 files changed, 148 insertions(+), 104 deletions(-) mode change 100755 => 100644 gfsphysics/physics/module_sf_noahmp_glacier.f90 mode change 100755 => 100644 gfsphysics/physics/module_sf_noahmplsm.f90 mode change 100755 => 100644 gfsphysics/physics/module_wrf_utl.f90 mode change 100755 => 100644 gfsphysics/physics/noahmp_tables.f90 mode change 100755 => 100644 gfsphysics/physics/sfc_noahmp_drv.f diff --git a/.gitmodules b/.gitmodules index 949d298df..d253f6966 100644 --- a/.gitmodules +++ b/.gitmodules @@ -5,6 +5,8 @@ [submodule "ccpp/framework"] path = ccpp/framework url = https://github.com/NCAR/ccpp-framework + branch = master [submodule "ccpp/physics"] path = ccpp/physics url = https://github.com/NCAR/ccpp-physics + branch = master diff --git a/atmos_model.F90 b/atmos_model.F90 index 34e1a6c99..9a73e0151 100644 --- a/atmos_model.F90 +++ b/atmos_model.F90 @@ -1720,7 +1720,7 @@ subroutine assign_importdata(rc) IPD_Data(nb)%Coupling%ficein_cpl(ix) = zero if (IPD_Data(nb)%Sfcprop%oceanfrac(ix) > zero) then if (datar8(i,j) >= IPD_control%min_seaice*IPD_Data(nb)%Sfcprop%oceanfrac(ix)) then - IPD_Data(nb)%Coupling%ficein_cpl(ix) = datar8(i,j) + IPD_Data(nb)%Coupling%ficein_cpl(ix) = max(zero, min(datar8(i,j),one)) ! if (IPD_Data(nb)%Sfcprop%oceanfrac(ix) == one) IPD_Data(nb)%Sfcprop%slmsk(ix) = 2. !slmsk=2 crashes in gcycle on partial land points IPD_Data(nb)%Sfcprop%slmsk(ix) = 2. !slmsk=2 crashes in gcycle on partial land points IPD_Data(nb)%Coupling%slimskin_cpl(ix) = 4. diff --git a/ccpp/framework b/ccpp/framework index 7ab419eee..e77210986 160000 --- a/ccpp/framework +++ b/ccpp/framework @@ -1 +1 @@ -Subproject commit 7ab419eeebe133e706d9825d14c5bdc5d190e60d +Subproject commit e7721098639ee73c2a69ee0e8423e8905549e240 diff --git a/ccpp/physics b/ccpp/physics index 39981891a..01ed01fb0 160000 --- a/ccpp/physics +++ b/ccpp/physics @@ -1 +1 @@ -Subproject commit 39981891a5b84e0f08acdf4d9e72d31c0c07aa82 +Subproject commit 01ed01fb0b3112e96eb619e0339d88fb0201982f diff --git a/gfsphysics/physics/gfdl_cloud_microphys.F90 b/gfsphysics/physics/gfdl_cloud_microphys.F90 index ba4c814d6..f01486db0 100644 --- a/gfsphysics/physics/gfdl_cloud_microphys.F90 +++ b/gfsphysics/physics/gfdl_cloud_microphys.F90 @@ -3266,7 +3266,7 @@ subroutine fall_speed (ktop, kbot, den, qs, qi, qg, ql, tk, vts, vti, vtg) else tc (k) = tk (k) - tice vti (k) = (3. + log10 (qi (k) * den (k))) * (tc (k) * (aa * tc (k) + bb) + cc) + dd * tc (k) + ee - vti (k) = vi0 * exp (log_10 * vti (k)) * 0.8 + vti (k) = vi0 * exp (log_10 * vti (k)) * 0.9 vti (k) = min (vi_max, max (vf_min, vti (k))) endif enddo diff --git a/gfsphysics/physics/module_sf_noahmp_glacier.f90 b/gfsphysics/physics/module_sf_noahmp_glacier.f90 old mode 100755 new mode 100644 diff --git a/gfsphysics/physics/module_sf_noahmplsm.f90 b/gfsphysics/physics/module_sf_noahmplsm.f90 old mode 100755 new mode 100644 diff --git a/gfsphysics/physics/module_wrf_utl.f90 b/gfsphysics/physics/module_wrf_utl.f90 old mode 100755 new mode 100644 diff --git a/gfsphysics/physics/moninedmf_hafs.f b/gfsphysics/physics/moninedmf_hafs.f index 42de545f2..a035ad3d6 100644 --- a/gfsphysics/physics/moninedmf_hafs.f +++ b/gfsphysics/physics/moninedmf_hafs.f @@ -1360,7 +1360,11 @@ subroutine moninedmf_hafs(ix,im,km,ntrac,ntcw,dv,du,tau,rtg, & tem = 0.5 * (diss(i,k-1)+diss(i,k)) tem = max(tem, 0.) ttend = tem / cp - tau(i,k) = tau(i,k) + 0.5*ttend + if (alpha .gt. 0.0) then + tau(i,k) = tau(i,k) + 0.5*ttend + else + tau(i,k) = tau(i,k) + 0.7*ttend ! in HWRF/HMON, use 0.7 + endif enddo enddo ! diff --git a/gfsphysics/physics/noahmp_tables.f90 b/gfsphysics/physics/noahmp_tables.f90 old mode 100755 new mode 100644 diff --git a/gfsphysics/physics/samfdeepcnv.f b/gfsphysics/physics/samfdeepcnv.f index 76204ebb4..d29410d2f 100644 --- a/gfsphysics/physics/samfdeepcnv.f +++ b/gfsphysics/physics/samfdeepcnv.f @@ -1547,22 +1547,22 @@ subroutine samfdeepcnv(im,ix,km,delt,itc,ntc,ntk,ntr,delp, enddo enddo do i = 1, im - betamn = betas - if(islimsk(i) == 1) betamn = betal - if(ntk > 0) then - betamx = betamn + dbeta - if(tkemean(i) > tkemx) then - beta = betamn - else if(tkemean(i) < tkemn) then - beta = betamx + if(cnvflg(i)) then + betamn = betas + if(islimsk(i) == 1) betamn = betal + if(ntk > 0) then + betamx = betamn + dbeta + if(tkemean(i) > tkemx) then + beta = betamn + else if(tkemean(i) < tkemn) then + beta = betamx + else + tem = (betamx - betamn) * (tkemean(i) - tkemn) + beta = betamx - tem / dtke + endif else - tem = (betamx - betamn) * (tkemean(i) - tkemn) - beta = betamx - tem / dtke + beta = betamn endif - else - beta = betamn - endif - if(cnvflg(i)) then dz = (sumx(i)+zi(i,1))/float(kbcon(i)) tem = 1./float(kbcon(i)) xlamd(i) = (1.-beta**tem)/dz diff --git a/gfsphysics/physics/satmedmfvdifq.f b/gfsphysics/physics/satmedmfvdifq.f index 11c047fd0..1cc0bbe89 100644 --- a/gfsphysics/physics/satmedmfvdifq.f +++ b/gfsphysics/physics/satmedmfvdifq.f @@ -148,7 +148,8 @@ subroutine satmedmfvdifq(ix,im,km,ntrac,ntcw,ntiw,ntke, & epsi, beta, chx, cqx, & rdt, rdz, qmin, qlmin, & rimin, rbcr, rbint, tdzmin, - & rlmn, rlmn1, rlmx, elmx, + & rlmn, rlmn1, rlmn2, + & rlmx, elmx, & ttend, utend, vtend, qtend, & zfac, zfmin, vk, spdk2, & tkmin, tkminx, xkzinv, xkgdx, @@ -172,7 +173,8 @@ subroutine satmedmfvdifq(ix,im,km,ntrac,ntcw,ntiw,ntke, parameter(gamcrt=3.,gamcrq=0.,sfcfrac=0.1) parameter(vk=0.4,rimin=-100.) parameter(rbcr=0.25,zolcru=-0.02,tdzmin=1.e-3) - parameter(rlmn=30.,rlmn1=5.,rlmx=300.,elmx=300.) + parameter(rlmn=30.,rlmn1=5.,rlmn2=10.) + parameter(rlmx=300.,elmx=300.) parameter(prmin=0.25,prmax=4.0) parameter(pr0=1.0,prtke=1.0,prscu=0.67) parameter(f0=1.e-4,crbmin=0.15,crbmax=0.35) @@ -698,8 +700,9 @@ subroutine satmedmfvdifq(ix,im,km,ntrac,ntcw,ntiw,ntke, ! if(tem1 > 1.e-5) then tem1 = tvx(i,k+1)-tvx(i,k) if(tem1 > 0.) then - xkzo(i,k) = min(xkzo(i,k),xkzinv) - xkzmo(i,k) = min(xkzmo(i,k),xkzinv) + xkzo(i,k) = min(xkzo(i,k), xkzinv) + xkzmo(i,k) = min(xkzmo(i,k), xkzinv) + rlmnz(i,k) = min(rlmnz(i,k), rlmn2) endif enddo enddo diff --git a/gfsphysics/physics/sfc_noahmp_drv.f b/gfsphysics/physics/sfc_noahmp_drv.f old mode 100755 new mode 100644 diff --git a/io/FV3GFS_io.F90 b/io/FV3GFS_io.F90 index 1ac6eae7b..972d43fde 100644 --- a/io/FV3GFS_io.F90 +++ b/io/FV3GFS_io.F90 @@ -285,7 +285,7 @@ subroutine FV3GFS_IPD_checksum (Model, IPD_Data, Atm_block) temp2d(i,j,55) = IPD_Data(nb)%Coupling%visbmui(ix) temp2d(i,j,56) = IPD_Data(nb)%Coupling%visdfui(ix) temp2d(i,j,57) = IPD_Data(nb)%Coupling%sfcdsw(ix) - temp2d(i,j,59) = IPD_Data(nb)%Coupling%sfcnsw(ix) + temp2d(i,j,58) = IPD_Data(nb)%Coupling%sfcnsw(ix) temp2d(i,j,59) = IPD_Data(nb)%Coupling%sfcdlw(ix) temp2d(i,j,60) = IPD_Data(nb)%Grid%xlon(ix) temp2d(i,j,61) = IPD_Data(nb)%Grid%xlat(ix) diff --git a/io/module_write_nemsio.F90 b/io/module_write_nemsio.F90 index 3afd66789..e51f64a52 100644 --- a/io/module_write_nemsio.F90 +++ b/io/module_write_nemsio.F90 @@ -51,7 +51,7 @@ subroutine nemsio_first_call(fieldbundle, imo, jmo, & integer, intent(in) :: wrt_mype, wrt_ntasks, wrt_mpi_comm integer, intent(in) :: wrt_nbdl, mybdl integer, intent(in) :: inidate(7) - real, intent(in) :: lat(:), lon(:) + real(8), intent(in) :: lat(:), lon(:) integer, optional,intent(out) :: rc !** local vars diff --git a/io/module_write_netcdf.F90 b/io/module_write_netcdf.F90 index 1fce3d8b9..fc59c75c9 100644 --- a/io/module_write_netcdf.F90 +++ b/io/module_write_netcdf.F90 @@ -42,7 +42,7 @@ subroutine write_netcdf(fieldbundle, wrtfb, filename, mpi_comm, mype, im, jm, rc real(4), dimension(:,:,:), allocatable :: arrayr4_3d,arrayr4_3d_save real(8), dimension(:,:,:), allocatable :: arrayr8_3d - real(8) rad2dg,x(im),y(jm) + real(8) x(im),y(jm) integer :: fieldCount, fieldDimCount, gridDimCount integer, dimension(:), allocatable :: ungriddedLBound, ungriddedUBound @@ -56,7 +56,8 @@ subroutine write_netcdf(fieldbundle, wrtfb, filename, mpi_comm, mype, im, jm, rc character(len=ESMF_MAXSTR) :: attName, fldName integer :: varival - real(4) :: varr4val, scale_fact, compress_err, offset, dataMin, dataMax + real(4) :: varr4val, scale_fact, offset, dataMin, dataMax + real(4), allocatable, dimension(:) :: compress_err real(8) :: varr8val character(len=ESMF_MAXSTR) :: varcval @@ -71,10 +72,10 @@ subroutine write_netcdf(fieldbundle, wrtfb, filename, mpi_comm, mype, im, jm, rc ! !! ! - rad2dg = 45./atan(1.0) call ESMF_FieldBundleGet(fieldbundle, fieldCount=fieldCount, rc=rc); ESMF_ERR_RETURN(rc) + allocate(compress_err(fieldCount)); compress_err=-999. allocate(fldlev(fieldCount)) ; fldlev = 0 allocate(fcstField(fieldCount)) allocate(varids(fieldCount)) @@ -117,13 +118,13 @@ subroutine write_netcdf(fieldbundle, wrtfb, filename, mpi_comm, mype, im, jm, rc if (mype==0) then if (ideflate == 0) then - ncerr = nf90_create(trim(filename), cmode=IOR(NF90_CLOBBER,NF90_64BIT_OFFSET), & + ncerr = nf90_create(trim(filename), cmode=IOR(IOR(NF90_CLOBBER,NF90_64BIT_OFFSET),NF90_SHARE), & ncid=ncid); NC_ERR_STOP(ncerr) ncerr = nf90_set_fill(ncid, NF90_NOFILL, oldMode); NC_ERR_STOP(ncerr) else ncerr = nf90_create(trim(filename), cmode=IOR(IOR(NF90_CLOBBER,NF90_NETCDF4),NF90_CLASSIC_MODEL), & ncid=ncid); NC_ERR_STOP(ncerr) - ! if compression on use HDF5 format with default _FillValue + ncerr = nf90_set_fill(ncid, NF90_NOFILL, oldMode); NC_ERR_STOP(ncerr) endif ! define dimensions @@ -156,28 +157,32 @@ subroutine write_netcdf(fieldbundle, wrtfb, filename, mpi_comm, mype, im, jm, rc ! define variables if (fldlev(i) == 1) then if (typekind == ESMF_TYPEKIND_R4) then - ncerr = nf90_def_var(ncid, trim(fldName), NF90_FLOAT, & - (/im_dimid,jm_dimid,time_dimid/), varids(i)); NC_ERR_STOP(ncerr) if (ideflate > 0) then - ! shuffle filter on for lossless compression - ncerr = nf90_def_var_deflate(ncid, varids(i), 1, 1, ideflate) - NC_ERR_STOP(ncerr) + ncerr = nf90_def_var(ncid, trim(fldName), NF90_FLOAT, & + (/im_dimid,jm_dimid,time_dimid/), varids(i), & + shuffle=.true.,deflate_level=ideflate, & + chunksizes=(/im,jm,1/)); NC_ERR_STOP(ncerr) + else + ncerr = nf90_def_var(ncid, trim(fldName), NF90_FLOAT, & + (/im_dimid,jm_dimid,time_dimid/), varids(i)); NC_ERR_STOP(ncerr) endif else if (typekind == ESMF_TYPEKIND_R8) then ncerr = nf90_def_var(ncid, trim(fldName), NF90_DOUBLE, & - (/im_dimid,jm_dimid,time_dimid/), varids(i)); NC_ERR_STOP(ncerr) + (/im_dimid,jm_dimid,time_dimid/), varids(i)); NC_ERR_STOP(ncerr) else write(0,*)'Unsupported typekind ', typekind stop end if else if (fldlev(i) > 1) then if (typekind == ESMF_TYPEKIND_R4) then - ncerr = nf90_def_var(ncid, trim(fldName), NF90_FLOAT, & - (/im_dimid,jm_dimid,pfull_dimid,time_dimid/), varids(i)); NC_ERR_STOP(ncerr) if (ideflate > 0) then - ! shuffle filter off since lossy compression used - ncerr = nf90_def_var_deflate(ncid, varids(i), 0, 1, ideflate) - NC_ERR_STOP(ncerr) + ncerr = nf90_def_var(ncid, trim(fldName), NF90_FLOAT, & + (/im_dimid,jm_dimid,pfull_dimid,time_dimid/), varids(i), & + shuffle=.false.,deflate_level=ideflate, & + chunksizes=(/im,jm,1,1/)); NC_ERR_STOP(ncerr) + else + ncerr = nf90_def_var(ncid, trim(fldName), NF90_FLOAT, & + (/im_dimid,jm_dimid,pfull_dimid,time_dimid/), varids(i)); NC_ERR_STOP(ncerr) endif else if (typekind == ESMF_TYPEKIND_R8) then ncerr = nf90_def_var(ncid, trim(fldName), NF90_DOUBLE, & @@ -219,8 +224,8 @@ subroutine write_netcdf(fieldbundle, wrtfb, filename, mpi_comm, mype, im, jm, rc call ESMF_AttributeGet(fcstField(i), convention="NetCDF", purpose="FV3", & name=trim(attName), value=varr8val, & rc=rc); ESMF_ERR_RETURN(rc) - if (trim(attName) /= '_FillValue' .or. ideflate == 0) then - ! FIXME: _FillValue must be cast to var type when using NF90_NETCDF4 + if (trim(attName) /= '_FillValue' ) then + ! FIXME: _FillValue must be cast to var type for recent versions of netcdf ncerr = nf90_put_att(ncid, varids(i), trim(attName), varr8val); NC_ERR_STOP(ncerr) endif @@ -236,6 +241,25 @@ subroutine write_netcdf(fieldbundle, wrtfb, filename, mpi_comm, mype, im, jm, rc end do ! i=1,fieldCount +! write grid_xt, grid_yt attributes + if (trim(output_grid) == 'gaussian_grid' .or. & + trim(output_grid) == 'regional_latlon') then + ncerr = nf90_put_att(ncid, im_varid, "long_name", "T-cell longitude"); NC_ERR_STOP(ncerr) + ncerr = nf90_put_att(ncid, im_varid, "units", "degrees_E"); NC_ERR_STOP(ncerr) + ncerr = nf90_put_att(ncid, jm_varid, "long_name", "T-cell latiitude"); NC_ERR_STOP(ncerr) + ncerr = nf90_put_att(ncid, jm_varid, "units", "degrees_N"); NC_ERR_STOP(ncerr) + else if (trim(output_grid) == 'rotated_latlon') then + ncerr = nf90_put_att(ncid, im_varid, "long_name", "rotated T-cell longiitude"); NC_ERR_STOP(ncerr) + ncerr = nf90_put_att(ncid, im_varid, "units", "degrees"); NC_ERR_STOP(ncerr) + ncerr = nf90_put_att(ncid, jm_varid, "long_name", "rotated T-cell latiitude"); NC_ERR_STOP(ncerr) + ncerr = nf90_put_att(ncid, jm_varid, "units", "degrees"); NC_ERR_STOP(ncerr) + else if (trim(output_grid) == 'lambert_conformal') then + ncerr = nf90_put_att(ncid, im_varid, "long_name", "x-coordinate of projection"); NC_ERR_STOP(ncerr) + ncerr = nf90_put_att(ncid, im_varid, "units", "meters"); NC_ERR_STOP(ncerr) + ncerr = nf90_put_att(ncid, jm_varid, "long_name", "y-coordinate of projection"); NC_ERR_STOP(ncerr) + ncerr = nf90_put_att(ncid, jm_varid, "units", "meters"); NC_ERR_STOP(ncerr) + endif + ncerr = nf90_enddef(ncid); NC_ERR_STOP(ncerr) end if @@ -247,31 +271,19 @@ subroutine write_netcdf(fieldbundle, wrtfb, filename, mpi_comm, mype, im, jm, rc if (mype==0) then if (trim(output_grid) == 'gaussian_grid' .or. & trim(output_grid) == 'regional_latlon') then - ncerr = nf90_put_var(ncid, im_varid, values=rad2dg*arrayr8(:,1) ); NC_ERR_STOP(ncerr) - ncerr = nf90_redef(ncid=ncid); NC_ERR_STOP(ncerr) - ncerr = nf90_put_att(ncid, im_varid, "long_name", "T-cell longitude"); NC_ERR_STOP(ncerr) - ncerr = nf90_put_att(ncid, im_varid, "units", "degrees_E"); NC_ERR_STOP(ncerr) - ncerr = nf90_enddef(ncid=ncid); NC_ERR_STOP(ncerr) + ncerr = nf90_put_var(ncid, im_varid, values=arrayr8(:,1) ); NC_ERR_STOP(ncerr) else if (trim(output_grid) == 'rotated_latlon') then do i=1,im x(i) = lon1 + (lon2-lon1)/(im-1) * (i-1) enddo ncerr = nf90_put_var(ncid, im_varid, values=x ); NC_ERR_STOP(ncerr) - ncerr = nf90_redef(ncid=ncid); NC_ERR_STOP(ncerr) - ncerr = nf90_put_att(ncid, im_varid, "long_name", "rotated T-cell longiitude"); NC_ERR_STOP(ncerr) - ncerr = nf90_put_att(ncid, im_varid, "units", "degrees"); NC_ERR_STOP(ncerr) - ncerr = nf90_enddef(ncid=ncid); NC_ERR_STOP(ncerr) else if (trim(output_grid) == 'lambert_conformal') then do i=1,im x(i) = dx * (i-1) enddo ncerr = nf90_put_var(ncid, im_varid, values=x ); NC_ERR_STOP(ncerr) - ncerr = nf90_redef(ncid=ncid); NC_ERR_STOP(ncerr) - ncerr = nf90_put_att(ncid, im_varid, "long_name", "x-coordinate of projection"); NC_ERR_STOP(ncerr) - ncerr = nf90_put_att(ncid, im_varid, "units", "meters"); NC_ERR_STOP(ncerr) - ncerr = nf90_enddef(ncid=ncid); NC_ERR_STOP(ncerr) endif - ncerr = nf90_put_var(ncid, lon_varid, values=rad2dg*arrayr8 ); NC_ERR_STOP(ncerr) + ncerr = nf90_put_var(ncid, lon_varid, values=arrayr8 ); NC_ERR_STOP(ncerr) endif call ESMF_GridGetCoord(wrtGrid, coordDim=2, array=array, rc=rc); ESMF_ERR_RETURN(rc) @@ -279,31 +291,19 @@ subroutine write_netcdf(fieldbundle, wrtfb, filename, mpi_comm, mype, im, jm, rc if (mype==0) then if (trim(output_grid) == 'gaussian_grid' .or. & trim(output_grid) == 'regional_latlon') then - ncerr = nf90_put_var(ncid, jm_varid, values=rad2dg*arrayr8(1,:) ); NC_ERR_STOP(ncerr) - ncerr = nf90_redef(ncid=ncid); NC_ERR_STOP(ncerr) - ncerr = nf90_put_att(ncid, jm_varid, "long_name", "T-cell latiitude"); NC_ERR_STOP(ncerr) - ncerr = nf90_put_att(ncid, jm_varid, "units", "degrees_N"); NC_ERR_STOP(ncerr) - ncerr = nf90_enddef(ncid=ncid); NC_ERR_STOP(ncerr) + ncerr = nf90_put_var(ncid, jm_varid, values=arrayr8(1,:) ); NC_ERR_STOP(ncerr) else if (trim(output_grid) == 'rotated_latlon') then do j=1,jm y(j) = lat1 + (lat2-lat1)/(jm-1) * (j-1) enddo ncerr = nf90_put_var(ncid, jm_varid, values=y ); NC_ERR_STOP(ncerr) - ncerr = nf90_redef(ncid=ncid); NC_ERR_STOP(ncerr) - ncerr = nf90_put_att(ncid, jm_varid, "long_name", "rotated T-cell latiitude"); NC_ERR_STOP(ncerr) - ncerr = nf90_put_att(ncid, jm_varid, "units", "degrees"); NC_ERR_STOP(ncerr) - ncerr = nf90_enddef(ncid=ncid); NC_ERR_STOP(ncerr) else if (trim(output_grid) == 'lambert_conformal') then do j=1,jm y(j) = dy * (j-1) enddo ncerr = nf90_put_var(ncid, jm_varid, values=y ); NC_ERR_STOP(ncerr) - ncerr = nf90_redef(ncid=ncid); NC_ERR_STOP(ncerr) - ncerr = nf90_put_att(ncid, jm_varid, "long_name", "y-coordinate of projection"); NC_ERR_STOP(ncerr) - ncerr = nf90_put_att(ncid, jm_varid, "units", "meters"); NC_ERR_STOP(ncerr) - ncerr = nf90_enddef(ncid=ncid); NC_ERR_STOP(ncerr) endif - ncerr = nf90_put_var(ncid, lat_varid, values=rad2dg*arrayr8 ); NC_ERR_STOP(ncerr) + ncerr = nf90_put_var(ncid, lat_varid, values=arrayr8 ); NC_ERR_STOP(ncerr) endif do i=1, fieldCount @@ -344,11 +344,7 @@ subroutine write_netcdf(fieldbundle, wrtfb, filename, mpi_comm, mype, im, jm, rc arrayr4_3d = quantized(arrayr4_3d_save, nbits, dataMin, dataMax) ! compute max abs compression error, save as a variable ! attribute. - compress_err = maxval(abs(arrayr4_3d_save-arrayr4_3d)) - ncerr = nf90_redef(ncid=ncid); NC_ERR_STOP(ncerr) - ncerr = nf90_put_att(ncid, varids(i), 'max_abs_compression_error', compress_err); NC_ERR_STOP(ncerr) - ncerr = nf90_put_att(ncid, varids(i), 'nbits', nbits); NC_ERR_STOP(ncerr) - ncerr = nf90_enddef(ncid=ncid); NC_ERR_STOP(ncerr) + compress_err(i) = maxval(abs(arrayr4_3d_save-arrayr4_3d)) endif ncerr = nf90_put_var(ncid, varids(i), values=arrayr4_3d, start=(/1,1,1/),count=(/im,jm,lm,1/) ); NC_ERR_STOP(ncerr) end if @@ -363,6 +359,17 @@ subroutine write_netcdf(fieldbundle, wrtfb, filename, mpi_comm, mype, im, jm, rc end do + if (ideflate > 0 .and. nbits > 0 .and. mype == 0) then + ncerr = nf90_redef(ncid=ncid); NC_ERR_STOP(ncerr) + do i=1, fieldCount + if (compress_err(i) > 0) then + ncerr = nf90_put_att(ncid, varids(i), 'max_abs_compression_error', compress_err(i)); NC_ERR_STOP(ncerr) + ncerr = nf90_put_att(ncid, varids(i), 'nbits', nbits); NC_ERR_STOP(ncerr) + endif + enddo + ncerr = nf90_enddef(ncid=ncid); NC_ERR_STOP(ncerr) + endif + deallocate(arrayr4) deallocate(arrayr8) deallocate(arrayr4_3d,arrayr4_3d_save) @@ -484,9 +491,9 @@ subroutine get_grid_attr(grid, prefix, ncid, varid, rc) else if (typekind==ESMF_TYPEKIND_R8) then call ESMF_AttributeGet(grid, convention="NetCDF", purpose="FV3", & name=trim(attName), value=varr8val, rc=rc); ESMF_ERR_RETURN(rc) - if (trim(attName) /= '_FillValue' .or. ideflate == 0) then - ! FIXME: _FillValue must be cast to var type when using - ! NF90_NETCDF4. Until this is fixed, using netCDF default _FillValue. + if (trim(attName) /= '_FillValue') then + ! FIXME: _FillValue must be cast to var type for recent versions + ! of netcdf ncerr = nf90_put_att(ncid, varid, trim(attName(ind+1:len(attName))), varr8val); NC_ERR_STOP(ncerr) endif diff --git a/io/module_wrt_grid_comp.F90 b/io/module_wrt_grid_comp.F90 index aad3991d0..84769eaea 100644 --- a/io/module_wrt_grid_comp.F90 +++ b/io/module_wrt_grid_comp.F90 @@ -183,7 +183,7 @@ subroutine wrt_initialize(wrt_comp, imp_state_write, exp_state_write, clock, rc) character(128) :: FBlist_outfilename(100), outfile_name character(128),dimension(:,:), allocatable :: outfilename real(8), dimension(:), allocatable :: slat - real, dimension(:), allocatable :: lat, lon, axesdata + real(8), dimension(:), allocatable :: lat, lon real(ESMF_KIND_R8), dimension(:,:), pointer :: lonPtr, latPtr real(ESMF_KIND_R8) :: rot_lon, rot_lat real(ESMF_KIND_R8) :: geo_lon, geo_lat @@ -358,19 +358,20 @@ subroutine wrt_initialize(wrt_comp, imp_state_write, exp_state_write, clock, rc) wrt_int_state%latstart = lat(1) wrt_int_state%latlast = lat(jmo) do j=1,imo - lon(j) = 360./real(imo) *real(j-1) + lon(j) = 360.d0/real(imo,8) *real(j-1,8) enddo wrt_int_state%lonstart = lon(1) wrt_int_state%lonlast = lon(imo) do j=lbound(latPtr,2),ubound(latPtr,2) do i=lbound(lonPtr,1),ubound(lonPtr,1) - lonPtr(i,j) = 360./real(imo) * (i-1) + lonPtr(i,j) = 360.d0/real(imo,8) * real(i-1,8) latPtr(i,j) = lat(j) enddo enddo ! print *,'aft wrtgrd, Gaussian, dimi,i=',lbound(lonPtr,1),ubound(lonPtr,1), & ! ' j=',lbound(lonPtr,2),ubound(lonPtr,2),'imo=',imo,'jmo=',jmo -! print *,'aft wrtgrd, lon=',lonPtr(lbound(lonPtr,1),lbound(lonPtr,2)), & +! if(wrt_int_state%mype==0) print *,'aft wrtgrd, lon=',lonPtr(1:5,1), & +! 'lat=',latPtr(1,1:5),'imo,jmo=',imo,jmo ! lonPtr(lbound(lonPtr,1),ubound(lonPtr,2)),'lat=',latPtr(lbound(lonPtr,1),lbound(lonPtr,2)), & ! latPtr(lbound(lonPtr,1),ubound(lonPtr,2)) wrt_int_state%lat_start = lbound(latPtr,2) @@ -1622,13 +1623,14 @@ subroutine recover_fields(file_bundle,rc) character(100) fieldName,uwindname,vwindname type(ESMF_Field), allocatable :: fcstField(:) real(ESMF_KIND_R8), dimension(:,:), pointer :: lon, lat + real(ESMF_KIND_R8), dimension(:,:), pointer :: lonloc, latloc real(ESMF_KIND_R4), dimension(:,:), pointer :: pressfc real(ESMF_KIND_R4), dimension(:,:), pointer :: uwind2dr4,vwind2dr4 real(ESMF_KIND_R4), dimension(:,:,:), pointer :: uwind3dr4,vwind3dr4 real(ESMF_KIND_R4), dimension(:,:,:), pointer :: cart3dPtr2dr4 real(ESMF_KIND_R4), dimension(:,:,:,:), pointer :: cart3dPtr3dr4 real(ESMF_KIND_R8), dimension(:,:,:,:), pointer :: cart3dPtr3dr8 - save lon, lat + save lonloc, latloc real(ESMF_KIND_R8) :: coslon, sinlon, sinlat ! ! get filed count @@ -1648,9 +1650,18 @@ subroutine recover_fields(file_bundle,rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return - lon = lon * pi/180. -! print *,'in 3DCartesian2wind, lon dim=',lbound(lon,1),ubound(lon,1),lbound(lon,2),ubound(lon,2), & -! 'lon=',lon(lbound(lon,1),lbound(lon,2)), lon(ubound(lon,1),ubound(lon,2)) + allocate(lonloc(lbound(lon,1):ubound(lon,1),lbound(lon,2):ubound(lon,2))) + istart = lbound(lon,1) + iend = ubound(lon,1) + jstart = lbound(lon,2) + jend = ubound(lon,2) +!$omp parallel do default(none) shared(lon,lonloc,jstart,jend,istart,iend) & +!$omp private(i,j) + do j=jstart,jend + do i=istart,iend + lonloc(i,j) = lon(i,j) * pi/180. + enddo + enddo CALL ESMF_LogWrite("call recover field get coord 2",ESMF_LOGMSG_INFO,rc=RC) @@ -1658,9 +1669,18 @@ subroutine recover_fields(file_bundle,rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return - lat = lat * pi/180. -! print *,'in 3DCartesian2wind, lat dim=',lbound(lat,1),ubound(lat,1),lbound(lat,2),ubound(lat,2), & -! 'lat=',lat(lbound(lon,1),lbound(lon,2)), lat(ubound(lon,1),ubound(lon,2)) + allocate(latloc(lbound(lat,1):ubound(lat,1),lbound(lat,2):ubound(lat,2))) + istart = lbound(lat,1) + iend = ubound(lat,1) + jstart = lbound(lat,2) + jend = ubound(lat,2) +!$omp parallel do default(none) shared(lat,latloc,jstart,jend,istart,iend) & +!$omp private(i,j) + do j=jstart,jend + do i=istart,iend + latloc(i,j) = lat(i,j) * pi/180.d0 + enddo + enddo first_getlatlon = .false. endif ! @@ -1718,18 +1738,18 @@ subroutine recover_fields(file_bundle,rc) ! update u , v wind !$omp parallel do default(shared) private(i,j,k,coslon,sinlon,sinlat) do k=kstart,kend -!!$omp parallel do default(none) shared(uwind3dr4,vwind3dr4,lon,lat,cart3dPtr3dr4,jstart,jend,istart,iend,k) & -!!$omp private(i,j,coslon,sinlon,sinlat) +!$omp parallel do default(none) shared(uwind3dr4,vwind3dr4,lonloc,latloc,cart3dPtr3dr4,jstart,jend,istart,iend,k) & +!$omp private(i,j,coslon,sinlon,sinlat) do j=jstart, jend do i=istart, iend - coslon = cos(lon(i,j)) - sinlon = sin(lon(i,j)) - sinlat = sin(lat(i,j)) + coslon = cos(lonloc(i,j)) + sinlon = sin(lonloc(i,j)) + sinlat = sin(latloc(i,j)) uwind3dr4(i,j,k) = cart3dPtr3dr4(1,i,j,k) * coslon & + cart3dPtr3dr4(2,i,j,k) * sinlon vwind3dr4(i,j,k) =-cart3dPtr3dr4(1,i,j,k) * sinlat*sinlon & + cart3dPtr3dr4(2,i,j,k) * sinlat*coslon & - + cart3dPtr3dr4(3,i,j,k) * cos(lat(i,j)) + + cart3dPtr3dr4(3,i,j,k) * cos(latloc(i,j)) enddo enddo enddo @@ -1749,18 +1769,18 @@ subroutine recover_fields(file_bundle,rc) call ESMF_FieldGet(ufield, localDe=0, farrayPtr=uwind2dr4,rc=rc) call ESMF_FieldGet(vfield, localDe=0, farrayPtr=vwind2dr4,rc=rc) ! update u , v wind -!$omp parallel do default(none) shared(uwind2dr4,vwind2dr4,lon,lat,cart3dPtr2dr4,jstart,jend,istart,iend) & +!$omp parallel do default(none) shared(uwind2dr4,vwind2dr4,lonloc,latloc,cart3dPtr2dr4,jstart,jend,istart,iend) & !$omp private(i,j,k,coslon,sinlon,sinlat) do j=jstart, jend do i=istart, iend - coslon = cos(lon(i,j)) - sinlon = sin(lon(i,j)) - sinlat = sin(lat(i,j)) + coslon = cos(lonloc(i,j)) + sinlon = sin(lonloc(i,j)) + sinlat = sin(latloc(i,j)) uwind2dr4(i,j) = cart3dPtr2dr4(1,i,j) * coslon & + cart3dPtr2dr4(2,i,j) * sinlon vwind2dr4(i,j) =-cart3dPtr2dr4(1,i,j) * sinlat*sinlon & + cart3dPtr2dr4(2,i,j) * sinlat*coslon & - + cart3dPtr2dr4(3,i,j) * cos(lat(i,j)) + + cart3dPtr2dr4(3,i,j) * cos(latloc(i,j)) enddo enddo endif diff --git a/io/post_gfs.F90 b/io/post_gfs.F90 index 98d4fef50..daa6551bd 100644 --- a/io/post_gfs.F90 +++ b/io/post_gfs.F90 @@ -1146,7 +1146,7 @@ subroutine set_postvars_gfs(wrt_int_state,mpicomp,setvar_atmfile, & do i=ista, iend if (arrayr42d(i,j) /= spval) then !set range within (0,1) - sr(i,j) = min(1.,max(0.,sr(i,j))) + sr(i,j) = min(1.,max(0.,arrayr42d(i,j))) else sr(i,j) = spval endif @@ -2295,7 +2295,6 @@ subroutine set_postvars_gfs(wrt_int_state,mpicomp,setvar_atmfile, & do j=jsta,jend do i=1,im omga(i,j,l) = (-1.) * wh(i,j,l) * dpres(i,j,l)/zint(i,j,l) - pmid(i,j,l) = rgas*dpres(i,j,l) * t(i,j,l)*(q(i,j,l)*fv+1.0)/grav/zint(i,j,l) zint(i,j,l) = zint(i,j,l) + zint(i,j,l+1) enddo enddo @@ -2318,6 +2317,15 @@ subroutine set_postvars_gfs(wrt_int_state,mpicomp,setvar_atmfile, & enddo end do +!compute pmid from averaged two layer pint + do l=lm,1,-1 + do j=jsta,jend + do i=1,im + pmid(i,j,l) = 0.5*(pint(i,j,l)+pint(i,j,l+1)) + enddo + enddo + enddo + !$omp parallel do private(i,j) do j=jsta,jend do i=1,im @@ -2337,7 +2345,7 @@ subroutine set_postvars_gfs(wrt_int_state,mpicomp,setvar_atmfile, & end do end do -! compute zmid ??? where is definition of alpint(1) +! compute zmid do l=lm,1,-1 !$omp parallel do private(i,j) do j=jsta,jend From d257b2a9b9d2b386441ea2deba5acb944cf19a3b Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Mon, 27 Jan 2020 09:53:16 -0700 Subject: [PATCH 6/7] Update .gitmodules for code review and testing --- .gitmodules | 12 ++++++------ ccpp/physics | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.gitmodules b/.gitmodules index d4b7cd2e0..c2b56985c 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,12 +1,12 @@ [submodule "atmos_cubed_sphere"] path = atmos_cubed_sphere - url = https://github.com/noaa-gsd/GFDL_atmos_cubed_sphere - branch = gsd/develop + url = https://github.com/climbfuji/GFDL_atmos_cubed_sphere + branch = update_dtc_develop_from_dev-emc [submodule "ccpp/framework"] path = ccpp/framework - url = https://github.com/noaa-gsd/ccpp-framework - branch = gsd/develop + url = https://github.com/climbfuji/ccpp-framework + branch = update_dtc_develop_from_master [submodule "ccpp/physics"] path = ccpp/physics - url = https://github.com/noaa-gsd/ccpp-physics - branch = gsd/develop + url = https://github.com/climbfuji/ccpp-physics + branch = update_dtc_develop_from_master diff --git a/ccpp/physics b/ccpp/physics index 6c9e614a8..3449dd57f 160000 --- a/ccpp/physics +++ b/ccpp/physics @@ -1 +1 @@ -Subproject commit 6c9e614a8cd2eddf17c4a3b34e6f82de9048f82b +Subproject commit 3449dd57f0f678324c4d73e5ed883a088fbb1d34 From 1e0619f86d506d4fb5bc29251d7b480c57fc67c2 Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Thu, 30 Jan 2020 08:54:43 -0700 Subject: [PATCH 7/7] Revert change to .gitmodules, update submodule pointers --- .gitmodules | 12 ++++++------ atmos_cubed_sphere | 2 +- ccpp/framework | 2 +- ccpp/physics | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.gitmodules b/.gitmodules index c2b56985c..bdc0ffbf1 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,12 +1,12 @@ [submodule "atmos_cubed_sphere"] path = atmos_cubed_sphere - url = https://github.com/climbfuji/GFDL_atmos_cubed_sphere - branch = update_dtc_develop_from_dev-emc + url = https://github.com/NOAA-GSD/GFDL_atmos_cubed_sphere + branch = gsd/develop [submodule "ccpp/framework"] path = ccpp/framework - url = https://github.com/climbfuji/ccpp-framework - branch = update_dtc_develop_from_master + url = https://github.com/NOAA-GSD/ccpp-framework + branch = gsd/develop [submodule "ccpp/physics"] path = ccpp/physics - url = https://github.com/climbfuji/ccpp-physics - branch = update_dtc_develop_from_master + url = https://github.com/NOAA-GSD/ccpp-physics + branch = gsd/develop diff --git a/atmos_cubed_sphere b/atmos_cubed_sphere index ee15b812f..e53a24be1 160000 --- a/atmos_cubed_sphere +++ b/atmos_cubed_sphere @@ -1 +1 @@ -Subproject commit ee15b812f7273a1dfbbc30356a60b7835450f470 +Subproject commit e53a24be1bee834a14f5f85ef5d8d18f431d6b16 diff --git a/ccpp/framework b/ccpp/framework index 21019f892..60b4cc785 160000 --- a/ccpp/framework +++ b/ccpp/framework @@ -1 +1 @@ -Subproject commit 21019f892caf771846bf99f66d7c1cdaf56038ae +Subproject commit 60b4cc785cd6ddc5151fb61f3c24e657d71db451 diff --git a/ccpp/physics b/ccpp/physics index 3449dd57f..a779ea8f2 160000 --- a/ccpp/physics +++ b/ccpp/physics @@ -1 +1 @@ -Subproject commit 3449dd57f0f678324c4d73e5ed883a088fbb1d34 +Subproject commit a779ea8f2c53052cf854c12b0264a4b7e429ac4d