diff --git a/.gitignore b/.gitignore
new file mode 100644
index 00000000..7277eaf5
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,59 @@
+*~
+*.o
+*.mod
+*.s
+*.out
+pathnames*
+/*.zip
+/*.tar.gz
+
+Makefile
+# From https://github.com/github/gitignore/blob/master/Autotools.gitignore
+# http://www.gnu.org/software/automake
+Makefile.in
+/ar-lib
+/mdate-sh
+/py-compile
+/test-driver
+/tap-driver.sh
+/ylwrap
+*.log
+*.trs
+
+# http://www.gnu.org/software/autoconf
+autom4te.cache
+/autoscan.log
+/autoscan-*.log
+/aclocal.m4
+/compile
+/config.guess
+/config.h.in
+/config.log
+/config.status
+/config.sub
+/configure
+/configure.scan
+/depcomp
+/install-sh
+/missing
+/stamp-h1
+.deps
+
+# https://www.gnu.org/software/libtool/
+libtool
+/ltmain.sh
+*.lo
+*.la
+.libs
+
+# http://www.gnu.org/software/texinfo
+/texinfo.tex
+
+# http://www.gnu.org/software/m4/
+m4/libtool.m4
+m4/ltoptions.m4
+m4/ltsugar.m4
+m4/ltversion.m4
+m4/lt~obsolete.m4
+
+.dirstamp
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644
index 00000000..322c3d42
--- /dev/null
+++ b/.gitlab-ci.yml
@@ -0,0 +1,43 @@
+before_script:
+ - hostname
+
+
+.ncrc_build: &ncrc_build
+ script:
+ - source /opt/cray/pe/modules/default/init/bash
+ - module rm cray-netcdf cray-hdf5 PrgEnv-intel PrgEnv-pgi PrgEnv-gnu PrgEnv-cray
+ - module load PrgEnv-${COMPILER_FAMILY}
+ - module swap ${COMPILER_NAME} ${COMPILER_NAME}/${COMPILER_VERSION}
+ - module load cray-hdf5 cray-netcdf
+ - mkdir local
+ - git clone https://github.com/NOAA-GFDL/FMS.git FMS
+ - cd FMS
+ - autoreconf --install
+ - ./configure --prefix=${CI_BUILDS_DIR}/local
+ - make
+ - make install
+ - cd ..
+ - autoreconf --install
+ - ./configure
+ - make
+
+
+build:ncrc:intel19:debug:
+ stage: build
+ tags:
+ - ncrc
+ variables:
+ CC: cc
+ COMPILER_FAMILY: intel
+ COMPILER_NAME: intel
+ COMPILER_VERSION: 19.0.5.281
+ FC: ftn
+ F77: ftn
+ FCFLAGS: "-I${CI_BUILDS_DIR}/local/include -O0"
+ FFLAGS: "-I${CI_BUILDS_DIR}/local/include -O0"
+ LDFLAGS: "-L${CI_BUILDS_DIR}/local/lib"
+ <<: *ncrc_build
+ artifacts:
+ paths:
+ - .libs/libatmos_phys.so
+ - ./*.mod
diff --git a/Makefile.am b/Makefile.am
new file mode 100644
index 00000000..b51234f8
--- /dev/null
+++ b/Makefile.am
@@ -0,0 +1,2118 @@
+ACLOCAL_AMFLAGS = -I m4
+AM_CPPFLAGS = -I${top_srcdir}/atmos_param/cosp -DCLUBB -DINTERNAL_FILE_NML
+
+lib_LTLIBRARIES = libatmos_phys.la
+libatmos_phys_la_SOURCES = ${top_srcdir}/atmos_shared/atmos_nudge/atmos_nudge.F90 \
+ ${top_srcdir}/atmos_shared/atmos_cmip_diag/atmos_global_diag.F90 \
+ ${top_srcdir}/atmos_shared/atmos_cmip_diag/atmos_cmip_diag.F90 \
+ ${top_srcdir}/atmos_shared/vert_advection/vert_advection.F90 \
+ ${top_srcdir}/atmos_shared/aerosol/aerosol.F90 \
+ ${top_srcdir}/atmos_shared/aerosol/aerosol_types.F90 \
+ ${top_srcdir}/atmos_shared/tracer_driver/atmos_convection_tracer.F90 \
+ ${top_srcdir}/atmos_shared/tracer_driver/atmos_sulfur_hex.F90 \
+ ${top_srcdir}/atmos_shared/tracer_driver/atmos_tracer_driver.F90 \
+ ${top_srcdir}/atmos_shared/tracer_driver/atmos_sea_salt.F90 \
+ ${top_srcdir}/atmos_shared/tracer_driver/atmos_tracer_utilities.F90 \
+ ${top_srcdir}/atmos_shared/tracer_driver/atmos_co2.F90 \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem_driver.F90 \
+ ${top_srcdir}/atmos_shared/tracer_driver/atmos_dust.F90 \
+ ${top_srcdir}/atmos_shared/tracer_driver/atmos_tropopause.F90 \
+ ${top_srcdir}/atmos_shared/tracer_driver/atmos_sulfate.F90 \
+ ${top_srcdir}/atmos_shared/tracer_driver/atmos_radon.F90 \
+ ${top_srcdir}/atmos_shared/tracer_driver/atmos_nh3_tag.F90 \
+ ${top_srcdir}/atmos_shared/tracer_driver/atmos_soa.F90 \
+ ${top_srcdir}/atmos_shared/tracer_driver/atmos_ch4.F90 \
+ ${top_srcdir}/atmos_shared/tracer_driver/atmos_regional_tracer_driver.F90 \
+ ${top_srcdir}/atmos_shared/tracer_driver/cloud_chem.F90 \
+ ${top_srcdir}/atmos_shared/tracer_driver/atmos_age_tracer.F90 \
+ ${top_srcdir}/atmos_shared/tracer_driver/mo_setsox.F90 \
+ ${top_srcdir}/atmos_shared/tracer_driver/atmos_ch3i.F90 \
+ ${top_srcdir}/atmos_shared/tracer_driver/xactive_bvoc.F90 \
+ ${top_srcdir}/atmos_shared/tracer_driver/atmos_carbon_aerosol.F90 \
+ ${top_srcdir}/atmos_shared/tracer_driver/stratchem/strat_chem_model.F90 \
+ ${top_srcdir}/atmos_shared/tracer_driver/stratchem/strat_chem_driver.F90 \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/mo_chemini.F90 \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/mo_jpl.F90 \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/mo_exp_slv.F90 \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/mo_chem_utls.F90 \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/tropchem_types_mod.F90 \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/mo_usrrxt.F90 \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/mo_photo.F90 \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/aerosol_thermodynamics.F90 \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/mo_chemdr.F90 \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/strat_chem_utilities.F90 \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/mo_imp_slv.F90 \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/isoropiaIIcode.F \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/mo_hook.F90 \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/mo_setinv.F90 \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/mo_rodas_slv.F90 \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/mo_read_sim_chm.F90 \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/m_tracname.F90 \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM3_chem/AM3.mods.F90 \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM3_chem/AM3_fphoto.F90 \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM3_chem/AM3_fastjx.F90 \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM3_chem/AM3.subs.F90 \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM3_chem/AM3.mat.F90 \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM4_chem/moz.mods.F90 \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM4_chem/mo_fphoto.F90 \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM4_chem/moz.mat.F90 \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM4_chem/moz.subs.F90 \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM4_chem/mo_fastjx.F90 \
+ ${top_srcdir}/atmos_shared/tracer_driver/aer_ccn_act/aer_ccn_act.F90 \
+ ${top_srcdir}/atmos_shared/tracer_driver/aer_ccn_act/aer_in_act.F90 \
+ ${top_srcdir}/atmos_shared/tracer_driver/aer_ccn_act/aer_ccn_act_k.F90 \
+ ${top_srcdir}/atmos_shared/tracer_driver/aer_ccn_act/ice_nucl.F90 \
+ ${top_srcdir}/atmos_shared/tracer_driver/aer_ccn_act/aerosol_params.F90 \
+ ${top_srcdir}/atmos_param/physics_driver/physics_types.F90 \
+ ${top_srcdir}/atmos_param/physics_driver/physics_driver.F90 \
+ ${top_srcdir}/atmos_param/diag_cloud/diag_cloud.F90 \
+ ${top_srcdir}/atmos_param/grey_radiation/grey_radiation.F90 \
+ ${top_srcdir}/atmos_param/diffusivity/diffusivity.F90 \
+ ${top_srcdir}/atmos_param/topo_drag/topo_drag.F90 \
+ ${top_srcdir}/atmos_param/macrophysics/ls_cloud_macrophysics.F90 \
+ ${top_srcdir}/atmos_param/macrophysics/tiedtke_macro.F90 \
+ ${top_srcdir}/atmos_param/moist_conv/moist_conv.F90 \
+ ${top_srcdir}/atmos_param/radiation/clouds/cloudrad_types.F90 \
+ ${top_srcdir}/atmos_param/radiation/clouds/microphys_rad.F90 \
+ ${top_srcdir}/atmos_param/radiation/clouds/strat_clouds_W.F90 \
+ ${top_srcdir}/atmos_param/radiation/clouds/isccp_clouds.F90 \
+ ${top_srcdir}/atmos_param/radiation/clouds/get_random_number_stream.F90 \
+ ${top_srcdir}/atmos_param/radiation/clouds/bulkphys_rad.F90 \
+ ${top_srcdir}/atmos_param/radiation/clouds/uw_clouds_W.F90 \
+ ${top_srcdir}/atmos_param/radiation/clouds/cloudrad_driver.F90 \
+ ${top_srcdir}/atmos_param/radiation/clouds/cloud_spec.F90 \
+ ${top_srcdir}/atmos_param/radiation/clouds/donner_deep_clouds_W.F90 \
+ ${top_srcdir}/atmos_param/radiation/clouds/cloudrad_diagnostics.F90 \
+ ${top_srcdir}/atmos_param/radiation/clouds/cloudrad_package.F90 \
+ ${top_srcdir}/atmos_param/radiation/longwave/longwave_tables.F90 \
+ ${top_srcdir}/atmos_param/radiation/longwave/longwave_clouds.F90 \
+ ${top_srcdir}/atmos_param/radiation/longwave/gas_tf.F90 \
+ ${top_srcdir}/atmos_param/radiation/longwave/longwave_params.F90 \
+ ${top_srcdir}/atmos_param/radiation/longwave/sealw99.F90 \
+ ${top_srcdir}/atmos_param/radiation/longwave/optical_path.F90 \
+ ${top_srcdir}/atmos_param/radiation/longwave/longwave_types.F90 \
+ ${top_srcdir}/atmos_param/radiation/longwave/longwave_utilities.F90 \
+ ${top_srcdir}/atmos_param/radiation/longwave/longwave_fluxes.F90 \
+ ${top_srcdir}/atmos_param/radiation/longwave/lw_gases_stdtf.F90 \
+ ${top_srcdir}/atmos_param/radiation/aerosols/aerosolrad_types.F90 \
+ ${top_srcdir}/atmos_param/radiation/aerosols/aerosolrad_package.F90 \
+ ${top_srcdir}/atmos_param/radiation/aerosols/aerosolrad_driver.F90 \
+ ${top_srcdir}/atmos_param/radiation/shortwave/esfsw_driver.F90 \
+ ${top_srcdir}/atmos_param/radiation/shortwave/esfsw_utilities.F90 \
+ ${top_srcdir}/atmos_param/radiation/shortwave/shortwave_types.F90 \
+ ${top_srcdir}/atmos_param/radiation/shortwave/esfsw_bands.F90 \
+ ${top_srcdir}/atmos_param/radiation/shortwave/esfsw_parameters.F90 \
+ ${top_srcdir}/atmos_param/radiation/radiative_gases/radiative_gases.F90 \
+ ${top_srcdir}/atmos_param/radiation/radiative_gases/radiative_gases_types.F90 \
+ ${top_srcdir}/atmos_param/radiation/radiative_gases/ozone.F90 \
+ ${top_srcdir}/atmos_param/radiation/util/radiation_diag.F90 \
+ ${top_srcdir}/atmos_param/radiation/driver/longwave_driver.F90 \
+ ${top_srcdir}/atmos_param/radiation/driver/rad_output_file.F90 \
+ ${top_srcdir}/atmos_param/radiation/driver/radiation_driver_types.F90 \
+ ${top_srcdir}/atmos_param/radiation/driver/radiation_types.F90 \
+ ${top_srcdir}/atmos_param/radiation/driver/solar_data_driver.F90 \
+ ${top_srcdir}/atmos_param/radiation/driver/shortwave_driver.F90 \
+ ${top_srcdir}/atmos_param/radiation/driver/radiation_driver_diag.F90 \
+ ${top_srcdir}/atmos_param/radiation/driver/radiation_driver.F90 \
+ ${top_srcdir}/atmos_param/edt/edt.F90 \
+ ${top_srcdir}/atmos_param/convection_driver/convection_utilities.F90 \
+ ${top_srcdir}/atmos_param/convection_driver/detr_ice_num.F90 \
+ ${top_srcdir}/atmos_param/convection_driver/convection_driver.F90 \
+ ${top_srcdir}/atmos_param/physics_radiation_exch/physics_radiation_exch.F90 \
+ ${top_srcdir}/atmos_param/cloud_generator/betaDistribution.F90 \
+ ${top_srcdir}/atmos_param/cloud_generator/cloud_generator.F90 \
+ ${top_srcdir}/atmos_param/qe_moist_convection/qe_moist_convection.F90 \
+ ${top_srcdir}/atmos_param/lscloud_driver/lscloud_debug.F90 \
+ ${top_srcdir}/atmos_param/lscloud_driver/lscloud_constants.F90 \
+ ${top_srcdir}/atmos_param/lscloud_driver/lscloud_netcdf.F90 \
+ ${top_srcdir}/atmos_param/lscloud_driver/lscloud_types.F90 \
+ ${top_srcdir}/atmos_param/lscloud_driver/lscloud_driver.F90 \
+ ${top_srcdir}/atmos_param/lscloud_driver/polysvp.F90 \
+ ${top_srcdir}/atmos_param/lscloud_driver/check_nan.F90 \
+ ${top_srcdir}/atmos_param/shallow_conv/shallow_conv.F90 \
+ ${top_srcdir}/atmos_param/stable_bl_turb/stable_bl_turb.F90 \
+ ${top_srcdir}/atmos_param/microphysics/morrison_gettelman_microp.F90 \
+ ${top_srcdir}/atmos_param/microphysics/gamma_mg.F90 \
+ ${top_srcdir}/atmos_param/microphysics/micro_mg.F90 \
+ ${top_srcdir}/atmos_param/microphysics/rotstayn_klein_mp.F90 \
+ ${top_srcdir}/atmos_param/microphysics/ls_cloud_microphysics.F90 \
+ ${top_srcdir}/atmos_param/microphysics/simple_pdf.F90 \
+ ${top_srcdir}/atmos_param/microphysics/cldwat2m_micro.F90 \
+ ${top_srcdir}/atmos_param/clouds/clouds.F90 \
+ ${top_srcdir}/atmos_param/lin_cloud_microphys/lin_cloud_microphys.F90 \
+ ${top_srcdir}/atmos_param/cloud_obs/cloud_obs.F90 \
+ ${top_srcdir}/atmos_param/diag_cloud_rad/diag_cloud_rad.F90 \
+ ${top_srcdir}/atmos_param/damping_driver/damping_driver.F90 \
+ ${top_srcdir}/atmos_param/shallow_physics/shallow_physics.F90 \
+ ${top_srcdir}/atmos_param/vert_diff_driver/vert_diff_driver.F90 \
+ ${top_srcdir}/atmos_param/moist_processes/moist_processes.F90 \
+ ${top_srcdir}/atmos_param/moist_processes/moist_processes_utils.F90 \
+ ${top_srcdir}/atmos_param/strat_cloud/strat_cloud.F90 \
+ ${top_srcdir}/atmos_param/my25_turb/my25_turb.F90 \
+ ${top_srcdir}/atmos_param/cosp/cosp_modis_simulator.F90 \
+ ${top_srcdir}/atmos_param/cosp/cosp_driver.F90 \
+ ${top_srcdir}/atmos_param/cosp/cosp_misr_simulator.F90 \
+ ${top_srcdir}/atmos_param/cosp/cosp_stats.F90 \
+ ${top_srcdir}/atmos_param/cosp/cosp_utils.F90 \
+ ${top_srcdir}/atmos_param/cosp/cosp_types.F90 \
+ ${top_srcdir}/atmos_param/cosp/cosp_rttov_simulator.F90 \
+ ${top_srcdir}/atmos_param/cosp/cosp_isccp_simulator.F90 \
+ ${top_srcdir}/atmos_param/cosp/cosp.F90 \
+ ${top_srcdir}/atmos_param/cosp/cosp_constants.F90 \
+ ${top_srcdir}/atmos_param/cosp/cosp_diagnostics.F90 \
+ ${top_srcdir}/atmos_param/cosp/cosp_simulator.F90 \
+ ${top_srcdir}/atmos_param/cosp/cosp_lidar.F90 \
+ ${top_srcdir}/atmos_param/cosp/cosp_io.F90 \
+ ${top_srcdir}/atmos_param/cosp/actsim/lidar_simulator.F90 \
+ ${top_srcdir}/atmos_param/cosp/actsim/lmd_ipsl_stats.F90 \
+ ${top_srcdir}/atmos_param/cosp/MISR_simulator/MISR_simulator.F \
+ ${top_srcdir}/atmos_param/cosp/quickbeam/radar_simulator_types.F90 \
+ ${top_srcdir}/atmos_param/cosp/quickbeam/array_lib.F90 \
+ ${top_srcdir}/atmos_param/cosp/quickbeam/dsd.F90 \
+ ${top_srcdir}/atmos_param/cosp/quickbeam/optics_lib.F90 \
+ ${top_srcdir}/atmos_param/cosp/quickbeam/gases.F90 \
+ ${top_srcdir}/atmos_param/cosp/quickbeam/format_input.F90 \
+ ${top_srcdir}/atmos_param/cosp/quickbeam/mrgrnk.F90 \
+ ${top_srcdir}/atmos_param/cosp/quickbeam/radar_simulator.F90 \
+ ${top_srcdir}/atmos_param/cosp/quickbeam/scale_LUTs_io.F90 \
+ ${top_srcdir}/atmos_param/cosp/quickbeam/zeff.F90 \
+ ${top_srcdir}/atmos_param/cosp/quickbeam/atmos_lib.F90 \
+ ${top_srcdir}/atmos_param/cosp/quickbeam/calc_Re.F90 \
+ ${top_srcdir}/atmos_param/cosp/quickbeam/radar_simulator_init.F90 \
+ ${top_srcdir}/atmos_param/cosp/quickbeam/math_lib.F90 \
+ ${top_srcdir}/atmos_param/cosp/llnl/prec_scops.F \
+ ${top_srcdir}/atmos_param/cosp/llnl/cosp_radar.F90 \
+ ${top_srcdir}/atmos_param/cosp/llnl/llnl_stats.F90 \
+ ${top_srcdir}/atmos_param/cosp/llnl/pf_to_mr.F \
+ ${top_srcdir}/atmos_param/cosp/icarus-scops-3.7/icarus.F90 \
+ ${top_srcdir}/atmos_param/cosp/icarus-scops-3.7/scops.F \
+ ${top_srcdir}/atmos_param/cosp/icarus-scops-3.7/isccp_cloud_types.F \
+ ${top_srcdir}/atmos_param/cosp/MODIS_simulator/modis_simulator.F90 \
+ ${top_srcdir}/atmos_param/lscale_cond/lscale_cond.F90 \
+ ${top_srcdir}/atmos_param/entrain/entrain.F90 \
+ ${top_srcdir}/atmos_param/cg_drag/cg_drag.F90 \
+ ${top_srcdir}/atmos_param/cu_mo_trans/cu_mo_trans.F90 \
+ ${top_srcdir}/atmos_param/cloud_rad/cloud_rad.F90 \
+ ${top_srcdir}/atmos_param/betts_miller/bm_omp.F90 \
+ ${top_srcdir}/atmos_param/betts_miller/betts_miller.F90 \
+ ${top_srcdir}/atmos_param/betts_miller/bm_massflux.F90 \
+ ${top_srcdir}/atmos_param/vert_diff/vert_diff.F90 \
+ ${top_srcdir}/atmos_param/two_stream_gray_rad/two_stream_gray_rad.F90 \
+ ${top_srcdir}/atmos_param/aerosol_cloud/aerosol_cloud.F90 \
+ ${top_srcdir}/atmos_param/rh_clouds/rh_clouds.F90 \
+ ${top_srcdir}/atmos_param/cloud_zonal/cloud_zonal.F90 \
+ ${top_srcdir}/atmos_param/donner_deep/donner_deep.F90 \
+ ${top_srcdir}/atmos_param/donner_deep/donner_deep_k.F90 \
+ ${top_srcdir}/atmos_param/donner_deep/donner_deep_miz.F90 \
+ ${top_srcdir}/atmos_param/donner_deep/donner_cape_k.F90 \
+ ${top_srcdir}/atmos_param/donner_deep/fms_donner.F90 \
+ ${top_srcdir}/atmos_param/donner_deep/nonfms_donner.F90 \
+ ${top_srcdir}/atmos_param/donner_deep/donner_utilities_k.F90 \
+ ${top_srcdir}/atmos_param/donner_deep/donner_meso_k.F90 \
+ ${top_srcdir}/atmos_param/donner_deep/donner_lite_k.F90 \
+ ${top_srcdir}/atmos_param/donner_deep/donner_rad_k.F90 \
+ ${top_srcdir}/atmos_param/donner_deep/donner_types.F90 \
+ ${top_srcdir}/atmos_param/donner_deep/donner_cloud_model_k.F90 \
+ ${top_srcdir}/atmos_param/donner_deep/donner_lscloud_k.F90 \
+ ${top_srcdir}/atmos_param/donner_deep/wet_deposition_0D.F90 \
+ ${top_srcdir}/atmos_param/donner_deep/cumulus_closure_k.F90 \
+ ${top_srcdir}/atmos_param/dry_adj/dry_adj.F90 \
+ ${top_srcdir}/atmos_param/tke_turb/tke_turb.F90 \
+ ${top_srcdir}/atmos_param/mg_drag/mg_drag.F90 \
+ ${top_srcdir}/atmos_param/clubb/alt_cloud.F90 \
+ ${top_srcdir}/atmos_param/clubb/advance_sclrm_Nd_module.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_3D_var.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_driver_SCM.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/stats_rad_zm.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/array_index.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/mono_flux_limiter.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/stats_variables.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/output_netcdf.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/T_in_K_module.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/error_code.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/variables_prognostic_module.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/clip_explicit.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/hyper_diffusion_4th_ord.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/diffusion.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/stats_zm.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/mean_adv.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/advance_windm_edsclrm_module.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/parameters_microphys.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/clip_semi_implicit.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/output_grads.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/stat_file_module.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/parameters_tunable.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/pos_definite_module.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/advance_helper_module.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/stats_type.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/corr_matrix_module.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/clubb_precision.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/advance_xm_wpxp_module.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/lapack_wrap.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/numerical_check.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/input_reader.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/parameters_model.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/input_names.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/stats_LH_zt.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/stats_zt.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/parameters_radiation.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/stats_subs.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/csr_matrix_class_3array.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/fill_holes.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/stats_sfc.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/surface_varnce_module.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/file_functions.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/advance_xp2_xpyp_module.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/clubb_core.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/stats_rad_zt.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/constants_clubb.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/mixing_length.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/variables_radiation_module.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/Skw_module.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/extrapolation.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/matrix_operations.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/advance_wp2_wp3_module.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/pdf_closure_module.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/mt95.f90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/grid_class.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/gmres_cache.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/model_flags.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/endian.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/calendar.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/parameter_indices.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/pdf_parameter_module.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/sponge_layer_damping.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/sigma_sqd_w_module.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/gmres_wrap.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/anl_erf.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/interpolation.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/saturation.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/hydrostatic_module.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/variables_diagnostic_module.F90 \
+ ${top_srcdir}/atmos_param/vert_turb_driver/vert_turb_driver.F90 \
+ ${top_srcdir}/atmos_param/shallow_cu/conv_plumes_k.F90 \
+ ${top_srcdir}/atmos_param/shallow_cu/deep_conv.F90 \
+ ${top_srcdir}/atmos_param/shallow_cu/conv_closures.F90 \
+ ${top_srcdir}/atmos_param/shallow_cu/conv_plumes.F90 \
+ ${top_srcdir}/atmos_param/shallow_cu/conv_utilities_k.F90 \
+ ${top_srcdir}/atmos_param/shallow_cu/conv_utilities.F90 \
+ ${top_srcdir}/atmos_param/shallow_cu/uw_conv.F90 \
+ ${top_srcdir}/atmos_param/ras/ras.F90
+
+${top_builddir}/atmos_shared/atmos_nudge/atmos_nudge.lo: ${top_srcdir}/atmos_shared/atmos_nudge/atmos_nudge.F90
+${top_builddir}/atmos_shared/atmos_cmip_diag/atmos_global_diag.lo: ${top_srcdir}/atmos_shared/atmos_cmip_diag/atmos_global_diag.F90
+${top_builddir}/atmos_shared/atmos_cmip_diag/atmos_cmip_diag.lo: ${top_srcdir}/atmos_shared/atmos_cmip_diag/atmos_cmip_diag.F90
+${top_builddir}/atmos_shared/vert_advection/vert_advection.lo: ${top_srcdir}/atmos_shared/vert_advection/vert_advection.F90
+${top_builddir}/atmos_shared/aerosol/aerosol.lo: ${top_srcdir}/atmos_shared/aerosol/aerosol.F90 \
+ ${top_srcdir}/atmos_shared/aerosol/aerosol_types.lo
+${top_builddir}/atmos_shared/aerosol/aerosol_types.lo: ${top_srcdir}/atmos_shared/aerosol/aerosol_types.F90
+${top_builddir}/atmos_shared/tracer_driver/atmos_convection_tracer.lo: ${top_srcdir}/atmos_shared/tracer_driver/atmos_convection_tracer.F90 \
+ ${top_srcdir}/atmos_shared/tracer_driver/atmos_tracer_utilities.lo
+${top_builddir}/atmos_shared/tracer_driver/atmos_sulfur_hex.lo: ${top_srcdir}/atmos_shared/tracer_driver/atmos_sulfur_hex.F90 \
+ ${top_srcdir}/atmos_shared/tracer_driver/atmos_tracer_utilities.lo
+${top_builddir}/atmos_shared/tracer_driver/atmos_tracer_driver.lo: ${top_srcdir}/atmos_shared/tracer_driver/atmos_tracer_driver.F90 \
+ ${top_srcdir}/atmos_shared/atmos_cmip_diag/atmos_cmip_diag.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/atmos_tracer_utilities.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/atmos_radon.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/atmos_carbon_aerosol.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/atmos_convection_tracer.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/atmos_sulfur_hex.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/atmos_ch3i.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/atmos_sea_salt.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/atmos_dust.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/atmos_sulfate.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/atmos_soa.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/atmos_nh3_tag.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem_driver.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/atmos_regional_tracer_driver.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/stratchem/strat_chem_driver.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/atmos_age_tracer.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/atmos_co2.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/atmos_ch4.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/atmos_tropopause.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/xactive_bvoc.lo
+${top_builddir}/atmos_shared/tracer_driver/atmos_sea_salt.lo: ${top_srcdir}/atmos_shared/tracer_driver/atmos_sea_salt.F90 \
+ ${top_srcdir}/atmos_shared/atmos_cmip_diag/atmos_cmip_diag.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/atmos_tracer_utilities.lo
+${top_builddir}/atmos_shared/tracer_driver/atmos_tracer_utilities.lo: ${top_srcdir}/atmos_shared/tracer_driver/atmos_tracer_utilities.F90 \
+ ${top_srcdir}/atmos_shared/atmos_cmip_diag/atmos_cmip_diag.lo
+${top_builddir}/atmos_shared/tracer_driver/atmos_co2.lo: ${top_srcdir}/atmos_shared/tracer_driver/atmos_co2.F90
+${top_builddir}/atmos_shared/tracer_driver/tropchem_driver.lo: ${top_srcdir}/atmos_shared/tracer_driver/tropchem_driver.F90 \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/tropchem_types_mod.lo \
+ ${top_srcdir}/atmos_shared/atmos_cmip_diag/atmos_cmip_diag.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/atmos_tracer_utilities.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/mo_chemdr.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/mo_setsox.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/mo_chemini.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/m_tracname.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM4_chem/moz.mods.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM3_chem/AM3.mods.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/mo_hook.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/strat_chem_utilities.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/mo_chem_utls.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/atmos_sulfate.lo \
+ ${top_srcdir}/atmos_param/radiation/driver/shortwave_driver.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/cloud_chem.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/aerosol_thermodynamics.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/mo_usrrxt.lo
+${top_builddir}/atmos_shared/tracer_driver/atmos_dust.lo: ${top_srcdir}/atmos_shared/tracer_driver/atmos_dust.F90 \
+ ${top_srcdir}/atmos_shared/atmos_cmip_diag/atmos_cmip_diag.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/atmos_tracer_utilities.lo
+${top_builddir}/atmos_shared/tracer_driver/atmos_tropopause.lo: ${top_srcdir}/atmos_shared/tracer_driver/atmos_tropopause.F90 \
+ ${top_srcdir}/atmos_shared/atmos_cmip_diag/atmos_cmip_diag.lo
+${top_builddir}/atmos_shared/tracer_driver/atmos_sulfate.lo: ${top_srcdir}/atmos_shared/tracer_driver/atmos_sulfate.F90 \
+ ${top_srcdir}/atmos_shared/atmos_cmip_diag/atmos_cmip_diag.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/cloud_chem.lo
+${top_builddir}/atmos_shared/tracer_driver/atmos_radon.lo: ${top_srcdir}/atmos_shared/tracer_driver/atmos_radon.F90 \
+ ${top_srcdir}/atmos_shared/tracer_driver/atmos_tracer_utilities.lo
+${top_builddir}/atmos_shared/tracer_driver/atmos_nh3_tag.lo: ${top_srcdir}/atmos_shared/tracer_driver/atmos_nh3_tag.F90 \
+ ${top_srcdir}/atmos_shared/atmos_cmip_diag/atmos_cmip_diag.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/atmos_tracer_utilities.lo
+${top_builddir}/atmos_shared/tracer_driver/atmos_soa.lo: ${top_srcdir}/atmos_shared/tracer_driver/atmos_soa.F90 \
+ ${top_srcdir}/atmos_shared/atmos_cmip_diag/atmos_cmip_diag.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/xactive_bvoc.lo
+${top_builddir}/atmos_shared/tracer_driver/atmos_ch4.lo: ${top_srcdir}/atmos_shared/tracer_driver/atmos_ch4.F90
+${top_builddir}/atmos_shared/tracer_driver/atmos_regional_tracer_driver.lo: ${top_srcdir}/atmos_shared/tracer_driver/atmos_regional_tracer_driver.F90
+${top_builddir}/atmos_shared/tracer_driver/cloud_chem.lo: ${top_srcdir}/atmos_shared/tracer_driver/cloud_chem.F90
+${top_builddir}/atmos_shared/tracer_driver/atmos_age_tracer.lo: ${top_srcdir}/atmos_shared/tracer_driver/atmos_age_tracer.F90
+${top_builddir}/atmos_shared/tracer_driver/mo_setsox.lo: ${top_srcdir}/atmos_shared/tracer_driver/mo_setsox.F90 \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/mo_chem_utls.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/tropchem_types_mod.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/cloud_chem.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/aerosol_thermodynamics.lo
+${top_builddir}/atmos_shared/tracer_driver/atmos_ch3i.lo: ${top_srcdir}/atmos_shared/tracer_driver/atmos_ch3i.F90
+${top_builddir}/atmos_shared/tracer_driver/xactive_bvoc.lo: ${top_srcdir}/atmos_shared/tracer_driver/xactive_bvoc.F90 \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM4_chem/moz.mods.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/m_tracname.lo
+${top_builddir}/atmos_shared/tracer_driver/atmos_carbon_aerosol.lo: ${top_srcdir}/atmos_shared/tracer_driver/atmos_carbon_aerosol.F90 \
+ ${top_srcdir}/atmos_shared/atmos_cmip_diag/atmos_cmip_diag.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/atmos_tracer_utilities.lo
+${top_builddir}/atmos_shared/tracer_driver/stratchem/strat_chem_model.lo: ${top_srcdir}/atmos_shared/tracer_driver/stratchem/strat_chem_model.F90
+${top_builddir}/atmos_shared/tracer_driver/stratchem/strat_chem_driver.lo: ${top_srcdir}/atmos_shared/tracer_driver/stratchem/strat_chem_driver.F90 \
+ ${top_srcdir}/atmos_shared/tracer_driver/stratchem/strat_chem_model.lo
+${top_builddir}/atmos_shared/tracer_driver/tropchem/mo_chemini.lo: ${top_srcdir}/atmos_shared/tracer_driver/tropchem/mo_chemini.F90 \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/mo_photo.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/mo_chem_utls.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/mo_usrrxt.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM4_chem/moz.mods.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM3_chem/AM3.mods.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/mo_exp_slv.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/mo_imp_slv.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/mo_rodas_slv.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/mo_read_sim_chm.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM4_chem/mo_fphoto.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM3_chem/AM3_fphoto.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/tropchem_types_mod.lo
+${top_builddir}/atmos_shared/tracer_driver/tropchem/mo_jpl.lo: ${top_srcdir}/atmos_shared/tracer_driver/tropchem/mo_jpl.F90
+${top_builddir}/atmos_shared/tracer_driver/tropchem/mo_exp_slv.lo: ${top_srcdir}/atmos_shared/tracer_driver/tropchem/mo_exp_slv.F90 \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM4_chem/moz.mods.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM3_chem/AM3.mods.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/mo_chem_utls.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM4_chem/moz.mat.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM3_chem/AM3.mat.lo
+${top_builddir}/atmos_shared/tracer_driver/tropchem/mo_chem_utls.lo: ${top_srcdir}/atmos_shared/tracer_driver/tropchem/mo_chem_utls.F90 \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM4_chem/moz.mods.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM3_chem/AM3.mods.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/m_tracname.lo
+${top_builddir}/atmos_shared/tracer_driver/tropchem/tropchem_types_mod.lo: ${top_srcdir}/atmos_shared/tracer_driver/tropchem/tropchem_types_mod.F90
+${top_builddir}/atmos_shared/tracer_driver/tropchem/mo_usrrxt.lo: ${top_srcdir}/atmos_shared/tracer_driver/tropchem/mo_usrrxt.F90 \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/aerosol_thermodynamics.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/strat_chem_utilities.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/tropchem_types_mod.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/mo_chem_utls.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM4_chem/moz.mods.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM3_chem/AM3.mods.lo
+${top_builddir}/atmos_shared/tracer_driver/tropchem/mo_photo.lo: ${top_srcdir}/atmos_shared/tracer_driver/tropchem/mo_photo.F90 \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/mo_chem_utls.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM4_chem/moz.mods.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM3_chem/AM3.mods.lo
+${top_builddir}/atmos_shared/tracer_driver/tropchem/aerosol_thermodynamics.lo: ${top_srcdir}/atmos_shared/tracer_driver/tropchem/aerosol_thermodynamics.F90 \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/tropchem_types_mod.lo
+${top_builddir}/atmos_shared/tracer_driver/tropchem/mo_chemdr.lo: ${top_srcdir}/atmos_shared/tracer_driver/tropchem/mo_chemdr.F90 \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/tropchem_types_mod.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/mo_chem_utls.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM4_chem/moz.mods.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM3_chem/AM3.mods.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/mo_photo.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/mo_exp_slv.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/mo_imp_slv.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/mo_rodas_slv.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/mo_usrrxt.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/mo_setinv.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM4_chem/moz.subs.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM3_chem/AM3.subs.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/mo_setsox.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM4_chem/mo_fphoto.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM3_chem/AM3_fphoto.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/strat_chem_utilities.lo
+${top_builddir}/atmos_shared/tracer_driver/tropchem/strat_chem_utilities.lo: ${top_srcdir}/atmos_shared/tracer_driver/tropchem/strat_chem_utilities.F90
+${top_builddir}/atmos_shared/tracer_driver/tropchem/mo_imp_slv.lo: ${top_srcdir}/atmos_shared/tracer_driver/tropchem/mo_imp_slv.F90 \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM4_chem/moz.mods.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM3_chem/AM3.mods.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/mo_chem_utls.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/m_tracname.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM4_chem/moz.mat.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM3_chem/AM3.mat.lo
+${top_builddir}/atmos_shared/tracer_driver/tropchem/isoropiaIIcode.lo: ${top_srcdir}/atmos_shared/tracer_driver/tropchem/isoropiaIIcode.F
+${top_builddir}/atmos_shared/tracer_driver/tropchem/mo_hook.lo: ${top_srcdir}/atmos_shared/tracer_driver/tropchem/mo_hook.F90 \
+ ${top_srcdir}/atmos_shared/atmos_cmip_diag/atmos_cmip_diag.lo
+${top_builddir}/atmos_shared/tracer_driver/tropchem/mo_setinv.lo: ${top_srcdir}/atmos_shared/tracer_driver/tropchem/mo_setinv.F90
+${top_builddir}/atmos_shared/tracer_driver/tropchem/mo_rodas_slv.lo: ${top_srcdir}/atmos_shared/tracer_driver/tropchem/mo_rodas_slv.F90 \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM4_chem/moz.mods.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM3_chem/AM3.mods.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/mo_chem_utls.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM4_chem/moz.mat.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM3_chem/AM3.mat.lo
+${top_builddir}/atmos_shared/tracer_driver/tropchem/mo_read_sim_chm.lo: ${top_srcdir}/atmos_shared/tracer_driver/tropchem/mo_read_sim_chm.F90 \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM4_chem/moz.mods.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM3_chem/AM3.mods.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/m_tracname.lo
+${top_builddir}/atmos_shared/tracer_driver/tropchem/m_tracname.lo: ${top_srcdir}/atmos_shared/tracer_driver/tropchem/m_tracname.F90 \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM4_chem/moz.mods.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM3_chem/AM3.mods.lo
+${top_builddir}/atmos_shared/tracer_driver/tropchem/AM3_chem/AM3.mods.lo: ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM3_chem/AM3.mods.F90
+${top_builddir}/atmos_shared/tracer_driver/tropchem/AM3_chem/AM3_fphoto.lo: ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM3_chem/AM3_fphoto.F90 \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM3_chem/AM3_fastjx.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/mo_chem_utls.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM4_chem/moz.mods.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM3_chem/AM3.mods.lo
+${top_builddir}/atmos_shared/tracer_driver/tropchem/AM3_chem/AM3_fastjx.lo: ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM3_chem/AM3_fastjx.F90
+${top_builddir}/atmos_shared/tracer_driver/tropchem/AM3_chem/AM3.subs.lo: ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM3_chem/AM3.subs.F90 \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM3_chem/AM3.mods.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/mo_jpl.lo
+${top_builddir}/atmos_shared/tracer_driver/tropchem/AM3_chem/AM3.mat.lo: ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM3_chem/AM3.mat.F90 \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM3_chem/AM3.mods.lo
+${top_builddir}/atmos_shared/tracer_driver/tropchem/AM4_chem/moz.mods.lo: ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM4_chem/moz.mods.F90
+${top_builddir}/atmos_shared/tracer_driver/tropchem/AM4_chem/mo_fphoto.lo: ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM4_chem/mo_fphoto.F90 \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM4_chem/mo_fastjx.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/mo_chem_utls.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM4_chem/moz.mods.lo
+${top_builddir}/atmos_shared/tracer_driver/tropchem/AM4_chem/moz.mat.lo: ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM4_chem/moz.mat.F90 \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM4_chem/moz.mods.lo
+${top_builddir}/atmos_shared/tracer_driver/tropchem/AM4_chem/moz.subs.lo: ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM4_chem/moz.subs.F90 \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM4_chem/moz.mods.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/mo_jpl.lo
+${top_builddir}/atmos_shared/tracer_driver/tropchem/AM4_chem/mo_fastjx.lo: ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM4_chem/mo_fastjx.F90 \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/tropchem_types_mod.lo
+${top_builddir}/atmos_shared/tracer_driver/aer_ccn_act/aer_ccn_act.lo: ${top_srcdir}/atmos_shared/tracer_driver/aer_ccn_act/aer_ccn_act.F90 \
+ ${top_srcdir}/atmos_shared/tracer_driver/aer_ccn_act/aer_ccn_act_k.lo
+${top_builddir}/atmos_shared/tracer_driver/aer_ccn_act/aer_in_act.lo: ${top_srcdir}/atmos_shared/tracer_driver/aer_ccn_act/aer_in_act.F90
+${top_builddir}/atmos_shared/tracer_driver/aer_ccn_act/aer_ccn_act_k.lo: ${top_srcdir}/atmos_shared/tracer_driver/aer_ccn_act/aer_ccn_act_k.F90
+${top_builddir}/atmos_shared/tracer_driver/aer_ccn_act/ice_nucl.lo: ${top_srcdir}/atmos_shared/tracer_driver/aer_ccn_act/ice_nucl.F90 \
+ ${top_srcdir}/atmos_shared/tracer_driver/aer_ccn_act/aer_ccn_act_k.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/aer_ccn_act/aerosol_params.lo
+${top_builddir}/atmos_shared/tracer_driver/aer_ccn_act/aerosol_params.lo: ${top_srcdir}/atmos_shared/tracer_driver/aer_ccn_act/aerosol_params.F90
+${top_builddir}/atmos_param/physics_driver/physics_types.lo: ${top_srcdir}/atmos_param/physics_driver/physics_types.F90
+${top_builddir}/atmos_param/physics_driver/physics_driver.lo: ${top_srcdir}/atmos_param/physics_driver/physics_driver.F90 \
+ ${top_srcdir}/atmos_shared/tracer_driver/atmos_tracer_driver.lo \
+ ${top_srcdir}/atmos_shared/atmos_cmip_diag/atmos_cmip_diag.lo \
+ ${top_srcdir}/atmos_shared/aerosol/aerosol_types.lo \
+ ${top_srcdir}/atmos_param/physics_radiation_exch/physics_radiation_exch.lo \
+ ${top_srcdir}/atmos_param/physics_driver/physics_types.lo \
+ ${top_srcdir}/atmos_param/moist_processes/moist_processes_utils.lo \
+ ${top_srcdir}/atmos_shared/aerosol/aerosol.lo \
+ ${top_srcdir}/atmos_param/cosp/cosp_driver.lo \
+ ${top_srcdir}/atmos_param/moist_processes/moist_processes.lo \
+ ${top_srcdir}/atmos_param/vert_turb_driver/vert_turb_driver.lo \
+ ${top_srcdir}/atmos_param/vert_diff_driver/vert_diff_driver.lo \
+ ${top_srcdir}/atmos_param/damping_driver/damping_driver.lo \
+ ${top_srcdir}/atmos_param/grey_radiation/grey_radiation.lo
+${top_builddir}/atmos_param/diag_cloud/diag_cloud.lo: ${top_srcdir}/atmos_param/diag_cloud/diag_cloud.F90 \
+ ${top_srcdir}/atmos_param/cloud_zonal/cloud_zonal.lo \
+ ${top_srcdir}/atmos_param/diag_cloud_rad/diag_cloud_rad.lo \
+ ${top_srcdir}/atmos_param/shallow_conv/shallow_conv.lo
+${top_builddir}/atmos_param/grey_radiation/grey_radiation.lo: ${top_srcdir}/atmos_param/grey_radiation/grey_radiation.F90
+${top_builddir}/atmos_param/diffusivity/diffusivity.lo: ${top_srcdir}/atmos_param/diffusivity/diffusivity.F90
+${top_builddir}/atmos_param/topo_drag/topo_drag.lo: ${top_srcdir}/atmos_param/topo_drag/topo_drag.F90
+${top_builddir}/atmos_param/macrophysics/ls_cloud_macrophysics.lo: ${top_srcdir}/atmos_param/macrophysics/ls_cloud_macrophysics.F90 \
+ ${top_srcdir}/atmos_param/physics_driver/physics_types.lo \
+ ${top_srcdir}/atmos_param/macrophysics/tiedtke_macro.lo \
+ ${top_srcdir}/atmos_param/aerosol_cloud/aerosol_cloud.lo \
+ ${top_srcdir}/atmos_param/lscloud_driver/lscloud_types.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_driver_SCM.lo \
+ ${top_srcdir}/atmos_shared/aerosol/aerosol_types.lo \
+ ${top_srcdir}/atmos_param/moist_processes/moist_processes_utils.lo \
+ ${top_srcdir}/atmos_param/physics_radiation_exch/physics_radiation_exch.lo
+${top_builddir}/atmos_param/macrophysics/tiedtke_macro.lo: ${top_srcdir}/atmos_param/macrophysics/tiedtke_macro.F90 \
+ ${top_srcdir}/atmos_param/cloud_generator/betaDistribution.lo \
+ ${top_srcdir}/atmos_param/lscloud_driver/lscloud_types.lo \
+ ${top_srcdir}/atmos_param/lscloud_driver/lscloud_debug.lo \
+ ${top_srcdir}/atmos_param/lscloud_driver/polysvp.lo \
+ ${top_srcdir}/atmos_param/moist_processes/moist_processes_utils.lo \
+ ${top_srcdir}/atmos_param/physics_radiation_exch/physics_radiation_exch.lo
+${top_builddir}/atmos_param/moist_conv/moist_conv.lo: ${top_srcdir}/atmos_param/moist_conv/moist_conv.F90
+${top_builddir}/atmos_param/radiation/clouds/cloudrad_types.lo: ${top_srcdir}/atmos_param/radiation/clouds/cloudrad_types.F90
+${top_builddir}/atmos_param/radiation/clouds/microphys_rad.lo: ${top_srcdir}/atmos_param/radiation/clouds/microphys_rad.F90 \
+ ${top_srcdir}/atmos_param/radiation/clouds/cloudrad_types.lo \
+ ${top_srcdir}/atmos_param/radiation/longwave/sealw99.lo \
+ ${top_srcdir}/atmos_param/radiation/shortwave/esfsw_driver.lo
+${top_builddir}/atmos_param/radiation/clouds/strat_clouds_W.lo: ${top_srcdir}/atmos_param/radiation/clouds/strat_clouds_W.F90 \
+ ${top_srcdir}/atmos_shared/aerosol/aerosol_types.lo \
+ ${top_srcdir}/atmos_param/physics_radiation_exch/physics_radiation_exch.lo \
+ ${top_srcdir}/atmos_param/cloud_rad/cloud_rad.lo \
+ ${top_srcdir}/atmos_param/radiation/clouds/cloudrad_types.lo \
+ ${top_srcdir}/atmos_param/radiation/clouds/get_random_number_stream.lo \
+ ${top_srcdir}/atmos_param/cloud_generator/cloud_generator.lo
+${top_builddir}/atmos_param/radiation/clouds/isccp_clouds.lo: ${top_srcdir}/atmos_param/radiation/clouds/isccp_clouds.F90
+${top_builddir}/atmos_param/radiation/clouds/get_random_number_stream.lo: ${top_srcdir}/atmos_param/radiation/clouds/get_random_number_stream.F90 \
+ ${top_srcdir}/atmos_param/radiation/clouds/cloudrad_types.lo
+${top_builddir}/atmos_param/radiation/clouds/bulkphys_rad.lo: ${top_srcdir}/atmos_param/radiation/clouds/bulkphys_rad.F90 \
+ ${top_srcdir}/atmos_param/radiation/clouds/cloudrad_types.lo \
+ ${top_srcdir}/atmos_param/radiation/clouds/strat_clouds_W.lo
+${top_builddir}/atmos_param/radiation/clouds/uw_clouds_W.lo: ${top_srcdir}/atmos_param/radiation/clouds/uw_clouds_W.F90 \
+ ${top_srcdir}/atmos_param/physics_radiation_exch/physics_radiation_exch.lo \
+ ${top_srcdir}/atmos_param/radiation/clouds/cloudrad_types.lo
+${top_builddir}/atmos_param/radiation/clouds/cloudrad_driver.lo: ${top_srcdir}/atmos_param/radiation/clouds/cloudrad_driver.F90 \
+ ${top_srcdir}/atmos_shared/aerosol/aerosol_types.lo \
+ ${top_srcdir}/atmos_param/physics_radiation_exch/physics_radiation_exch.lo \
+ ${top_srcdir}/atmos_param/radiation/clouds/cloudrad_types.lo \
+ ${top_srcdir}/atmos_param/radiation/clouds/cloud_spec.lo \
+ ${top_srcdir}/atmos_param/radiation/clouds/cloudrad_package.lo
+${top_builddir}/atmos_param/radiation/clouds/cloud_spec.lo: ${top_srcdir}/atmos_param/radiation/clouds/cloud_spec.F90 \
+ ${top_srcdir}/atmos_param/radiation/clouds/get_random_number_stream.lo \
+ ${top_srcdir}/atmos_shared/aerosol/aerosol_types.lo \
+ ${top_srcdir}/atmos_param/physics_radiation_exch/physics_radiation_exch.lo \
+ ${top_srcdir}/atmos_param/radiation/clouds/cloudrad_types.lo \
+ ${top_srcdir}/atmos_param/radiation/clouds/strat_clouds_W.lo \
+ ${top_srcdir}/atmos_param/radiation/clouds/donner_deep_clouds_W.lo \
+ ${top_srcdir}/atmos_param/radiation/clouds/uw_clouds_W.lo
+${top_builddir}/atmos_param/radiation/clouds/donner_deep_clouds_W.lo: ${top_srcdir}/atmos_param/radiation/clouds/donner_deep_clouds_W.F90 \
+ ${top_srcdir}/atmos_param/radiation/clouds/cloudrad_types.lo
+${top_builddir}/atmos_param/radiation/clouds/cloudrad_diagnostics.lo: ${top_srcdir}/atmos_param/radiation/clouds/cloudrad_diagnostics.F90 \
+ ${top_srcdir}/atmos_shared/atmos_cmip_diag/atmos_cmip_diag.lo \
+ ${top_srcdir}/atmos_param/radiation/clouds/cloudrad_types.lo \
+ ${top_srcdir}/atmos_param/radiation/clouds/microphys_rad.lo \
+ ${top_srcdir}/atmos_param/radiation/clouds/isccp_clouds.lo
+${top_builddir}/atmos_param/radiation/clouds/cloudrad_package.lo: ${top_srcdir}/atmos_param/radiation/clouds/cloudrad_package.F90 \
+ ${top_srcdir}/atmos_param/radiation/clouds/cloudrad_types.lo \
+ ${top_srcdir}/atmos_param/radiation/clouds/cloudrad_diagnostics.lo \
+ ${top_srcdir}/atmos_param/radiation/clouds/bulkphys_rad.lo \
+ ${top_srcdir}/atmos_param/radiation/clouds/microphys_rad.lo
+${top_builddir}/atmos_param/radiation/longwave/longwave_tables.lo: ${top_srcdir}/atmos_param/radiation/longwave/longwave_tables.F90 \
+ ${top_srcdir}/atmos_param/radiation/longwave/longwave_utilities.lo \
+ ${top_srcdir}/atmos_param/radiation/longwave/longwave_params.lo
+${top_builddir}/atmos_param/radiation/longwave/longwave_clouds.lo: ${top_srcdir}/atmos_param/radiation/longwave/longwave_clouds.F90 \
+ ${top_srcdir}/atmos_param/radiation/longwave/longwave_utilities.lo \
+ ${top_srcdir}/atmos_param/radiation/longwave/longwave_types.lo
+${top_builddir}/atmos_param/radiation/longwave/gas_tf.lo: ${top_srcdir}/atmos_param/radiation/longwave/gas_tf.F90 \
+ ${top_srcdir}/atmos_param/radiation/longwave/longwave_utilities.lo \
+ ${top_srcdir}/atmos_param/radiation/longwave/longwave_params.lo
+${top_builddir}/atmos_param/radiation/longwave/longwave_params.lo: ${top_srcdir}/atmos_param/radiation/longwave/longwave_params.F90
+${top_builddir}/atmos_param/radiation/longwave/sealw99.lo: ${top_srcdir}/atmos_param/radiation/longwave/sealw99.F90 \
+ ${top_srcdir}/atmos_param/radiation/longwave/longwave_utilities.lo \
+ ${top_srcdir}/atmos_param/radiation/longwave/longwave_types.lo \
+ ${top_srcdir}/atmos_param/radiation/longwave/longwave_params.lo \
+ ${top_srcdir}/atmos_param/radiation/longwave/longwave_clouds.lo \
+ ${top_srcdir}/atmos_param/radiation/longwave/longwave_fluxes.lo \
+ ${top_srcdir}/atmos_param/radiation/longwave/longwave_tables.lo \
+ ${top_srcdir}/atmos_param/radiation/longwave/optical_path.lo \
+ ${top_srcdir}/atmos_param/radiation/longwave/gas_tf.lo \
+ ${top_srcdir}/atmos_param/radiation/longwave/lw_gases_stdtf.lo
+${top_builddir}/atmos_param/radiation/longwave/optical_path.lo: ${top_srcdir}/atmos_param/radiation/longwave/optical_path.F90 \
+ ${top_srcdir}/atmos_param/radiation/longwave/longwave_utilities.lo \
+ ${top_srcdir}/atmos_param/radiation/longwave/longwave_params.lo \
+ ${top_srcdir}/atmos_param/radiation/longwave/lw_gases_stdtf.lo
+${top_builddir}/atmos_param/radiation/longwave/longwave_types.lo: ${top_srcdir}/atmos_param/radiation/longwave/longwave_types.F90
+${top_builddir}/atmos_param/radiation/longwave/longwave_utilities.lo: ${top_srcdir}/atmos_param/radiation/longwave/longwave_utilities.F90
+${top_builddir}/atmos_param/radiation/longwave/longwave_fluxes.lo: ${top_srcdir}/atmos_param/radiation/longwave/longwave_fluxes.F90 \
+ ${top_srcdir}/atmos_param/radiation/longwave/longwave_types.lo
+${top_builddir}/atmos_param/radiation/longwave/lw_gases_stdtf.lo: ${top_srcdir}/atmos_param/radiation/longwave/lw_gases_stdtf.F90 \
+ ${top_srcdir}/atmos_param/radiation/longwave/longwave_utilities.lo \
+ ${top_srcdir}/atmos_param/radiation/longwave/gas_tf.lo
+${top_builddir}/atmos_param/radiation/aerosols/aerosolrad_types.lo: ${top_srcdir}/atmos_param/radiation/aerosols/aerosolrad_types.F90
+${top_builddir}/atmos_param/radiation/aerosols/aerosolrad_package.lo: ${top_srcdir}/atmos_param/radiation/aerosols/aerosolrad_package.F90 \
+ ${top_srcdir}/atmos_shared/aerosol/aerosol_types.lo \
+ ${top_srcdir}/atmos_param/radiation/aerosols/aerosolrad_types.lo \
+ ${top_srcdir}/atmos_param/radiation/longwave/sealw99.lo \
+ ${top_srcdir}/atmos_param/radiation/shortwave/esfsw_driver.lo
+${top_builddir}/atmos_param/radiation/aerosols/aerosolrad_driver.lo: ${top_srcdir}/atmos_param/radiation/aerosols/aerosolrad_driver.F90 \
+ ${top_srcdir}/atmos_shared/aerosol/aerosol_types.lo \
+ ${top_srcdir}/atmos_shared/aerosol/aerosol.lo \
+ ${top_srcdir}/atmos_param/radiation/aerosols/aerosolrad_types.lo \
+ ${top_srcdir}/atmos_param/radiation/aerosols/aerosolrad_package.lo
+${top_builddir}/atmos_param/radiation/shortwave/esfsw_driver.lo: ${top_srcdir}/atmos_param/radiation/shortwave/esfsw_driver.F90 \
+ ${top_srcdir}/atmos_param/radiation/shortwave/esfsw_parameters.lo \
+ ${top_srcdir}/atmos_param/radiation/shortwave/esfsw_bands.lo \
+ ${top_srcdir}/atmos_param/radiation/shortwave/esfsw_utilities.lo \
+ ${top_srcdir}/atmos_param/radiation/shortwave/shortwave_types.lo
+${top_builddir}/atmos_param/radiation/shortwave/esfsw_utilities.lo: ${top_srcdir}/atmos_param/radiation/shortwave/esfsw_utilities.F90
+${top_builddir}/atmos_param/radiation/shortwave/shortwave_types.lo: ${top_srcdir}/atmos_param/radiation/shortwave/shortwave_types.F90
+${top_builddir}/atmos_param/radiation/shortwave/esfsw_bands.lo: ${top_srcdir}/atmos_param/radiation/shortwave/esfsw_bands.F90 \
+ ${top_srcdir}/atmos_param/radiation/shortwave/esfsw_utilities.lo
+${top_builddir}/atmos_param/radiation/shortwave/esfsw_parameters.lo: ${top_srcdir}/atmos_param/radiation/shortwave/esfsw_parameters.F90
+${top_builddir}/atmos_param/radiation/radiative_gases/radiative_gases.lo: ${top_srcdir}/atmos_param/radiation/radiative_gases/radiative_gases.F90 \
+ ${top_srcdir}/atmos_param/radiation/longwave/sealw99.lo \
+ ${top_srcdir}/atmos_param/radiation/radiative_gases/radiative_gases_types.lo \
+ ${top_srcdir}/atmos_param/radiation/radiative_gases/ozone.lo
+${top_builddir}/atmos_param/radiation/radiative_gases/radiative_gases_types.lo: ${top_srcdir}/atmos_param/radiation/radiative_gases/radiative_gases_types.F90
+${top_builddir}/atmos_param/radiation/radiative_gases/ozone.lo: ${top_srcdir}/atmos_param/radiation/radiative_gases/ozone.F90 \
+ ${top_srcdir}/atmos_param/radiation/radiative_gases/radiative_gases_types.lo
+${top_builddir}/atmos_param/radiation/util/radiation_diag.lo: ${top_srcdir}/atmos_param/radiation/util/radiation_diag.F90 \
+ ${top_srcdir}/atmos_param/radiation/driver/radiation_driver.lo
+${top_builddir}/atmos_param/radiation/driver/longwave_driver.lo: ${top_srcdir}/atmos_param/radiation/driver/longwave_driver.F90 \
+ ${top_srcdir}/atmos_param/radiation/driver/radiation_driver_types.lo \
+ ${top_srcdir}/atmos_param/radiation/aerosols/aerosolrad_types.lo \
+ ${top_srcdir}/atmos_param/radiation/longwave/sealw99.lo \
+ ${top_srcdir}/atmos_param/radiation/longwave/longwave_types.lo \
+ ${top_srcdir}/atmos_param/radiation/radiative_gases/radiative_gases.lo \
+ ${top_srcdir}/atmos_param/radiation/radiative_gases/radiative_gases_types.lo
+${top_builddir}/atmos_param/radiation/driver/rad_output_file.lo: ${top_srcdir}/atmos_param/radiation/driver/rad_output_file.F90 \
+ ${top_srcdir}/atmos_shared/aerosol/aerosol_types.lo \
+ ${top_srcdir}/atmos_shared/atmos_cmip_diag/atmos_cmip_diag.lo \
+ ${top_srcdir}/atmos_param/radiation/driver/radiation_driver_types.lo \
+ ${top_srcdir}/atmos_param/radiation/aerosols/aerosolrad_types.lo \
+ ${top_srcdir}/atmos_param/radiation/clouds/cloudrad_types.lo \
+ ${top_srcdir}/atmos_param/radiation/shortwave/esfsw_driver.lo \
+ ${top_srcdir}/atmos_param/radiation/shortwave/shortwave_types.lo \
+ ${top_srcdir}/atmos_param/radiation/longwave/longwave_types.lo
+${top_builddir}/atmos_param/radiation/driver/radiation_driver_types.lo: ${top_srcdir}/atmos_param/radiation/driver/radiation_driver_types.F90
+${top_builddir}/atmos_param/radiation/driver/radiation_types.lo: ${top_srcdir}/atmos_param/radiation/driver/radiation_types.F90 \
+ ${top_srcdir}/atmos_shared/tracer_driver/atmos_co2.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/atmos_ch4.lo
+${top_builddir}/atmos_param/radiation/driver/solar_data_driver.lo: ${top_srcdir}/atmos_param/radiation/driver/solar_data_driver.F90
+${top_builddir}/atmos_param/radiation/driver/shortwave_driver.lo: ${top_srcdir}/atmos_param/radiation/driver/shortwave_driver.F90 \
+ ${top_srcdir}/atmos_param/radiation/driver/radiation_driver_types.lo \
+ ${top_srcdir}/atmos_param/radiation/shortwave/esfsw_driver.lo \
+ ${top_srcdir}/atmos_param/radiation/shortwave/shortwave_types.lo \
+ ${top_srcdir}/atmos_param/radiation/radiative_gases/radiative_gases_types.lo \
+ ${top_srcdir}/atmos_param/radiation/driver/solar_data_driver.lo
+${top_builddir}/atmos_param/radiation/driver/radiation_driver_diag.lo: ${top_srcdir}/atmos_param/radiation/driver/radiation_driver_diag.F90 \
+ ${top_srcdir}/atmos_shared/atmos_cmip_diag/atmos_cmip_diag.lo \
+ ${top_srcdir}/atmos_shared/atmos_cmip_diag/atmos_global_diag.lo \
+ ${top_srcdir}/atmos_param/radiation/driver/radiation_driver_types.lo \
+ ${top_srcdir}/atmos_param/radiation/aerosols/aerosolrad_types.lo \
+ ${top_srcdir}/atmos_param/radiation/shortwave/shortwave_types.lo \
+ ${top_srcdir}/atmos_param/radiation/longwave/longwave_types.lo \
+ ${top_srcdir}/atmos_param/radiation/radiative_gases/radiative_gases_types.lo \
+ ${top_srcdir}/atmos_param/radiation/driver/shortwave_driver.lo
+${top_builddir}/atmos_param/radiation/driver/radiation_driver.lo: ${top_srcdir}/atmos_param/radiation/driver/radiation_driver.F90 \
+ ${top_srcdir}/atmos_param/radiation/driver/radiation_types.lo \
+ ${top_srcdir}/atmos_param/physics_radiation_exch/physics_radiation_exch.lo \
+ ${top_srcdir}/atmos_param/radiation/driver/radiation_driver_types.lo \
+ ${top_srcdir}/atmos_shared/aerosol/aerosol_types.lo \
+ ${top_srcdir}/atmos_param/radiation/aerosols/aerosolrad_types.lo \
+ ${top_srcdir}/atmos_param/radiation/clouds/cloudrad_types.lo \
+ ${top_srcdir}/atmos_param/radiation/driver/longwave_driver.lo \
+ ${top_srcdir}/atmos_param/radiation/longwave/longwave_types.lo \
+ ${top_srcdir}/atmos_param/radiation/driver/shortwave_driver.lo \
+ ${top_srcdir}/atmos_param/radiation/shortwave/shortwave_types.lo \
+ ${top_srcdir}/atmos_param/radiation/driver/rad_output_file.lo \
+ ${top_srcdir}/atmos_param/radiation/aerosols/aerosolrad_driver.lo \
+ ${top_srcdir}/atmos_param/radiation/clouds/cloudrad_driver.lo \
+ ${top_srcdir}/atmos_param/radiation/clouds/cloudrad_diagnostics.lo \
+ ${top_srcdir}/atmos_param/radiation/radiative_gases/radiative_gases.lo \
+ ${top_srcdir}/atmos_param/radiation/radiative_gases/radiative_gases_types.lo \
+ ${top_srcdir}/atmos_param/radiation/driver/radiation_driver_diag.lo
+${top_builddir}/atmos_param/edt/edt.lo: ${top_srcdir}/atmos_param/edt/edt.F90
+${top_builddir}/atmos_param/convection_driver/convection_utilities.lo: ${top_srcdir}/atmos_param/convection_driver/convection_utilities.F90
+${top_builddir}/atmos_param/convection_driver/detr_ice_num.lo: ${top_srcdir}/atmos_param/convection_driver/detr_ice_num.F90 \
+ ${top_srcdir}/atmos_param/lscloud_driver/lscloud_constants.lo
+${top_builddir}/atmos_param/convection_driver/convection_driver.lo: ${top_srcdir}/atmos_param/convection_driver/convection_driver.F90 \
+ ${top_srcdir}/atmos_shared/atmos_cmip_diag/atmos_global_diag.lo \
+ ${top_srcdir}/atmos_shared/atmos_cmip_diag/atmos_cmip_diag.lo \
+ ${top_srcdir}/atmos_param/physics_driver/physics_types.lo \
+ ${top_srcdir}/atmos_param/vert_diff_driver/vert_diff_driver.lo \
+ ${top_srcdir}/atmos_param/physics_radiation_exch/physics_radiation_exch.lo \
+ ${top_srcdir}/atmos_param/betts_miller/betts_miller.lo \
+ ${top_srcdir}/atmos_param/betts_miller/bm_massflux.lo \
+ ${top_srcdir}/atmos_param/betts_miller/bm_omp.lo \
+ ${top_srcdir}/atmos_param/donner_deep/donner_deep.lo \
+ ${top_srcdir}/atmos_param/moist_conv/moist_conv.lo \
+ ${top_srcdir}/atmos_param/shallow_cu/uw_conv.lo \
+ ${top_srcdir}/atmos_param/ras/ras.lo \
+ ${top_srcdir}/atmos_param/dry_adj/dry_adj.lo \
+ ${top_srcdir}/atmos_param/convection_driver/detr_ice_num.lo \
+ ${top_srcdir}/atmos_param/rh_clouds/rh_clouds.lo \
+ ${top_srcdir}/atmos_param/cu_mo_trans/cu_mo_trans.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/tropchem/mo_hook.lo \
+ ${top_srcdir}/atmos_shared/aerosol/aerosol_types.lo \
+ ${top_srcdir}/atmos_param/moist_processes/moist_processes_utils.lo \
+ ${top_srcdir}/atmos_param/convection_driver/convection_utilities.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/atmos_tracer_utilities.lo
+${top_builddir}/atmos_param/physics_radiation_exch/physics_radiation_exch.lo: ${top_srcdir}/atmos_param/physics_radiation_exch/physics_radiation_exch.F90
+${top_builddir}/atmos_param/cloud_generator/betaDistribution.lo: ${top_srcdir}/atmos_param/cloud_generator/betaDistribution.F90
+${top_builddir}/atmos_param/cloud_generator/cloud_generator.lo: ${top_srcdir}/atmos_param/cloud_generator/cloud_generator.F90 \
+ ${top_srcdir}/atmos_param/cloud_generator/betaDistribution.lo
+${top_builddir}/atmos_param/qe_moist_convection/qe_moist_convection.lo: ${top_srcdir}/atmos_param/qe_moist_convection/qe_moist_convection.F90
+${top_builddir}/atmos_param/lscloud_driver/lscloud_debug.lo: ${top_srcdir}/atmos_param/lscloud_driver/lscloud_debug.F90 \
+ ${top_srcdir}/atmos_param/lscloud_driver/lscloud_types.lo \
+ ${top_srcdir}/atmos_param/moist_processes/moist_processes_utils.lo \
+ ${top_srcdir}/atmos_param/lscloud_driver/check_nan.lo
+${top_builddir}/atmos_param/lscloud_driver/lscloud_constants.lo: ${top_srcdir}/atmos_param/lscloud_driver/lscloud_constants.F90
+${top_builddir}/atmos_param/lscloud_driver/lscloud_netcdf.lo: ${top_srcdir}/atmos_param/lscloud_driver/lscloud_netcdf.F90 \
+ ${top_srcdir}/atmos_param/lscloud_driver/lscloud_types.lo \
+ ${top_srcdir}/atmos_shared/atmos_cmip_diag/atmos_cmip_diag.lo
+${top_builddir}/atmos_param/lscloud_driver/lscloud_types.lo: ${top_srcdir}/atmos_param/lscloud_driver/lscloud_types.F90 \
+ ${top_srcdir}/atmos_shared/atmos_cmip_diag/atmos_cmip_diag.lo
+${top_builddir}/atmos_param/lscloud_driver/lscloud_driver.lo: ${top_srcdir}/atmos_param/lscloud_driver/lscloud_driver.F90 \
+ ${top_srcdir}/atmos_param/physics_driver/physics_types.lo \
+ ${top_srcdir}/atmos_param/lscale_cond/lscale_cond.lo \
+ ${top_srcdir}/atmos_param/lscloud_driver/lscloud_debug.lo \
+ ${top_srcdir}/atmos_param/lscloud_driver/lscloud_types.lo \
+ ${top_srcdir}/atmos_param/lscloud_driver/polysvp.lo \
+ ${top_srcdir}/atmos_param/lscloud_driver/lscloud_netcdf.lo \
+ ${top_srcdir}/atmos_param/rh_clouds/rh_clouds.lo \
+ ${top_srcdir}/atmos_param/physics_radiation_exch/physics_radiation_exch.lo \
+ ${top_srcdir}/atmos_param/macrophysics/ls_cloud_macrophysics.lo \
+ ${top_srcdir}/atmos_param/microphysics/ls_cloud_microphysics.lo \
+ ${top_srcdir}/atmos_param/aerosol_cloud/aerosol_cloud.lo \
+ ${top_srcdir}/atmos_param/strat_cloud/strat_cloud.lo \
+ ${top_srcdir}/atmos_param/moist_processes/moist_processes_utils.lo \
+ ${top_srcdir}/atmos_shared/aerosol/aerosol_types.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/atmos_tracer_utilities.lo \
+ ${top_srcdir}/atmos_shared/atmos_cmip_diag/atmos_global_diag.lo \
+ ${top_srcdir}/atmos_shared/atmos_cmip_diag/atmos_cmip_diag.lo
+${top_builddir}/atmos_param/lscloud_driver/polysvp.lo: ${top_srcdir}/atmos_param/lscloud_driver/polysvp.F90 \
+ ${top_srcdir}/atmos_param/lscloud_driver/lscloud_constants.lo \
+ ${top_srcdir}/atmos_param/lscloud_driver/lscloud_types.lo
+${top_builddir}/atmos_param/lscloud_driver/check_nan.lo: ${top_srcdir}/atmos_param/lscloud_driver/check_nan.F90
+${top_builddir}/atmos_param/shallow_conv/shallow_conv.lo: ${top_srcdir}/atmos_param/shallow_conv/shallow_conv.F90
+${top_builddir}/atmos_param/stable_bl_turb/stable_bl_turb.lo: ${top_srcdir}/atmos_param/stable_bl_turb/stable_bl_turb.F90
+${top_builddir}/atmos_param/microphysics/morrison_gettelman_microp.lo: ${top_srcdir}/atmos_param/microphysics/morrison_gettelman_microp.F90 \
+ ${top_srcdir}/atmos_param/lscloud_driver/polysvp.lo \
+ ${top_srcdir}/atmos_param/lscloud_driver/lscloud_debug.lo \
+ ${top_srcdir}/atmos_param/lscloud_driver/lscloud_types.lo \
+ ${top_srcdir}/atmos_param/microphysics/gamma_mg.lo \
+ ${top_srcdir}/atmos_param/lscloud_driver/lscloud_constants.lo \
+ ${top_srcdir}/atmos_param/microphysics/simple_pdf.lo \
+ ${top_srcdir}/atmos_param/physics_radiation_exch/physics_radiation_exch.lo
+${top_builddir}/atmos_param/microphysics/gamma_mg.lo: ${top_srcdir}/atmos_param/microphysics/gamma_mg.F90 \
+ ${top_srcdir}/atmos_param/lscloud_driver/lscloud_constants.lo
+${top_builddir}/atmos_param/microphysics/micro_mg.lo: ${top_srcdir}/atmos_param/microphysics/micro_mg.F90 \
+ ${top_srcdir}/atmos_param/microphysics/gamma_mg.lo \
+ ${top_srcdir}/atmos_param/lscloud_driver/lscloud_types.lo \
+ ${top_srcdir}/atmos_param/microphysics/simple_pdf.lo \
+ ${top_srcdir}/atmos_param/physics_radiation_exch/physics_radiation_exch.lo
+${top_builddir}/atmos_param/microphysics/rotstayn_klein_mp.lo: ${top_srcdir}/atmos_param/microphysics/rotstayn_klein_mp.F90 \
+ ${top_srcdir}/atmos_param/cloud_generator/cloud_generator.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/aer_ccn_act/aer_in_act.lo \
+ ${top_srcdir}/atmos_param/lscloud_driver/polysvp.lo \
+ ${top_srcdir}/atmos_param/lscloud_driver/lscloud_types.lo \
+ ${top_srcdir}/atmos_param/lscloud_driver/lscloud_debug.lo \
+ ${top_srcdir}/atmos_param/physics_radiation_exch/physics_radiation_exch.lo
+${top_builddir}/atmos_param/microphysics/ls_cloud_microphysics.lo: ${top_srcdir}/atmos_param/microphysics/ls_cloud_microphysics.F90 \
+ ${top_srcdir}/atmos_param/physics_driver/physics_types.lo \
+ ${top_srcdir}/atmos_param/lscloud_driver/lscloud_types.lo \
+ ${top_srcdir}/atmos_shared/aerosol/aerosol_types.lo \
+ ${top_srcdir}/atmos_param/physics_radiation_exch/physics_radiation_exch.lo \
+ ${top_srcdir}/atmos_param/moist_processes/moist_processes_utils.lo \
+ ${top_srcdir}/atmos_param/lin_cloud_microphys/lin_cloud_microphys.lo \
+ ${top_srcdir}/atmos_param/lscloud_driver/lscloud_debug.lo \
+ ${top_srcdir}/atmos_param/microphysics/rotstayn_klein_mp.lo \
+ ${top_srcdir}/atmos_param/microphysics/morrison_gettelman_microp.lo \
+ ${top_srcdir}/atmos_param/microphysics/cldwat2m_micro.lo \
+ ${top_srcdir}/atmos_param/microphysics/micro_mg.lo
+${top_builddir}/atmos_param/microphysics/simple_pdf.lo: ${top_srcdir}/atmos_param/microphysics/simple_pdf.F90 \
+ ${top_srcdir}/atmos_param/cloud_generator/betaDistribution.lo \
+ ${top_srcdir}/atmos_param/lscloud_driver/lscloud_types.lo
+${top_builddir}/atmos_param/microphysics/cldwat2m_micro.lo: ${top_srcdir}/atmos_param/microphysics/cldwat2m_micro.F90 \
+ ${top_srcdir}/atmos_param/microphysics/gamma_mg.lo \
+ ${top_srcdir}/atmos_param/lscloud_driver/lscloud_types.lo \
+ ${top_srcdir}/atmos_param/microphysics/simple_pdf.lo \
+ ${top_srcdir}/atmos_param/physics_radiation_exch/physics_radiation_exch.lo
+${top_builddir}/atmos_param/clouds/clouds.lo: ${top_srcdir}/atmos_param/clouds/clouds.F90 \
+ ${top_srcdir}/atmos_param/cloud_rad/cloud_rad.lo \
+ ${top_srcdir}/atmos_param/cloud_zonal/cloud_zonal.lo \
+ ${top_srcdir}/atmos_param/cloud_obs/cloud_obs.lo \
+ ${top_srcdir}/atmos_param/rh_clouds/rh_clouds.lo \
+ ${top_srcdir}/atmos_param/diag_cloud/diag_cloud.lo
+${top_builddir}/atmos_param/lin_cloud_microphys/lin_cloud_microphys.lo: ${top_srcdir}/atmos_param/lin_cloud_microphys/lin_cloud_microphys.F90
+${top_builddir}/atmos_param/cloud_obs/cloud_obs.lo: ${top_srcdir}/atmos_param/cloud_obs/cloud_obs.F90
+${top_builddir}/atmos_param/diag_cloud_rad/diag_cloud_rad.lo: ${top_srcdir}/atmos_param/diag_cloud_rad/diag_cloud_rad.F90 \
+ ${top_srcdir}/atmos_param/cloud_rad/cloud_rad.lo
+${top_builddir}/atmos_param/damping_driver/damping_driver.lo: ${top_srcdir}/atmos_param/damping_driver/damping_driver.F90 \
+ ${top_srcdir}/atmos_param/mg_drag/mg_drag.lo \
+ ${top_srcdir}/atmos_param/cg_drag/cg_drag.lo \
+ ${top_srcdir}/atmos_param/topo_drag/topo_drag.lo \
+ ${top_srcdir}/atmos_shared/atmos_cmip_diag/atmos_cmip_diag.lo
+${top_builddir}/atmos_param/shallow_physics/shallow_physics.lo: ${top_srcdir}/atmos_param/shallow_physics/shallow_physics.F90
+${top_builddir}/atmos_param/vert_diff_driver/vert_diff_driver.lo: ${top_srcdir}/atmos_param/vert_diff_driver/vert_diff_driver.F90 \
+ ${top_srcdir}/atmos_param/vert_diff/vert_diff.lo \
+ ${top_srcdir}/atmos_shared/atmos_cmip_diag/atmos_cmip_diag.lo
+${top_builddir}/atmos_param/moist_processes/moist_processes.lo: ${top_srcdir}/atmos_param/moist_processes/moist_processes.F90 \
+ ${top_srcdir}/atmos_param/physics_driver/physics_types.lo \
+ ${top_srcdir}/atmos_param/physics_radiation_exch/physics_radiation_exch.lo \
+ ${top_srcdir}/atmos_param/lscloud_driver/lscloud_driver.lo \
+ ${top_srcdir}/atmos_param/convection_driver/convection_driver.lo \
+ ${top_srcdir}/atmos_param/convection_driver/convection_utilities.lo \
+ ${top_srcdir}/atmos_shared/atmos_cmip_diag/atmos_global_diag.lo \
+ ${top_srcdir}/atmos_param/vert_diff_driver/vert_diff_driver.lo \
+ ${top_srcdir}/atmos_shared/aerosol/aerosol_types.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/atmos_tracer_utilities.lo \
+ ${top_srcdir}/atmos_param/moist_processes/moist_processes_utils.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/atmos_dust.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/atmos_tracer_driver.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/atmos_sea_salt.lo \
+ ${top_srcdir}/atmos_shared/atmos_cmip_diag/atmos_cmip_diag.lo
+${top_builddir}/atmos_param/moist_processes/moist_processes_utils.lo: ${top_srcdir}/atmos_param/moist_processes/moist_processes_utils.F90 \
+ ${top_srcdir}/atmos_param/lscloud_driver/lscloud_types.lo
+${top_builddir}/atmos_param/strat_cloud/strat_cloud.lo: ${top_srcdir}/atmos_param/strat_cloud/strat_cloud.F90 \
+ ${top_srcdir}/atmos_shared/aerosol/aerosol_types.lo \
+ ${top_srcdir}/atmos_param/lscloud_driver/lscloud_types.lo \
+ ${top_srcdir}/atmos_param/moist_processes/moist_processes_utils.lo \
+ ${top_srcdir}/atmos_param/physics_driver/physics_types.lo \
+ ${top_srcdir}/atmos_param/physics_radiation_exch/physics_radiation_exch.lo \
+ ${top_srcdir}/atmos_param/lscloud_driver/lscloud_netcdf.lo \
+ ${top_srcdir}/atmos_param/aerosol_cloud/aerosol_cloud.lo \
+ ${top_srcdir}/atmos_param/cloud_generator/betaDistribution.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/aer_ccn_act/aer_in_act.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/aer_ccn_act/aer_ccn_act.lo \
+ ${top_srcdir}/atmos_param/cloud_generator/cloud_generator.lo
+${top_builddir}/atmos_param/my25_turb/my25_turb.lo: ${top_srcdir}/atmos_param/my25_turb/my25_turb.F90
+${top_builddir}/atmos_param/cosp/cosp_modis_simulator.lo: ${top_srcdir}/atmos_param/cosp/cosp_modis_simulator.F90 \
+ ${top_srcdir}/atmos_param/cosp/cosp_constants.lo \
+ ${top_srcdir}/atmos_param/cosp/cosp_types.lo \
+ ${top_srcdir}/atmos_param/cosp/MODIS_simulator/modis_simulator.lo
+${top_builddir}/atmos_param/cosp/cosp_driver.lo: ${top_srcdir}/atmos_param/cosp/cosp_driver.F90 \
+ ${top_srcdir}/atmos_param/physics_radiation_exch/physics_radiation_exch.lo \
+ ${top_srcdir}/atmos_param/physics_driver/physics_types.lo \
+ ${top_srcdir}/atmos_param/cosp/cosp_types.lo \
+ ${top_srcdir}/atmos_param/cosp/cosp.lo \
+ ${top_srcdir}/atmos_param/cosp/cosp_io.lo \
+ ${top_srcdir}/atmos_param/cosp/cosp_constants.lo \
+ ${top_srcdir}/atmos_param/cosp/cosp_modis_simulator.lo \
+ ${top_srcdir}/atmos_param/cosp/cosp_diagnostics.lo \
+ ${top_srcdir}/atmos_param/cosp/cosp_utils.lo
+${top_builddir}/atmos_param/cosp/cosp_misr_simulator.lo: ${top_srcdir}/atmos_param/cosp/cosp_misr_simulator.F90 \
+ ${top_srcdir}/atmos_param/cosp/cosp_constants.lo \
+ ${top_srcdir}/atmos_param/cosp/cosp_types.lo
+${top_builddir}/atmos_param/cosp/cosp_stats.lo: ${top_srcdir}/atmos_param/cosp/cosp_stats.F90 \
+ ${top_srcdir}/atmos_param/cosp/cosp_constants.lo \
+ ${top_srcdir}/atmos_param/cosp/cosp_types.lo \
+ ${top_srcdir}/atmos_param/cosp/llnl/llnl_stats.lo \
+ ${top_srcdir}/atmos_param/cosp/actsim/lmd_ipsl_stats.lo
+${top_builddir}/atmos_param/cosp/cosp_utils.lo: ${top_srcdir}/atmos_param/cosp/cosp_utils.F90 \
+ ${top_srcdir}/atmos_param/cosp/cosp_constants.lo
+${top_builddir}/atmos_param/cosp/cosp_types.lo: ${top_srcdir}/atmos_param/cosp/cosp_types.F90 \
+ ${top_srcdir}/atmos_param/cosp/cosp_constants.lo \
+ ${top_srcdir}/atmos_param/cosp/cosp_utils.lo \
+ ${top_srcdir}/atmos_param/cosp/quickbeam/radar_simulator_types.lo \
+ ${top_srcdir}/atmos_param/cosp/quickbeam/scale_LUTs_io.lo
+${top_builddir}/atmos_param/cosp/cosp_rttov_simulator.lo: ${top_srcdir}/atmos_param/cosp/cosp_rttov_simulator.F90 \
+ ${top_srcdir}/atmos_param/cosp/cosp_constants.lo \
+ ${top_srcdir}/atmos_param/cosp/cosp_types.lo
+${top_builddir}/atmos_param/cosp/cosp_isccp_simulator.lo: ${top_srcdir}/atmos_param/cosp/cosp_isccp_simulator.F90 \
+ ${top_srcdir}/atmos_param/cosp/cosp_constants.lo \
+ ${top_srcdir}/atmos_param/cosp/cosp_types.lo
+${top_builddir}/atmos_param/cosp/cosp.lo: ${top_srcdir}/atmos_param/cosp/cosp.F90 \
+ ${top_srcdir}/atmos_param/cosp/cosp_types.lo \
+ ${top_srcdir}/atmos_param/cosp/cosp_simulator.lo \
+ ${top_srcdir}/atmos_param/cosp/cosp_modis_simulator.lo
+${top_builddir}/atmos_param/cosp/cosp_constants.lo: ${top_srcdir}/atmos_param/cosp/cosp_constants.F90
+${top_builddir}/atmos_param/cosp/cosp_diagnostics.lo: ${top_srcdir}/atmos_param/cosp/cosp_diagnostics.F90 \
+ ${top_srcdir}/atmos_param/cosp/cosp_types.lo \
+ ${top_srcdir}/atmos_param/cosp/cosp_io.lo \
+ ${top_srcdir}/atmos_param/cosp/cosp_constants.lo \
+ ${top_srcdir}/atmos_param/cosp/actsim/lmd_ipsl_stats.lo \
+ ${top_srcdir}/atmos_param/cosp/cosp_modis_simulator.lo \
+ ${top_srcdir}/atmos_param/cosp/MODIS_simulator/modis_simulator.lo \
+ ${top_srcdir}/atmos_param/cosp/cosp_utils.lo
+${top_builddir}/atmos_param/cosp/cosp_simulator.lo: ${top_srcdir}/atmos_param/cosp/cosp_simulator.F90 \
+ ${top_srcdir}/atmos_param/cosp/cosp_constants.lo \
+ ${top_srcdir}/atmos_param/cosp/cosp_types.lo \
+ ${top_srcdir}/atmos_param/cosp/llnl/cosp_radar.lo \
+ ${top_srcdir}/atmos_param/cosp/cosp_lidar.lo \
+ ${top_srcdir}/atmos_param/cosp/cosp_isccp_simulator.lo \
+ ${top_srcdir}/atmos_param/cosp/cosp_modis_simulator.lo \
+ ${top_srcdir}/atmos_param/cosp/cosp_misr_simulator.lo \
+ ${top_srcdir}/atmos_param/cosp/cosp_rttov_simulator.lo \
+ ${top_srcdir}/atmos_param/cosp/cosp_stats.lo
+${top_builddir}/atmos_param/cosp/cosp_lidar.lo: ${top_srcdir}/atmos_param/cosp/cosp_lidar.F90 \
+ ${top_srcdir}/atmos_param/cosp/cosp_constants.lo \
+ ${top_srcdir}/atmos_param/cosp/cosp_types.lo
+${top_builddir}/atmos_param/cosp/cosp_io.lo: ${top_srcdir}/atmos_param/cosp/cosp_io.F90 \
+ ${top_srcdir}/atmos_param/cosp/cosp_constants.lo \
+ ${top_srcdir}/atmos_param/cosp/cosp_types.lo \
+ ${top_srcdir}/atmos_param/cosp/cosp_modis_simulator.lo
+${top_builddir}/atmos_param/cosp/actsim/lidar_simulator.lo: ${top_srcdir}/atmos_param/cosp/actsim/lidar_simulator.F90
+${top_builddir}/atmos_param/cosp/actsim/lmd_ipsl_stats.lo: ${top_srcdir}/atmos_param/cosp/actsim/lmd_ipsl_stats.F90 \
+ ${top_srcdir}/atmos_param/cosp/llnl/llnl_stats.lo \
+ ${top_srcdir}/atmos_param/cosp/cosp_constants.lo
+${top_builddir}/atmos_param/cosp/MISR_simulator/MISR_simulator.lo: ${top_srcdir}/atmos_param/cosp/MISR_simulator/MISR_simulator.F
+${top_builddir}/atmos_param/cosp/quickbeam/radar_simulator_types.lo: ${top_srcdir}/atmos_param/cosp/quickbeam/radar_simulator_types.F90
+${top_builddir}/atmos_param/cosp/quickbeam/array_lib.lo: ${top_srcdir}/atmos_param/cosp/quickbeam/array_lib.F90 \
+ ${top_srcdir}/atmos_param/cosp/quickbeam/mrgrnk.lo
+${top_builddir}/atmos_param/cosp/quickbeam/dsd.lo: ${top_srcdir}/atmos_param/cosp/quickbeam/dsd.F90 \
+ ${top_srcdir}/atmos_param/cosp/quickbeam/array_lib.lo \
+ ${top_srcdir}/atmos_param/cosp/quickbeam/math_lib.lo
+${top_builddir}/atmos_param/cosp/quickbeam/optics_lib.lo: ${top_srcdir}/atmos_param/cosp/quickbeam/optics_lib.F90
+${top_builddir}/atmos_param/cosp/quickbeam/gases.lo: ${top_srcdir}/atmos_param/cosp/quickbeam/gases.F90
+${top_builddir}/atmos_param/cosp/quickbeam/format_input.lo: ${top_srcdir}/atmos_param/cosp/quickbeam/format_input.F90 \
+ ${top_srcdir}/atmos_param/cosp/quickbeam/array_lib.lo
+${top_builddir}/atmos_param/cosp/quickbeam/mrgrnk.lo: ${top_srcdir}/atmos_param/cosp/quickbeam/mrgrnk.F90
+${top_builddir}/atmos_param/cosp/quickbeam/radar_simulator.lo: ${top_srcdir}/atmos_param/cosp/quickbeam/radar_simulator.F90 \
+ ${top_srcdir}/atmos_param/cosp/quickbeam/mrgrnk.lo \
+ ${top_srcdir}/atmos_param/cosp/quickbeam/array_lib.lo \
+ ${top_srcdir}/atmos_param/cosp/quickbeam/math_lib.lo \
+ ${top_srcdir}/atmos_param/cosp/quickbeam/optics_lib.lo \
+ ${top_srcdir}/atmos_param/cosp/quickbeam/radar_simulator_types.lo \
+ ${top_srcdir}/atmos_param/cosp/quickbeam/scale_LUTs_io.lo
+${top_builddir}/atmos_param/cosp/quickbeam/scale_LUTs_io.lo: ${top_srcdir}/atmos_param/cosp/quickbeam/scale_LUTs_io.F90 \
+ ${top_srcdir}/atmos_param/cosp/quickbeam/radar_simulator_types.lo
+${top_builddir}/atmos_param/cosp/quickbeam/zeff.lo: ${top_srcdir}/atmos_param/cosp/quickbeam/zeff.F90 \
+ ${top_srcdir}/atmos_param/cosp/quickbeam/math_lib.lo \
+ ${top_srcdir}/atmos_param/cosp/quickbeam/optics_lib.lo
+${top_builddir}/atmos_param/cosp/quickbeam/atmos_lib.lo: ${top_srcdir}/atmos_param/cosp/quickbeam/atmos_lib.F90
+${top_builddir}/atmos_param/cosp/quickbeam/calc_Re.lo: ${top_srcdir}/atmos_param/cosp/quickbeam/calc_Re.F90 \
+ ${top_srcdir}/atmos_param/cosp/quickbeam/math_lib.lo
+${top_builddir}/atmos_param/cosp/quickbeam/radar_simulator_init.lo: ${top_srcdir}/atmos_param/cosp/quickbeam/radar_simulator_init.F90 \
+ ${top_srcdir}/atmos_param/cosp/quickbeam/radar_simulator_types.lo
+${top_builddir}/atmos_param/cosp/quickbeam/math_lib.lo: ${top_srcdir}/atmos_param/cosp/quickbeam/math_lib.F90 \
+ ${top_srcdir}/atmos_param/cosp/quickbeam/mrgrnk.lo \
+ ${top_srcdir}/atmos_param/cosp/quickbeam/array_lib.lo
+${top_builddir}/atmos_param/cosp/llnl/prec_scops.lo: ${top_srcdir}/atmos_param/cosp/llnl/prec_scops.F
+${top_builddir}/atmos_param/cosp/llnl/cosp_radar.lo: ${top_srcdir}/atmos_param/cosp/llnl/cosp_radar.F90 \
+ ${top_srcdir}/atmos_param/cosp/cosp_constants.lo \
+ ${top_srcdir}/atmos_param/cosp/cosp_types.lo \
+ ${top_srcdir}/atmos_param/cosp/cosp_utils.lo \
+ ${top_srcdir}/atmos_param/cosp/quickbeam/radar_simulator_types.lo \
+ ${top_srcdir}/atmos_param/cosp/quickbeam/array_lib.lo \
+ ${top_srcdir}/atmos_param/cosp/quickbeam/atmos_lib.lo \
+ ${top_srcdir}/atmos_param/cosp/quickbeam/format_input.lo \
+ ${top_srcdir}/atmos_param/cosp/quickbeam/mrgrnk.lo \
+ ${top_srcdir}/atmos_param/cosp/quickbeam/math_lib.lo \
+ ${top_srcdir}/atmos_param/cosp/quickbeam/optics_lib.lo
+${top_builddir}/atmos_param/cosp/llnl/llnl_stats.lo: ${top_srcdir}/atmos_param/cosp/llnl/llnl_stats.F90 \
+ ${top_srcdir}/atmos_param/cosp/cosp_constants.lo
+${top_builddir}/atmos_param/cosp/llnl/pf_to_mr.lo: ${top_srcdir}/atmos_param/cosp/llnl/pf_to_mr.F
+${top_builddir}/atmos_param/cosp/icarus-scops-3.7/icarus.lo: ${top_srcdir}/atmos_param/cosp/icarus-scops-3.7/icarus.F90
+${top_builddir}/atmos_param/cosp/icarus-scops-3.7/scops.lo: ${top_srcdir}/atmos_param/cosp/icarus-scops-3.7/scops.F
+${top_builddir}/atmos_param/cosp/icarus-scops-3.7/isccp_cloud_types.lo: ${top_srcdir}/atmos_param/cosp/icarus-scops-3.7/isccp_cloud_types.F
+${top_builddir}/atmos_param/cosp/MODIS_simulator/modis_simulator.lo: ${top_srcdir}/atmos_param/cosp/MODIS_simulator/modis_simulator.F90 \
+ ${top_srcdir}/atmos_param/cosp/cosp_types.lo
+${top_builddir}/atmos_param/lscale_cond/lscale_cond.lo: ${top_srcdir}/atmos_param/lscale_cond/lscale_cond.F90
+${top_builddir}/atmos_param/entrain/entrain.lo: ${top_srcdir}/atmos_param/entrain/entrain.F90
+${top_builddir}/atmos_param/cg_drag/cg_drag.lo: ${top_srcdir}/atmos_param/cg_drag/cg_drag.F90
+${top_builddir}/atmos_param/cu_mo_trans/cu_mo_trans.lo: ${top_srcdir}/atmos_param/cu_mo_trans/cu_mo_trans.F90 \
+ ${top_srcdir}/atmos_param/convection_driver/convection_utilities.lo \
+ ${top_srcdir}/atmos_param/moist_processes/moist_processes_utils.lo
+${top_builddir}/atmos_param/cloud_rad/cloud_rad.lo: ${top_srcdir}/atmos_param/cloud_rad/cloud_rad.F90 \
+ ${top_srcdir}/atmos_param/microphysics/gamma_mg.lo \
+ ${top_srcdir}/atmos_param/lscloud_driver/lscloud_constants.lo \
+ ${top_srcdir}/atmos_shared/aerosol/aerosol_types.lo \
+ ${top_srcdir}/atmos_param/physics_radiation_exch/physics_radiation_exch.lo
+${top_builddir}/atmos_param/betts_miller/bm_omp.lo: ${top_srcdir}/atmos_param/betts_miller/bm_omp.F90
+${top_builddir}/atmos_param/betts_miller/betts_miller.lo: ${top_srcdir}/atmos_param/betts_miller/betts_miller.F90
+${top_builddir}/atmos_param/betts_miller/bm_massflux.lo: ${top_srcdir}/atmos_param/betts_miller/bm_massflux.F90
+${top_builddir}/atmos_param/vert_diff/vert_diff.lo: ${top_srcdir}/atmos_param/vert_diff/vert_diff.F90
+${top_builddir}/atmos_param/two_stream_gray_rad/two_stream_gray_rad.lo: ${top_srcdir}/atmos_param/two_stream_gray_rad/two_stream_gray_rad.F90
+${top_builddir}/atmos_param/aerosol_cloud/aerosol_cloud.lo: ${top_srcdir}/atmos_param/aerosol_cloud/aerosol_cloud.F90 \
+ ${top_srcdir}/atmos_shared/aerosol/aerosol_types.lo \
+ ${top_srcdir}/atmos_param/lscloud_driver/polysvp.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/aer_ccn_act/aerosol_params.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/aer_ccn_act/aer_ccn_act.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/aer_ccn_act/ice_nucl.lo \
+ ${top_srcdir}/atmos_param/lscloud_driver/lscloud_types.lo \
+ ${top_srcdir}/atmos_param/lscloud_driver/lscloud_debug.lo \
+ ${top_srcdir}/atmos_param/moist_processes/moist_processes_utils.lo \
+ ${top_srcdir}/atmos_param/physics_radiation_exch/physics_radiation_exch.lo
+${top_builddir}/atmos_param/rh_clouds/rh_clouds.lo: ${top_srcdir}/atmos_param/rh_clouds/rh_clouds.F90
+${top_builddir}/atmos_param/cloud_zonal/cloud_zonal.lo: ${top_srcdir}/atmos_param/cloud_zonal/cloud_zonal.F90
+${top_builddir}/atmos_param/donner_deep/donner_deep.lo: ${top_srcdir}/atmos_param/donner_deep/donner_deep.F90 \
+ ${top_srcdir}/atmos_param/donner_deep/donner_types.lo \
+ ${top_srcdir}/atmos_param/shallow_cu/conv_utilities_k.lo \
+ ${top_srcdir}/atmos_param/shallow_cu/conv_plumes_k.lo \
+ ${top_srcdir}/atmos_param/donner_deep/fms_donner.lo \
+ ${top_srcdir}/atmos_param/donner_deep/nonfms_donner.lo
+${top_builddir}/atmos_param/donner_deep/donner_deep_k.lo: ${top_srcdir}/atmos_param/donner_deep/donner_deep_k.F90 \
+ ${top_srcdir}/atmos_param/donner_deep/donner_types.lo \
+ ${top_srcdir}/atmos_param/shallow_cu/conv_utilities_k.lo \
+ ${top_srcdir}/atmos_param/shallow_cu/conv_plumes_k.lo
+${top_builddir}/atmos_param/donner_deep/donner_deep_miz.lo: ${top_srcdir}/atmos_param/donner_deep/donner_deep_miz.F90
+${top_builddir}/atmos_param/donner_deep/donner_cape_k.lo: ${top_srcdir}/atmos_param/donner_deep/donner_cape_k.F90 \
+ ${top_srcdir}/atmos_param/donner_deep/donner_types.lo
+${top_builddir}/atmos_param/donner_deep/fms_donner.lo: ${top_srcdir}/atmos_param/donner_deep/fms_donner.F90 \
+ ${top_srcdir}/atmos_shared/tracer_driver/atmos_tracer_utilities.lo \
+ ${top_srcdir}/atmos_param/donner_deep/donner_types.lo
+${top_builddir}/atmos_param/donner_deep/nonfms_donner.lo: ${top_srcdir}/atmos_param/donner_deep/nonfms_donner.F90 \
+ ${top_srcdir}/atmos_param/donner_deep/donner_types.lo
+${top_builddir}/atmos_param/donner_deep/donner_utilities_k.lo: ${top_srcdir}/atmos_param/donner_deep/donner_utilities_k.F90 \
+ ${top_srcdir}/atmos_param/donner_deep/donner_types.lo
+${top_builddir}/atmos_param/donner_deep/donner_meso_k.lo: ${top_srcdir}/atmos_param/donner_deep/donner_meso_k.F90 \
+ ${top_srcdir}/atmos_param/donner_deep/donner_types.lo
+${top_builddir}/atmos_param/donner_deep/donner_lite_k.lo: ${top_srcdir}/atmos_param/donner_deep/donner_lite_k.F90 \
+ ${top_srcdir}/atmos_param/donner_deep/donner_types.lo \
+ ${top_srcdir}/atmos_param/shallow_cu/conv_utilities_k.lo \
+ ${top_srcdir}/atmos_param/shallow_cu/conv_plumes_k.lo
+${top_builddir}/atmos_param/donner_deep/donner_rad_k.lo: ${top_srcdir}/atmos_param/donner_deep/donner_rad_k.F90 \
+ ${top_srcdir}/atmos_param/donner_deep/donner_types.lo
+${top_builddir}/atmos_param/donner_deep/donner_types.lo: ${top_srcdir}/atmos_param/donner_deep/donner_types.F90
+${top_builddir}/atmos_param/donner_deep/donner_cloud_model_k.lo: ${top_srcdir}/atmos_param/donner_deep/donner_cloud_model_k.F90 \
+ ${top_srcdir}/atmos_param/donner_deep/donner_types.lo
+${top_builddir}/atmos_param/donner_deep/donner_lscloud_k.lo: ${top_srcdir}/atmos_param/donner_deep/donner_lscloud_k.F90 \
+ ${top_srcdir}/atmos_param/donner_deep/donner_types.lo
+${top_builddir}/atmos_param/donner_deep/wet_deposition_0D.lo: ${top_srcdir}/atmos_param/donner_deep/wet_deposition_0D.F90
+${top_builddir}/atmos_param/donner_deep/cumulus_closure_k.lo: ${top_srcdir}/atmos_param/donner_deep/cumulus_closure_k.F90 \
+ ${top_srcdir}/atmos_param/donner_deep/donner_types.lo
+${top_builddir}/atmos_param/dry_adj/dry_adj.lo: ${top_srcdir}/atmos_param/dry_adj/dry_adj.F90
+${top_builddir}/atmos_param/tke_turb/tke_turb.lo: ${top_srcdir}/atmos_param/tke_turb/tke_turb.F90
+${top_builddir}/atmos_param/mg_drag/mg_drag.lo: ${top_srcdir}/atmos_param/mg_drag/mg_drag.F90
+${top_builddir}/atmos_param/clubb/alt_cloud.lo: ${top_srcdir}/atmos_param/clubb/alt_cloud.F90
+${top_builddir}/atmos_param/clubb/advance_sclrm_Nd_module.lo: ${top_srcdir}/atmos_param/clubb/advance_sclrm_Nd_module.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/clubb_precision.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/grid_class.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/parameters_model.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/lapack_wrap.lo
+${top_builddir}/atmos_param/clubb/CLUBB_3D_var.lo: ${top_srcdir}/atmos_param/clubb/CLUBB_3D_var.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/parameters_model.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/constants_clubb.lo
+${top_builddir}/atmos_param/clubb/CLUBB_driver_SCM.lo: ${top_srcdir}/atmos_param/clubb/CLUBB_driver_SCM.F90 \
+ ${top_srcdir}/atmos_shared/aerosol/aerosol_types.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/aer_ccn_act/aer_ccn_act.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/aer_ccn_act/aer_ccn_act_k.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/aer_ccn_act/ice_nucl.lo \
+ ${top_srcdir}/atmos_param/clubb/alt_cloud.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/clubb_core.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/clubb_precision.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/constants_clubb.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/error_code.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/grid_class.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/parameter_indices.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/parameters_model.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/parameters_tunable.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/stats_subs.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/stats_variables.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/T_in_K_module.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/variables_prognostic_module.lo \
+ ${top_srcdir}/atmos_param/lscloud_driver/polysvp.lo
+${top_builddir}/atmos_param/clubb/CLUBB_core/stats_rad_zm.lo: ${top_srcdir}/atmos_param/clubb/CLUBB_core/stats_rad_zm.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/constants_clubb.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/stats_variables.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/stats_type.lo
+${top_builddir}/atmos_param/clubb/CLUBB_core/array_index.lo: ${top_srcdir}/atmos_param/clubb/CLUBB_core/array_index.F90
+${top_builddir}/atmos_param/clubb/CLUBB_core/mono_flux_limiter.lo: ${top_srcdir}/atmos_param/clubb/CLUBB_core/mono_flux_limiter.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/grid_class.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/constants_clubb.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/clubb_precision.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/error_code.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/fill_holes.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/stats_type.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/stats_variables.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/mean_adv.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/lapack_wrap.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/anl_erf.lo
+${top_builddir}/atmos_param/clubb/CLUBB_core/stats_variables.lo: ${top_srcdir}/atmos_param/clubb/CLUBB_core/stats_variables.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/stats_type.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/clubb_precision.lo
+${top_builddir}/atmos_param/clubb/CLUBB_core/output_netcdf.lo: ${top_srcdir}/atmos_param/clubb/CLUBB_core/output_netcdf.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/stat_file_module.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/clubb_precision.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/constants_clubb.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/parameters_model.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/parameters_tunable.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/parameter_indices.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/model_flags.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/parameters_microphys.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/parameters_radiation.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/calendar.lo
+${top_builddir}/atmos_param/clubb/CLUBB_core/T_in_K_module.lo: ${top_srcdir}/atmos_param/clubb/CLUBB_core/T_in_K_module.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/constants_clubb.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/clubb_precision.lo
+${top_builddir}/atmos_param/clubb/CLUBB_core/error_code.lo: ${top_srcdir}/atmos_param/clubb/CLUBB_core/error_code.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/constants_clubb.lo
+${top_builddir}/atmos_param/clubb/CLUBB_core/variables_prognostic_module.lo: ${top_srcdir}/atmos_param/clubb/CLUBB_core/variables_prognostic_module.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/pdf_parameter_module.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/clubb_precision.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/constants_clubb.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/parameters_model.lo
+${top_builddir}/atmos_param/clubb/CLUBB_core/clip_explicit.lo: ${top_srcdir}/atmos_param/clubb/CLUBB_core/clip_explicit.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/grid_class.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/parameters_model.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/model_flags.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/clubb_precision.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/stats_type.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/stats_variables.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/constants_clubb.lo
+${top_builddir}/atmos_param/clubb/CLUBB_core/hyper_diffusion_4th_ord.lo: ${top_srcdir}/atmos_param/clubb/CLUBB_core/hyper_diffusion_4th_ord.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/clubb_precision.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/grid_class.lo
+${top_builddir}/atmos_param/clubb/CLUBB_core/diffusion.lo: ${top_srcdir}/atmos_param/clubb/CLUBB_core/diffusion.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/grid_class.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/clubb_precision.lo
+${top_builddir}/atmos_param/clubb/CLUBB_core/stats_zm.lo: ${top_srcdir}/atmos_param/clubb/CLUBB_core/stats_zm.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/constants_clubb.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/stats_variables.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/stats_type.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/parameters_model.lo
+${top_builddir}/atmos_param/clubb/CLUBB_core/mean_adv.lo: ${top_srcdir}/atmos_param/clubb/CLUBB_core/mean_adv.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/grid_class.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/model_flags.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/clubb_precision.lo
+${top_builddir}/atmos_param/clubb/CLUBB_core/advance_windm_edsclrm_module.lo: ${top_srcdir}/atmos_param/clubb/CLUBB_core/advance_windm_edsclrm_module.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/grid_class.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/parameters_model.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/parameters_tunable.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/model_flags.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/clubb_precision.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/stats_type.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/stats_variables.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/clip_explicit.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/error_code.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/constants_clubb.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/sponge_layer_damping.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/lapack_wrap.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/diffusion.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/mean_adv.lo
+${top_builddir}/atmos_param/clubb/CLUBB_core/parameters_microphys.lo: ${top_srcdir}/atmos_param/clubb/CLUBB_core/parameters_microphys.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/clubb_precision.lo
+${top_builddir}/atmos_param/clubb/CLUBB_core/clip_semi_implicit.lo: ${top_srcdir}/atmos_param/clubb/CLUBB_core/clip_semi_implicit.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/clubb_precision.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/constants_clubb.lo
+${top_builddir}/atmos_param/clubb/CLUBB_core/output_grads.lo: ${top_srcdir}/atmos_param/clubb/CLUBB_core/output_grads.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/clubb_precision.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/constants_clubb.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/stat_file_module.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/model_flags.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/endian.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/calendar.lo
+${top_builddir}/atmos_param/clubb/CLUBB_core/stat_file_module.lo: ${top_srcdir}/atmos_param/clubb/CLUBB_core/stat_file_module.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/clubb_precision.lo
+${top_builddir}/atmos_param/clubb/CLUBB_core/parameters_tunable.lo: ${top_srcdir}/atmos_param/clubb/CLUBB_core/parameters_tunable.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/parameter_indices.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/grid_class.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/clubb_precision.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/constants_clubb.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/error_code.lo
+${top_builddir}/atmos_param/clubb/CLUBB_core/pos_definite_module.lo: ${top_srcdir}/atmos_param/clubb/CLUBB_core/pos_definite_module.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/grid_class.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/constants_clubb.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/clubb_precision.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/error_code.lo
+${top_builddir}/atmos_param/clubb/CLUBB_core/advance_helper_module.lo: ${top_srcdir}/atmos_param/clubb/CLUBB_core/advance_helper_module.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/clubb_precision.lo
+${top_builddir}/atmos_param/clubb/CLUBB_core/stats_type.lo: ${top_srcdir}/atmos_param/clubb/CLUBB_core/stats_type.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/stat_file_module.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/clubb_precision.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/grid_class.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/error_code.lo
+${top_builddir}/atmos_param/clubb/CLUBB_core/corr_matrix_module.lo: ${top_srcdir}/atmos_param/clubb/CLUBB_core/corr_matrix_module.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/input_reader.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/matrix_operations.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/constants_clubb.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/clubb_precision.lo
+${top_builddir}/atmos_param/clubb/CLUBB_core/clubb_precision.lo: ${top_srcdir}/atmos_param/clubb/CLUBB_core/clubb_precision.F90
+${top_builddir}/atmos_param/clubb/CLUBB_core/advance_xm_wpxp_module.lo: ${top_srcdir}/atmos_param/clubb/CLUBB_core/advance_xm_wpxp_module.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/parameters_tunable.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/constants_clubb.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/parameters_model.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/grid_class.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/model_flags.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/mono_flux_limiter.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/pdf_parameter_module.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/clubb_precision.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/error_code.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/stats_type.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/stats_variables.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/sponge_layer_damping.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/diffusion.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/mean_adv.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/clip_semi_implicit.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/advance_helper_module.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/lapack_wrap.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/pos_definite_module.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/clip_explicit.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/fill_holes.lo
+${top_builddir}/atmos_param/clubb/CLUBB_core/lapack_wrap.lo: ${top_srcdir}/atmos_param/clubb/CLUBB_core/lapack_wrap.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/constants_clubb.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/error_code.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/clubb_precision.lo
+${top_builddir}/atmos_param/clubb/CLUBB_core/numerical_check.lo: ${top_srcdir}/atmos_param/clubb/CLUBB_core/numerical_check.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/grid_class.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/clubb_precision.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/parameters_model.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/pdf_parameter_module.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/stats_variables.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/constants_clubb.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/variables_diagnostic_module.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/variables_prognostic_module.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/parameters_microphys.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/error_code.lo
+${top_builddir}/atmos_param/clubb/CLUBB_core/input_reader.lo: ${top_srcdir}/atmos_param/clubb/CLUBB_core/input_reader.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/clubb_precision.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/constants_clubb.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/input_names.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/interpolation.lo
+${top_builddir}/atmos_param/clubb/CLUBB_core/parameters_model.lo: ${top_srcdir}/atmos_param/clubb/CLUBB_core/parameters_model.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/clubb_precision.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/constants_clubb.lo
+${top_builddir}/atmos_param/clubb/CLUBB_core/input_names.lo: ${top_srcdir}/atmos_param/clubb/CLUBB_core/input_names.F90
+${top_builddir}/atmos_param/clubb/CLUBB_core/stats_LH_zt.lo: ${top_srcdir}/atmos_param/clubb/CLUBB_core/stats_LH_zt.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/constants_clubb.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/stats_variables.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/stats_type.lo
+${top_builddir}/atmos_param/clubb/CLUBB_core/stats_zt.lo: ${top_srcdir}/atmos_param/clubb/CLUBB_core/stats_zt.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/constants_clubb.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/stats_variables.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/stats_type.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/parameters_model.lo
+${top_builddir}/atmos_param/clubb/CLUBB_core/parameters_radiation.lo: ${top_srcdir}/atmos_param/clubb/CLUBB_core/parameters_radiation.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/clubb_precision.lo
+${top_builddir}/atmos_param/clubb/CLUBB_core/stats_subs.lo: ${top_srcdir}/atmos_param/clubb/CLUBB_core/stats_subs.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/stats_variables.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/clubb_precision.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/output_grads.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/output_netcdf.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/stats_zm.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/stats_zt.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/stats_LH_zt.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/stats_rad_zt.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/stats_rad_zm.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/stats_sfc.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/error_code.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/constants_clubb.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/parameters_microphys.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/grid_class.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/variables_diagnostic_module.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/pdf_parameter_module.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/T_in_K_module.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/parameters_model.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/stats_type.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/fill_holes.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/interpolation.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/saturation.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/array_index.lo
+${top_builddir}/atmos_param/clubb/CLUBB_core/csr_matrix_class_3array.lo: ${top_srcdir}/atmos_param/clubb/CLUBB_core/csr_matrix_class_3array.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/constants_clubb.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/grid_class.lo
+${top_builddir}/atmos_param/clubb/CLUBB_core/fill_holes.lo: ${top_srcdir}/atmos_param/clubb/CLUBB_core/fill_holes.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/grid_class.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/clubb_precision.lo
+${top_builddir}/atmos_param/clubb/CLUBB_core/stats_sfc.lo: ${top_srcdir}/atmos_param/clubb/CLUBB_core/stats_sfc.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/constants_clubb.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/stats_variables.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/stats_type.lo
+${top_builddir}/atmos_param/clubb/CLUBB_core/surface_varnce_module.lo: ${top_srcdir}/atmos_param/clubb/CLUBB_core/surface_varnce_module.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/parameters_model.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/constants_clubb.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/numerical_check.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/error_code.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/array_index.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/stats_type.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/clubb_precision.lo
+${top_builddir}/atmos_param/clubb/CLUBB_core/file_functions.lo: ${top_srcdir}/atmos_param/clubb/CLUBB_core/file_functions.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/clubb_precision.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/constants_clubb.lo
+${top_builddir}/atmos_param/clubb/CLUBB_core/advance_xp2_xpyp_module.lo: ${top_srcdir}/atmos_param/clubb/CLUBB_core/advance_xp2_xpyp_module.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/constants_clubb.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/model_flags.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/parameters_tunable.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/parameters_model.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/grid_class.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/clubb_precision.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/clip_explicit.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/stats_type.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/error_code.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/stats_variables.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/array_index.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/diffusion.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/mean_adv.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/advance_helper_module.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/lapack_wrap.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/interpolation.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/fill_holes.lo
+${top_builddir}/atmos_param/clubb/CLUBB_core/clubb_core.lo: ${top_srcdir}/atmos_param/clubb/CLUBB_core/clubb_core.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/constants_clubb.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/parameters_tunable.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/parameters_model.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/model_flags.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/grid_class.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/numerical_check.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/variables_diagnostic_module.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/pdf_parameter_module.lo \
+ ${top_srcdir}/atmos_param/clubb/advance_sclrm_Nd_module.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/advance_xm_wpxp_module.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/advance_xp2_xpyp_module.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/surface_varnce_module.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/pdf_closure_module.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/mixing_length.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/advance_windm_edsclrm_module.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/saturation.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/advance_wp2_wp3_module.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/clubb_precision.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/error_code.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/Skw_module.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/clip_explicit.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/T_in_K_module.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/stats_subs.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/stats_type.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/stats_variables.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/fill_holes.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/sigma_sqd_w_module.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/parameter_indices.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/variables_prognostic_module.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/csr_matrix_class_3array.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/gmres_wrap.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/gmres_cache.lo
+${top_builddir}/atmos_param/clubb/CLUBB_core/stats_rad_zt.lo: ${top_srcdir}/atmos_param/clubb/CLUBB_core/stats_rad_zt.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/constants_clubb.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/stats_variables.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/stats_type.lo
+${top_builddir}/atmos_param/clubb/CLUBB_core/constants_clubb.lo: ${top_srcdir}/atmos_param/clubb/CLUBB_core/constants_clubb.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/clubb_precision.lo
+${top_builddir}/atmos_param/clubb/CLUBB_core/mixing_length.lo: ${top_srcdir}/atmos_param/clubb/CLUBB_core/mixing_length.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/constants_clubb.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/parameters_tunable.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/parameters_model.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/grid_class.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/numerical_check.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/saturation.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/error_code.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/model_flags.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/clubb_precision.lo
+${top_builddir}/atmos_param/clubb/CLUBB_core/variables_radiation_module.lo: ${top_srcdir}/atmos_param/clubb/CLUBB_core/variables_radiation_module.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/clubb_precision.lo
+${top_builddir}/atmos_param/clubb/CLUBB_core/Skw_module.lo: ${top_srcdir}/atmos_param/clubb/CLUBB_core/Skw_module.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/constants_clubb.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/clubb_precision.lo
+${top_builddir}/atmos_param/clubb/CLUBB_core/extrapolation.lo: ${top_srcdir}/atmos_param/clubb/CLUBB_core/extrapolation.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/clubb_precision.lo
+${top_builddir}/atmos_param/clubb/CLUBB_core/matrix_operations.lo: ${top_srcdir}/atmos_param/clubb/CLUBB_core/matrix_operations.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/clubb_precision.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/error_code.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/constants_clubb.lo
+${top_builddir}/atmos_param/clubb/CLUBB_core/advance_wp2_wp3_module.lo: ${top_srcdir}/atmos_param/clubb/CLUBB_core/advance_wp2_wp3_module.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/grid_class.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/parameters_tunable.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/stats_type.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/stats_variables.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/constants_clubb.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/model_flags.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/clubb_precision.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/error_code.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/lapack_wrap.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/fill_holes.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/clip_explicit.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/csr_matrix_class_3array.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/gmres_wrap.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/gmres_cache.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/diffusion.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/mean_adv.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/hyper_diffusion_4th_ord.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/advance_helper_module.lo
+${top_builddir}/atmos_param/clubb/CLUBB_core/pdf_closure_module.lo: ${top_srcdir}/atmos_param/clubb/CLUBB_core/pdf_closure_module.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/constants_clubb.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/parameters_model.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/parameters_tunable.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/pdf_parameter_module.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/anl_erf.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/numerical_check.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/saturation.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/error_code.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/stats_variables.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/clubb_precision.lo
+${top_builddir}/atmos_param/clubb/CLUBB_core/mt95.lo: ${top_srcdir}/atmos_param/clubb/CLUBB_core/mt95.f90
+${top_builddir}/atmos_param/clubb/CLUBB_core/grid_class.lo: ${top_srcdir}/atmos_param/clubb/CLUBB_core/grid_class.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/clubb_precision.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/constants_clubb.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/error_code.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/file_functions.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/interpolation.lo
+${top_builddir}/atmos_param/clubb/CLUBB_core/gmres_cache.lo: ${top_srcdir}/atmos_param/clubb/CLUBB_core/gmres_cache.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/clubb_precision.lo
+${top_builddir}/atmos_param/clubb/CLUBB_core/model_flags.lo: ${top_srcdir}/atmos_param/clubb/CLUBB_core/model_flags.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/constants_clubb.lo
+${top_builddir}/atmos_param/clubb/CLUBB_core/endian.lo: ${top_srcdir}/atmos_param/clubb/CLUBB_core/endian.F90
+${top_builddir}/atmos_param/clubb/CLUBB_core/calendar.lo: ${top_srcdir}/atmos_param/clubb/CLUBB_core/calendar.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/clubb_precision.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/constants_clubb.lo
+${top_builddir}/atmos_param/clubb/CLUBB_core/parameter_indices.lo: ${top_srcdir}/atmos_param/clubb/CLUBB_core/parameter_indices.F90
+${top_builddir}/atmos_param/clubb/CLUBB_core/pdf_parameter_module.lo: ${top_srcdir}/atmos_param/clubb/CLUBB_core/pdf_parameter_module.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/clubb_precision.lo
+${top_builddir}/atmos_param/clubb/CLUBB_core/sponge_layer_damping.lo: ${top_srcdir}/atmos_param/clubb/CLUBB_core/sponge_layer_damping.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/clubb_precision.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/grid_class.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/constants_clubb.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/interpolation.lo
+${top_builddir}/atmos_param/clubb/CLUBB_core/sigma_sqd_w_module.lo: ${top_srcdir}/atmos_param/clubb/CLUBB_core/sigma_sqd_w_module.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/constants_clubb.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/clubb_precision.lo
+${top_builddir}/atmos_param/clubb/CLUBB_core/gmres_wrap.lo: ${top_srcdir}/atmos_param/clubb/CLUBB_core/gmres_wrap.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/gmres_cache.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/clubb_precision.lo
+${top_builddir}/atmos_param/clubb/CLUBB_core/anl_erf.lo: ${top_srcdir}/atmos_param/clubb/CLUBB_core/anl_erf.F90
+${top_builddir}/atmos_param/clubb/CLUBB_core/interpolation.lo: ${top_srcdir}/atmos_param/clubb/CLUBB_core/interpolation.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/clubb_precision.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/constants_clubb.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/model_flags.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/error_code.lo
+${top_builddir}/atmos_param/clubb/CLUBB_core/saturation.lo: ${top_srcdir}/atmos_param/clubb/CLUBB_core/saturation.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/model_flags.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/clubb_precision.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/constants_clubb.lo
+${top_builddir}/atmos_param/clubb/CLUBB_core/hydrostatic_module.lo: ${top_srcdir}/atmos_param/clubb/CLUBB_core/hydrostatic_module.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/constants_clubb.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/grid_class.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/clubb_precision.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/interpolation.lo
+${top_builddir}/atmos_param/clubb/CLUBB_core/variables_diagnostic_module.lo: ${top_srcdir}/atmos_param/clubb/CLUBB_core/variables_diagnostic_module.F90 \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/pdf_parameter_module.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/clubb_precision.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/constants_clubb.lo \
+ ${top_srcdir}/atmos_param/clubb/CLUBB_core/parameters_model.lo
+${top_builddir}/atmos_param/vert_turb_driver/vert_turb_driver.lo: ${top_srcdir}/atmos_param/vert_turb_driver/vert_turb_driver.F90 \
+ ${top_srcdir}/atmos_param/my25_turb/my25_turb.lo \
+ ${top_srcdir}/atmos_param/tke_turb/tke_turb.lo \
+ ${top_srcdir}/atmos_param/diffusivity/diffusivity.lo \
+ ${top_srcdir}/atmos_param/edt/edt.lo \
+ ${top_srcdir}/atmos_param/physics_radiation_exch/physics_radiation_exch.lo \
+ ${top_srcdir}/atmos_param/physics_driver/physics_types.lo \
+ ${top_srcdir}/atmos_param/shallow_conv/shallow_conv.lo \
+ ${top_srcdir}/atmos_param/stable_bl_turb/stable_bl_turb.lo \
+ ${top_srcdir}/atmos_param/entrain/entrain.lo \
+ ${top_srcdir}/atmos_param/moist_processes/moist_processes_utils.lo \
+ ${top_srcdir}/atmos_shared/atmos_cmip_diag/atmos_cmip_diag.lo
+${top_builddir}/atmos_param/shallow_cu/conv_plumes_k.lo: ${top_srcdir}/atmos_param/shallow_cu/conv_plumes_k.F90 \
+ ${top_srcdir}/atmos_shared/tracer_driver/aer_ccn_act/aer_ccn_act_k.lo \
+ ${top_srcdir}/atmos_param/shallow_cu/conv_utilities_k.lo
+${top_builddir}/atmos_param/shallow_cu/deep_conv.lo: ${top_srcdir}/atmos_param/shallow_cu/deep_conv.F90 \
+ ${top_srcdir}/atmos_param/shallow_cu/conv_utilities.lo \
+ ${top_srcdir}/atmos_param/shallow_cu/conv_utilities_k.lo \
+ ${top_srcdir}/atmos_param/shallow_cu/conv_plumes_k.lo \
+ ${top_srcdir}/atmos_param/shallow_cu/conv_closures.lo
+${top_builddir}/atmos_param/shallow_cu/conv_closures.lo: ${top_srcdir}/atmos_param/shallow_cu/conv_closures.F90 \
+ ${top_srcdir}/atmos_param/shallow_cu/conv_utilities_k.lo \
+ ${top_srcdir}/atmos_param/shallow_cu/conv_plumes_k.lo
+${top_builddir}/atmos_param/shallow_cu/conv_plumes.lo: ${top_srcdir}/atmos_param/shallow_cu/conv_plumes.F90
+${top_builddir}/atmos_param/shallow_cu/conv_utilities_k.lo: ${top_srcdir}/atmos_param/shallow_cu/conv_utilities_k.F90
+${top_builddir}/atmos_param/shallow_cu/conv_utilities.lo: ${top_srcdir}/atmos_param/shallow_cu/conv_utilities.F90 \
+ ${top_srcdir}/atmos_param/shallow_cu/conv_utilities_k.lo
+${top_builddir}/atmos_param/shallow_cu/uw_conv.lo: ${top_srcdir}/atmos_param/shallow_cu/uw_conv.F90 \
+ ${top_srcdir}/atmos_shared/atmos_cmip_diag/atmos_cmip_diag.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/atmos_tracer_utilities.lo \
+ ${top_srcdir}/atmos_param/moist_processes/moist_processes_utils.lo \
+ ${top_srcdir}/atmos_shared/aerosol/aerosol_types.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/aer_ccn_act/aer_ccn_act.lo \
+ ${top_srcdir}/atmos_param/shallow_cu/conv_utilities.lo \
+ ${top_srcdir}/atmos_param/shallow_cu/conv_utilities_k.lo \
+ ${top_srcdir}/atmos_param/shallow_cu/conv_plumes_k.lo \
+ ${top_srcdir}/atmos_param/shallow_cu/conv_closures.lo \
+ ${top_srcdir}/atmos_param/shallow_cu/deep_conv.lo
+${top_builddir}/atmos_param/ras/ras.lo: ${top_srcdir}/atmos_param/ras/ras.F90 \
+ ${top_srcdir}/atmos_shared/aerosol/aerosol_types.lo \
+ ${top_srcdir}/atmos_shared/tracer_driver/aer_ccn_act/aer_ccn_act.lo \
+ ${top_srcdir}/atmos_param/moist_processes/moist_processes_utils.lo
+atmos_nudge_mod.mod: ${top_srcdir}/atmos_shared/atmos_nudge/atmos_nudge.lo
+atmos_global_diag_mod.mod: ${top_srcdir}/atmos_shared/atmos_cmip_diag/atmos_global_diag.lo
+atmos_cmip_diag_mod.mod: ${top_srcdir}/atmos_shared/atmos_cmip_diag/atmos_cmip_diag.lo
+vert_advection_mod.mod: ${top_srcdir}/atmos_shared/vert_advection/vert_advection.lo
+aerosol_mod.mod: ${top_srcdir}/atmos_shared/aerosol/aerosol.lo
+aerosol_types_mod.mod: ${top_srcdir}/atmos_shared/aerosol/aerosol_types.lo
+atmos_convection_tracer_mod.mod: ${top_srcdir}/atmos_shared/tracer_driver/atmos_convection_tracer.lo
+atmos_sulfur_hex_mod.mod: ${top_srcdir}/atmos_shared/tracer_driver/atmos_sulfur_hex.lo
+atmos_tracer_driver_mod.mod: ${top_srcdir}/atmos_shared/tracer_driver/atmos_tracer_driver.lo
+atmos_sea_salt_mod.mod: ${top_srcdir}/atmos_shared/tracer_driver/atmos_sea_salt.lo
+atmos_tracer_utilities_mod.mod: ${top_srcdir}/atmos_shared/tracer_driver/atmos_tracer_utilities.lo
+atmos_co2_mod.mod: ${top_srcdir}/atmos_shared/tracer_driver/atmos_co2.lo
+tropchem_driver_mod.mod: ${top_srcdir}/atmos_shared/tracer_driver/tropchem_driver.lo
+atmos_dust_mod.mod: ${top_srcdir}/atmos_shared/tracer_driver/atmos_dust.lo
+atmos_tropopause_mod.mod: ${top_srcdir}/atmos_shared/tracer_driver/atmos_tropopause.lo
+atmos_sulfate_mod.mod: ${top_srcdir}/atmos_shared/tracer_driver/atmos_sulfate.lo
+atmos_radon_mod.mod: ${top_srcdir}/atmos_shared/tracer_driver/atmos_radon.lo
+atmos_nh3_tag_mod.mod: ${top_srcdir}/atmos_shared/tracer_driver/atmos_nh3_tag.lo
+atmos_soa_mod.mod: ${top_srcdir}/atmos_shared/tracer_driver/atmos_soa.lo
+atmos_ch4_mod.mod: ${top_srcdir}/atmos_shared/tracer_driver/atmos_ch4.lo
+atmos_regional_tracer_driver_mod.mod: ${top_srcdir}/atmos_shared/tracer_driver/atmos_regional_tracer_driver.lo
+cloud_chem.mod: ${top_srcdir}/atmos_shared/tracer_driver/cloud_chem.lo
+atmos_age_tracer_mod.mod: ${top_srcdir}/atmos_shared/tracer_driver/atmos_age_tracer.lo
+mo_setsox_mod.mod: ${top_srcdir}/atmos_shared/tracer_driver/mo_setsox.lo
+atmos_ch3i_mod.mod: ${top_srcdir}/atmos_shared/tracer_driver/atmos_ch3i.lo
+xactive_bvoc_mod.mod: ${top_srcdir}/atmos_shared/tracer_driver/xactive_bvoc.lo
+atmos_carbon_aerosol_mod.mod: ${top_srcdir}/atmos_shared/tracer_driver/atmos_carbon_aerosol.lo
+strat_chem_mod.mod: ${top_srcdir}/atmos_shared/tracer_driver/stratchem/strat_chem_model.lo
+strat_chem_driver_mod.mod: ${top_srcdir}/atmos_shared/tracer_driver/stratchem/strat_chem_driver.lo
+mo_chemini_mod.mod: ${top_srcdir}/atmos_shared/tracer_driver/tropchem/mo_chemini.lo
+mo_jpl_mod.mod: ${top_srcdir}/atmos_shared/tracer_driver/tropchem/mo_jpl.lo
+mo_exp_sol_mod.mod: ${top_srcdir}/atmos_shared/tracer_driver/tropchem/mo_exp_slv.lo
+mo_chem_utls_mod.mod: ${top_srcdir}/atmos_shared/tracer_driver/tropchem/mo_chem_utls.lo
+tropchem_types_mod.mod: ${top_srcdir}/atmos_shared/tracer_driver/tropchem/tropchem_types_mod.lo
+mo_usrrxt_mod.mod: ${top_srcdir}/atmos_shared/tracer_driver/tropchem/mo_usrrxt.lo
+mo_photo_mod.mod: ${top_srcdir}/atmos_shared/tracer_driver/tropchem/mo_photo.lo
+aerosol_thermodynamics.mod: ${top_srcdir}/atmos_shared/tracer_driver/tropchem/aerosol_thermodynamics.lo
+mo_chemdr_mod.mod: ${top_srcdir}/atmos_shared/tracer_driver/tropchem/mo_chemdr.lo
+strat_chem_utilities_mod.mod: ${top_srcdir}/atmos_shared/tracer_driver/tropchem/strat_chem_utilities.lo
+mo_imp_sol_mod.mod: ${top_srcdir}/atmos_shared/tracer_driver/tropchem/mo_imp_slv.lo
+moz_hook_mod.mod: ${top_srcdir}/atmos_shared/tracer_driver/tropchem/mo_hook.lo
+mo_setinv_mod.mod: ${top_srcdir}/atmos_shared/tracer_driver/tropchem/mo_setinv.lo
+mo_rodas_sol_mod.mod: ${top_srcdir}/atmos_shared/tracer_driver/tropchem/mo_rodas_slv.lo
+mo_read_sim_chm_mod.mod: ${top_srcdir}/atmos_shared/tracer_driver/tropchem/mo_read_sim_chm.lo
+m_tracname_mod.mod: ${top_srcdir}/atmos_shared/tracer_driver/tropchem/m_tracname.lo
+am3_mo_grid_mod.mod: ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM3_chem/AM3.mods.lo
+am3_chem_mods_mod.mod: ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM3_chem/AM3.mods.lo
+am3_m_spc_id_mod.mod: ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM3_chem/AM3.mods.lo
+am3_m_rxt_id_mod.mod: ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM3_chem/AM3.mods.lo
+am3_m_het_id_mod.mod: ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM3_chem/AM3.mods.lo
+am3_fphoto_mod.mod: ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM3_chem/AM3_fphoto.lo
+am3_fastjx_mod.mod: ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM3_chem/AM3_fastjx.lo
+am3_mo_setrxt_mod.mod: ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM3_chem/AM3.subs.lo
+am3_mo_adjrxt_mod.mod: ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM3_chem/AM3.subs.lo
+am3_mo_phtadj_mod.mod: ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM3_chem/AM3.subs.lo
+am3_mo_rxt_mod.mod: ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM3_chem/AM3.subs.lo
+am3_mo_make_grp_vmr_mod.mod: ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM3_chem/AM3.subs.lo
+am3_mo_exp_prod_loss_mod.mod: ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM3_chem/AM3.mat.lo
+am3_mo_imp_prod_loss_mod.mod: ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM3_chem/AM3.mat.lo
+am3_mo_rodas_prod_loss_mod.mod: ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM3_chem/AM3.mat.lo
+am3_mo_indprd_mod.mod: ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM3_chem/AM3.mat.lo
+am3_mo_imp_lin_matrix_mod.mod: ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM3_chem/AM3.mat.lo
+am3_mo_rod_lin_matrix_mod.mod: ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM3_chem/AM3.mat.lo
+am3_mo_imp_nln_matrix_mod.mod: ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM3_chem/AM3.mat.lo
+am3_mo_rod_nln_matrix_mod.mod: ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM3_chem/AM3.mat.lo
+am3_mo_imp_factor_mod.mod: ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM3_chem/AM3.mat.lo
+am3_mo_rod_factor_mod.mod: ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM3_chem/AM3.mat.lo
+am3_mo_imp_solve_mod.mod: ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM3_chem/AM3.mat.lo
+am3_mo_rod_solve_mod.mod: ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM3_chem/AM3.mat.lo
+mo_grid_mod.mod: ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM4_chem/moz.mods.lo
+chem_mods_mod.mod: ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM4_chem/moz.mods.lo
+m_spc_id_mod.mod: ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM4_chem/moz.mods.lo
+m_rxt_id_mod.mod: ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM4_chem/moz.mods.lo
+m_het_id_mod.mod: ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM4_chem/moz.mods.lo
+mo_fphoto_mod.mod: ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM4_chem/mo_fphoto.lo
+mo_exp_prod_loss_mod.mod: ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM4_chem/moz.mat.lo
+mo_imp_prod_loss_mod.mod: ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM4_chem/moz.mat.lo
+mo_rodas_prod_loss_mod.mod: ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM4_chem/moz.mat.lo
+mo_indprd_mod.mod: ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM4_chem/moz.mat.lo
+mo_imp_lin_matrix_mod.mod: ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM4_chem/moz.mat.lo
+mo_rod_lin_matrix_mod.mod: ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM4_chem/moz.mat.lo
+mo_imp_nln_matrix_mod.mod: ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM4_chem/moz.mat.lo
+mo_rod_nln_matrix_mod.mod: ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM4_chem/moz.mat.lo
+mo_imp_factor_mod.mod: ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM4_chem/moz.mat.lo
+mo_rod_factor_mod.mod: ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM4_chem/moz.mat.lo
+mo_imp_solve_mod.mod: ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM4_chem/moz.mat.lo
+mo_rod_solve_mod.mod: ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM4_chem/moz.mat.lo
+mo_setrxt_mod.mod: ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM4_chem/moz.subs.lo
+mo_adjrxt_mod.mod: ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM4_chem/moz.subs.lo
+mo_phtadj_mod.mod: ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM4_chem/moz.subs.lo
+mo_rxt_mod.mod: ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM4_chem/moz.subs.lo
+mo_make_grp_vmr_mod.mod: ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM4_chem/moz.subs.lo
+mo_fastjx_mod.mod: ${top_srcdir}/atmos_shared/tracer_driver/tropchem/AM4_chem/mo_fastjx.lo
+aer_ccn_act_mod.mod: ${top_srcdir}/atmos_shared/tracer_driver/aer_ccn_act/aer_ccn_act.lo
+aer_in_act_mod.mod: ${top_srcdir}/atmos_shared/tracer_driver/aer_ccn_act/aer_in_act.lo
+aer_ccn_act_k_mod.mod: ${top_srcdir}/atmos_shared/tracer_driver/aer_ccn_act/aer_ccn_act_k.lo
+ice_nucl_mod.mod: ${top_srcdir}/atmos_shared/tracer_driver/aer_ccn_act/ice_nucl.lo
+aerosol_params_mod.mod: ${top_srcdir}/atmos_shared/tracer_driver/aer_ccn_act/aerosol_params.lo
+physics_types_mod.mod: ${top_srcdir}/atmos_param/physics_driver/physics_types.lo
+physics_driver_mod.mod: ${top_srcdir}/atmos_param/physics_driver/physics_driver.lo
+diag_cloud_mod.mod: ${top_srcdir}/atmos_param/diag_cloud/diag_cloud.lo
+grey_radiation_mod.mod: ${top_srcdir}/atmos_param/grey_radiation/grey_radiation.lo
+diffusivity_mod.mod: ${top_srcdir}/atmos_param/diffusivity/diffusivity.lo
+topo_drag_mod.mod: ${top_srcdir}/atmos_param/topo_drag/topo_drag.lo
+ls_cloud_macrophysics_mod.mod: ${top_srcdir}/atmos_param/macrophysics/ls_cloud_macrophysics.lo
+tiedtke_macro_mod.mod: ${top_srcdir}/atmos_param/macrophysics/tiedtke_macro.lo
+moist_conv_mod.mod: ${top_srcdir}/atmos_param/moist_conv/moist_conv.lo
+cloudrad_types_mod.mod: ${top_srcdir}/atmos_param/radiation/clouds/cloudrad_types.lo
+microphys_rad_mod.mod: ${top_srcdir}/atmos_param/radiation/clouds/microphys_rad.lo
+strat_clouds_w_mod.mod: ${top_srcdir}/atmos_param/radiation/clouds/strat_clouds_W.lo
+isccp_clouds_mod.mod: ${top_srcdir}/atmos_param/radiation/clouds/isccp_clouds.lo
+random_number_streams_mod.mod: ${top_srcdir}/atmos_param/radiation/clouds/get_random_number_stream.lo
+bulkphys_rad_mod.mod: ${top_srcdir}/atmos_param/radiation/clouds/bulkphys_rad.lo
+uw_clouds_w_mod.mod: ${top_srcdir}/atmos_param/radiation/clouds/uw_clouds_W.lo
+cloudrad_driver_mod.mod: ${top_srcdir}/atmos_param/radiation/clouds/cloudrad_driver.lo
+cloud_spec_mod.mod: ${top_srcdir}/atmos_param/radiation/clouds/cloud_spec.lo
+donner_deep_clouds_w_mod.mod: ${top_srcdir}/atmos_param/radiation/clouds/donner_deep_clouds_W.lo
+cloudrad_diagnostics_mod.mod: ${top_srcdir}/atmos_param/radiation/clouds/cloudrad_diagnostics.lo
+cloudrad_package_mod.mod: ${top_srcdir}/atmos_param/radiation/clouds/cloudrad_package.lo
+longwave_tables_mod.mod: ${top_srcdir}/atmos_param/radiation/longwave/longwave_tables.lo
+longwave_clouds_mod.mod: ${top_srcdir}/atmos_param/radiation/longwave/longwave_clouds.lo
+gas_tf_mod.mod: ${top_srcdir}/atmos_param/radiation/longwave/gas_tf.lo
+longwave_params_mod.mod: ${top_srcdir}/atmos_param/radiation/longwave/longwave_params.lo
+sealw99_mod.mod: ${top_srcdir}/atmos_param/radiation/longwave/sealw99.lo
+optical_path_mod.mod: ${top_srcdir}/atmos_param/radiation/longwave/optical_path.lo
+longwave_types_mod.mod: ${top_srcdir}/atmos_param/radiation/longwave/longwave_types.lo
+longwave_utilities_mod.mod: ${top_srcdir}/atmos_param/radiation/longwave/longwave_utilities.lo
+longwave_fluxes_mod.mod: ${top_srcdir}/atmos_param/radiation/longwave/longwave_fluxes.lo
+lw_gases_stdtf_mod.mod: ${top_srcdir}/atmos_param/radiation/longwave/lw_gases_stdtf.lo
+aerosolrad_types_mod.mod: ${top_srcdir}/atmos_param/radiation/aerosols/aerosolrad_types.lo
+aerosolrad_package_mod.mod: ${top_srcdir}/atmos_param/radiation/aerosols/aerosolrad_package.lo
+aerosolrad_driver_mod.mod: ${top_srcdir}/atmos_param/radiation/aerosols/aerosolrad_driver.lo
+esfsw_driver_mod.mod: ${top_srcdir}/atmos_param/radiation/shortwave/esfsw_driver.lo
+esfsw_utilities_mod.mod: ${top_srcdir}/atmos_param/radiation/shortwave/esfsw_utilities.lo
+shortwave_types_mod.mod: ${top_srcdir}/atmos_param/radiation/shortwave/shortwave_types.lo
+esfsw_bands_mod.mod: ${top_srcdir}/atmos_param/radiation/shortwave/esfsw_bands.lo
+esfsw_parameters_mod.mod: ${top_srcdir}/atmos_param/radiation/shortwave/esfsw_parameters.lo
+radiative_gases_mod.mod: ${top_srcdir}/atmos_param/radiation/radiative_gases/radiative_gases.lo
+radiative_gases_types_mod.mod: ${top_srcdir}/atmos_param/radiation/radiative_gases/radiative_gases_types.lo
+ozone_mod.mod: ${top_srcdir}/atmos_param/radiation/radiative_gases/ozone.lo
+radiation_diag_mod.mod: ${top_srcdir}/atmos_param/radiation/util/radiation_diag.lo
+longwave_driver_mod.mod: ${top_srcdir}/atmos_param/radiation/driver/longwave_driver.lo
+rad_output_file_mod.mod: ${top_srcdir}/atmos_param/radiation/driver/rad_output_file.lo
+radiation_driver_types_mod.mod: ${top_srcdir}/atmos_param/radiation/driver/radiation_driver_types.lo
+radiation_types_mod.mod: ${top_srcdir}/atmos_param/radiation/driver/radiation_types.lo
+solar_data_driver_mod.mod: ${top_srcdir}/atmos_param/radiation/driver/solar_data_driver.lo
+shortwave_driver_mod.mod: ${top_srcdir}/atmos_param/radiation/driver/shortwave_driver.lo
+radiation_driver_diag_mod.mod: ${top_srcdir}/atmos_param/radiation/driver/radiation_driver_diag.lo
+radiation_driver_mod.mod: ${top_srcdir}/atmos_param/radiation/driver/radiation_driver.lo
+edt_mod.mod: ${top_srcdir}/atmos_param/edt/edt.lo
+convection_utilities_mod.mod: ${top_srcdir}/atmos_param/convection_driver/convection_utilities.lo
+detr_ice_num_mod.mod: ${top_srcdir}/atmos_param/convection_driver/detr_ice_num.lo
+convection_driver_mod.mod: ${top_srcdir}/atmos_param/convection_driver/convection_driver.lo
+physics_radiation_exch_mod.mod: ${top_srcdir}/atmos_param/physics_radiation_exch/physics_radiation_exch.lo
+beta_dist_mod.mod: ${top_srcdir}/atmos_param/cloud_generator/betaDistribution.lo
+cloud_generator_mod.mod: ${top_srcdir}/atmos_param/cloud_generator/cloud_generator.lo
+qe_moist_convection_mod.mod: ${top_srcdir}/atmos_param/qe_moist_convection/qe_moist_convection.lo
+lscloud_debug_mod.mod: ${top_srcdir}/atmos_param/lscloud_driver/lscloud_debug.lo
+lscloud_constants_mod.mod: ${top_srcdir}/atmos_param/lscloud_driver/lscloud_constants.lo
+lscloud_netcdf_mod.mod: ${top_srcdir}/atmos_param/lscloud_driver/lscloud_netcdf.lo
+lscloud_types_mod.mod: ${top_srcdir}/atmos_param/lscloud_driver/lscloud_types.lo
+lscloud_driver_mod.mod: ${top_srcdir}/atmos_param/lscloud_driver/lscloud_driver.lo
+polysvp_mod.mod: ${top_srcdir}/atmos_param/lscloud_driver/polysvp.lo
+check_nan_mod.mod: ${top_srcdir}/atmos_param/lscloud_driver/check_nan.lo
+shallow_conv_mod.mod: ${top_srcdir}/atmos_param/shallow_conv/shallow_conv.lo
+stable_bl_turb_mod.mod: ${top_srcdir}/atmos_param/stable_bl_turb/stable_bl_turb.lo
+morrison_gettelman_microp_mod.mod: ${top_srcdir}/atmos_param/microphysics/morrison_gettelman_microp.lo
+gamma_mg_mod.mod: ${top_srcdir}/atmos_param/microphysics/gamma_mg.lo
+micro_mg_mod.mod: ${top_srcdir}/atmos_param/microphysics/micro_mg.lo
+micro_mg1_5.mod: ${top_srcdir}/atmos_param/microphysics/micro_mg.lo
+rotstayn_klein_mp_mod.mod: ${top_srcdir}/atmos_param/microphysics/rotstayn_klein_mp.lo
+ls_cloud_microphysics_mod.mod: ${top_srcdir}/atmos_param/microphysics/ls_cloud_microphysics.lo
+simple_pdf_mod.mod: ${top_srcdir}/atmos_param/microphysics/simple_pdf.lo
+cldwat2m_micro_mod.mod: ${top_srcdir}/atmos_param/microphysics/cldwat2m_micro.lo
+cldwat2m_micro.mod: ${top_srcdir}/atmos_param/microphysics/cldwat2m_micro.lo
+clouds_mod.mod: ${top_srcdir}/atmos_param/clouds/clouds.lo
+lin_cld_microphys_mod.mod: ${top_srcdir}/atmos_param/lin_cloud_microphys/lin_cloud_microphys.lo
+cloud_obs_mod.mod: ${top_srcdir}/atmos_param/cloud_obs/cloud_obs.lo
+diag_cloud_rad_mod.mod: ${top_srcdir}/atmos_param/diag_cloud_rad/diag_cloud_rad.lo
+damping_driver_mod.mod: ${top_srcdir}/atmos_param/damping_driver/damping_driver.lo
+shallow_physics_mod.mod: ${top_srcdir}/atmos_param/shallow_physics/shallow_physics.lo
+vert_diff_driver_mod.mod: ${top_srcdir}/atmos_param/vert_diff_driver/vert_diff_driver.lo
+moist_processes_mod.mod: ${top_srcdir}/atmos_param/moist_processes/moist_processes.lo
+moist_proc_utils_mod.mod: ${top_srcdir}/atmos_param/moist_processes/moist_processes_utils.lo
+strat_cloud_mod.mod: ${top_srcdir}/atmos_param/strat_cloud/strat_cloud.lo
+my25_turb_mod.mod: ${top_srcdir}/atmos_param/my25_turb/my25_turb.lo
+mod_cosp_modis_simulator.mod: ${top_srcdir}/atmos_param/cosp/cosp_modis_simulator.lo
+cosp_driver_mod.mod: ${top_srcdir}/atmos_param/cosp/cosp_driver.lo
+mod_cosp_misr_simulator.mod: ${top_srcdir}/atmos_param/cosp/cosp_misr_simulator.lo
+mod_cosp_stats.mod: ${top_srcdir}/atmos_param/cosp/cosp_stats.lo
+mod_cosp_utils.mod: ${top_srcdir}/atmos_param/cosp/cosp_utils.lo
+mod_cosp_types.mod: ${top_srcdir}/atmos_param/cosp/cosp_types.lo
+mod_cosp_rttov_simulator.mod: ${top_srcdir}/atmos_param/cosp/cosp_rttov_simulator.lo
+mod_cosp_isccp_simulator.mod: ${top_srcdir}/atmos_param/cosp/cosp_isccp_simulator.lo
+mod_cosp.mod: ${top_srcdir}/atmos_param/cosp/cosp.lo
+mod_cosp_constants.mod: ${top_srcdir}/atmos_param/cosp/cosp_constants.lo
+cosp_diagnostics_mod.mod: ${top_srcdir}/atmos_param/cosp/cosp_diagnostics.lo
+mod_cosp_simulator.mod: ${top_srcdir}/atmos_param/cosp/cosp_simulator.lo
+mod_cosp_lidar.mod: ${top_srcdir}/atmos_param/cosp/cosp_lidar.lo
+mod_cosp_io.mod: ${top_srcdir}/atmos_param/cosp/cosp_io.lo
+mod_lmd_ipsl_stats.mod: ${top_srcdir}/atmos_param/cosp/actsim/lmd_ipsl_stats.lo
+radar_simulator_types.mod: ${top_srcdir}/atmos_param/cosp/quickbeam/radar_simulator_types.lo
+array_lib.mod: ${top_srcdir}/atmos_param/cosp/quickbeam/array_lib.lo
+optics_lib.mod: ${top_srcdir}/atmos_param/cosp/quickbeam/optics_lib.lo
+format_input.mod: ${top_srcdir}/atmos_param/cosp/quickbeam/format_input.lo
+m_mrgrnk.mod: ${top_srcdir}/atmos_param/cosp/quickbeam/mrgrnk.lo
+scale_luts_io.mod: ${top_srcdir}/atmos_param/cosp/quickbeam/scale_LUTs_io.lo
+atmos_lib.mod: ${top_srcdir}/atmos_param/cosp/quickbeam/atmos_lib.lo
+math_lib.mod: ${top_srcdir}/atmos_param/cosp/quickbeam/math_lib.lo
+mod_cosp_radar.mod: ${top_srcdir}/atmos_param/cosp/llnl/cosp_radar.lo
+mod_llnl_stats.mod: ${top_srcdir}/atmos_param/cosp/llnl/llnl_stats.lo
+mod_modis_sim.mod: ${top_srcdir}/atmos_param/cosp/MODIS_simulator/modis_simulator.lo
+lscale_cond_mod.mod: ${top_srcdir}/atmos_param/lscale_cond/lscale_cond.lo
+entrain_mod.mod: ${top_srcdir}/atmos_param/entrain/entrain.lo
+cg_drag_mod.mod: ${top_srcdir}/atmos_param/cg_drag/cg_drag.lo
+cu_mo_trans_mod.mod: ${top_srcdir}/atmos_param/cu_mo_trans/cu_mo_trans.lo
+cloud_rad_mod.mod: ${top_srcdir}/atmos_param/cloud_rad/cloud_rad.lo
+bm_omp_mod.mod: ${top_srcdir}/atmos_param/betts_miller/bm_omp.lo
+betts_miller_mod.mod: ${top_srcdir}/atmos_param/betts_miller/betts_miller.lo
+bm_massflux_mod.mod: ${top_srcdir}/atmos_param/betts_miller/bm_massflux.lo
+vert_diff_mod.mod: ${top_srcdir}/atmos_param/vert_diff/vert_diff.lo
+two_stream_gray_rad_mod.mod: ${top_srcdir}/atmos_param/two_stream_gray_rad/two_stream_gray_rad.lo
+aerosol_cloud_mod.mod: ${top_srcdir}/atmos_param/aerosol_cloud/aerosol_cloud.lo
+rh_clouds_mod.mod: ${top_srcdir}/atmos_param/rh_clouds/rh_clouds.lo
+cloud_zonal_mod.mod: ${top_srcdir}/atmos_param/cloud_zonal/cloud_zonal.lo
+donner_deep_mod.mod: ${top_srcdir}/atmos_param/donner_deep/donner_deep.lo
+null_donner_deep_miz.mod: ${top_srcdir}/atmos_param/donner_deep/donner_deep_miz.lo
+fms_donner_mod.mod: ${top_srcdir}/atmos_param/donner_deep/fms_donner.lo
+nonfms_donner_mod.mod: ${top_srcdir}/atmos_param/donner_deep/nonfms_donner.lo
+donner_types_mod.mod: ${top_srcdir}/atmos_param/donner_deep/donner_types.lo
+dry_adj_mod.mod: ${top_srcdir}/atmos_param/dry_adj/dry_adj.lo
+tke_turb_mod.mod: ${top_srcdir}/atmos_param/tke_turb/tke_turb.lo
+mg_drag_mod.mod: ${top_srcdir}/atmos_param/mg_drag/mg_drag.lo
+alt_cloud_mod.mod: ${top_srcdir}/atmos_param/clubb/alt_cloud.lo
+advance_sclrm_nd_module.mod: ${top_srcdir}/atmos_param/clubb/advance_sclrm_Nd_module.lo
+clubb_3d_var.mod: ${top_srcdir}/atmos_param/clubb/CLUBB_3D_var.lo
+clubb_driver_mod.mod: ${top_srcdir}/atmos_param/clubb/CLUBB_driver_SCM.lo
+stats_rad_zm.mod: ${top_srcdir}/atmos_param/clubb/CLUBB_core/stats_rad_zm.lo
+array_index.mod: ${top_srcdir}/atmos_param/clubb/CLUBB_core/array_index.lo
+mono_flux_limiter.mod: ${top_srcdir}/atmos_param/clubb/CLUBB_core/mono_flux_limiter.lo
+stats_variables.mod: ${top_srcdir}/atmos_param/clubb/CLUBB_core/stats_variables.lo
+output_netcdf.mod: ${top_srcdir}/atmos_param/clubb/CLUBB_core/output_netcdf.lo
+t_in_k_module.mod: ${top_srcdir}/atmos_param/clubb/CLUBB_core/T_in_K_module.lo
+error_code.mod: ${top_srcdir}/atmos_param/clubb/CLUBB_core/error_code.lo
+variables_prognostic_module.mod: ${top_srcdir}/atmos_param/clubb/CLUBB_core/variables_prognostic_module.lo
+clip_explicit.mod: ${top_srcdir}/atmos_param/clubb/CLUBB_core/clip_explicit.lo
+hyper_diffusion_4th_ord.mod: ${top_srcdir}/atmos_param/clubb/CLUBB_core/hyper_diffusion_4th_ord.lo
+diffusion.mod: ${top_srcdir}/atmos_param/clubb/CLUBB_core/diffusion.lo
+stats_zm.mod: ${top_srcdir}/atmos_param/clubb/CLUBB_core/stats_zm.lo
+mean_adv.mod: ${top_srcdir}/atmos_param/clubb/CLUBB_core/mean_adv.lo
+advance_windm_edsclrm_module.mod: ${top_srcdir}/atmos_param/clubb/CLUBB_core/advance_windm_edsclrm_module.lo
+parameters_microphys.mod: ${top_srcdir}/atmos_param/clubb/CLUBB_core/parameters_microphys.lo
+clip_semi_implicit.mod: ${top_srcdir}/atmos_param/clubb/CLUBB_core/clip_semi_implicit.lo
+output_grads.mod: ${top_srcdir}/atmos_param/clubb/CLUBB_core/output_grads.lo
+stat_file_module.mod: ${top_srcdir}/atmos_param/clubb/CLUBB_core/stat_file_module.lo
+parameters_tunable.mod: ${top_srcdir}/atmos_param/clubb/CLUBB_core/parameters_tunable.lo
+pos_definite_module.mod: ${top_srcdir}/atmos_param/clubb/CLUBB_core/pos_definite_module.lo
+advance_helper_module.mod: ${top_srcdir}/atmos_param/clubb/CLUBB_core/advance_helper_module.lo
+stats_type.mod: ${top_srcdir}/atmos_param/clubb/CLUBB_core/stats_type.lo
+corr_matrix_module.mod: ${top_srcdir}/atmos_param/clubb/CLUBB_core/corr_matrix_module.lo
+clubb_precision.mod: ${top_srcdir}/atmos_param/clubb/CLUBB_core/clubb_precision.lo
+advance_xm_wpxp_module.mod: ${top_srcdir}/atmos_param/clubb/CLUBB_core/advance_xm_wpxp_module.lo
+lapack_wrap.mod: ${top_srcdir}/atmos_param/clubb/CLUBB_core/lapack_wrap.lo
+numerical_check.mod: ${top_srcdir}/atmos_param/clubb/CLUBB_core/numerical_check.lo
+input_reader.mod: ${top_srcdir}/atmos_param/clubb/CLUBB_core/input_reader.lo
+parameters_model.mod: ${top_srcdir}/atmos_param/clubb/CLUBB_core/parameters_model.lo
+input_names.mod: ${top_srcdir}/atmos_param/clubb/CLUBB_core/input_names.lo
+stats_lh_zt.mod: ${top_srcdir}/atmos_param/clubb/CLUBB_core/stats_LH_zt.lo
+stats_zt.mod: ${top_srcdir}/atmos_param/clubb/CLUBB_core/stats_zt.lo
+parameters_radiation.mod: ${top_srcdir}/atmos_param/clubb/CLUBB_core/parameters_radiation.lo
+stats_subs.mod: ${top_srcdir}/atmos_param/clubb/CLUBB_core/stats_subs.lo
+csr_matrix_class.mod: ${top_srcdir}/atmos_param/clubb/CLUBB_core/csr_matrix_class_3array.lo
+fill_holes.mod: ${top_srcdir}/atmos_param/clubb/CLUBB_core/fill_holes.lo
+stats_sfc.mod: ${top_srcdir}/atmos_param/clubb/CLUBB_core/stats_sfc.lo
+surface_varnce_module.mod: ${top_srcdir}/atmos_param/clubb/CLUBB_core/surface_varnce_module.lo
+file_functions.mod: ${top_srcdir}/atmos_param/clubb/CLUBB_core/file_functions.lo
+advance_xp2_xpyp_module.mod: ${top_srcdir}/atmos_param/clubb/CLUBB_core/advance_xp2_xpyp_module.lo
+clubb_core.mod: ${top_srcdir}/atmos_param/clubb/CLUBB_core/clubb_core.lo
+stats_rad_zt.mod: ${top_srcdir}/atmos_param/clubb/CLUBB_core/stats_rad_zt.lo
+constants_clubb.mod: ${top_srcdir}/atmos_param/clubb/CLUBB_core/constants_clubb.lo
+mixing_length.mod: ${top_srcdir}/atmos_param/clubb/CLUBB_core/mixing_length.lo
+variables_radiation_module.mod: ${top_srcdir}/atmos_param/clubb/CLUBB_core/variables_radiation_module.lo
+skw_module.mod: ${top_srcdir}/atmos_param/clubb/CLUBB_core/Skw_module.lo
+extrapolation.mod: ${top_srcdir}/atmos_param/clubb/CLUBB_core/extrapolation.lo
+matrix_operations.mod: ${top_srcdir}/atmos_param/clubb/CLUBB_core/matrix_operations.lo
+advance_wp2_wp3_module.mod: ${top_srcdir}/atmos_param/clubb/CLUBB_core/advance_wp2_wp3_module.lo
+pdf_closure_module.mod: ${top_srcdir}/atmos_param/clubb/CLUBB_core/pdf_closure_module.lo
+mt95.mod: ${top_srcdir}/atmos_param/clubb/CLUBB_core/mt95.lo
+grid_class.mod: ${top_srcdir}/atmos_param/clubb/CLUBB_core/grid_class.lo
+gmres_cache.mod: ${top_srcdir}/atmos_param/clubb/CLUBB_core/gmres_cache.lo
+model_flags.mod: ${top_srcdir}/atmos_param/clubb/CLUBB_core/model_flags.lo
+endian.mod: ${top_srcdir}/atmos_param/clubb/CLUBB_core/endian.lo
+calendar.mod: ${top_srcdir}/atmos_param/clubb/CLUBB_core/calendar.lo
+parameter_indices.mod: ${top_srcdir}/atmos_param/clubb/CLUBB_core/parameter_indices.lo
+pdf_parameter_module.mod: ${top_srcdir}/atmos_param/clubb/CLUBB_core/pdf_parameter_module.lo
+sponge_layer_damping.mod: ${top_srcdir}/atmos_param/clubb/CLUBB_core/sponge_layer_damping.lo
+sigma_sqd_w_module.mod: ${top_srcdir}/atmos_param/clubb/CLUBB_core/sigma_sqd_w_module.lo
+gmres_wrap.mod: ${top_srcdir}/atmos_param/clubb/CLUBB_core/gmres_wrap.lo
+anl_erf.mod: ${top_srcdir}/atmos_param/clubb/CLUBB_core/anl_erf.lo
+interpolation.mod: ${top_srcdir}/atmos_param/clubb/CLUBB_core/interpolation.lo
+saturation.mod: ${top_srcdir}/atmos_param/clubb/CLUBB_core/saturation.lo
+hydrostatic_module.mod: ${top_srcdir}/atmos_param/clubb/CLUBB_core/hydrostatic_module.lo
+variables_diagnostic_module.mod: ${top_srcdir}/atmos_param/clubb/CLUBB_core/variables_diagnostic_module.lo
+vert_turb_driver_mod.mod: ${top_srcdir}/atmos_param/vert_turb_driver/vert_turb_driver.lo
+conv_plumes_k_mod.mod: ${top_srcdir}/atmos_param/shallow_cu/conv_plumes_k.lo
+deep_conv_mod.mod: ${top_srcdir}/atmos_param/shallow_cu/deep_conv.lo
+conv_closures_mod.mod: ${top_srcdir}/atmos_param/shallow_cu/conv_closures.lo
+conv_plumes_mod.mod: ${top_srcdir}/atmos_param/shallow_cu/conv_plumes.lo
+conv_utilities_k_mod.mod: ${top_srcdir}/atmos_param/shallow_cu/conv_utilities_k.lo
+conv_utilities_mod.mod: ${top_srcdir}/atmos_param/shallow_cu/conv_utilities.lo
+uw_conv_mod.mod: ${top_srcdir}/atmos_param/shallow_cu/uw_conv.lo
+ras_mod.mod: ${top_srcdir}/atmos_param/ras/ras.lo
+include_HEADERS = atmos_nudge_mod.mod \
+ atmos_global_diag_mod.mod \
+ atmos_cmip_diag_mod.mod \
+ vert_advection_mod.mod \
+ aerosol_mod.mod \
+ aerosol_types_mod.mod \
+ atmos_convection_tracer_mod.mod \
+ atmos_sulfur_hex_mod.mod \
+ atmos_tracer_driver_mod.mod \
+ atmos_sea_salt_mod.mod \
+ atmos_tracer_utilities_mod.mod \
+ atmos_co2_mod.mod \
+ tropchem_driver_mod.mod \
+ atmos_dust_mod.mod \
+ atmos_tropopause_mod.mod \
+ atmos_sulfate_mod.mod \
+ atmos_radon_mod.mod \
+ atmos_nh3_tag_mod.mod \
+ atmos_soa_mod.mod \
+ atmos_ch4_mod.mod \
+ atmos_regional_tracer_driver_mod.mod \
+ cloud_chem.mod \
+ atmos_age_tracer_mod.mod \
+ mo_setsox_mod.mod \
+ atmos_ch3i_mod.mod \
+ xactive_bvoc_mod.mod \
+ atmos_carbon_aerosol_mod.mod \
+ strat_chem_mod.mod \
+ strat_chem_driver_mod.mod \
+ mo_chemini_mod.mod \
+ mo_jpl_mod.mod \
+ mo_exp_sol_mod.mod \
+ mo_chem_utls_mod.mod \
+ tropchem_types_mod.mod \
+ mo_usrrxt_mod.mod \
+ mo_photo_mod.mod \
+ aerosol_thermodynamics.mod \
+ mo_chemdr_mod.mod \
+ strat_chem_utilities_mod.mod \
+ mo_imp_sol_mod.mod \
+ moz_hook_mod.mod \
+ mo_setinv_mod.mod \
+ mo_rodas_sol_mod.mod \
+ mo_read_sim_chm_mod.mod \
+ m_tracname_mod.mod \
+ am3_mo_grid_mod.mod \
+ am3_chem_mods_mod.mod \
+ am3_m_spc_id_mod.mod \
+ am3_m_rxt_id_mod.mod \
+ am3_m_het_id_mod.mod \
+ am3_fphoto_mod.mod \
+ am3_fastjx_mod.mod \
+ am3_mo_setrxt_mod.mod \
+ am3_mo_adjrxt_mod.mod \
+ am3_mo_phtadj_mod.mod \
+ am3_mo_rxt_mod.mod \
+ am3_mo_make_grp_vmr_mod.mod \
+ am3_mo_exp_prod_loss_mod.mod \
+ am3_mo_imp_prod_loss_mod.mod \
+ am3_mo_rodas_prod_loss_mod.mod \
+ am3_mo_indprd_mod.mod \
+ am3_mo_imp_lin_matrix_mod.mod \
+ am3_mo_rod_lin_matrix_mod.mod \
+ am3_mo_imp_nln_matrix_mod.mod \
+ am3_mo_rod_nln_matrix_mod.mod \
+ am3_mo_imp_factor_mod.mod \
+ am3_mo_rod_factor_mod.mod \
+ am3_mo_imp_solve_mod.mod \
+ am3_mo_rod_solve_mod.mod \
+ mo_grid_mod.mod \
+ chem_mods_mod.mod \
+ m_spc_id_mod.mod \
+ m_rxt_id_mod.mod \
+ m_het_id_mod.mod \
+ mo_fphoto_mod.mod \
+ mo_exp_prod_loss_mod.mod \
+ mo_imp_prod_loss_mod.mod \
+ mo_rodas_prod_loss_mod.mod \
+ mo_indprd_mod.mod \
+ mo_imp_lin_matrix_mod.mod \
+ mo_rod_lin_matrix_mod.mod \
+ mo_imp_nln_matrix_mod.mod \
+ mo_rod_nln_matrix_mod.mod \
+ mo_imp_factor_mod.mod \
+ mo_rod_factor_mod.mod \
+ mo_imp_solve_mod.mod \
+ mo_rod_solve_mod.mod \
+ mo_setrxt_mod.mod \
+ mo_adjrxt_mod.mod \
+ mo_phtadj_mod.mod \
+ mo_rxt_mod.mod \
+ mo_make_grp_vmr_mod.mod \
+ mo_fastjx_mod.mod \
+ aer_ccn_act_mod.mod \
+ aer_in_act_mod.mod \
+ aer_ccn_act_k_mod.mod \
+ ice_nucl_mod.mod \
+ aerosol_params_mod.mod \
+ physics_types_mod.mod \
+ physics_driver_mod.mod \
+ diag_cloud_mod.mod \
+ grey_radiation_mod.mod \
+ diffusivity_mod.mod \
+ topo_drag_mod.mod \
+ ls_cloud_macrophysics_mod.mod \
+ tiedtke_macro_mod.mod \
+ moist_conv_mod.mod \
+ cloudrad_types_mod.mod \
+ microphys_rad_mod.mod \
+ strat_clouds_w_mod.mod \
+ isccp_clouds_mod.mod \
+ random_number_streams_mod.mod \
+ bulkphys_rad_mod.mod \
+ uw_clouds_w_mod.mod \
+ cloudrad_driver_mod.mod \
+ cloud_spec_mod.mod \
+ donner_deep_clouds_w_mod.mod \
+ cloudrad_diagnostics_mod.mod \
+ cloudrad_package_mod.mod \
+ longwave_tables_mod.mod \
+ longwave_clouds_mod.mod \
+ gas_tf_mod.mod \
+ longwave_params_mod.mod \
+ sealw99_mod.mod \
+ optical_path_mod.mod \
+ longwave_types_mod.mod \
+ longwave_utilities_mod.mod \
+ longwave_fluxes_mod.mod \
+ lw_gases_stdtf_mod.mod \
+ aerosolrad_types_mod.mod \
+ aerosolrad_package_mod.mod \
+ aerosolrad_driver_mod.mod \
+ esfsw_driver_mod.mod \
+ esfsw_utilities_mod.mod \
+ shortwave_types_mod.mod \
+ esfsw_bands_mod.mod \
+ esfsw_parameters_mod.mod \
+ radiative_gases_mod.mod \
+ radiative_gases_types_mod.mod \
+ ozone_mod.mod \
+ radiation_diag_mod.mod \
+ longwave_driver_mod.mod \
+ rad_output_file_mod.mod \
+ radiation_driver_types_mod.mod \
+ radiation_types_mod.mod \
+ solar_data_driver_mod.mod \
+ shortwave_driver_mod.mod \
+ radiation_driver_diag_mod.mod \
+ radiation_driver_mod.mod \
+ edt_mod.mod \
+ convection_utilities_mod.mod \
+ detr_ice_num_mod.mod \
+ convection_driver_mod.mod \
+ physics_radiation_exch_mod.mod \
+ beta_dist_mod.mod \
+ cloud_generator_mod.mod \
+ qe_moist_convection_mod.mod \
+ lscloud_debug_mod.mod \
+ lscloud_constants_mod.mod \
+ lscloud_netcdf_mod.mod \
+ lscloud_types_mod.mod \
+ lscloud_driver_mod.mod \
+ polysvp_mod.mod \
+ check_nan_mod.mod \
+ shallow_conv_mod.mod \
+ stable_bl_turb_mod.mod \
+ morrison_gettelman_microp_mod.mod \
+ gamma_mg_mod.mod \
+ micro_mg_mod.mod \
+ micro_mg1_5.mod \
+ rotstayn_klein_mp_mod.mod \
+ ls_cloud_microphysics_mod.mod \
+ simple_pdf_mod.mod \
+ cldwat2m_micro_mod.mod \
+ cldwat2m_micro.mod \
+ clouds_mod.mod \
+ lin_cld_microphys_mod.mod \
+ cloud_obs_mod.mod \
+ diag_cloud_rad_mod.mod \
+ damping_driver_mod.mod \
+ shallow_physics_mod.mod \
+ vert_diff_driver_mod.mod \
+ moist_processes_mod.mod \
+ moist_proc_utils_mod.mod \
+ strat_cloud_mod.mod \
+ my25_turb_mod.mod \
+ mod_cosp_modis_simulator.mod \
+ cosp_driver_mod.mod \
+ mod_cosp_misr_simulator.mod \
+ mod_cosp_stats.mod \
+ mod_cosp_utils.mod \
+ mod_cosp_types.mod \
+ mod_cosp_rttov_simulator.mod \
+ mod_cosp_isccp_simulator.mod \
+ mod_cosp.mod \
+ mod_cosp_constants.mod \
+ cosp_diagnostics_mod.mod \
+ mod_cosp_simulator.mod \
+ mod_cosp_lidar.mod \
+ mod_cosp_io.mod \
+ mod_lmd_ipsl_stats.mod \
+ radar_simulator_types.mod \
+ array_lib.mod \
+ optics_lib.mod \
+ format_input.mod \
+ m_mrgrnk.mod \
+ scale_luts_io.mod \
+ atmos_lib.mod \
+ math_lib.mod \
+ mod_cosp_radar.mod \
+ mod_llnl_stats.mod \
+ mod_modis_sim.mod \
+ lscale_cond_mod.mod \
+ entrain_mod.mod \
+ cg_drag_mod.mod \
+ cu_mo_trans_mod.mod \
+ cloud_rad_mod.mod \
+ bm_omp_mod.mod \
+ betts_miller_mod.mod \
+ bm_massflux_mod.mod \
+ vert_diff_mod.mod \
+ two_stream_gray_rad_mod.mod \
+ aerosol_cloud_mod.mod \
+ rh_clouds_mod.mod \
+ cloud_zonal_mod.mod \
+ donner_deep_mod.mod \
+ null_donner_deep_miz.mod \
+ fms_donner_mod.mod \
+ nonfms_donner_mod.mod \
+ donner_types_mod.mod \
+ dry_adj_mod.mod \
+ tke_turb_mod.mod \
+ mg_drag_mod.mod \
+ alt_cloud_mod.mod \
+ advance_sclrm_nd_module.mod \
+ clubb_3d_var.mod \
+ clubb_driver_mod.mod \
+ stats_rad_zm.mod \
+ array_index.mod \
+ mono_flux_limiter.mod \
+ stats_variables.mod \
+ output_netcdf.mod \
+ t_in_k_module.mod \
+ error_code.mod \
+ variables_prognostic_module.mod \
+ clip_explicit.mod \
+ hyper_diffusion_4th_ord.mod \
+ diffusion.mod \
+ stats_zm.mod \
+ mean_adv.mod \
+ advance_windm_edsclrm_module.mod \
+ parameters_microphys.mod \
+ clip_semi_implicit.mod \
+ output_grads.mod \
+ stat_file_module.mod \
+ parameters_tunable.mod \
+ pos_definite_module.mod \
+ advance_helper_module.mod \
+ stats_type.mod \
+ corr_matrix_module.mod \
+ clubb_precision.mod \
+ advance_xm_wpxp_module.mod \
+ lapack_wrap.mod \
+ numerical_check.mod \
+ input_reader.mod \
+ parameters_model.mod \
+ input_names.mod \
+ stats_lh_zt.mod \
+ stats_zt.mod \
+ parameters_radiation.mod \
+ stats_subs.mod \
+ csr_matrix_class.mod \
+ fill_holes.mod \
+ stats_sfc.mod \
+ surface_varnce_module.mod \
+ file_functions.mod \
+ advance_xp2_xpyp_module.mod \
+ clubb_core.mod \
+ stats_rad_zt.mod \
+ constants_clubb.mod \
+ mixing_length.mod \
+ variables_radiation_module.mod \
+ skw_module.mod \
+ extrapolation.mod \
+ matrix_operations.mod \
+ advance_wp2_wp3_module.mod \
+ pdf_closure_module.mod \
+ mt95.mod \
+ grid_class.mod \
+ gmres_cache.mod \
+ model_flags.mod \
+ endian.mod \
+ calendar.mod \
+ parameter_indices.mod \
+ pdf_parameter_module.mod \
+ sponge_layer_damping.mod \
+ sigma_sqd_w_module.mod \
+ gmres_wrap.mod \
+ anl_erf.mod \
+ interpolation.mod \
+ saturation.mod \
+ hydrostatic_module.mod \
+ variables_diagnostic_module.mod \
+ vert_turb_driver_mod.mod \
+ conv_plumes_k_mod.mod \
+ deep_conv_mod.mod \
+ conv_closures_mod.mod \
+ conv_plumes_mod.mod \
+ conv_utilities_k_mod.mod \
+ conv_utilities_mod.mod \
+ uw_conv_mod.mod \
+ ras_mod.mod
+CLEANFILES = *.mod
diff --git a/README.md b/README.md
new file mode 100644
index 00000000..aa840186
--- /dev/null
+++ b/README.md
@@ -0,0 +1,109 @@
+# atmos_phys
+This is the repository that combines the atmosphere physics and chemistry
+## Table of contents
+* [Guidelines for Contributing](README.md#guidelines-for-contributing)
+* [Instructions on merging in code from atmos_param or atmos_shared](README.md#instructions-on-merging-in-code-from-atmos_param-or-atmos_shared)
+* [XML changes to checkout atmos_phys](README.md#xml-changes-to-checkout-atmos_phys)
+## Guidelines for Contributing
+If you have code you would like to contribute, you will first create a git branch.
+Your branch should be in the format of /user/**ini**/**BranchName** where **ini**
+are your initals and **BranchName** is a name that describes the purpose of your
+branch. Avoid using a BranchName like *bugfix* or *update* because this is not
+descritive.
+```bash
+git checkout -b user/ini/BranchName
+```
+Second, you will commit your changes, and push them to the atmos_phys remote
+repository.
+```bash
+git push -u origin user/ini/BranchName
+```
+After the changes are pushed, you can share your code with others. If your code
+should be included in the main model development, you can submit a merge request by
+clicking on the Merge Requests link on the gitlab page. Please include a detailed
+description of the changes made by your branch. You should submit the merge to the
+main development branch (*master*). Assign your merge request to Uriel Ramirez.
+
+## Instructions on merging in code from atmos_param or atmos_shared
+In order to commit changes that currently exist on atmos_param or atmos_shared,
+you first have to commit and push the changes to a branch in the repository you are
+working in. Next you will clone atmos_phys. After that, you will add the original
+repository to as a remote in your atmos_phys directory. You can then fetch from the
+original repository and merge in the branch you were working on.
+
+Below is an example set of instructions to accomplish this. This assumes that you
+cloned atmos_param.
+```bash
+git clone https://gitlab.gfdl.noaa.gov/fms/atmos_phys.git #clone atmos_param
+cd atmos_phys
+pushd ../atmos_param/ #Set up a directory stack with the two repo directories
+git checkout user/ter/exampleBranch #check out your user branch
+git fetch #fetch any changes that may have occurred in atmos_param since you branched
+git pull origin/master #merge in the master (update your code base)
+## The following 3 lines can be skipped if you already have committed changes ##
+touch test.file #Make your changes (DO NOT COPY THIS, it is just an example)
+git add test.file #stage your changes
+git commit -m "Save a test commit to user branch" #commit your changes
+## The folowing can be skipped if you have already pushed your changes ##
+git push -u origin user/ter/exampleBranch
+pushd #change directory to the atmos_phys folder
+git checkout -b user/ter/exampleBranch #create your branch in atmos_phys
+git remote add param https://gitlab.gfdl.noaa.gov/fms/atmos_param.git #add atmos_param as a remote
+git fetch param #fetch the contents of the atmos_param
+git merge param/user/ter/exampleBranch #merge your branch from atmos_param into your branch on atmos_phys
+git push -u origin user/ter/exampleBranch
+```
+A note on git remotes:
+
+The default name for a remote is **origin**. When you clone a repository, the remote
+is automatically given the name **origin**. When you add a remote, you can name it
+anything except origin. In the above example, I named the remote **param**. That's
+why I fetch from **param**. To see what remotes you have set up, you can issue the
+command
+```bash
+git remote -v
+```
+
+## XML changes to checkout atmos_phys
+There are a few modifications to an XML in order switch to the atmos_phys code.
+An XML will have a section in the compile experiment that looks like the following:
+```xml
+
+
+
+
+ $(F2003_FLAGS) -DCLUBB
+
+
+```
+This can be found by searching the XML for *atmos_phys* or *atmos_shared.git* or
+*atmos_param.git*. This block should be updated to the following:
+```xml
+
+
+
+
+ $(F2003_FLAGS) -DCLUBB
+
+
+```
+1. The **paths** has been changed from "atmos_param atmos_shared" to "atmos_phys".
+2. The **codeBase** was changed from **atmos_shared.git atmos_param.git** to **atmos_phys.git**
+3. The `csh` block was updated to only `cd` to atmos_phys
+
+NOTE: Users should switch to atmos_phys if they are checking out code that is newer
+than xanadu. If your model is running code older than xanadu, you should check the
+code out from atmos_shared and atmos_param.
diff --git a/atmos_param/aerosol_cloud/aerosol_cloud.F90 b/atmos_param/aerosol_cloud/aerosol_cloud.F90
index 5a63c9ad..785eb09e 100644
--- a/atmos_param/aerosol_cloud/aerosol_cloud.F90
+++ b/atmos_param/aerosol_cloud/aerosol_cloud.F90
@@ -8,9 +8,9 @@ MODULE aerosol_cloud_mod
!-----------------------------------------------------------------------
use fms_mod, only : error_mesg, FATAL, mpp_pe, &
- mpp_root_pe, open_namelist_file, &
- check_nml_error, close_file, &
- write_version_number, file_exist, &
+ mpp_root_pe, &
+ check_nml_error, &
+ write_version_number, &
stdlog
use constants_mod, ONLY : grav, cp_air, rdgas, rvgas, tfreeze
use time_manager_mod, only : time_type
@@ -145,7 +145,7 @@ subroutine aerosol_cloud_init (Constants_lsc, Nml_lsc, Nml_mp, Exch_ctrl)
!-----local variables
- integer :: unit, io, ierr, logunit
+ integer :: io, ierr, logunit
!-----------------------------------------------------------------------
if (module_is_initialized) return
@@ -171,20 +171,8 @@ subroutine aerosol_cloud_init (Constants_lsc, Nml_lsc, Nml_mp, Exch_ctrl)
!-------------------------------------------------------------------------
! process namelist.
!-------------------------------------------------------------------------
-#ifdef INTERNAL_FILE_NML
read (input_nml_file, nml=aerosol_cloud_nml, iostat=io)
ierr = check_nml_error(io,'aerosol_cloud_nml')
-#else
- if ( file_exist('input.nml')) then
- unit = open_namelist_file ( )
- ierr=1; do while (ierr /= 0)
- read (unit, nml=aerosol_cloud_nml, iostat=io, end=10)
- ierr = check_nml_error(io,'aerosol_cloud_nml')
- enddo
-10 call close_file (unit)
- endif
-#endif
-
!-------------------------------------------------------------------------
! write version and namelist to standard log.
!-------------------------------------------------------------------------
diff --git a/atmos_param/betts_miller/betts_miller.F90 b/atmos_param/betts_miller/betts_miller.F90
index 39edb92c..cbfe35ac 100644
--- a/atmos_param/betts_miller/betts_miller.F90
+++ b/atmos_param/betts_miller/betts_miller.F90
@@ -2,14 +2,10 @@
module betts_miller_mod
!----------------------------------------------------------------------
-!use utilities_mod, only: file_exist, error_mesg, open_file, &
-! check_nml_error, get_my_pe, FATAL, &
-! close_file
-
use mpp_mod, only: input_nml_file
-use fms_mod, only: file_exist, error_mesg, open_namelist_file, &
+use fms_mod, only: error_mesg, &
check_nml_error, mpp_pe, mpp_root_pe, &
- FATAL, close_file, write_version_number, stdlog
+ FATAL, write_version_number, stdlog
use sat_vapor_pres_mod, only: escomp, descomp
use constants_mod, only: HLv,HLs,Cp_air,Grav,rdgas,rvgas, &
@@ -511,9 +507,9 @@ subroutine capecalcnew(kx,p,phalf,cp_air,rdgas,rvgas,hlv,kappa,tin,rin,&
call escomp(t0,es)
rs = rdgas/rvgas*es/p(kx)
if (r0.ge.rs) then
-! if you¹re already saturated, set lcl to be the surface value.
+! if you're already saturated, set lcl to be the surface value.
plcl = p(kx)
-! the first level where you¹re completely saturated.
+! the first level where you're completely saturated.
klcl = kx
! saturate out to get the parcel temp and humidity at this level
! first order (in delta T) accurate expression for change in temp
@@ -522,7 +518,7 @@ subroutine capecalcnew(kx,p,phalf,cp_air,rdgas,rvgas,hlv,kappa,tin,rin,&
rp(kx) = rdgas/rvgas*es/p(kx)
else
! if not saturated to begin with, use the analytic expression to calculate the
-! exact pressure and temperature where you¹re saturated.
+! exact pressure and temperature where you're saturated.
theta0 = tin(kx)*(pstar/p(kx))**kappa
! the expression that we utilize is
! log(r/theta**(1/kappa)*pstar*rvgas/rdgas/es00) = log(es/T**(1/kappa))
@@ -599,14 +595,14 @@ subroutine capecalcnew(kx,p,phalf,cp_air,rdgas,rvgas,hlv,kappa,tin,rin,&
! write (*,*) 'tp, rp klcl:kx, new', tp(klcl:kx), rp(klcl:kx)
! CAPE/CIN stuff
if ((tp(klcl).lt.tin(klcl)).and.nocape) then
-! if you¹re not yet buoyant, then add to the CIN and continue
+! if you're not yet buoyant, then add to the CIN and continue
cin = cin + rdgas*(tin(klcl) - &
tp(klcl))*log(phalf(klcl+1)/phalf(klcl))
else
-! if you¹re buoyant, then add to cape
+! if you're buoyant, then add to cape
cape = cape + rdgas*(tp(klcl) - &
tin(klcl))*log(phalf(klcl+1)/phalf(klcl))
-! if it¹s the first time buoyant, then set the level of free convection to k
+! if it's the first time buoyant, then set the level of free convection to k
if (nocape) then
nocape = .false.
klfc = klcl
@@ -636,7 +632,7 @@ subroutine capecalcnew(kx,p,phalf,cp_air,rdgas,rvgas,hlv,kappa,tin,rin,&
! reset CIN to zero.
cin = 0.
! again, use the analytic expression to calculate the exact pressure and
-! temperature where you¹re saturated.
+! temperature where you're saturated.
! the expression that we utilize is
! log(r/theta**(1/kappa)*pstar*rvgas/rdgas/es00)= log(es/T**(1/kappa))
! (the division by es00 is necessary because the RHS values are tabulated
@@ -661,7 +657,7 @@ subroutine capecalcnew(kx,p,phalf,cp_air,rdgas,rvgas,hlv,kappa,tin,rin,&
cin = cin + rdgas*(tin(k) - tp(k))*log(phalf(k+1)/phalf(k))
k = k-1
end do
-! first level where you¹re saturated at the level
+! first level where you're saturated at the level
klcl2 = k
if (klcl2.eq.1) klcl2 = 2
! do a saturated ascent to get the parcel temp at the LCL.
@@ -694,14 +690,14 @@ subroutine capecalcnew(kx,p,phalf,cp_air,rdgas,rvgas,hlv,kappa,tin,rin,&
rp(klcl2) = rdgas/rvgas*es/p(klcl2)
! CAPE/CIN stuff
if ((tp(klcl2).lt.tin(klcl2)).and.nocape) then
-! if you¹re not yet buoyant, then add to the CIN and continue
+! if you're not yet buoyant, then add to the CIN and continue
cin = cin + rdgas*(tin(klcl2) - &
tp(klcl2))*log(phalf(klcl2+1)/phalf(klcl2))
else
-! if you¹re buoyant, then add to cape
+! if you're buoyant, then add to cape
cape = cape + rdgas*(tp(klcl) - &
tin(klcl))*log(phalf(klcl+1)/phalf(klcl))
-! if it¹s the first time buoyant, then set the level of free convection to k
+! if it's the first time buoyant, then set the level of free convection to k
if (nocape) then
nocape = .false.
klfc = klcl2
@@ -740,17 +736,17 @@ subroutine capecalcnew(kx,p,phalf,cp_air,rdgas,rvgas,hlv,kappa,tin,rin,&
call escomp(tp(k),es)
rp(k) = rdgas/rvgas*es/p(k)
if ((tp(k).lt.tin(k)).and.nocape) then
-! if you¹re not yet buoyant, then add to the CIN and continue
+! if you're not yet buoyant, then add to the CIN and continue
cin = cin + rdgas*(tin(k) - tp(k))*log(phalf(k+1)/phalf(k))
elseif((tp(k).lt.tin(k)).and.(.not.nocape)) then
-! if you have CAPE, and it¹s your first time being negatively buoyant,
+! if you have CAPE, and it's your first time being negatively buoyant,
! then set the level of zero buoyancy to k+1, and stop the moist ascent
klzb = k+1
go to 11
else
-! if you¹re buoyant, then add to cape
+! if you're buoyant, then add to cape
cape = cape + rdgas*(tp(k) - tin(k))*log(phalf(k+1)/phalf(k))
-! if it¹s the first time buoyant, then set the level of free convection to k
+! if it's the first time buoyant, then set the level of free convection to k
if (nocape) then
nocape = .false.
klfc = k
@@ -851,23 +847,12 @@ subroutine betts_miller_init ()
!
!-----------------------------------------------------------------------
- integer unit,io,ierr, logunit
+ integer io,ierr, logunit
!----------- read namelist ---------------------------------------------
-#ifdef INTERNAL_FILE_NML
read (input_nml_file, nml=betts_miller_nml, iostat=io)
ierr = check_nml_error(io,'betts_miller_nml')
-#else
- if (file_exist('input.nml')) then
- unit = open_namelist_file ( )
- ierr=1; do while (ierr /= 0)
- read (unit, nml=betts_miller_nml, iostat=io, end=10)
- ierr = check_nml_error (io,'betts_miller_nml')
- enddo
- 10 call close_file (unit)
- endif
-#endif
!---------- output namelist --------------------------------------------
diff --git a/atmos_param/betts_miller/bm_massflux.F90 b/atmos_param/betts_miller/bm_massflux.F90
index 6d171934..c7de78b8 100644
--- a/atmos_param/betts_miller/bm_massflux.F90
+++ b/atmos_param/betts_miller/bm_massflux.F90
@@ -3,9 +3,9 @@ module bm_massflux_mod
!----------------------------------------------------------------------
use mpp_mod, only: input_nml_file
-use fms_mod, only: file_exist, error_mesg, open_namelist_file, &
+use fms_mod, only: error_mesg, &
check_nml_error, mpp_pe, FATAL, &
- close_file, mpp_root_pe, write_version_number, stdlog
+ mpp_root_pe, write_version_number, stdlog
use sat_vapor_pres_mod, only: escomp, descomp
use constants_mod, only: HLv,HLs,Cp_air,Grav,rdgas,rvgas, cp_vapor, kappa
@@ -1048,9 +1048,9 @@ subroutine capecalcnew(kx,p,phalf,cp_air,rdgas,rvgas,hlv,kappa,tin,rin,&
call escomp(t0,es)
rs = rdgas/rvgas*es/p(kx)
if (r0.ge.rs) then
-! if you¹re already saturated, set lcl to be the surface value.
+! if you're already saturated, set lcl to be the surface value.
plcl = p(kx)
-! the first level where you¹re completely saturated.
+! the first level where you're completely saturated.
klcl = kx
! saturate out to get the parcel temp and humidity at this level
! first order (in delta T) accurate expression for change in temp
@@ -1060,7 +1060,7 @@ subroutine capecalcnew(kx,p,phalf,cp_air,rdgas,rvgas,hlv,kappa,tin,rin,&
rp(kx) = rdgas/rvgas*es/p(kx)
else
! if not saturated to begin with, use the analytic expression to calculate the
-! exact pressure and temperature where you¹re saturated.
+! exact pressure and temperature where you're saturated.
theta0 = tin(kx)*(pstar/p(kx))**kappa
! the expression that we utilize is log(r/theta**(1/kappa)*pstar*rvgas/rdgas) =
! log(es/T**(1/kappa))
@@ -1137,14 +1137,14 @@ subroutine capecalcnew(kx,p,phalf,cp_air,rdgas,rvgas,hlv,kappa,tin,rin,&
! write (*,*) 'tp, rp klcl:kx, new', tp(klcl:kx), rp(klcl:kx)
! CAPE/CIN stuff
if ((tp(klcl).lt.tin(klcl)).and.nocape) then
-! if you¹re not yet buoyant, then add to the CIN and continue
+! if you're not yet buoyant, then add to the CIN and continue
cin = cin + rdgas*(tin(klcl) - &
tp(klcl))*log(phalf(klcl+1)/phalf(klcl))
else
-! if you¹re buoyant, then add to cape
+! if you're buoyant, then add to cape
cape = cape + rdgas*(tp(klcl) - &
tin(klcl))*log(phalf(klcl+1)/phalf(klcl))
-! if it¹s the first time buoyant, then set the level of free convection to k
+! if it's the first time buoyant, then set the level of free convection to k
if (nocape) then
nocape = .false.
klfc = klcl
@@ -1165,17 +1165,17 @@ subroutine capecalcnew(kx,p,phalf,cp_air,rdgas,rvgas,hlv,kappa,tin,rin,&
end do
thetam = thetam/(phalf(kx+1) - phalf(klcl))
rm = rm/(phalf(kx+1) - phalf(klcl))
-! check if you¹re saturated at the top level. if not, then get a new LCL
+! check if you're saturated at the top level. if not, then get a new LCL
tp(klcl) = thetam*(p(klcl)/pstar)**kappa
! call establ(es,tp(klcl))
call escomp(tp(klcl),es)
rs = rdgas/rvgas*es/p(klcl)
-! if you¹re not saturated, get a new LCL
+! if you're not saturated, get a new LCL
if (rm.lt.rs) then
! reset CIN to zero.
cin = 0.
! again, use the analytic expression to calculate the exact pressure and
-! temperature where you¹re saturated.
+! temperature where you're saturated.
! the expression that we utilize is log(r/theta**(1/kappa)*pstar*rvgas/rdgas)=
! log(es/T**(1/kappa))
! The right hand side of this is only a function of temperature, therefore
@@ -1234,14 +1234,14 @@ subroutine capecalcnew(kx,p,phalf,cp_air,rdgas,rvgas,hlv,kappa,tin,rin,&
rp(klcl2) = rdgas/rvgas*es/p(klcl2)
! CAPE/CIN stuff
if ((tp(klcl2).lt.tin(klcl2)).and.nocape) then
-! if you¹re not yet buoyant, then add to the CIN and continue
+! if you're not yet buoyant, then add to the CIN and continue
cin = cin + rdgas*(tin(klcl2) - &
tp(klcl2))*log(phalf(klcl2+1)/phalf(klcl2))
else
-! if you¹re buoyant, then add to cape
+! if you're buoyant, then add to cape
cape = cape + rdgas*(tp(klcl) - &
tin(klcl))*log(phalf(klcl+1)/phalf(klcl))
-! if it¹s the first time buoyant, then set the level of free convection to k
+! if it's the first time buoyant, then set the level of free convection to k
if (nocape) then
nocape = .false.
klfc = klcl2
@@ -1281,17 +1281,17 @@ subroutine capecalcnew(kx,p,phalf,cp_air,rdgas,rvgas,hlv,kappa,tin,rin,&
call escomp(tp(k),es)
rp(k) = rdgas/rvgas*es/p(k)
if ((tp(k).lt.tin(k)).and.nocape) then
-! if you¹re not yet buoyant, then add to the CIN and continue
+! if you're not yet buoyant, then add to the CIN and continue
cin = cin + rdgas*(tin(k) - tp(k))*log(phalf(k+1)/phalf(k))
elseif((tp(k).lt.tin(k)).and.(.not.nocape)) then
-! if you have CAPE, and it¹s your first time being negatively buoyant,
+! if you have CAPE, and it's your first time being negatively buoyant,
! then set the level of zero buoyancy to k+1, and stop the moist ascent
klzb = k+1
go to 11
else
-! if you¹re buoyant, then add to cape
+! if you're buoyant, then add to cape
cape = cape + rdgas*(tp(k) - tin(k))*log(phalf(k+1)/phalf(k))
-! if it¹s the first time buoyant, then set the level of free convection to k
+! if it's the first time buoyant, then set the level of free convection to k
if (nocape) then
nocape = .false.
klfc = k
@@ -1561,22 +1561,11 @@ subroutine bm_massflux_init ()
!
!-----------------------------------------------------------------------
- integer unit,io,ierr, logunit
+ integer io,ierr, logunit
!----------- read namelist ---------------------------------------------
-#ifdef INTERNAL_FILE_NML
read (input_nml_file, nml=bm_massflux_nml, iostat=io)
ierr = check_nml_error(io,"bm_massflux_nml")
-#else
- if (file_exist('input.nml')) then
- unit = open_namelist_file ( )
- ierr=1; do while (ierr /= 0)
- read (unit, nml=bm_massflux_nml, iostat=io, end=10)
- ierr = check_nml_error (io,'bm_massflux_nml')
- enddo
- 10 call close_file (unit)
- endif
-#endif
!---------- output namelist --------------------------------------------
@@ -1585,7 +1574,6 @@ subroutine bm_massflux_init ()
logunit = stdlog()
write (logunit,nml=bm_massflux_nml)
endif
- call close_file (unit)
module_is_initialized =.true.
diff --git a/atmos_param/betts_miller/bm_omp.F90 b/atmos_param/betts_miller/bm_omp.F90
index 0c593a09..165359cf 100644
--- a/atmos_param/betts_miller/bm_omp.F90
+++ b/atmos_param/betts_miller/bm_omp.F90
@@ -3,9 +3,9 @@ module bm_omp_mod
!----------------------------------------------------------------------
use mpp_mod, only: input_nml_file
-use fms_mod, only: file_exist, open_namelist_file, check_nml_error, &
+use fms_mod, only: check_nml_error, &
error_mesg, FATAL, mpp_pe, mpp_root_pe, &
- close_file, write_version_number, stdlog
+ write_version_number, stdlog
use sat_vapor_pres_mod, only: escomp, descomp
use constants_mod, only: HLv,HLs,Cp_air,Grav,rdgas,rvgas, cp_vapor, &
@@ -942,9 +942,9 @@ subroutine capecalcnew(kx,p,phalf,Cp_air,rdgas,rvgas,hlv,kappa,tin,rin,&
call escomp(t0,es)
rs = rdgas/rvgas*es/p(kx)
if (r0.ge.rs) then
-! if you¹re already saturated, set lcl to be the surface value.
+! if you're already saturated, set lcl to be the surface value.
plcl = p(kx)
-! the first level where you¹re completely saturated.
+! the first level where you're completely saturated.
klcl = kx
! saturate out to get the parcel temp and humidity at this level
! first order (in delta T) accurate expression for change in temp
@@ -954,7 +954,7 @@ subroutine capecalcnew(kx,p,phalf,Cp_air,rdgas,rvgas,hlv,kappa,tin,rin,&
rp(kx) = rdgas/rvgas*es/p(kx)
else
! if not saturated to begin with, use the analytic expression to calculate the
-! exact pressure and temperature where you¹re saturated.
+! exact pressure and temperature where you're saturated.
theta0 = tin(kx)*(pstar/p(kx))**kappa
! the expression that we utilize is log(r/theta**(1/kappa)*pstar*rvgas/rdgas) =
! log(es/T**(1/kappa))
@@ -996,7 +996,7 @@ subroutine capecalcnew(kx,p,phalf,Cp_air,rdgas,rvgas,hlv,kappa,tin,rin,&
cin = cin + rdgas*(tin(k) - tp(k))*log(phalf(k+1)/phalf(k))
k = k-1
end do
-! first level where you¹re saturated at the level
+! first level where you're saturated at the level
klcl = k
if (klcl.eq.1) klcl = 2
! do a saturated ascent to get the parcel temp at the LCL.
@@ -1031,14 +1031,14 @@ subroutine capecalcnew(kx,p,phalf,Cp_air,rdgas,rvgas,hlv,kappa,tin,rin,&
! write (*,*) 'tp, rp klcl:kx, new', tp(klcl:kx), rp(klcl:kx)
! CAPE/CIN stuff
if ((tp(klcl).lt.tin(klcl)).and.nocape) then
-! if you¹re not yet buoyant, then add to the CIN and continue
+! if you're not yet buoyant, then add to the CIN and continue
cin = cin + rdgas*(tin(klcl) - &
tp(klcl))*log(phalf(klcl+1)/phalf(klcl))
else
-! if you¹re buoyant, then add to cape
+! if you're buoyant, then add to cape
cape = cape + rdgas*(tp(klcl) - &
tin(klcl))*log(phalf(klcl+1)/phalf(klcl))
-! if it¹s the first time buoyant, then set the level of free convection to k
+! if it's the first time buoyant, then set the level of free convection to k
if (nocape) then
nocape = .false.
klfc = klcl
@@ -1059,17 +1059,17 @@ subroutine capecalcnew(kx,p,phalf,Cp_air,rdgas,rvgas,hlv,kappa,tin,rin,&
end do
thetam = thetam/(phalf(kx+1) - phalf(klcl))
rm = rm/(phalf(kx+1) - phalf(klcl))
-! check if you¹re saturated at the top level. if not, then get a new LCL
+! check if you're saturated at the top level. if not, then get a new LCL
tp(klcl) = thetam*(p(klcl)/pstar)**kappa
! call establ(es,tp(klcl))
call escomp(tp(klcl),es)
rs = rdgas/rvgas*es/p(klcl)
-! if you¹re not saturated, get a new LCL
+! if you're not saturated, get a new LCL
if (rm.lt.rs) then
! reset CIN to zero.
cin = 0.
! again, use the analytic expression to calculate the exact pressure and
-! temperature where you¹re saturated.
+! temperature where you're saturated.
! the expression that we utilize is log(r/theta**(1/kappa)*pstar*rvgas/rdgas)=
! log(es/T**(1/kappa))
! The right hand side of this is only a function of temperature, therefore
@@ -1128,14 +1128,14 @@ subroutine capecalcnew(kx,p,phalf,Cp_air,rdgas,rvgas,hlv,kappa,tin,rin,&
rp(klcl2) = rdgas/rvgas*es/p(klcl2)
! CAPE/CIN stuff
if ((tp(klcl2).lt.tin(klcl2)).and.nocape) then
-! if you¹re not yet buoyant, then add to the CIN and continue
+! if you're not yet buoyant, then add to the CIN and continue
cin = cin + rdgas*(tin(klcl2) - &
tp(klcl2))*log(phalf(klcl2+1)/phalf(klcl2))
else
-! if you¹re buoyant, then add to cape
+! if you're buoyant, then add to cape
cape = cape + rdgas*(tp(klcl) - &
tin(klcl))*log(phalf(klcl+1)/phalf(klcl))
-! if it¹s the first time buoyant, then set the level of free convection to k
+! if it's the first time buoyant, then set the level of free convection to k
if (nocape) then
nocape = .false.
klfc = klcl2
@@ -1175,17 +1175,17 @@ subroutine capecalcnew(kx,p,phalf,Cp_air,rdgas,rvgas,hlv,kappa,tin,rin,&
call escomp(tp(k),es)
rp(k) = rdgas/rvgas*es/p(k)
if ((tp(k).lt.tin(k)).and.nocape) then
-! if you¹re not yet buoyant, then add to the CIN and continue
+! if you're not yet buoyant, then add to the CIN and continue
cin = cin + rdgas*(tin(k) - tp(k))*log(phalf(k+1)/phalf(k))
elseif((tp(k).lt.tin(k)).and.(.not.nocape)) then
-! if you have CAPE, and it¹s your first time being negatively buoyant,
+! if you have CAPE, and it's your first time being negatively buoyant,
! then set the level of zero buoyancy to k+1, and stop the moist ascent
klzb = k+1
go to 11
else
-! if you¹re buoyant, then add to cape
+! if you're buoyant, then add to cape
cape = cape + rdgas*(tp(k) - tin(k))*log(phalf(k+1)/phalf(k))
-! if it¹s the first time buoyant, then set the level of free convection to k
+! if it's the first time buoyant, then set the level of free convection to k
if (nocape) then
nocape = .false.
klfc = k
@@ -1469,23 +1469,12 @@ subroutine bm_omp_init ()
!
!-----------------------------------------------------------------------
- integer unit,io,ierr, logunit
+ integer io,ierr, logunit
!----------- read namelist ---------------------------------------------
-#ifdef INTERNAL_FILE_NML
read (input_nml_file, nml=bm_omp_nml, iostat=io)
ierr = check_nml_error(io,"bm_omp_nml")
-#else
- if (file_exist('input.nml')) then
- unit = open_namelist_file ( )
- ierr=1; do while (ierr /= 0)
- read (unit, nml=bm_omp_nml, iostat=io, end=10)
- ierr = check_nml_error (io,'bm_omp_nml')
- enddo
- 10 call close_file (unit)
- endif
-#endif
!---------- output namelist --------------------------------------------
@@ -1494,7 +1483,6 @@ subroutine bm_omp_init ()
logunit = stdlog()
write (logunit,nml=bm_omp_nml)
endif
- call close_file (unit)
module_is_initialized =.true.
diff --git a/atmos_param/cg_drag/cg_drag.F90 b/atmos_param/cg_drag/cg_drag.F90
index 2c66c6f9..fa555275 100644
--- a/atmos_param/cg_drag/cg_drag.F90
+++ b/atmos_param/cg_drag/cg_drag.F90
@@ -1,14 +1,16 @@
module cg_drag_mod
-use mpp_mod, only: input_nml_file
-use fms_mod, only: fms_init, mpp_pe, mpp_root_pe, &
- file_exist, check_nml_error, &
- error_mesg, FATAL, WARNING, NOTE, &
- close_file, open_namelist_file, &
- stdlog, write_version_number, &
- read_data, write_data
-use fms_io_mod, only: register_restart_field, restart_file_type
-use fms_io_mod, only: save_restart, restore_state, get_mosaic_tile_file
+use mpp_mod, only: input_nml_file, mpp_get_current_pelist
+use mpp_domains_mod, only: domain2D, mpp_get_ntile_count
+use fms_mod, only: fms_init, mpp_pe, mpp_root_pe, mpp_npes, &
+ check_nml_error, &
+ error_mesg, FATAL, NOTE, &
+ stdlog, write_version_number
+use fms2_io_mod, only: FmsNetcdfFile_t, FmsNetcdfDomainFile_t, &
+ register_restart_field, register_axis, unlimited, &
+ open_file, read_restart, write_restart, close_file, &
+ register_field, write_data, get_global_io_domain_indices, &
+ register_variable_attribute
use time_manager_mod, only: time_manager_init, time_type
use diag_manager_mod, only: diag_manager_init, &
register_diag_field, send_data
@@ -53,9 +55,7 @@ module cg_drag_mod
private read_nc_restart_file, gwfc
!--- for netcdf restart
-type(restart_file_type), pointer, save :: Cg_restart => NULL()
-type(restart_file_type), pointer, save :: Til_restart => NULL()
-logical :: in_different_file = .false.
+type (domain2D), pointer :: cg_domain !< Atmosphere domain
integer :: vers, old_time_step
!wfc++ Addition for regular use
@@ -259,13 +259,14 @@ module cg_drag_mod
!####################################################################
-subroutine cg_drag_init (lonb, latb, pref, Time, axes)
+subroutine cg_drag_init (domain, lonb, latb, pref, Time, axes)
!-------------------------------------------------------------------
! cg_drag_init is the constructor for cg_drag_mod.
!-------------------------------------------------------------------
!-------------------------------------------------------------------
+type(domain2D), target, intent(in) :: domain !< Atmosphere domain
real, dimension(:,:), intent(in) :: lonb, latb
real, dimension(:), intent(in) :: pref
integer, dimension(4), intent(in) :: axes
@@ -328,19 +329,8 @@ subroutine cg_drag_init (lonb, latb, pref, Time, axes)
!---------------------------------------------------------------------
! read namelist.
!---------------------------------------------------------------------
-#ifdef INTERNAL_FILE_NML
read (input_nml_file, nml=cg_drag_nml, iostat=io)
ierr = check_nml_error(io,"cg_drag_nml")
-#else
- if (file_exist('input.nml')) then
- unit = open_namelist_file ( )
- ierr=1; do while (ierr /= 0)
- read (unit, nml=cg_drag_nml, iostat=io, end=10)
- ierr = check_nml_error (io, 'cg_drag_nml')
- enddo
-10 call close_file (unit)
- endif
-#endif
!---------------------------------------------------------------------
! write version number and namelist to logfile.
@@ -488,31 +478,11 @@ subroutine cg_drag_init (lonb, latb, pref, Time, axes)
!--------------------------------------------------------------------
! if present, read the restart data file.
!---------------------------------------------------------------------
- if (size(restart_versions(:)) .gt. 2 ) then
- call cg_drag_register_restart
- endif
- if (file_exist('INPUT/cg_drag.res.nc')) then
- call read_nc_restart_file
+ cg_domain => domain
+ vers = 3 ! NetCDF version
+ call read_nc_restart_file
- elseif (file_exist('INPUT/cg_drag.res')) then
- call error_mesg ( 'cg_drag_mod', 'Native restart capability has been removed.', &
- FATAL)
-!-------------------------------------------------------------------
-! if no restart file is present, initialize the gwd field to zero.
-! define the time remaining until the next cg_drag calculation from
-! the namelist inputs.
-!-------------------------------------------------------------------
- else
- gwd_u(:,:,:) = 0.0
- gwd_v(:,:,:) = 0.0
- if (cg_drag_offset > 0) then
- cgdrag_alarm = cg_drag_offset
- else
- cgdrag_alarm = cg_drag_freq
- endif
- endif
- vers = restart_versions(size(restart_versions(:)))
old_time_step = cgdrag_alarm
!---------------------------------------------------------------------
! mark the module as initialized.
@@ -925,6 +895,9 @@ subroutine read_nc_restart_file
character(len=64) :: fname='INPUT/cg_drag.res.nc'
character(len=8) :: chvers
+ type(FmsNetcdfFile_t) :: Cg_restart !< Fms2io fileobj
+ type(FmsNetcdfDomainFile_t) :: Til_restart !< Fms2io domain fileobj
+ integer, allocatable, dimension(:) :: pes !< Array of the pes in the current pelist
!---------------------------------------------------------------------
! local variables:
@@ -941,79 +914,107 @@ subroutine read_nc_restart_file
&Reading netCDF formatted restart file:'//trim(fname), NOTE)
endif
-!-------------------------------------------------------------------
-! read the values of gwd_u and gwd_v
-!-------------------------------------------------------------------
- if (size(restart_versions(:)) .le. 2 ) then
- call error_mesg ('cg_drag_mod', 'read_restart_nc: restart file format is netcdf, ' // &
- 'restart_versions is not netcdf file version', FATAL)
- endif
- call restore_state(Cg_restart)
- if(in_different_file) call restore_state(Til_restart)
- if (.not. any(vers == restart_versions) ) then
- write (chvers, '(i4)') vers
- call error_mesg ('cg_drag_init', &
- 'restart version '//chvers//' cannot be read &
- &by this module version', FATAL)
- endif
- vers = restart_versions(size(restart_versions(:)))
+ !< Get the current pelist
+ allocate(pes(mpp_npes()))
+ call mpp_get_current_pelist(pes)
+
+ !< Open the scalar file with the current pelist, so that only the root pe opens and reads the file and
+ !! distributes the data to the other pes
+ !> read the values of gwd_u and gwd_v
+ if (open_file(Cg_restart, fname, "read", is_restart = .true., pelist=pes)) then
+ call cg_drag_register_restart(Cg_restart)
+ call read_restart(Cg_restart)
+ call close_file(Cg_restart)
+
+ !> if current cg_drag calling frequency differs from that previously
+ !! used, adjust the time remaining before the next calculation.
+ if (cg_drag_freq /= old_time_step) then
+ cgdrag_alarm = cgdrag_alarm - old_time_step + cg_drag_freq
+ if (mpp_pe() == mpp_root_pe() ) then
+ call error_mesg ('cg_drag_mod', &
+ 'cgdrag time step has changed, &
+ &next cgdrag time also changed', NOTE)
+ endif
+ old_time_step = cg_drag_freq
+ endif
-!--------------------------------------------------------------------
-! if current cg_drag calling frequency differs from that previously
-! used, adjust the time remaining before the next calculation.
-!--------------------------------------------------------------------
- if (cg_drag_freq /= old_time_step) then
- cgdrag_alarm = cgdrag_alarm - old_time_step + cg_drag_freq
- if (mpp_pe() == mpp_root_pe() ) then
- call error_mesg ('cg_drag_mod', &
- 'cgdrag time step has changed, &
- &next cgdrag time also changed', NOTE)
+ !> if cg_drag_offset is specified and is smaller than the time remaining
+ !! until the next calculation, modify the time remaining to be
+ !! that offset time. the assumption is made that the restart was
+ !! written at 00Z.
+ if (cg_drag_offset /= 0) then
+ if (cgdrag_alarm > cg_drag_offset) then
+ cgdrag_alarm = cg_drag_offset
+ endif
endif
- old_time_step = cg_drag_freq
- endif
+ else
-!--------------------------------------------------------------------
-! if cg_drag_offset is specified and is smaller than the time remain-
-! ing until the next calculation, modify the time remaining to be
-! that offset time. the assumption is made that the restart was
-! written at 00Z.
-!--------------------------------------------------------------------
- if (cg_drag_offset /= 0) then
- if (cgdrag_alarm > cg_drag_offset) then
+ !> if no restart file is present, initialize the gwd field to zero.
+ !! define the time remaining until the next cg_drag calculation from
+ !! the namelist inputs.
+ if (cg_drag_offset > 0) then
cgdrag_alarm = cg_drag_offset
+ else
+ cgdrag_alarm = cg_drag_freq
endif
endif
+ deallocate(pes)
+
+ if (open_file(Til_restart, fname, "read", cg_domain, is_restart = .true.)) then
+ call cg_drag_register_tile_restart(Til_restart)
+ call read_restart(Til_restart)
+ call close_file(Til_restart)
+ else
+ !> if no restart file is present, initialize the gwd field to zero.
+ !! define the time remaining until the next cg_drag calculation from
+ !! the namelist inputs.
+ gwd_u(:,:,:) = 0.0
+ gwd_v(:,:,:) = 0.0
+ endif
!---------------------------------------------------------------------
end subroutine read_nc_restart_file
!####################################################################
! register restart field to be read and written through save_restart and restore_state.
-subroutine cg_drag_register_restart
+subroutine cg_drag_register_restart(Cg_restart)
- character(len=64) :: fname = 'cg_drag.res.nc' ! name of restart file
- character(len=64) :: fname2
- integer :: id_restart
+ type(FmsNetcdfFile_t), intent(inout) :: Cg_restart !< Fms2io file obj
+ character(len=8), dimension(1) :: dim_names !< Array of dimension names
- call get_mosaic_tile_file(fname, fname2, .false. )
- allocate(Cg_restart)
- if(trim(fname2) == trim(fname)) then
- Til_restart => Cg_restart
- in_different_file = .false.
- else
- in_different_file = .true.
- allocate(Til_restart)
- endif
+ dim_names(1) = "Time"
+ call register_axis(Cg_restart, dim_names(1), unlimited)
+ call register_restart_field(Cg_restart, "restart_version", vers, dim_names)
+ call register_restart_field(Cg_restart, "cgdrag_alarm", cgdrag_alarm, dim_names)
+ call register_restart_field(Cg_restart, "cg_drag_freq", old_time_step, dim_names)
- id_restart = register_restart_field(Cg_restart, fname, 'restart_version', vers, no_domain = .true. )
- id_restart = register_restart_field(Cg_restart, fname, 'cgdrag_alarm', cgdrag_alarm, no_domain = .true. )
- id_restart = register_restart_field(Cg_restart, fname, 'cg_drag_freq', old_time_step, no_domain = .true. )
- id_restart = register_restart_field(Til_restart, fname, 'gwd_u', gwd_u)
- id_restart = register_restart_field(Til_restart, fname, 'gwd_v', gwd_v)
+end subroutine cg_drag_register_restart
- return
+!> \brief register restart field to be read and written through save_restart and restore_state.
+subroutine cg_drag_register_tile_restart (Til_restart)
-end subroutine cg_drag_register_restart
+ type(FmsNetcdfDomainFile_t), intent(inout) :: Til_restart !< Fms2io domain file obj
+ character(len=8), dimension(4) :: dim_names !< Array of dimension names
+
+ dim_names(1) = "xaxis_1"
+ dim_names(2) = "yaxis_1"
+ dim_names(3) = "zaxis_1"
+ dim_names(4) = "Time"
+
+ call register_axis(Til_restart, dim_names(1), "x")
+ call register_axis(Til_restart, dim_names(2), "y")
+ call register_axis(Til_restart, dim_names(3), size(gwd_u, 3))
+ if (.not. Til_restart%mode_is_append) call register_axis(Til_restart, dim_names(4), unlimited)
+
+ !< Register the domain decomposed dimensions as variables so that the combiner can work
+ !! correctly
+ call register_field(Til_restart, dim_names(1), "double", (/dim_names(1)/))
+ call register_field(Til_restart, dim_names(2), "double", (/dim_names(2)/))
+
+ call register_restart_field(Til_restart, "gwd_u", gwd_u, dim_names)
+ call register_restart_field(Til_restart, "gwd_v", gwd_v, dim_names)
+
+end subroutine cg_drag_register_tile_restart
!####################################################################
!
@@ -1027,12 +1028,65 @@ end subroutine cg_drag_register_restart
!
!
subroutine cg_drag_restart(timestamp)
- character(len=*), intent(in), optional :: timestamp
+ character(len=*), intent(in), optional :: timestamp !< A character string that represents the model time,
+ !! used for writing restart. timestamp will append to
+ !! the any restart file name as a prefix.
+
+ character(len=128) :: fname
+ type(FmsNetcdfFile_t) :: Cg_restart
+ type(FmsNetcdfDomainFile_t) :: Til_restart
+ logical :: tile_file_exist
+ integer, allocatable, dimension(:) :: pes
+
+ if (present(timestamp)) then
+ fname='RESTART/'//trim(timestamp)//'.cg_drag.res.nc'
+ else
+ fname='RESTART/cg_drag.res.nc'
+ endif
+
+ !< Get the current pelist
+ allocate(pes(mpp_npes()))
+ call mpp_get_current_pelist(pes)
+
+ !< Open the scalar file with the current pelist, so that only the root pe opens and writes the file
+ if (open_file(Cg_restart, fname, "overwrite", is_restart = .true., pelist=pes)) then
+ call cg_drag_register_restart(Cg_restart)
+ call write_restart(Cg_restart)
+ call close_file(Cg_restart)
+ endif
+ deallocate(pes)
+
+ if (mpp_get_ntile_count(cg_domain) == 1) then
+ tile_file_exist = open_file(Til_restart, fname, "append", cg_domain, is_restart = .true.)
+ else
+ tile_file_exist = open_file(Til_restart, fname, "overwrite", cg_domain, is_restart = .true.)
+ endif
- call save_restart(Cg_restart, timestamp)
- if(in_different_file) call save_restart(Til_restart, timestamp)
+ if (tile_file_exist) then
+ call cg_drag_register_tile_restart(Til_restart)
+ call write_restart(Til_restart)
+ call add_domain_dimension_data(Til_restart)
+ call close_file(Til_restart)
+ endif
end subroutine cg_drag_restart
+
+!< Add_dimension_data: Adds dummy data for the domain decomposed axis
+subroutine add_domain_dimension_data(fileobj)
+ type(FmsNetcdfDomainFile_t) :: fileobj !< Fms2io domain decomposed fileobj
+ integer, dimension(:), allocatable :: buffer !< Buffer with axis data
+ integer :: is, ie !< Starting and Ending indices for data
+
+ call get_global_io_domain_indices(fileobj, "xaxis_1", is, ie, indices=buffer)
+ call write_data(fileobj, "xaxis_1", buffer)
+ deallocate(buffer)
+
+ call get_global_io_domain_indices(fileobj, "yaxis_1", is, ie, indices=buffer)
+ call write_data(fileobj, "yaxis_1", buffer)
+ deallocate(buffer)
+
+end subroutine add_domain_dimension_data
+
! NAME=cg_drag_restart"
diff --git a/atmos_param/cloud_generator/betaDistribution.F90 b/atmos_param/cloud_generator/betaDistribution.F90
index 52129ae0..15a0909b 100644
--- a/atmos_param/cloud_generator/betaDistribution.F90
+++ b/atmos_param/cloud_generator/betaDistribution.F90
@@ -1,7 +1,7 @@
module beta_dist_mod
use fms_mod,only: stdlog, write_version_number, &
error_mesg, FATAL
- use fms_mod,only: open_file, close_file, read_distributed
+ use fms_io_mod,only: open_file, close_file, read_distributed
use mpp_mod,only: get_unit
implicit none
private
diff --git a/atmos_param/cloud_generator/cloud_generator.F90 b/atmos_param/cloud_generator/cloud_generator.F90
index 8300b015..6b9a6083 100644
--- a/atmos_param/cloud_generator/cloud_generator.F90
+++ b/atmos_param/cloud_generator/cloud_generator.F90
@@ -5,11 +5,11 @@ module cloud_generator_mod
use constants_mod, only: hlv, hls, cp_air, tfreeze, &
rvgas, rdgas
use mpp_mod, only: input_nml_file
- use fms_mod, only: open_namelist_file, mpp_pe, &
+ use fms_mod, only: mpp_pe, &
mpp_root_pe, stdlog, &
- write_version_number, file_exist, &
+ write_version_number, &
check_nml_error, error_mesg, &
- FATAL, close_file
+ FATAL
use random_numbers_mod, only: randomNumberStream, &
getRandomNumbers
use beta_dist_mod, only: beta_dist_init, beta_dist_end, &
@@ -143,7 +143,7 @@ subroutine cloud_generator_init
!----------------------------------------------------------------------
! local variables:
- integer :: unit, ierr, io, logunit
+ integer :: ierr, io, logunit
!--------------------------------------------------------------------
! local variables:
@@ -158,19 +158,8 @@ subroutine cloud_generator_init
!---------------------------------------------------------------------
! read namelist.
!---------------------------------------------------------------------
-#ifdef INTERNAL_FILE_NML
read (input_nml_file, nml=cloud_generator_nml, iostat=io)
ierr = check_nml_error(io,"cloud_generator_nml")
-#else
- if (file_exist('input.nml')) then
- unit = open_namelist_file ( )
- ierr=1; do while (ierr /= 0)
- read (unit, nml=cloud_generator_nml, iostat=io, end=10)
- ierr = check_nml_error (io, 'cloud_generator_nml')
- enddo
-10 call close_file (unit)
- endif
-#endif
!----------------------------------------------------------------------
! write version number and namelist to logfile.
!---------------------------------------------------------------------
diff --git a/atmos_param/cloud_obs/cloud_obs.F90 b/atmos_param/cloud_obs/cloud_obs.F90
index 8166b97e..63a168b6 100644
--- a/atmos_param/cloud_obs/cloud_obs.F90
+++ b/atmos_param/cloud_obs/cloud_obs.F90
@@ -10,11 +10,10 @@ module cloud_obs_mod
use horiz_interp_mod, only: horiz_interp_type, horiz_interp_init, &
horiz_interp_new, horiz_interp, horiz_interp_del
use mpp_mod, only: input_nml_file
-use fms_mod, only: file_exist, error_mesg, FATAL, NOTE, &
- open_namelist_file, close_file, &
+use fms_mod, only: error_mesg, FATAL, NOTE, &
check_nml_error, mpp_pe, mpp_root_pe, &
- write_version_number, stdlog, open_ieee32_file
-use fms_io_mod, only: read_data
+ write_version_number, stdlog
+use fms2_io_mod, only: file_exists, FmsNetcdfFile_t, open_file, read_data, close_file
use time_manager_mod, only: time_type, get_date
use time_interp_mod, only: time_interp
@@ -84,6 +83,7 @@ subroutine cloud_obs ( is, js, Time, cldamt )
logical,save :: useclimo1,useclimo2
logical :: unit_opened
integer :: nrecords, tlvl
+ type(FmsNetcdfFile_t) :: cloud_obs_data_file !< Fms2io fileobj
!-----------------------------------------------------------------------
if ( .not. module_is_initialized) &
@@ -101,7 +101,7 @@ subroutine cloud_obs ( is, js, Time, cldamt )
! --- check existence of cloud data set --------
- if (.not.file_exist('INPUT/cloud_obs.data')) then
+ if (.not.file_exists('INPUT/cloud_obs.data')) then
call error_mesg ('observed_cloud', &
'file INPUT/cloud_obs.data does not exist.', FATAL)
endif
@@ -124,16 +124,17 @@ subroutine cloud_obs ( is, js, Time, cldamt )
! we can easily modify the code to accommodate the change. As of now,
! since the native format data file does not contain any year information,
! we don't process year and just use month to get data.
- if(file_exist('INPUT/cloud_obs.data.nc')) then
+ if (open_file(cloud_obs_data_file, 'INPUT/cloud_obs.data.nc' , "read", is_restart = .false.)) then
call get_date (Time, year, month, day, hour, minute, second)
if(mpp_pe() == mpp_root_pe()) call error_mesg ('cloud_obs_mod', &
- 'Reading NetCDF formatted input file: INPUT/cloud_obs.data.nc', NOTE)
- call read_data('INPUT/cloud_obs.data.nc', 'nrecords', nrecords, no_domain=.true.)
+ 'Reading NetCDF formatted input file with new io: INPUT/cloud_obs.data.nc', NOTE)
+ call read_data(cloud_obs_data_file, 'nrecords', nrecords)
tlvl = month
- call read_data('INPUT/cloud_obs.data.nc', 'obs', obs, timelevel=tlvl, no_domain=.true.)
+ call read_data(cloud_obs_data_file, 'obs', obs, unlim_dim_level=tlvl)
do n=1,3
call horiz_interp (Interp, obs(:,:,n), cldb(:,:,n), verbose=verbose)
enddo
+ call close_file(cloud_obs_data_file)
goto 381
end if
@@ -145,7 +146,7 @@ subroutine cloud_obs ( is, js, Time, cldamt )
if (year1 .ne. yrclda .or. month1 .ne. moclda) then
unit_opened=.true.
- unit = open_ieee32_file ( 'INPUT/cloud_obs.data', action='read' )
+ open(file='INPUT/cloud_obs.data', form='unformatted',action='read', newunit=unit)
irec=0
do
!!!! read (unit,end=380) yr,mo,obs
@@ -175,7 +176,7 @@ subroutine cloud_obs ( is, js, Time, cldamt )
if (year2 .ne. yrcldb .or. month2 .ne. mocldb) then
if (.not.unit_opened) then
unit_opened=.true.
- unit = open_ieee32_file ( 'INPUT/cloud_obs.data', action='read' )
+ open(file='INPUT/cloud_obs.data', form='unformatted',action='read', newunit=unit)
endif
if (useclimo1 .and. month2 <= month1 ) then
if (verbose > 1 .and. pe == mpp_root_pe()) &
@@ -216,8 +217,8 @@ subroutine cloud_obs ( is, js, Time, cldamt )
381 continue
- if (unit_opened .or. file_exist('INPUT/cloud_obs.data.nc')) then
- if(unit_opened) call close_file (unit)
+ if (unit_opened .or. file_exists('INPUT/cloud_obs.data.nc')) then
+ if(unit_opened) call close(unit)
if (verbose > 0 .and. pe == 0) then
call get_date (Time, year, month, day, hour, minute, second)
write (*,600) year,month,day, hour,minute,second
@@ -262,19 +263,8 @@ subroutine cloud_obs_init (lonb,latb)
!------- read namelist --------
-#ifdef INTERNAL_FILE_NML
read (input_nml_file, nml=cloud_obs_nml, iostat=io)
ierr = check_nml_error(io,"cloud_obs_nml")
-#else
- if (file_exist('input.nml')) then
- unit = open_namelist_file ()
- ierr=1; do while (ierr /= 0)
- read (unit, nml=cloud_obs_nml, iostat=io, end=10)
- ierr = check_nml_error(io,'cloud_obs_nml')
- enddo
- 10 call close_file (unit)
- endif
-#endif
!------- write version number and namelist ---------
diff --git a/atmos_param/cloud_rad/cloud_rad.F90 b/atmos_param/cloud_rad/cloud_rad.F90
index 64f4cb07..c4fd2a4f 100644
--- a/atmos_param/cloud_rad/cloud_rad.F90
+++ b/atmos_param/cloud_rad/cloud_rad.F90
@@ -218,11 +218,10 @@ module cloud_rad_mod
! shared modules:
use mpp_mod, only: input_nml_file
-use fms_mod, only: file_exist, fms_init, &
+use fms_mod, only: fms_init, &
stdlog, mpp_pe, mpp_root_pe, &
- open_namelist_file, &
write_version_number, &
- error_mesg, FATAL, close_file, &
+ error_mesg, FATAL, &
check_nml_error
use constants_mod, only: RDGAS, GRAV, TFREEZE, DENS_H2O, &
constants_init, pi
@@ -508,7 +507,7 @@ subroutine cloud_rad_init (Exch_ctrl)
!----------------------------------------------------------------------
! Internal variables
- integer :: unit, io, ierr, logunit
+ integer :: io, ierr, logunit
!---------------------------------------------------------------------
! if routine has already been executed, exit.
@@ -528,19 +527,8 @@ subroutine cloud_rad_init (Exch_ctrl)
!--------------------------------------------------------------------
! read namelist.
!--------------------------------------------------------------------
-#ifdef INTERNAL_FILE_NML
read (input_nml_file, nml=cloud_rad_nml, iostat=io)
ierr = check_nml_error(io,'cloud_rad_nml')
-#else
- if ( file_exist('input.nml')) then
- unit = open_namelist_file ()
- ierr=1; do while (ierr /= 0)
- read (unit, nml=cloud_rad_nml, iostat=io, end=10)
- ierr = check_nml_error(io,'cloud_rad_nml')
- enddo
-10 call close_file (unit)
- endif
-#endif
!---------------------------------------------------------------------
! write version number and namelist to logfile.
diff --git a/atmos_param/cloud_zonal/cloud_zonal.F90 b/atmos_param/cloud_zonal/cloud_zonal.F90
index 1d24640c..c07e6d22 100644
--- a/atmos_param/cloud_zonal/cloud_zonal.F90
+++ b/atmos_param/cloud_zonal/cloud_zonal.F90
@@ -9,8 +9,8 @@ module cloud_zonal_mod
use time_manager_mod, only: time_type
use time_interp_mod, only: fraction_of_year
-use fms_mod, only: error_mesg, FATAL, open_file, &
- close_file, mpp_pe, mpp_root_pe, &
+use fms_mod, only: error_mesg, FATAL, &
+ mpp_pe, mpp_root_pe, &
write_version_number
implicit none
diff --git a/atmos_param/clouds/clouds.F90 b/atmos_param/clouds/clouds.F90
index 77fc4e31..b075edf8 100644
--- a/atmos_param/clouds/clouds.F90
+++ b/atmos_param/clouds/clouds.F90
@@ -14,9 +14,9 @@ module clouds_mod
use cloud_obs_mod, only: cloud_obs, cloud_obs_init
use time_manager_mod, only: time_type
use mpp_mod, only: input_nml_file
-use fms_mod, only: error_mesg, FATAL, file_exist, &
- check_nml_error, open_namelist_file, &
- mpp_pe, mpp_root_pe, close_file, &
+use fms_mod, only: error_mesg, FATAL, &
+ check_nml_error, &
+ mpp_pe, mpp_root_pe, &
write_version_number, stdlog
use rh_clouds_mod, only: do_rh_clouds, rh_clouds, rh_clouds_avg
use diag_cloud_mod, only: do_diag_cloud, diag_cloud_driver, &
@@ -707,23 +707,12 @@ subroutine clouds_init ( lonb, latb, axes, Time )
integer, intent(in), dimension(4) :: axes
type(time_type), intent(in) :: Time
!-----------------------------------------------------------------------
- integer unit,io,ierr, logunit
+ integer io,ierr, logunit
!-------------- read namelist --------------
-#ifdef INTERNAL_FILE_NML
read (input_nml_file, nml=clouds_nml, iostat=io)
ierr = check_nml_error(io,"clouds_nml")
-#else
- if ( file_exist('input.nml')) then
- unit = open_namelist_file ()
- ierr=1; do while (ierr /= 0)
- read (unit, nml=clouds_nml, iostat=io, end=10)
- ierr = check_nml_error(io,'clouds_nml')
- enddo
- 10 call close_file (unit)
- endif
-#endif
! ----- write namelist -----
diff --git a/atmos_param/clubb/CLUBB_core/mt95.f90 b/atmos_param/clubb/CLUBB_core/mt95.f90
index e0d73ab8..3d606067 100644
--- a/atmos_param/clubb/CLUBB_core/mt95.f90
+++ b/atmos_param/clubb/CLUBB_core/mt95.f90
@@ -1,10 +1,10 @@
! A C-program for MT19937, with initialization improved 2002/1/26.
! Coded by Takuji Nishimura and Makoto Matsumoto.
-! Code converted to Fortran 95 by José Rui Faustino de Sousa
+! Code converted to Fortran 95 by José Rui Faustino de Sousa
! Date: 2002-02-01
-! Enhanced version by José Rui Faustino de Sousa
+! Enhanced version by José Rui Faustino de Sousa
! Date: 2003-04-30
! Interface:
@@ -1310,7 +1310,7 @@ subroutine genrand_res53_7d( r )
end subroutine genrand_res53_7d
! These real versions are due to Isaku Wada, 2002/01/09 added
- ! Altered by José Sousa genrand_real[1-3] will not return exactely
+ ! Altered by José Sousa genrand_real[1-3] will not return exactely
! the same values but should have the same properties and are faster
end module mt95
diff --git a/atmos_param/clubb/CLUBB_driver_SCM.F90 b/atmos_param/clubb/CLUBB_driver_SCM.F90
index f5fd1cdd..db3b07b6 100644
--- a/atmos_param/clubb/CLUBB_driver_SCM.F90
+++ b/atmos_param/clubb/CLUBB_driver_SCM.F90
@@ -107,14 +107,14 @@ module clubb_driver_mod
use constants_mod, only: RAD_TO_DEG
use mpp_mod, only: mpp_pe, mpp_root_pe, stdlog, mpp_chksum, &
mpp_clock_id, mpp_clock_begin, mpp_clock_end, &
- CLOCK_MODULE_DRIVER
+ CLOCK_MODULE_DRIVER, input_nml_file
use diag_manager_mod, only: register_diag_field, send_data
use time_manager_mod, only: time_type, get_time, set_time, get_date, &
operator(+), operator(-)
-use fms_mod, only: write_version_number, open_file, &
- open_namelist_file, check_nml_error, &
- file_exist, error_mesg, close_file, &
- read_data, write_data, &
+use fms2_io_mod, only: file_exists
+use fms_mod, only: write_version_number, &
+ check_nml_error, &
+ error_mesg, &
mpp_error, FATAL, NOTE
use field_manager_mod, only: MODEL_ATMOS
use tracer_manager_mod, only: get_number_tracers, get_tracer_index, &
@@ -2213,7 +2213,7 @@ subroutine clubb_init(id, jd, kd, lon, lat, axes, Time, phalf, &
! ----- Local variables -----
integer, dimension(3) :: half = (/1,2,4/)
- integer :: ierr, io, unit !open namelist error
+ integer :: ierr, io !open namelist error
integer :: i, j, n
@@ -2238,23 +2238,13 @@ subroutine clubb_init(id, jd, kd, lon, lat, axes, Time, phalf, &
! ----- Read namelist -----
- if ( file_exist( 'input.nml' ) ) then
+ if ( file_exists( 'input.nml' ) ) then
- unit = open_namelist_file ( )
- ierr = 1
- do while( ierr /= 0 )
- read ( unit, nml = clubb_setting_nml, iostat = io, end = 10 )
- ierr = check_nml_error (io, 'clubb_setting_nml')
- end do
-10 call close_file( unit )
+ read (input_nml_file, nml=clubb_setting_nml, iostat=io)
+ ierr = check_nml_error(io,"clubb_setting_nml")
- unit = open_namelist_file ( )
- ierr = 1
- do while( ierr /= 0 )
- read ( unit, nml = clubb_stats_setting_nml, iostat = io, end = 20 )
- ierr = check_nml_error (io, 'clubb_stats_setting_nml')
- end do
-20 call close_file( unit )
+ read (input_nml_file, nml=clubb_stats_setting_nml, iostat=io)
+ ierr = check_nml_error(io,"clubb_stats_setting_nml")
end if
@@ -2614,9 +2604,6 @@ subroutine clubb_init(id, jd, kd, lon, lat, axes, Time, phalf, &
RAD_TO_DEG*lon(istats,jstats), RAD_TO_DEG*lat(istats,jstats), &
trim(fname_prefix(fstats))
- unit_stats = open_namelist_file()
- close(unit_stats)
-
Time_stats_init = Time
call get_date( Time_stats_init, year, month, day, hour, minute, second )
time_current = 3600.0*hour + 60.0*minute + second
diff --git a/atmos_param/convection_driver/convection_driver.F90 b/atmos_param/convection_driver/convection_driver.F90
index 73b6db9b..07fe31c3 100644
--- a/atmos_param/convection_driver/convection_driver.F90
+++ b/atmos_param/convection_driver/convection_driver.F90
@@ -1,101 +1,160 @@
+
module convection_driver_mod
!-----------------------------------------------------------------------
!
-! interface module for convective processes
+! This module accesses the following convective parameterizations.
+! Access is controlled by logical variables found in
+! moist_processes_nml.
+!
! ---------------------------------------
-! dry convective adjustment
-! moist convective adjustment
-! relaxed arakawa-schubert
-! donner deep convection
-! betts-miller convective adjustment
-! uw shallow convection
-! cumulus momentum transport
+! 1) dry convective adjustment
+! 2) moist convective adjustment
+! 3) relaxed arakawa-schubert
+! 4) donner deep convection
+! 5) betts-miller convective adjustment (3 varieties)
+! 6) uw convection
+!
+! The following convective implementations are available:
+! -------------------------------------------------
+! 1) dry convective adjustment alone
+! 2) moist convective adjustment alone
+! 3) dry convective adjustment followed by moist convective
+! adjustment
+! 4) betts-miller convection alone, as either
+! a) standard version,
+! b) a mass flux based version, or
+! c) a version developed by O. Pauluis.
+! 5) relaxed arakawa-schubert alone
+! 6) donner convection alone
+! 7) uw convection alone
+! 8) donner convection followed by relaxed arakawa-schubert
+! 9) donner convection followed by uw convection
+! 10) uw convection followed by donner convection
+!
+!------------------------------------------------------------------------
!
+! The module also calculates cumulus momentum transport (if desired,
+! using either a diffusive or a non-local scheme), and produces needed
+! fields for input to the large-scale cloud scheme and COSP, updates
+! the time tendencies of model variables as a result of convection, and
+! outputs convective diagnostics.
+!
!-----------------------------------------------------------------------
-! fms modules
-use sat_vapor_pres_mod, only: compute_qs
-use time_manager_mod, only: time_type, get_time
-use diag_manager_mod, only: register_diag_field, send_data, &
- get_diag_field_id, DIAG_FIELD_NOT_FOUND
-use diag_data_mod, only: CMOR_MISSING_VALUE
-use mpp_mod, only: input_nml_file
-use fms_mod, only: error_mesg, FATAL, WARNING,NOTE,&
- file_exist, check_nml_error, &
- open_namelist_file, close_file, &
- write_version_number, &
- mpp_pe, mpp_root_pe, stdlog, &
- mpp_clock_id, mpp_clock_begin, &
- mpp_clock_end, CLOCK_MODULE, &
- CLOCK_MODULE_DRIVER, &
- MPP_CLOCK_SYNC, read_data, write_data
-use field_manager_mod, only: MODEL_ATMOS
-use tracer_manager_mod, only: get_tracer_index,&
- get_tracer_names, &
- query_method, &
- NO_TRACER
-use constants_mod, only: CP_AIR, HLV, HLS, HLF, RDGAS, RVGAS, &
- SECONDS_PER_DAY, KAPPA, AVOGNO
-! atmos_param modules
-use physics_types_mod, only: physics_control_type, phys_mp_exch_type
-use vert_diff_driver_mod, only: surf_diff_type
+
+
+! infrastructure modules
+use sat_vapor_pres_mod, only: compute_qs
+use time_manager_mod, only: time_type, get_time, assignment(=)
+use diag_manager_mod, only: register_diag_field, send_data, &
+ get_diag_field_id, DIAG_FIELD_NOT_FOUND
+use diag_data_mod, only: CMOR_MISSING_VALUE
+use mpp_domains_mod, only: domain2D
+use mpp_mod, only: input_nml_file
+use fms2_io_mod, only: file_exists
+use fms_mod, only: error_mesg, FATAL, WARNING,NOTE,&
+ check_nml_error, &
+ write_version_number, &
+ mpp_pe, mpp_root_pe, stdlog, &
+ mpp_clock_id, mpp_clock_begin, &
+ mpp_clock_end, CLOCK_MODULE, &
+ CLOCK_MODULE_DRIVER, &
+ MPP_CLOCK_SYNC
+use field_manager_mod, only: MODEL_ATMOS
+use tracer_manager_mod, only: get_tracer_index,&
+ get_tracer_names, &
+ NO_TRACER
+use constants_mod, only: CP_AIR, HLV, HLS, HLF, RDGAS, RVGAS, &
+ SECONDS_PER_DAY, KAPPA, AVOGNO
+use atmos_global_diag_mod, only: register_global_diag_field, &
+ buffer_global_diag
+use atmos_cmip_diag_mod, only: register_cmip_diag_field_2d, &
+ register_cmip_diag_field_3d, &
+ send_cmip_data_3d, &
+ query_cmip_diag_id, &
+ cmip_diag_id_type
+
+! atmos modules
+use physics_types_mod, only: physics_control_type, phys_mp_exch_type
+use vert_diff_driver_mod, only: surf_diff_type
use physics_radiation_exch_mod, &
- only: clouds_from_moist_block_type, &
- exchange_control_type
-use betts_miller_mod, only: betts_miller, betts_miller_init
-use bm_massflux_mod, only: bm_massflux, bm_massflux_init
-use bm_omp_mod, only: bm_omp, bm_omp_init
-use donner_deep_mod, only: donner_deep_init, &
- donner_deep_time_vary, &
- donner_deep_endts, &
- donner_deep, donner_deep_end, &
- donner_deep_restart
-use moist_conv_mod, only: moist_conv, moist_conv_init
-use uw_conv_mod, only: uw_conv_end, uw_conv_init
-use ras_mod, only: ras_end, ras_init
-use dry_adj_mod, only: dry_adj, dry_adj_init
-use detr_ice_num_mod, only: detr_ice_num, detr_ice_num_init, &
- detr_ice_num_end
-use rh_clouds_mod, only: rh_clouds_init, rh_clouds_end, &
- rh_clouds_sum
-use cu_mo_trans_mod, only: cu_mo_trans_init, cu_mo_trans, &
- cu_mo_trans_end
-use moz_hook_mod, only: moz_hook
-use aerosol_types_mod, only: aerosol_type
-use moist_proc_utils_mod, only: capecalcnew, column_diag, rh_calc, &
- mp_nml_type, mp_input_type, &
- mp_tendency_type, mp_removal_type, &
- mp_removal_control_type, &
- mp_conv2ls_type, mp_output_type
-use moistproc_kernels_mod, only: moistproc_mca, moistproc_ras, &
- moistproc_cmt, moistproc_uw_conv, &
- moistproc_scale_uw, moistproc_scale_donner
-! atmos_shared modules
+ only: clouds_from_moist_block_type, &
+ exchange_control_type, &
+ cloud_scheme_data_type
+use betts_miller_mod, only: betts_miller, betts_miller_init
+use bm_massflux_mod, only: bm_massflux, bm_massflux_init
+use bm_omp_mod, only: bm_omp, bm_omp_init
+use donner_deep_mod, only: donner_deep_init, &
+ donner_deep_time_vary, &
+ donner_deep_endts, &
+ donner_deep, donner_deep_end, &
+ donner_deep_restart
+use moist_conv_mod, only: moist_conv, moist_conv_init
+use uw_conv_mod, only: uw_conv, uw_conv_end, uw_conv_init
+use ras_mod, only: ras_end, ras_init, ras
+use dry_adj_mod, only: dry_adj, dry_adj_init
+use detr_ice_num_mod, only: detr_ice_num, detr_ice_num_init, &
+ detr_ice_num_end
+use rh_clouds_mod, only: do_rh_clouds, rh_clouds_sum
+use cu_mo_trans_mod, only: cu_mo_trans_init, cu_mo_trans, &
+ cu_mo_trans_end
+use moz_hook_mod, only: moz_hook
+use aerosol_types_mod, only: aerosol_type
+use moist_proc_utils_mod, only: capecalcnew, column_diag, rh_calc, &
+ mp_nml_type, mp_input_type, &
+ mp_tendency_type, mp_removal_type, &
+ mp_removal_control_type, &
+ mp_conv2ls_type, mp_output_type
+use convection_utilities_mod, &
+ only: conv_tendency_type, &
+ conv_output_type, donner_input_type,&
+ conv_results_type
use atmos_tracer_utilities_mod, &
- only: wet_deposition
-use diag_axis_mod, only: get_axis_num
-use atmos_global_diag_mod, only: register_global_diag_field, &
- buffer_global_diag, &
- send_global_diag
-use atmos_cmip_diag_mod, only: register_cmip_diag_field_2d, &
- register_cmip_diag_field_3d, &
- send_cmip_data_3d, &
- cmip_diag_id_type, &
- query_cmip_diag_id
+ only: wet_deposition
+
implicit none
private
!-----------------------------------------------------------------------
!-------------------- public data/interfaces ---------------------------
- public convection_driver_init, convection_driver, &
- convection_driver_time_vary, convection_driver_endts, &
- convection_driver_end, convection_driver_restart, &
- cape_cin_diagnostics
-
- private diag_field_init, prevent_neg_precip_fluxes, &
- compute_convective_area
+public convection_driver_init, convection_driver_time_vary, &
+ convection_driver, convection_driver_endts, &
+ convection_driver_end, &
+ convection_driver_restart, cape_cin_diagnostics
+
+private &
+! initialization:
+ diag_field_init, &
+! called in prognostic loop:
+ convection_driver_alloc, define_total_convective_output, &
+ convective_diagnostics, define_convective_area, &
+ compute_convective_area, &
+ define_inputs_for_cosp, prevent_neg_precip_fluxes, &
+ convection_driver_dealloc, &
+! associated with donner convection:
+ donner_driver, donner_alloc, donner_prep, &
+ process_donner_output, check_donner_conservation, &
+ prevent_unrealizable_water, define_output_fields, &
+ donner_mca_driver, output_donner_diagnostics, &
+ donner_dealloc, &
+! associated with dry convective adjustment:
+ dca_driver, &
+! associated with betts-miller convection:
+ betts_miller_driver, &
+! associated with moist convective adjustment:
+ mca_driver, &
+! associated with uw-then-donner convection:
+ uw_then_donner_driver, &
+! associated with uw convection:
+ uw_conv_driver, uw_conv_driver_part, uw_alloc, &
+ finalize_uw_outputs, update_inputs, uw_diagnostics, &
+ uw_dealloc, &
+! associated with relaxed arakawa-schubert convection:
+ ras_driver, &
+! routines accessed by multiple convection implementations:
+ update_outputs, define_and_apply_scale
!-----------------------------------------------------------------------
!-------------------- private data -------------------------------------
@@ -103,220 +162,417 @@ module convection_driver_mod
!--------------------- version number ----------------------------------
character(len=128) :: version = '$Id: $'
character(len=128) :: tagname = '$Name: $'
+
+
!-------------------- namelist data (private) --------------------------
!---------------- namelist variable definitions -----------------------
-
!
-! do_limit_donner = limit Donner deeo tendencies to prevent the
+! do_cmt = compute cumulus momentum transport (default = T).
+! cmt_mass_flux_source = parameterization(s) being used to supply the
+! mass flux profiles seen by the cumulus momentum transport
+! module; currently either 'ras', 'donner', 'uw',
+! 'donner_and_ras', 'donner_and_uw', 'ras_and_uw',
+! 'donner_and_ras_and_uw' or 'all' (default = 'all').
+
+! do_gust_cv = switch to use convective gustiness (default = F).
+! do_gust_cv_new = switch to use newer convective gustiness expression
+! (default = F).
+! gustmax = maximum convective gustiness (m/s); default = 3.
+! gustconst = precip rate which defines precip rate which begins to
+! matter for convective gustiness (kg/m2/sec)
+! default = 1. cm/day = 10. mm/da
+
+! do_limit_donner = limit Donner deep tendencies to prevent the
! formation of grid points with negative water vapor,
-! liquid or ice.
+! liquid or ice (default = T).
!
! do_limit_uw = limit UW shallow tendencies to prevent the formation
-! of grid points with negative total water specific
+! of grid points with negative total water specific
! humidities. This situation can occur because both
! shallow and deep convection operate on the same
! soundings without knowledge of what the other is doing
+! (default = T).
!
! do_unified_convective_closure = use cloud base mass flux calculated
! in uw_conv module as value for donner deep parameter-
! ization; adjust cbmf available for uw shallow appropr-
! iately. only available when uw shallow and donner deep
-! are the active convective schemes
+! are the active convective schemes, CURRENTLY IS NOT
+! AVAILABLE (default = F).
+
+! do_donner_before_uw = calculate convection seen by donner scheme
+! before calculating what is seen by uw (default = T).
+! use_updated_profiles_for_uw = when donner convection is calculated
+! first, update the profiles with its effects before
+! calculating the uw convection (default = F).
+! use_updated_profiles_for_donner = when uw convection is calculated
+! first, update the profiles with its effects before
+! calculating the donner convection (default = F).
+! only_one_conv_scheme_per_column = once convection has been predicted
+! in a column, do not allow another scheme to also compute
+! convection in that column (default = F).
+
+! force_donner_moist_conserv = adjust donner precip to exactly balance
+! the moisture change in each model column (default = F).
+! do_donner_conservation_checks = Perform various checks to verify the
+! conservation of enthalpy and moisture as a result of the
+! donner convection calculation (default = T).
+
+! do_donner_mca = include a call to moist convective adjustment as a
+! final step in the donner calculation to remove any
+! remaining instability (default = F).
+
+! detrain_liq_num = if true, convective droplets may be detrained into
+! the large-scale clouds (default = F).
+! detrain_ice_num = if true, convective ice particles may be detrained
+! into the large-scale clouds (default = F).
+
+! conv_frac_max = the largest allowable convective cloud fraction in a
+! grid box (default = 0.99, used only for clubb scheme).
+
+! remain_detrain_bug = setting this to T will result in retaining a bug
+! which resulted in 10x fewer liquid droplets being
+! detrained into the large-scale clouds than should have
+! been (default = F).
+! keep_icenum_detrain_bug = setting this to T will result in retaining
+! a bug where the ice number detrainment calculation module
+! receives an inconsistent temperature field with which to
+! perform the calculation, whereas in the
+! corrected code, all fields are updated before uw
+! convection is calculated. (default = F).
+! reproduce_AM4 = setting this to T will reproduce legacy
+! (warsaw) results because the model will use temperature
+! and tracer fields that have not been updated with the uw
+! convective tendency for the calculation of cu_mo_trans
+! and lightning (updated values should have been used for
+! consistency). ANSWERS THUS WILL CHANGE from warsaw results
+! for any runs using both uw convection and cu_mo_trans (or
+! tracer "no") when this variable is set to F, since in that
+! case all fields are updated with uw tendencies before the
+! cumulus momentum transport and lightning calculations
+! are done. (default = F).
+!----------------------------------------------------------------------
-! cmt_mass_flux_source = parameterization(s) being used to supply the
-! mass flux profiles seen by the cumulus momentum transport
-! module; currently either 'ras', 'donner', 'uw',
-! 'donner_and_ras', 'donner_and_uw', 'ras_and_uw',
-! 'donner_and_ras_and_uw' or 'all'
-! do_gust_cv = switch to use convective gustiness (default = false)
-! do_gust_cv_new = new switch to use convective gustiness
-! (default = false)
-! gustmax = maximum convective gustiness (m/s)
-! gustconst = precip rate which defines precip rate which begins to
-! matter for convective gustiness (kg/m2/sec)
-! default = 1 cm/day = 10 mm/da
-integer, public :: id_pr_g, id_prc_g, id_prsn_g, id_prsnc, id_prrc
-logical :: do_limit_donner =.true.
-logical :: do_limit_uw = .true.
-logical :: do_unified_convective_closure = .false.
+logical :: do_cmt=.true.
character(len=64) :: cmt_mass_flux_source = 'all'
logical :: do_gust_cv = .false.
logical :: do_gust_cv_new = .false.
-real :: gustmax = 3. ! maximum gustiness wind (m/s)
-real :: gustconst = 10./SECONDS_PER_DAY
+real :: gustmax = 3.
+real :: gustconst = 10./SECONDS_PER_DAY
+logical :: do_limit_donner =.true.
+logical :: do_limit_uw = .true.
+logical :: do_unified_convective_closure = .false.
logical :: do_donner_before_uw = .true.
logical :: use_updated_profiles_for_uw = .false.
+logical :: use_updated_profiles_for_donner = .false.
logical :: only_one_conv_scheme_per_column = .false.
-logical :: do_cmt=.true.
logical :: force_donner_moist_conserv = .false.
logical :: do_donner_conservation_checks = .true.
logical :: do_donner_mca=.false.
-logical :: using_fms = .true.
logical :: detrain_liq_num = .false.
logical :: detrain_ice_num = .false.
real :: conv_frac_max = 0.99
logical :: remain_detrain_bug = .false.
logical :: keep_icenum_detrain_bug = .false.
+logical :: reproduce_AM4 = .true.
+
namelist /convection_driver_nml/ &
+ do_cmt, cmt_mass_flux_source, &
+ do_gust_cv, do_gust_cv_new, gustmax, gustconst, &
do_limit_donner, do_limit_uw, &
do_unified_convective_closure, &
- cmt_mass_flux_source, do_gust_cv, do_gust_cv_new, &
- gustmax, gustconst, &
do_donner_before_uw, use_updated_profiles_for_uw, &
- only_one_conv_scheme_per_column, do_cmt, &
+ use_updated_profiles_for_donner, &
+ only_one_conv_scheme_per_column, &
force_donner_moist_conserv, do_donner_conservation_checks, &
- do_donner_mca, using_fms, detrain_liq_num, detrain_ice_num, &
- conv_frac_max, remain_detrain_bug, keep_icenum_detrain_bug
+ do_donner_mca, &
+ detrain_liq_num, detrain_ice_num, &
+ conv_frac_max, &
+ remain_detrain_bug, keep_icenum_detrain_bug, &
+ reproduce_AM4
+
+
+!------------------- other global variables ------------------------
+
+
+! variables imported during initialization and saved as module variables:
+real :: qmin ! minimum value for condensate specific
+ ! humidity
+logical :: do_liq_num ! prognostic cloud droplet number ?
+logical :: do_ice_num ! prognostic ice particle number ?
+logical :: do_cosp ! call COSP diagnostic package ?
+integer :: do_clubb ! using CLUBB as the large-scale cloud
+ ! scheme ?
+logical :: do_lsc ! using bulk large scale condensation ?
+logical :: do_mca ! moist convective adjustment is active?
+logical :: do_ras ! relaxed arakawa-schubert param
+ ! is active?
+logical :: do_uw_conv ! uw convection scheme is active ?
+logical :: do_donner_deep ! donner convection scheme is active ?
+logical :: do_dryadj ! dry convective adjustment is active ?
+logical :: limit_conv_cloud_frac ! total convective cloud area in a box
+ ! is limited to 0.999, when donner and
+ ! uw schemes are both active ?
+logical :: include_donmca_in_cosp ! assuming mca is included inside of
+ ! the donner scheme, are its contri-
+ ! butions to be seen by COSP ?
+logical :: do_rh_clouds_BM ! are rh clouds to be included in the
+ ! Betts-Miller scheme ?
+logical :: do_bm ! the basic bm scheme is active ?
+logical :: do_bmmass ! the mass flux version of bm
+ ! is active ?
+logical :: do_bmomp ! the Pauluis version of bm is active ?
+logical :: do_simple ! a simple formulation for rh is to be
+ ! used with the betts-miller scheme ?
+integer :: num_donner_tracers, & ! number of tracers transported by the
+ ! donner scheme
+ num_mca_tracers, & ! number of tracers to be transported
+ ! by moist convective adjustment
+ num_ras_tracers, & ! number of tracers to be transported
+ ! by the ras scheme
+ num_uw_tracers ! number of tracers to be transported
+ ! by the uw scheme
+logical :: doing_prog_clouds ! prognostic clouds are active ?
+integer :: nsphum, & ! tracer index for specific humidity
+ nql, & ! tracer index for cloud water
+ nqi, & ! tracer index for cloud ice
+ nqa, & ! tracer index for cloud area
+ nqn, & ! tracer index for cloud droplet number
+ nqni, & ! tracer index for cloud ice particle
+ ! number
+ nqr, & ! tracer index for rain water
+ nqs, & ! tracer index for snow
+ nqg ! tracer index for graupel
+integer :: num_prog_tracers ! total number of prognostic tracers
+logical, dimension(:), allocatable :: &
+ cloud_tracer ! logical array indicating which tracers
+ ! are cloud tracers
+logical, dimension(:), allocatable :: &
+ tracers_in_donner, & ! logical array indicating which tracers
+ ! are transported by donner convection
+ tracers_in_ras,& ! logical array indicating which tracers
+ ! are transported by ras convection
+ tracers_in_uw, & ! logical array indicating which tracers
+ ! are transported by uw convection
+ tracers_in_mca ! logical array indicating which tracers
+ ! are transported by mca
+
+! variables imported during the time_vary code segment and saved
+! as module variables:
+real :: dt ! model timestep [s]
+real :: dtinv ! inverse of model timestep
+type(time_type) :: Time ! Time at end of current step, used for
+ ! diagnostics
+integer :: i_cell, & ! index of donner cell clouds in cloud
+ ! array
+ i_meso, & ! index of donner meso clouds in cloud
+ ! array
+ i_shallow ! index of uw clouds in cloud array
+
+! variables used to define the active convective implementation:
+logical :: ldca = .false. ! dry convective adjustment only
+logical :: lmca = .false. ! moist convective adjustment only
+logical :: lras = .false. ! ras only
+logical :: luwconv = .false. ! uw only
+logical :: ldonner = .false. ! donner only
+logical :: lBM = .false. ! Betts-Miller only
+logical :: lBMmass = .false. ! Betts-Miller mass version only
+logical :: lBMomp = .false. ! Betts-Miller Pauluis version only
+logical :: ldcamca = .false. ! dry, then moist cnvctve adjustment
+logical :: ldonnerras = .false. ! donner and ras
+logical :: luw_then_donner = .false.
+ ! uw and then donner
+logical :: ldonner_then_uw = .false.
+ ! donner first, then uw
+
+real, allocatable, dimension(:,:) :: &
+ max_enthalpy_imbal_don, & ! max enthalpy budget imbalance from
+ ! donner parameterization during
+ ! current job segment
+ max_water_imbal_don ! max h2o budget imbalance from
+ ! donner parameterization during
+ ! current job segment
!-------------------- clock definitions --------------------------------
-integer :: convection_clock, donner_clock, mca_clock, ras_clock, &
- donner_mca_clock, bm_clock, cmt_clock, shallowcu_clock
+integer :: convection_clock, & ! clock to time total convection
+ donner_clock, & ! clock to time donner paramaeterization
+ dca_clock, & ! clock to time dry conv adjustment
+ mca_clock, & ! clock to time moist conv adjustment
+ uw_clock, & ! clock to time uw parameterization
+ donner_mca_clock, & ! clock to time mca with donner param
+ bm_clock, & ! clock to time betts-miller param
+ cmt_clock, & ! clock to time cumulus momentum
+ ! transport calculation
+ ras_clock ! clock to time ras parameterization
!-------------------- diagnostics variables ----------------------------
-integer :: id_cell_cld_frac, id_meso_cld_frac, id_donner_humidity_area
-integer :: id_tdt_conv, id_qdt_conv, id_prec_conv, id_snow_conv, &
- id_conv_freq, id_gust_conv, id_mc_full, id_mc_half, &
- id_tdt_dadj, id_mc_donner, id_mc_donner_half, &
- id_mc_conv_up, id_conv_cld_base, id_conv_cld_top, &
+!CMIP diagnostics:
+integer, public :: id_pr_g, id_prc_g, id_prsn_g, id_prsnc, id_prrc
+integer :: id_prc, id_ci, id_ccb, id_cct
+type(cmip_diag_id_type) :: ID_tntc, ID_tnhusc, ID_mc, ID_emilnox_area
+
+!donner convection diagnostics
+integer :: id_cell_cld_frac, id_meso_cld_frac, id_donner_humidity_area, &
+ id_mc_donner, id_mc_donner_half, &
id_tdt_deep_donner, id_qdt_deep_donner, &
- id_qadt_deep_donner, id_qldt_deep_donner, &
- id_qidt_deep_donner, &
+ id_qadt_deep_donner, id_qldt_deep_donner, id_qidt_deep_donner, &
id_qndt_deep_donner, id_qnidt_deep_donner, &
id_tdt_mca_donner, id_qdt_mca_donner, &
id_prec_deep_donner, id_precret_deep_donner,id_prec_mca_donner,&
- id_tdt_uw, id_qdt_uw, &
- id_qadt_uw, id_qldt_uw, id_qidt_uw, id_qndt_uw, id_qnidt_uw, &
id_prec1_deep_donner, id_snow_deep_donner, id_snow_mca_donner, &
- id_qadt_conv, id_qldt_conv, id_qndt_conv, id_qidt_conv, &
- id_qnidt_conv, &
- id_qa_conv_col, id_ql_conv_col, id_qn_conv_col, &
- id_qni_conv_col, id_qi_conv_col, &
- id_bmflag, id_klzbs, id_invtaubmt, id_invtaubmq, &
- id_massflux, id_tref, id_qref, &
- id_tp, id_rp, id_lcl, id_lfc, id_lzb, &
- id_q_conv_col, id_t_conv_col, &
- id_enth_conv_col, id_wat_conv_col, &
id_enth_donner_col, id_wat_donner_col, &
- id_enth_donner_col2, &
- id_enth_donner_col3, &
- id_enth_donner_col4, &
- id_enth_donner_col5, &
- id_enth_donner_col6, &
- id_enth_donner_col7, &
+ id_enth_donner_col2, id_enth_donner_col3, &
+ id_enth_donner_col4, id_enth_donner_col5, &
+ id_enth_donner_col6, id_enth_donner_col7, &
id_enth_mca_donner_col, id_wat_mca_donner_col, &
- id_enth_uw_col, id_wat_uw_col, &
- id_scale_donner, id_scale_uw, &
- id_ras_precip, id_ras_freq, id_don_precip, id_don_freq, &
- id_uw_precip, id_uw_snow, id_uw_freq, id_prod_no, &
- id_m_cdet_donner, id_m_cellup, id_conv_rain3d, id_conv_snow3d
-integer :: id_cape, id_cin
+ id_scale_donner, id_scale_donner_REV, &
+ id_m_cdet_donner, id_m_cellup, &
+ id_don_precip, id_don_freq
+integer :: id_max_enthalpy_imbal_don, id_max_water_imbal_don
integer :: id_vaporint, id_condensint, id_precipint, id_diffint
integer :: id_vertmotion
-integer :: id_max_enthalpy_imbal_don, id_max_water_imbal_don
integer :: id_enthint, id_lprcp, id_lcondensint, id_enthdiffint
+integer, dimension(:), allocatable :: &
+ id_tracerdt_mcadon, &
+ id_tracerdt_mcadon_col
-integer :: id_prc, id_ci, id_ccb, id_cct
+! uw diagnostics:
+integer :: id_tdt_uw, id_qdt_uw, &
+ id_qadt_uw, id_qldt_uw, id_qidt_uw, id_qndt_uw, id_qnidt_uw, &
+ id_scale_uw, &
+ id_uw_precip, id_uw_snow, id_uw_freq
+! total convection diagnostics:
+integer :: id_tdt_conv, id_qdt_conv, id_prec_conv, id_snow_conv, &
+ id_conv_freq, id_gust_conv, id_mc_full, id_mc_half, &
+ id_mc_conv_up, id_conv_cld_base, id_conv_cld_top, &
+ id_qadt_conv, id_qldt_conv, id_qndt_conv, id_qidt_conv, &
+ id_qnidt_conv, &
+ id_qa_conv_col, id_ql_conv_col, id_qn_conv_col, &
+ id_qni_conv_col, id_qi_conv_col, &
+ id_q_conv_col, id_t_conv_col, &
+ id_enth_conv_col, id_wat_conv_col, &
+ id_enth_uw_col, id_wat_uw_col, &
+ id_prod_no, id_conv_rain3d, id_conv_snow3d
integer, dimension(:), allocatable :: &
id_tracerdt_conv, &
id_tracerdt_conv_col, &
id_conv_tracer, &
- id_conv_tracer_col, &
- id_tracerdt_mcadon, &
- id_tracerdt_mcadon_col
+ id_conv_tracer_col
-real :: missing_value = -999.
-character(len=5), private :: mod_name = 'moist'
-character(len=8), private :: mod_name_tr = 'moist_tr' ! fixes name conflict with
- ! tracers and moist
+! dry adjustment diagnostic:
+integer :: id_tdt_dadj
+! BM diagnostics:
+integer :: id_bmflag, id_klzbs, id_invtaubmt, id_invtaubmq, &
+ id_massflux, id_tref, id_qref
+! cape-cin diagnostics:
+integer :: id_cape, id_cin, id_tp, id_rp, id_lcl, id_lfc, id_lzb
+
+!ras diagnostics:
+integer :: id_ras_precip, id_ras_freq
+
+
+character(len=5) :: mod_name = 'moist'
+character(len=8) :: mod_name2 = 'moist_tr'
+real :: missing_value = -999.
-!------------------- other global variables ------------------------
-real, allocatable, dimension(:,:) :: &
- max_enthalpy_imbal_don, max_water_imbal_don
-
-logical :: do_liq_num
-logical :: do_ice_num
-logical :: do_cosp
-integer :: do_clubb
-logical :: do_lsc
-logical :: do_mca
-logical :: do_ras
-logical :: do_uw_conv
-logical :: do_donner_deep
-logical :: do_dryadj
-logical :: limit_conv_cloud_frac
-logical :: include_donmca_in_cosp
-logical :: do_rh_clouds
-logical :: do_bm
-logical :: do_bmmass
-logical :: do_bmomp
-logical :: do_simple
-
-logical :: doing_prog_clouds
-logical :: doing_diffusive
-integer :: nsphum, nql, nqi, nqa, nqn, nqni, nqr,nqs, nqg
-integer :: num_prog_tracers
-logical, dimension(:), allocatable :: cloud_tracer
-logical :: cmt_uses_donner, cmt_uses_ras, cmt_uses_uw
logical :: module_is_initialized = .false.
-type(cmip_diag_id_type) :: ID_tntc, ID_tnhusc, ID_mc, ID_emilnox_area
- contains
+ contains
+
+
+!*******************************************************************
+!
+! PUBLIC SUBROUTINES
+!
+!*******************************************************************
+
!#######################################################################
-subroutine convection_driver_init (id, jd, kd, axes, Time, &
- Physics_control, Exch_ctrl, Nml_mp, Control, &
- lonb, latb, pref )
+subroutine convection_driver_init &
+ (domain, id, jd, kd, axes, Time, Physics_control, Exch_ctrl, &
+ Nml_mp, Control, lonb, latb, pref )
+
+!---------------------------------------------------------------------
+! subroutine convection_driver_init processes convection_driver_nml,
+! saves input variables that are needed as module variables, checks for
+! consistency between specified integration choices, sets up logical
+! variables defining the integration path for convection, initializes
+! the active convective parameterization(s), and initializes the
+! convective clocks and convective diagnostics.
+!---------------------------------------------------------------------
+!---------------------------------------------------------------------
+type(domain2D), target, intent(in) :: domain !< Atmosphere domain
integer, intent(in) :: id, jd, kd
integer, intent(in) :: axes(4)
type(time_type), intent(in) :: Time
type(physics_control_type), intent(in) :: Physics_control
type(exchange_control_type), intent(in) :: Exch_ctrl
type(mp_nml_type), intent(in) :: Nml_mp
-type(mp_removal_control_type), intent(inout) :: Control
+type(mp_removal_control_type), intent(in) :: Control
real, dimension(:,:), intent(in) :: lonb, latb
real, dimension(:), intent(in) :: pref
+!---------------------------------------------------------------------
+
+!------------------------------------------------------------------------
+! id, jd, kd dimensions of processor window
+! axes data axis indices, (x,y,pf,ph) for diagnostics
+! Time time used for diagnostics [time_type]
+! Physics_control
+! derived type containing control variables needed by
+! multiple physics modules
+! Exch_ctrl derived type variable containing control variables
+! needed by both physics and radiation modules
+! Nml_mp derived type variable containing the moist_processes_nml
+! variables
+! Control derived type variable containing control variables
+! associated with tracer removal and transport by
+! available convective schemes
+! lonb longitude of grid box corners [ radians ]
+! latb latitude of grid box corners [ radians ]
+! pref array of reference pressures at full levels (plus
+! surface value at nlev+1), based on 1013.25 hPa pstar
+! [ Pa ]
+!------------------------------------------------------------------------
- integer :: secs, days
- integer :: n, unit, io, ierr, logunit
- character(len=80) :: scheme
+ integer :: secs, days
+ integer :: io, ierr, logunit
-!!-----------------------------------------------------------------------
+!------------------------------------------------------------------------
+! secs seconds component of time_type variable Time
+! days days component of time_type variable Time
+! unit unit number used to read nml file
+! io error return code
+! ierr error return flag
+! logunit unit number used for stdlog file
+!------------------------------------------------------------------------
+!-----------------------------------------------------------------------
if ( module_is_initialized ) return
!-----------------------------------------------------------------------
-! process the moist_processes_nml.
+! process the convection_driver_nml.
!-----------------------------------------------------------------------
- if ( file_exist('input.nml')) then
-#ifdef INTERNAL_FILE_NML
+ if ( file_exists('input.nml')) then
read (input_nml_file, nml=convection_driver_nml, iostat=io)
ierr = check_nml_error(io,'convection_driver_nml')
-#else
- unit = open_namelist_file ( )
- ierr=1; do while (ierr /= 0)
- read (unit, nml=convection_driver_nml, iostat=io, end=10)
- ierr = check_nml_error(io,'convection_driver_nml')
- enddo
- 10 call close_file (unit)
-#endif
-
-!--------- write version and namelist to standard log ------------
-
+!----------------------------------------------------------------------
+! write version and namelist to standard logfile.
+!----------------------------------------------------------------------
call write_version_number ( version, tagname )
logunit = stdlog()
if ( mpp_pe() == mpp_root_pe() ) &
@@ -324,8 +580,10 @@ subroutine convection_driver_init (id, jd, kd, axes, Time, &
endif
!----------------------------------------------------------------------
-! define needed local module variables from the derived types passed in.
+! define needed module variables supplied by the derived types input
+! to this subroutine.
!----------------------------------------------------------------------
+ qmin = Exch_ctrl%qmin
do_liq_num = Exch_ctrl%do_liq_num
do_ice_num = Exch_ctrl%do_ice_num
do_clubb = Exch_ctrl%do_clubb
@@ -338,10 +596,10 @@ subroutine convection_driver_init (id, jd, kd, axes, Time, &
limit_conv_cloud_frac = Nml_mp%limit_conv_cloud_frac
do_dryadj = Nml_mp%do_dryadj
include_donmca_in_cosp = Nml_mp%include_donmca_in_cosp
- do_rh_clouds = Nml_mp%do_rh_clouds
+ do_rh_clouds_BM = Nml_mp%do_rh_clouds
do_bm = Nml_mp%do_bm
do_bmmass = Nml_mp%do_bmmass
- do_bmomp = Nml_mp%do_bmomp
+ do_bmomp = Nml_mp%do_bmomp
do_simple = Nml_mp%do_simple
doing_prog_clouds = Exch_ctrl%doing_prog_clouds
nsphum = Physics_control%nsphum
@@ -355,12 +613,27 @@ subroutine convection_driver_init (id, jd, kd, axes, Time, &
nqg = Physics_control%nqg
num_prog_tracers = Physics_control%num_prog_tracers
+ num_donner_tracers = Control%num_donner_tracers
+ num_mca_tracers = Control%num_mca_tracers
+ num_ras_tracers = Control%num_ras_tracers
+ num_uw_tracers = Control%num_uw_tracers
+
+ allocate (tracers_in_donner (num_prog_tracers))
+ allocate (tracers_in_ras (num_prog_tracers))
+ allocate (tracers_in_mca (num_prog_tracers))
+ allocate (tracers_in_uw (num_prog_tracers))
+
+ tracers_in_donner = Control%tracers_in_donner
+ tracers_in_ras = Control%tracers_in_ras
+ tracers_in_mca = Control%tracers_in_mca
+ tracers_in_uw = Control%tracers_in_uw
+
allocate (cloud_tracer(size(Physics_control%cloud_tracer)))
cloud_tracer = Physics_control%cloud_tracer
!-----------------------------------------------------------------------
-! check to make sure only compatible convection schemes have
-! been activated.
+! check to make sure that unavailable convection implementations have
+! not been specified.
!-----------------------------------------------------------------------
if (do_mca .and. do_ras ) call error_mesg &
('convection_driver_init', &
@@ -399,9 +672,48 @@ subroutine convection_driver_init (id, jd, kd, axes, Time, &
'do_donner_deep and do_mca cannot both be active', FATAL)
!----------------------------------------------------------------------
-! check for inconsistent / invalid settings involving nml variables.
+! define logical controls indicating the status of the available
+! convective implementations in this experiment.
!----------------------------------------------------------------------
- if (do_donner_deep) then
+ if (do_dryadj) then
+ if (do_mca) then
+ ldcamca = .true.
+ else
+ ldca = .true.
+ endif
+ else if (do_mca) then
+ lmca = .true.
+ else if (do_ras) then
+ if (do_donner_deep) then
+ ldonnerras = .true.
+ else
+ lras = .true.
+ endif
+ else if (do_uw_conv) then
+ if (do_donner_deep) then
+ if (do_donner_before_uw) then
+ ldonner_then_uw = .true.
+ else
+ luw_then_donner = .true.
+ endif
+ else
+ luwconv = .true.
+ endif
+ else if (do_donner_deep) then
+ ldonner = .true.
+ else if (do_bm) then
+ lbm = .true.
+ else if (do_bmmass) then
+ lbmmass = .true.
+ else if (do_bmomp) then
+ lbmomp = .true.
+ endif
+
+!----------------------------------------------------------------------
+! check for inconsistent / invalid settings involving
+! convection_driver_nml variables.
+!----------------------------------------------------------------------
+ if (do_donner_deep) then
if (include_donmca_in_cosp .and. (.not. do_donner_mca) ) &
call error_mesg ('convection_driver_init', &
'trying to include donmca in COSP when donmca is inactive', &
@@ -420,21 +732,28 @@ subroutine convection_driver_init (id, jd, kd, axes, Time, &
'when force_donner_moist_conserv is .true., &
&do_donner_conservation_checks must be .true.', FATAL)
endif
-
- if (use_updated_profiles_for_uw .and. &
+
+ if (use_updated_profiles_for_uw .and. &
.not. (do_donner_before_uw) ) then
call error_mesg ('convection_driver_init', &
'use_updated_profiles_for_uw is only meaningful when &
&do_donner_before_uw is true', FATAL)
endif
+ if (use_updated_profiles_for_donner .and. &
+ (do_donner_before_uw) ) then
+ call error_mesg ('convection_driver_init', &
+ 'use_updated_profiles_for_donner is only meaningful when &
+ &do_donner_before_uw is false', FATAL)
+ endif
+
if (only_one_conv_scheme_per_column .and. &
.not. (do_donner_before_uw) ) then
call error_mesg ('convection_driver_init', &
'only_one_conv_scheme_per_column is only meaningful when &
&do_donner_before_uw is true', FATAL)
endif
-
+
if (limit_conv_cloud_frac .and. (.not. do_donner_before_uw)) then
call error_mesg ('convection_driver_init', &
'when limit_conv_cloud_frac is .true., &
@@ -455,205 +774,33 @@ subroutine convection_driver_init (id, jd, kd, axes, Time, &
endif
endif
-!----------------------------------------------------------------------
-! for each tracer, determine if it is to be transported by convect-
-! ion, and the convection schemes that are to transport it. set a
-! logical flag to .true. for each tracer that is to be transported by
-! each scheme and increment the count of tracers to be transported
-! by that scheme.
-!----------------------------------------------------------------------
- do n=1, num_prog_tracers
- if (query_method ('convection', MODEL_ATMOS, n, scheme)) then
- select case (scheme)
- case ("none")
- case ("donner")
- Control%num_donner_tracers = Control%num_donner_tracers + 1
- Control%tracers_in_donner(n) = .true.
- case ("mca")
- Control%num_mca_tracers = Control%num_mca_tracers + 1
- Control%tracers_in_mca(n) = .true.
- case ("ras")
- Control%num_ras_tracers = Control%num_ras_tracers + 1
- Control%tracers_in_ras(n) = .true.
- case ("uw")
- Control%num_uw_tracers = Control%num_uw_tracers + 1
- Control%tracers_in_uw(n) = .true.
- case ("donner_and_ras")
- Control%num_donner_tracers = Control%num_donner_tracers + 1
- Control%tracers_in_donner(n) = .true.
- Control%num_ras_tracers = Control%num_ras_tracers + 1
- Control%tracers_in_ras(n) = .true.
- case ("donner_and_mca")
- Control%num_donner_tracers = Control%num_donner_tracers + 1
- Control%tracers_in_donner(n) = .true.
- Control%num_mca_tracers = Control%num_mca_tracers + 1
-
- Control%tracers_in_mca(n) = .true.
- case ("mca_and_ras")
- Control%num_mca_tracers = Control%num_mca_tracers + 1
- Control%tracers_in_mca(n) = .true.
- Control%num_ras_tracers = Control%num_ras_tracers + 1
- Control%tracers_in_ras(n) = .true.
- case ("all")
- Control%num_donner_tracers = Control%num_donner_tracers + 1
- Control%tracers_in_donner(n) = .true.
- Control%num_mca_tracers = Control%num_mca_tracers + 1
- Control%tracers_in_mca(n) = .true.
- Control%num_ras_tracers = Control%num_ras_tracers + 1
- Control%tracers_in_ras(n) = .true.
- Control%num_uw_tracers = Control%num_uw_tracers + 1
- Control%tracers_in_uw(n) = .true.
- case ("all_nodonner")
- Control%num_mca_tracers = Control%num_mca_tracers + 1
- Control%tracers_in_mca(n) = .true.
- Control%num_ras_tracers = Control%num_ras_tracers + 1
- Control%tracers_in_ras(n) = .true.
- Control%num_uw_tracers = Control%num_uw_tracers + 1
- Control%tracers_in_uw(n) = .true.
- case default ! corresponds to "none"
- end select
- endif
- end do
-
!-----------------------------------------------------------------------
-! initialize the convective schemes active in this experiment.
+! initialize the convective parameterizations that are active in this
+! experiment.
!-----------------------------------------------------------------------
if (do_dryadj) call dry_adj_init ()
- if (do_cmt) call cu_mo_trans_init (axes, Time, doing_diffusive)
- if (do_bm) call betts_miller_init ()
+ if (do_bm) call betts_miller_init ()
if (do_bmmass) call bm_massflux_init()
- if (do_bmomp) call bm_omp_init ()
+ if (do_bmomp) call bm_omp_init ()
!-------------------------------------------------------------------------
-! define logicals indicating which convective schemes are to be seen
-! by the cumulus momentum transport scheme.
+! initialize the cumulus momentum transport module, defining logicals
+! indicating which convective schemes are to be seen by that module.
!-------------------------------------------------------------------------
if (do_cmt) then
- if (trim(cmt_mass_flux_source) == 'ras') then
- cmt_uses_ras = .true.
- cmt_uses_donner = .false.
- cmt_uses_uw = .false.
- if (.not. do_ras) then
- call error_mesg ('moist_processes_mod', &
- 'if cmt_uses_ras = T, then do_ras must be T', FATAL)
- endif
-
- else if (trim(cmt_mass_flux_source) == 'donner') then
- cmt_uses_ras = .false.
- cmt_uses_donner = .true.
- cmt_uses_uw = .false.
- if (.not. do_donner_deep) then
- call error_mesg ('convection_driver_init', &
- 'if cmt_uses_donner = T, then do_donner_deep must be T', &
- FATAL)
- endif
-
- else if (trim(cmt_mass_flux_source) == 'uw') then
- cmt_uses_ras = .false.
- cmt_uses_donner = .false.
- cmt_uses_uw = .true.
- if (.not. do_uw_conv) then
- call error_mesg ('convection_driver_init', &
- 'if cmt_uses_uw = T, then do_uw_conv must be T', FATAL)
- endif
-
- else if (trim(cmt_mass_flux_source) == 'donner_and_ras') then
- cmt_uses_ras = .true.
- if (.not. do_ras) then
- call error_mesg ('convection_driver_init', &
- 'if cmt_uses_ras = T, then do_ras must be T', FATAL)
- endif
- cmt_uses_donner = .true.
- if (.not. do_donner_deep) then
- call error_mesg ('convection_driver_init', &
- 'if cmt_uses_donner = T, then do_donner_deep must be T', &
- FATAL)
- endif
- cmt_uses_uw = .false.
-
- else if (trim(cmt_mass_flux_source) == 'donner_and_uw') then
- cmt_uses_uw = .true.
- if (.not. do_uw_conv) then
- call error_mesg ('convection_driver_init', &
- 'if cmt_uses_uw = T, then do_uw_conv must be T', FATAL)
- endif
- cmt_uses_donner = .true.
- if (.not. do_donner_deep) then
- call error_mesg ('convection_driver_init', &
- 'if cmt_uses_donner = T, then do_donner_deep must be T', &
- FATAL)
- endif
- cmt_uses_ras = .false.
-
- else if (trim(cmt_mass_flux_source) == 'ras_and_uw') then
- cmt_uses_ras = .true.
- if (.not. do_ras) then
- call error_mesg ('convection_driver_init', &
- 'if cmt_uses_ras = T, then do_ras must be T', FATAL)
- endif
- cmt_uses_uw = .true.
- if (.not. do_uw_conv) then
- call error_mesg ('convection_driver_init', &
- 'if cmt_uses_uw = T, then do_uw_conv must be T', FATAL)
- endif
- cmt_uses_donner = .false.
-
- else if &
- (trim(cmt_mass_flux_source) == 'donner_and_ras_and_uw') then
- cmt_uses_ras = .true.
- if (.not. do_ras) then
- call error_mesg ('convection_driver_init', &
- 'if cmt_uses_ras = T, then do_ras must be T', FATAL)
- endif
- cmt_uses_donner = .true.
- if (.not. do_donner_deep) then
- call error_mesg ('convection_driver_init', &
- 'if cmt_uses_donner = T, then do_donner_deep must be T', &
- FATAL)
- endif
- cmt_uses_uw = .true.
- if (.not. do_uw_conv) then
- call error_mesg ('convection_driver_init', &
- 'if cmt_uses_uw = T, then do_uw_conv must be T', FATAL)
- endif
- else if (trim(cmt_mass_flux_source) == 'all') then
- if (do_ras) then
- cmt_uses_ras = .true.
- else
- cmt_uses_ras = .false.
- endif
- if (do_donner_deep) then
- cmt_uses_donner = .true.
- else
- cmt_uses_donner = .false.
- endif
- if (do_uw_conv) then
- cmt_uses_uw = .true.
- else
- cmt_uses_uw = .false.
- endif
- else
- call error_mesg ('convection_driver_init', &
- 'invalid specification of cmt_mass_flux_source', FATAL)
- endif
-
- if (cmt_uses_uw .and. .not. doing_diffusive) then
- call error_mesg ('convection_driver_init', &
- 'currently cannot do non-local cmt with uw as mass &
- &flux_source', FATAL)
- endif
- endif !(do_cmt)
+ call cu_mo_trans_init (axes, Time, Nml_mp, cmt_mass_flux_source)
+ endif
!--------------------------------------------------------------------
! continue the initialization of the convection scheme modules.
!--------------------------------------------------------------------
if (do_donner_deep) then
call get_time (Time, secs, days)
- call donner_deep_init (lonb, latb, pref, axes, secs, days, &
+ call donner_deep_init (domain, lonb, latb, pref, axes, secs, days, &
Control%tracers_in_donner, &
do_donner_conservation_checks, &
do_unified_convective_closure, &
- using_fms)
+ doing_prog_clouds)
if (do_donner_conservation_checks) then
allocate (max_enthalpy_imbal_don (id, jd))
allocate (max_water_imbal_don (id, jd))
@@ -661,7 +808,7 @@ subroutine convection_driver_init (id, jd, kd, axes, Time, &
max_water_imbal_don = 0.
endif
endif ! (do_donner_deep)
-
+
if (do_ras) then
call ras_init (doing_prog_clouds, do_liq_num, axes, Time, Nml_mp, &
Control%tracers_in_ras)
@@ -675,32 +822,34 @@ subroutine convection_driver_init (id, jd, kd, axes, Time, &
endif
!-----------------------------------------------------------------------
-! initialize clocks.
+! initialize clocks.
!-----------------------------------------------------------------------
convection_clock = mpp_clock_id( ' Physics_up: Moist Proc: Conv' ,&
grain=CLOCK_MODULE_DRIVER )
donner_clock = mpp_clock_id( ' Moist Processes: Donner_deep' ,&
grain=CLOCK_MODULE_DRIVER )
+ dca_clock = mpp_clock_id( ' Moist Processes: DCA' ,&
+ grain=CLOCK_MODULE_DRIVER )
mca_clock = mpp_clock_id( ' Moist Processes: MCA' ,&
grain=CLOCK_MODULE_DRIVER )
donner_mca_clock = mpp_clock_id( ' Moist Processes: Donner_MCA' ,&
grain=CLOCK_MODULE_DRIVER )
ras_clock = mpp_clock_id( ' Moist Processes: RAS' ,&
grain=CLOCK_MODULE_DRIVER )
- shallowcu_clock = mpp_clock_id( ' Moist Processes: Shallow_cu' ,&
+ uw_clock = mpp_clock_id( ' Moist Processes: UW' ,&
grain=CLOCK_MODULE_DRIVER )
cmt_clock = mpp_clock_id( ' Moist Processes: CMT' ,&
grain=CLOCK_MODULE_DRIVER )
bm_clock = mpp_clock_id( ' Moist Processes: Betts-Miller',&
grain=CLOCK_MODULE_DRIVER )
-
+
!------------------------------------------------------------------------
-! call diag_field_init to register the netcdf diagnostic fields.
+! call diag_field_init to register the netcdf diagnostic fields.
!------------------------------------------------------------------------
call diag_field_init (axes, Time, Control)
!------------------------------------------------------------------------
-! initialize the ice number detrain module.
+! initialize the ice number detrain module.
!------------------------------------------------------------------------
call detr_ice_num_init
@@ -711,158 +860,159 @@ subroutine convection_driver_init (id, jd, kd, axes, Time, &
end subroutine convection_driver_init
+!#######################################################################
-!########################################################################
-
-subroutine convection_driver &
- (is, ie, js, je, Time, dt, Input_mp, Tend_mp, C2ls_mp, &
- Output_mp, Removal_mp, Removal_mp_control, &
- Surf_diff, Phys_mp_exch, &
- shflx, lhflx, tdt_dif, qdt_dif, Moist_clouds_block, &
- Aerosol, mask, kbot)
+subroutine convection_driver_time_vary &
+ (Time_in, dt_in, i_cell_in, i_meso_in, i_shallow_in)
-!-----------------------------------------------------------------------
-!
-! in: is,ie starting and ending i indices for window
-!
-! js,je starting and ending j indices for window
-!
-! Time time used for diagnostics [time_type]
-!
-! dt time step (from t(n-1) to t(n+1) if leapfrog)
-! in seconds [real]
-!
-!
-! optional
-! -----------------
-!
-!
-!
-!-----------------------------------------------------------------------
-integer, intent(in) :: is,ie,js,je
-type(time_type), intent(in) :: Time
-real, intent(in) :: dt
-type(mp_input_type), intent(inout) :: Input_mp
-type(mp_output_type), intent(inout) :: Output_mp
-type(mp_tendency_type), intent(inout) :: Tend_mp
-type(mp_removal_type), intent(inout) :: Removal_mp
-type(mp_removal_control_type), intent(inout) :: Removal_mp_control
-type(surf_diff_type), intent(in) :: Surf_diff
-type(phys_mp_exch_type),intent(inout) :: Phys_mp_exch
-real, dimension(:,:), intent(in) :: shflx, lhflx
-real, dimension(:,:,:), intent(in) :: tdt_dif, qdt_dif
-type(mp_conv2ls_type), intent(inout) :: C2ls_mp
-type(clouds_from_moist_block_type), &
- intent(inout) :: Moist_clouds_block
+!------------------------------------------------------------------------
+! subroutine convection_driver_time_vary saves needed input arguments
+! as module variables for use within the prognostic spatial loops
+! and verifies that needed cloud inputs will be available.
+!------------------------------------------------------------------------
-type(aerosol_type), intent(in), optional :: Aerosol
-real, dimension(:,:,:), intent(in), optional :: mask
-integer, dimension(:,:), intent(in), optional :: kbot
+!-------------------------------------------------------------------------
+type(time_type), intent(in) :: Time_in
+real, intent(in) :: dt_in
+integer, intent(in) :: i_cell_in, i_meso_in, i_shallow_in
+!-------------------------------------------------------------------------
+!-------------------------------------------------------------------------
+! Time_in ! time used for diagnostics [ time_type ]
+! dt_in ! time step [ seconds ]
+! i_cell_in ! index in cloud arrays for donner cell clouds
+! i_meso_in ! index in cloud arrays for donner meso clouds
+! i_shallow_in ! index in cloud arrays for uw clouds
+!-------------------------------------------------------------------------
-!-----------------------------------------------------------------------
-! local variables:
+!---------------------------------------------------------------------
+! verify that the module has been initialized.
+!---------------------------------------------------------------------
+ if (.not. module_is_initialized) then
+ call error_mesg ( &
+ 'convection_driver_mod/convection_driver_time_vary', &
+ 'convection_driver_init has not been called.', FATAL)
+ endif
+!------------------------------------------------------------------------
+! save the input arguments as module variables of this module. Pass them
+! to dependent modules as required.
+!------------------------------------------------------------------------
+ dt = dt_in
+ dtinv = 1./dt
+ if (do_donner_deep) then
+ call donner_deep_time_vary (dt)
+ endif
- real, dimension(size(Input_mp%t,1),size(Input_mp%t,2)) :: &
- cape, cin, precip, total_precip, &
- lheat_precip, precip_returned, &
- precip_adjustment, vert_motion, &
- rain, snow, rain_don, snow_don, rain_ras, &
- snow_ras, rain_donmca, snow_donmca, &
- bmflag, klzbs, invtaubmt, invtaubmq, &
- scale, sumneg, freq_count, enthint, &
- lcondensint, enthdiffint, vaporint, &
- condensint, precipint, diffint, &
- sfc_sh_flux, sfc_vapor_flux, &
- adjust_frac, temp_2d, &
- rain_uw, snow_uw, scale_donner
+ i_cell = i_cell_in
+ i_meso = i_meso_in
+ i_shallow = i_shallow_in
- logical, dimension(size(Input_mp%t,1),size(Input_mp%t,2)) :: &
- conv_calc_completed, ltemp
+ Time = Time_in
- integer, dimension(size(Output_mp%rdt,1),size(Output_mp%rdt,2)) :: &
- cldtop, cldbot, klzb, klcl, klfc, &
- maxTe_launch_level
+!---------------------------------------------------------------------
+! if donner parameterization is active, be sure the donner cloud field
+! arguments are valid.
+!---------------------------------------------------------------------
+ if (do_donner_deep) then
+ if (i_cell /= 0 .and. i_meso /= 0 ) then
+ else
+ call error_mesg ('convection_driver_mod', &
+ 'input args for donner clouds not correct', FATAL)
+ endif
+ endif
- real, dimension(size(Input_mp%t,1),size(Input_mp%t,2), &
- size(Input_mp%phalf,3)) :: &
- rain3d, snow3d, snowclr3d, cmf, &
- mc, m_cellup, mc_cmt, mc_donner_half
+!---------------------------------------------------------------------
+! if uw parameterization is active, be sure the uw cloud field argument
+! is valid.
+!---------------------------------------------------------------------
+ if (do_uw_conv) then
+ if (i_shallow /= 0) then
+ else
+ call error_mesg ('convection_driver_mod', &
+ 'input args for uw shallow clouds not correct', FATAL)
+ endif
+ endif
- real, dimension(size(Input_mp%t,1),size(Input_mp%t,2), &
- size(Input_mp%t,3)) :: &
- f_snow_berg, prod_no, ttnd_adjustment, &
- available_cf_for_uw, total_cloud_area, &
- rin, rh, temp_3d1, temp_3d2, &
- tin_orig, qin_orig, &
- t_ref, q_ref, ttnd_don, qtnd_don, &
- delta_temp, delta_q, delta_vapor, &
- delta_qn, delta_qni, &
- tp, rp, thetae, &
- liquid_precip, frozen_precip, &
- det0, det_cmt, mc_donner, mc_donner_up, &
- m_cdet_donner, massflux, nllin, nilin, &
- ttnd_uw, qtnd_uw, utnd_uw, vtnd_uw, &
- qltnd_uw, qitnd_uw, qatnd_uw, qntnd_uw, &
- qnitnd_uw, delta_ql, delta_qi, delta_qa, &
- qlin, qiin, qain
-
- real, dimension(size(Input_mp%t,1),size(Input_mp%t,2), &
- size(Input_mp%t,3), &
- size(Output_mp%rdt,4) ) :: &
- rdt_init
-
- real, dimension(size(Input_mp%t,1),size(Input_mp%t,2), &
- size(Input_mp%t,3), &
- size(Input_mp%r,4)) :: &
- tracer_orig
-
- real, dimension(size(Input_mp%t,1),size(Input_mp%t,2), &
- size(Input_mp%t,3), &
- Removal_mp_control%num_donner_tracers) :: &
- qtr, donner_tracer
-
- real, dimension(size(Input_mp%t,1),size(Input_mp%t,2), &
- Removal_mp_control%num_donner_tracers) :: &
- tr_flux
-
- real, dimension(size(Input_mp%t,1),size(Input_mp%t,2), &
- size(Input_mp%t,3), &
- Removal_mp_control%num_uw_tracers) :: &
- qtruw
-
- real, dimension(size(Input_mp%t,1),size(Input_mp%t,2), &
- size(Output_mp%rdt,4) ) :: &
- total_wetdep, total_wetdep_uw, &
- total_wetdep_donner
-
- character(len=128) :: warn_mesg
-
- integer :: secs, days
- integer :: n, nn, i, j, k, ix, jx, kx, nt, tr
- integer :: m, mm
- logical :: used, avgbl
- real :: dtinv
- real, parameter :: boltz = 1.38044e-16
- real :: qnew
- real :: current_total_sec
- integer :: current_sec, current_days
- integer :: i_cell, i_meso, i_shallow
- real :: temp
-
-
-!------------------------------------------------------------------------
-! local variables:
-!
-! sfc_sh_flux sensible heat flux across the surface
-! [ watts / m**2 ]
-! sfc_vapor_flux water vapor flux across the surface
-! [ kg(h2o) / (m**2 sec) ]
-! tr_flux tracer fux across the surface
-! [ kg(tracer) / (m**2 sec) ]
!----------------------------------------------------------------------
+
+end subroutine convection_driver_time_vary
+
+
+!########################################################################
+
+subroutine convection_driver &
+ (is, ie, js, je, Surf_diff, Phys_mp_exch, &
+ Moist_clouds_block, Input_mp, Tend_mp, C2ls_mp, &
+ Output_mp, Removal_mp, Aerosol)
+
+!------------------------------------------------------------------------
+! subroutine convection_driver saves needed variables on input for
+! later use, calls the driver routines for the activated convective
+! implementation to compute convective effects on the model variables,
+! computes cumulus momentum transport and other effects of convection,
+! and outputs various convective diagnostics.
+!------------------------------------------------------------------------
+
+integer, intent(in) :: is, ie, js, je
+type(surf_diff_type), intent(in) :: Surf_diff
+type(phys_mp_exch_type),intent(inout) :: Phys_mp_exch
+type(clouds_from_moist_block_type), &
+ intent(inout) :: Moist_clouds_block
+type(mp_input_type), intent(inout) :: Input_mp
+type(mp_tendency_type), intent(inout) :: Tend_mp
+type(mp_conv2ls_type), intent(inout) :: C2ls_mp
+type(mp_output_type), intent(inout) :: Output_mp
+type(mp_removal_type), intent(inout) :: Removal_mp
+type(aerosol_type), intent(in), optional :: Aerosol
+
+!-----------------------------------------------------------------------
+! is,ie starting and ending i indices for window
+! js,je starting and ending j indices for window
+! Surf_diff derived type which will transport surface fluxes from
+! atmos_model to convection_driver via physics_driver
+! and moist_processes (not yet implemented)
+! Phys_mp_exch
+! derived type used to transfer data between physics_driver
+! and convection_driver via moist_processes
+! Moist_clouds_block
+! derived type used to transfer cloud data between
+! atmos_model and convection_driver via physics_driver and
+! moist_processes
+! Input_mp derived type used to transfer needed input data between
+! moist_processes and convection_driver
+! Tend_mp derived type used to transfer calculated tendency data
+! between convection_driver and moist_processes
+! C2ls_mp derived type used to transfer data from convection_driver
+! to lscloud_driver via moist_processes.
+! Output_mp derived type used to transfer output fields between
+! convection_driver and moist_processes
+! Removal_mp derived type used to transfer precipitation and tracer
+! removal fields between convection_driver and
+! moist_processes
+! Aerosol derived type containing model aerosol fields to be input
+! to model convective schemes
+!-----------------------------------------------------------------------
+
+!-----------------------------------------------------------------------
+
+ type(conv_results_type) :: Conv_results
+ integer :: ix, jx, kx, nt
+
+!-----------------------------------------------------------------------
+! Conv_results derived type variable containing convective results
+! that are collected during integration and passed to
+! the diagnostics output subroutine.
+! ix, jx, kx i, j, and k dimensions of the current physics_window
+! nt number of activated prognostic tracers
+!-----------------------------------------------------------------------
+
+!---------------------------------------------------------------------
+! turn on the convective parameterizations clock.
+!---------------------------------------------------------------------
+ call mpp_clock_begin (convection_clock)
+
!---------------------------------------------------------------------
! verify that the module has been initialized.
!---------------------------------------------------------------------
@@ -872,3168 +1022,6270 @@ subroutine convection_driver &
endif
!-----------------------------------------------------------------------
-! define array dimensions.
+! be sure optional argument is present if needed.
!-----------------------------------------------------------------------
- ix = size(Input_mp%t,1)
- jx = size(Input_mp%t,2)
- kx = size(Input_mp%t,3)
- nt = size(Output_mp%rdt,4)
+ if (present(Aerosol)) then
+ else
+ if (do_uw_conv .or. (do_ras .and. do_liq_num)) then
+ call error_mesg ('convection_driver_mod', &
+ 'Aerosol argument required when either do_uw_conv or ras with&
+ & prognostic droplet number is activated.', FATAL)
+ endif
+ endif
!-----------------------------------------------------------------------
-! define index into cloud data for the different convective types.
+! save the value of rdt upon entry to the routine so that the total
+! convective contribution to the tendency (as defined by this module)
+! may later be defined.
+! save input temperature, specific humidity and tracer fields. the
+! original values may be needed by multiple parameterizations called
+! from within this module; however, these values may be updated within
+! this module, so those values would not be available.
!-----------------------------------------------------------------------
- i_shallow = Moist_clouds_block%index_uw_conv
- i_meso = Moist_clouds_block%index_donner_meso
- i_cell = Moist_clouds_block%index_donner_cell
+ Output_mp%rdt_init = Output_mp%rdt
+ Input_mp%tin_orig = Input_mp%tin
+ Input_mp%qin_orig = Input_mp%qin
+ Input_mp%tracer_orig = Input_mp%tracer
!-----------------------------------------------------------------------
-! save the value of rdt upon entry to the routine do the total
-! convective contribution to the tendency may later be defined.
-! save input tracer fields.
+! define array dimensions.
!-----------------------------------------------------------------------
- rdt_init = Output_mp%rdt
- tracer_orig = Input_mp%tracer
+ ix = size(Input_mp%t,1)
+ jx = size(Input_mp%t,2)
+ kx = size(Input_mp%t,3)
+ nt = size(Output_mp%rdt,4)
!--------------------------------------------------------------------
-! initialize some variables. define the inverse of the time step.
+! call convection_driver-alloc to allocate and initialize the components
+! of the conv_results_type variable Conv_results.
!--------------------------------------------------------------------
- conv_calc_completed = .false.
- available_cf_for_uw = 1.0
- dtinv = 1.0/dt
+ call convection_driver_alloc (ix, jx, kx, Conv_results)
-!--------------------------------------------------------------------
-! initialize various arrays which are used in this subroutine.
-!--------------------------------------------------------------------
- t_ref = 0.
- q_ref = 0.
- ttnd_don = 0.
- qtnd_don = 0.
- cmf = 0.
- delta_temp = 0.
- delta_q = 0.
- delta_vapor = 0.
- delta_qn = 0.
- delta_qni = 0.
- liquid_precip = 0.
- frozen_precip = 0.
- det0 = 0.
- det_cmt = 0.
- mc_donner = 0.
- mc_donner_half = 0.
- mc_donner_up = 0.
- m_cdet_donner = 0.
- massflux = 0.
- qtr = 0.
-
- rain_uw = 0.
- snow_uw = 0.
- ttnd_uw = 0.
- qtnd_uw = 0.
- utnd_uw = 0.
- vtnd_uw = 0.
- qltnd_uw = 0.
- qitnd_uw = 0.
- qatnd_uw = 0.
- qntnd_uw = 0.
- qnitnd_uw = 0.
- qtruw = 0.
- delta_ql = 0.
- delta_qi = 0.
- delta_qa = 0.
-
- rain_donmca = 0.0
- snow_donmca = 0.0
-
- precip = 0.0
- rain3d = 0.0
- snow3d = 0.0
-
-!----------------------------------------------------------------------
-! output any requested convectively-transported tracer fields
-! and / or their column sums before convective transport.
-!----------------------------------------------------------------------
- do n=1, num_prog_tracers
- used = send_data (id_conv_tracer(n), Input_mp%tracer(:,:,:,n), &
- Time, is, js, 1)
- if (id_conv_tracer_col(n) > 0) &
- call column_diag(id_conv_tracer_col(n), is, js, Time, &
- Input_mp%tracer(:,:,:,n), 1.0, Input_mp%pmass)
- end do
+
+!&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
+!& &
+!& AVAILABLE CONVECTIVE IMPLEMENTATIONS &
+!& &
+!&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
+
+!------------------------------------------------------------------------
+! integrate the active convective implementation.
+!------------------------------------------------------------------------
+
+
+! @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
+! @ @
+! @ DRY CONVECTIVE ADJUSTMENT @
+! @ @
+! @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
!---------------------------------------------------------------------
-! begin the convective parameterizations clock.
+! if dry adjustment only is desired call subroutine dca_driver.
!---------------------------------------------------------------------
- call mpp_clock_begin (convection_clock)
+ if (ldca) then
+ call dca_driver (is, js, Input_mp, Output_mp, Tend_mp)
-!@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
-!
-! DRY CONVECTION PARAMETERIZATION
-!
-!@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
+
+! @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
+! @ @
+! @ MOIST CONVECTIVE ADJUSTMENT @
+! @ @
+! @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
!---------------------------------------------------------------------
-! if dry adjustment is desired call subroutine dry_adj to obtain
-! the temperature tendencies which must be applied to adjust each
-! column to a non-superadiabatic lapse rate.
+! if moist adjustment only is desired call subroutine mca_driver.
!---------------------------------------------------------------------
- if (do_dryadj) then
- call dry_adj (Input_mp%tin, Input_mp%pfull, Input_mp%phalf, &
- delta_temp, mask)
+ else if (lmca) then
+ call mca_driver (is, js, Input_mp, Output_mp, Tend_mp )
-!-------------------------------------------------------------------
-! add the temperature change due to dry adjustment to the current
-! temperature. convert the temperature change to a heating rate and
-! add that to the temperature tendency array accumulating the ten-
-! dencies due to all physics processes.
-!-------------------------------------------------------------------
- Input_mp%tin = Input_mp%tin + delta_temp
- Tend_mp%ttnd = delta_temp*dtinv
- Output_mp%tdt = Output_mp%tdt + Tend_mp%ttnd
+! @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
+! @ @
+! @ DRY CONVECTIVE ADJUSTMENT AND @
+! @ MOIST CONVECTIVE ADJUSTMENT @
+! @ @
+! @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
!---------------------------------------------------------------------
-! output the temperature tendency from dry adjustment, if desired.
+! if both dry and moist convective adjustment are desired call
+! subroutines dca_driver and mca_driver.
!---------------------------------------------------------------------
- used = send_data (id_tdt_dadj, Tend_mp%ttnd, Time, is, js, 1 )
+ else if (ldcamca) then
+ call dca_driver (is, js, Input_mp, Output_mp, Tend_mp)
+ call mca_driver (is, js, Input_mp, Output_mp, Tend_mp)
+
+! @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
+! @ @
+! @ UW CONVECTION SCHEME ONLY @
+! @ @
+! @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
!---------------------------------------------------------------------
-! add the temperature time tendency from dry adjustment to the array
-! accumulating the total temperature time tendency from convection.
+! if only the uw convection scheme is desired call subroutine
+! uw_conv_driver.
!---------------------------------------------------------------------
- Tend_mp%ttnd_conv = Tend_mp%ttnd_conv + Tend_mp%ttnd
- endif
-
-
-!@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
-!
-! MOIST CONVECTION PARAMETERIZATIONS
-!
-!@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
+ else if (luwconv) then
+ call uw_conv_driver &
+ ( is, ie, js, je, Input_mp, Aerosol, Phys_mp_exch, &
+ Output_mp, Tend_mp, Conv_results, Removal_mp, &
+ Moist_clouds_block%cloud_data(i_shallow))
+
+! @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
+! @ @
+! @ UW CONVECTION SCHEME, FOLLOWED BY @
+! @ DONNER CONVECTION SCHEME @
+! @ @
+! @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
+!---------------------------------------------------------------------
+! if the uw convection scheme followed by a call to the donner scheme
+! is desired, call subroutine uw_then_donner_driver.
+!---------------------------------------------------------------------
+ else if (luw_then_donner ) then
+ call uw_then_donner_driver &
+ ( is, ie, js, je, Input_mp, Aerosol, Phys_mp_exch, &
+ Output_mp, Tend_mp, Conv_results, Removal_mp, &
+ Moist_clouds_block, C2ls_mp)
-!@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
-!
-! 0. UW SHALLOW CONVECTION PARAMETERIZATION
-!
-!@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
+! @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
+! @ @
+! @ DONNER CONVECTION SCHEME, FOLLOWED @
+! @ BY UW CONVECTION SCHEME @
+! @ @
+! @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
!---------------------------------------------------------------------
-! if it is desired to do shallow convection before donner deep
-! convection, turn on the shallowcu clock and make the call to
-! uw_conv.
+! if the donner scheme followed by uw convection is desired, call
+! donner_driver to execute the donner_deep parameterization:
!---------------------------------------------------------------------
- if (.not. do_donner_before_uw) then
- call mpp_clock_begin (shallowcu_clock)
- if (do_uw_conv) then
+ else if (ldonner_then_uw) then
+ call donner_driver ( is, ie, js, je, Input_mp, &
+ Moist_clouds_block, Conv_results, &
+ C2ls_mp, Removal_mp, Tend_mp, Output_mp)
!---------------------------------------------------------------------
-! be sure the shallow cloud field arguments associated with the uw_conv
-! parameterization are present.
+! then call the uw_conv wrapper routine:
!---------------------------------------------------------------------
- if (i_shallow /= 0) then
- else
- call error_mesg ('convection_driver_mod', 'convection_driver: &
- &improper arguments for uw_shallow clouds', FATAL)
- endif
+ call uw_conv_driver &
+ ( is, ie, js, je, Input_mp, Aerosol, Phys_mp_exch, &
+ Output_mp, Tend_mp, Conv_results, Removal_mp, &
+ Moist_clouds_block%cloud_data(i_shallow))
+
+! @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
+! @ @
+! @ DONNER CONVECTION SCHEME ONLY @
+! @ @
+! @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
!---------------------------------------------------------------------
-! call the uw_conv wrapper routine.
-!---------------------------------------------------------------------
- call moistproc_uw_conv( &
- Time, is, ie, js, je, dt, Input_mp%tin, Input_mp%qin, &
- Input_mp%uin, Input_mp%vin, Input_mp%tracer, &
- Input_mp%pfull, Input_mp%phalf, Input_mp%zfull, &
- Input_mp%zhalf, Input_mp%omega, Input_mp%pblht, &
- Input_mp%ustar, Input_mp%bstar, Input_mp%qstar, &
- shflx, lhflx, &
- Input_mp%land, Input_mp%coldT, Aerosol, &
- Surf_diff%tdt_rad, Surf_diff%tdt_dyn, Surf_diff%qdt_dyn, &
- Surf_diff%dgz_dyn, Surf_diff%ddp_dyn, tdt_dif, qdt_dif, &
- Phys_mp_exch%hmint, Input_mp%lat, Input_mp%lon, &
- Input_mp%cush, Input_mp%cbmf, Phys_mp_exch%cgust, &
- Phys_mp_exch%tke, Phys_mp_exch%pblhto, &
- Phys_mp_exch%rkmo, Phys_mp_exch%taudpo, &
- Phys_mp_exch%exist_shconv, Phys_mp_exch%exist_dpconv, &
- Phys_mp_exch%pblht_prev, Phys_mp_exch%hlsrc_prev, &
- Phys_mp_exch%qtsrc_prev, Phys_mp_exch%cape_prev, &
- Phys_mp_exch%cin_prev, Phys_mp_exch%tke_prev, &
- cmf, conv_calc_completed, &
- available_cf_for_uw, Output_mp%tdt, Output_mp%rdt(:,:,:,1),&
- Output_mp%udt, Output_mp%vdt, Output_mp%rdt, &
- Tend_mp%ttnd_conv, Tend_mp%qtnd_conv, Output_mp%lprec, &
- Output_mp%fprec, precip, Removal_mp%liq_precflx, &
- Removal_mp%ice_precflx, rain_uw, snow_uw, ttnd_uw, &
- qtnd_uw, utnd_uw, vtnd_uw, qtruw, qltnd_uw, qitnd_uw, &
- qatnd_uw, qntnd_uw, qnitnd_uw, doing_prog_clouds, &
- do_limit_uw, do_liq_num, num_prog_tracers, &
- Removal_mp_control%tracers_in_uw, &
- Removal_mp_control%num_uw_tracers, &
- Moist_clouds_block%cloud_data(i_shallow), &
- Removal_mp%uw_wetdep, do_ice_num, detrain_ice_num)
- endif !( do_uw_conv)
- call mpp_clock_end (shallowcu_clock)
- else
+! if only the donner scheme is desired, call donner_driver to execute
+! the donner_deep parameterization.
+!---------------------------------------------------------------------
+ else if (ldonner) then
+ call donner_driver ( is, ie, js, je, Input_mp, &
+ Moist_clouds_block, Conv_results, &
+ C2ls_mp, Removal_mp, Tend_mp, Output_mp )
+
+! @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
+! @ @
+! @ BETTS-MILLER CONVECTION SCHEME @
+! @ @
+! @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
+
!----------------------------------------------------------------------
-! save the original input values of t and q for use when uw is called
-! in case the option to not use updated profiles in uw is activated.
-! (otherwise these fields will be modified by any other calls to
-! convective processes made before the uw_conv call.)
+! if one of the betts-miller convection schemes is active, call the
+! betts-miller driver subroutine.
!----------------------------------------------------------------------
- tin_orig = Input_mp%tin
- qin_orig = Input_mp%qin
- endif ! (.not do_donner_before_uw)
+ else if ( any((/do_bm, do_bmmass, do_bmomp/)) ) then
+ call betts_miller_driver (is, js, Input_mp, Output_mp, Tend_mp)
-!@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
-!
-! A. DONNER DEEP CONVECTION PARAMETERIZATION
-!
-!@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
-!---------------------------------------------------------------------
-! if donner_deep convection is activated, execute the following code.
-! activate the donner clock.
-!---------------------------------------------------------------------
- if (do_donner_deep) then
- call mpp_clock_begin (donner_clock)
+! @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
+! @ @
+! @ DONNER CONVECTION SCHEME FOLLOWED @
+! @ BY RELAXED ARAKAWA-SCHUBERT SCHEME @
+! @ @
+! @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
!---------------------------------------------------------------------
-! be sure the donner cloud field arguments are present.
+! if the donner scheme followed by the ras scheme is desired, call
+! donner_driver to execute the donner_deep parameterization:
!---------------------------------------------------------------------
- if (i_cell /= 0 .and. i_meso /= 0 ) then
- else
- call error_mesg ('convection_driver_mod', &
- 'input args for donner clouds not correct', FATAL)
- endif
+ else if (ldonnerras) then
+ call donner_driver (is, ie, js, je, Input_mp, &
+ Moist_clouds_block, Conv_results, &
+ C2ls_mp, Removal_mp, Tend_mp, Output_mp)
-!--------------------------------------------------------------------
-! if prognostic clouds are present, define the cloud liquid and
-! cloud ice specific humidities and cloud area associated with them,
-! so that they may be input to donner_deep_mod. if not using prognostic
-! clouds, define these arrays to be zero.
-!--------------------------------------------------------------------
- if (doing_prog_clouds) then
- qlin = Input_mp%tracer(:,:,:,nql)
- qiin = Input_mp%tracer(:,:,:,nqi)
- qain = Input_mp%tracer(:,:,:,nqa)
- if (do_liq_num ) nllin = Input_mp%tracer(:,:,:,nqn)
- if (do_ice_num ) nilin = Input_mp%tracer(:,:,:,nqni)
- endif
+!-----------------------------------------------------------------------
+! then call ras_driver to execute relaxed arakawa/schubert cumulus
+! parameterization scheme:
+!-----------------------------------------------------------------------
+ call ras_driver &
+ (is, js, Input_mp, Output_mp, Tend_mp, Conv_results, &
+ C2ls_mp, Aerosol)
-!--------------------------------------------------------------------
-! convert vapor specific humidity to vapor mixing ratio so it may
-! be input to donner_deep_mod.
-!--------------------------------------------------------------------
- rin = Input_mp%qin/(1.0 - Input_mp%qin)
+! @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
+! @ @
+! @ RELAXED ARAKAWA-SCHUBERT SCHEME @
+! @ @
+! @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
-!---------------------------------------------------------------------
-! if any tracers are to be transported by donner convection,
-! check each active tracer to find those to be transported and fill
-! the donner_tracer array with these fields.
-!---------------------------------------------------------------------
- if (Removal_mp_control%num_donner_tracers > 0) then
- nn = 1
- do n=1,num_prog_tracers
- if (Removal_mp_control%tracers_in_donner(n)) then
- donner_tracer(:,:,:,nn) = Input_mp%tracer(:,:,:,n)
- nn = nn + 1
- endif
- end do
- else
- donner_tracer(:,:,:,:) = 0.0
- endif
+!-----------------------------------------------------------------------
+! if only the ras scheme is desired, call ras_driver to execute the
+! relaxed arakawa/schubert cumulus parameterization scheme.
+!-----------------------------------------------------------------------
+ else if (lras) then
+ call ras_driver &
+ (is, js, Input_mp, Output_mp, Tend_mp, Conv_results, &
+ C2ls_mp, Aerosol)
-!---------------------------------------------------------------------
-! NOTE 1: sfc_sh_flux, sfc_vapor_flux, tr_flux are the surface fluxes
-! that will have been obtained from the flux exchange module
-! and passed on to moist_processes and then to donner_deep.
-! FOR NOW, these values are defined herein, and given
-! values of 0.0. Could / should be passed in appropriately
-! from the Surf_diff variable.
-!---------------------------------------------------------------------
- sfc_sh_flux = 0.0
- sfc_vapor_flux = 0.0
- if (Removal_mp_control%num_donner_tracers > 0) then
- nn = 1
- do n=1, num_prog_tracers
- if (Removal_mp_control%tracers_in_donner(n)) then
- tr_flux(:,:,nn) = 0.0
- nn = nn + 1
- endif
- end do
- else
- tr_flux = 0.
- endif
+ else
!-----------------------------------------------------------------------
-! define boundary layer kinetic energy to pass to donner deep routine.
+! if no available convective implementations were requested, exit
+! with an error message.
!-----------------------------------------------------------------------
- temp_2d = Input_mp%pblht
- temp_2d = min(max(temp_2d, 0.0),5000.)
- temp_2d = Input_mp%ustar**3. + &
- 0.6*Input_mp%ustar*Input_mp%bstar*temp_2d
- where (temp_2d .gt. 0.)
- temp_2d = temp_2d**(2./3.)
- end where
- temp_2d = MAX (1.e-6, temp_2d)
+ call error_mesg ('convection_driver', &
+ 'no convective implementation specified', FATAL)
+ endif
-!----------------------------------------------------------------------
-! define model time in days and secs from base time.
-!----------------------------------------------------------------------
- call get_time (Time, secs, days)
+!&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
+!& &
+!& END OF INDIVIDUAL CONVECTIVE SCHEMES &
+!& &
+!&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
-!---------------------------------------------------------------------
-! call donner_deep to compute the effects of deep convection on the
-! temperature, vapor mixing ratio, tracers, cloud liquid, cloud ice
-! cloud area and precipitation fields.
-!---------------------------------------------------------------------
- if (doing_prog_clouds) then
- call donner_deep &
- (is, ie, js, je, dt, Input_mp%tin, rin, Input_mp%pfull, &
- Input_mp%phalf, Input_mp%zfull, Input_mp%zhalf, &
- Input_mp%omega, Input_mp%pblht, temp_2d, Input_mp%qstar, &
- Input_mp%cush, Input_mp%coldT, Input_mp%land, &
- sfc_sh_flux, sfc_vapor_flux, tr_flux, donner_tracer, &
- secs, days, Input_mp%cbmf, &
- Moist_clouds_block%cloud_data(i_cell)%cloud_area, &
- Moist_clouds_block%cloud_data(i_cell)%liquid_amt, &
- Moist_clouds_block%cloud_data(i_cell)%liquid_size, &
- Moist_clouds_block%cloud_data(i_cell)%ice_amt , &
- Moist_clouds_block%cloud_data(i_cell)%ice_size , &
- Moist_clouds_block%cloud_data(i_cell)%droplet_number, &
- Moist_clouds_block%cloud_data(i_meso)%cloud_area, &
- Moist_clouds_block%cloud_data(i_meso)%liquid_amt, &
- Moist_clouds_block%cloud_data(i_meso)%liquid_size, &
- Moist_clouds_block%cloud_data(i_meso)%ice_amt , &
- Moist_clouds_block%cloud_data(i_meso)%ice_size , &
- Moist_clouds_block%cloud_data(i_meso)%droplet_number, &
- Moist_clouds_block%cloud_data(i_meso)%nsum_out, &
- maxTe_launch_level, &
- precip_returned, delta_temp, delta_vapor, &
- m_cdet_donner, m_cellup, mc_donner, mc_donner_up, &
- mc_donner_half, C2ls_mp%donner_humidity_area, &
- C2ls_mp%donner_humidity_factor, qtr, &
- Removal_mp%donner_wetdep, lheat_precip, vert_motion, &
- total_precip, liquid_precip, frozen_precip, &
- Removal_mp%frz_meso, Removal_mp%liq_meso, &
- Removal_mp%frz_cell, Removal_mp%liq_cell, &
- qlin, qiin, qain, delta_ql, &!optional
- delta_qi, delta_qa) !optional
- else
- call donner_deep &
- (is, ie, js, je, dt, Input_mp%tin, rin, Input_mp%pfull, &
- Input_mp%phalf, Input_mp%zfull, Input_mp%zhalf, &
- Input_mp%omega, Input_mp%pblht, temp_2d, Input_mp%qstar, &
- Input_mp%cush, Input_mp%coldT, Input_mp%land, &
- sfc_sh_flux, sfc_vapor_flux, tr_flux, donner_tracer, &
- secs, days, Input_mp%cbmf, &
- Moist_clouds_block%cloud_data(i_cell)%cloud_area, &
- Moist_clouds_block%cloud_data(i_cell)%liquid_amt, &
- Moist_clouds_block%cloud_data(i_cell)%liquid_size, &
- Moist_clouds_block%cloud_data(i_cell)%ice_amt , &
- Moist_clouds_block%cloud_data(i_cell)%ice_size , &
- Moist_clouds_block%cloud_data(i_cell)%droplet_number, &
- Moist_clouds_block%cloud_data(i_meso)%cloud_area, &
- Moist_clouds_block%cloud_data(i_meso)%liquid_amt, &
- Moist_clouds_block%cloud_data(i_meso)%liquid_size, &
- Moist_clouds_block%cloud_data(i_meso)%ice_amt , &
- Moist_clouds_block%cloud_data(i_meso)%ice_size , &
- Moist_clouds_block%cloud_data(i_meso)%droplet_number, &
- Moist_clouds_block%cloud_data(i_meso)%nsum_out, &
- maxTe_launch_level, &
- precip_returned, delta_temp, delta_vapor, &
- m_cdet_donner, m_cellup, mc_donner, mc_donner_up, &
- mc_donner_half, C2ls_mp%donner_humidity_area, &
- C2ls_mp%donner_humidity_factor, qtr, &
- Removal_mp%donner_wetdep, lheat_precip, vert_motion, &
- total_precip, liquid_precip, frozen_precip, &
- Removal_mp%frz_meso, Removal_mp%liq_meso, &
- Removal_mp%frz_cell, Removal_mp%liq_cell)
- endif
!---------------------------------------------------------------------
-! update the current timestep tracer changes with the contributions
-! just obtained from donner transport.
+! now that all potential convection schemes have been processed,
+! calculate cumulus momentum transport, if desired.
!---------------------------------------------------------------------
- if (Removal_mp_control%num_donner_tracers > 0) then
- nn = 1
- do n=1, num_prog_tracers
- if (Removal_mp_control%tracers_in_donner(n)) then
- Output_mp%rdt(:,:,:,n) = Output_mp%rdt(:,:,:,n) + &
- qtr(:,:,:,nn)
- nn = nn + 1
- endif
- end do
- endif
+ if (do_cmt) then
-!--------------------------------------------------------------------
-! obtain updated vapor specific humidity (qnew) resulting from deep
-! convection. define the vapor specific humidity change due to deep
-! convection (qtnd).
-!--------------------------------------------------------------------
- do k=1,kx
- do j=1,jx
- do i=1,ix
- if (delta_vapor(i,j,k) /= 0.0) then
-!was qnew... now temp
- temp = (rin(i,j,k) + delta_vapor(i,j,k))/ &
- (1.0 + (rin(i,j,k) + delta_vapor(i,j,k)))
- delta_q(i,j,k) = temp - Input_mp%qin(i,j,k)
- else
- delta_q(i,j,k) = 0.
- endif
- enddo
- enddo
- end do
+!----------------------------------------------------------------------
+! activate the cmt clock, call cu_mo_trans, and then deactivate
+! the clock.
+!----------------------------------------------------------------------
+ call mpp_clock_begin (cmt_clock)
+ call cu_mo_trans (is, js, Time, dt, num_prog_tracers, Input_mp, &
+ Conv_results, Output_mp, Tend_mp%ttnd_conv)
+ call mpp_clock_end (cmt_clock)
+ endif
!------------------------------------------------------------------------
-! if conservation checks on the water and enthalpy changes produced
-! within the donner deep convectuion scheme have been requested,
-! compute the needed vertical integrals here.
+! call define_total_convective_output to a) define total cloud mass
+! flux, b) define cloud base and cloud top, c) define lightning
+! source of nox, d) define convective gustiness, e) set flag indicating
+! columns with convection, f) update the Input_mp%tracer field with
+! the changes produced in this module, and g) update the tin and
+! rdt fields with the uw tendencies if they have not already been so
+! updated. Updating fields at this point only occurs when legacy warsaw
+! results are desired; otherwise the updates would have been done at
+! the more appropriate time.
!------------------------------------------------------------------------
- if (do_donner_conservation_checks) then
- vaporint = 0.
- lcondensint = 0.
- condensint = 0.
- diffint = 0.
- enthint = 0.
- enthdiffint = 0.
-
- do k=1,kx
- vaporint = vaporint + Input_mp%pmass (:,:,k)*delta_q(:,:,k)
- enthint = enthint + CP_AIR* &
- Input_mp%pmass(:,:,k)*delta_temp(:,:,k)
- condensint = condensint + Input_mp%pmass(:,:,k) * &
- (delta_ql(:,:,k) + delta_qi(:,:,k))
- lcondensint = lcondensint + Input_mp%pmass(:,:,k) * &
- (HLV*delta_ql(:,:,k) + HLS*delta_qi(:,:,k))
- end do
- precipint = total_precip/seconds_per_day
- diffint = (vaporint + condensint)*dtinv + precipint
- enthdiffint = (enthint - lcondensint)*dtinv - &
- lheat_precip/seconds_per_day - &
- vert_motion/seconds_per_day
+ call define_total_convective_output (is, js, nt, C2ls_mp, &
+ Conv_results, Input_mp, Output_mp, Phys_mp_exch)
!------------------------------------------------------------------------
-! update the variable collecting the maximum imbalance over the entire
-! model run, if the present imbalance value is larger than the
-! previously recorded.
+! call convective_diagnostics to produce and output desired diagnostics
+! reflecting the model's total convection, summed over the active
+! convective parameterization(s).
!------------------------------------------------------------------------
- do j=1,size(enthdiffint,2)
- do i=1,size(enthdiffint,1)
- max_enthalpy_imbal_don(i+is-1,j+js-1) = &
- max( abs(enthdiffint(i,j)), &
- max_enthalpy_imbal_don(i+is-1,j+js-1) )
- max_water_imbal_don(i+is-1,j+js-1) = &
- max( abs(diffint(i,j)), &
- max_water_imbal_don(i+is-1,j+js-1) )
- end do
- end do
+ call convective_diagnostics (is, js, C2ls_mp, Conv_results, &
+ Input_mp, Tend_mp, Output_mp)
+
+!-----------------------------------------------------------------------
+! call define_convective_area to compute the grid box area taken up by
+! convective clouds, so that this information may be supplied to the
+! large-scale cloud module.
+!-----------------------------------------------------------------------
+ call define_convective_area &
+ (C2ls_mp, Moist_clouds_block, Input_mp)
+!----------------------------------------------------------------------
+! define the interface-level precip fluxes needed for input to the
+! COSP simulator package.
+!---------------------------------------------------------------------
+ if (do_cosp) then
+ call define_inputs_for_cosp (Removal_mp)
+ endif
!------------------------------------------------------------------------
-! output diagnostics related to water and enthalpy conservation.
+! deallocate the components of the Conv_results derived type variable.
!------------------------------------------------------------------------
- used = send_data(id_max_enthalpy_imbal_don, &
- max_enthalpy_imbal_don(is:ie,js:je), Time, is, js)
- used = send_data(id_max_water_imbal_don, &
- max_water_imbal_don(is:ie,js:je), Time, is, js)
- used = send_data(id_vaporint, vaporint*dtinv, Time, is, js)
- used = send_data(id_condensint, condensint*dtinv, Time, is, js)
- used = send_data(id_vertmotion, vert_motion/seconds_per_day, &
- Time, is, js)
- used = send_data(id_precipint, precipint, Time, is, js)
- used = send_data(id_diffint, diffint, Time, is, js)
- used = send_data(id_enthint, enthint*dtinv, Time, is, js)
- used = send_data(id_lcondensint, lcondensint*dtinv, Time, is, js)
- used = send_data(id_lprcp, lheat_precip/seconds_per_day, &
- Time, is, js)
- used = send_data(id_enthdiffint, enthdiffint, Time, is, js)
- endif
+ call convection_driver_dealloc (Conv_results)
!---------------------------------------------------------------------
-! scale Donner tendencies to prevent the formation of negative
-! total water specific humidities
+! end the timing of the convection code section.
!---------------------------------------------------------------------
- if (doing_prog_clouds .and. do_limit_donner) then
- call moistproc_scale_donner ( &
- is, ie, js, je, dt, Input_mp%qin, delta_temp, delta_q, &
- precip_returned, total_precip, lheat_precip, &
- liquid_precip, frozen_precip, Input_mp%pmass, &
- num_prog_tracers, &
- Removal_mp_control%tracers_in_donner, delta_ql, delta_qi, &
- delta_qa, qlin, qiin, qtr, scale_donner)
- else
- scale_donner = 1.0
- end if
- used = send_data (id_scale_donner, scale_donner, Time, is, js )
+ call mpp_clock_end (convection_clock)
-!---------------------------------------------------------------------
-! recalculate the precip using the delta specific humidity tenden-
-! cies. define precip_adjustment as the change in precipitation
-! resulting from the recalculation.
-!---------------------------------------------------------------------
- if (force_donner_moist_conserv) then
-!---------------------------------------------------------------------
-! calculate the adjustment to the precipitation that would be needed
-! in order to balance the change in water content in the column.
-! if this is smaller than 1.e-10, ignore the imbalance. Also calculate
-! the fraction of the returned precip that this corresponds to.
-!---------------------------------------------------------------------
- temp_2d = 0.
- do k=1,kx
- temp_2d (:,:) = temp_2d (:,:) + (-delta_q(:,:,k) - &
- delta_ql(:,:,k) -delta_qi(:,:,k))* &
- Input_mp%pmass(:,:,k)
- end do
- precip_adjustment = (temp_2d - precip_returned)
+!------------------------------------------------------------------------
- do j=1,jx
- do i=1,ix
- if (ABS(precip_adjustment(i,j)) < 1.0e-10) then
- precip_adjustment (i,j) = 0.0
- endif
- if ( precip_adjustment(i,j) < 0.0 .and. &
- (precip_adjustment(i,j)+precip_returned(i,j)) < 0.0 ) then
-! If precip_returned is greater than the "change in water content" balance,
-!and
-! there is not enough water available to beg/borrow/steal from, we need to zero
-! out the various tendencies. i.e. donner_deep will not contribute to changing
-! the column
-! write (warn_mesg,'(2i4,2e12.4)') i,j,precip_adjustment(i,j), precip_returned(i,j)
-! call error_mesg ('moist_processes_mod', 'moist_processes: &
-! &Change in water content does not balance precip &
-! &from donner_deep routine.'//trim(warn_mesg), WARNING)
- scale(i,j) = 0.0
- delta_vapor(i,j,:) = 0.0
- delta_q(i,j,:) = 0.0
- delta_qi(i,j,:) = 0.0
- delta_ql(i,j,:) = 0.0
- delta_qa(i,j,:) = 0.0
- total_precip(i,j) = 0.0
- precip_returned(i,j) = 0.0
- liquid_precip(i,j,:) = 0.0
- frozen_precip(i,j,:) = 0.0
- lheat_precip(i,j) = 0.0
- endif
- end do
- end do
- do j=1,jx
- do i=1,ix
- if (precip_returned(i,j) > 0.0) then
- adjust_frac(i,j) = &
- precip_adjustment(i,j)/precip_returned(i,j)
- else
- adjust_frac(i,j) = 0.
- endif
- end do
- end do
-!----------------------------------------------------------------------
-! now adjust the temperature to balance the precip adjustment
-! and so conserve enthalpy in the column, and define the new values
-! of liquid and frozen precipitation after adjustment.
-!---------------------------------------------------------------------
- do k=1,kx
- ttnd_adjustment(:,:,k) = &
- ((HLV*liquid_precip(:,:,k)*adjust_frac(:,:) + &
- HLS*frozen_precip(:,:,k)*adjust_frac(:,:)) &
- *dt/seconds_per_day)/CP_AIR
- liquid_precip(:,:,k) = liquid_precip(:,:,k)* &
- (1.0+adjust_frac(:,:))
- frozen_precip(:,:,k) = frozen_precip(:,:,k)* &
- (1.0+adjust_frac(:,:))
- end do
- else ! (force_donner_moist_conserv)
+end subroutine convection_driver
-!------------------------------------------------------------------------
-! define the adjustments to be 0.0 if conservation is not being forced.
-!------------------------------------------------------------------------
- precip_adjustment = 0.0
- adjust_frac = 0.0
- ttnd_adjustment = 0.
- endif ! (force_donner_moist_conserv)
-!-------------------------------------------------------------------------
-! define the column rainfall and snowfall from the donner scheme.
-!-------------------------------------------------------------------------
- rain_don = 0.0
- snow_don = 0.0
- do k=1,kx
- rain_don = rain_don + liquid_precip(:,:,k)* &
- Input_mp%pmass(:,:,k)/seconds_per_day
- snow_don = snow_don + frozen_precip(:,:,k)* &
- Input_mp%pmass(:,:,k)/seconds_per_day
- end do
+!######################################################################
-!----------------------------------------------------------------------
-! modify the 3d precip fluxes used by COSP to account for the
-! conservation adjustment.
-!----------------------------------------------------------------------
- if (do_cosp) then
- do k=1, kx
- do j=1,jx
- do i=1,ix
- Removal_mp%frz_meso(i,j,k) = Removal_mp%frz_meso(i,j,k)* &
- Input_mp%pmass(i,j,k)*scale(i,j)* &
- (1.0+adjust_frac(i,j))/SECONDS_PER_DAY
- Removal_mp%liq_meso(i,j,k) = Removal_mp%liq_meso(i,j,k)* &
- Input_mp%pmass(i,j,k)*scale(i,j)* &
- (1.0+adjust_frac(i,j))/SECONDS_PER_DAY
- Removal_mp%frz_cell(i,j,k) = Removal_mp%frz_cell(i,j,k)* &
- Input_mp%pmass(i,j,k)*scale(i,j)* &
- (1.0+adjust_frac(i,j))/SECONDS_PER_DAY
- Removal_mp%liq_cell(i,j,k) = Removal_mp%liq_cell(i,j,k)* &
- Input_mp%pmass(i,j,k)*scale(i,j)* &
- (1.0+adjust_frac(i,j))/SECONDS_PER_DAY
- end do
- end do
- end do
- endif
+subroutine convection_driver_endts
-!-------------------------------------------------------------------------
-! if the option to allow only one convective scheme per column is
-! active, mark those columns which underwent donner convection.
-!-------------------------------------------------------------------------
- if (only_one_conv_scheme_per_column) then
- conv_calc_completed = (rain_don + snow_don) > 0.0
- endif
+!-----------------------------------------------------------------------
+! subroutine convection_driver_endts performs needed calculations
+! upon exiting the prognostic loop.
+!-----------------------------------------------------------------------
-!---------------------------------------------------------------------
-! convert the deltas in temperature, vapor specific humidity and
-! precipitation resulting from deep convection to time tendencies
-! of these quantities.
-!---------------------------------------------------------------------
- ttnd_don = delta_temp*dtinv
- ttnd_don = ttnd_don + ttnd_adjustment*dtinv
- qtnd_don = delta_q*dtinv
+!-----------------------------------------------------------------------
+! if donner convection is active, call the end-of-timestep routine of
+! that module.
+!-----------------------------------------------------------------------
+ if (do_donner_deep) then
+ call donner_deep_endts
+ endif
-!--------------------------------------------------------------------
-! add the tendencies of temperature and specific humidity resulting
-! from the deep convection component of the donner parameterization
-! to the total convective tendency.
-!--------------------------------------------------------------------
- Tend_mp%ttnd_conv = Tend_mp%ttnd_conv + ttnd_don
- Tend_mp%qtnd_conv = Tend_mp%qtnd_conv + qtnd_don
+!-----------------------------------------------------------------------
-!--------------------------------------------------------------------
-! add the tendencies of temperature and specific humidity resulting
-! from the deep convection component of the donner parameterization
-! to the total tendencies from all physics processes.
-!--------------------------------------------------------------------
- Output_mp%tdt = Output_mp%tdt + ttnd_don
- Output_mp%rdt(:,:,:,1) = Output_mp%rdt(:,:,:,1) + qtnd_don
-!--------------------------------------------------------------------
-! add the liquid (rain) and frozen (snow) precipitation generated by
-! deep convection on this step to the arrays accumulating precip-
-! itation from all sources (lprec, fprec).
-!--------------------------------------------------------------------
+end subroutine convection_driver_endts
+
+!########################################################################
-!if (minval(rain_don) < 0.0 ) then
-! write (warn_mesg,'(2i4,e12.4)') minloc(rain_don), minval(rain_don)
-! call error_mesg ('moist_processes_mod', 'moist_processes: &
-! &Donner_deep rain is negative.'//trim(warn_mesg), WARNING)
-!endif
-!if (minval(snow_don) < 0.0 ) then
-! write (warn_mesg,'(2i4,e12.4)') minloc(snow_don), minval(snow_don)
-! call error_mesg ('moist_processes_mod', 'moist_processes: &
-! &Donner_deep snow is negative.'//trim(warn_mesg), WARNING)
-!endif
+subroutine convection_driver_end
- Output_mp%lprec = Output_mp%lprec + rain_don
- Output_mp%fprec = Output_mp%fprec + snow_don
+!---------------------------------------------------------------------
+! subroutine convection_driver_end calls destructor routines for the
+! modules initialized within this module, and deallocates module
+! variables.
+!---------------------------------------------------------------------
+
+!---------------------------------------------------------------------
+! call the destructor routines for the active convection modules.
+!---------------------------------------------------------------------
+ if (do_donner_deep) call donner_deep_end
+ if (do_ras ) call ras_end
+ if (do_uw_conv ) call uw_conv_end
+ if (do_cmt ) call cu_mo_trans_end
+ call detr_ice_num_end
+
+!----------------------------------------------------------------------
+! deallocate module variables.
+!----------------------------------------------------------------------
+ if (do_donner_deep .and. do_donner_conservation_checks) then
+ deallocate (max_water_imbal_don)
+ deallocate (max_enthalpy_imbal_don)
+ endif
+
+ deallocate (tracers_in_donner)
+ deallocate (tracers_in_uw )
+ deallocate (tracers_in_mca )
+ deallocate (tracers_in_ras )
+
+ deallocate (cloud_tracer)
+
+ deallocate(id_tracerdt_conv) ! h1g, 2017-02-02
+ deallocate (id_tracerdt_conv_col) ! h1g, 2017-02-02
+ deallocate (id_conv_tracer) ! h1g, 2017-02-02
+ deallocate (id_conv_tracer_col) ! h1g, 2017-02-02
+ if (do_donner_mca) then
+ deallocate ( id_tracerdt_mcadon ) ! h1g, 2017-02-02
+ deallocate ( id_tracerdt_mcadon_col ) ! h1g, 2017-02-02
+ endif
!--------------------------------------------------------------------
-! output diagnostics for the time tendencies of temperature, vapor
-! specific humidity and large scale cloud fields, and various precip
-! and mass flux diagnostics due to donner deep convection.
-!--------------------------------------------------------------------
- used = send_data (id_tdt_deep_donner, ttnd_don, Time, is, js, 1)
- used = send_data (id_qdt_deep_donner, qtnd_don, Time, is, js, 1)
- used = send_data (id_qadt_deep_donner, delta_qa*dtinv, &
- Time, is, js, 1)
- used = send_data (id_qldt_deep_donner, delta_ql*dtinv, &
- Time, is, js, 1)
- used = send_data (id_qidt_deep_donner, delta_qi*dtinv, &
- Time, is, js, 1)
- used = send_data (id_mc_donner, mc_donner, Time, is, js, 1)
- used = send_data (id_mc_donner_half, mc_donner_half, &
- Time, is, js, 1 )
- used = send_data (id_m_cdet_donner, m_cdet_donner, &
- Time, is, js, 1 )
- used = send_data (id_m_cellup, m_cellup, Time, is, js, 1 )
- used = send_data (id_snow_deep_donner, snow_don, Time, is, js)
- used = send_data (id_prec_deep_donner, rain_don + snow_don, &
- Time, is, js )
- used = send_data (id_prec1_deep_donner, precip_adjustment, &
- Time, is, js, mask = precip_returned > 0.0)
- used = send_data (id_precret_deep_donner, precip_returned, &
- Time, is, js)
+
+ end subroutine convection_driver_end
-!------------------------------------------------------------------------
-! if donner conservation checks have been done, output various
-! diagnostics describing the results.
-!------------------------------------------------------------------------
- if (do_donner_conservation_checks) then
- used = send_data (id_enth_donner_col2, -hlv*rain_don, &
- Time, is, js)
- used = send_data (id_enth_donner_col3, -hls*snow_don, &
- Time, is, js)
- if (id_enth_donner_col4 > 0) &
- call column_diag(id_enth_donner_col4, is, js, Time, &
- ttnd_don(:,:,:), CP_AIR, Input_mp%pmass)
- if (id_enth_donner_col5 > 0) &
- call column_diag(id_enth_donner_col5, is, js, Time, &
- delta_ql(:,:,:), -HLV*dtinv, &
- delta_qi(:,:,:), -HLS*dtinv, Input_mp%pmass)
- if (id_enth_donner_col6 > 0) &
- call column_diag(id_enth_donner_col6, is, js, Time, &
- ttnd_adjustment, CP_AIR, Input_mp%pmass)
- used = send_data (id_enth_donner_col7, adjust_frac, Time, is, js)
-!------------------------------------------------------------------------
-! compute and output column enthalpy change due to donner deep
-! convection.
-!------------------------------------------------------------------------
- temp_2d = 0.
- do k=1,kx
- temp_2d(:,:) = temp_2d(:,:) + &
- (-HLV*liquid_precip(:,:,k)/seconds_per_day - &
- hls*frozen_precip(:,:,k)/seconds_per_day + &
- CP_AIR*ttnd_don(:,:,k) - &
- (HLV*delta_ql(:,:,k)*dtinv + &
- HLS*delta_qi(:,:,k)*dtinv))* &
- Input_mp%pmass(:,:,k)
- end do
- used = send_data (id_enth_donner_col, temp_2d, Time, is, js)
-!------------------------------------------------------------------------
-! compute and output column water change due to donner deep convection.
-!------------------------------------------------------------------------
- if (id_wat_donner_col > 0) then
- temp_2d = rain_don + snow_don
- call column_diag(id_wat_donner_col, is, js, Time, qtnd_don, &
- 1.0, delta_ql, dtinv, delta_qi, dtinv, &
- Input_mp%pmass, temp_2d)
- endif
- endif ! (donner_conservation_checks)
+!######################################################################
+
+subroutine convection_driver_restart (timestamp)
!------------------------------------------------------------------------
-! output additional diagnostics related to the clouds associated with
-! donner convection.
+! subroutine convection_driver_restart controls the writing of any
+! restart files associated with activated convection schemes.
!------------------------------------------------------------------------
- used = send_data (id_cell_cld_frac, &
- Moist_clouds_block%cloud_data(i_cell)%cloud_area, &
- Time, is, js, 1 )
- used = send_data (id_meso_cld_frac, &
- Moist_clouds_block%cloud_data(i_meso)%cloud_area, &
- Time, is, js, 1)
- used = send_data (id_donner_humidity_area, &
- C2ls_mp%donner_humidity_area(:,:,:), Time, is, js, 1 )
-!1/19/16 MOD RSH
-!---------------------------------------------------------------------
-! update the values of temperature and vapor specific humidity to
-! include the effects of deep convection. if mca was included in the
-! donner deep scheme, then this update has already been done.
-!---------------------------------------------------------------------
- if (keep_icenum_detrain_bug) then
- else
- Input_mp%tin(:,:,:) = Input_mp%tin(:,:,:) + delta_temp(:,:,:)
- Input_mp%qin(:,:,:) = Input_mp%qin(:,:,:) + delta_q(:,:,:)
- endif
+character(len=*), intent(in), optional :: timestamp
!-----------------------------------------------------------------------
-! turn off the donner clock.
+! timestamp character string that represents the model time,
+! used for writing restart. timestamp will append to
+! the any restart file name as a prefix.
!-----------------------------------------------------------------------
- call mpp_clock_end (donner_clock)
-!----------------------------------------------------------------------
-! this section calculates the moist convective adjustment associated
-! with the donner convection scheme. It is activated / deactivated
-! by moist_processes_nml variable do_donner_mca.
-!----------------------------------------------------------------------
- if (do_donner_mca) then
+!-----------------------------------------------------------------------
+! process the donner convection restart file.
+!-----------------------------------------------------------------------
+ if (do_donner_deep) call donner_deep_restart (timestamp)
-!----------------------------------------------------------------------
-! if donner mca is active, turn on its clock.
-!----------------------------------------------------------------------
- call mpp_clock_begin (donner_mca_clock)
+!-----------------------------------------------------------------------
-!--------------------------------------------------------------------
-! call subroutine moist_conv to handle any shallow convection present
-! in the grid. this call is made without the optional lsc variables so
-! that no convective detrainment (and corresponding change in
-! large-scale cloud amount and area) occurs, consistent with this call
-! being intended to handle only shallow convection. The temp and vapor
-! fields are updated with any changes from deep convection before the
-! routine is called.
-!--------------------------------------------------------------------
- if (keep_icenum_detrain_bug) then
- Input_mp%tin = Input_mp%tin + delta_temp
- Input_mp%qin = Input_mp%qin + delta_q
- endif
- call moist_conv ( &
- Input_mp%tin, Input_mp%qin, Input_mp%pfull, &
- Input_mp%phalf, Input_mp%coldT, ttnd_don, qtnd_don, &
- rain_donmca, snow_donmca, dtinv, Time, is, js, &
- donner_tracer, qtr, Lbot=kbot, mask=mask)
+
+end subroutine convection_driver_restart
+
+
+!#######################################################################
+
+subroutine cape_cin_diagnostics (is, ie, js, je, Input_mp, Time)
!-----------------------------------------------------------------------
-! if the effects of the mca component of donner are to be seen by
-! COSP, define the associated precip fluxes.
+! subroutine cape_cin_diagnostics calls subroutine capecalcnew to
+! compute a parcel's ascent, computing cape and cin of the
+! environment as it does, if diagnostics for cape or cin are requested,
!-----------------------------------------------------------------------
- if (do_cosp .and. include_donmca_in_cosp) then
- do j=1,jx
- do i=1,ix
- if (Input_mp%coldT(i,j)) then
- do k=1,kx
- Removal_mp%mca_frz(i,j,k) = &
- -1.0*qtnd_don(i,j,k)*Input_mp%pmass(i,j,k)
- Removal_mp%mca_liq(i,j,k) = 0.
- end do
- else
- do k=1,kx
- Removal_mp%mca_frz(i,j,k) = 0.
- Removal_mp%mca_liq(i,j,k) = &
- -1.0*qtnd_don(i,j,k)*Input_mp%pmass(i,j,k)
- end do
- endif
- end do
- end do
- else
- Removal_mp%mca_frz = 0.
- Removal_mp%mca_liq = 0.
- endif
-!---------------------------------------------------------------------
-! update the current tracer tendencies with the contributions
-! just obtained from moist convective adjustment. currently there
-! is no tracer transport by this process, so qtr will be 0.0 for all
-! tracers.
-!---------------------------------------------------------------------
- nn = 1
- do n=1, num_prog_tracers
- if (Removal_mp_control%tracers_in_donner(n)) then
- Output_mp%rdt(:,:,:,n) = Output_mp%rdt(:,:,:,n) + &
- qtr(:,:,:,nn)
- nn = nn + 1
- endif
- end do
+integer, intent(in) :: is, ie, js, je
+type(mp_input_type), intent(in) :: Input_mp
+type(time_type), intent(in) :: Time
-!--------------------------------------------------------------------
-! add the heating and moistening rates from the mca portion of
-! donner convection to the arrays accumulating total convective
-! changes and those accumulating total physics changes.
-!--------------------------------------------------------------------
- Tend_mp%ttnd_conv = Tend_mp%ttnd_conv + ttnd_don
- Tend_mp%qtnd_conv = Tend_mp%qtnd_conv + qtnd_don
- Output_mp%tdt = Output_mp%tdt + ttnd_don
- Output_mp%rdt(:,:,:,1) = Output_mp%rdt(:,:,:,1) + qtnd_don
+!-----------------------------------------------------------------------
+! is,ie starting and ending i indices for window
+! js,je starting and ending j indices for window
+! Input_mp derived type variable containing model profiles
+! Time variable containing current diagnostic time [ time_type ]
+!-----------------------------------------------------------------------
-!--------------------------------------------------------------------
-! add the liquid (rain) and frozen (snow) precipitation generated by
-! the moist convective adjustment pass of the donner parameterization
-! on this step to the arrays accumulating precipitation from all
-! sources (lprec, fprec).
-!--------------------------------------------------------------------
- Output_mp%lprec = Output_mp%lprec + rain_donmca
- Output_mp%fprec = Output_mp%fprec + snow_donmca
+ real, dimension(size(Input_mp%tin,1), size(Input_mp%tin,2), &
+ size(Input_mp%tin,3)) :: &
+ rin, rp, tp
+ real, dimension(size(Input_mp%tin,1), size(Input_mp%tin,2)) :: &
+ cape, cin
+ integer, dimension(size(Input_mp%tin,1), size(Input_mp%tin,2)) :: &
+ klcl, klfc, klzb
+ logical :: avgbl, used
+ integer :: i, j, ix, jx, kx
+
!--------------------------------------------------------------------
-! output the time tendencies of temperature, vapor specific humid-
-! ity, precipitation and snow due to the moist convective
-! adjustment pass of the donner parameterization.
-!--------------------------------------------------------------------
- used = send_data (id_tdt_mca_donner, ttnd_don, Time, is, js, 1)
- used = send_data (id_qdt_mca_donner, qtnd_don, Time, is, js, 1)
- used = send_data (id_prec_mca_donner, rain_donmca+snow_donmca, &
- Time, is, js)
- used = send_data (id_snow_mca_donner, snow_donmca, Time, is, js)
-
-!------------------------------------------------------------------------
-! output the column imbalances of enthalpy and water resulting from the
-! mca component of donner convection.
-!------------------------------------------------------------------------
- if (id_enth_mca_donner_col > 0) then
- temp_2d = -HLV*rain_donmca -HLS*snow_donmca
- call column_diag(id_enth_mca_donner_col, is, js, Time, &
- ttnd_don, CP_AIR, Input_mp%pmass, temp_2d)
- endif
+! rin model h2o mixing ratio [ kg [h2o] / kg [dry air ]
+! rp rising parcel mixing ratio profile
+! tp rising parcel temperature profile
+! cape convective available potential energy
+! cin convective inhibition
+! klcl model lifting condensation level for rising parcel
+! klfc model level of free convection for rising parcel
+! klzb model level of zero buoyancy for rising parcel
+! avgbl outdated variable no longer used in capecalcnew
+! used logical used to indicate data has been received by
+! diag_manager_mod
+! i, j do loop indices
+! ix, jx, kx array spatial dimensions; size of physics_window
+!------------------------------------------------------
- if (id_wat_mca_donner_col > 0) then
- temp_2d = rain_donmca + snow_donmca
- call column_diag(id_wat_mca_donner_col, is, js, Time, &
- qtnd_don, 1.0, Input_mp%pmass, temp_2d)
- endif
+!-------------------------------------------------------------------
+! proceed with computation if diagnostics for cape or cin are requested,
+!------------------------------------------------------------------
+ if ( id_cape > 0 .or. id_cin > 0) then
+!---------------------------------------------------------------------
+! define physics window dimensions.
!--------------------------------------------------------------------
-! output the time tendencies of tracer and of column tracer
-! due to the moist convective adjustment pass of the donner
-! parameterization. currently moist convective adjustment does not
-! affect the tracer fields, so these fields are always 0.0.
-!--------------------------------------------------------------------
- do n = 1, Removal_mp_control%num_donner_tracers
- if ( id_tracerdt_mcadon(n) > 0 ) &
- used = send_data(id_tracerdt_mcadon(n), qtr(:,:,:,n), &
- Time, is, js, 1 )
- if (id_tracerdt_mcadon_col(n) > 0 ) &
- call column_diag(id_tracerdt_mcadon_col(n), is, js, Time, &
- qtr(:,:,:,n), 1.0, Input_mp%pmass)
- enddo
-
-!-----------------------------------------------------------------------
-! turn off the donner mca clock.
-!-----------------------------------------------------------------------
- call mpp_clock_end (donner_mca_clock)
- endif !(do_donner_mca)
+ kx = size(Input_mp%tin,3)
+ ix = size(Input_mp%tin,1)
+ jx = size(Input_mp%tin,2)
-!-----------------------------------------------------------------------
-! if a realizability constraint is to be placed on total cloud fraction,
-! define the area available for clouds from other schemes (usually
-! uw shallow) after the donner cloud area has been accounted for.
-! Note also that if the entire area at any level is taken up by donner
-! clouds, then uw clouds will not be allowed in the box
-! ( set conv_calc_completed = T).
-!-----------------------------------------------------------------------
- if (limit_conv_cloud_frac) then
- ltemp = ANY(C2ls_mp%donner_humidity_area(:,:,:) >= 0.999, &
- dim = 3)
- where (ltemp(:,:)) conv_calc_completed(:,:) = .true.
- available_cf_for_uw = MAX(0.999 - &
- C2ls_mp%donner_humidity_area(:,:,:), 0.0)
- endif
+!----------------------------------------------
+! calculate mixing ratio.
+!----------------------------------------------
+ rin = Input_mp%qin/(1.0 - Input_mp%qin)
!-----------------------------------------------------------------------
-! update the largescale cloud fields and their total tendencies from
-! physics with the tendencies resulting from the donner deep
-! convection scheme.
+! call routine to calculate cape and cin based on parcel rise.
!-----------------------------------------------------------------------
- if (doing_prog_clouds) then
- Input_mp%tracer(:,:,:,nql) = qlin + delta_ql
- Input_mp%tracer(:,:,:,nqi) = qiin + delta_qi
- Input_mp%tracer(:,:,:,nqa) = qain + delta_qa
- Output_mp%rdt(:,:,:,nql) = Output_mp%rdt(:,:,:,nql) + &
- delta_ql*dtinv
- Output_mp%rdt(:,:,:,nqi) = Output_mp%rdt(:,:,:,nqi) + &
- delta_qi*dtinv
- Output_mp%rdt(:,:,:,nqa) = Output_mp%rdt(:,:,:,nqa) + &
- delta_qa*dtinv
-
-
-!------------------------------------------------------------------------
-! calculate the amount of ice particles detrained from the donner
-! convective clouds. Modify the ice particle number and ice particle
-! number tendency from physics to account for this detrainment. output
-! a diagnostic if desired.
-!------------------------------------------------------------------------
- if (do_ice_num .and. detrain_ice_num) then
- CALL detr_ice_num (Input_mp%tin, delta_qi, delta_qni)
- Input_mp%tracer(:,:,:,nqni) = nilin + delta_qni
- Output_mp%rdt(:,:,:,nqni) = Output_mp%rdt(:,:,:,nqni) + &
- delta_qni*dtinv
- used = send_data (id_qnidt_deep_donner, delta_qni*dtinv, &
- Time, is, js, 1)
- endif
+ avgbl = .false.
+ do j = 1,jx
+ do i = 1,ix
+ call capecalcnew &
+ ( kx, Input_mp%pfull(i,j,:), Input_mp%phalf(i,j,:), &
+ CP_AIR, RDGAS, RVGAS, HLV, KAPPA, Input_mp%tin(i,j,:), &
+ rin(i,j,:), avgbl, cape(i,j), cin(i,j), tp(i,j,:), &
+ rp(i,j,:), klcl(i,j), klfc(i,j), klzb(i,j))
+ end do
+ end do
!-------------------------------------------------------------------------
-! detrain liquid droplets if desired. the original code had a bug which
-! may be preserved for test purposes with the remain_detrain_bug nml
-! variable. assume 10 micron mean volume radius for detrained droplets.
-! Modify the particle number and particle number tendency from physics
-! to account for this detrainment. output a diagnostic if desired.
+! output any requested diagnostics.
!-------------------------------------------------------------------------
- if (do_liq_num .and. detrain_liq_num) then
- if (remain_detrain_bug ) then
- delta_qn = delta_ql/1000.*3./(4.*3.14*10.e-15)
- else
- delta_qn = delta_ql/1000.*3./(4.*3.14e-15)
- endif !( remain_detrain_bug )
- Input_mp%tracer(:,:,:,nqn) = nllin + delta_qn
- Output_mp%rdt(:,:,:,nqn) = Output_mp%rdt(:,:,:,nqn) + &
- delta_qn*dtinv
- used = send_data (id_qndt_deep_donner, &
- delta_qn*dtinv, Time, is, js, 1)
- endif
- endif ! doing_prog_clouds
+ if (id_cape > 0) used = send_data ( id_cape, cape, Time, is, js )
+ if ( id_cin > 0 ) used = send_data ( id_cin, cin, Time, is, js )
+ if ( id_tp > 0 ) used = send_data ( id_tp, tp, Time, is, js )
+ if ( id_rp > 0 ) used = send_data ( id_rp, rp, Time, is, js )
+ if ( id_lcl > 0 ) used = send_data ( id_lcl, 1.0*klcl, Time, &
+ is, js )
+ if ( id_lfc > 0 ) used = send_data ( id_lfc, 1.0*klfc, Time, &
+ is, js )
+ if ( id_lzb > 0 ) used = send_data ( id_lzb, 1.0*klzb, Time, &
+ is, js )
+ end if
-!---------------------------------------------------------------------
-! update the values of temperature and vapor specific humidity to
-! include the effects of deep convection. if mca was included in the
-! donner deep scheme, then this update has already been done.
-!---------------------------------------------------------------------
- if (keep_icenum_detrain_bug) then
- if (.not. do_donner_mca) then
- Input_mp%tin(:,:,:) = Input_mp%tin(:,:,:) + delta_temp(:,:,:)
- Input_mp%qin(:,:,:) = Input_mp%qin(:,:,:) + delta_q(:,:,:)
- endif
- endif
- endif !(do_donner_deep)
+!-----------------------------------------------------------------------
-!@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
-!
-! 0. UW SHALLOW CONVECTION PARAMETERIZATION
-!
-!@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
-!------------------------------------------------------------------------
-! if uw shallow convection is to be done after donner deep, do it here.
-! start shallowcu clock.
-!------------------------------------------------------------------------
- if (do_donner_before_uw) then
- if (do_uw_conv) then
- call mpp_clock_begin (shallowcu_clock)
+end subroutine cape_cin_diagnostics
-!---------------------------------------------------------------------
-! be sure all optional arguments associated with the uw_conv param-
-! eterization are present.
-!---------------------------------------------------------------------
- if (i_shallow /= 0) then
- else
- call error_mesg ('convection_driver_mod', &
- 'improper arguments for uw_shallow clouds', FATAL)
- endif
-!---------------------------------------------------------------------
-! update tracer fields with tendencies due to donner convection and
-! wet deposition by donner deep precipitation if these updated fields
-! are what is to be seen by uw convection.
-!---------------------------------------------------------------------
- if (use_updated_profiles_for_uw) then
- do n=1,nt
- if (.not. cloud_tracer(n)) then
- Input_mp%tracer(:,:,:,n) = tracer_orig(:,:,:,n) + &
- (Output_mp%rdt(:,:,:,n) - rdt_init(:,:,:,n)) *dt
- endif
- end do
-!---------------------------------------------------------------------
-! call the uw_conv wrapper routine.
-!---------------------------------------------------------------------
- call moistproc_uw_conv &
- (Time, is, ie, js, je, dt, Input_mp%tin, Input_mp%qin, &
- Input_mp%uin, Input_mp%vin, Input_mp%tracer, &
- Input_mp%pfull, Input_mp%phalf, Input_mp%zfull, &
- Input_mp%zhalf, Input_mp%omega, Input_mp%pblht, &
- Input_mp%ustar, Input_mp%bstar, Input_mp%qstar, &
- shflx, lhflx, Input_mp%land, Input_mp%coldT, Aerosol, &
- Surf_diff%tdt_rad, Surf_diff%tdt_dyn, &
- Surf_diff%qdt_dyn, Surf_diff%dgz_dyn, &
- Surf_diff%ddp_dyn, tdt_dif, qdt_dif, &
- Phys_mp_exch%hmint, Input_mp%lat, Input_mp%lon, &
- Input_mp%cush, Input_mp%cbmf, Phys_mp_exch%cgust, &
- Phys_mp_exch%tke, Phys_mp_exch%pblhto, &
- Phys_mp_exch%rkmo, Phys_mp_exch%taudpo, &
- Phys_mp_exch%exist_shconv, Phys_mp_exch%exist_dpconv, &
- Phys_mp_exch%pblht_prev, Phys_mp_exch%hlsrc_prev, &
- Phys_mp_exch%qtsrc_prev, Phys_mp_exch%cape_prev, &
- Phys_mp_exch%cin_prev, Phys_mp_exch%tke_prev, &
- cmf, conv_calc_completed, available_cf_for_uw, &
- Output_mp%tdt, Output_mp%rdt(:,:,:,1), Output_mp%udt, &
- Output_mp%vdt, Output_mp%rdt, Tend_mp%ttnd_conv, &
- Tend_mp%qtnd_conv, Output_mp%lprec, Output_mp%fprec, &
- precip, Removal_mp%liq_precflx, &
- Removal_mp%ice_precflx, rain_uw, snow_uw, ttnd_uw, &
- qtnd_uw, utnd_uw, vtnd_uw, qtruw, qltnd_uw, qitnd_uw, &
- qatnd_uw, qntnd_uw, qnitnd_uw, doing_prog_clouds, &
- do_limit_uw, do_liq_num, num_prog_tracers, &
- Removal_mp_control%tracers_in_uw, &
- Removal_mp_control%num_uw_tracers, &
- Moist_clouds_block%cloud_data(i_shallow), &
- Removal_mp%uw_wetdep, do_ice_num, detrain_ice_num)
-
-!---------------------------------------------------------------------
-! if not using updated profiles for uw shallow, call the uw_conv
-! wrapper routine with the original input fields of t,q, and tracer.
-!---------------------------------------------------------------------
- else ! ( use_updated_profiles_for_uw)
- call moistproc_uw_conv &
- (Time, is, ie, js, je, dt, tin_orig, qin_orig, &
- Input_mp%uin, Input_mp%vin, tracer_orig, &
- Input_mp%pfull, Input_mp%phalf, Input_mp%zfull, &
- Input_mp%zhalf, Input_mp%omega, Input_mp%pblht, &
- Input_mp%ustar, Input_mp%bstar, Input_mp%qstar, &
- shflx, lhflx, Input_mp%land, Input_mp%coldT, Aerosol, &
- Surf_diff%tdt_rad, Surf_diff%tdt_dyn, &
- Surf_diff%qdt_dyn, Surf_diff%dgz_dyn, &
- Surf_diff%ddp_dyn, tdt_dif, qdt_dif, &
- Phys_mp_exch%hmint, Input_mp%lat, Input_mp%lon, &
- Input_mp%cush, Input_mp%cbmf, Phys_mp_exch%cgust, &
- Phys_mp_exch%tke, Phys_mp_exch%pblhto, &
- Phys_mp_exch%rkmo, Phys_mp_exch%taudpo, &
- Phys_mp_exch%exist_shconv, Phys_mp_exch%exist_dpconv, &
- Phys_mp_exch%pblht_prev, Phys_mp_exch%hlsrc_prev, &
- Phys_mp_exch%qtsrc_prev, Phys_mp_exch%cape_prev, &
- Phys_mp_exch%cin_prev, Phys_mp_exch%tke_prev, &
- cmf, conv_calc_completed, available_cf_for_uw, &
- Output_mp%tdt, Output_mp%rdt(:,:,:,1), Output_mp%udt, &
- Output_mp%vdt, Output_mp%rdt, Tend_mp%ttnd_conv, &
- Tend_mp%qtnd_conv, Output_mp%lprec, Output_mp%fprec, &
- precip, Removal_mp%liq_precflx, &
- Removal_mp%ice_precflx, rain_uw, snow_uw, ttnd_uw, &
- qtnd_uw, utnd_uw, vtnd_uw, qtruw, qltnd_uw, qitnd_uw, &
- qatnd_uw, qntnd_uw, qnitnd_uw, doing_prog_clouds, &
- do_limit_uw, do_liq_num, num_prog_tracers, &
- Removal_mp_control%tracers_in_uw, &
- Removal_mp_control%num_uw_tracers, &
- Moist_clouds_block%cloud_data(i_shallow), &
- Removal_mp%uw_wetdep, do_ice_num, detrain_ice_num)
- endif ! (use_updated_profiles_for_uw)
- call mpp_clock_end (shallowcu_clock)
- endif !(do_uw_conv)
- endif !(do_donner_before_uw)
-
-!@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
+!*******************************************************************
!
-! B. MOIST CONVECTIVE ADJUSTMENT
+! PRIVATE INITIALIZATION SUBROUTINES
!
-!@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
+!*******************************************************************
-!----------------------------------------------------------------------
-! if moist convective adjustment is active,activate its clock and call
-! its wrapper routine.
-!----------------------------------------------------------------------
- if (do_mca) then
- call mpp_clock_begin (mca_clock)
- call moistproc_mca &
- (Time, is, js, Input_mp%tin, Input_mp%qin, Input_mp%tracer, &
- Input_mp%pfull, Input_mp%phalf, Input_mp%coldT, dtinv, &
- Output_mp%tdt, Output_mp%rdt(:,:,:,1), Output_mp%rdt, &
- Tend_mp%q_tnd, Tend_mp%ttnd_conv, Tend_mp%qtnd_conv, &
- Output_mp%lprec, Output_mp%fprec, doing_prog_clouds, &
- num_prog_tracers, Removal_mp_control%tracers_in_mca, &
- Removal_mp_control%num_mca_tracers )
- call mpp_clock_end (mca_clock)
- endif
-!@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
-!
-! X. BETTS-MILLER CONVECTION SCHEME
-!
-!@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
-!----------------------------------------------------------------------
-! if one of the betts-miller convection schemes is active, activate
-! its clock and call the appropriate subroutine.
-!----------------------------------------------------------------------
- if ( any((/do_bm, do_bmmass, do_bmomp/)) ) then
- call mpp_clock_begin (bm_clock)
+!#########################################################################
-! betts-miller cumulus param scheme
- if (do_bm) then
- call betts_miller &
- (dt, Input_mp%tin, Input_mp%qin, Input_mp%pfull, &
- Input_mp%phalf, Input_mp%coldT, rain, snow, Tend_mp%ttnd, &
- Tend_mp%qtnd, q_ref, bmflag, klzbs, cape, cin, t_ref, &
- invtaubmt, invtaubmq, mask=mask)
- endif
+subroutine diag_field_init ( axes, Time, Control)
-! betts-miller-style massflux cumulus param scheme
- if (do_bmmass) then
- call bm_massflux &
- (dt, Input_mp%tin, Input_mp%qin, Input_mp%pfull, &
- Input_mp%phalf, Input_mp%coldT, rain, snow, Tend_mp%ttnd, &
- Tend_mp%qtnd, q_ref, bmflag, klzbs, t_ref, massflux, &
- mask=mask)
- endif
+!-----------------------------------------------------------------------
+! this subroutine initializes diagnostic fields from this module. it
+! also initializes global integrals for netCDF output.
+!-----------------------------------------------------------------------
-! olivier's betts-miller cumulus param scheme
- if (do_bmomp) then
- call bm_omp &
- (dt, Input_mp%tin, Input_mp%qin, Input_mp%pfull, &
- Input_mp%phalf, Input_mp%coldT, rain, snow, Tend_mp%ttnd, &
- Tend_mp%qtnd, q_ref, bmflag, klzbs, t_ref, mask=mask)
- endif
+integer, intent(in) :: axes(4)
+type(time_type), intent(in) :: Time
+type(mp_removal_control_type), intent(in) :: Control
-!----------------------------------------------------------------------
-! update input values and compute tendency.
-!----------------------------------------------------------------------
- Input_mp%tin = Input_mp%tin + Tend_mp%ttnd
- Input_mp%qin = Input_mp%qin + Tend_mp%qtnd
- Tend_mp%ttnd = Tend_mp%ttnd*dtinv
- Tend_mp%qtnd = Tend_mp%qtnd*dtinv
- rain = rain*dtinv
- snow = snow*dtinv
+!------------------------------------------------------------------------
-!----------------------------------------------------------------------
-! add tendencies and generated precipitation to arrays accumulating
-! tendencies from physics.
-!----------------------------------------------------------------------
- Output_mp%tdt = Output_mp%tdt + Tend_mp%ttnd
- Output_mp%rdt(:,:,:,1) = Output_mp%rdt(:,:,:,1) + Tend_mp%qtnd
- Output_mp%lprec = Output_mp%lprec + rain
- Output_mp%fprec = Output_mp%fprec + snow
- precip = precip + rain + snow
+!------------------------------------------------------------------------
+! axes data axis indices, (x,y,pf,ph) for diagnostics
+! Time time used for diagnostics [time_type]
+! Control derived type variable containing control variables
+! associated with tracer removal and transport by
+! available convective schemes
+!------------------------------------------------------------------------
-!-------------------------------------------------------------------------
-! compute rh clouds if they are active with betts-miller. first
-! calculate the relative humidity, then pass it to rh_clouds_mod to be
-! stored till needed.
-!-------------------------------------------------------------------------
- if (do_rh_clouds) then
- call rh_calc &
- (Input_mp%pfull, Input_mp%tin, Input_mp%qin, RH, do_simple)
- call rh_clouds_sum (is, js, RH)
- end if
+ character(len=32) :: tracer_units, tracer_name
+ character(len=128) :: diaglname
+ integer, dimension(3) :: half = (/1,2,4/)
+ integer :: n, nn
!-----------------------------------------------------------------------
-! save desired betts-miller diagnostics.
+! tracer_units units assigned to each tracer field
+! tracer_name name assigned to each tracer field
+! diaglname long name associated with each tracer diagnostic field
+! half axis indices for x, y and model half-levels
+! n do loop index
+! nn counter for subset of tracers meeting a particular
+! condition
!-----------------------------------------------------------------------
- used = send_data (id_tref, t_ref, Time, is, js, 1 )
- used = send_data (id_qref, q_ref, Time, is, js, 1 )
- used = send_data (id_bmflag, bmflag, Time, is, js)
- used = send_data (id_klzbs, klzbs, Time, is, js)
- used = send_data (id_invtaubmt, invtaubmt, Time, is, js)
- used = send_data (id_invtaubmq, invtaubmq, Time, is, js)
- used = send_data (id_massflux, massflux, Time, is, js, 1)
- call mpp_clock_end (bm_clock)
- endif ! if ( any((/do_bm, do_bmmass, do_bmomp/)) )
-
-
-!@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
-!
-! C. RELAXED ARAKAWA-SCHUBERT PARAMETERIZATION
-!
-!@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
!-----------------------------------------------------------------------
-! execute relaxed arakawa/schubert cumulus parameterization scheme,
-! if desired.
+! initialize global integrals for netCDF output.
!-----------------------------------------------------------------------
- if (do_ras) then
- call mpp_clock_begin (ras_clock)
-
-!------------------------------------------------------------------------
-! call the wrapper routine for the ras parameterization.
-!------------------------------------------------------------------------
- call moistproc_ras &
- (Time, is, js, dt, Input_mp%coldT, Input_mp%tin, Input_mp%qin,&
- Input_mp%uin, Input_mp%vin, Input_mp%tracer, Input_mp%pfull, &
- Input_mp%phalf, Input_mp%zhalf, Output_mp%tdt, &
- Output_mp%rdt(:,:,:,1), Output_mp%udt, Output_mp%vdt, &
- Output_mp%rdt, Tend_mp%q_tnd, Tend_mp%ttnd, Tend_mp%qtnd, &
- Tend_mp%ttnd_conv, Tend_mp%qtnd_conv, mc, det0, &
- Output_mp%lprec, Output_mp%fprec, rain_ras, snow_ras, &
- rain3d, snow3d, Aerosol, doing_prog_clouds, do_liq_num, &
- num_prog_tracers, Removal_mp_control%tracers_in_ras, &
- Removal_mp_control%num_ras_tracers, &
- do_ice_num, detrain_ice_num)
- call mpp_clock_end (ras_clock)
- else
+ id_pr_g = register_global_diag_field ('pr', Time, 'Precipitation', &
+ 'kg m-2 s-1', standard_name='precipitation_flux', &
+ buffer=.true. )
+ id_prc_g = register_global_diag_field ('prc', Time, &
+ 'Convective Precipitation', 'kg m-2 s-1', &
+ standard_name='convective_precipitation_flux', &
+ buffer=.true. )
+ id_prsn_g = register_global_diag_field ('prsn', Time, &
+ 'Snowfall Flux', 'kg m-2 s-1', &
+ standard_name='snowfall_flux', buffer=.true. )
-!---------------------------------------------------------------------
-! if ras_mod is not activated, set the ras mass flux and precip fields
-! to 0.
-!---------------------------------------------------------------------
- mc = 0.0
- rain_ras = 0.0
- snow_ras = 0.0
- endif ! ( do_ras)
+!-------------------------------------------------------------------------
+! diagnostics related to total convective tendencies of temperature,
+! vapor and precipitation.
+!-------------------------------------------------------------------------
+ id_tdt_conv = register_diag_field ( mod_name, &
+ 'tdt_conv', axes(1:3), Time, &
+ 'Temperature tendency from convection ', 'deg_K/s', &
+ missing_value=missing_value)
-!@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
-!
-! END OF INDIVIDUAL CONVECTIVE SCHEMES
-!
-!@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
+ ID_tntc = register_cmip_diag_field_3d ( mod_name, 'tntc', Time, &
+ 'Tendency of Air Temperature Due to Convection ', &
+ 'K s-1', standard_name= &
+ 'tendency_of_air_temperature_due_to_convection' )
-!---------------------------------------------------------------------
-! now that all potential convection schemes have been processed,
-! calculate cumulus momentum transport, if desired.
-!---------------------------------------------------------------------
- if (do_cmt) then
+ id_qdt_conv = register_diag_field ( mod_name, &
+ 'qdt_conv', axes(1:3), Time, &
+ 'Spec humidity tendency from convection ', 'kg/kg/s', &
+ missing_value=missing_value)
-!----------------------------------------------------------------------
-! activate the cmt clock. initialize the output field (not needed, was
-! done when allocated).
-!----------------------------------------------------------------------
- call mpp_clock_begin (cmt_clock)
+ ID_tnhusc = register_cmip_diag_field_3d ( mod_name, 'tnhusc', Time, &
+ 'Tendency of Specific Humidity Due to Convection ', &
+ 's-1', standard_name= &
+ 'tendency_of_specific_humidity_due_to_convection' )
-!----------------------------------------------------------------------
-! if doing nonlocal cmt, call cu_mo_trans for each convective scheme
-! separately.
-!----------------------------------------------------------------------
- if (.not. doing_diffusive) then
- if (cmt_uses_ras) then
- call moistproc_cmt &
- ( Time, is, js, Input_mp%tin, Input_mp%uin, Input_mp%vin, &
- Input_mp%tracer, Input_mp%pfull, Input_mp%phalf, &
- Input_mp%zfull, Input_mp%zhalf, Input_mp%pmass, &
- Output_mp%tdt, Output_mp%udt, Output_mp%vdt, &
- Output_mp%rdt, Tend_mp%ttnd_conv, dt, mc, det0, &
- Output_mp%diff_cu_mo, num_prog_tracers)
- endif !(cmt_uses_ras)
-
- if (cmt_uses_donner) then
- call moistproc_cmt &
- ( Time, is, js, Input_mp%tin, Input_mp%uin, Input_mp%vin, &
- Input_mp%tracer, Input_mp%pfull, Input_mp%phalf, &
- Input_mp%zfull, Input_mp%zhalf, Input_mp%pmass, &
- Output_mp%tdt, Output_mp%udt, Output_mp%vdt, &
- Output_mp%rdt, Tend_mp%ttnd_conv, dt, m_cellup, &
- M_cdet_donner, Output_mp%diff_cu_mo, num_prog_tracers)
- endif
+ id_q_conv_col = register_diag_field ( mod_name, &
+ 'q_conv_col', axes(1:2), Time, &
+ 'Water vapor path tendency from convection ', &
+ 'kg/m2/s' )
+
+ id_t_conv_col = register_diag_field ( mod_name, &
+ 't_conv_col', axes(1:2), Time, &
+ 'Column static energy tendency from convection ', &
+ 'W/m2' )
+
+ id_enth_conv_col = register_diag_field ( mod_name, &
+ 'enth_conv_col', axes(1:2), Time, &
+ 'Column enthalpy tendency from convection', &
+ 'W/m2' )
+
+ id_wat_conv_col = register_diag_field ( mod_name, &
+ 'wat_conv_col', axes(1:2), Time, &
+ 'Column total water tendency from convection', &
+ 'kg(h2o)/m2/s' )
- if (cmt_uses_uw) then
+ id_prec_conv = register_diag_field ( mod_name, &
+ 'prec_conv', axes(1:2), Time, &
+ 'Precipitation rate from convection ', &
+ 'kg(h2o)/m2/s', interp_method = "conserve_order1" )
-!----------------------------------------------------------------------
-! CURRENTLY no detrained mass flux is provided from uw_conv; should only
-! use with 'diffusive' cmt scheme, not the non-local. (attempt to
-! use non-local will cause FATAL in _init routine.)
-!----------------------------------------------------------------------
- endif
+ id_prc = register_cmip_diag_field_2d ( mod_name, 'prc', Time, &
+ 'Convective Precipitation', 'kg m-2 s-1', &
+ standard_name = 'convective_precipitation_flux', &
+ interp_method = "conserve_order1" )
+
+ id_prrc = register_cmip_diag_field_2d ( mod_name, 'prrc', Time, &
+ 'Convective Rainfall Rate', 'kg m-2 s-1', &
+ standard_name='convective_rainfall_flux', &
+ interp_method="conserve_order1" )
- else ! (we are doing_diffusive)
+ id_snow_conv = register_diag_field ( mod_name, &
+ 'snow_conv', axes(1:2), Time, &
+ 'Frozen precip rate from convection ', &
+ 'kg(h2o)/m2/s', interp_method = "conserve_order1" )
-!-----------------------------------------------------------------------
-! if using diffusive cmt, call cu_mo_trans once with combined mass
-! fluxes from all desired convective schemes.
-!-----------------------------------------------------------------------
- mc_cmt = 0.
- if (cmt_uses_ras) then
- mc_cmt = mc_cmt + mc
- endif
- if (cmt_uses_donner) then
- mc_cmt = mc_cmt + m_cellup
- endif
- if (cmt_uses_uw) then
- do k=2,kx
- mc_cmt(:,:,k) = mc_cmt(:,:,k) + cmf(:,:,k-1)
- end do
- endif
+ id_conv_freq = register_diag_field ( mod_name, &
+ 'conv_freq', axes(1:2), Time, &
+ 'frequency of convection ', '1', &
+ missing_value = missing_value, &
+ interp_method = "conserve_order1" )
- call moistproc_cmt &
- ( Time, is, js, Input_mp%tin, Input_mp%uin, Input_mp%vin, &
- Input_mp%tracer, Input_mp%pfull, Input_mp%phalf, &
- Input_mp%zfull, Input_mp%zhalf, Input_mp%pmass, &
- Output_mp%tdt, Output_mp%udt, Output_mp%vdt, &
- Output_mp%rdt, Tend_mp%ttnd_conv, dt, mc_cmt, det_cmt, &
- Output_mp%diff_cu_mo, num_prog_tracers)
- endif ! (.not. doing_diffusive)
+ id_prsnc = register_cmip_diag_field_2d ( mod_name, 'prsnc', Time, &
+ 'Convective Snowfall Flux', 'kg m-2 s-1', &
+ standard_name='convective_snowfall_flux', &
+ interp_method="conserve_order1" )
- call mpp_clock_end (cmt_clock)
- endif !(do_cmt)
+ id_ci = register_cmip_diag_field_2d ( mod_name, 'ci', Time, &
+ 'Fraction of Time Convection Occurs in Cell', '1.0', &
+ standard_name='convection_time_fraction', &
+ interp_method = "conserve_order1" )
+
+ id_gust_conv = register_diag_field ( mod_name, &
+ 'gust_conv', axes(1:2), Time, &
+ 'Gustiness resulting from convection ', 'm/s' )
+
+ id_conv_rain3d= register_diag_field ( mod_name, &
+ 'conv_rain3d', axes(half), Time, &
+ 'Rain fall rate from convection -3D ', &
+ 'kg(h2o)/m2/s', interp_method = "conserve_order1" )
+
+ id_conv_snow3d= register_diag_field ( mod_name, &
+ 'conv_snow3d', axes(half), Time, &
+ 'Snow fall rate from convection -3D', &
+ 'kg(h2o)/m2/s', interp_method = "conserve_order1" )
+
+!----------------------------------------------------------------------
+! tendencies of cloud tracers resulting from convection.
+!----------------------------------------------------------------------
+ if (doing_prog_clouds ) then
+
+ id_qldt_conv = register_diag_field ( mod_name, &
+ 'qldt_conv', axes(1:3), Time, &
+ 'Liquid water tendency from convection', &
+ 'kg/kg/s', missing_value=missing_value )
+
+ if (do_liq_num) then
+ id_qndt_conv = register_diag_field ( mod_name, &
+ 'qndt_conv', axes(1:3), Time, &
+ 'Liquid drop tendency from convection', &
+ '#/kg/s', missing_value=missing_value)
+ endif
+
+ id_qidt_conv = register_diag_field ( mod_name, &
+ 'qidt_conv', axes(1:3), Time, &
+ 'Ice water tendency from convection', &
+ 'kg/kg/s', missing_value=missing_value )
+
+ id_qadt_conv = register_diag_field ( mod_name, &
+ 'qadt_conv', axes(1:3), Time, &
+ 'Cloud fraction tendency from convection', &
+ '1/sec', missing_value=missing_value )
+
+ id_ql_conv_col = register_diag_field ( mod_name, &
+ 'ql_conv_col', axes(1:2), Time, &
+ 'Liquid water path tendency from convection', &
+ 'kg/m2/s' )
+
+ if (do_liq_num) then
+ id_qn_conv_col = register_diag_field ( mod_name, &
+ 'qn_conv_col', axes(1:2), Time, &
+ 'Liquid drp tendency from convection', &
+ 'kg/m2/s' )
+ endif
+
+ id_qi_conv_col = register_diag_field ( mod_name, &
+ 'qi_conv_col', axes(1:2), Time, &
+ 'Ice water path tendency from convection', &
+ 'kg/m2/s' )
+
+ id_qa_conv_col = register_diag_field ( mod_name, &
+ 'qa_conv_col', axes(1:2), Time, &
+ 'Cloud mass tendency from convection', &
+ 'kg/m2/s' )
+
+ if (do_ice_num) then
+ id_qnidt_conv = register_diag_field ( mod_name, &
+ 'qnidt_conv', axes(1:3), Time, &
+ 'Ice number tendency from convection', &
+ '#/kg/s', missing_value=missing_value )
+
+ id_qni_conv_col = register_diag_field ( mod_name, &
+ 'qni_conv_col', axes(1:2), Time, &
+ 'Ice number tendency from convection', &
+ 'kg/m2/s' )
+ endif
+ endif ! (doing_prog_clouds)
+
+!-----------------------------------------------------------------------
+! diagnostics for cloud base and cloud top.
+!-----------------------------------------------------------------------
+ id_conv_cld_base = register_diag_field ( mod_name, &
+ 'conv_cld_base', axes(1:2), Time, &
+ 'pressure at convective cloud base', &
+ 'Pa', mask_variant = .true., &
+ missing_value=missing_value )
+
+ id_ccb = register_cmip_diag_field_2d ( mod_name, 'ccb', Time, &
+ 'Air Pressure at Convective Cloud Base', 'Pa', &
+ standard_name = &
+ 'air_pressure_at_convective_cloud_base', &
+ mask_variant = .true. )
+
+ id_conv_cld_top = register_diag_field ( mod_name, &
+ 'conv_cld_top', axes(1:2), Time, &
+ 'pressure at convective cloud top', 'Pa', &
+ mask_variant = .true., &
+ missing_value=missing_value )
+
+ id_cct = register_cmip_diag_field_2d ( mod_name, 'cct', Time, &
+ 'Air Pressure at Convective Cloud Top', 'Pa', &
+ standard_name = &
+ 'air_pressure_at_convective_cloud_top', &
+ mask_variant = .true. )
+
+!-----------------------------------------------------------------------
+! convective mass flux diagnostics.
+!-----------------------------------------------------------------------
+ id_mc_full = register_diag_field ( mod_name, &
+ 'mc_full', axes(1:3), Time, &
+ 'Net Mass Flux from convection', 'kg/m2/s', &
+ missing_value=missing_value )
+
+ id_mc_half = register_diag_field ( mod_name, &
+ 'mc_half', axes(half), Time, &
+ 'Net Mass Flux from convection on half levs', &
+ 'kg/m2/s', missing_value=missing_value )
+
+ ID_mc = register_cmip_diag_field_3d ( mod_name, 'mc', Time, &
+ 'Convective Mass Flux', 'kg m-2 s-1', &
+ standard_name= &
+ 'atmosphere_net_upward_convective_mass_flux', &
+ interp_method = "conserve_order1", axis="half" )
+
+ id_mc_conv_up = register_diag_field ( mod_name, &
+ 'mc_conv_up', axes(1:3), Time, &
+ 'Upward Mass Flux from convection', 'kg/m2/s', &
+ missing_value=missing_value )
+
+!---------------------------------------------------------------------
+! register diagnostics for lightning NOx.
+!---------------------------------------------------------------------
+ if (get_tracer_index(MODEL_ATMOS,'no') > 0) then
+ id_prod_no = register_diag_field ( 'tracers', &
+ 'hook_no', axes(1:3), Time, &
+ 'hook_no', 'molec/cm3/s')
+ ID_emilnox_area = register_cmip_diag_field_3d ( mod_name, &
+ 'emilnox_area', Time, &
+ 'Layer-integrated Lightning Production of NOx', 'mol m-2 s-1', &
+ standard_name= &
+ 'tendency_of_atmosphere_moles_of_nox_expressed_as_nitrogen')
+ end if
+
+!-------------------------------------------------------------------------
+! register diagnostics specific to the Betts-Miller experiments.
+!-------------------------------------------------------------------------
+ if ( any((/do_bm, do_bmmass, do_bmomp/)) ) then
+ id_qref = register_diag_field ( mod_name, &
+ 'qref', axes(1:3), Time, &
+ 'Adjustment reference specific humidity profile', &
+ 'kg/kg', missing_value=missing_value)
+
+ id_tref = register_diag_field ( mod_name, &
+ 'tref', axes(1:3), Time, &
+ 'Adjustment reference temperature profile', &
+ 'K', missing_value=missing_value )
+
+ id_bmflag = register_diag_field (mod_name, &
+ 'bmflag', axes(1:2), Time, &
+ 'Betts-Miller flag', &
+ 'no units', missing_value=missing_value)
+
+ id_klzbs = register_diag_field (mod_name, &
+ 'klzbs', axes(1:2), Time, &
+ 'klzb', &
+ 'no units', missing_value=missing_value )
+
+ endif
+
+ if (do_bm ) then
+ id_invtaubmt = register_diag_field (mod_name, &
+ 'invtaubmt', axes(1:2), Time, &
+ 'Inverse temperature relaxation time', &
+ '1/s', missing_value=missing_value )
+
+ id_invtaubmq = register_diag_field (mod_name, &
+ 'invtaubmq', axes(1:2), Time, &
+ 'Inverse humidity relaxation time', &
+ '1/s', missing_value=missing_value )
+ end if
+
+ if (do_bmmass) then
+ id_massflux = register_diag_field (mod_name, &
+ 'massflux', axes(1:3), Time, &
+ 'Massflux implied by temperature adjustment', &
+ 'm/s', missing_value=missing_value )
+ end if
+
+!-------------------------------------------------------------------------
+! register diagnostics associated with CAPE / CIN calculations.
+!-------------------------------------------------------------------------
+ id_cape = register_diag_field ( mod_name, &
+ 'cape', axes(1:2), Time, &
+ 'Convectively available potential energy', 'J/Kg')
+
+ id_cin = register_diag_field ( mod_name, &
+ 'cin', axes(1:2), Time, 'Convective inhibition','J/Kg')
+
+ id_tp = register_diag_field ( mod_name, &
+ 'tp', axes(1:3), Time, 'Temperature of lifted parcel', 'K')
+
+ id_rp = register_diag_field ( mod_name, &
+ 'rp', axes(1:3), Time, 'Humidity of lifted parcel', 'kg/kg')
+
+ id_lcl = register_diag_field ( mod_name, &
+ 'klcl', axes(1:2), Time, 'Index of LCL', 'none')
+
+ id_lfc = register_diag_field ( mod_name, &
+ 'klfc', axes(1:2), Time, 'Index of LFC', 'none')
+
+ id_lzb = register_diag_field ( mod_name, &
+ 'klzb', axes(1:2), Time, 'Index of LZB', 'none')
+
+!------------------------------------------------------------------------
+! register diagnostics specific to the ras parameterization.
+!------------------------------------------------------------------------
+ if (do_ras) then
+ id_ras_precip = register_diag_field ( mod_name, &
+ 'ras_precip', axes(1:2), Time, &
+ 'Precipitation rate from ras ', 'kg/m2/s', &
+ interp_method = "conserve_order1" )
+
+ id_ras_freq = register_diag_field ( mod_name, &
+ 'ras_freq', axes(1:2), Time, &
+ 'frequency of precip from ras ', 'number' , &
+ missing_value = missing_value, &
+ interp_method = "conserve_order1" )
+ endif
+
+!------------------------------------------------------------------------
+! register diagnostics specific to the donner parameterization.
+!------------------------------------------------------------------------
+ if (do_donner_deep) then
+ id_don_precip = register_diag_field ( mod_name, &
+ 'don_precip', axes(1:2), Time, &
+ 'Precipitation rate from donner ', 'kg/m2/s', &
+ interp_method = "conserve_order1")
+
+ id_don_freq = register_diag_field ( mod_name, &
+ 'don_freq', axes(1:2), Time, &
+ 'frequency of precip from donner ', 'number', &
+ missing_value = missing_value, &
+ interp_method = "conserve_order1" )
+
+ id_enth_donner_col2 = &
+ register_diag_field ( mod_name, &
+ 'enth_donner_col2', axes(1:2), Time, &
+ 'column enthalpy tendency from Donner liq&
+ & precip','W/m2' )
+
+ id_enth_donner_col3 = &
+ register_diag_field ( mod_name, &
+ 'enth_donner_col3', axes(1:2), Time, &
+ 'Column enthalpy tendency from Donner &
+ &frzn precip','W/m2' )
+
+ id_enth_donner_col4 = &
+ register_diag_field ( mod_name, &
+ 'enth_donner_col4', axes(1:2), Time, &
+ 'Atmospheric column enthalpy tendency from&
+ & Donner convection', 'W/m2' )
+
+ id_enth_donner_col5 = &
+ register_diag_field ( mod_name, &
+ 'enth_donner_col5', axes(1:2), Time, &
+ 'Column enthalpy tendency due to condensate&
+ & xfer from Donner to lsc','W/m2' )
+
+ id_enth_donner_col6 = &
+ register_diag_field ( mod_name, &
+ 'enth_donner_col6', axes(1:2), Time, &
+ 'Column enthalpy tendency from donner &
+ &moisture conservation adjustment','W/m2' )
+
+ id_enth_donner_col7 = &
+ register_diag_field ( mod_name, &
+ 'enth_donner_col7', axes(1:2), Time, &
+ 'Precip adjustment needed to balance donner&
+ & moisture adjustment','kg(h2o)/m2/s' )
+
+ id_enth_donner_col = &
+ register_diag_field ( mod_name, &
+ 'enth_donner_col', axes(1:2), Time, &
+ 'Column enthalpy imbalance from Donner &
+ &convection','W/m2' )
+
+ id_wat_donner_col = &
+ register_diag_field ( mod_name, &
+ 'wat_donner_col', axes(1:2), Time, &
+ 'Column total water tendency from Donner&
+ & convection','kg(h2o)/m2/s' )
+
+ id_enth_mca_donner_col = &
+ register_diag_field ( mod_name, &
+ 'enth_mca_donner_col', axes(1:2), Time, &
+ 'Column enthalpy imbalance from Donner&
+ & MCA convection','W/m2' )
+
+ id_wat_mca_donner_col = &
+ register_diag_field ( mod_name, &
+ 'wat_mca_donner_col', axes(1:2), Time, &
+ 'Column total water imbalance from Donner&
+ & MCA convection', 'kg(h2o)/m2/s' )
+
+ id_scale_donner = &
+ register_diag_field ( mod_name, &
+ 'scale_donner', axes(1:2), Time, &
+ 'Scaling factor applied to donner convection&
+ & tendencies','1' )
+
+ id_scale_donner_REV = &
+ register_diag_field ( mod_name, &
+ 'scale_donner_REV', axes(1:2), Time, &
+ ' Revised scaling factor for donner convection&
+ & tendencies','1' )
+
+ id_tdt_deep_donner= &
+ register_diag_field ( mod_name, &
+ 'tdt_deep_donner', axes(1:3), Time, &
+ ' heating rate - deep portion', &
+ 'deg K/s', missing_value=missing_value )
+
+ id_qdt_deep_donner = &
+ register_diag_field ( mod_name, &
+ 'qdt_deep_donner', axes(1:3), Time, &
+ ' moistening rate - deep portion', 'kg/kg/s',&
+ missing_value=missing_value )
+
+ id_qadt_deep_donner = &
+ register_diag_field ( mod_name, &
+ 'qadt_deep_donner', axes(1:3), Time, &
+ ' cloud amount tendency - deep portion', &
+ '1/s', missing_value=missing_value )
+
+ id_qldt_deep_donner = &
+ register_diag_field ( mod_name, &
+ 'qldt_deep_donner', axes(1:3), Time, &
+ ' cloud liquid tendency - deep portion', &
+ 'kg/kg/s', missing_value=missing_value)
+
+ id_qidt_deep_donner = &
+ register_diag_field ( mod_name, &
+ 'qidt_deep_donner', axes(1:3), Time, &
+ ' ice water tendency - deep portion', &
+ 'kg/kg/s', missing_value=missing_value)
+ if (do_liq_num) &
+ id_qndt_deep_donner = &
+ register_diag_field ( mod_name, &
+ 'qndt_deep_donner', axes(1:3), Time, &
+ 'deep convection cloud drop tendency', &
+ '#/kg/s', missing_value=missing_value )
+
+ if (do_ice_num) &
+ id_qnidt_deep_donner = &
+ register_diag_field ( mod_name, &
+ 'qnidt_deep_donner', axes(1:3), Time, &
+ ' ice number tendency - deep portion', &
+ '#/kg/s', missing_value=missing_value )
+
+ id_tdt_mca_donner = &
+ register_diag_field ( mod_name, &
+ 'tdt_mca_donner', axes(1:3), Time, &
+ ' heating rate - mca portion', 'deg K/s', &
+ missing_value=missing_value )
+
+ id_qdt_mca_donner = &
+ register_diag_field ( mod_name, &
+ 'qdt_mca_donner', axes(1:3), Time, &
+ ' moistening rate - mca portion', 'kg/kg/s', &
+ missing_value=missing_value )
+
+ id_prec_deep_donner = &
+ register_diag_field ( mod_name, &
+ 'prc_deep_donner', axes(1:2), Time, &
+ ' total precip rate - deep portion', &
+ 'kg/m2/s', missing_value=missing_value, &
+ interp_method = "conserve_order1")
+
+ id_precret_deep_donner = &
+ register_diag_field ( mod_name, &
+ 'prc_ret_deep_donner', axes(1:2), Time, &
+ ' precip_returned - per timestep', &
+ 'kg/m2/timestep', &
+ missing_value=missing_value, &
+ interp_method = "conserve_order1" )
+
+ id_prec1_deep_donner = &
+ register_diag_field ( mod_name, &
+ 'prc1_deep_donner', axes(1:2), Time, &
+ ' change in precip for conservation&
+ & in donner', 'kg/m2/s ', &
+ missing_value=missing_value, &
+ mask_variant = .true., &
+ interp_method = "conserve_order1")
+
+ id_prec_mca_donner = &
+ register_diag_field ( mod_name, &
+ 'prc_mca_donner', axes(1:2), Time, &
+ ' total precip rate - mca portion', &
+ 'kg/m2/s', missing_value=missing_value, &
+ interp_method = "conserve_order1" )
+
+ id_snow_deep_donner = &
+ register_diag_field ( mod_name, &
+ 'snow_deep_donner', axes(1:2), Time, &
+ ' frozen precip rate - deep portion', &
+ 'kg/m2/s', missing_value=missing_value, &
+ interp_method = "conserve_order1" )
+
+ id_snow_mca_donner = &
+ register_diag_field ( mod_name, &
+ 'snow_mca_donner', axes(1:2), Time, &
+ ' frozen precip rate - mca portion', &
+ 'kg/m2/s', missing_value=missing_value, &
+ interp_method = "conserve_order1" )
+
+ id_mc_donner = &
+ register_diag_field ( mod_name, &
+ 'mc_donner', axes(1:3), Time, &
+ 'Net Mass Flux from donner', 'kg/m2/s', &
+ missing_value=missing_value )
+
+ id_mc_donner_half = &
+ register_diag_field ( mod_name, &
+ 'mc_donner_half', axes(half), Time, &
+ 'Net Mass Flux from donner at half levs', &
+ 'kg/m2/s', missing_value=missing_value )
+
+ id_m_cdet_donner = &
+ register_diag_field ( mod_name, &
+ 'm_cdet_donner', axes(1:3), Time, &
+ 'Detrained Cell Mass Flux from donner', &
+ 'kg/m2/s', missing_value=missing_value )
+
+ id_m_cellup = &
+ register_diag_field ( mod_name, &
+ 'm_cellup', axes(half), Time, &
+ 'Upward Cell Mass Flux from donner', 'kg/m2/s', &
+ missing_value=missing_value )
+
+ id_cell_cld_frac = &
+ register_diag_field ( mod_name, &
+ 'cell_cld_frac', axes(1:3), Time, &
+ 'cell cloud fraction from donner', '', &
+ missing_value=missing_value )
+
+ id_meso_cld_frac = &
+ register_diag_field ( mod_name, &
+ 'meso_cld_frac', axes(1:3), Time, &
+ 'meso-scale cloud fraction from donner', '', &
+ missing_value=missing_value )
+
+ id_donner_humidity_area = &
+ register_diag_field ( mod_name, &
+ 'donner_humidity_area', axes(1:3), Time,&
+ 'donner humidity area', '', &
+ missing_value=missing_value )
+
+ if (do_donner_conservation_checks) then
+
+ id_enthint = &
+ register_diag_field (mod_name, 'enthint_don', axes(1:2), &
+ Time, 'atmospheric column enthalpy change from donner', &
+ 'W/m2', missing_value=missing_value)
+
+ id_lcondensint = &
+ register_diag_field &
+ (mod_name, 'lcondensint_don', axes(1:2), Time, &
+ 'enthalpy transferred by condensate from &
+ &donner to lscale', 'W/m2', &
+ missing_value=missing_value)
+
+ id_lprcp = &
+ register_diag_field &
+ (mod_name, 'lprcpint_don', axes(1:2), Time, &
+ 'enthalpy removed by donner precip', 'W/m2', &
+ missing_value=missing_value)
+
+ id_vertmotion = &
+ register_diag_field &
+ (mod_name, 'vertmotion_don', axes(1:2), Time, &
+ 'enthalpy change due to cell and meso motion &
+ &in donner', 'W/m2', &
+ missing_value=missing_value)
+
+ id_enthdiffint = &
+ register_diag_field &
+ (mod_name, 'enthdiffint_don', axes(1:2), &
+ Time, 'enthalpy imbalance due to donner', &
+ 'W/m2', missing_value=missing_value)
+
+ id_vaporint = &
+ register_diag_field &
+ (mod_name, 'vaporint_don', axes(1:2), &
+ Time, 'column water vapor change', &
+ 'kg(h2o)/m2/s', &
+ missing_value=missing_value)
+
+ id_max_enthalpy_imbal_don = &
+ register_diag_field &
+ (mod_name, 'max_enth_imbal_don', axes(1:2),&
+ Time, 'max enthalpy imbalance from donner', &
+ 'W/m**2', missing_value=missing_value)
+
+ id_max_water_imbal_don = &
+ register_diag_field &
+ (mod_name, 'max_water_imbal_don', &
+ axes(1:2), Time, 'max water imbalance&
+ & from donner', 'kg(h2o)/m2/s', &
+ missing_value=missing_value)
+
+ id_condensint = &
+ register_diag_field &
+ (mod_name, 'condensint_don', axes(1:2), Time, &
+ 'column condensate exported from donner&
+ & to lscale', 'kg(h2o)/m2/s', &
+ missing_value=missing_value )
+
+ id_precipint = &
+ register_diag_field &
+ (mod_name, 'precipint_don', axes(1:2), &
+ Time, 'column precip from donner', &
+ 'kg(h2o)/m2/s', missing_value=missing_value)
+
+ id_diffint= &
+ register_diag_field &
+ (mod_name, 'diffint_don', axes(1:2), &
+ Time, 'water imbalance due to donner', &
+ 'kg(h2o)/m2/s', missing_value=missing_value)
+
+ endif
+ endif
+
+!------------------------------------------------------------------------
+! register diagnostics specific to the uw parameterization.
+!------------------------------------------------------------------------
+ if (do_uw_conv) then
+ id_uw_precip = register_diag_field ( mod_name, &
+ 'uw_precip', axes(1:2), Time, &
+ 'Precipitation rate from uw shallow', 'kg/m2/s', &
+ interp_method = "conserve_order1" )
+
+ id_uw_snow = register_diag_field ( mod_name, &
+ 'uw_snow', axes(1:2), Time, &
+ 'Snow rate from uw shallow', 'kg/m2/s' , &
+ interp_method = "conserve_order1" )
+
+ id_uw_freq = register_diag_field ( mod_name, &
+ 'uw_freq', axes(1:2), Time, &
+ 'frequency of precip from uw shallow ', 'number' , &
+ missing_value = missing_value, &
+ interp_method = "conserve_order1" )
+
+ id_enth_uw_col = register_diag_field ( mod_name, &
+ 'enth_uw_col', axes(1:2), Time, &
+ 'Column enthalpy tendency from UW convection', &
+ 'W/m2' )
+
+ id_wat_uw_col = register_diag_field ( mod_name, &
+ 'wat_uw_col', axes(1:2), Time, &
+ 'Column total water tendency from UW convection',&
+ 'kg(h2o)/m2/s' )
+
+ id_scale_uw = register_diag_field ( mod_name, &
+ 'scale_uw', axes(1:2), Time, &
+ 'Scaling factor applied to UW convection&
+ & tendencies','1' )
+
+ id_tdt_uw = register_diag_field ( mod_name, &
+ 'tdt_uw', axes(1:3), Time, &
+ 'UW convection heating rate', 'deg K/s', &
+ missing_value=missing_value )
+
+ id_qdt_uw = register_diag_field ( mod_name, &
+ 'qdt_uw', axes(1:3), Time, &
+ 'UW convection moistening rate', 'kg/kg/s', &
+ missing_value=missing_value )
+
+ id_qadt_uw = register_diag_field ( mod_name, &
+ 'qadt_uw', axes(1:3), Time, &
+ 'UW convection cloud amount tendency', '1/s', &
+ missing_value=missing_value )
+
+ id_qldt_uw = register_diag_field ( mod_name, &
+ 'qldt_uw', axes(1:3), Time, &
+ 'UW convection cloud liquid tendency', 'kg/kg/s', &
+ missing_value=missing_value )
+
+ id_qidt_uw = register_diag_field ( mod_name, &
+ 'qidt_uw', axes(1:3), Time, &
+ 'UW convection ice water tendency', 'kg/kg/s', &
+ missing_value=missing_value )
+
+ if (do_liq_num) &
+ id_qndt_uw = register_diag_field ( mod_name, &
+ 'qndt_uw', axes(1:3), Time, &
+ 'UW convection cloud drop tendency', '#/kg/s', &
+ missing_value=missing_value )
+
+ if (do_ice_num) &
+ id_qnidt_uw = register_diag_field ( mod_name, &
+ 'qnidt_uw', axes(1:3), Time, &
+ 'UW convection ice number tendency', '#/kg/s', &
+ missing_value=missing_value )
+
+ endif
+
+!----------------------------------------------------------------------
+! dry adjustment diagnostic.
+!----------------------------------------------------------------------
+ if (do_dryadj) then
+ id_tdt_dadj = register_diag_field ( mod_name, &
+ 'tdt_dadj', axes(1:3), Time, &
+ 'Temperature tendency from dry conv adj', 'deg_K/s', &
+ missing_value=missing_value )
+ endif
+
+!---------------------------------------------------------------------
+! allocate and initialize arrays to hold the diagnostic ids for each
+! active tracer. diagnostics for tendency due to convection,
+! column tendency due to convection, the tracer amount and tracer
+! column amount are available.
+!---------------------------------------------------------------------
+ allocate (id_tracerdt_conv (num_prog_tracers))
+ allocate (id_tracerdt_conv_col (num_prog_tracers))
+ allocate (id_conv_tracer (num_prog_tracers))
+ allocate (id_conv_tracer_col (num_prog_tracers))
+
+ id_tracerdt_conv = NO_TRACER
+ id_tracerdt_conv_col = NO_TRACER
+ id_conv_tracer = NO_TRACER
+ id_conv_tracer_col = NO_TRACER
+
+!------------------------------------------------------------------------
+! define the diagnostics names that are requested and register the
+! diagnostics for those tracers that were specified to be affected
+! by a convection scheme.
+!------------------------------------------------------------------------
+ do n = 1,num_prog_tracers
+ call get_tracer_names (MODEL_ATMOS, n, name = tracer_name, &
+ units = tracer_units)
+ if (Control%tracers_in_donner(n) .or. &
+ Control%tracers_in_ras(n) .or. &
+ Control%tracers_in_mca(n) .or. &
+ Control%tracers_in_uw(n)) then
+ diaglname = trim(tracer_name)// &
+ ' total tendency from moist convection'
+ id_tracerdt_conv(n) = &
+ register_diag_field ( mod_name, &
+ TRIM(tracer_name)//'dt_conv', &
+ axes(1:3), Time, trim(diaglname), &
+ TRIM(tracer_units)//'/s', &
+ missing_value=missing_value)
+
+ diaglname = trim(tracer_name)// &
+ ' total path tendency from moist convection'
+ id_tracerdt_conv_col(n) = &
+ register_diag_field ( mod_name, &
+ TRIM(tracer_name)//'dt_conv_col', &
+ axes(1:2), Time, trim(diaglname), &
+ TRIM(tracer_units)//'*(kg/m2)/s', &
+ missing_value=missing_value)
+ endif
+
+!----------------------------------------------------------------------
+! output the distribution and column values of any tracer for which
+! they are requested, even if not transported by convection.
+!----------------------------------------------------------------------
+ diaglname = trim(tracer_name)
+
+!---------------------------------------------------------------------
+! RSH:
+! temporary get-around for the fact that 'cl' may be both a tracer
+! variable (full chemistry) and a CMIP6 cloud diagnostic variable
+! in module 'moist', and so they need to be registered differently.
+! In the future, all the tracers should be registered under mod_name2,
+! after existing scripts / experiments are replaced.
+!---------------------------------------------------------------------
+ if (trim(diaglname) == 'cl') then
+ id_conv_tracer(n) = &
+ register_diag_field ( mod_name2, &
+ TRIM(tracer_name), &
+ axes(1:3), Time, trim(diaglname), &
+ TRIM(tracer_units) , &
+ missing_value=missing_value)
+ else
+ id_conv_tracer(n) = &
+ register_diag_field ( mod_name, &
+ TRIM(tracer_name), &
+ axes(1:3), Time, trim(diaglname), &
+ TRIM(tracer_units) , &
+ missing_value=missing_value)
+ endif
+ diaglname = ' column integrated' // trim(tracer_name)
+ id_conv_tracer_col(n) = &
+ register_diag_field ( mod_name, &
+ TRIM(tracer_name)//'_col', &
+ axes(1:2), Time, trim(diaglname), &
+ TRIM(tracer_units) , &
+ missing_value=missing_value)
+ end do
+
+!------------------------------------------------------------------
+! register the diagnostics which will report the tendencies due to
+! mca component of donner convection.
+!------------------------------------------------------------------
+ if (do_donner_mca) then
+ allocate (id_tracerdt_mcadon (Control%num_donner_tracers))
+ allocate (id_tracerdt_mcadon_col(Control%num_donner_tracers))
+
+ nn = 1
+ do n = 1,num_prog_tracers
+ call get_tracer_names (MODEL_ATMOS, n, name = tracer_name, &
+ units = tracer_units)
+ if (Control%tracers_in_donner(n) ) then
+ diaglname = trim(tracer_name)// &
+ ' tendency from donner-mca'
+ id_tracerdt_mcadon(nn) = &
+ register_diag_field ( mod_name, &
+ TRIM(tracer_name)//'_donmca', &
+ axes(1:3), Time, trim(diaglname), &
+ TRIM(tracer_units)//'/s', &
+ missing_value=missing_value)
+
+ diaglname = trim(tracer_name)// &
+ ' total path tendency from donner-mca'
+ id_tracerdt_mcadon_col(nn) = &
+ register_diag_field ( mod_name, &
+ TRIM(tracer_name)//'_donmca_col', &
+ axes(1:2), Time, trim(diaglname), &
+ TRIM(tracer_units)//'*(kg/m2)/s', &
+ missing_value=missing_value)
+ nn = nn + 1
+ endif
+ end do
+ endif
+
+
+!---------------------------------------------------------------------
+
+
+end subroutine diag_field_init
+
+
+
+
+!*******************************************************************
+!
+! PRIVATE DRIVER-CALLED SUBROUTINES,
+! NON-CONVECTION-SCHEME SPECIFIC
+!
+!*******************************************************************
+
+
+!#######################################################################
+
+subroutine convection_driver_alloc (ix, jx, kx, Conv_results)
+
+!---------------------------------------------------------------------
+! subroutine convection_driver_alloc allocates and initializes
+! variables that are calculated in this module and transferred
+! between convective parameterizations and / or to the diagnostics
+! routine for output.
+!---------------------------------------------------------------------
+
+integer, intent(in) :: ix, jx, kx
+type(conv_results_type), intent(inout) :: Conv_results
+
+!--------------------------------------------------------------------
+! ix, jx, kx dimensions of physics window
+! Conv_results conv_results_type variable containing local
+! variables used in multiple convective
+! parameterizations and for diagnostic output
+!--------------------------------------------------------------------
+
+!--------------------------------------------------------------------
+! allocate and initialize arrays which transfer data between individual
+! parameterizations within an implementation.
+!--------------------------------------------------------------------
+
+ allocate (Conv_results%conv_calc_completed (ix, jx))
+ allocate (Conv_results%available_cf_for_uw (ix, jx, kx))
+ Conv_results%conv_calc_completed = .false.
+ Conv_results%available_cf_for_uw = 1.0
+
+!------------------------------------------------------------------------
+! allocate and initialize the massflux-related components of the
+! conv_results_type variable Conv_results.
+!------------------------------------------------------------------------
+ allocate (Conv_results%ras_mflux(ix, jx, kx+1)) ! old variable mc
+ allocate (Conv_results%ras_det_mflux(ix, jx, kx)) ! old variable det0
+ if (do_donner_deep) then
+ allocate (Conv_results%donner_mflux(ix, jx, kx+1)) ! m_cellup
+ allocate (Conv_results%donner_det_mflux(ix, jx, kx)) !m_cdet_donner
+ endif
+ allocate (Conv_results%uw_mflux(ix, jx, kx+1)) ! cmf
+ Conv_results%ras_mflux = 0.
+ Conv_results%ras_det_mflux = 0.
+ if (do_donner_deep) then
+ Conv_results%donner_mflux = 0.
+ Conv_results%donner_det_mflux = 0.
+ endif
+ Conv_results%uw_mflux = 0.
+
+ allocate (Conv_results%mc_donner (ix, jx, kx))
+ allocate (Conv_results%mc_donner_up (ix, jx, kx))
+ allocate (Conv_results%mc_donner_half (ix, jx, kx+1))
+ Conv_results%mc_donner = 0.
+ Conv_results%mc_donner_up = 0.
+ Conv_results%mc_donner_half = 0.
+
+!------------------------------------------------------------------------
+! allocate the components of the conv_results_type variable Conv_results
+! which depend on the results of the convective implementation, not each
+! convective parameterization included within it.
+!------------------------------------------------------------------------
+ allocate (Conv_results%cldtop (ix, jx))
+ allocate (Conv_results%cldbot (ix, jx))
+ allocate (Conv_results%prod_no (ix, jx, kx))
+ Conv_results%cldtop = 0
+ Conv_results%cldbot = 0
+ Conv_results%prod_no = 0.
+
+!----------------------------------------------------------------------
+
+
+end subroutine convection_driver_alloc
+
+
+
+!######################################################################
+
+subroutine define_total_convective_output &
+ (is, js, nt, C2ls_mp, Conv_results, Input_mp, Output_mp, &
+ Phys_mp_exch)
+
+!----------------------------------------------------------------------
+! subroutine define_total_convective_output: a) defines total cloud
+! mass flux, b) defines cloud base and cloud top, c) defines lightning
+! source of nox, d) defines convective gustiness, e) sets flag
+! indicating columns with convection, f) updates the Input_mp%tracer
+! field with the changes produced in this module, and g) updates the
+! tin and rdt fields with the uw tendencies if they have not already
+! been so updated. Updating fields at this point only occurs when
+! legacy warsaw results are desired; otherwise the updates would have
+! been done at the more appropriate earlier time in the integration.
+!----------------------------------------------------------------------
+
+!-----------------------------------------------------------------------
+integer, intent(in) :: is, js, nt
+type(mp_conv2ls_type), intent(inout) :: C2ls_mp
+type(conv_results_type), intent(inout) :: Conv_results
+type(mp_input_type), intent(inout) :: Input_mp
+type(mp_output_type), intent(inout) :: Output_mp
+type(phys_mp_exch_type), intent(inout) :: Phys_mp_exch
+!-----------------------------------------------------------------------
+
+!----------------------------------------------------------------------
+! is, js starting i,j physics window indices
+! nt number of prognostic tracers
+! C2ls_mp derived type used to transfer data from
+! convection_driver to lscloud_driver via moist_processes.
+! Conv_results
+! conv_results_type variable containing local variables
+! used in multiple convective parameterizations and for
+! diagnostic output
+! Input_mp derived type used to transfer needed input data between
+! moist_processes and convection_driver
+! Output_mp derived type used to transfer output fields between
+! convection_driver and moist_processes
+! Phys_mp_exch
+! derived type used to transfer data between physics_driver
+! and convection_driver via moist_processes
+!----------------------------------------------------------------------
+
+ real, parameter :: boltz = 1.38044e-16
+ integer :: i, j, k, n
+ integer :: ix, jx, kx
+
+!---------------------------------------------------------------------
+! boltz boltzmann constant
+! i, j, k, n do-loop indices
+! ix, jx, kx physics window dimensions
+!---------------------------------------------------------------------
+
+!------------------------------------------------------------------------
+! define array dimensions.
+!------------------------------------------------------------------------
+ ix = size(Input_mp%tin,1)
+ jx = size(Input_mp%tin,2)
+ kx = size (Input_mp%t, 3)
+
+!------------------------------------------------------------------------
+! define total convective mass flux from all sources, at both full
+! levels and at half levels.
+!------------------------------------------------------------------------
+ C2ls_mp%mc_full(:,:,1)=0.;
+ C2ls_mp%mc_half(:,:,1)=0.;
+ do k=2,kx
+ C2ls_mp%mc_full(:,:,k) = 0.5*(Conv_results%ras_mflux(:,:,k) + &
+ Conv_results%ras_mflux(:,:,k+1)) + &
+ 0.5*(Conv_results%uw_mflux(:,:,k)+ &
+ Conv_results%uw_mflux(:,:,k-1)) + &
+ Conv_results%mc_donner(:,:,k)
+ end do
+ do k=2,kx+1
+ C2ls_mp%mc_half(:,:,k) = Conv_results%ras_mflux(:,:,k) + &
+ Conv_results%uw_mflux(:,:,k-1)+ &
+ Conv_results%mc_donner_half(:,:,k)
+ end do
+
+!------------------------------------------------------------------------
+! define convective cloud base and cloud top. these are needed if
+! diagnostics defining the temporal and spatial location of convection
+! are desired or if tracer "no" is present, so that the nox tendency
+! due to lightning may be calculated.
+!------------------------------------------------------------------------
+ if (get_tracer_index(MODEL_ATMOS,'no') .ne. NO_TRACER &
+ .or. id_conv_freq > 0 &
+ .or. id_ci > 0 &
+ .or. id_conv_cld_base > 0 &
+ .or. id_ccb > 0 &
+ .or. id_cct > 0 &
+ .or. id_conv_cld_top > 0 ) then
+
+ do j=1,jx
+ do i=1,ix
+ do k=1,kx
+ if (C2ls_mp%mc_full(i,j,k) /= 0.0 ) then
+ Conv_results%cldtop(i,j) = k
+ exit
+ endif
+ enddo
+ do k = size(Input_mp%r,3),1,-1
+ if (C2ls_mp%mc_full(i,j,k) /= 0.0 ) then
+ Conv_results%cldbot(i,j) = k
+ exit
+ endif
+ enddo
+ enddo
+ enddo
+ end if
+
+!-----------------------------------------------------------------------
+! calculate NOx tendency from lightning and add it to the tendency
+! field.
+!-----------------------------------------------------------------------
+ if ( get_tracer_index(MODEL_ATMOS,'no') .ne. NO_TRACER ) then
+ call moz_hook &
+ (Conv_results%cldtop, Conv_results%cldbot, Input_mp%land, &
+ Input_mp%zfull, Input_mp%zhalf, Input_mp%t, &
+ Conv_results%prod_no, Input_mp%area, Input_mp%lat, &
+ Time, is, js)
+
+ Output_mp%rdt(:,:,:,get_tracer_index(MODEL_ATMOS,'no')) = &
+ Output_mp%rdt(:,:,:,get_tracer_index(MODEL_ATMOS,'no')) + &
+ Conv_results%prod_no*((boltz*Input_mp%t)/ &
+ (10. * Input_mp%pfull))
+ endif
+
+!-----------------------------------------------------------------------
+! calculate convective gustiness, if desired. two forms are available.
+!-----------------------------------------------------------------------
+ if (do_gust_cv) then
+ where((Output_mp%precip) > 0.0)
+ Output_mp%gust_cv = gustmax* &
+ sqrt(Output_mp%precip/(gustconst + Output_mp%precip))
+ end where
+ end if
+
+ if (do_gust_cv_new) then
+ Output_mp%gust_cv = sqrt(Phys_mp_exch%cgust)
+ end if
+
+!---------------------------------------------------------------------
+! save a field indicating whether or not convection has occurred
+! within the column.
+!---------------------------------------------------------------------
+ where (Output_mp%precip > 0.) Output_mp%convect = .true.
+
+!------------------------------------------------------------------------
+! update the current temp and rdt tendencies with the contributions
+! obtained from uw transport (tin_tentative, rdt_tentative), if
+! reproduce_AM4 was set true. otherwise these fields have
+! already been updated, and the _tentative fields contain 0.0.
+!------------------------------------------------------------------------
+ Input_mp%tin = Input_mp%tin + Input_mp%tin_tentative
+ Output_mp%rdt = Output_mp%rdt + Output_mp%rdt_tentative
+
+!---------------------------------------------------------------------
+! update the input tracer arrays with the tendencies obtained in this
+! module.
+!---------------------------------------------------------------------
+ do n=1,nt
+ if (.not. cloud_tracer(n)) then
+ Input_mp%tracer(:,:,:,n) = Input_mp%tracer_orig(:,:,:,n) + &
+ (Output_mp%rdt(:,:,:,n) - Output_mp%rdt_init(:,:,:,n))*dt
+ endif
+ end do
+
+!------------------------------------------------------------------------
+
+
+end subroutine define_total_convective_output
+
+
+
+!######################################################################
+
+subroutine convective_diagnostics &
+ (is, js, C2ls_mp, Conv_results, Input_mp, Tend_mp, Output_mp)
+
+!-----------------------------------------------------------------------
+! subroutine convective_diagnostics outputs requested convective
+! diagnostics associated with the convective implementation rather than
+! any specific convective parameterization.
+!-----------------------------------------------------------------------
+
+integer, intent(in) :: is, js
+type(mp_conv2ls_type), intent(inout) :: C2ls_mp
+type(conv_results_type), intent(inout) :: Conv_results
+type(mp_input_type), intent(inout) :: Input_mp
+type(mp_tendency_type), intent(inout) :: Tend_mp
+type(mp_output_type), intent(in) :: Output_mp
+
+!--------------------------------------------------------------------
+! is, js starting i,j physics window indices
+! C2ls_mp derived type used to transfer data from convection_driver
+! to lscloud_driver via moist_processes.
+! Conv_results
+! conv_results_type variable containing local variables
+! used in multiple convective parameterizations and for
+! diagnostic output
+! Input_mp derived type used to transfer needed input data between
+! moist_processes and convection_driver
+! Tend_mp derived type used to transfer calculated tendency data
+! between convection_driver and moist_processes
+! Output_mp derived type used to transfer output fields between
+! convection_driver and moist_processes
+!--------------------------------------------------------------------
+
+ real, dimension(size(Input_mp%t,1),size(Input_mp%t,2)) :: &
+ temp_2d, freq_count
+ logical, dimension(size(Input_mp%t,1),size(Input_mp%t,2)) :: &
+ ltemp
+ real, dimension(size(Input_mp%t,1),size(Input_mp%t,2), &
+ size(Input_mp%t,3)) :: &
+ temp_3d1, temp_3d2, uw_massflx_full
+ integer :: i,j,k, n
+ integer :: ix, jx, kx
+ logical :: used
+
+!--------------------------------------------------------------------
+! temp_2d array used to hold diagnostic fields when
+! they are sent for output
+! freq_count array used to hold diagnostic field when sent
+! for output
+! ltemp logical used to define condition needed for
+! several diagnostics
+! temp_3d1 temporary array used in computing diagnostics
+! temp_3d2 temporary array used in computing diagnostics
+! uw_massflx_full uw massflux on full levels [ kg/m2/s ]
+! i, j, k, n do loop indices
+! ix, jx, kx array spatial dimensions, size of physics window
+! used logical used to indicate data has been received
+! by diag_manager_mod
+!--------------------------------------------------------------------
+
+!-------------------------------------------------------------------
+! define array dimensions.
+!-------------------------------------------------------------------
+ ix = size(Input_mp%r,1)
+ jx = size(Input_mp%r,2)
+ kx = size(Input_mp%r,3)
+
+!-----------------------------------------------------------------------
+! output the NOx tendency from lightning.
+!-----------------------------------------------------------------------
+ if ( get_tracer_index(MODEL_ATMOS,'no') .ne. NO_TRACER ) then
+ used = send_data(id_prod_no, Conv_results%prod_no, Time, is, js)
+ used = send_cmip_data_3d (ID_emilnox_area, & ! convert molec/cm3/s to mol/m2/s
+ Conv_results%prod_no*1.e6*(Input_mp%zhalf(:,:,1:kx)-Input_mp%zhalf(:,:,2:kx+1))/AVOGNO, &
+ Time, is, js, 1, phalf=log(Input_mp%phalf))
+ endif
+
+!----------------------------------------------------------------------
+! output any requested convectively-transported tracer fields
+! and / or their column sums before convective transport.
+!----------------------------------------------------------------------
+ do n=1, num_prog_tracers
+ used = send_data (id_conv_tracer(n), &
+ Input_mp%tracer_orig(:,:,:,n), Time, is, js, 1)
+ if (id_conv_tracer_col(n) > 0) &
+ call column_diag(id_conv_tracer_col(n), is, js, Time, &
+ Input_mp%tracer_orig(:,:,:,n), 1.0, Input_mp%pmass)
+ end do
+
+!---------------------------------------------------------------------
+! output diagnostics:
+! total cumulus mass flux on full levels,
+! total cumulus mass flux on half levels,
+! total cumulus mass flux on half levels (CMOR standard).
+!---------------------------------------------------------------------
+ used = send_data (id_mc_full, C2ls_mp%mc_full, Time, is, js, 1)
+ used = send_data (id_mc_half, C2ls_mp%mc_half, Time, is, js, 1)
+ used = send_cmip_data_3d (ID_mc, C2ls_mp%mc_half, Time, is, js, 1)
+
+!---------------------------------------------------------------------
+! total convective updraft mass flux (uw + donner cell up +
+! donner meso up) on full levels.
+!---------------------------------------------------------------------
+ if (id_mc_conv_up > 0 ) then
+ do k=1,kx
+ uw_massflx_full(:,:,k) = 0.5*(Conv_results%uw_mflux(:,:,k) + &
+ Conv_results%uw_mflux(:,:,k+1))
+ end do
+ used = send_data (id_mc_conv_up, uw_massflx_full(:,:,:) + &
+ Conv_results%mc_donner_up(:,:,:), Time, is, js, 1 )
+ endif
+
+!------------------------------------------------------------------------
+! output diagnostics related to convective cloud base and cloud top.
+! both FMS-standard and CMOR-standard output variables are currently
+! present.
+!------------------------------------------------------------------------
+ if ( id_conv_cld_base > 0 ) then
+ temp_2d = missing_value
+ do j = 1,jx
+ do i = 1,ix
+ if ( Conv_results%cldbot(i,j) > 0 ) temp_2d(i,j) = &
+ Input_mp%pfull(i,j,Conv_results%cldbot(i,j))
+ end do
+ end do
+ used = send_data(id_conv_cld_base, temp_2d, Time, is_in=is, &
+ js_in=js, mask = Conv_results%cldbot > 0)
+ end if
+
+ if ( id_ccb > 0 ) then
+ temp_2d = CMOR_MISSING_VALUE
+ do j = 1,jx
+ do i = 1,ix
+ if ( Conv_results%cldbot(i,j) > 0 ) temp_2d(i,j) = &
+ Input_mp%pfull(i,j,Conv_results%cldbot(i,j))
+ end do
+ end do
+ used = send_data(id_ccb, temp_2d, Time, is_in=is, &
+ js_in=js, mask = Conv_results%cldbot > 0)
+ end if
+
+ if ( id_conv_cld_top > 0 ) then
+ temp_2d = missing_value
+ do j = 1,jx
+ do i = 1,ix
+ if ( Conv_results%cldtop(i,j) > 0 ) temp_2d(i,j) = &
+ Input_mp%pfull(i,j,Conv_results%cldtop(i,j))
+ end do
+ end do
+ used = send_data(id_conv_cld_top, temp_2d, Time, is_in=is, &
+ js_in=js, mask = Conv_results%cldtop > 0)
+ end if
+
+ if ( id_cct > 0 ) then
+ temp_2d = CMOR_MISSING_VALUE
+ do j = 1,jx
+ do i = 1,ix
+ if ( Conv_results%cldtop(i,j) > 0 ) temp_2d(i,j) = &
+ Input_mp%pfull(i,j,Conv_results%cldtop(i,j))
+ end do
+ end do
+ used = send_data(id_cct, temp_2d, Time, is_in=is, &
+ js_in=js, mask = Conv_results%cldtop > 0)
+ end if
+
+
+!---------------------------------------------------------------------
+! temperature change due to dry and moist convection:
+!---------------------------------------------------------------------
+ used = send_data (id_tdt_conv, Tend_mp%ttnd_conv, Time, is, js, 1)
+ if (query_cmip_diag_id(ID_tntc)) then
+ used = send_cmip_data_3d (ID_tntc, Tend_mp%ttnd_conv, Time, is, &
+ js,1, phalf=log(Input_mp%phalf))
+ endif
+
+!---------------------------------------------------------------------
+! vapor specific humidity change due to convection:
+!---------------------------------------------------------------------
+ used = send_data (id_qdt_conv, Tend_mp%qtnd_conv, Time, is, js, 1)
+ if (query_cmip_diag_id(ID_tnhusc)) then
+ used = send_cmip_data_3d (ID_tnhusc, Tend_mp%qtnd_conv, Time, &
+ is, js, 1, phalf=log(Input_mp%phalf))
+ endif
+
+!---------------------------------------------------------------------
+! total precipitation due to convection (both FMS and CMOR standards):
+!---------------------------------------------------------------------
+ used = send_data (id_prec_conv, Output_mp%precip, Time, is, js)
+ used = send_data (id_prc, Output_mp%precip, Time, is, js)
+ if (id_prc_g > 0) call buffer_global_diag &
+ (id_prc_g, Output_mp%precip(:,:), Time, is, js)
+
+!---------------------------------------------------------------------
+! frozen precipitation (snow) due to convection:
+!---------------------------------------------------------------------
+ used = send_data (id_snow_conv, Output_mp%fprec, Time, is, js)
+ used = send_data (id_prsnc, Output_mp%fprec, Time, is, js)
+!---------------------------------------------------------------------
+! liquid precipitation (rain) due to convection:
+!---------------------------------------------------------------------
+ used = send_data (id_prrc, Output_mp%lprec, Time, is, js)
+
+!---------------------------------------------------------------------
+! convective frequency (both FMS and CMOR standards).
+!---------------------------------------------------------------------
+ if (id_conv_freq > 0 .or. id_ci > 0) then
+ ltemp = Output_mp%precip > 0. .or. Conv_results%cldtop > 0
+ where (ltemp)
+ freq_count = 1.
+ elsewhere
+ freq_count = 0.
+ end where
+ if (id_conv_freq > 0) &
+ used = send_data (id_conv_freq, freq_count, Time, is, js )
+ if (id_ci > 0) &
+ used = send_data (id_ci, freq_count, Time, is, js )
+ endif
+
+!---------------------------------------------------------------------
+! surface wind gustiness due to convection:
+!---------------------------------------------------------------------
+ used = send_data (id_gust_conv, Output_mp%gust_cv, Time, is, js)
+
+!---------------------------------------------------------------------
+! water vapor path tendency due to convection:
+!---------------------------------------------------------------------
+ if (id_q_conv_col > 0) &
+ call column_diag (id_q_conv_col, is, js, Time, &
+ Tend_mp%qtnd_conv, 1.0, Input_mp%pmass)
+
+!---------------------------------------------------------------------
+! dry static energy tendency due to dry and moist convection:
+!---------------------------------------------------------------------
+ if (id_t_conv_col > 0) &
+ call column_diag (id_t_conv_col, is, js, Time, &
+ Tend_mp%ttnd_conv, CP_AIR, Input_mp%pmass)
+
+!---------------------------------------------------------------------
+! define the total prognostic cloud liquid, ice, drop number,
+! ice number and area tendencies due to convection.
+!---------------------------------------------------------------------
+ if (doing_prog_clouds) then
+ Tend_mp%qldt_conv = Output_mp%rdt(:,:,:,nql) - &
+ Output_mp%rdt_init(:,:,:,nql)
+ Tend_mp%qidt_conv = Output_mp%rdt(:,:,:,nqi) - &
+ Output_mp%rdt_init(:,:,:,nqi)
+ if (do_liq_num) Tend_mp%qndt_conv = &
+ Output_mp%rdt(:,:,:,nqn) - &
+ Output_mp%rdt_init(:,:,:,nqn)
+ if (do_ice_num) Tend_mp%qnidt_conv = &
+ Output_mp%rdt(:,:,:,nqni) - &
+ Output_mp%rdt_init(:,:,:,nqni)
+ Tend_mp%qadt_conv = Output_mp%rdt(:,:,:,nqa) - &
+ Output_mp%rdt_init(:,:,:,nqa)
+
+!---------------------------------------------------------------------
+! output diagnostics for cloud liquid tendency and liquid water path
+! tendency due to convection.
+!---------------------------------------------------------------------
+ if (id_qldt_conv > 0 .or. id_ql_conv_col > 0) then
+ used = send_data (id_qldt_conv, Tend_mp%qldt_conv, &
+ Time, is, js, 1)
+ if (id_ql_conv_col > 0) &
+ call column_diag (id_ql_conv_col, is, js, Time, &
+ Tend_mp%qldt_conv, 1.0, Input_mp%pmass)
+
+ endif
+
+!---------------------------------------------------------------------
+! output diagnostics for cloud drop number tendency and cloud drop
+! number path tendency due to convection.
+!---------------------------------------------------------------------
+ if (do_liq_num) then
+ if (id_qndt_conv > 0 .or. id_qn_conv_col > 0) then
+ used = send_data (id_qndt_conv, Tend_mp%qndt_conv, &
+ Time, is, js, 1)
+ if (id_qn_conv_col > 0) &
+ call column_diag (id_qn_conv_col, is, js, Time, &
+ Tend_mp%qndt_conv, 1.0, Input_mp%pmass)
+ endif
+ endif
+
+!---------------------------------------------------------------------
+! output diagnostics for cloud ice tendency and cloud ice water path
+! tendency due to convection.
+!---------------------------------------------------------------------
+ if (id_qidt_conv > 0 .or. id_qi_conv_col > 0) then
+ used = send_data (id_qidt_conv, Tend_mp%qidt_conv, Time, &
+ is, js, 1)
+ if (id_qi_conv_col > 0) &
+ call column_diag (id_qi_conv_col, is, js, Time, &
+ Tend_mp%qidt_conv, 1.0, Input_mp%pmass)
+ endif
+
+
+!---------------------------------------------------------------------
+! output diagnostics for cloud ice number tendency and cloud ice number
+! path tendency due to convection.
+!---------------------------------------------------------------------
+ if (do_ice_num) then
+ if (id_qnidt_conv > 0 .or. id_qni_conv_col > 0) then
+ used = send_data (id_qnidt_conv, Tend_mp%qnidt_conv, &
+ Time, is, js, 1)
+ if (id_qni_conv_col > 0) &
+ call column_diag (id_qni_conv_col, is, js, Time, &
+ Tend_mp%qnidt_conv, 1.0, Input_mp%pmass)
+ endif
+ endif
+
+!---------------------------------------------------------------------
+! output diagnostics for cloud area tendency and column integrated
+! cloud mass tendency due to convection.
+!---------------------------------------------------------------------
+ if (id_qadt_conv > 0 .or. id_qa_conv_col > 0 ) then
+ used = send_data (id_qadt_conv, Tend_mp%qadt_conv, &
+ Time, is, js, 1)
+ if (id_qa_conv_col > 0) &
+ call column_diag (id_qa_conv_col, is, js, Time, &
+ Tend_mp%qadt_conv, 1.0, Input_mp%pmass)
+ endif
+ endif !(doing_prog_clouds)
+
+!---------------------------------------------------------------------
+! compute the column integrated enthalpy and total water tendencies
+! due to convection parameterizations, if those diagnostics are desired.
+!---------------------------------------------------------------------
+ if (id_enth_conv_col > 0 .or. id_wat_conv_col > 0) then
+ temp_3d1 = Output_mp%rdt(:,:,:,nql) - Output_mp%rdt_init(:,:,:,nql)
+ temp_3d2 = Output_mp%rdt(:,:,:,nqi) - Output_mp%rdt_init(:,:,:,nqi)
+
+ if (id_enth_conv_col > 0) then
+ temp_2d = -HLV*Output_mp%precip -HLF*Output_mp%fprec
+ call column_diag &
+ (id_enth_conv_col, is, js, Time, Tend_mp%ttnd_conv, CP_AIR, &
+ temp_3d1, -HLV, temp_3d2, -HLS, Input_mp%pmass, temp_2d)
+ endif
+
+ if (id_wat_conv_col > 0) then
+ temp_2d = Output_mp%precip
+ call column_diag &
+ (id_wat_conv_col, is, js, Time, Tend_mp%qtnd_conv, 1.0, &
+ temp_3d1, 1.0, temp_3d2, 1.0, Input_mp%pmass, temp_2d)
+ endif
+ endif
+
+
+!---------------------------------------------------------------------
+! compute the tracer tendencies due to convection for any tracers that
+! are to be transported by any convective parameterization.
+!---------------------------------------------------------------------
+ do n=1,size(Output_mp%rdt,4)
+ if ( tracers_in_donner(n) .or. &
+ tracers_in_ras(n) .or. &
+ tracers_in_mca(n) .or. &
+ tracers_in_uw(n)) then
+
+!---------------------------------------------------------------------
+! output diagnostics for tracer tendency and column integrated
+! tracer tendency due to convection.
+!---------------------------------------------------------------------
+ if (id_tracerdt_conv(n) > 0 .or. &
+ id_tracerdt_conv_col(n) > 0) then
+ temp_3d1 = Output_mp%rdt(:,:,:,n) - Output_mp%rdt_init(:,:,:,n)
+ used = send_data (id_tracerdt_conv(n), temp_3d1, &
+ Time, is, js, 1 )
+
+ if (id_tracerdt_conv_col(n) > 0) &
+ call column_diag &
+ (id_tracerdt_conv_col(n), is, js, Time, temp_3d1, &
+ 1.0, Input_mp%pmass)
+ endif
+ endif
+ end do
+
+!------------------------------------------------------------------
+
+
+end subroutine convective_diagnostics
+
+
+
+!######################################################################
+
+subroutine define_convective_area (C2ls_mp, Moist_clouds_block, Input_mp)
+
+!----------------------------------------------------------------------
+! subroutine define_convective_area computes the grid box area taken up
+! by convective clouds and thus unavailable to the large-scale cloud
+! scheme, and the ratio of gridbox relative humidity to that in the
+! convective cloud environment.
+!----------------------------------------------------------------------
+
+!---------------------------------------------------------------------
+type(mp_conv2ls_type), intent(inout) :: C2ls_mp
+type(clouds_from_moist_block_type), intent(in) :: Moist_clouds_block
+type(mp_input_type), intent(in) :: Input_mp
+
+!-----------------------------------------------------------------------
+! C2ls_mp derived type used to transfer data from convection_driver
+! to lscloud_driver via moist_processes.
+! Moist_clouds_block
+! derived type used to transfer cloud data between
+! atmos_model and convection_driver via physics_driver and
+! moist_processes
+! Input_mp derived type used to transfer needed input data between
+! moist_processes and convection_driver
+!
+!----------------------------------------------------------------------
+
+ real, dimension(size(Input_mp%t,1),size(Input_mp%t,2), &
+ size(Input_mp%t,3)) :: &
+ conv_area_input, &
+ rh_wtd_conv_area
+
+!---------------------------------------------------------------------
+! conv_area_input area taken up by convective clouds, summed over
+! the active convective schemes which predict clouds.
+! this is the area unavailable for large-scale
+! clouds.
+! rh_wtd_conv_area sum of convective area times relative humidity,
+! summed over active convective cloud schemes
+! (relative-humidity-weighted convective area).
+! uw, donner cell and donner meso clouds above meso
+! updraft level each contribute CF*1.0 (their
+! cloud areas are assumed saturated), while the
+! donner meso area below downdraft level but above
+! cloud base contributes CF * an assumed height-
+! dependent relative humidity (details in donner_deep
+! parameterization.
+!---------------------------------------------------------------------
+
+!-----------------------------------------------------------------------
+! define the total convective area and relative-humidity-weighted
+! convective area for the current convective implementation.
+! if no convective scheme which produces convective clouds is active,
+! set these fields to 0.0.
+!-----------------------------------------------------------------------
+ if (do_uw_conv .and. do_donner_deep ) then
+ conv_area_input = C2ls_mp%donner_humidity_area + &
+ Moist_clouds_block%cloud_data(i_shallow)%cloud_area
+ rh_wtd_conv_area = &
+ Moist_clouds_block%cloud_data(i_cell)%cloud_area + &
+ C2ls_mp%donner_humidity_factor + &
+ Moist_clouds_block%cloud_data(i_shallow)%cloud_area
+ else if (do_donner_deep) then
+ conv_area_input = C2ls_mp%donner_humidity_area
+ rh_wtd_conv_area = &
+ Moist_clouds_block%cloud_data(i_cell)%cloud_area + &
+ C2ls_mp%donner_humidity_factor
+ else if (do_uw_conv) then
+ conv_area_input = &
+ Moist_clouds_block%cloud_data(i_shallow)%cloud_area
+ rh_wtd_conv_area = &
+ Moist_clouds_block%cloud_data(i_shallow)%cloud_area
+ else
+ conv_area_input = 0.
+ rh_wtd_conv_area = 0.
+ endif
+
+!-----------------------------------------------------------------------
+! call compute_convective_area to compute the grid box area taken up
+! by convective clouds, and the ratio of gridbox relative humidity to
+! that in the cloud environment. If CLUBB is active, then a second call
+! is made using slightly different inputs, and with outputs that are
+! used only with CLUBB.
+!-----------------------------------------------------------------------
+ if (.not. do_lsc) then
+ call compute_convective_area &
+ (Input_mp%tin, Input_mp%pfull, Input_mp%qin, conv_area_input, &
+ rh_wtd_conv_area, 1.0, C2ls_mp%convective_humidity_ratio, &
+ C2ls_mp%convective_humidity_area)
+ endif
+ if (do_clubb == 2) then
+ call compute_convective_area &
+ (Input_mp%t, Input_mp%pfull, Input_mp%q, &
+ conv_area_input, rh_wtd_conv_area, conv_frac_max, &
+ C2ls_mp%convective_humidity_ratio_clubb, &
+ C2ls_mp%conv_frac_clubb)
+
+ endif
+
+!---------------------------------------------------------------------
+
+
+end subroutine define_convective_area
+
+
+
+!#######################################################################
+
+subroutine compute_convective_area &
+ (t, pfull, q, conv_area_input, rh_wtd_conv_area, &
+ max_cnv_frac, humidity_ratio, convective_area)
+
+!-------------------------------------------------------------------------
+! subroutine compute_convective_area defines the grid box area affected
+! by the convective clouds (convective_area) and the ratio of the
+! grid-box relative humidity to the humidity in the environment of the
+! convective clouds (humidity_ratio).
+!-------------------------------------------------------------------------
+
+real, dimension(:,:,:), intent(in) :: t, pfull, q, &
+ conv_area_input, rh_wtd_conv_area
+real, intent(in) :: max_cnv_frac
+real, dimension(:,:,:), intent(out) :: humidity_ratio, convective_area
+
+!------------------------------------------------------------------------
+
+!----------------------------------------------------------------------
+! t temperature [ K ]
+! pfull pressure on full levels [ Pa ]
+! q specific humidity [ kg h2o / kg moist air ]
+! conv_area_input
+! convective cloud area as determined by active convective
+! schemes
+! rh_wtd_conv_area
+! sum of products of convective area * rh over all active
+! convective cloud schemes
+! max_cnv_frac
+! largest area in a gridbox which may be taken up by
+! convective clouds
+! humidity_ratio
+! ratio of the grid-box relative humidity to the humidity
+! in the environment of the convective clouds
+! convective_area
+! grid box area affected by the convective clouds
+!
+!----------------------------------------------------------------------
+
+!----------------------------------------------------------------------
+ real, dimension(size(t,1), size(t,2), &
+ size(t,3)) :: qs, qrf, env_fraction, env_qv
+ integer :: i, j ,k
+ integer :: ix, jx, kx
+
+!-----------------------------------------------------------------------
+! qs saturation specific humidity
+! qrf model specific humidity, forced to be realizable
+! env_fraction portion of gridbox free of convective cloud
+! influence
+! env_qv temporary variable used in calculation of
+! humidity_ratio
+! i, j, k do loop indices
+! ix, jx, kx dimensions of physics window
+!-----------------------------------------------------------------------
+
+!-----------------------------------------------------------------------
+! define array dimensions.
+!-----------------------------------------------------------------------
+ ix = size(t,1)
+ jx = size(t,2)
+ kx = size(t,3)
+
+!-----------------------------------------------------------------------
+! define the grid box area whose humidity is affected by the
+! convective clouds (convective_area) initially as that obtained from
+! the active cloud schemes (conv_area_input) and passed into this
+! subroutine. here it may be limited by max_cnv_frac, which may be set
+! either arbitrarily or by an nml variable. the convective environment
+! fraction (env_fraction) is defined as the remainder of the box.
+!-----------------------------------------------------------------------
+ do k=1, kx
+ do j=1,jx
+ do i=1,ix
+ convective_area(i,j,k) = min (conv_area_input(i,j,k), &
+ max_cnv_frac)
+ env_fraction(i,j,k) = 1.0 - convective_area(i,j,k)
+ end do
+ end do
+ end do
+
+!-----------------------------------------------------------------------
+! calculate the ratio of the gridbox relative humidity to that
+! in the cloud environment (humidity_ratio). to do so, define a
+! realizable grid box specific humidity (qrf) and the saturation
+! specific humidity (qs).
+!------------------------------------------------------------------
+ qrf = MAX(q, 0.0)
+ call compute_qs (t, pfull, qs)
+
+!----------------------------------------------------------------------
+! given the gridbox specific humidity (qrf) and the convective area
+! specific humidity (based on qs), the environmental specific humidity
+! must be given by
+!
+! q(ENVIRONMENT) = (q(GRIDBOX) -q(ConvectiveArea)*ConvectiveArea)/ &
+! (1 - ConvectiveArea).
+!
+! the convective cloud area is assumed saturated for the uw clouds, in
+! the donner cell clouds and in the region of donner meso updraft, but
+! is assumed subsaturated in the donner meso downdraft layer above cloud
+! base, with the degree of saturation given by the
+! donner_humidity_factor (mesoscale area times assumed RH).
+!
+! variable env_qv is defined as the numerator in the above expression.
+! where the ConvectiveArea has been passed in as rh_wtd_conv_area,
+! taking account of the different treatment of qs in the cloud area by
+! meso, cell and uw clouds.
+!-------------------------------------------------------------------
+ env_qv = qrf - qs*rh_wtd_conv_area
+ do k=1,kx
+ do j=1,jx
+ do i=1,ix
+
+!---------------------------------------------------------------------
+! one can define the ratio of the grid-box relative humidity to the
+! humidity in the environment of the convective clouds only if the
+! grid box contains vapor (qrf > 0.0) and there is some vapor
+! outside of the convective clouds (env_qv > 0.).
+!----------------------------------------------------------------------
+ if (qrf(i,j,k) /= 0.0 .and. env_qv(i,j,k) > 0.0) then
+
+!--------------------------------------------------------------------
+! there must also be some grid box area that does not contain convective
+! clouds (env_fraction > 0.).
+!--------------------------------------------------------------------
+ if (env_fraction(i,j,k) > 0.0) then
+ humidity_ratio(i,j,k) = &
+ MAX (qrf(i,j,k)*env_fraction(i,j,k)/env_qv(i,j,k), 1.0)
+
+!---------------------------------------------------------------------
+! if the grid box is filled with convective clouds, set humidity ratio
+! to a flag value. this will not happen if max_cnv_frac is < 1.0.
+!----------------------------------------------------------------------
+ else
+ humidity_ratio(i,j,k) = -10.0
+ endif
+
+!--------------------------------------------------------------------
+! if there either is no vapor in the gridbox or all the vapor has been
+! taken up by the convective clouds, set the humidity_ratio to 1.0.
+!---------------------------------------------------------------------
+ else
+ humidity_ratio(i,j,k) = 1.0
+ endif
+ end do
+ end do
+ end do
+
+!------------------------------------------------------------------------
+
+
+end subroutine compute_convective_area
+
+
+
+!######################################################################
+
+subroutine define_inputs_for_cosp (Removal_mp)
+
+!---------------------------------------------------------------------
+! subroutine define_inputs_for_cosp converts the precip fluxes from
+! =mid-layer values to interface values.
+!---------------------------------------------------------------------
+
+type(mp_removal_type), intent(inout) :: Removal_mp
+
+!---------------------------------------------------------------------
+! Removal_mp derived type used to transfer precipitation and tracer
+! removal fields between convection_driver and
+! moist_processes
+!---------------------------------------------------------------------
+
+ integer :: k
+
+!--------------------------------------------------------------------
+! k do loop index
+!--------------------------------------------------------------------
+
+!---------------------------------------------------------------------
+! define precip fluxes from donner schemes at each layer interface.
+! (index 1 is model lid)
+!---------------------------------------------------------------------
+ do k=2, size(Removal_mp%liq_mesoh,3)
+ Removal_mp%liq_mesoh(:,:,k) = Removal_mp%liq_mesoh (:,:,k-1) + &
+ Removal_mp%liq_meso (:,:,k-1)
+ Removal_mp%frz_mesoh(:,:,k) = Removal_mp%frz_mesoh (:,:,k-1) + &
+ Removal_mp%frz_meso (:,:,k-1)
+ Removal_mp%liq_cellh(:,:,k) = Removal_mp%liq_cellh (:,:,k-1) + &
+ Removal_mp%liq_cell (:,:,k-1)
+ Removal_mp%frz_cellh(:,:,k) = Removal_mp%frz_cellh (:,:,k-1) + &
+ Removal_mp%frz_cell (:,:,k-1)
+ Removal_mp%ice_precflxh(:,:,k) = &
+ Removal_mp%ice_precflxh(:,:,k-1) + &
+ Removal_mp%ice_precflx(:,:,k-1)
+ Removal_mp%liq_precflxh(:,:,k) = &
+ Removal_mp%liq_precflxh(:,:,k-1) + &
+ Removal_mp%liq_precflx(:,:,k-1)
+ if (include_donmca_in_cosp) then
+ Removal_mp%mca_liqh(:,:,k) = Removal_mp%mca_liqh (:,:,k-1) + &
+ Removal_mp%mca_liq(:,:,k-1)
+ Removal_mp%mca_frzh(:,:,k) = Removal_mp%mca_frzh (:,:,k-1) + &
+ Removal_mp%mca_frz(:,:,k-1)
+ endif
+ end do
+
+!--------------------------------------------------------------------
+! adjust precip fluxes to remove any negative values that were produced.
+! precip contribution is determined as the negative of the total
+! moisture tendency, so at top of clouds a positive moisture tendency
+! sometimes results in a negative precipitation contribution.
+!----------------------------------------------------------------------
+ call prevent_neg_precip_fluxes (Removal_mp%liq_mesoh)
+ call prevent_neg_precip_fluxes (Removal_mp%frz_mesoh)
+ call prevent_neg_precip_fluxes (Removal_mp%liq_cellh)
+ call prevent_neg_precip_fluxes (Removal_mp%frz_cellh)
+ call prevent_neg_precip_fluxes (Removal_mp%ice_precflxh)
+ call prevent_neg_precip_fluxes (Removal_mp%liq_precflxh)
+ if (include_donmca_in_cosp) then
+ call prevent_neg_precip_fluxes (Removal_mp%mca_liqh)
+ call prevent_neg_precip_fluxes (Removal_mp%mca_frzh)
+ endif
+
+!-----------------------------------------------------------------------
+
+
+end subroutine define_inputs_for_cosp
+
+
+
+!#######################################################################
+
+subroutine prevent_neg_precip_fluxes (fluxh)
+
+!----------------------------------------------------------------------
+! subroutine prevent_neg_precip_fluxes checks for negative precip
+! fluxes (implying precip is moving upwards in the atmosphere) at each
+! level, and if encountered the flux is eliminated.
+!----------------------------------------------------------------------
+
+real, dimension(:,:,:), intent(inout) :: fluxh
+
+!---------------------------------------------------------------------
+! fluxh precip flux at model half-level
+!---------------------------------------------------------------------
+
+ real, dimension(size(fluxh,1), size(fluxh,2)) :: sumneg
+ integer :: i,j,k
+
+!---------------------------------------------------------------------
+! sumneg the accumulated vertical sum of unbalanced negative
+! precip fluxes in the column (beginning at the top)
+! i, j, k do loop indices
+!---------------------------------------------------------------------
+
+!-----------------------------------------------------------------------
+! move down each column looking for negative precip fluxes at each
+! level. if found, the negative flux is eliminated at the level, and
+! positive fluxes lower down will be reduced until the negative flux
+! is balanced.
+!-----------------------------------------------------------------------
+ sumneg(:,:) = 0.
+ do k=2, size(fluxh,3)
+ do j=1,size(fluxh,2)
+ do i=1,size(fluxh,1)
+ if (fluxh(i,j,k) > 0.0) then
+ if (fluxh(i,j,k) > ABS(sumneg(i,j))) then
+ fluxh(i,j,k) = fluxh(i,j,k) + sumneg(i,j)
+ sumneg(i,j) = 0.
+ else
+ sumneg(i,j) = sumneg(i,j) + fluxh(i,j,k)
+ fluxh(i,j,k) = 0.
+ endif
+ else
+ sumneg(i,j) = sumneg(i,j) + fluxh(i,j,k)
+ fluxh(i,j,k) = 0.
+ endif
+ end do
+ end do
+ end do
+
+!----------------------------------------------------------------------
+
+
+end subroutine prevent_neg_precip_fluxes
+
+
+
+!#######################################################################
+
+subroutine convection_driver_dealloc (Conv_results)
+
+!--------------------------------------------------------------------
+! subroutine convection_driver_dealloc deallocates the components of
+! the conv_results_type variable Conv_results.
+!--------------------------------------------------------------------
+
+type(conv_results_type), intent(inout) :: Conv_results
+
+!---------------------------------------------------------------------
+! Conv_results
+! conv_results_type variable containing local variables
+! used in multiple convective parameterizations and for
+! diagnostic output
+!---------------------------------------------------------------------
+
+!------------------------------------------------------------------------
+! deallocate the components of the conv_results_type variable
+! Conv_results.
+!------------------------------------------------------------------------
+ deallocate (Conv_results%ras_mflux) ! old variable mc
+ deallocate (Conv_results%ras_det_mflux) ! old variable det0
+ if (do_donner_deep) then
+ deallocate (Conv_results%donner_mflux) ! m_cellup
+ deallocate (Conv_results%donner_det_mflux) ! m_cdet_donner
+ endif
+ deallocate (Conv_results%uw_mflux) ! cmf
+ deallocate (Conv_results%mc_donner)
+ deallocate (Conv_results%mc_donner_up)
+ deallocate (Conv_results%mc_donner_half)
+
+ deallocate(Conv_results%available_cf_for_uw)
+ deallocate(Conv_results%conv_calc_completed)
+
+ deallocate (Conv_results%cldtop)
+ deallocate (Conv_results%cldbot)
+ deallocate (Conv_results%prod_no)
+
+!----------------------------------------------------------------------
+
+
+end subroutine convection_driver_dealloc
+
+
+
+!*******************************************************************
+!
+! PRIVATE, DONNER-RELATED SUBROUTINES
+!
+!*******************************************************************
+
+!######################################################################
+
+subroutine donner_driver ( is, ie, js, je, Input_mp, Moist_clouds_block, &
+ Conv_results, C2ls_mp, Removal_mp, Tend_mp, &
+ Output_mp)
+
+!------------------------------------------------------------------------
+! subroutine donner_driver prepares for the execution of
+! donner_deep_mod, calls its module driver, processes its
+! output into the form needed by other parameterizations active in
+! the atmospheric model while assuring that output is realizable and
+! conserves desired properties, calls moist convective adjustment if
+! that is executed as part of the donner scheme, and then outputs
+! diagnostics from the donner scheme.
+!------------------------------------------------------------------------
+
+integer, intent(in) :: is, ie, js, je
+type(mp_input_type), intent(inout) :: Input_mp
+type(clouds_from_moist_block_type), intent(inout) :: Moist_clouds_block
+type(conv_results_type), intent(inout) :: Conv_results
+type(mp_conv2ls_type), intent(inout) :: C2ls_mp
+type(mp_removal_type), intent(inout) :: Removal_mp
+type(mp_tendency_type), intent(inout) :: Tend_mp
+type(mp_output_type), intent(inout) :: Output_mp
+!------------------------------------------------------------------------
+
+!----------------------------------------------------------------------
+! is,ie starting and ending i indices for window
+! js,je starting and ending j indices for window
+! Input_mp derived type used to transfer needed input data between
+! moist_processes and convection_driver
+! Moist_clouds_block
+! derived type used to transfer cloud data between
+! atmos_model and convection_driver via physics_driver and
+! moist_processes
+! Conv_results
+! conv_results_type variable containing variables
+! used in multiple convective parameterizations and for
+! diagnostic output
+! C2ls_mp derived type used to transfer data from convection_driver
+! to lscloud_driver via moist_processes.
+! Removal_mp derived type used to transfer precipitation and tracer
+! removal fields between convection_driver and
+! moist_processes
+! Tend_mp derived type used to transfer calculated tendency data
+! between convection_driver and moist_processes
+! Output_mp derived type used to transfer output fields between
+! convection_driver and moist_processes
+!----------------------------------------------------------------------
+
+ type(donner_input_type) :: Input_don
+ type(conv_output_type) :: Output_don
+ type(conv_tendency_type) :: Don_tend, Don_mca_tend
+ integer :: ix, jx, kx
+
+!--------------------------------------------------------------------
+! Input_don donner_input_type variable containing input
+! fields used by donner_deep_mod
+! Output_don conv_output_type variable containing output
+! fields from donner_deep_mod
+! Don_tend conv_tendency_type variable containing tendency
+! output form donner_deep_mod
+! Don_mca_tend conv_tendency_type variable containing tendency
+! output from the moist convective adjustment
+! component of the donner deep convection scheme
+! ix, jx, kx sizes of the physics window
+!--------------------------------------------------------------------
+
+!---------------------------------------------------------------------
+! activate the donner clock.
+!---------------------------------------------------------------------
+ call mpp_clock_begin (donner_clock)
+
+!-----------------------------------------------------------------------
+! define array dimensions.
+!-----------------------------------------------------------------------
+ ix = size(Input_mp%t,1)
+ jx = size(Input_mp%t,2)
+ kx = size(Input_mp%t,3)
+
+!-----------------------------------------------------------------------
+! call donner_alloc to allocate and initialize components of Input_don,
+! Output_don, Don_tend and Don_mca_tend.
+!-----------------------------------------------------------------------
+ call donner_alloc (ix, jx, kx, Input_don, Output_don, Don_tend, &
+ Don_mca_tend)
+
+!---------------------------------------------------------------------
+! call donner_prep to collect some additional inputs needed by the
+! donner parameterization.
+!---------------------------------------------------------------------
+ call donner_prep (Input_mp, Input_don, Output_don)
+
+!---------------------------------------------------------------------
+! call donner_deep to compute the effects of deep convection on the
+! temperature, vapor mixing ratio, tracers, cloud liquid, cloud ice
+! cloud area and precipitation fields.
+!---------------------------------------------------------------------
+ call donner_deep &
+ (is, ie, js, je, dt, Input_mp%tin, Input_don%rin, &
+ Input_mp%pfull, Input_mp%phalf, Input_mp%zfull, Input_mp%zhalf, &
+ Input_mp%omega, Input_mp%pblht, Input_don%ke_bl, Input_mp%qstar, &
+ Input_mp%cush, Input_mp%coldT, Input_mp%land, &
+ Input_don%sfc_sh_flux, Input_don%sfc_vapor_flux, &
+ Input_don%tr_flux, Output_don%donner_tracer, &
+ Input_don%secs, Input_don%days, Input_mp%cbmf, &
+ Moist_clouds_block%cloud_data(i_cell)%cloud_area, &
+ Moist_clouds_block%cloud_data(i_cell)%liquid_amt, &
+ Moist_clouds_block%cloud_data(i_cell)%liquid_size, &
+ Moist_clouds_block%cloud_data(i_cell)%ice_amt , &
+ Moist_clouds_block%cloud_data(i_cell)%ice_size , &
+ Moist_clouds_block%cloud_data(i_cell)%droplet_number, &
+ Moist_clouds_block%cloud_data(i_meso)%cloud_area, &
+ Moist_clouds_block%cloud_data(i_meso)%liquid_amt, &
+ Moist_clouds_block%cloud_data(i_meso)%liquid_size, &
+ Moist_clouds_block%cloud_data(i_meso)%ice_amt , &
+ Moist_clouds_block%cloud_data(i_meso)%ice_size , &
+ Moist_clouds_block%cloud_data(i_meso)%droplet_number, &
+ Moist_clouds_block%cloud_data(i_meso)%nsum_out, &
+ Input_don%maxTe_launch_level, &
+ Output_don%precip_returned, Output_don%delta_temp, &
+ Output_don%delta_vapor, Conv_results%donner_det_mflux, &
+ Conv_results%donner_mflux, Conv_results%mc_donner, &
+ Conv_results%mc_donner_up, &
+ Conv_results%mc_donner_half, C2ls_mp%donner_humidity_area, &
+ C2ls_mp%donner_humidity_factor, Input_don%qtr, &
+ Removal_mp%donner_wetdep, Output_don%lheat_precip, &
+ Output_don%vert_motion, Output_don%total_precip, &
+ Output_don%liquid_precip, Output_don%frozen_precip, &
+ Removal_mp%frz_meso, Removal_mp%liq_meso, &
+ Removal_mp%frz_cell, Removal_mp%liq_cell, &
+ Input_don%qlin, Input_don%qiin, Input_don%qain, &
+ Output_don%delta_ql, Output_don%delta_qi, Output_don%delta_qa)
+
+!------------------------------------------------------------------------
+! call process_donner_output to 1) add tracer tendencies from
+! donner_deep_mod to the arrays accumulating the total tracer
+! tendencies, and 2) define the change in vapor specific humidity
+! resulting from donner_deep_mod.
+!------------------------------------------------------------------------
+ call process_donner_output (Input_don, Input_mp, Output_don, &
+ Output_mp)
+
+!------------------------------------------------------------------------
+! if column conservation checks on the water and enthalpy changes
+! produced within the donner deep convection scheme have been requested,
+! call check_donner_conservation to compute the needed vertical
+! integrals.
+!------------------------------------------------------------------------
+ if (do_donner_conservation_checks) then
+ call check_donner_conservation (is, js, ie, je, Input_mp, &
+ Output_don)
+ endif
+
+!---------------------------------------------------------------------
+! scale the donner_deep_mod tendencies to prevent the formation of
+! negative condensate, cloud areas smaller than a specified minimum,
+! and water vapor specific humidity below a specified limit.
+!---------------------------------------------------------------------
+ if (doing_prog_clouds .and. do_limit_donner) then
+ call define_and_apply_scale ( Input_mp, Don_tend, Output_don,&
+ .true., .false., Input_don%qtr)
+ endif
+
+!---------------------------------------------------------------------
+! call prevent_unrealizable_water to adjust raw forcings from
+! donner_deep so as to prevent unrealizable mixing ratios for
+! water substance and cloud area, and to adjust precipitation field to
+! force moisture conservation in each model column.
+!---------------------------------------------------------------------
+ call prevent_unrealizable_water &
+ (Input_mp, Output_don, Removal_mp, Don_tend)
+
+!------------------------------------------------------------------------
+! call define output fields to 1) define quantities needed for use by
+! other modules, 2) to update the input fields which will be supplied to
+! to other active moist_processes parameterizations, and 3) to define
+! donner tendencies in the desired units used in moist_processes_mod.
+!------------------------------------------------------------------------
+ call define_output_fields &
+ (Input_mp, Input_don, Output_don, Conv_results, &
+ C2ls_mp, Don_tend)
+
+!-----------------------------------------------------------------------
+! call update_outputs to update tendency fields in Output_mp% and
+! Don_tend% that are needed later.
+!-----------------------------------------------------------------------
+ call update_outputs (Don_tend, Output_mp, Tend_mp)
+
+!----------------------------------------------------------------------
+! this section calculates the moist convective adjustment associated
+! with the donner convection scheme. It is activated / deactivated
+! by moist_processes_nml variable do_donner_mca.
+!----------------------------------------------------------------------
+ if (do_donner_mca) then
+ call donner_mca_driver &
+ (is, js, Input_mp, Input_don, Output_don, Removal_mp, &
+ Output_mp, Don_mca_tend)
+!-----------------------------------------------------------------------
+! call update_outputs to update tendency fields in Output_mp% and
+! Don_mca_tend% that are needed later.
+!-----------------------------------------------------------------------
+ call update_outputs ( Don_mca_tend, Output_mp, Tend_mp)
+ endif !(do_donner_mca)
+
+!------------------------------------------------------------------------
+! call output_donner_diagnostics to output netcdf diagnostics of
+! diagnostic fields from donner_deep_mod.
+!------------------------------------------------------------------------
+ call output_donner_diagnostics &
+ (is, js, Input_mp, Conv_results, Moist_clouds_block, &
+ Input_don, Output_don, C2ls_mp, Don_tend, Don_mca_tend)
+
+!----------------------------------------------------------------------
+! call donner_dealloc to deallocate the components of the derived types
+! local to this subroutine.
+!----------------------------------------------------------------------
+ call donner_dealloc (Input_don, Output_don, Don_tend, Don_mca_tend)
+
+!-----------------------------------------------------------------------
+! turn off the donner clock.
+!-----------------------------------------------------------------------
+ call mpp_clock_end (donner_clock)
+
+!---------------------------------------------------------------------
+
+
+end subroutine donner_driver
+
+
+
+!#########################################################################
+
+subroutine donner_alloc (ix, jx, kx, Input_don, Output_don, Don_tend, &
+ Don_mca_tend)
+
+!-----------------------------------------------------------------------
+! subroutine donner_alloc allocates the components of derived type
+! arrays local to subroutine donner_driver.
+!-----------------------------------------------------------------------
+
+!----------------------------------------------------------------------
+integer, intent(in) :: ix, jx, kx
+type(donner_input_type), intent(inout) :: Input_don
+type(conv_output_type), intent(inout) :: Output_don
+type(conv_tendency_type), intent(inout) :: Don_tend, Don_mca_tend
+
+!--------------------------------------------------------------------
+! ix, jx, kx sizes of the physics window
+! Input_don donner_input_type variable containing input
+! fields used by donner_deep_mod
+! Output_don conv_output_type variable containing output
+! fields from donner_deep_mod
+! Don_tend conv_tendency_type variable containing tendency
+! output form donner_deep_mod
+! Don_mca_tend conv_tendency_type variable containing tendency
+! output from the moist convective adjustment
+! component of the donner deep convection scheme
+!--------------------------------------------------------------------
+
+!-------------------------------------------------------------------
+! allocate and initialize the Don_mca_tend components.
+!-------------------------------------------------------------------
+ if (do_donner_mca) then
+ allocate (Don_mca_tend%rain (ix, jx))
+ allocate (Don_mca_tend%snow (ix, jx))
+ allocate (Don_mca_tend%ttnd (ix, jx, kx))
+ allocate (Don_mca_tend%qtnd (ix, jx, kx))
+ allocate (Don_mca_tend%qtr (ix, jx, kx, num_donner_tracers))
+
+ Don_mca_tend%rain = 0.
+ Don_mca_tend%snow = 0.
+ Don_mca_tend%ttnd = 0.
+ Don_mca_tend%qtnd = 0.
+ Don_mca_tend%qtr = 0.
+ endif
+
+!-------------------------------------------------------------------
+! allocate and initialize the Don_tend components.
+!-------------------------------------------------------------------
+ allocate (Don_tend%delta_q (ix, jx, kx))
+ allocate (Don_tend%rain (ix, jx))
+ allocate (Don_tend%snow (ix, jx))
+ allocate (Don_tend%ttnd (ix, jx, kx))
+ allocate (Don_tend%qtnd (ix, jx, kx))
+ allocate (Don_tend%qtr (ix, jx, kx, num_donner_tracers))
+ if (doing_prog_clouds) then
+ allocate (Don_tend%qltnd (ix, jx, kx))
+ allocate (Don_tend%qitnd (ix, jx, kx))
+ allocate (Don_tend%qatnd (ix, jx, kx))
+ allocate (Don_tend%qntnd (ix, jx, kx))
+ allocate (Don_tend%qnitnd (ix, jx, kx))
+ endif
+ Don_tend%delta_q = 0.
+ Don_tend%rain = 0.
+ Don_tend%snow = 0.
+ Don_tend%ttnd = 0.
+ Don_tend%qtnd = 0.
+ Don_tend%qtr = 0.
+ if (doing_prog_clouds) then
+ Don_tend%qltnd = 0.
+ Don_tend%qitnd = 0.
+ Don_tend%qatnd = 0.
+ Don_tend%qntnd = 0.
+ Don_tend%qnitnd = 0.
+ endif
+
+!-------------------------------------------------------------------
+! allocate and initialize the Input_don components.
+!
+! sfc_sh_flux sensible heat flux across the surface
+! [ watts / m**2 ]
+! sfc_vapor_flux water vapor flux across the surface
+! [ kg(h2o) / (m**2 sec) ]
+! tr_flux tracer fux across the surface
+! [ kg(tracer) / (m**2 sec) ]
+!----------------------------------------------------------------------
+ allocate (Input_don%rin(ix, jx, kx) )
+ allocate (Input_don%sfc_sh_flux(ix, jx) )
+ allocate (Input_don%sfc_vapor_flux(ix, jx) )
+ allocate (Input_don%tr_flux(ix, jx, num_donner_tracers) )
+ allocate (Input_don%ke_bl(ix, jx) )
+ allocate (Input_don%maxTe_launch_level(ix, jx) )
+ allocate (Input_don%qtr(ix, jx, kx, num_donner_tracers) )
+ allocate (Input_don%qlin(ix, jx, kx) )
+ allocate (Input_don%qiin(ix, jx, kx) )
+ allocate (Input_don%qain(ix, jx, kx) )
+ allocate (Input_don%nllin(ix, jx, kx) )
+ allocate (Input_don%nilin(ix, jx, kx) )
+
+ Input_don%rin = 0.
+ Input_don%sfc_sh_flux = 0.
+ Input_don%sfc_vapor_flux = 0.
+ Input_don%tr_flux = 0.
+ Input_don%ke_bl = 0.
+ Input_don%maxTe_launch_level = 0.
+ Input_don%qtr = 0.
+ Input_don%qlin = 0.
+ Input_don%qiin = 0.
+ Input_don%qain = 0.
+ Input_don%nllin = 0.
+
+!-------------------------------------------------------------------
+! allocate and initialize the Output_don components.
+!-------------------------------------------------------------------
+ allocate (Output_don%delta_temp(ix, jx, kx))
+ allocate (Output_don%delta_vapor(ix, jx, kx))
+ allocate (Output_don%delta_q (ix, jx, kx))
+ allocate (Output_don%delta_ql (ix, jx, kx))
+ allocate (Output_don%delta_qi (ix, jx, kx))
+ allocate (Output_don%delta_qa (ix, jx, kx))
+ allocate (Output_don%delta_qn (ix, jx, kx))
+ allocate (Output_don%delta_qni (ix, jx, kx))
+ allocate (Output_don%ttnd_adjustment(ix, jx, kx))
+ allocate (Output_don%liquid_precip (ix, jx, kx))
+ allocate (Output_don%frozen_precip (ix, jx, kx))
+ allocate (Output_don%precip_adjustment(ix, jx))
+ allocate (Output_don%precip_returned (ix, jx))
+ allocate (Output_don%adjust_frac (ix, jx))
+ allocate (Output_don%lheat_precip (ix, jx))
+ allocate (Output_don%vert_motion (ix, jx))
+ allocate (Output_don%total_precip (ix, jx))
+ allocate (Output_don%scale (ix, jx))
+ allocate (Output_don%scale_REV (ix, jx))
+ allocate (Output_don%donner_tracer (ix, jx,kx,num_donner_tracers))
+
+ Output_don%delta_temp = 0.
+ Output_don%delta_vapor= 0.
+ Output_don%delta_q = 0.
+ Output_don%delta_ql = 0.
+ Output_don%delta_qi = 0.
+ Output_don%delta_qa = 0.
+ Output_don%delta_qn = 0.
+ Output_don%delta_qni = 0.
+ Output_don%liquid_precip= 0.
+ Output_don%frozen_precip= 0.
+ Output_don%ttnd_adjustment = 0.
+ Output_don%vert_motion = 0.
+ Output_don%lheat_precip = 0.
+ Output_don%total_precip = 0.
+ Output_don%scale = 1.0
+ Output_don%scale_REV = 1.0
+ Output_don%precip_adjustment = 0.
+ Output_don%precip_returned = 0.
+ Output_don%adjust_frac = 0.
+ Output_don%donner_tracer = 0.
+
+!----------------------------------------------------------------------
+
+
+end subroutine donner_alloc
+
+
+
+!#######################################################################
+
+subroutine donner_prep (Input_mp, Input_don, Output_don)
+
+!-----------------------------------------------------------------------
+! subroutine donner_prep consolidates the input fields needed by
+! donner_deep_mod.
+!-----------------------------------------------------------------------
+
+type(mp_input_type), intent(in) :: Input_mp
+type(donner_input_type), intent(inout) :: Input_don
+type(conv_output_type), intent(inout) :: Output_don
+
+!--------------------------------------------------------------------
+! Input_mp derived type used to transfer needed input data between
+! moist_processes and convection_driver
+! Input_don donner_input_type variable containing input fields used by
+! donner_deep_mod
+! Output_don conv_output_type variable containing output fields from
+! donner_deep_mod
+!--------------------------------------------------------------------
+
+ integer :: n, nn
+
+!------------------------------------------------------------------------
+! n do loop index
+! nn counter
+!------------------------------------------------------------------------
+
+!--------------------------------------------------------------------
+! if prognostic clouds are active in the model, define the cloud liquid,
+! and cloud ice specific humidities, cloud area, and droplet and ice
+! particle numbers associated with them. if not using prognostic clouds,
+! these fields remain set to their initialized value of 0.0.
+!--------------------------------------------------------------------
+ if (doing_prog_clouds) then
+ Input_don%qlin = Input_mp%tracer(:,:,:,nql)
+ Input_don%qiin = Input_mp%tracer(:,:,:,nqi)
+ Input_don%qain = Input_mp%tracer(:,:,:,nqa)
+ if (do_liq_num ) Input_don%nllin = Input_mp%tracer(:,:,:,nqn)
+ if (do_ice_num ) Input_don%nilin = Input_mp%tracer(:,:,:,nqni)
+ endif
+
+!--------------------------------------------------------------------
+! convert vapor specific humidity to vapor mixing ratio, which is
+! needed in donner_deep_mod.
+!--------------------------------------------------------------------
+ Input_don%rin = Input_mp%qin/(1.0 - Input_mp%qin)
+
+!---------------------------------------------------------------------
+! if any tracers are to be transported by donner convection,
+! check each active tracer to find those to be transported and fill
+! the donner_tracer array with these fields. If none are to be
+! transported, the array remains at its initialized value of 0.0.
+!---------------------------------------------------------------------
+ if (num_donner_tracers > 0) then
+ nn = 1
+ do n=1,num_prog_tracers
+ if (tracers_in_donner(n)) then
+ Output_don%donner_tracer(:,:,:,nn) = Input_mp%tracer(:,:,:,n)
+ nn = nn + 1
+ endif
+ end do
+ endif
+
+!---------------------------------------------------------------------
+! If one desires donner_deep_mod to see model-supplied surface fluxes of
+! sensible heat (Input_don%sfc_sh_flux), water vapor
+! (Input_don%sfc_vapor_flux) or tracers (Input_don%tr_flux), they
+! should be input here. They will need to be passed down in Surf_diff
+! from flux_exchange through moist_processes to convection_driver, and
+! then to donner_deep through this interface.
+! FOR NOW, these values retain their initialized values of 0.0, as these
+! fields are not passed to donner_deep_mod.
+!---------------------------------------------------------------------
+! Input_don%sfc_sh_flux = 0.0
+! Input_don%sfc_vapor_flux = 0.0
+! if (num_donner_tracers > 0) then
+! nn = 1
+! do n=1, num_prog_tracers
+! if (tracers_in_donner(n)) then
+! Input_don%tr_flux(:,:,nn) = 0.0
+! nn = nn + 1
+! endif
+! end do
+! else
+! Input_don%tr_flux = 0.
+! endif
+
+!-----------------------------------------------------------------------
+! define boundary layer kinetic energy to pass to donner deep routine.
+!-----------------------------------------------------------------------
+ Input_don%ke_bl = Input_mp%pblht
+ Input_don%ke_bl = min(max(Input_don%ke_bl, 0.0),5000.)
+ Input_don%ke_bl = Input_mp%ustar**3. + &
+ 0.6*Input_mp%ustar*Input_mp%bstar*Input_don%ke_bl
+ where (Input_don%ke_bl .gt. 0.)
+ Input_don%ke_bl = Input_don%ke_bl**(2./3.)
+ end where
+ Input_don%ke_bl = MAX (1.e-6, Input_don%ke_bl)
+
+!----------------------------------------------------------------------
+! define model time in days and secs from base time.
+!----------------------------------------------------------------------
+ call get_time (Time, Input_don%secs, Input_don%days)
+
+!---------------------------------------------------------------------
+
+
+end subroutine donner_prep
+
+
+
+!#######################################################################
+
+subroutine process_donner_output &
+ (Input_don, Input_mp, Output_don, Output_mp)
+
+!------------------------------------------------------------------------
+type(donner_input_type), intent(inout) :: Input_don
+type(mp_input_type), intent(inout) :: Input_mp
+type(conv_output_type), intent(inout) :: Output_don
+type(mp_output_type), intent(inout) :: Output_mp
+
+!-------------------------------------------------------------------------
+! Input_don donner_input_type variable containing input fields used by
+! donner_deep_mod
+! Input_mp derived type used to transfer needed input data between
+! moist_processes and convection_driver
+! Output_don conv_output_type variable containing output fields from
+! donner_deep_mod
+! Output_mp derived type used to transfer output fields between
+! convection_driver and moist_processes
+!-------------------------------------------------------------------------
+
+ real :: qnew
+ integer :: ix, jx, kx
+ integer :: i, j, k, n, nn
+
+!------------------------------------------------------------------------
+! qnew updated specific humidity after donner is executed
+! ix, jx, kx physics window sizes
+! i, j, k, n do loop indice
+! nn counter
+!------------------------------------------------------------------------
+
+!-----------------------------------------------------------------------
+! define array dimensions.
+!-----------------------------------------------------------------------
+ ix = size(Output_mp%rdt, 1)
+ jx = size(Output_mp%rdt, 2)
+ kx = size(Output_mp%rdt, 3)
+
+!---------------------------------------------------------------------
+! update the current tracer tendencies with the contributions
+! just obtained from donner convection.
+!---------------------------------------------------------------------
+ if (num_donner_tracers > 0) then
+ nn = 1
+ do n=1, num_prog_tracers
+ if (tracers_in_donner(n)) then
+ Output_mp%rdt(:,:,:,n) = Output_mp%rdt(:,:,:,n) + &
+ Input_don%qtr(:,:,:,nn)
+ nn = nn + 1
+ endif
+ end do
+ endif
+
+!--------------------------------------------------------------------
+! obtain updated vapor specific humidity (qnew) resulting from deep
+! convection so that the vapor specific humidity change due to deep
+! convection (delta_q) can be defined.
+!--------------------------------------------------------------------
+ do k=1,kx
+ do j=1,jx
+ do i=1,ix
+ if (Output_don%delta_vapor(i,j,k) /= 0.0) then
+ qnew = &
+ (Input_don%rin(i,j,k) + Output_don%delta_vapor(i,j,k))/ &
+ (1.0 + (Input_don%rin(i,j,k) + &
+ Output_don%delta_vapor(i,j,k)))
+ Output_don%delta_q(i,j,k) = qnew - Input_mp%qin(i,j,k)
+ else
+ Output_don%delta_q(i,j,k) = 0.
+ endif
+ enddo
+ enddo
+ end do
+
+!---------------------------------------------------------------------
+
+
+end subroutine process_donner_output
+
+
+
+!#######################################################################
+
+subroutine check_donner_conservation (is, js, ie, je, Input_mp, &
+ Output_don)
+
+!-----------------------------------------------------------------------
+! subroutine check_donner_conservation checks the water substance
+! and enthalpy changes in model columns as a result of donner deep
+! convection, and provides netcdf output of the appropriate terms and
+! net imbalances. Note that this is the raw output from the donner
+! scheme so that moisture imbalances are to be expected at this
+! juncture; they will be balanced if moisture conservation is enforced
+! in subroutine prevent_unrealizable_water.
+! a second call to this subroutine after adjustments are completed
+! is recommended if it is desired to see final balances. {ADD NEW CODE
+! TO ENABLE THIS OPTION.}
+!-----------------------------------------------------------------------
+
+!---------------------------------------------------------------------
+integer, intent(in) :: is, ie, js, je
+type(mp_input_type), intent(inout) :: Input_mp
+type(conv_output_type), intent(inout) :: Output_don
+
+!-------------------------------------------------------------------------
+! is,ie starting and ending i indices for window
+! js,je starting and ending j indices for window
+! Input_mp derived type used to transfer needed input data between
+! moist_processes and convection_driver
+! Output_don conv_output_type variable containing output fields from
+! donner_deep_mod
+!-------------------------------------------------------------------------
+!------------------------------------------------------------------------
+ real, dimension( size(Input_mp%t,1), size(Input_mp%t,2)) :: &
+ vaporint, lcondensint, condensint, diffint, &
+ enthint, enthdiffint, precipint
+ integer :: k, i, j
+ integer :: kx
+ logical :: used
+
+!-------------------------------------------------------------------------
+! vertical integrals in each model column.
+! vaporint: pressure-weighted sum of vapor changes in column
+! lcondensint: presuure-weighted sum of latent heat release in column
+! condensint: pressure-weighted sum of condensation in the column
+! diffint: imbalance between water substance change in column;
+! the sum of vapor change (vaporint) should balance the
+! column precipitation (precipint) and the condensate
+! transferred to the large-scale (condensint)
+! enthint : pressure-weighted sum of enthalpy changes in column
+! enthdiffint: imbalance in enthalpy change in column:
+! the enthalpy change in the column should be balanced by
+! the enthalpy associated with the latent heat removed by
+! 1) condensate that was transferred to the large-scale
+! clouds (lcondensint), and 2) lost by precipitation
+! (lheat_precip). An additional roundoff term due to
+! column vertical motion is also included (vert_motion).
+! precipint: precipitation rate from column
+!
+! i, j, k: do loop indices
+! kx vertical size of physics window
+! used logical used to indicate data has been received by
+! diag_manager_mod
+!-------------------------------------------------------------------------
+
+!------------------------------------------------------------------------
+! define vertical array size. initialize vertical integrals.
+!------------------------------------------------------------------------
+ kx = size(output_don%delta_temp,3)
+
+!--------------------------------------------------------
+! initialize column integrals.
+!--------------------------------------------------------
+ vaporint = 0.
+ lcondensint = 0.
+ condensint = 0.
+ diffint = 0.
+ enthint = 0.
+ enthdiffint = 0.
+
+!------------------------------------------------------------------------
+! compute vertical integrals in each model column.
+!------------------------------------------------------------------------
+ do k=1,kx
+ vaporint = vaporint + Input_mp%pmass(:,:,k)* &
+ Output_don%delta_q(:,:,k)
+ enthint = enthint + CP_AIR*Input_mp%pmass(:,:,k)* &
+ Output_don%delta_temp(:,:,k)
+ condensint = condensint + Input_mp%pmass(:,:,k) * &
+ (Output_don%delta_ql(:,:,k) + Output_don%delta_qi(:,:,k))
+ lcondensint = lcondensint + Input_mp%pmass(:,:,k) * &
+ (HLV*Output_don%delta_ql(:,:,k) + &
+ HLS*Output_don%delta_qi(:,:,k))
+ end do
+
+ precipint = Output_don%total_precip/seconds_per_day
+ diffint = (vaporint + condensint)*dtinv + precipint
+ enthdiffint = (enthint - lcondensint)*dtinv - &
+ Output_don%lheat_precip/seconds_per_day - &
+ Output_don%vert_motion/seconds_per_day
+
+!------------------------------------------------------------------------
+! update the variable collecting the maximum imbalance over the entire
+! model run, if the present imbalance value is larger than the
+! previously recorded.
+!------------------------------------------------------------------------
+ do j=1,size(enthdiffint,2)
+ do i=1,size(enthdiffint,1)
+ max_enthalpy_imbal_don(i+is-1,j+js-1) = &
+ max( abs(enthdiffint(i,j)), &
+ max_enthalpy_imbal_don(i+is-1,j+js-1) )
+ max_water_imbal_don(i+is-1,j+js-1) = &
+ max( abs(diffint(i,j)), &
+ max_water_imbal_don(i+is-1,j+js-1) )
+ end do
+ end do
+
+!------------------------------------------------------------------------
+! output diagnostics related to water and enthalpy conservation.
+!------------------------------------------------------------------------
+ used = send_data(id_max_enthalpy_imbal_don, &
+ max_enthalpy_imbal_don(is:ie,js:je), Time, is, js)
+ used = send_data(id_max_water_imbal_don, &
+ max_water_imbal_don(is:ie,js:je), Time, is, js)
+ used = send_data(id_vaporint, vaporint*dtinv, Time, is, js)
+ used = send_data(id_condensint, condensint*dtinv, Time, is, js)
+ used = send_data(id_vertmotion, &
+ Output_don%vert_motion/seconds_per_day, &
+ Time, is, js)
+ used = send_data(id_precipint, precipint, Time, is, js)
+ used = send_data(id_diffint, diffint, Time, is, js)
+ used = send_data(id_enthint, enthint*dtinv, Time, is, js)
+ used = send_data(id_lcondensint, lcondensint*dtinv, Time, is, js)
+ used = send_data(id_lprcp, Output_don%lheat_precip/seconds_per_day, &
+ Time, is, js)
+ used = send_data(id_enthdiffint, enthdiffint, Time, is, js)
+
+!-------------------------------------------------------------------------
+
+
+end subroutine check_donner_conservation
+
+
+
+!#######################################################################
+
+subroutine prevent_unrealizable_water &
+ (Input_mp, Output_don, Removal_mp, Don_tend)
+
+!--------------------------------------------------------------------------
+! subroutine prevent_unrealizable_water adjusts the tendencies coming
+! out of the donner deep parameterization to prevent the formation of
+! negative water vapor, liquid or ice.
+!--------------------------------------------------------------------------
+
+!-------------------------------------------------------------------------
+type(mp_input_type), intent(inout) :: Input_mp
+type(mp_removal_type), intent(inout) :: Removal_mp
+type(conv_output_type), intent(inout) :: Output_don
+type(conv_tendency_type), intent(inout) :: Don_tend
+!-----------------------------------------------------------------------
+
+!----------------------------------------------------------------------
+! Input_mp derived type used to transfer needed input data between
+! moist_processes and convection_driver
+! Removal_mp derived type used to transfer precipitation and tracer
+! removal fields between convection_driver and
+! moist_processes
+! Output_don conv_output_type variable containing output fields from
+! donner_deep_mod
+! Don_tend conv_tendency_type variable containing tendency output from
+! donner_deep_mod
+!-----------------------------------------------------------------------
+
+ real, dimension(size(Output_don%delta_q,1), &
+ size(Output_don%delta_q,2)) :: temp_2d
+ integer :: ix, jx, kx
+ integer :: i, j, k, n
+ integer :: nn
+
+!------------------------------------------------------------------------
+! temp_2d temporary array
+! ix, jx, kx physics window dimensions
+! i, j, k, n do loop indices
+! nn counter
+!----------------------------------------------------------------------
+
+!------------------------------------------------------------------------
+! define array sizes.
+!------------------------------------------------------------------------
+ ix = size(Input_mp%qin,1)
+ jx = size(Input_mp%qin,2)
+ kx = size(Input_mp%qin,3)
+
+!----------------------------------------------------------------------
+! if limiting tendencies is active, scale the precipitation fields and
+! associated enthalpy terms. precip returned from Donner scheme is
+! recalculated below, after the adjustments (precip_returned).
+!----------------------------------------------------------------------
+ if (doing_prog_clouds .and. do_limit_donner) then
+ do j=1,jx
+ do i=1,ix
+ if (Output_don%scale(i,j) /= 1.0) then
+ Output_don%total_precip(i,j) = &
+ Output_don%scale(i,j)* &
+ Output_don%total_precip(i,j)
+ Output_don%lheat_precip(i,j) = &
+ Output_don%scale(i,j)* &
+ Output_don%lheat_precip(i,j)
+ do k=1, kx
+ Output_don%liquid_precip(i,j,k) = &
+ Output_don%scale(i,j)* &
+ Output_don%liquid_precip(i,j,k)
+ Output_don%frozen_precip(i,j,k) = &
+ Output_don%scale(i,j)* &
+ Output_don%frozen_precip(i,j,k)
+ end do
+ endif
+ end do
+ end do
+
+!---------------------------------------------------------------------
+! prevent liquid and frozen precip from having negative values.
+!-------------------------------------------------------------------------
+ where ( Output_don%liquid_precip(:,:,:) .lt. 0.)
+ Output_don%liquid_precip(:,:,:) = 0.0
+ end where
+
+ where ( Output_don%frozen_precip(:,:,:) .lt. 0.)
+ Output_don%frozen_precip(:,:,:) = 0.0
+ end where
+
+!-------------------------------------------------------------------------
+! dimensions of liquid_precip is [kg(H20)/(kg s)]*(SECONDS_PER_DAY)
+! dimensions of frozen_precip is [kg(H20)/(kg s)]*(SECONDS_PER_DAY)
+!
+! Note that (dt/seconds_per_day) * sum of (liquid_precip(k) +
+! frozen_precip( k) *pmass(k)) gives precip_returned.
+!-------------------------------------------------------------------------
+ Output_don%precip_returned(:,:) = 0.0
+ do k=1, kx
+ Output_don%precip_returned(:,:) = &
+ Output_don%precip_returned(:,:) + &
+ (Output_don%liquid_precip(:,:,k) + &
+ Output_don%frozen_precip(:,:,k))* &
+ Input_mp%pmass(:,:,k) *dt/SECONDS_PER_DAY
+ end do
+
+ endif ! doing_clouds and do_limit_donner)
+
+!-----------------------------------------------------------------------
+! if one is to force moisture conservation with donner, then determine
+! the imbalance between the net pressure-weighted moisture changes in
+! each column and the predicted precip in that column (they should be
+! equal). this difference is Output_don%precip_adjustment.
+!-----------------------------------------------------------------------
+ if (force_donner_moist_conserv) then
+ temp_2d = 0.
+ do k=1,kx
+ temp_2d (:,:) = temp_2d (:,:) + (-Output_don%delta_q(:,:,k) - &
+ Output_don%delta_ql(:,:,k) - &
+ Output_don%delta_qi(:,:,k))* &
+ Input_mp%pmass(:,:,k)
+ end do
+ Output_don%precip_adjustment = (temp_2d - &
+ Output_don%precip_returned)
+
+!---------------------------------------------------------------------
+! process the water imbalance, so that it is resolved. define a new
+! scale (scale_REV) for those cases where donner convection must be
+! turned off because it will produce negative values of precipitation.
+!---------------------------------------------------------------------
+ Output_don%scale_REV = Output_don%scale
+ do j=1,jx
+ do i=1,ix
+
+!---------------------------------------------------------------------
+! If the net change of water content is less than qmin, the imbalance
+! is ignored.
+!---------------------------------------------------------------------
+ if (ABS(Output_don%precip_adjustment(i,j)) < 1.0e-10) then
+ Output_don%precip_adjustment (i,j) = 0.0
+ endif
+
+!-----------------------------------------------------------------------
+! a net gain to the sum of vapor, liquid and ice in the column implies
+! negative precip, which is unrealizable. in such a case any precip
+! that had been predicted in the column is zeroed out, and the effects
+! of donner convection on the column become non-existent. note that
+! additional arrays associated with the precip field must be modified
+! for consistency when a change is made, and any non-zero value for
+! scale is set to 0.0.
+!---------------------------------------------------------------------
+ if ( Output_don%precip_adjustment(i,j) < 0.0 .and. &
+ (Output_don%precip_adjustment(i,j) + &
+ Output_don%precip_returned(i,j)) < 0.0 ) then
+! write (warn_mesg,'(2i4,2e12.4)') i,j, &
+! precip_adjustment(i,j), precip_returned(i,j)
+! call error_mesg ('moist_processes_mod', 'moist_processes: &
+! &Change in water content does not balance precip &
+! &from donner_deep routine.'//trim(warn_mesg), WARNING)
+ Output_don%scale_REV(i,j) = 0.0
+ Output_don%delta_vapor(i,j,:) = 0.0
+ Output_don%delta_q(i,j,:) = 0.0
+ Output_don%delta_qi(i,j,:) = 0.0
+ Output_don%delta_ql(i,j,:) = 0.0
+ Output_don%delta_qa(i,j,:) = 0.0
+ Output_don%total_precip(i,j) = 0.0
+ Output_don%precip_returned(i,j) = 0.0
+ Output_don%liquid_precip(i,j,:) = 0.0
+ Output_don%frozen_precip(i,j,:) = 0.0
+ Output_don%lheat_precip(i,j) = 0.0
+ endif
+ end do
+ end do
+
+!---------------------------------------------------------------------
+! define the fractional change to the precipitation that must be made
+! in order to balance the net change in water in the column.
+!---------------------------------------------------------------------
+ do j=1,jx
+ do i=1,ix
+ if (Output_don%precip_returned(i,j) > 0.0) then
+ Output_don%adjust_frac(i,j) = &
+ Output_don%precip_adjustment(i,j)/ &
+ Output_don%precip_returned(i,j)
+ else
+ Output_don%adjust_frac(i,j) = 0.
+ endif
+ end do
+ end do
+
+!---------------------------------------------------------------------
+! if the predicted precip exceeds the net loss to vapor, liquid and
+! ice in the column, the precip is reduced by the adjustment fraction
+! so that a balance is obtained (adjust_frac is negative).
+! if the predicted precip is less than the net loss of vapor, liquid
+! and ice from the column, the precip is increased by the adjustment
+! fraction to balance that net loss adjust_frac is positive).
+! also adjust the temperature to balance the precip adjustment
+! and so conserve enthalpy in the column, and define the new values
+! of liquid and frozen precipitation after adjustment.
+!---------------------------------------------------------------------
+ do k=1,kx
+ Output_don%ttnd_adjustment(:,:,k) = &
+ ((HLV*Output_don%liquid_precip(:,:,k)* &
+ Output_don%adjust_frac(:,:) + &
+ HLS*Output_don%frozen_precip(:,:,k)* &
+ Output_don%adjust_frac(:,:)) &
+ *dt/seconds_per_day)/CP_AIR
+ Output_don%liquid_precip(:,:,k) = &
+ Output_don%liquid_precip(:,:,k)* &
+ (1.0+Output_don%adjust_frac(:,:))
+ Output_don%frozen_precip(:,:,k) = &
+ Output_don%frozen_precip(:,:,k)* &
+ (1.0+Output_don%adjust_frac(:,:))
+ end do
+
+!------------------------------------------------------------------------
+! define the adjustments to be 0.0 if conservation is not being forced.
+!------------------------------------------------------------------------
+ else ! (force_donner_moist_conserv)
+ Output_don%precip_adjustment = 0.0
+ Output_don%adjust_frac = 0.0
+ Output_don%ttnd_adjustment = 0.
+ endif ! (force_donner_moist_conserv)
+
+!-------------------------------------------------------------------------
+! define the column rainfall and snowfall from the donner scheme,
+! using the recently-adjusted values.
+!-------------------------------------------------------------------------
+ do k=1,kx
+ Don_tend%rain = Don_tend%rain + Output_don%liquid_precip(:,:,k)* &
+ Input_mp%pmass(:,:,k)/seconds_per_day
+ Don_tend%snow = Don_tend%snow + Output_don%frozen_precip(:,:,k)* &
+ Input_mp%pmass(:,:,k)/seconds_per_day
+ end do
+
+!----------------------------------------------------------------------
+! modify the 3d precip fluxes used by COSP to account for the
+! conservation adjustment.
+!----------------------------------------------------------------------
+ if (do_cosp) then
+ do k=1, kx
+ do j=1,jx
+ do i=1,ix
+ Removal_mp%frz_meso(i,j,k) = &
+ Removal_mp%frz_meso(i,j,k)*Input_mp%pmass(i,j,k)* &
+ Output_don%scale_REV(i,j)* &
+ (1.0 + Output_don%adjust_frac(i,j))/ &
+ SECONDS_PER_DAY
+ Removal_mp%liq_meso(i,j,k) = &
+ Removal_mp%liq_meso(i,j,k)*Input_mp%pmass(i,j,k)* &
+ Output_don%scale_REV(i,j)* &
+ (1.0 + Output_don%adjust_frac(i,j))/ &
+ SECONDS_PER_DAY
+ Removal_mp%frz_cell(i,j,k) = &
+ Removal_mp%frz_cell(i,j,k)*Input_mp%pmass(i,j,k)* &
+ Output_don%scale_REV(i,j)* &
+ (1.0 + Output_don%adjust_frac(i,j))/ &
+ SECONDS_PER_DAY
+ Removal_mp%liq_cell(i,j,k) = &
+ Removal_mp%liq_cell(i,j,k)*Input_mp%pmass(i,j,k)* &
+ Output_don%scale_REV(i,j)* &
+ (1.0 + Output_don%adjust_frac(i,j))/ &
+ SECONDS_PER_DAY
+ end do
+ end do
+ end do
+ endif
+
+!------------------------------------------------------------------------
+
+
+end subroutine prevent_unrealizable_water
+
+
+
+!#######################################################################
+
+
+subroutine define_output_fields &
+ (Input_mp, Input_don, Output_don, Conv_results, &
+ C2ls_mp, Don_tend)
+
+!------------------------------------------------------------------------
+! subroutine define_output_fields 1) defines quantities needed for use
+! by other modules, 2) updates the input fields which will be supplied
+! to other active moist_processes parameterizations, and 3) defines
+! donner tendencies in the desired units used in moist_processes_mod.
+!-------------------------------------------------------------------------
+
+type(mp_input_type), intent(inout) :: Input_mp
+type(donner_input_type), intent(inout) :: Input_don
+type(conv_output_type), intent(inout) :: Output_don
+type(conv_results_type), intent(inout) :: Conv_results
+type(mp_conv2ls_type), intent(in) :: C2ls_mp
+type(conv_tendency_type), intent(inout) :: Don_tend
+
+!-----------------------------------------------------------------------
+! Input_mp derived type used to transfer needed input data between
+! moist_processes and convection_driver
+! Input_don donner_input_type variable containing input
+! fields used by donner_deep_mod
+! Output_don conv_output_type variable containing output
+! fields from donner_deep_mod
+! Conv_results
+! conv_results_type variable containing variables
+! used in multiple convective parameterizations and for
+! diagnostic output
+! C2ls_mp derived type used to transfer data from convection_driver
+! to lscloud_driver via moist_processes.
+! Don_tend conv_tendency_type variable containing tendency
+! output form donner_deep_mod
+!---------------------------------------------------------------------
+
+ real, dimension(size(Input_mp%t,1), size(Input_mp%t,2), &
+ size(Input_mp%t,3)) :: targ, qarg
+ logical, dimension(size(Input_mp%t,1),size( Input_mp%t,2)) :: ltemp
+
+ integer :: ix, jx, kx
+ logical :: used
+ integer :: i, j, k
+
+!-----------------------------------------------------------------------
+! targ variable to hold temperature field passed to
+! subroutine detr_ice_num. that field will vary dependent
+! on namelist options selected
+! qarg variable to hold specific humidity field passed to
+! subroutine detr_ice_num. that field will vary dependent
+! on namelist options selected
+! ltemp temporary logical variable
+! ix, jx, kx physics window dimensions
+! used logical used to indicate data has been received by
+! diag_manager_mod
+! i, j, k do loop indices
+!-----------------------------------------------------------------------
+
+!------------------------------------------------------------------------
+! define array dimensions.
+!------------------------------------------------------------------------
+ ix = size(Input_mp%t,1)
+ jx = size(Input_mp%t,2)
+ kx = size(Input_mp%t,3)
+
+!-------------------------------------------------------------------------
+! if the option to allow only one convective scheme per column is
+! active, mark those columns which have undergone donner convection
+! so they will not be used in any other convection scheme.
+!-------------------------------------------------------------------------
+ if (only_one_conv_scheme_per_column) then
+ Conv_results%conv_calc_completed = &
+ (Don_tend%rain + Don_tend%snow) > 0.0
+ endif
+
+!-----------------------------------------------------------------------
+! if a realizability constraint is to be placed on total cloud fraction,
+! define the area remaining available for clouds from other schemes
+! after the donner cloud area has been accounted for.
+! Note also that if the entire area (>= 0.999) at any level is taken
+! up by donner clouds, then uw clouds will not be allowed in the
+! column ( set conv_calc_completed = T).
+!-----------------------------------------------------------------------
+ if (limit_conv_cloud_frac) then
+ ltemp = ANY(C2ls_mp%donner_humidity_area(:,:,:) >= 0.999, &
+ dim = 3)
+ where (ltemp(:,:)) Conv_results%conv_calc_completed(:,:) = .true.
+ Conv_results%available_cf_for_uw = MAX(0.999 - &
+ C2ls_mp%donner_humidity_area(:,:,:), 0.0)
+ endif
+
+!---------------------------------------------------------------------
+! convert the deltas in temperature, vapor specific humidity and
+! precipitation resulting from donner convection to time tendencies
+! of these quantities. include the temperature adjustment made due
+! to adjustments to ensure positive water fields.
+!---------------------------------------------------------------------
+ Don_tend%ttnd = Output_don%delta_temp*dtinv
+ Don_tend%ttnd = Don_tend%ttnd + Output_don%ttnd_adjustment*dtinv
+
+ Don_tend%qtnd = Output_don%delta_q*dtinv
+ Don_tend%qltnd = Output_don%delta_ql*dtinv
+ Don_tend%qitnd = Output_don%delta_qi*dtinv
+ Don_tend%qatnd = Output_don%delta_qa*dtinv
+
+!---------------------------------------------------------------------
+! update the values of temperature and vapor specific humidity to
+! include the effects of donner_deep convection. if mca was included
+! in the donner deep scheme, then this update has already been done.
+! define targ and qarg, the values to be passed to subroutine
+! detrain_ice_num. The ability to reproduce old buggy results where
+! detrain_ice_num received an un-updated temperature field is retained
+! at this time.
+!---------------------------------------------------------------------
+ if (keep_icenum_detrain_bug .and. .not. do_donner_mca) then
+ targ = Input_mp%tin
+ qarg = Input_mp%qin
+ Input_mp%tin = Input_mp%tin + Output_don%delta_temp
+ Input_mp%qin = Input_mp%qin + Output_don%delta_q(:,:,:)
+ else
+ Input_mp%tin = Input_mp%tin + Output_don%delta_temp
+ Input_mp%qin = Input_mp%qin + Output_don%delta_q
+ targ = Input_mp%tin
+ qarg = Input_mp%qin
+ endif
-!------------------------------------------------------------------------
-! initialize fields needed for call to wet deposition routine.
-!------------------------------------------------------------------------
- f_snow_berg = 0.
- C2ls_mp%wet_data = 0.0
- C2ls_mp%cloud_frac = 0.1
- C2ls_mp%cloud_wet = 1.e-3
- Tend_mp%qtnd_wet(:,:,:) = Tend_mp%qtnd(:,:,:)
if (doing_prog_clouds) then
- Tend_mp%qtnd_wet(:,:,:) = Tend_mp%qtnd_wet(:,:,:) + &
- Tend_mp%q_tnd(:,:,:,nql) + &
- Tend_mp%q_tnd(:,:,:,nqi)
- end if
+
+!------------------------------------------------------------------------
+! calculate the amount of ice particles detrained from the donner
+! convective clouds. Modify the ice particle number and ice particle
+! number tendency from physics to account for this detrainment. output
+! a diagnostic if desired.
+!------------------------------------------------------------------------
+ if (do_ice_num .and. detrain_ice_num) then
+ call detr_ice_num (targ, Output_don%delta_qi, &
+ Output_don%delta_qni)
+ Don_tend%qnitnd = Output_don%delta_qni*dtinv
+ endif
+
+!-------------------------------------------------------------------------
+! detrain liquid droplets if desired. the original code had a bug which
+! may be preserved for test purposes with the remain_detrain_bug nml
+! variable. assume 10 micron mean volume radius for detrained droplets.
+! Modify the particle number and particle number tendency from physics
+! to account for this detrainment. output a diagnostic if desired.
+!-------------------------------------------------------------------------
+ if (do_liq_num .and. detrain_liq_num) then
+ if (remain_detrain_bug ) then
+ Output_don%delta_qn = Output_don%delta_ql/1000.*3./ &
+ (4.*3.14*10.e-15)
+ else
+ Output_don%delta_qn = Output_don%delta_ql/1000.*3./ &
+ (4.*3.14e-15)
+ endif
+ Don_tend%qntnd = Output_don%delta_qn*dtinv
+ endif
+
+!-----------------------------------------------------------------------
+! update the largescale cloud fields and their total tendencies from
+! physics with the tendencies resulting from the donner deep
+! convection scheme.
+!-----------------------------------------------------------------------
+ Input_mp%tracer(:,:,:,nql) = Input_don%qlin + Output_don%delta_ql
+ Input_mp%tracer(:,:,:,nqi) = Input_don%qiin + Output_don%delta_qi
+ Input_mp%tracer(:,:,:,nqa) = Input_don%qain + Output_don%delta_qa
+ if (do_ice_num .and. detrain_ice_num) then
+ Input_mp%tracer(:,:,:,nqni) = Input_don%nilin + &
+ Output_don%delta_qni
+ endif
+ if (do_liq_num .and. detrain_liq_num) then
+ Input_mp%tracer(:,:,:,nqn) = Input_don%nllin + &
+ Output_don%delta_qn
+ endif
+ endif ! doing_prog_clouds
+
+!-----------------------------------------------------------------------
+
+
+end subroutine define_output_fields
+
+
+
+!#######################################################################
+
+subroutine donner_mca_driver (is, js, Input_mp, Input_don, Output_don, &
+ Removal_mp, Output_mp, Don_mca_tend)
+
+!-----------------------------------------------------------------------
+! subroutine donner_mca_driver makes the call to moist convective
+! adjustment that may be a part of the donner deep parameterization.
+!-----------------------------------------------------------------------
+
+!---------------------------------------------------------------------
+integer, intent(in) :: is, js
+type(mp_input_type), intent(inout) :: Input_mp
+type(donner_input_type), intent(inout) :: Input_don
+type(conv_output_type), intent(inout) :: Output_don
+type(mp_removal_type), intent(inout) :: Removal_mp
+type(mp_output_type), intent(inout) :: Output_mp
+type(conv_tendency_type), intent(inout) :: Don_mca_tend
+!---------------------------------------------------------------------
+
+!-----------------------------------------------------------------------
+! is,js starting i and j indices for window
+! Input_mp derived type used to transfer needed input data between
+! moist_processes and convection_driver
+! Input_don donner_input_type variable containing input
+! fields used by donner_deep_mod
+! Output_don conv_output_type variable containing output
+! fields from donner_deep_mod
+! Removal_mp derived type used to transfer precipitation and tracer
+! removal fields between convection_driver and
+! moist_processes
+! Output_mp derived type used to transfer output fields between
+! convection_driver and moist_processes
+! Don_mca_tend
+! conv_tendency_type variable containing tendency
+! output from the mca component of donner convection
+!-----------------------------------------------------------------------
+
+ integer :: ix, jx, kx
+ integer :: i, j, k, n
+ integer :: nn
+
+!-----------------------------------------------------------------------
+! ix, jx, kx physics window dimensions
+! i, j, k, n do loop indices
+! nn counter
+!-----------------------------------------------------------------------
+
+!------------------------------------------------------------------------
+! define array dimensions.
+!------------------------------------------------------------------------
+ ix = size(Input_mp%tin, 1)
+ jx = size(Input_mp%tin, 2)
+ kx = size(Input_mp%tin, 3)
+
+!----------------------------------------------------------------------
+! if donner mca is active, turn on its clock.
+!----------------------------------------------------------------------
+ call mpp_clock_begin (donner_mca_clock)
+
+!--------------------------------------------------------------------
+! call subroutine moist_conv to handle any shallow convection present
+! in the grid. this call is made without the optional lsc variables so
+! that no convective detrainment (and corresponding change in
+! large-scale cloud amount and area) occurs, consistent with this call
+! being intended to handle only shallow convection. The temp and vapor
+! fields are updated with any changes from deep convection before the
+! routine is called.
+!--------------------------------------------------------------------
+ call moist_conv (Input_mp%tin, Input_mp%qin, Input_mp%pfull, &
+ Input_mp%phalf, Input_mp%coldT, Don_mca_tend%ttnd, &
+ Don_mca_tend%qtnd, Don_mca_tend%rain, Don_mca_tend%snow,&
+ dtinv, Time, is, js, Output_don%donner_tracer, &
+ Input_don%qtr )
+
+!-----------------------------------------------------------------------
+! if the effects of the mca component of donner are to be seen by
+! COSP, define the associated precip fluxes.
+!-----------------------------------------------------------------------
+ if (do_cosp .and. include_donmca_in_cosp) then
+ do j=1,jx
+ do i=1,ix
+ if (Input_mp%coldT(i,j)) then
+ do k=1,kx
+ Removal_mp%mca_frz(i,j,k) = &
+ -1.0*Don_mca_tend%qtnd(i,j,k)*Input_mp%pmass(i,j,k)
+ Removal_mp%mca_liq(i,j,k) = 0.
+ end do
+ else
+ do k=1,kx
+ Removal_mp%mca_frz(i,j,k) = 0.
+ Removal_mp%mca_liq(i,j,k) = &
+ -1.0*Don_mca_tend%qtnd(i,j,k)*Input_mp%pmass(i,j,k)
+ end do
+ endif
+ end do
+ end do
+ endif
+
+!---------------------------------------------------------------------
+! update the current tracer tendencies with the contributions
+! just obtained from moist convective adjustment. currently there
+! is no tracer transport by this process, so qtr will be 0.0 for all
+! tracers.
+!---------------------------------------------------------------------
+ nn = 1
+ do n=1, num_prog_tracers
+ if (tracers_in_donner(n)) then
+ Output_mp%rdt(:,:,:,n) = Output_mp%rdt(:,:,:,n) + &
+ Input_don%qtr(:,:,:,nn)
+ nn = nn + 1
+ endif
+ end do
+
+!-----------------------------------------------------------------------
+! turn off the donner mca clock.
+!-----------------------------------------------------------------------
+ call mpp_clock_end (donner_mca_clock)
+
+!-----------------------------------------------------------------------
+
+
+end subroutine donner_mca_driver
+
+
+
+!########################################################################
+
+subroutine output_donner_diagnostics ( is, js, Input_mp, Conv_results, &
+ Moist_clouds_block, Input_don, Output_don, C2ls_mp, &
+ Don_tend, Don_mca_tend)
+
+!-----------------------------------------------------------------------
+! subroutine output_donner_diagnostics outputs various netcdf
+! diagnostics that are associated with donner deep convection.
+!-----------------------------------------------------------------------
+
+!--------------------------------------------------------------------
+integer, intent(in) :: is, js
+type(mp_input_type), intent(inout) :: Input_mp
+type(conv_results_type), intent(in) :: Conv_results
+type(clouds_from_moist_block_type), intent(inout) :: Moist_clouds_block
+type(donner_input_type), intent(inout) :: Input_don
+type(conv_output_type), intent(inout) :: Output_don
+type(mp_conv2ls_type), intent(in) :: C2ls_mp
+type(conv_tendency_type), intent(inout) :: Don_tend, Don_mca_tend
+!------------------------------------------------------------------------
+
+!-----------------------------------------------------------------------
+! is,js starting i and j indices for window
+! Input_mp derived type used to transfer needed input data between
+! moist_processes and convection_driver
+! Conv_results
+! conv_results_type variable containing variables
+! used in multiple convective parameterizations and for
+! diagnostic output
+! Moist_clouds_block
+! derived type used to transfer cloud data between
+! atmos_model and convection_driver via physics_driver and
+! moist_processes
+! Input_don donner_input_type variable containing input
+! fields used by donner_deep_mod
+! Output_don conv_output_type variable containing output
+! fields from donner_deep_mod
+! C2ls_mp derived type used to transfer data from convection_driver
+! to lscloud_driver via moist_processes.
+! Don_tend conv_tendency_type variable containing tendency
+! output from donner convection
+! Don_mca_tend
+! conv_tendency_type variable containing tendency
+! output from the mca component of donner convection
+!-----------------------------------------------------------------------
+
+ logical, dimension(size(Input_mp%t,1),size(Input_mp%t,2)) :: &
+ ltemp
+ real, dimension(size(Don_tend%ttnd,1), &
+ size(Don_tend%ttnd,2)) :: temp_2d
+
+ logical :: used
+ integer :: ix, jx, kx
+ integer :: k, n
+
+!----------------------------------------------------------------------
+! ltemp temporary logical array
+! temp_2d temporary real array
+! used logical used to indicate data has been received by
+! diag_manager_mod
+! ix, jx, kx physics window dimensions
+! k, n do loop indices
+!----------------------------------------------------------------------
+
+!-----------------------------------------------------------------------
+! define array dimensions.
+!-----------------------------------------------------------------------
+ ix = size(Don_tend%ttnd, 1)
+ jx = size(Don_tend%ttnd, 2)
+ kx = size(Don_tend%ttnd, 3)
+
+!-----------------------------------------------------------------------
+! output scaling factors which were applied to donner tendencies to
+! preserve realizable water quantities. the difference between scale
+! and scale_REV reflects the absence of scaling where no conservation
+! is possible.
+!-----------------------------------------------------------------------
+ used = send_data (id_scale_donner, Output_don%scale, &
+ Time, is, js )
+ used = send_data (id_scale_donner_REV, Output_don%scale_REV, &
+ Time, is, js )
+
+!--------------------------------------------------------------------
+! output diagnostics for the time tendencies of temperature, vapor
+! specific humidity and large scale cloud fields, and various precip
+! and mass flux diagnostics due to donner deep convection.
+!--------------------------------------------------------------------
+ used = send_data (id_tdt_deep_donner, Don_tend%ttnd, Time, is, js, 1)
+ used = send_data (id_qdt_deep_donner, Don_tend%qtnd, Time, is, js, 1)
+ used = send_data (id_qadt_deep_donner, Don_tend%qatnd, &
+ Time, is, js, 1)
+ used = send_data (id_qldt_deep_donner, Don_tend%qltnd, &
+ Time, is, js, 1)
+ used = send_data (id_qidt_deep_donner, Don_tend%qitnd, &
+ Time, is, js, 1)
+
+ used = send_data (id_mc_donner, Conv_results%mc_donner, &
+ Time, is, js, 1)
+ used = send_data (id_mc_donner_half, Conv_results%mc_donner_half, &
+ Time, is, js, 1 )
+ used = send_data (id_m_cdet_donner, Conv_results%donner_det_mflux, &
+ Time, is, js, 1 )
+ used = send_data (id_m_cellup, Conv_results%donner_mflux, &
+ Time, is, js, 1 )
+ used = send_data (id_snow_deep_donner, Don_tend%snow, Time, is, js)
+ used = send_data (id_prec_deep_donner, &
+ Don_tend%rain + Don_tend%snow, Time, is, js )
+ used = send_data (id_prec1_deep_donner, &
+ Output_don%precip_adjustment, Time, is, js, &
+ mask = Output_don%precip_returned > 0.0)
+ used = send_data (id_precret_deep_donner, &
+ Output_don%precip_returned, Time, is, js)
+ if (do_donner_mca) then
+ used = send_data (id_don_precip, Don_tend%rain + Don_tend%snow + &
+ Don_mca_tend%rain + Don_mca_tend%snow, &
+ Time, is, js)
+ if (id_don_freq > 0) then
+ ltemp = Don_tend%rain > 0. .or. Don_tend%snow > 0.0 .or. &
+ Don_mca_tend%rain > 0. .or. Don_mca_tend%snow > 0.0
+ where (ltemp)
+ temp_2d = 1.
+ elsewhere
+ temp_2d = 0.
+ end where
+ used = send_data (id_don_freq, temp_2d, Time, is, js)
+ endif
+ else
+ used = send_data (id_don_precip, Don_tend%rain + Don_tend%snow, &
+ Time, is, js)
+ if (id_don_freq > 0) then
+ ltemp = Don_tend%rain > 0. .or. Don_tend%snow > 0.0
+ where (ltemp)
+ temp_2d = 1.
+ elsewhere
+ temp_2d = 0.
+ end where
+ used = send_data (id_don_freq, temp_2d, Time, is, js)
+ endif
+ endif
+
+!------------------------------------------------------------------------
+! if donner conservation checks have been done, output various
+! diagnostics describing the results.
+!------------------------------------------------------------------------
+ if (do_donner_conservation_checks) then
+ used = send_data (id_enth_donner_col2, -hlv*Don_tend%rain, &
+ Time, is, js)
+ used = send_data (id_enth_donner_col3, -hls*Don_tend%snow, &
+ Time, is, js)
+ if (id_enth_donner_col4 > 0) &
+ call column_diag(id_enth_donner_col4, is, js, Time, &
+ Don_tend%ttnd(:,:,:), CP_AIR, Input_mp%pmass)
+ if (id_enth_donner_col5 > 0) &
+ call column_diag(id_enth_donner_col5, is, js, Time, &
+ Output_don%delta_ql(:,:,:), -HLV*dtinv, &
+ Output_don%delta_qi(:,:,:), -HLS*dtinv, &
+ Input_mp%pmass)
+ if (id_enth_donner_col6 > 0) &
+ call column_diag(id_enth_donner_col6, is, js, Time, &
+ Output_don%ttnd_adjustment, CP_AIR, &
+ Input_mp%pmass)
+ used = send_data (id_enth_donner_col7, Output_don%adjust_frac, &
+ Time, is, js)
+
+!------------------------------------------------------------------------
+! compute and output column enthalpy change due to donner deep
+! convection.
+!------------------------------------------------------------------------
+ temp_2d = 0.
+ do k=1,kx
+ temp_2d(:,:) = temp_2d(:,:) + &
+ (-HLV*Output_don%liquid_precip(:,:,k)/seconds_per_day - &
+ hls*Output_don%frozen_precip(:,:,k)/seconds_per_day + &
+ CP_AIR*Don_tend%ttnd(:,:,k) - &
+ (HLV*Don_tend%qltnd(:,:,k) + HLS*Don_tend%qitnd(:,:,k)))* &
+ Input_mp%pmass(:,:,k)
+ end do
+ used = send_data (id_enth_donner_col, temp_2d, Time, is, js)
+
+!------------------------------------------------------------------------
+! compute and output column water change due to donner deep convection.
+!------------------------------------------------------------------------
+ if (id_wat_donner_col > 0) then
+ temp_2d = Don_tend%rain + Don_tend%snow
+ call column_diag (id_wat_donner_col, is, js, Time, &
+ Don_tend%qtnd, 1.0, Output_don%delta_ql, &
+ dtinv, Output_don%delta_qi, dtinv, &
+ Input_mp%pmass, temp_2d)
+ endif
+ endif ! (donner_conservation_checks)
+
+!------------------------------------------------------------------------
+! output additional diagnostics related to the clouds associated with
+! donner convection.
+!------------------------------------------------------------------------
+ used = send_data (id_cell_cld_frac, &
+ Moist_clouds_block%cloud_data(i_cell)%cloud_area, &
+ Time, is, js, 1 )
+ used = send_data (id_meso_cld_frac, &
+ Moist_clouds_block%cloud_data(i_meso)%cloud_area, &
+ Time, is, js, 1)
+ used = send_data (id_donner_humidity_area, &
+ C2ls_mp%donner_humidity_area(:,:,:), Time, is, js, 1 )
+
+
+ if (doing_prog_clouds) then
+ if (do_ice_num .and. detrain_ice_num) then
+ used = send_data (id_qnidt_deep_donner, Don_tend%qnitnd, &
+ Time, is, js, 1)
+ endif
+
+!-------------------------------------------------------------------------
+! detrain liquid droplets if desired. the original code had a bug which
+! may be preserved for test purposes with the remain_detrain_bug nml
+! variable. assume 10 micron mean volume radius for detrained droplets.
+! Modify the particle number and particle number tendency from physics
+! to account for this detrainment. output a diagnostic if desired.
+!-------------------------------------------------------------------------
+ if (do_liq_num .and. detrain_liq_num) then
+ used = send_data (id_qndt_deep_donner, &
+ Don_tend%qntnd, Time, is, js, 1)
+ endif
+ endif ! doing_prog_clouds
+
+!-----------------------------------------------------------------------
+! output diagnostics associated with the donner mca component.
+!-----------------------------------------------------------------------
+ if (do_donner_mca) then
+
+!--------------------------------------------------------------------
+! output the time tendencies of temperature, vapor specific humid-
+! ity, precipitation and snow due to the moist convective
+! adjustment pass of the donner parameterization.
+!--------------------------------------------------------------------
+ used = send_data (id_tdt_mca_donner, Don_mca_tend%ttnd, &
+ Time, is, js, 1)
+ used = send_data (id_qdt_mca_donner, Don_mca_tend%qtnd, &
+ Time, is, js, 1)
+ used = send_data (id_prec_mca_donner, &
+ Don_mca_tend%rain+Don_mca_tend%snow, Time, is, js)
+ used = send_data (id_snow_mca_donner, Don_mca_tend%snow, &
+ Time, is, js)
+
+!------------------------------------------------------------------------
+! output the column imbalances of enthalpy and water resulting from the
+! mca component of donner convection.
+!------------------------------------------------------------------------
+ if (id_enth_mca_donner_col > 0) then
+ temp_2d = -HLV*Don_mca_tend%rain -HLS*Don_mca_tend%snow
+ call column_diag(id_enth_mca_donner_col, is, js, Time, &
+ Don_mca_tend%ttnd, CP_AIR, Input_mp%pmass, temp_2d)
+ endif
+
+ if (id_wat_mca_donner_col > 0) then
+ temp_2d = Don_mca_tend%rain + Don_mca_tend%snow
+ call column_diag(id_wat_mca_donner_col, is, js, Time, &
+ Don_mca_tend%qtnd, 1.0, Input_mp%pmass, temp_2d)
+ endif
+
+!--------------------------------------------------------------------
+! output the time tendencies of tracer and of column tracer
+! due to the moist convective adjustment pass of the donner
+! parameterization. currently moist convective adjustment does not
+! affect the tracer fields, so these fields are always 0.0.
+!--------------------------------------------------------------------
+ do n=1,num_donner_tracers
+ if ( id_tracerdt_mcadon(n) > 0 ) &
+ used = send_data(id_tracerdt_mcadon(n), &
+ Input_don%qtr(:,:,:,n), Time, is, js, 1 )
+ if (id_tracerdt_mcadon_col(n) > 0 ) &
+ call column_diag(id_tracerdt_mcadon_col(n), is, js, Time, &
+ Input_don%qtr(:,:,:,n), 1.0, Input_mp%pmass)
+ enddo
+
+ endif ! (do_donner_mca)
+
+!-----------------------------------------------------------------------
+
+
+end subroutine output_donner_diagnostics
+
+
+
+!#######################################################################
+
+subroutine donner_dealloc (Input_don, Output_don, Don_tend, &
+ Don_mca_tend)
+
+!-------------------------------------------------------------------
+! subroutine donner_dealloc deallocates the components of the
+! derived type variables rsident in subroutine donner_driver.
+!-------------------------------------------------------------------
+
+type(donner_input_type), intent(inout) :: Input_don
+type(conv_output_type), intent(inout) :: Output_don
+type(conv_tendency_type), intent(inout) :: Don_tend, Don_mca_tend
+
+!--------------------------------------------------------------------
+! Input_don donner_input_type variable containing input
+! fields used by donner_deep_mod
+! Output_don conv_output_type variable containing output
+! fields from donner_deep_mod
+! Don_tend conv_tendency_type variable containing tendency
+! output from donner convection
+! Don_mca_tend
+! conv_tendency_type variable containing tendency
+! output from the mca component of donner convection
+!-----------------------------------------------------------------------
+
+!-------------------------------------------------------------------
+! deallocate the components of Input_don.
+!-------------------------------------------------------------------
+ deallocate (Input_don%rin)
+ deallocate (Input_don%sfc_sh_flux)
+ deallocate (Input_don%sfc_vapor_flux)
+ deallocate (Input_don%tr_flux)
+ deallocate (Input_don%ke_bl)
+ deallocate (Input_don%maxTe_launch_level)
+ deallocate (Input_don%qtr)
+ deallocate (Input_don%qlin)
+ deallocate (Input_don%qiin)
+ deallocate (Input_don%qain)
+ deallocate (Input_don%nllin)
+ deallocate (Input_don%nilin)
+
+!-------------------------------------------------------------------
+! deallocate the components of Output_don.
+!-------------------------------------------------------------------
+ deallocate (Output_don%delta_temp)
+ deallocate (Output_don%delta_vapor)
+ deallocate (Output_don%delta_q )
+ deallocate (Output_don%delta_ql )
+ deallocate (Output_don%delta_qi )
+ deallocate (Output_don%delta_qa )
+ deallocate (Output_don%delta_qn )
+ deallocate (Output_don%delta_qni )
+ deallocate (Output_don%ttnd_adjustment)
+ deallocate (Output_don%liquid_precip )
+ deallocate (Output_don%frozen_precip )
+ deallocate (Output_don%lheat_precip )
+ deallocate (Output_don%vert_motion )
+ deallocate (Output_don%total_precip )
+ deallocate (Output_don%scale )
+ deallocate (Output_don%scale_REV )
+ deallocate (Output_don%precip_adjustment)
+ deallocate (Output_don%precip_returned )
+ deallocate (Output_don%adjust_frac )
+ deallocate (Output_don%donner_tracer )
+
+!-------------------------------------------------------------------
+! deallocate the components of Don_tend.
+!-------------------------------------------------------------------
+ deallocate (Don_tend%delta_q)
+ deallocate (Don_tend%rain)
+ deallocate (Don_tend%snow)
+ deallocate (Don_tend%ttnd)
+ deallocate (Don_tend%qtnd)
+ deallocate (Don_tend%qtr )
+ if (doing_prog_clouds) then
+ deallocate (Don_tend%qltnd)
+ deallocate (Don_tend%qitnd)
+ deallocate (Don_tend%qatnd)
+ deallocate (Don_tend%qntnd)
+ deallocate (Don_tend%qnitnd)
+ endif
+
+!-------------------------------------------------------------------
+! deallocate the components of Don_mca_tend.
+!-------------------------------------------------------------------
+ if (do_donner_mca) then
+ deallocate (Don_mca_tend%rain)
+ deallocate (Don_mca_tend%snow)
+ deallocate (Don_mca_tend%ttnd)
+ deallocate (Don_mca_tend%qtnd)
+ deallocate (Don_mca_tend%qtr )
+ endif
+
+!--------------------------------------------------------------------
+
+
+end subroutine donner_dealloc
+
+
+
+!#######################################################################
+
+
+
+!*******************************************************************
+!
+! PRIVATE, DRY ADJUSTMENT-RELATED SUBROUTINES
+!
+!*******************************************************************
+
+
+!######################################################################
+
+subroutine dca_driver (is, js, Input_mp, Output_mp, Tend_mp)
!---------------------------------------------------------------------
-! for each tracer for which wet deposition has been requested, call
-! subrouitine wet_deposition to calculate the tracer tendency due to
-! wet deposition (wetdeptnd) caused by the convectively generated
-! precipitation (rain, snow).
+! subroutine dca_driver prepares for, calls, and handles the output from
+! the dry convective adjustment parameterization.
!---------------------------------------------------------------------
- do n=1, nt
- if (.not. cloud_tracer(n)) then
- Tend_mp%wetdeptnd(:,:,:) = 0.0
- call wet_deposition &
- (n, Input_mp%t, Input_mp%pfull, Input_mp%phalf, &
- Input_mp%zfull, Input_mp%zhalf, rain_ras, snow_ras, &
- Tend_mp%qtnd_wet, C2ls_mp%cloud_wet, C2ls_mp%cloud_frac, &
- f_snow_berg, rain3d, snow3d, Input_mp%tracer(:,:,:,n), &
- Tend_mp%wetdeptnd, Time, 'convect', is, js, dt )
-!-----------------------------------------------------------------------
-! add this tendency to the tracer tendency due to all physics (rdt).
-! save it also in an array which will be combined with any wet
-! deposition resulting from large-scale precip producing the total wet
-! deposition for the tracer (wet_data).
+integer, intent(in) :: is, js
+type(mp_input_type), intent(inout) :: Input_mp
+type(mp_output_type), intent(inout) :: Output_mp
+type(mp_tendency_type), intent(inout) :: Tend_mp
+
+!----------------------------------------------------------------------
+! is,js starting i and j indices for window
+! Input_mp derived type used to transfer needed input data between
+! moist_processes and convection_driver
+! Output_mp derived type used to transfer output fields between
+! convection_driver and moist_processes
+! Tend_mp derived type used to transfer calculated tendency data
+! between convection_driver and moist_processes
!---------------------------------------------------------------------
- Output_mp%rdt (:,:,:,n) = Output_mp%rdt(:,:,:,n) - &
- Tend_mp%wetdeptnd(:,:,:)
- C2ls_mp%wet_data(:,:,:,n) = Tend_mp%wetdeptnd(:,:,:)
- endif
- end do
-!------------------------------------------------------------------------
-! define total convective mass flux from all sources, at both full
-! levels and at half levels.
-!------------------------------------------------------------------------
- C2ls_mp%mc_full(:,:,1)=0.;
- C2ls_mp%mc_half(:,:,1)=0.;
- do k=2,kx
- C2ls_mp%mc_full(:,:,k) = 0.5*(mc(:,:,k) + mc(:,:,k+1)) + &
- 0.5*(cmf(:,:,k)+cmf(:,:,k-1)) + &
- mc_donner(:,:,k)
- end do
- do k=2,kx+1
- C2ls_mp%mc_half(:,:,k) = mc(:,:,k) + &
- cmf(:,:,k-1)+ &
- mc_donner_half(:,:,k)
- end do
+ real, dimension(size(Input_mp%t,1),size(Input_mp%t,2), &
+ size(Input_mp%t,3)) :: delta_temp
+ type(conv_tendency_type) :: Dca_tend
+ logical :: used
+ integer :: ix, jx, kx
!---------------------------------------------------------------------
-! output diagnostics:
-! total cumulus mass flux on full levels,
-! total cumulus mass flux on half levels,
-! total cumulus mass flux on half levels (CMOR standard).
+! delta_temp
+! Dca_tend conv_tendency_type variable containing tendency
+! output from dry convective adjustment parameterization
+! used logical used to indicate data has been received by
+! diag_manager_mod
+! ix, jx, kx physics window dimensions
!---------------------------------------------------------------------
- used = send_data (id_mc_full, C2ls_mp%mc_full, Time, is, js, 1)
- used = send_data (id_mc_half, C2ls_mp%mc_half, Time, is, js, 1)
- used = send_cmip_data_3d (ID_mc, C2ls_mp%mc_half, Time, is, js, 1)!, rmask=mask)
-! used = send_data (id_mc , C2ls_mp%mc_half, Time, is, js, 1)
!---------------------------------------------------------------------
-! total convective updraft mass flux (uw + donner cell up +
-! donner meso up)
+! activate dca_clock.
!---------------------------------------------------------------------
- if (id_mc_conv_up > 0 ) &
- used = send_data (id_mc_conv_up, cmf(:,:,:) + &
- mc_donner_up(:,:,:), Time, is, js, 1 )
-
-!------------------------------------------------------------------------
-! define convective cloud base and cloud top. these are needed if
-! diagnostics defining the temporal and spatial location of convection
-! are desired or if tracer "no" is present, so that the nox tendency
-! due to lightning may be calculated.
-!------------------------------------------------------------------------
- if (get_tracer_index(MODEL_ATMOS,'no') .ne. NO_TRACER &
- .or. id_conv_freq > 0 &
- .or. id_ci > 0 &
- .or. id_conv_cld_base > 0 &
- .or. id_ccb > 0 &
- .or. id_cct > 0 &
- .or. id_conv_cld_top > 0 ) then
+ call mpp_clock_begin (dca_clock)
- cldbot = 0
- cldtop = 0
- do j = 1,jx
- do i = 1,ix
- do k = 1,kx
- if (C2ls_mp%mc_full(i,j,k) /= 0.0 ) then
- cldtop(i,j) = k
- exit
- endif
- enddo
- do k = size(Input_mp%r,3),1,-1
- if (C2ls_mp%mc_full(i,j,k) /= 0.0 ) then
- cldbot(i,j) = k
- exit
- endif
- enddo
- enddo
- enddo
- end if
+!--------------------------------------------------------------------
+! define local array dimensions.
+!--------------------------------------------------------------------
+ ix = size(Input_mp%t,1)
+ jx = size(Input_mp%t,2)
+ kx = size(Input_mp%t,3)
-!------------------------------------------------------------------------
-! output diagnostics related to convective cloud base and cloud top.
-! both FMS-standard and CMOR-standard output variables are currently
-! present.
-!------------------------------------------------------------------------
- if ( id_conv_cld_base > 0 ) then
- temp_2d = missing_value
- do j = 1,jx
- do i = 1,ix
- if ( cldbot(i,j) > 0 ) temp_2d(i,j) = &
- Input_mp%pfull(i,j,cldbot(i,j))
- end do
- end do
- used = send_data(id_conv_cld_base, temp_2d, Time, is_in=is, &
- js_in=js, mask = cldbot > 0)
- end if
+!--------------------------------------------------------------------
+! allocate and initialize tendency array.
+!--------------------------------------------------------------------
+ allocate (Dca_tend%ttnd(ix, jx, kx))
+ Dca_tend%ttnd = 0.
- if ( id_ccb > 0 ) then
- temp_2d = CMOR_MISSING_VALUE
- do j = 1,jx
- do i = 1,ix
- if ( cldbot(i,j) > 0 ) temp_2d(i,j) = &
- Input_mp%pfull(i,j,cldbot(i,j))
- end do
- end do
- used = send_data(id_ccb, temp_2d, Time, is_in=is, &
- js_in=js, mask = cldbot > 0)
- end if
+!---------------------------------------------------------------------
+! call subroutine dry_adj to obtain the temperature tendencies which
+! must be applied to adjust each column to a non-superadiabatic lapse
+! rate.
+!---------------------------------------------------------------------
+ call dry_adj (Input_mp%tin, Input_mp%pfull, Input_mp%phalf, &
+ delta_temp)
- if ( id_conv_cld_top > 0 ) then
- temp_2d = missing_value
- do j = 1,jx
- do i = 1,ix
- if ( cldtop(i,j) > 0 ) temp_2d(i,j) = &
- Input_mp%pfull(i,j,cldtop(i,j))
- end do
- end do
- used = send_data(id_conv_cld_top, temp_2d, Time, is_in=is, &
- js_in=js, mask = cldtop > 0)
- end if
+!-------------------------------------------------------------------
+! add the temperature change due to dry adjustment to the current
+! temperature. convert the temperature change to a heating rate.
+!-------------------------------------------------------------------
+ Input_mp%tin = Input_mp%tin + delta_temp
+ Dca_tend%ttnd = delta_temp*dtinv
- if ( id_cct > 0 ) then
- temp_2d = CMOR_MISSING_VALUE
- do j = 1,jx
- do i = 1,ix
- if ( cldtop(i,j) > 0 ) temp_2d(i,j) = &
- Input_mp%pfull(i,j,cldtop(i,j))
- end do
- end do
- used = send_data(id_cct, temp_2d, Time, is_in=is, &
- js_in=js, mask = cldtop > 0)
- end if
+!---------------------------------------------------------------------
+! output the temperature tendency from dry adjustment, if desired.
+!---------------------------------------------------------------------
+ used = send_data (id_tdt_dadj, Dca_tend%ttnd, Time, is, js, 1 )
-!-----------------------------------------------------------------------
-! calculate NOx tendency from lightning and add it to the tendency
-! field.
-!-----------------------------------------------------------------------
- if ( get_tracer_index(MODEL_ATMOS,'no') .ne. NO_TRACER ) then
- call moz_hook &
- (cldtop, cldbot, Input_mp%land, Input_mp%zfull, &
- Input_mp%zhalf, Input_mp%t, prod_no, Input_mp%area, &
- Input_mp%lat, Time, is, js)
-! conc_air
- Output_mp%rdt(:,:,:,get_tracer_index(MODEL_ATMOS,'no')) = &
- Output_mp%rdt(:,:,:,get_tracer_index(MODEL_ATMOS,'no')) + &
- prod_no* ((boltz * Input_mp%t) / (10. * Input_mp%pfull))
- used = send_data(id_prod_no, prod_no, Time, is_in=is, js_in=js)
- used = send_cmip_data_3d (ID_emilnox_area, & ! convert molec/cm3/s to mol/m2/s
- prod_no*1.e6*(Input_mp%zhalf(:,:,1:kx)-Input_mp%zhalf(:,:,2:kx+1))/AVOGNO, &
- Time, is, js, 1, phalf=log(Input_mp%phalf))
- endif
+!----------------------------------------------------------------------
+! call update_outputs to update the arrays which will return the
+! convective tendencies to moist_processes.
+!----------------------------------------------------------------------
+ call update_outputs (Dca_tend, Output_mp, Tend_mp)
-!-----------------------------------------------------------------------
-! define the total precipitation rate (precip).
-!-----------------------------------------------------------------------
- precip = Output_mp%lprec + Output_mp%fprec
+!----------------------------------------------------------------------
+! deallocate local arrays and turn off the dca clock.
+!----------------------------------------------------------------------
+ deallocate (Dca_tend%ttnd)
+ call mpp_clock_end (dca_clock)
!---------------------------------------------------------------------
-! apply changes resulting from uw_conv. scale if necessary to maintain
-! realizability. output a diagnostic for the scale.
-!---------------------------------------------------------------------
- if (do_uw_conv) then
- if (do_limit_uw) then
- call moistproc_scale_uw &
- (is, ie, js, je, dt, Input_mp%qin, Input_mp%tracer, &
- Output_mp%tdt, Output_mp%rdt(:,:,:,1), Output_mp%udt, &
- Output_mp%vdt, Output_mp%rdt, Tend_mp%ttnd_conv, &
- Tend_mp%qtnd_conv, Output_mp%lprec, Output_mp%fprec, &
- precip, qtruw, rain_uw, snow_uw, ttnd_uw, qtnd_uw, &
- utnd_uw, vtnd_uw, qltnd_uw, qitnd_uw, qatnd_uw, qntnd_uw, &
- qnitnd_uw, doing_prog_clouds, do_liq_num, num_prog_tracers,&
- Removal_mp_control%tracers_in_uw, scale, do_ice_num)
- else
- scale = 1.0
- endif
- used = send_data (id_scale_uw, scale, Time, is, js )
-!-------------------------------------------------------------------------
-! update input fields with changes from uw_conv
-!-------------------------------------------------------------------------
- Input_mp%tin = Input_mp%tin + ttnd_uw*dt
- Input_mp%qin = Input_mp%qin + qtnd_uw*dt
- Input_mp%uin = Input_mp%uin + utnd_uw*dt
- Input_mp%vin = Input_mp%vin + vtnd_uw*dt
- Input_mp%tracer(:,:,:,nql) = Input_mp%tracer(:,:,:,nql) + &
- qltnd_uw*dt
- Input_mp%tracer(:,:,:,nqi) = Input_mp%tracer(:,:,:,nqi) + &
- qitnd_uw*dt
- Input_mp%tracer(:,:,:,nqa) = Input_mp%tracer(:,:,:,nqa) + &
- qatnd_uw*dt
- if (do_liq_num) then
- Input_mp%tracer(:,:,:,nqn) = Input_mp%tracer(:,:,:,nqn) + &
- qntnd_uw*dt
- endif
- if (do_ice_num) then
- Input_mp%tracer(:,:,:,nqni) = Input_mp%tracer(:,:,:,nqni) + &
- qnitnd_uw*dt
- endif
- endif !(uw_conv)
-!-----------------------------------------------------------------------
-! Note: the following two blocks of code were moved from before to after
-! the call to moistproc_scale_uw in order to account for UW convection
-! contributions to 'precip'. This will change answers if UW is active
-! and do_gust_cv = .true. or entrain_nml:convect_shutoff = .true. (cjg)
+end subroutine dca_driver
+
+
+
+!######################################################################
+
+
+!*******************************************************************
!
-! calculate convective gustiness, if desired.
-!-----------------------------------------------------------------------
- if (do_gust_cv) then
- where((precip) > 0.0)
- Output_mp%gust_cv = gustmax*sqrt( precip/(gustconst + precip) )
- end where
- end if
+! PRIVATE, BETTS-MILLER-RELATED SUBROUTINES
+!
+!*******************************************************************
- if (do_gust_cv_new) then
- Output_mp%gust_cv = sqrt(Phys_mp_exch%cgust)
- end if
+!#######################################################################
+subroutine betts_miller_driver (is, js, Input_mp, Output_mp, Tend_mp)
+
+!------------------------------------------------------------------
+! subroutine betts_miller_driver prepares for, calls, and handles the
+! output from the three flavors of the betts-miller convective
+! parameterization.
+!------------------------------------------------------------------
+
+integer, intent(in) :: is, js
+type(mp_input_type), intent(inout) :: Input_mp
+type(mp_output_type), intent(inout) :: Output_mp
+type(mp_tendency_type), intent(inout) :: Tend_mp
+
+!----------------------------------------------------------------------
+! is,js starting i and j indices for window
+! Input_mp derived type used to transfer needed input data between
+! moist_processes and convection_driver
+! Output_mp derived type used to transfer output fields between
+! convection_driver and moist_processes
+! Tend_mp derived type used to transfer calculated tendency data
+! between convection_driver and moist_processes
!---------------------------------------------------------------------
-! save a field indicating whether or not convection has occurred
-! within the column.
-!---------------------------------------------------------------------
- where (precip > 0.) Output_mp%convect = .true.
+
+ real, dimension(size(Input_mp%qin,1), &
+ size(Input_mp%qin,2), size(Input_mp%qin,3)) :: &
+ RH, t_ref, q_ref, massflux
+ real, dimension(size(Input_mp%qin,1), size(Input_mp%qin,2)) :: &
+ bmflag, klzbs, invtaubmt, invtaubmq, cape, cin
+ type(conv_tendency_type) :: BM_tend
+ logical :: used, alpha
+ integer :: ix, jx, kx
!---------------------------------------------------------------------
-! update tracer fields with tendencies due to convection and wet
-! deposition by convective precipitation.
+! RH relative humidity
+! t_ref reference temperature profile used with Betts-Miller
+! convection
+! q_ref reference specific humidity p[rofile used with
+! Betts-Miller convection
+! massflux mass flux used to calculate the humidity adjustment
+! bmflag bmflag indicates the degree of convection in the
+! column
+! bmflag = 0. is no cape, no convection
+! bmflag = 1. is shallow conv, no precipitationo
+! bmflag = 2. is deep convection
+! klzbs model grid level of zero buoyancy
+! invtaubmt temperature relaxation timescale
+! invtaubmq humidity relaxation timescale
+! cape convective available potential energy
+! cin convective inhibition
+! BM_tend conv_tendency_type variable containing tendency
+! output from betts-miller parameterization
+! used logical used to indicate data has been received by
+! diag_manager_mod
+! alpha logical indicating whether do_rh_clouds is .true.
+! ix, jx, kx physics window dimesnsions
!---------------------------------------------------------------------
- do n=1,nt
- if (.not. cloud_tracer(n)) then
- Input_mp%tracer(:,:,:,n) = tracer_orig(:,:,:,n) + &
- (Output_mp%rdt(:,:,:,n) - rdt_init(:,:,:,n)) *dt
- endif
- end do
-!@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
-!
-! CONVECTION DIAGNOSTICS
-!
-!@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
+!---------------------------------------------------------------------
+! activate bm_clock.
+!---------------------------------------------------------------------
+ call mpp_clock_begin (bm_clock)
!-----------------------------------------------------------------------
-! precip from the various convection schemes.
+! define array dimensions.
!-----------------------------------------------------------------------
- used = send_data (id_ras_precip, rain_ras + snow_ras, Time, is, js)
- if (do_donner_deep) then
- used = send_data (id_don_precip, rain_don + snow_don + &
- rain_donmca + snow_donmca, &
- Time, is, js)
- endif
- used = send_data (id_uw_precip, rain_uw + snow_uw, Time, is, js)
- used = send_data (id_uw_snow, snow_uw, Time, is, js)
+ ix = size(Input_mp%t,1)
+ jx = size(Input_mp%t,2)
+ kx = size(Input_mp%t,3)
-!-----------------------------------------------------------------------
-! uw_conv diagnostics: prognostic variable tendencies and enthalpy
-! and water column tendencies.
-!-----------------------------------------------------------------------
- if (do_uw_conv) then
- used = send_data (id_tdt_uw, ttnd_uw, Time, is, js, 1)
- used = send_data (id_qdt_uw, qtnd_uw, Time, is, js, 1)
- used = send_data (id_qadt_uw, qatnd_uw, Time, is, js, 1)
- used = send_data (id_qldt_uw, qltnd_uw, Time, is, js, 1)
- used = send_data (id_qidt_uw, qitnd_uw, Time, is, js, 1)
- if (do_liq_num) then
- used = send_data (id_qndt_uw, qntnd_uw, Time, is, js, 1)
- endif
- if (do_ice_num) then
- used = send_data (id_qnidt_uw, qnitnd_uw, Time, is, js, 1)
- end if
- endif
+!--------------------------------------------------------------------
+! allocate and initialize the needed components of a
+! conv_tendency_type array.
+!--------------------------------------------------------------------
+ allocate (BM_tend%rain(ix, jx))
+ allocate (BM_tend%snow(ix, jx))
+ allocate (BM_tend%ttnd(ix, jx, kx))
+ allocate (BM_tend%qtnd(ix, jx, kx))
+ BM_tend%rain = 0.
+ BM_tend%snow = 0.
+ BM_tend%ttnd = 0.
+ BM_tend%qtnd = 0.
- if (id_enth_uw_col > 0) then
- temp_2d = -HLV*rain_uw -HLS*snow_uw
- call column_diag (id_enth_uw_col, is, js, Time, ttnd_uw, CP_AIR, &
- qltnd_uw, -HLV, qitnd_uw, -HLS, Input_mp%pmass, temp_2d)
- endif
+!--------------------------------------------------------------------
+! initialize local arrays.
+!--------------------------------------------------------------------
+ t_ref = 0.
+ q_ref = 0.
- if (id_wat_uw_col > 0) then
- temp_2d = rain_uw + snow_uw
- call column_diag(id_wat_uw_col, is, js, Time, qtnd_uw, 1.0, &
- qltnd_uw, 1.0, qitnd_uw, 1.0, Input_mp%pmass, temp_2d)
+!----------------------------------------------------------------------
+! call appropriate interface dependent on flavor of Betts-Miller which
+! has been selected.
+!----------------------------------------------------------------------
+ if (LBM) then
+
+!----------------------------------------------------------------------
+! betts-miller cumulus param scheme
+!----------------------------------------------------------------------
+ call betts_miller &
+ (dt, Input_mp%tin, Input_mp%qin, Input_mp%pfull, &
+ Input_mp%phalf, Input_mp%coldT, BM_tend%rain, &
+ BM_tend%snow, BM_tend%ttnd, BM_tend%qtnd, &
+ q_ref, bmflag, klzbs, cape, cin, t_ref, &
+ invtaubmt, invtaubmq)
endif
+ if (LBMmass) then
+
!----------------------------------------------------------------------
-! convection scheme frequency diagnostics.
+! betts-miller-style massflux cumulus param scheme
!----------------------------------------------------------------------
- if (id_ras_freq > 0) then
- ltemp = rain_ras > 0. .or. snow_ras > 0.0
- where (ltemp)
- temp_2d = 1.
- elsewhere
- temp_2d = 0.
- end where
- used = send_data (id_ras_freq, temp_2d,Time, is, js)
+ call bm_massflux &
+ (dt, Input_mp%tin, Input_mp%qin, Input_mp%pfull, &
+ Input_mp%phalf, Input_mp%coldT, BM_tend%rain, &
+ BM_tend%snow, BM_tend%ttnd, BM_tend%qtnd, q_ref, &
+ bmflag, klzbs, t_ref, massflux)
+
endif
- if (id_don_freq > 0) then
- ltemp = rain_don > 0. .or. snow_don > 0.0 .or. &
- rain_donmca > 0. .or. snow_donmca > 0.0
- where (ltemp)
- temp_2d = 1.
- elsewhere
- temp_2d = 0.
- end where
- used = send_data (id_don_freq, temp_2d, Time, is, js)
+ if (LBMomp) then
+!----------------------------------------------------------------------
+! olivier's betts-miller cumulus param scheme
+!----------------------------------------------------------------------
+ call bm_omp &
+ (dt, Input_mp%tin, Input_mp%qin, Input_mp%pfull, &
+ Input_mp%phalf, Input_mp%coldT, BM_tend%rain, &
+ BM_tend%snow, BM_tend%ttnd, BM_tend%qtnd, q_ref, &
+ bmflag, klzbs, t_ref)
endif
- if (id_uw_freq > 0) then
- ltemp = rain_uw > 0. .or. snow_uw > 0.0
- where (ltemp)
- temp_2d = 1.
- elsewhere
- temp_2d = 0.
- end where
- used = send_data (id_uw_freq, temp_2d, Time, is, js)
+!----------------------------------------------------------------------
+! update input values and compute tendency.
+!----------------------------------------------------------------------
+ Input_mp%tin = Input_mp%tin + BM_tend%ttnd
+ Input_mp%qin = Input_mp%qin + BM_tend%qtnd
+
+ BM_tend%ttnd = BM_tend%ttnd*dtinv
+ BM_tend%qtnd = BM_tend%qtnd*dtinv
+ BM_tend%rain= BM_tend%rain*dtinv
+ BM_tend%snow= BM_tend%snow*dtinv
+
+!-------------------------------------------------------------------------
+! compute rh clouds if they are active with betts-miller. first
+! calculate the relative humidity, then pass it to rh_clouds_mod to be
+! stored till needed.
+!-------------------------------------------------------------------------
+ if (do_rh_clouds_BM) then
+ alpha = do_rh_clouds()
+ if (alpha) then
+ call rh_calc &
+ (Input_mp%pfull, Input_mp%tin, Input_mp%qin, RH, do_simple)
+ call rh_clouds_sum (is, js, RH)
+ else
+ call error_mesg ('convection_driver', &
+ 'rh_clouds_mod is being used without initialization', &
+ FATAL)
+ endif
+ end if
+
+!-----------------------------------------------------------------------
+! save desired betts-miller diagnostics.
+!-----------------------------------------------------------------------
+ used = send_data (id_tref, t_ref, Time, is, js, 1 )
+ used = send_data (id_qref, q_ref, Time, is, js, 1 )
+ used = send_data (id_bmflag, bmflag, Time, is, js)
+ used = send_data (id_klzbs, klzbs, Time, is, js)
+ if (do_bm) then
+ used = send_data (id_invtaubmt, invtaubmt, Time, is, js)
+ used = send_data (id_invtaubmq, invtaubmq, Time, is, js)
endif
-
-!---------------------------------------------------------------------
-! temperature change due to dry and moist convection:
-!---------------------------------------------------------------------
- used = send_data (id_tdt_conv, Tend_mp%ttnd_conv, Time, is, js, 1)
- if (query_cmip_diag_id(ID_tntc)) then
- used = send_cmip_data_3d (ID_tntc, Tend_mp%ttnd_conv, Time, is, js, 1, phalf=log(Input_mp%phalf))!, rmask=mask)
+ if (do_bmmass) then
+ used = send_data (id_massflux, massflux, Time, is, js, 1)
endif
-!---------------------------------------------------------------------
-! vapor specific humidity change due to convection:
-!---------------------------------------------------------------------
- used = send_data (id_qdt_conv, Tend_mp%qtnd_conv, Time, is, js, 1)
- if (query_cmip_diag_id(ID_tnhusc)) then
- used = send_cmip_data_3d (ID_tnhusc, Tend_mp%qtnd_conv, Time, is, js, 1, phalf=log(Input_mp%phalf))!, rmask=mask)
+!----------------------------------------------------------------------
+! call update_outputs to update the arrays which will return the
+! convective tendencies to moist_processes.
+!----------------------------------------------------------------------
+ call update_outputs (BM_tend, Output_mp, Tend_mp)
+
+!-----------------------------------------------------------------------
+! preserve an error / bug in the warsaw code. diagnostic output changes
+! for the post-warsaw case, reflecting the bugfix.
+!-----------------------------------------------------------------------
+ if (reproduce_AM4) then
+ Tend_mp%ttnd_conv = 0.
+ Tend_mp%qtnd_conv = 0.
endif
-!---------------------------------------------------------------------
-! total precipitation due to convection (both FMS and CMOR standards):
-!---------------------------------------------------------------------
- used = send_data (id_prec_conv, precip, Time, is, js)
- used = send_data (id_prc, precip, Time, is, js)
- if (id_prc_g > 0) call buffer_global_diag (id_prc_g, precip(:,:), Time, is, js)
+!----------------------------------------------------------------------
+! deallocate components of conv_tendency_type which were allocated
+! in this subroutine.
+!----------------------------------------------------------------------
+ deallocate (BM_tend%rain)
+ deallocate (BM_tend%snow)
+ deallocate (BM_tend%ttnd)
+ deallocate (BM_tend%qtnd)
!---------------------------------------------------------------------
-! frozen precipitation (snow) due to convection:
-!---------------------------------------------------------------------
- used = send_data (id_snow_conv, Output_mp%fprec, Time, is, js)
- used = send_data (id_prsnc, Output_mp%fprec, Time, is, js)
-!---------------------------------------------------------------------
-! liquid precipitation (rain) due to convection:
+! turn off the betts-miller clock.
!---------------------------------------------------------------------
- used = send_data (id_prrc, Output_mp%lprec, Time, is, js)
+ call mpp_clock_end (bm_clock)
!---------------------------------------------------------------------
-! convective frequency (both FMS and CMOR standards).
-!---------------------------------------------------------------------
- if (id_conv_freq > 0) then
- ltemp = precip > 0. .or. cldtop > 0
- where (ltemp)
- freq_count = 1.
- elsewhere
- freq_count = 0.
- end where
- used = send_data (id_conv_freq, freq_count, Time, is, js )
- endif
- if (id_ci > 0) then
- ltemp = precip > 0. .or. cldtop > 0
- where (ltemp)
- freq_count = 1.
- elsewhere
- freq_count = 0.
- end where
- used = send_data (id_ci, freq_count, Time, is, js )
- endif
-!---------------------------------------------------------------------
-! diagnostic for 3D convective precip
-!---------------------------------------------------------------------
- used = send_data ( id_conv_rain3d, rain3d, Time, is, js, 1 )
- used = send_data ( id_conv_snow3d, snow3d, Time, is, js, 1 )
+end subroutine betts_miller_driver
-!---------------------------------------------------------------------
-! surface wind gustiness due to convection:
-!---------------------------------------------------------------------
- used = send_data (id_gust_conv, Output_mp%gust_cv, Time, is, js)
-!---------------------------------------------------------------------
-! water vapor path tendency due to convection:
-!---------------------------------------------------------------------
- if (id_q_conv_col > 0) &
- call column_diag (id_q_conv_col, is, js, Time, &
- Tend_mp%qtnd_conv, 1.0, Input_mp%pmass)
-!---------------------------------------------------------------------
-! dry static energy tendency due to dry and moist convection:
-!---------------------------------------------------------------------
- if (id_t_conv_col > 0) &
- call column_diag (id_t_conv_col, is, js, Time, &
- Tend_mp%ttnd_conv, CP_AIR, Input_mp%pmass)
+!#######################################################################
-!---------------------------------------------------------------------
-! define the total prognostic cloud liquid, ice, drop number,
-! ice number and area tendencies due to convection.
-!---------------------------------------------------------------------
- if (doing_prog_clouds) then
- Tend_mp%qldt_conv = Output_mp%rdt(:,:,:,nql) - rdt_init(:,:,:,nql)
- Tend_mp%qidt_conv = Output_mp%rdt(:,:,:,nqi) - rdt_init(:,:,:,nqi)
- if (do_liq_num) Tend_mp%qndt_conv = &
- Output_mp%rdt(:,:,:,nqn) - rdt_init(:,:,:,nqn)
- if (do_ice_num) Tend_mp%qnidt_conv = &
- Output_mp%rdt(:,:,:,nqni) - rdt_init(:,:,:,nqni)
- Tend_mp%qadt_conv = Output_mp%rdt(:,:,:,nqa) - rdt_init(:,:,:,nqa)
+!*******************************************************************
+!
+! PRIVATE, MCA-RELATED SUBROUTINES
+!
+!*******************************************************************
+
+
+subroutine mca_driver (is, js, Input_mp, Output_mp, Tend_mp)
+
+!-----------------------------------------------------------------------
+! subroutine mca_driver prepares for, calls, and handles the output from
+! the moist convective adjustment parameterization.
+!-----------------------------------------------------------------------
+
+!-----------------------------------------------------------------------
+integer, intent(in) :: is, js
+type(mp_input_type), intent(inout) :: Input_mp
+type(mp_output_type), intent(inout) :: Output_mp
+type(mp_tendency_type), intent(inout) :: Tend_mp
+
+!----------------------------------------------------------------------
+! is,js starting i and j indices for window
+! Input_mp derived type used to transfer needed input data between
+! moist_processes and convection_driver
+! Output_mp derived type used to transfer output fields between
+! convection_driver and moist_processes
+! Tend_mp derived type used to transfer calculated tendency data
+! between convection_driver and moist_processes
!---------------------------------------------------------------------
-! output diagnostics for cloud liquid tendency and liquid water path
-! tendency due to convection.
-!---------------------------------------------------------------------
- if (id_qldt_conv > 0 .or. id_ql_conv_col > 0) then
- used = send_data (id_qldt_conv, Tend_mp%qldt_conv, &
- Time, is, js, 1)
- if (id_ql_conv_col > 0) &
- call column_diag (id_ql_conv_col, is, js, Time, &
- Tend_mp%qldt_conv, 1.0, Input_mp%pmass)
- endif
+ real, dimension(size(Output_mp%rdt,1), size(Output_mp%rdt,2),&
+ size(Output_mp%rdt,3), num_mca_tracers) :: trcr
+ type(conv_tendency_type) :: Mca_tend
+ integer :: ix, jx, kx
+ integer :: nn, n
+
+!-----------------------------------------------------------------------
+! trcr set of tracers transported by moist convective
+! adjustment
+! Mca_tend conv_tendency_type variable containing tendency
+! output from moist convective adjustment parameterization
+! ix, jx, kx physics window dimensions
+! n do loop index
+! nn counter
+!-----------------------------------------------------------------------
+
+!-----------------------------------------------------------------------
+! turn on the mca clock.
+!-----------------------------------------------------------------------
+ call mpp_clock_begin (mca_clock)
+
+!-------------------------------------------------------------------
+! define the physics window dimensions.
+!-------------------------------------------------------------------
+ ix = size(Input_mp%t,1)
+ jx = size(Input_mp%t,2)
+ kx = size(Input_mp%t,3)
+
+!-------------------------------------------------------------------
+! allocate and initialize the components of the derived type variable
+! Mca_tend.
+!-------------------------------------------------------------------
+ allocate (Mca_tend%ttnd(ix, jx, kx))
+ allocate (Mca_tend%qtnd(ix, jx, kx))
+ allocate (Mca_tend%qltnd(ix, jx, kx))
+ allocate (Mca_tend%qitnd(ix, jx, kx))
+ allocate (Mca_tend%qatnd(ix, jx, kx))
+ allocate (Mca_tend%rain (ix, jx))
+ allocate (Mca_tend%snow (ix, jx))
+ allocate (Mca_tend%qtr (ix, jx, kx, num_mca_tracers))
+
+ Mca_tend% ttnd = 0.
+ Mca_tend% qtnd = 0.
+ Mca_tend% qltnd = 0.
+ Mca_tend% qitnd = 0.
+ Mca_tend% qatnd = 0.
+ Mca_tend% rain = 0.
+ Mca_tend% snow = 0.
+ Mca_tend% qtr = 0.
!---------------------------------------------------------------------
-! output diagnostics for cloud drop number tendency and cloud drop
-! number path tendency due to convection.
+! check each active tracer to find any that are to be transported
+! by moist convective adjustment and fill the trcr array with
+! these fields.
!---------------------------------------------------------------------
- if (do_liq_num) then
- if (id_qndt_conv > 0 .or. id_qn_conv_col > 0) then
- used = send_data (id_qndt_conv, Tend_mp%qndt_conv, &
- Time, is, js, 1)
- if (id_qn_conv_col > 0) &
- call column_diag (id_qn_conv_col, is, js, Time, &
- Tend_mp%qndt_conv, 1.0, Input_mp%pmass)
- endif
+ nn = 1
+ do n=1, num_prog_tracers
+ if (tracers_in_mca(n)) then
+ trcr(:,:,:,nn) = Input_mp%tracer(:,:,:,n)
+ nn = nn + 1
endif
+ end do
!---------------------------------------------------------------------
-! output diagnostics for cloud ice tendency and cloud ice water path
-! tendency due to convection.
+! call subroutine moist_conv to obtain the temperature, moisture
+! precipitation and tracer tendencies due to the moist convective
+! adjustment parameterization. currently there is no tracer tendency
+! due to this parameterization.
+!++++yim Should also account for change in qn dut to moist convective
+! adjustment.
!---------------------------------------------------------------------
- if (id_qidt_conv > 0 .or. id_qi_conv_col > 0) then
- used = send_data (id_qidt_conv, Tend_mp%qidt_conv, Time, &
- is, js, 1)
- if (id_qi_conv_col > 0) &
- call column_diag (id_qi_conv_col, is, js, Time, &
- Tend_mp%qidt_conv, 1.0, Input_mp%pmass)
- endif
-
+ if (doing_prog_clouds) then
+ call moist_conv (Input_mp%tin, Input_mp%qin, Input_mp%pfull, &
+ Input_mp%phalf, Input_mp%coldT, Mca_tend%ttnd, &
+ Mca_tend%qtnd, Mca_tend%rain, Mca_tend%snow, &
+ dtinv, Time, is, js, trcr, Mca_tend%qtr, &
+ ql=INput_mp%tracer(:,:,:,nql), &
+ qi=Input_mp%tracer(:,:,:,nqi), &
+ cf=Input_mp%tracer(:,:,:,nqa), &
+ qldel=Mca_tend%qltnd, &
+ qidel=Mca_tend%qitnd, &
+ cfdel=Mca_tend%qatnd)
+ else
+ call moist_conv (Input_mp%tin, Input_mp%qin, Input_mp%pfull, &
+ Input_mp%phalf, Input_mp%coldT, Mca_tend%ttnd, &
+ Mca_tend%qtnd, Mca_tend%rain, Mca_tend%snow, &
+ dtinv, Time, is, js, trcr, Mca_tend%qtr)
+ endif
!---------------------------------------------------------------------
-! output diagnostics for cloud ice number tendency and cloud ice number
-! path tendency due to convection.
+! update the current tracer tendencies with the contributions
+! just obtained from moist convective adjustment. currently there
+! is no tracer transport by this process.
+! NOTE : the stratcloud tracers are updated within moist_conv.
!---------------------------------------------------------------------
- if (do_ice_num) then
- if (id_qnidt_conv > 0 .or. id_qni_conv_col > 0) then
- used = send_data (id_qnidt_conv, Tend_mp%qnidt_conv, &
- Time, is, js, 1)
- if (id_qni_conv_col > 0) &
- call column_diag (id_qni_conv_col, is, js, Time, &
- Tend_mp%qnidt_conv, 1.0, Input_mp%pmass)
- endif
+ nn = 1
+ do n=1, num_prog_tracers
+ if (tracers_in_mca(n)) then
+ Output_mp%rdt(:,:,:,n) = Output_mp%rdt(:,:,:,n) + &
+ Mca_tend%qtr(:,:,:,nn)
+ nn = nn + 1
endif
+ end do
!---------------------------------------------------------------------
-! output diagnostics for cloud area tendency and column integrated
-! cloud mass tendency due to convection.
-!---------------------------------------------------------------------
- if (id_qadt_conv > 0 .or. id_qa_conv_col > 0 ) then
- used = send_data (id_qadt_conv, Tend_mp%qadt_conv, &
- Time, is, js, 1)
- if (id_qa_conv_col > 0) &
- call column_diag (id_qa_conv_col, is, js, Time, &
- Tend_mp%qadt_conv, 1.0, Input_mp%pmass)
- endif
- endif !(doing_prog_clouds)
+! call update_outputs to update the arrays which will return the
+! convective tendencies to moist_processes.
+!----------------------------------------------------------------------
+ call update_outputs (Mca_tend, Output_mp, Tend_mp)
!---------------------------------------------------------------------
-! compute the column integrated enthalpy and total water tendencies
-! due to convection parameterizations, if those diagnostics are desired.
+! deallocate the components of Mca_tend.
!---------------------------------------------------------------------
- if (id_enth_conv_col > 0 .or. id_wat_conv_col > 0) then
- temp_3d1 = Output_mp%rdt(:,:,:,nql) - rdt_init(:,:,:,nql)
- temp_3d2 = Output_mp%rdt(:,:,:,nqi) - rdt_init(:,:,:,nqi)
+ deallocate (Mca_tend%ttnd)
+ deallocate (Mca_tend%qtnd)
+ deallocate (Mca_tend%qltnd)
+ deallocate (Mca_tend%qitnd)
+ deallocate (Mca_tend%qatnd)
+ deallocate (Mca_tend%rain )
+ deallocate (Mca_tend%snow )
+ deallocate (Mca_tend%qtr )
- if (id_enth_conv_col > 0) then
- temp_2d = -HLV*precip -HLF*Output_mp%fprec
- call column_diag &
- (id_enth_conv_col, is, js, Time, Tend_mp%ttnd_conv, CP_AIR, &
- temp_3d1, -HLV, temp_3d2, -HLS, Input_mp%pmass, temp_2d)
- endif
+!----------------------------------------------------------------------
+! turn off the mca clock.
+!----------------------------------------------------------------------
+ call mpp_clock_end (mca_clock)
- if (id_wat_conv_col > 0) then
- temp_2d = precip
- call column_diag &
- (id_wat_conv_col, is, js, Time, Tend_mp%qtnd_conv, 1.0, &
- temp_3d1, 1.0, temp_3d2, 1.0, Input_mp%pmass, temp_2d)
- endif
- endif
+!--------------------------------------------------------------------
-!---------------------------------------------------------------------
-! compute the tracer tendencies due to convection for any tracers that
-! are to be transported by any convective parameterization.
-!---------------------------------------------------------------------
-! do n=1,size(Output_mp%rdt,4)
- do n=1,nt
- if (Removal_mp_control%tracers_in_donner(n) .or. &
- Removal_mp_control%tracers_in_ras(n) .or. &
- Removal_mp_control%tracers_in_mca(n) .or. &
- Removal_mp_control%tracers_in_uw(n)) then
-!---------------------------------------------------------------------
-! output diagnostics for tracer tendency and column integrated
-! tracer tendency due to convection.
-!---------------------------------------------------------------------
- if (id_tracerdt_conv(n) > 0 .or. &
- id_tracerdt_conv_col(n) > 0) then
- temp_3d1 = Output_mp%rdt(:,:,:,n) - rdt_init(:,:,:,n)
- used = send_data (id_tracerdt_conv(n), temp_3d1, &
- Time, is, js, 1 )
+end subroutine mca_driver
- if (id_tracerdt_conv_col(n) > 0) &
- call column_diag &
- (id_tracerdt_conv_col(n), is, js, Time, temp_3d1, &
- 1.0, Input_mp%pmass)
- endif
- endif
- end do
-!----------------------------------------------------------------------
-! define the precip fluxes needed for input to the COSP simulator
-! package.
-!---------------------------------------------------------------------
- if (do_cosp) then
-!---------------------------------------------------------------------
-! define precip fluxes from convective schemes at each layer
-! interface. (index 1 is model lid)
-!---------------------------------------------------------------------
- do k=2, size(Input_mp%t,3)+1
- Removal_mp%liq_mesoh(:,:,k) = Removal_mp%liq_mesoh (:,:,k-1) + &
- Removal_mp%liq_meso (:,:,k-1)
- Removal_mp%frz_mesoh(:,:,k) = Removal_mp%frz_mesoh (:,:,k-1) + &
- Removal_mp%frz_meso (:,:,k-1)
- Removal_mp%liq_cellh(:,:,k) = Removal_mp%liq_cellh (:,:,k-1) + &
- Removal_mp%liq_cell (:,:,k-1)
- Removal_mp%frz_cellh(:,:,k) = Removal_mp%frz_cellh (:,:,k-1) + &
- Removal_mp%frz_cell (:,:,k-1)
- Removal_mp%ice_precflxh(:,:,k) = &
- Removal_mp%ice_precflxh(:,:,k-1) + &
- Removal_mp%ice_precflx(:,:,k-1)
- Removal_mp%liq_precflxh(:,:,k) = &
- Removal_mp%liq_precflxh(:,:,k-1) + &
- Removal_mp%liq_precflx(:,:,k-1)
- if (include_donmca_in_cosp) then
- Removal_mp%mca_liqh(:,:,k) = Removal_mp%mca_liqh (:,:,k-1) + &
- Removal_mp%mca_liq(:,:,k-1)
- Removal_mp%mca_frzh(:,:,k) = Removal_mp%mca_frzh (:,:,k-1) + &
- Removal_mp%mca_frz(:,:,k-1)
- endif
- end do
+!#######################################################################
-!--------------------------------------------------------------------
-! adjust precip fluxes to account for any negative values produced.
-! precip contribution is determined as the negative of the moisture
-! tendency, so at top of clouds a positive moisture tendency some-
-! times results in a negative precipitation contribution.
-!----------------------------------------------------------------------
- call prevent_neg_precip_fluxes (Removal_mp%liq_mesoh)
- call prevent_neg_precip_fluxes (Removal_mp%frz_mesoh)
- call prevent_neg_precip_fluxes (Removal_mp%liq_cellh)
- call prevent_neg_precip_fluxes (Removal_mp%frz_cellh)
- call prevent_neg_precip_fluxes (Removal_mp%ice_precflxh)
- call prevent_neg_precip_fluxes (Removal_mp%liq_precflxh)
- if (include_donmca_in_cosp) then
- call prevent_neg_precip_fluxes (Removal_mp%mca_liqh)
- call prevent_neg_precip_fluxes (Removal_mp%mca_frzh)
- endif
- endif ! do_cosp
+!*******************************************************************
+!
+! PRIVATE, UW-THEN-DONNER RELATED SUBROUTINES
+!
+!*******************************************************************
+
+subroutine uw_then_donner_driver &
+ (is, ie, js, je, Input_mp, Aerosol, Phys_mp_exch, &
+ Output_mp, Tend_mp, Conv_results, Removal_mp, &
+ Moist_clouds_block, C2ls_mp)
!-----------------------------------------------------------------------
-! compute the grid box area taken up by convective clouds. If CLUBB is
-! active, then a second call is made using slightly different inputs.
+! subroutine uw_then_donner_driver handles the case when uw convection
+! is calculated first, followed by calculation of donner convection.
!-----------------------------------------------------------------------
- if (do_clubb == 2) then
-!---> h1g, 2017-01-31
- if( do_uw_conv .and. do_donner_deep ) then
- call compute_convective_area &
- (Input_mp%t, Input_mp%pfull, Input_mp%q, do_uw_conv, &
- do_donner_deep, C2ls_mp%donner_humidity_area, &
- C2ls_mp%donner_humidity_factor, conv_frac_max, &
- C2ls_mp%convective_humidity_ratio_clubb, &
- C2ls_mp%conv_frac_clubb, &
- shallow_cloud_area= &
- Moist_clouds_block%cloud_data(i_shallow)%cloud_area, &
- cell_cld_frac = &
- Moist_clouds_block%cloud_data(i_cell)%cloud_area)
- else if (do_donner_deep) then
- call compute_convective_area &
- (Input_mp%t, Input_mp%pfull, Input_mp%q, do_uw_conv, &
- do_donner_deep, C2ls_mp%donner_humidity_area, &
- C2ls_mp%donner_humidity_factor, conv_frac_max, &
- C2ls_mp%convective_humidity_ratio_clubb, &
- C2ls_mp%conv_frac_clubb, &
- cell_cld_frac = &
- Moist_clouds_block%cloud_data(i_cell)%cloud_area)
-
- else if (do_uw_conv) then
- call compute_convective_area &
- (Input_mp%t, Input_mp%pfull, Input_mp%q, do_uw_conv, &
- do_donner_deep, C2ls_mp%donner_humidity_area, &
- C2ls_mp%donner_humidity_factor, conv_frac_max, &
- C2ls_mp%convective_humidity_ratio_clubb, &
- C2ls_mp%conv_frac_clubb, &
- shallow_cloud_area= &
- Moist_clouds_block%cloud_data(i_shallow)%cloud_area )
+integer, intent(in) :: is, ie, js, je
+type(mp_input_type), intent(inout) :: Input_mp
+type(aerosol_type), intent(in) :: Aerosol
+type(phys_mp_exch_type), intent(inout) :: Phys_mp_exch
+type(mp_output_type), intent(inout) :: Output_mp
+type(mp_tendency_type), intent(inout) :: Tend_mp
+type(conv_results_type), intent(inout) :: Conv_results
+type(mp_removal_type), intent(inout) :: Removal_mp
+type(clouds_from_moist_block_type), intent(inout) :: Moist_clouds_block
+type(mp_conv2ls_type), intent(inout) :: C2ls_mp
- else
- call compute_convective_area &
- (Input_mp%t, Input_mp%pfull, Input_mp%q, do_uw_conv, &
- do_donner_deep, C2ls_mp%donner_humidity_area, &
- C2ls_mp%donner_humidity_factor, conv_frac_max, &
- C2ls_mp%convective_humidity_ratio_clubb, &
- C2ls_mp%conv_frac_clubb)
+!-----------------------------------------------------------------------
+! is,js starting i and j indices for window
+! ie,je ending i and j indices for window
+! Input_mp derived type used to transfer needed input data between
+! moist_processes and convection_driver
+! Aerosol derived type containing model aerosol fields to be input
+! to model convective schemes
+! Phys_mp_exch
+! derived type used to transfer data between physics_driver
+! and convection_driver via moist_processes
+! Output_mp derived type used to transfer output fields between
+! convection_driver and moist_processes
+! Tend_mp derived type used to transfer calculated tendency data
+! between convection_driver and moist_processes
+! Conv_results
+! conv_results_type variable containing variables
+! used in multiple convective parameterizations and for
+! diagnostic output
+! Removal_mp derived type used to transfer precipitation and tracer
+! removal fields between convection_driver and
+! moist_processes
+! Moist_clouds_block
+! derived type used to transfer cloud data between
+! atmos_model and convection_driver via physics_driver and
+! moist_processes
+! C2ls_mp derived type used to transfer data from convection_driver
+! to lscloud_driver via moist_processes.
+!-----------------------------------------------------------------------
- endif
-!<--- h1g, 2017-01-31
+ type(conv_tendency_type) :: Uw_tend
+ type(conv_output_type) :: Output_uw
- endif
+!------------------------------------------------------------------------
+! Uw_tend conv_tendency_type variable containing tendency
+! output from uw convection
+! Output_uw conv_output_type variable containing output
+! fields from uw convection
+!------------------------------------------------------------------------
- if (.not. do_lsc) then
+!-----------------------------------------------------------------------
+! use the nml variable use_updated_profiles_for_donner to determine
+! execution path through this module.
+!-----------------------------------------------------------------------
+ if (use_updated_profiles_for_donner) then ! ORIG4
-!---> h1g, 2017-01-31
- if( do_uw_conv .and. do_donner_deep ) then
- call compute_convective_area &
- (Input_mp%tin, Input_mp%pfull, Input_mp%qin, do_uw_conv, &
- do_donner_deep, C2ls_mp%donner_humidity_area, &
- C2ls_mp%donner_humidity_factor, 1.0, &
- C2ls_mp%convective_humidity_ratio, &
- C2ls_mp%convective_humidity_area, &
- shallow_cloud_area= &
- Moist_clouds_block%cloud_data(i_shallow)%cloud_area, &
- cell_cld_frac= &
- Moist_clouds_block%cloud_data(i_cell)%cloud_area)
- else if (do_donner_deep) then
- call compute_convective_area &
- (Input_mp%tin, Input_mp%pfull, Input_mp%qin, do_uw_conv, &
- do_donner_deep, C2ls_mp%donner_humidity_area, &
- C2ls_mp%donner_humidity_factor, 1.0, &
- C2ls_mp%convective_humidity_ratio, &
- C2ls_mp%convective_humidity_area, &
- cell_cld_frac= &
- Moist_clouds_block%cloud_data(i_cell)%cloud_area)
- else if (do_uw_conv) then
- call compute_convective_area &
- (Input_mp%tin, Input_mp%pfull, Input_mp%qin, do_uw_conv, &
- do_donner_deep, C2ls_mp%donner_humidity_area, &
- C2ls_mp%donner_humidity_factor, 1.0, &
- C2ls_mp%convective_humidity_ratio, &
- C2ls_mp%convective_humidity_area, &
- shallow_cloud_area= &
- Moist_clouds_block%cloud_data(i_shallow)%cloud_area)
- else
- call compute_convective_area &
- (Input_mp%tin, Input_mp%pfull, Input_mp%qin, do_uw_conv, &
- do_donner_deep, C2ls_mp%donner_humidity_area, &
- C2ls_mp%donner_humidity_factor, 1.0, &
- C2ls_mp%convective_humidity_ratio, &
- C2ls_mp%convective_humidity_area)
- endif
-!<--- h1g, 2017-01-31
+!----------------------------------------------------------------------
+! if one is using profiles updated by uw convection as inputs to the
+! donner parameterization, call uw first (doing both parts of that
+! calculation), followed by a call to donner convection.
+!----------------------------------------------------------------------
+ call mpp_clock_begin (uw_clock)
+ call uw_conv_driver_part &
+ (is, ie, js, je, Input_mp, Aerosol, Phys_mp_exch, &
+ Output_mp, Tend_mp, Conv_results, Removal_mp, &
+ Moist_clouds_block%cloud_data(i_shallow), &
+ Uw_tend, Output_uw, .true., .true.)
+ call mpp_clock_end (uw_clock)
+
+ call donner_driver ( is, ie, js, je, Input_mp, &
+ Moist_clouds_block, Conv_results, &
+ C2ls_mp, Removal_mp, Tend_mp, Output_mp)
- endif
+!----------------------------------------------------------------------
+! if not using updated fields for donner, execute the following.
+! this path will also reproduce results obtained using base warsaw
+! code if nml variable reproduce_AM4 is set to .true., using
+! some inconsistent values in the cmt calculation; if
+! reproduce_AM4 is set .false., then consistent (unupdated)
+! values will be used in the cmt and other calculations.
+!----------------------------------------------------------------------
+ else ! ORIG2 and ORIG5
!---------------------------------------------------------------------
-! end the timing of the convection code section.
+! call uw_conv_driver_part to execute the first part of the uw conv
+! calculation.
!---------------------------------------------------------------------
- call mpp_clock_end (convection_clock)
+ call mpp_clock_begin (uw_clock)
+ call uw_conv_driver_part &
+ ( is, ie, js, je, Input_mp, Aerosol, Phys_mp_exch, &
+ Output_mp, Tend_mp, Conv_results, Removal_mp, &
+ Moist_clouds_block%cloud_data(i_shallow), &
+ Uw_tend, Output_uw, .true., .false.)
+ call mpp_clock_end (uw_clock)
-!------------------------------------------------------------------------
+!---------------------------------------------------------------------
+! call donner_driver to execute the donner_deep parameterization.
+!---------------------------------------------------------------------
+ call donner_driver ( is, ie, js, je, Input_mp, &
+ Moist_clouds_block, Conv_results, &
+ C2ls_mp, Removal_mp, Tend_mp, Output_mp)
+!---------------------------------------------------------------------
+! call uw_conv_driver_part to execute the second part of the uw conv
+! calculation.
+!---------------------------------------------------------------------
+ call mpp_clock_begin (uw_clock)
+ call uw_conv_driver_part &
+ ( is, ie, js, je, Input_mp, Aerosol, Phys_mp_exch, &
+ Output_mp, Tend_mp, Conv_results, Removal_mp, &
+ Moist_clouds_block%cloud_data(i_shallow), &
+ Uw_tend, Output_uw, .false., .true.)
+ call mpp_clock_end (uw_clock)
+ endif
+!----------------------------------------------------------------------
-end subroutine convection_driver
+ end subroutine uw_then_donner_driver
-!######################################################################
-subroutine cape_cin_diagnostics (is, ie, js, je, Input_mp, Time)
+!#######################################################################
-integer, intent(in) :: is,ie,js,je
-type(mp_input_type), intent(in) :: Input_mp
-type(time_type), intent(in) :: Time
+!*******************************************************************
+!
+! PRIVATE, UW-RELATED SUBROUTINES
+!
+!*******************************************************************
- real, dimension(size(Input_mp%tin,1), size(Input_mp%tin,2), &
- size(Input_mp%tin,3)) :: &
- rin, rp, tp
- real, dimension(size(Input_mp%tin,1), size(Input_mp%tin,2)) :: &
- cape, cin
- integer, dimension(size(Input_mp%tin,1), size(Input_mp%tin,2)) :: &
- klcl, klfc, klzb
+subroutine uw_conv_driver &
+ (is, ie, js, je, Input_mp, Aerosol, Phys_mp_exch, &
+ Output_mp, Tend_mp, Conv_results, Removal_mp, Cld_props)
- logical :: avgbl, used
- integer :: i, j, ix, jx, kx
+!----------------------------------------------------------------------
+! subroutine uw_conv_driver prepares for and executes the uw convection
+! parameterization, and then processes its output appropriately. both
+! parts of uw_conv_driver_part are executed when called from this
+! subroutine.
+!----------------------------------------------------------------------
-!------------------------------------------------------
-! compute and write out CAPE and CIN.
-!------------------------------------------------------
+integer, intent(in) :: is, ie, js, je
+type(mp_input_type), intent(inout) :: Input_mp
+type(aerosol_type), intent(in) :: Aerosol
+type(phys_mp_exch_type), intent(inout) :: Phys_mp_exch
+type(mp_output_type), intent(inout) :: Output_mp
+type(mp_tendency_type), intent(inout) :: Tend_mp
+type(conv_results_type), intent(inout) :: Conv_results
+type(mp_removal_type), intent(inout) :: Removal_mp
+type(cloud_scheme_data_type), intent(inout) :: Cld_props
- if ( id_cape > 0 .or. id_cin > 0) then
- kx = size(Input_mp%tin,3)
- ix = size(Input_mp%tin,1)
- jx = size(Input_mp%tin,2)
+!---------------------------------------------------------------------
+! is,js starting i and j indices for window
+! ie,je ending i and j indices for window
+! Input_mp derived type used to transfer needed input data between
+! moist_processes and convection_driver
+! Aerosol derived type containing model aerosol fields to be input
+! to model convective schemes
+! Phys_mp_exch
+! derived type used to transfer data between physics_driver
+! and convection_driver via moist_processes
+! Output_mp derived type used to transfer output fields between
+! convection_driver and moist_processes
+! Tend_mp derived type used to transfer calculated tendency data
+! between convection_driver and moist_processes
+! Conv_results
+! conv_results_type variable containing variables
+! used in multiple convective parameterizations and for
+! diagnostic output
+! Removal_mp derived type used to transfer precipitation and tracer
+! removal fields between convection_driver and
+! moist_processes
+! Cld_props derived type used to transfer uw cloud data between
+! atmos_model and convection_driver via physics_driver and
+! moist_processes
+!-----------------------------------------------------------------------
+
+ type(conv_tendency_type) :: Uw_tend
+ type(conv_output_type) :: Output_uw
+
+!------------------------------------------------------------------------
+! Uw_tend conv_tendency_type variable containing tendency
+! output from uw convection
+! Output_uw conv_output_type variable containing output
+! fields from uw convection
+!------------------------------------------------------------------------
-!----------------------------------------------
-! calculate mixing ratio.
-!----------------------------------------------
- rin = Input_mp%qin/(1.0 - Input_mp%qin)
+!-----------------------------------------------------------------------
+! activate the uw clock.
+!-----------------------------------------------------------------------
+ call mpp_clock_begin (uw_clock)
!-----------------------------------------------------------------------
-! call routine to calculate cape and cin.
+! call uw_conv_driver_part, executing both parts of the driver.
!-----------------------------------------------------------------------
- avgbl = .false.
- do j = 1,jx
- do i = 1,ix
- call capecalcnew &
- ( kx, Input_mp%pfull(i,j,:), Input_mp%phalf(i,j,:), &
- CP_AIR, RDGAS, RVGAS, HLV, KAPPA, Input_mp%tin(i,j,:), &
- rin(i,j,:), avgbl, cape(i,j), cin(i,j), tp(i,j,:), &
- rp(i,j,:), klcl(i,j), klfc(i,j), klzb(i,j))
- end do
- end do
+ call uw_conv_driver_part &
+ (is, ie, js, je, Input_mp, Aerosol, Phys_mp_exch, &
+ Output_mp, Tend_mp, Conv_results, Removal_mp, Cld_props, &
+ Uw_tend, Output_uw, .true., .true.)
-!-------------------------------------------------------------------------
-! output diagnostics.
-!-------------------------------------------------------------------------
- if (id_cape > 0) used = send_data ( id_cape, cape, Time, is, js )
- if ( id_cin > 0 ) used = send_data ( id_cin, cin, Time, is, js )
- if ( id_tp > 0 ) used = send_data ( id_tp, tp, Time, is, js )
- if ( id_rp > 0 ) used = send_data ( id_rp, rp, Time, is, js )
- if ( id_lcl > 0 ) used = send_data ( id_lcl, 1.0*klcl, Time, &
- is, js )
- if ( id_lfc > 0 ) used = send_data ( id_lfc, 1.0*klfc, Time, &
- is, js )
- if ( id_lzb > 0 ) used = send_data ( id_lzb, 1.0*klzb, Time, &
- is, js )
- end if
+!----------------------------------------------------------------------
+! turn off the uw clock.
+!----------------------------------------------------------------------
+ call mpp_clock_end (uw_clock)
-!-----------------------------------------------------------------------
+!------------------------------------------------------------------------
+end subroutine uw_conv_driver
-end subroutine cape_cin_diagnostics
+!########################################################################
-!#######################################################################
+subroutine uw_conv_driver_part &
+ (is, ie, js, je, Input_mp, Aerosol, Phys_mp_exch, &
+ Output_mp, Tend_mp, Conv_results, Removal_mp, Cld_props, &
+ Uw_tend, Output_uw, do_segment1, do_segment2)
-subroutine diag_field_init ( axes, Time, Control)
+!-----------------------------------------------------------------------
+integer, intent(in) :: is, ie, js, je
+type(mp_input_type), intent(inout) :: Input_mp
+type(aerosol_type), intent(in) :: Aerosol
+type(phys_mp_exch_type), intent(inout) :: Phys_mp_exch
+type(mp_output_type), intent(inout) :: Output_mp
+type(mp_tendency_type), intent(inout) :: Tend_mp
+type(conv_results_type), intent(inout) :: Conv_results
+type(mp_removal_type), intent(inout) :: Removal_mp
+type(cloud_scheme_data_type), intent(inout) :: Cld_props
+type(conv_tendency_type), intent(inout) :: Uw_tend
+type(conv_output_type), intent(inout) :: Output_uw
+logical, intent(in) :: do_segment1, do_segment2
+
+!-----------------------------------------------------------------------
+! is,js starting i and j indices for window
+! ie,je ending i and j indices for window
+! Input_mp derived type used to transfer needed input data between
+! moist_processes and convection_driver
+! Aerosol derived type containing model aerosol fields to be input
+! to model convective schemes
+! Phys_mp_exch
+! derived type used to transfer data between physics_driver
+! and convection_driver via moist_processes
+! Output_mp derived type used to transfer output fields between
+! convection_driver and moist_processes
+! Tend_mp derived type used to transfer calculated tendency data
+! between convection_driver and moist_processes
+! Conv_results
+! conv_results_type variable containing variables
+! used in multiple convective parameterizations and for
+! diagnostic output
+! Removal_mp derived type used to transfer precipitation and tracer
+! removal fields between convection_driver and
+! moist_processes
+! Cld_props derived type used to transfer uw cloud data between
+! atmos_model and convection_driver via physics_driver and
+! moist_processes
+! Uw_tend conv_tendency_type variable containing tendency
+! output from uw convection
+! Output_uw conv_output_type variable containing output
+! fields from uw convection
+! do_segment1
+! logical indicating if first part of uw_conv_driver is to
+! be executed
+! do_segment2
+! logical indicating if second part of uw_conv_driver is to
+! be executed
+!-----------------------------------------------------------------------
-integer, intent(in) :: axes(4)
-type(time_type), intent(in) :: Time
-type(mp_removal_control_type), intent(in) :: Control
+ real, dimension(size(Input_mp%t,1), size(Input_mp%t,2), &
+ size(Input_mp%t,3)) :: targ, qarg
+ real, dimension(size(Input_mp%t,1), size(Input_mp%t,2), &
+ size(Input_mp%t,3), num_uw_tracers) :: trcr
+ real, dimension(size(Input_mp%t,1), size(Input_mp%t,2), &
+ size(Input_mp%t,3), &
+ num_prog_tracers) :: tracerarg
+ integer :: ix, jx, kx
+ logical :: used
+ integer :: nt
+ integer :: n
+ integer :: nn
- character(len=32) :: tracer_units, tracer_name
- character(len=128) :: diaglname
- integer, dimension(3) :: half = (/1,2,4/)
- integer :: n, nn
+!---------------------------------------------------------------------
+! targ temperature field passed to uw_conv
+! qarg specific humidity field passed to uw_conv
+! trcr set of tracers actually transported by uw_conv
+! tracerarg tracer fields passed to uw_conv
+! ix, jx, kx physics window dimensions
+! nt number of prognostic tracers
+! n do loop index
+! nn counter
+!----------------------------------------------------------------------
-!------------ initialize diagnostic fields in this module -------------
+!-----------------------------------------------------------------------
+! define array dimensions and number of prognostic tracers.
+!-----------------------------------------------------------------------
+ ix = size(Input_mp%t,1)
+ jx = size(Input_mp%t,2)
+ kx = size(Input_mp%t,3)
+ nt = size(Output_mp%rdt,4)
-!----- initialize global integrals for netCDF output -----
- id_pr_g = register_global_diag_field ('pr', Time, 'Precipitation', &
- 'kg m-2 s-1', standard_name='precipitation_flux', buffer=.true. )
- id_prc_g = register_global_diag_field ('prc', Time, 'Convective Precipitation', &
- 'kg m-2 s-1', standard_name='convective_precipitation_flux', buffer=.true. )
- id_prsn_g = register_global_diag_field ('prsn', Time, 'Snowfall Flux', 'kg m-2 s-1', &
- standard_name='snowfall_flux', buffer=.true. )
-!-------------------------------------------------------------------------
-! diagnostics related to total convective tendencies of temperature,
-! vapor and precipitation.
-!-------------------------------------------------------------------------
- id_tdt_conv = register_diag_field ( mod_name, &
- 'tdt_conv', axes(1:3), Time, &
- 'Temperature tendency from convection ', 'deg_K/s', &
- missing_value=missing_value )
+!-----------------------------------------------------------------------
+! this first part is executed when do_segment1 = .true.. to reproduce
+! the warsaw results it is necessary to execute the first part, call
+! donner, and then finish the uw execution (do_segment2 = .true.)
+!-----------------------------------------------------------------------
+ if (do_segment1) then
+!----------------------------------------------------------------------
+! call uw_alloc to allocate the needed components of the local derived
+! type varaibles resident in this module.
+!----------------------------------------------------------------------
+ call uw_alloc (ix, jx, kx, Uw_tend, Output_uw)
+!------------------------------------------------------------------------
+! define arguments to be used in uw convection calculation, either the
+! fields upon entry to convection, or the fields after having been
+! modified by another convective parameterization.
+!------------------------------------------------------------------------
+ if (use_updated_profiles_for_uw) then
- ID_tntc = register_cmip_diag_field_3d ( mod_name, 'tntc', Time, &
- 'Tendency of Air Temperature Due to Convection ', 'K s-1', &
- standard_name='tendency_of_air_temperature_due_to_convection' )
+!---------------------------------------------------------------------
+! if arguments are to be updated, update the tracer fields with
+! tendencies due to donner convection and wet deposition by donner
+! deep precipitation.
+!---------------------------------------------------------------------
+ do n=1,nt
+ if (.not. cloud_tracer(n)) then
+ Input_mp%tracer(:,:,:,n) = Input_mp%tracer_orig(:,:,:,n) + &
+ (Output_mp%rdt(:,:,:,n) - &
+ Output_mp%rdt_init(:,:,:,n)) *dt
+ endif
+ end do
- id_qdt_conv = register_diag_field ( mod_name, &
- 'qdt_conv', axes(1:3), Time, &
- 'Spec humidity tendency from convection ', 'kg/kg/s', &
- missing_value=missing_value )
+!---------------------------------------------------------------------
+! define the t, q and tracer fields to be passed to uw convection.
+!---------------------------------------------------------------------
+ targ = Input_mp%tin
+ qarg = Input_mp%qin
+ tracerarg = Input_mp%tracer
+ else
+ targ = Input_mp%tin_orig
+ qarg = Input_mp%qin_orig
+ tracerarg = Input_mp%tracer_orig
+ endif
- ID_tnhusc = register_cmip_diag_field_3d ( mod_name, 'tnhusc', Time, &
- 'Tendency of Specific Humidity Due to Convection ', 's-1', &
- standard_name='tendency_of_specific_humidity_due_to_convection' )
+!----------------------------------------------------------------------
+! if any tracers are to be transported by UW convection, check each
+! active tracer to find those to be transported and fill the
+! trcr array with these fields.
+!---------------------------------------------------------------------
+ nn = 1
+ do n=1, num_prog_tracers
+ if (tracers_in_uw(n)) then
+ trcr(:,:,:,nn) = tracerarg(:,:,:,n)
+ nn = nn + 1
+ endif
+ end do
- id_q_conv_col = register_diag_field ( mod_name, &
- 'q_conv_col', axes(1:2), Time, &
- 'Water vapor path tendency from convection ', &
- 'kg/m2/s' )
+!-------------------------------------------------------------------------
+! call uw_conv to calculate the effects of shallow convection.
+!-------------------------------------------------------------------------
+ call uw_conv (is, js, Time, targ, qarg, Input_mp%uin, &
+ Input_mp%vin, Input_mp%pfull, Input_mp%phalf,&
+ Input_mp% zfull, Input_mp%zhalf, tracerarg, &
+ Input_mp%omega, dt, Input_mp%pblht, &
+ Input_mp%ustar, Input_mp%bstar, Input_mp%qstar, &
+ Input_mp%land, Input_mp%coldT, Aerosol, &
+ Input_mp%lat, Input_mp%lon, Input_mp%cush, &
+ Phys_mp_exch%tke, doing_prog_clouds, &
+ Conv_results%conv_calc_completed, &
+ Conv_results%available_cf_for_uw, Uw_tend%ttnd, &
+ Uw_tend%qtnd, Uw_tend%qltnd, Uw_tend%qitnd, &
+ Uw_tend%qatnd, Uw_tend%qntnd, &
+ Uw_tend%utnd, Uw_tend%vtnd, Uw_tend%rain, &
+ Uw_tend%snow, Conv_results%uw_mflux, &
+ Removal_mp%liq_precflx, &
+ Removal_mp%ice_precflx, Cld_props%liquid_amt, &
+ Cld_props%ice_amt, Cld_props%cloud_area, &
+ Cld_props%droplet_number, trcr, Uw_tend%qtr, &
+ Removal_mp%uw_wetdep, Input_mp%cbmf, &
+ Phys_mp_exch%cgust)
- id_t_conv_col = register_diag_field ( mod_name, &
- 't_conv_col', axes(1:2), Time, &
- 'Column static energy tendency from convection ', &
- 'W/m2' )
+!-------------------------------------------------------------------------
+! call detr_ice_num to calculate the ice number tendency due to
+! detrainment, which is proportional to the ice mass.
+!-------------------------------------------------------------------------
+ if (do_ice_num .and. detrain_ice_num) then
+ CALL detr_ice_num (targ, Uw_tend%qitnd(:,:,:), &
+ Uw_tend%qnitnd(:,:,:) )
+ end if
+ endif ! (do_segment1)
- id_enth_conv_col = register_diag_field ( mod_name, &
- 'enth_conv_col', axes(1:2), Time, &
- 'Column enthalpy tendency from convection', &
- 'W/m2' )
+!----------------------------------------------------------------------
+! the second segment is executed whe do_segment2 is .true..
+!----------------------------------------------------------------------
+ if (do_segment2) then
- id_wat_conv_col = register_diag_field ( mod_name, &
- 'wat_conv_col', axes(1:2), Time, &
- 'Column total water tendency from convection', &
- 'kg(h2o)/m2/s' )
+!---------------------------------------------------------------------
+! if desired, call define_and_apply_scale to compute any adjustment
+! needed in order to preserve realizability for the water variables.
+!---------------------------------------------------------------------
+ if (do_limit_uw) then
+ call define_and_apply_scale &
+ (Input_mp, Uw_tend, Output_uw, .false., .true., Uw_tend%qtr)
+ else
+ Output_uw%scale = 1.0
+ endif
- id_prec_conv = register_diag_field ( mod_name, &
- 'prec_conv', axes(1:2), Time, &
- 'Precipitation rate from convection ', &
- 'kg(h2o)/m2/s', interp_method = "conserve_order1" )
+!-----------------------------------------------------------------------
+! call finalize_uw_outputs to define output fields, update input
+! fields as needed, and output uw-related diagnostics.
+!-----------------------------------------------------------------------
+ call finalize_uw_outputs (is, js, Input_mp, Uw_tend, Output_uw, &
+ Output_mp)
- id_prc = register_cmip_diag_field_2d ( mod_name, 'prc', Time, &
- 'Convective Precipitation', 'kg m-2 s-1', &
- standard_name = 'convective_precipitation_flux', &
- interp_method = "conserve_order1" )
+!-----------------------------------------------------------------------
+! call update_outputs to update the arrays which will return the
+! convective tendencies to moist_processes.
+!-----------------------------------------------------------------------
+ call update_outputs (Uw_tend, Output_mp, Tend_mp)
- id_prrc = register_cmip_diag_field_2d ( mod_name, 'prrc', Time, &
- 'Convective Rainfall Rate', 'kg m-2 s-1', &
- standard_name='convective_rainfall_flux', &
- interp_method="conserve_order1" )
+!----------------------------------------------------------------------
+! call uw_dealloc to deallocate the components of the derived type
+! variables Uw_tend and Output_uw.
+!----------------------------------------------------------------------
+ call uw_dealloc (Uw_tend, Output_uw)
- id_snow_conv = register_diag_field ( mod_name, &
- 'snow_conv', axes(1:2), Time, &
- 'Frozen precip rate from convection ', &
- 'kg(h2o)/m2/s', interp_method = "conserve_order1" )
+!----------------------------------------------------------------------
+! end of segment2.
+!----------------------------------------------------------------------
+ endif ! (do_segment2)
- id_conv_freq = register_diag_field ( mod_name, &
- 'conv_freq', axes(1:2), Time, &
- 'frequency of convection ', '1', &
- missing_value = missing_value, &
- interp_method = "conserve_order1" )
+!------------------------------------------------------------------------
- id_prsnc = register_cmip_diag_field_2d ( mod_name, 'prsnc', Time, &
- 'Convective Snowfall Flux', 'kg m-2 s-1', &
- standard_name='convective_snowfall_flux', &
- interp_method="conserve_order1" )
- id_ci = register_cmip_diag_field_2d ( mod_name, 'ci', Time, &
- 'Fraction of Time Convection Occurs in Cell', '1.0', &
- standard_name='convection_time_fraction', &
- interp_method='conserve_order1' )
+end subroutine uw_conv_driver_part
- id_gust_conv = register_diag_field ( mod_name, &
- 'gust_conv', axes(1:2), Time, &
- 'Gustiness resulting from convection ', 'm/s' )
- id_conv_rain3d= register_diag_field ( mod_name, &
- 'conv_rain3d', axes(half), Time, &
- 'Rain fall rate from convection -3D ', &
- 'kg(h2o)/m2/s', interp_method='conserve_order1' )
- id_conv_snow3d= register_diag_field ( mod_name, &
- 'conv_snow3d', axes(half), Time, &
- 'Snow fall rate from convection -3D', &
- 'kg(h2o)/m2/s', interp_method='conserve_order1' )
+!#####################################################################
+
+subroutine uw_alloc (ix, jx, kx, Uw_tend, Output_uw)
!----------------------------------------------------------------------
-! tendencies of cloud tracers resulting from convection.
+! subroutine uw_alloc allocates the needed components of the
+! conv_tendency_type and conv_output_type variables.
!----------------------------------------------------------------------
- if (doing_prog_clouds ) then
-
- id_qldt_conv = register_diag_field ( mod_name, &
- 'qldt_conv', axes(1:3), Time, &
- 'Liquid water tendency from convection', &
- 'kg/kg/s', missing_value=missing_value )
-
- if (do_liq_num) then
- id_qndt_conv = register_diag_field ( mod_name, &
- 'qndt_conv', axes(1:3), Time, &
- 'Liquid drop tendency from convection', '#/kg/s',&
- missing_value=missing_value )
- endif
+integer, intent(in) :: ix, jx, kx
+type(conv_tendency_type), intent(inout) :: Uw_tend
+type(conv_output_type), intent(inout) :: Output_uw
- id_qidt_conv = register_diag_field ( mod_name, &
- 'qidt_conv', axes(1:3), Time, &
- 'Ice water tendency from convection', 'kg/kg/s', &
- missing_value=missing_value )
+!------------------------------------------------------------------------
+! ix, jx, kx physics window dimensions
+! Uw_tend conv_tendency_type variable containing tendency
+! output from uw convection
+! Output_uw conv_output_type variable containing output
+! fields from uw convection
+!------------------------------------------------------------------------
- id_qadt_conv = register_diag_field ( mod_name, &
- 'qadt_conv', axes(1:3), Time, &
- 'Cloud fraction tendency from convection', '1/sec',&
- missing_value=missing_value )
+!----------------------------------------------------------------------
+! allocate and initialize the needed components of Uw_tend.
+!----------------------------------------------------------------------
+ allocate (Uw_tend%delta_q (ix, jx,kx))
+ allocate (Uw_tend%rain (ix, jx))
+ allocate (Uw_tend%snow (ix, jx))
+ allocate (Uw_tend%ttnd (ix, jx, kx))
+ allocate (Uw_tend%qtnd (ix, jx, kx))
+ allocate (Uw_tend%utnd (ix, jx, kx))
+ allocate (Uw_tend%vtnd (ix, jx, kx))
+ allocate (Uw_tend%qltnd (ix, jx, kx))
+ allocate (Uw_tend%qitnd (ix, jx, kx))
+ allocate (Uw_tend%qatnd (ix, jx, kx))
+ allocate (Uw_tend%qntnd (ix, jx, kx))
+ allocate (Uw_tend%qnitnd (ix, jx, kx))
+ allocate (Uw_tend%qtr (ix, jx, kx, num_uw_tracers))
+
+ Uw_tend%delta_q = 0.
+ Uw_tend%rain = 0.
+ Uw_tend%snow = 0.
+ Uw_tend%ttnd = 0.
+ Uw_tend%qtnd = 0.
+ Uw_tend%utnd = 0.
+ Uw_tend%vtnd = 0.
+ Uw_tend%qltnd = 0.
+ Uw_tend%qitnd = 0.
+ Uw_tend%qatnd = 0.
+ Uw_tend%qntnd = 0.
+ Uw_tend%qnitnd = 0.
+ Uw_tend%qtr = 0.
- id_ql_conv_col = register_diag_field ( mod_name, &
- 'ql_conv_col', axes(1:2), Time, &
- 'Liquid water path tendency from convection', &
- 'kg/m2/s' )
+!----------------------------------------------------------------------
+! allocate and initialize the needed components of Output_uw.
+!----------------------------------------------------------------------
+ allocate (Output_uw%liquid_precip (ix, jx, kx))
+ allocate (Output_uw%frozen_precip (ix, jx, kx))
+ allocate (Output_uw%total_precip (ix, jx))
+ allocate (Output_uw%scale (ix, jx))
+ allocate (Output_uw%scale_REV (ix, jx))
+
+ Output_uw%liquid_precip = 0.
+ Output_uw%frozen_precip = 0.
+ Output_uw%total_precip = 0.
+ Output_uw%scale = 1.0
+ Output_uw%scale_REV = 1.0
- if (do_liq_num) then
- id_qn_conv_col = register_diag_field ( mod_name, &
- 'qn_conv_col', axes(1:2), Time, &
- 'Liquid drp tendency from convection', &
- 'kg/m2/s' )
- endif
+!----------------------------------------------------------------------
- id_qi_conv_col = register_diag_field ( mod_name, &
- 'qi_conv_col', axes(1:2), Time, &
- 'Ice water path tendency from convection', &
- 'kg/m2/s' )
- id_qa_conv_col = register_diag_field ( mod_name, &
- 'qa_conv_col', axes(1:2), Time, &
- 'Cloud mass tendency from convection', 'kg/m2/s' )
+end subroutine uw_alloc
- if (do_ice_num) then
- id_qnidt_conv = register_diag_field ( mod_name, &
- 'qnidt_conv', axes(1:3), Time, &
- 'Ice number tendency from convection', '#/kg/s',&
- missing_value=missing_value )
- id_qni_conv_col = register_diag_field ( mod_name, &
- 'qni_conv_col', axes(1:2), Time, &
- 'Ice number tendency from convection', &
- 'kg/m2/s' )
- endif
- endif ! (doing_prog_clouds)
-!-----------------------------------------------------------------------
-! diagnostics for cloud base and cloud top.
-!-----------------------------------------------------------------------
- id_conv_cld_base = register_diag_field ( mod_name, &
- 'conv_cld_base', axes(1:2), Time, &
- 'pressure at convective cloud base', 'Pa', &
- mask_variant = .true., &
- missing_value=missing_value )
+!#######################################################################
- id_ccb = register_cmip_diag_field_2d ( mod_name, 'ccb', Time, &
- 'Air Pressure at Convective Cloud Base', 'Pa', &
- standard_name = 'air_pressure_at_convective_cloud_base', &
- mask_variant = .true. )
+subroutine finalize_uw_outputs (is, js, Input_mp, Uw_tend, Output_uw, &
+ Output_mp)
- id_conv_cld_top = register_diag_field ( mod_name, &
- 'conv_cld_top', axes(1:2), Time, &
- 'pressure at convective cloud top', 'Pa', &
- mask_variant = .true., &
- missing_value=missing_value )
+!---------------------------------------------------------------------
+! subroutine finalize_uw_outputs finishes processing the uw convection
+! results, updates the needed output variables, and produces the
+! diagnostics related to uw convection.
+!---------------------------------------------------------------------
- id_cct = register_cmip_diag_field_2d ( mod_name, 'cct', Time, &
- 'Air Pressure at Convective Cloud Top', 'Pa', &
- standard_name = 'air_pressure_at_convective_cloud_top', &
- mask_variant = .true. )
+integer, intent(in) :: is, js
+type(mp_input_type), intent(inout) :: Input_mp
+type(conv_tendency_type), intent(inout) :: Uw_tend
+type(conv_output_type), intent(inout) :: Output_uw
+type(mp_output_type), intent(inout) :: Output_mp
+!---------------------------------------------------------------------
+! is,js starting i and j indices for window
+! Input_mp derived type used to transfer needed input data between
+! moist_processes and convection_driver
+! Uw_tend conv_tendency_type variable containing tendency
+! output from uw convection
+! Output_uw conv_output_type variable containing output
+! fields from uw convection
+! Output_mp derived type used to transfer output fields between
+! convection_driver and moist_processes
!-----------------------------------------------------------------------
-! convective mass flux diagnostics.
-!-----------------------------------------------------------------------
- id_mc_full = register_diag_field ( mod_name, &
- 'mc_full', axes(1:3), Time, &
- 'Net Mass Flux from convection', 'kg/m2/s', &
- missing_value=missing_value )
- id_mc_half = register_diag_field ( mod_name, &
- 'mc_half', axes(half), Time, &
- 'Net Mass Flux from convection on half levs', &
- 'kg/m2/s', missing_value=missing_value )
+ logical :: used
+ integer :: n
+ integer :: nn
- ID_mc = register_cmip_diag_field_3d ( mod_name, 'mc', Time, &
- 'Convective Mass Flux', 'kg m-2 s-1', &
- standard_name='atmosphere_net_upward_convective_mass_flux', &
- interp_method = 'conserve_order1', axis="half" )
+!---------------------------------------------------------------------
+! used logical used to indicate data has been received by
+! diag_manager_mod
+! n do loop index
+! nn counter
+!---------------------------------------------------------------------
- id_mc_conv_up = register_diag_field ( mod_name, &
- 'mc_conv_up', axes(1:3), Time, &
- 'Upward Mass Flux from convection', 'kg/m2/s', &
- missing_value=missing_value )
+!---------------------------------------------------------------------
+! call update_inputs to update the components of Input_mp that have
+! been modified by uw convection.
+!---------------------------------------------------------------------
+ call update_inputs (Uw_tend, Input_mp)
!---------------------------------------------------------------------
-! register diagnostics for lightning NOx.
+! call uw_diagnostics to output desired diagnostics related to the
+! uw convection scheme.
!---------------------------------------------------------------------
- if (get_tracer_index(MODEL_ATMOS,'no') > 0) then
- id_prod_no = register_diag_field ( 'tracers', &
- 'hook_no', axes(1:3), Time, &
- 'hook_no', 'molec/cm3/s')
- ID_emilnox_area = register_cmip_diag_field_3d ( mod_name, 'emilnox_area', Time, &
- 'Layer-integrated Lightning Production of NOx', 'mol m-2 s-1', &
- standard_name='tendency_of_atmosphere_moles_of_nox_expressed_as_nitrogen')
- end if
+ call uw_diagnostics (is, js, Input_mp, Uw_tend, Output_uw)
-!-------------------------------------------------------------------------
-! register diagnostics specific to the Betts-Miller experiments.
-!-------------------------------------------------------------------------
- if ( any((/do_bm, do_bmmass, do_bmomp/)) ) then
- id_qref = register_diag_field ( mod_name, &
- 'qref', axes(1:3), Time, &
- 'Adjustment reference specific humidity profile', &
- 'kg/kg', missing_value=missing_value )
+!-----------------------------------------------------------------------
+! if the warsaw order of calculation (inconsistent) is to be
+! retained, save the changes to temperature and to the tracers in
+! the variables xxx_tentative, so that they may be applied at a
+! later time.
+!-----------------------------------------------------------------------
+ if (reproduce_AM4) then
+ Input_mp%tin_tentative = Uw_tend%ttnd*dt
- id_tref = register_diag_field ( mod_name, &
- 'tref', axes(1:3), Time, &
- 'Adjustment reference temperature profile', &
- 'K', missing_value=missing_value )
+!------------------------------------------------------------------------
+! save the current tracer tendencies obtained from uw transport.
+!------------------------------------------------------------------------
+ if (do_limit_uw) then
+ nn = 1
+ do n=1, num_prog_tracers
+ if (tracers_in_uw(n)) then
+ Output_mp%rdt_tentative(:,:,:,n) = Uw_tend%qtr(:,:,:,nn)
+ nn = nn + 1
+ else
+ Output_mp%rdt_tentative(:,:,:,n) = 0.
+ endif
+ end do
+ else
- id_bmflag = register_diag_field (mod_name, &
- 'bmflag', axes(1:2), Time, &
- 'Betts-Miller flag', &
- 'no units', missing_value=missing_value )
+!------------------------------------------------------------------------
+! update the current tracer tendencies with the contributions
+! obtained from uw transport.
+!------------------------------------------------------------------------
+ nn = 1
+ do n=1, num_prog_tracers
+ if (tracers_in_uw(n)) then
+ Output_mp%rdt(:,:,:,n) = Output_mp%rdt(:,:,:,n) + &
+ Uw_tend%qtr(:,:,:,nn)
+ nn = nn + 1
+ endif
+ end do
+ endif
- id_klzbs = register_diag_field (mod_name, &
- 'klzbs', axes(1:2), Time, &
- 'klzb', &
- 'no units', missing_value=missing_value )
+!-----------------------------------------------------------------------
+! if warsaw results are to be corrected, the Input_mp%tin
+! and Output_mp%rdt fields are updated with the uw tendencies at this
+! point.
+!-----------------------------------------------------------------------
+ else
+ Input_mp%tin = Input_mp%tin + Uw_tend%ttnd*dt
+!------------------------------------------------------------------------
+! update the current tracer tendencies with the contributions
+! obtained from uw transport.
+!------------------------------------------------------------------------
+ nn = 1
+ do n=1, num_prog_tracers
+ if (tracers_in_uw(n)) then
+ Output_mp%rdt(:,:,:,n) = Output_mp%rdt(:,:,:,n) + &
+ Uw_tend%qtr(:,:,:,nn)
+ nn = nn + 1
+ endif
+ end do
endif
- id_cape = register_diag_field ( mod_name, &
- 'cape', axes(1:2), Time, &
- 'Convectively available potential energy', 'J/Kg')
+!---------------------------------------------------------------------
- id_cin = register_diag_field ( mod_name, &
- 'cin', axes(1:2), Time, &
- 'Convective inhibition', 'J/Kg')
- id_tp = register_diag_field ( mod_name, &
- 'tp', axes(1:3), Time, &
- 'Temperature of lifted parcel', 'K')
- id_rp = register_diag_field ( mod_name, &
- 'rp', axes(1:3), Time, &
- 'Humidity of lifted parcel', 'kg/kg')
- id_lcl = register_diag_field ( mod_name, &
- 'klcl', axes(1:2), Time, &
- 'Index of LCL', 'none')
- id_lfc = register_diag_field ( mod_name, &
- 'klfc', axes(1:2), Time, &
- 'Index of LFC', 'none')
- id_lzb = register_diag_field ( mod_name, &
- 'klzb', axes(1:2), Time, &
- 'Index of LZB', 'none')
+end subroutine finalize_uw_outputs
- if (do_bm ) then
- id_invtaubmt = register_diag_field (mod_name, &
- 'invtaubmt', axes(1:2), Time, &
- 'Inverse temperature relaxation time', &
- '1/s', missing_value=missing_value )
- id_invtaubmq = register_diag_field (mod_name, &
- 'invtaubmq', axes(1:2), Time, &
- 'Inverse humidity relaxation time', &
- '1/s', missing_value=missing_value )
- end if ! if ( do_bm )
- if (do_bmmass) then
- id_massflux = register_diag_field (mod_name, &
- 'massflux', axes(1:3), Time, &
- 'Massflux implied by temperature adjustment', &
- 'm/s', missing_value=missing_value )
- end if ! if ( do_bmmass )
+!#######################################################################
-!------------------------------------------------------------------------
-! register diagnostics specific to the ras parameterization.
-!------------------------------------------------------------------------
-!RSH activate this if when convection code redone:
-! if (do_ras) then
- id_ras_precip = register_diag_field ( mod_name, &
- 'ras_precip', axes(1:2), Time, &
- 'Precipitation rate from ras ', 'kg/m2/s', &
- interp_method = 'conserve_order1' )
+subroutine update_inputs (Uw_tend, Input_mp)
+
+!---------------------------------------------------------------------
+! subroutine update_inputs updates the fields contained in Input_mp
+! that have been modified by the uw convection calculation.
+!---------------------------------------------------------------------
- id_ras_freq = register_diag_field ( mod_name, &
- 'ras_freq', axes(1:2), Time, &
- 'frequency of precip from ras ', 'number' , &
- missing_value = missing_value , &
- interp_method = 'conserve_order1' )
-! endif
+type(conv_tendency_type), intent(in) :: Uw_tend
+type(mp_input_type), intent(inout) :: Input_mp
-!------------------------------------------------------------------------
-! register diagnostics specific to the donner parameterization.
-!------------------------------------------------------------------------
-!RSH activate this if when convection code redone:
-! following if activated 10/8/16:
- if (do_donner_deep) then
- id_don_precip = register_diag_field ( mod_name, &
- 'don_precip', axes(1:2), Time, &
- 'Precipitation rate from donner ', 'kg/m2/s', &
- interp_method = 'conserve_order1' )
+!----------------------------------------------------------------------
+! Uw_tend conv_tendency_type variable containing tendency
+! output from uw convection
+! Input_mp derived type used to transfer needed input data between
+! moist_processes and convection_driver
+!--------------------------------------------------------------------
- id_don_freq = register_diag_field ( mod_name, &
- 'don_freq', axes(1:2), Time, &
- 'frequency of precip from donner ', 'number', &
- missing_value = missing_value, &
- interp_method = 'conserve_order1' )
-
- id_enth_donner_col2 = register_diag_field ( mod_name, &
- 'enth_donner_col2', axes(1:2), Time, &
- 'column enthalpy tendency from Donner liq&
- & precip','W/m2' )
-
- id_enth_donner_col3 = register_diag_field ( mod_name, &
- 'enth_donner_col3', axes(1:2), Time, &
- 'Column enthalpy tendency from Donner &
- &frzn precip','W/m2' )
-
- id_enth_donner_col4 = register_diag_field ( mod_name, &
- 'enth_donner_col4', axes(1:2), Time, &
- 'Atmospheric column enthalpy tendency from&
- & Donner convection', 'W/m2' )
-
- id_enth_donner_col5 = register_diag_field ( mod_name, &
- 'enth_donner_col5', axes(1:2), Time, &
- 'Column enthalpy tendency due to condensate&
- & xfer from Donner to lsc','W/m2' )
+!-------------------------------------------------------------------------
+! update Input_mp fields with changes from uw_conv.
+!-------------------------------------------------------------------------
+ Input_mp%qin = Input_mp%qin + Uw_tend%qtnd*dt
+ Input_mp%uin = Input_mp%uin + Uw_tend%utnd*dt
+ Input_mp%vin = Input_mp%vin + Uw_tend%vtnd*dt
+ Input_mp%tracer(:,:,:,nql) = Input_mp%tracer(:,:,:,nql) + &
+ Uw_tend%qltnd*dt
+ Input_mp%tracer(:,:,:,nqi) = Input_mp%tracer(:,:,:,nqi) + &
+ Uw_tend%qitnd*dt
+ Input_mp%tracer(:,:,:,nqa) = Input_mp%tracer(:,:,:,nqa) + &
+ Uw_tend%qatnd*dt
+ if (do_liq_num) then
+ Input_mp%tracer(:,:,:,nqn) = Input_mp%tracer(:,:,:,nqn) + &
+ Uw_tend%qntnd*dt
+ endif
+ if (do_ice_num) then
+ Input_mp%tracer(:,:,:,nqni) = Input_mp%tracer(:,:,:,nqni) + &
+ Uw_tend%qnitnd*dt
+ endif
- id_enth_donner_col6 = register_diag_field ( mod_name, &
- 'enth_donner_col6', axes(1:2), Time, &
- 'Column enthalpy tendency from donner &
- &moisture conservation adjustment','W/m2' )
+!------------------------------------------------------------------
- id_enth_donner_col7 = register_diag_field ( mod_name, &
- 'enth_donner_col7', axes(1:2), Time, &
- 'Precip adjustment needed to balance donner&
- & moisture adjustment','kg(h2o)/m2/s' )
- id_enth_donner_col = register_diag_field ( mod_name, &
- 'enth_donner_col', axes(1:2), Time, &
- 'Column enthalpy imbalance from Donner &
- &convection','W/m2' )
+end subroutine update_inputs
- id_wat_donner_col = register_diag_field ( mod_name, &
- 'wat_donner_col', axes(1:2), Time, &
- 'Column total water tendency from Donner&
- & convection','kg(h2o)/m2/s' )
- id_enth_mca_donner_col = register_diag_field ( mod_name, &
- 'enth_mca_donner_col', axes(1:2), Time, &
- 'Column enthalpy imbalance from Donner&
- & MCA convection','W/m2' )
- id_wat_mca_donner_col = register_diag_field ( mod_name, &
- 'wat_mca_donner_col', axes(1:2), Time, &
- 'Column total water imbalance from Donner&
- & MCA convection', 'kg(h2o)/m2/s' )
-
- id_scale_donner = register_diag_field ( mod_name, &
- 'scale_donner', axes(1:2), Time, &
-!RSH: FIx in final version:
-! 'Scaling factor applied to donner convection&
- 'Scaling factor applied to UW convection&
- & tendencies','1' )
-
- id_tdt_deep_donner= register_diag_field ( mod_name, &
- 'tdt_deep_donner', axes(1:3), Time, &
- ' heating rate - deep portion', 'deg K/s', &
- missing_value=missing_value )
-
- id_qdt_deep_donner = register_diag_field ( mod_name, &
- 'qdt_deep_donner', axes(1:3), Time, &
- ' moistening rate - deep portion', 'kg/kg/s',&
- missing_value=missing_value )
-
- id_qadt_deep_donner = register_diag_field ( mod_name, &
- 'qadt_deep_donner', axes(1:3), Time, &
- ' cloud amount tendency - deep portion', &
- '1/s', missing_value=missing_value )
-
- id_qldt_deep_donner = register_diag_field ( mod_name, &
- 'qldt_deep_donner', axes(1:3), Time, &
- ' cloud liquid tendency - deep portion', &
- 'kg/kg/s', missing_value=missing_value )
+!#########################################################################
- id_qidt_deep_donner = register_diag_field ( mod_name, &
- 'qidt_deep_donner', axes(1:3), Time, &
- ' ice water tendency - deep portion', &
- 'kg/kg/s', missing_value=missing_value )
- if (do_liq_num) &
- id_qndt_deep_donner = register_diag_field ( mod_name, &
- 'qndt_deep_donner', axes(1:3), Time, &
- 'deep convection cloud drop tendency', &
- '#/kg/s', missing_value=missing_value )
+subroutine uw_diagnostics (is, js, Input_mp, Uw_tend, Output_uw)
- if (do_ice_num) &
- id_qnidt_deep_donner = register_diag_field ( mod_name, &
- 'qnidt_deep_donner', axes(1:3), Time, &
- ' ice number tendency - deep portion', &
- '#/kg/s', missing_value=missing_value )
-
- id_tdt_mca_donner = register_diag_field ( mod_name, &
- 'tdt_mca_donner', axes(1:3), Time, &
- ' heating rate - mca portion', 'deg K/s', &
- missing_value=missing_value )
-
- id_qdt_mca_donner = register_diag_field ( mod_name, &
- 'qdt_mca_donner', axes(1:3), Time, &
- ' moistening rate - mca portion', 'kg/kg/s', &
- missing_value=missing_value )
-
- id_prec_deep_donner = register_diag_field ( mod_name, &
- 'prc_deep_donner', axes(1:2), Time, &
- ' total precip rate - deep portion', &
- 'kg/m2/s', missing_value=missing_value, &
- interp_method = "conserve_order1" )
-
- id_precret_deep_donner = register_diag_field ( mod_name, &
- 'prc_ret_deep_donner', axes(1:2), Time, &
- ' precip_returned - per timestep', &
- 'kg/m2/timestep', &
- missing_value=missing_value, &
- interp_method = "conserve_order1" )
-
- id_prec1_deep_donner = register_diag_field ( mod_name, &
- 'prc1_deep_donner', axes(1:2), Time, &
- ' change in precip for conservation&
- & in donner', 'kg/m2/s ', &
- missing_value=missing_value, &
- mask_variant = .true., &
- interp_method = "conserve_order1" )
+!--------------------------------------------------------------------
+! subroutine uw_diagnostics outputs uw-related diagnostics.
+!--------------------------------------------------------------------
- id_prec_mca_donner = register_diag_field ( mod_name, &
- 'prc_mca_donner', axes(1:2), Time, &
- ' total precip rate - mca portion', &
- 'kg/m2/s', missing_value=missing_value, &
- interp_method = "conserve_order1" )
+integer, intent(in) :: is, js
+type(mp_input_type), intent(in) :: Input_mp
+type(conv_tendency_type), intent(in) :: Uw_tend
+type(conv_output_type), intent(in) :: Output_uw
- id_snow_deep_donner = register_diag_field ( mod_name, &
- 'snow_deep_donner', axes(1:2), Time, &
- ' frozen precip rate - deep portion', &
- 'kg/m2/s', missing_value=missing_value, &
- interp_method = "conserve_order1" )
+!-------------------------------------------------------------------
+! is,js starting i and j indices for window
+! Input_mp derived type used to transfer needed input data between
+! moist_processes and convection_driver
+! Uw_tend conv_tendency_type variable containing tendency
+! output from uw convection
+! Output_uw conv_output_type variable containing output
+! fields from uw convection
+!-------------------------------------------------------------------
- id_snow_mca_donner = register_diag_field ( mod_name, &
- 'snow_mca_donner', axes(1:2), Time, &
- ' frozen precip rate - mca portion', &
- 'kg/m2/s', missing_value=missing_value, &
- interp_method = "conserve_order1" )
+ real, dimension(size(Input_mp%tin,1), &
+ size(Input_mp%tin,2)) :: temp_2d
+ logical, dimension(size(Input_mp%tin,1), &
+ size(Input_mp%tin,2)) :: ltemp
+ logical :: used
- id_mc_donner = register_diag_field ( mod_name, &
- 'mc_donner', axes(1:3), Time, &
- 'Net Mass Flux from donner', 'kg/m2/s', &
- missing_value=missing_value )
+!----------------------------------------------------------------------
+! temp_2d temporary real array
+! ltemp temporary logical array
+! used logical used to indicate data has been received by
+! diag_manager_mod
+!----------------------------------------------------------------------
- id_mc_donner_half = register_diag_field ( mod_name, &
- 'mc_donner_half', axes(half), Time, &
- 'Net Mass Flux from donner at half levs', &
- 'kg/m2/s', missing_value=missing_value )
+!-----------------------------------------------------------------------
+! output the scaling factor.
+!-----------------------------------------------------------------------
+ used = send_data (id_scale_uw, Output_uw%scale, Time, is, js )
- id_m_cdet_donner = register_diag_field ( mod_name, &
- 'm_cdet_donner', axes(1:3), Time, &
- 'Detrained Cell Mass Flux from donner', &
- 'kg/m2/s', missing_value=missing_value )
+!-----------------------------------------------------------------------
+! output total precip and snow from the uw convection scheme.
+!-----------------------------------------------------------------------
+ used = send_data (id_uw_precip, Uw_tend%rain + Uw_tend%snow, &
+ Time, is, js)
+ used = send_data (id_uw_snow, Uw_tend%snow, Time, is, js)
- id_m_cellup = register_diag_field ( mod_name, &
- 'm_cellup', axes(half), Time, &
- 'Upward Cell Mass Flux from donner', 'kg/m2/s', &
- missing_value=missing_value )
+!-----------------------------------------------------------------------
+! prognostic variable tendencies from uw convection.
+!-----------------------------------------------------------------------
+ used = send_data (id_tdt_uw, Uw_tend%ttnd, Time, is, js, 1)
+ used = send_data (id_qdt_uw, Uw_tend%qtnd, Time, is, js, 1)
+ used = send_data (id_qadt_uw, Uw_tend%qatnd, Time, is, js, 1)
+ used = send_data (id_qldt_uw, Uw_tend%qltnd, Time, is, js, 1)
+ used = send_data (id_qidt_uw, Uw_tend%qitnd, Time, is, js, 1)
+ if (do_liq_num) then
+ used = send_data (id_qndt_uw, Uw_tend%qntnd, Time, is, js, 1)
+ endif
+ if (do_ice_num) then
+ used = send_data (id_qnidt_uw, Uw_tend%qnitnd, Time, is, js, 1)
+ end if
- id_cell_cld_frac = register_diag_field ( mod_name, &
- 'cell_cld_frac', axes(1:3), Time, &
- 'cell cloud fraction from donner', '', &
- missing_value=missing_value )
+!-------------------------------------------------------------------
+! enthalpy and water column tendencies from uw.
+!-------------------------------------------------------------------
+ if (id_enth_uw_col > 0) then
+ temp_2d = -HLV*Uw_tend%rain -HLS*Uw_tend%snow
+ call column_diag (id_enth_uw_col, is, js, Time, Uw_tend%ttnd, &
+ CP_AIR, Uw_tend%qltnd, -HLV, Uw_tend%qitnd, &
+ -HLS, Input_mp%pmass, temp_2d)
+ endif
- id_meso_cld_frac = register_diag_field ( mod_name, &
- 'meso_cld_frac', axes(1:3), Time, &
- 'meso-scale cloud fraction from donner', '', &
- missing_value=missing_value )
+ if (id_wat_uw_col > 0) then
+ temp_2d = Uw_tend%rain + Uw_tend%snow
+ call column_diag(id_wat_uw_col, is, js, Time, Uw_tend%qtnd, 1.0, &
+ Uw_tend%qltnd, 1.0, Uw_tend%qitnd, 1.0, &
+ Input_mp%pmass, temp_2d)
+ endif
+
+!----------------------------------------------------------------------
+! uw convection scheme frequency diagnostics.
+!----------------------------------------------------------------------
+ if (id_uw_freq > 0) then
+ ltemp = Uw_tend%rain > 0. .or. Uw_tend%snow > 0.0
+ where (ltemp)
+ temp_2d = 1.
+ elsewhere
+ temp_2d = 0.
+ end where
+ used = send_data (id_uw_freq, temp_2d, Time, is, js)
+ endif
- id_donner_humidity_area = register_diag_field ( mod_name, &
- 'donner_humidity_area', axes(1:3), Time,&
- 'donner humidity area', '', &
- missing_value=missing_value )
+!----------------------------------------------------------------------
- if (do_donner_conservation_checks) then
- id_enthint = register_diag_field &
- (mod_name, 'enthint_don', axes(1:2), Time, &
- 'atmospheric column enthalpy change from donner', &
- 'W/m2', missing_value=missing_value)
-
- id_lcondensint = register_diag_field &
- (mod_name, 'lcondensint_don', axes(1:2), Time, &
- 'enthalpy transferred by condensate from &
- &donner to lscale', 'W/m2', &
- missing_value=missing_value)
-
- id_lprcp = register_diag_field &
- (mod_name, 'lprcpint_don', axes(1:2), &
- Time, 'enthalpy removed by donner precip', 'W/m2', &
- missing_value=missing_value)
-
- id_vertmotion = register_diag_field &
- (mod_name, 'vertmotion_don', axes(1:2), Time, &
- 'enthalpy change due to cell and meso motion &
- &in donner', 'W/m2', &
- missing_value=missing_value)
+end subroutine uw_diagnostics
- id_enthdiffint = register_diag_field &
- (mod_name, 'enthdiffint_don', axes(1:2), &
- Time, 'enthalpy imbalance due to donner', &
- 'W/m2', missing_value=missing_value)
- id_vaporint = register_diag_field &
- (mod_name, 'vaporint_don', axes(1:2), &
- Time, 'column water vapor change', 'kg(h2o)/m2/s',&
- missing_value=missing_value)
- id_max_enthalpy_imbal_don = register_diag_field &
- (mod_name, 'max_enth_imbal_don', &
- axes(1:2), Time, &
- 'max enthalpy imbalance from&
- & donner', 'W/m**2', &
- missing_value=missing_value)
-
- id_max_water_imbal_don = register_diag_field &
- (mod_name, 'max_water_imbal_don', &
- axes(1:2), Time, 'max water imbalance&
- & from donner', 'kg(h2o)/m2/s', &
- missing_value=missing_value)
-
- id_condensint = register_diag_field &
- (mod_name, 'condensint_don', axes(1:2), Time, &
- 'column condensate exported from donner&
- & to lscale', 'kg(h2o)/m2/s', &
- missing_value=missing_value )
+!#######################################################################
- id_precipint = register_diag_field &
- (mod_name, 'precipint_don', axes(1:2), &
- Time, 'column precip from donner', &
- 'kg(h2o)/m2/s', missing_value=missing_value)
+subroutine uw_dealloc (Uw_tend, Output_uw)
- id_diffint= register_diag_field &
- (mod_name, 'diffint_don', axes(1:2), &
- Time, 'water imbalance due to donner', &
- 'kg(h2o)/m2/s', missing_value=missing_value)
+!-----------------------------------------------------------------------
+! subroutine uw_dealloc deallocates the components of the derived type
+! variables Uw_tend and Output_uw.
+!-----------------------------------------------------------------------
- endif
- endif
+type(conv_tendency_type), intent(inout) :: Uw_tend
+type(conv_output_type), intent(inout) :: Output_uw
!------------------------------------------------------------------------
-! register diagnostics specific to the uw parameterization.
+! Uw_tend conv_tendency_type variable containing tendency
+! output from uw convection
+! Output_uw conv_output_type variable containing output
+! fields from uw convection
!------------------------------------------------------------------------
-!RSH activate this if when convection code redone:
-! if (do_uw_conv) then
- id_uw_precip = register_diag_field ( mod_name, &
- 'uw_precip', axes(1:2), Time, &
- 'Precipitation rate from uw shallow', 'kg/m2/s', &
- interp_method = "conserve_order1" )
+!---------------------------------------------------------------------
+! deallocate the Uw_tend components.
+!---------------------------------------------------------------------
+ deallocate (Uw_tend%delta_q)
+ deallocate (Uw_tend%rain)
+ deallocate (Uw_tend%snow)
+ deallocate (Uw_tend%ttnd)
+ deallocate (Uw_tend%qtnd)
+ deallocate (Uw_tend%utnd)
+ deallocate (Uw_tend%vtnd)
+ deallocate (Uw_tend%qltnd)
+ deallocate (Uw_tend%qitnd)
+ deallocate (Uw_tend%qatnd)
+ deallocate (Uw_tend%qntnd)
+ deallocate (Uw_tend%qnitnd)
+ deallocate (Uw_tend%qtr )
- id_uw_snow = register_diag_field ( mod_name, &
- 'uw_snow', axes(1:2), Time, &
- 'Snow rate from uw shallow', 'kg/m2/s' , &
- interp_method = "conserve_order1" )
+!---------------------------------------------------------------------
+! deallocate the Output_uw components.
+!---------------------------------------------------------------------
+ deallocate (Output_uw%liquid_precip )
+ deallocate (Output_uw%frozen_precip )
+ deallocate (Output_uw%total_precip )
+ deallocate (Output_uw%scale )
+ deallocate (Output_uw%scale_REV )
- id_uw_freq = register_diag_field ( mod_name, &
- 'uw_freq', axes(1:2), Time, &
- 'frequency of precip from uw shallow ', 'number' , &
- missing_value = missing_value, &
- interp_method = "conserve_order1" )
+!---------------------------------------------------------------------
- id_enth_uw_col = register_diag_field ( mod_name, &
- 'enth_uw_col', axes(1:2), Time, &
- 'Column enthalpy tendency from UW convection', &
- 'W/m2' )
- id_wat_uw_col = register_diag_field ( mod_name, &
- 'wat_uw_col', axes(1:2), Time, &
- 'Column total water tendency from UW convection',&
- 'kg(h2o)/m2/s' )
+end subroutine uw_dealloc
- id_scale_uw = register_diag_field ( mod_name, &
- 'scale_uw', axes(1:2), Time, &
- 'Scaling factor applied to UW convection&
- & tendencies','1' )
- id_tdt_uw = register_diag_field ( mod_name, &
- 'tdt_uw', axes(1:3), Time, &
- 'UW convection heating rate', 'deg K/s', &
- missing_value=missing_value )
- id_qdt_uw = register_diag_field ( mod_name, &
- 'qdt_uw', axes(1:3), Time, &
- 'UW convection moistening rate', 'kg/kg/s', &
- missing_value=missing_value )
+!#######################################################################
- id_qadt_uw = register_diag_field ( mod_name, &
- 'qadt_uw', axes(1:3), Time, &
- 'UW convection cloud amount tendency', '1/s', &
- missing_value=missing_value )
- id_qldt_uw = register_diag_field ( mod_name, &
- 'qldt_uw', axes(1:3), Time, &
- 'UW convection cloud liquid tendency', 'kg/kg/s', &
- missing_value=missing_value )
- id_qidt_uw = register_diag_field ( mod_name, &
- 'qidt_uw', axes(1:3), Time, &
- 'UW convection ice water tendency', 'kg/kg/s', &
- missing_value=missing_value )
+!*******************************************************************
+!
+! RAS-RELATED SUBROUTINES
+!
+!*******************************************************************
- if (do_liq_num) &
- id_qndt_uw = register_diag_field ( mod_name, &
- 'qndt_uw', axes(1:3), Time, &
- 'UW convection cloud drop tendency', '#/kg/s', &
- missing_value=missing_value )
+!#######################################################################
- if (do_ice_num) &
- id_qnidt_uw = register_diag_field ( mod_name, &
- 'qnidt_uw', axes(1:3), Time, &
- 'UW convection ice number tendency', '#/kg/s', &
- missing_value=missing_value )
+subroutine ras_driver (is, js, Input_mp, Output_mp, Tend_mp, &
+ Conv_results, C2ls_mp, Aerosol)
-! endif
+!---------------------------------------------------------------------
+! subroutine ras_driver executes ras_mod by allocating needed
+! derived-type components, calling its module driver, processing its
+! output into the form needed by other parameterizations active in the
+! atmospheric model, calling wet deposition to transport any tracers,
+! outputting any desired ras diagnostics, and then deallocating those
+! derived-type components which were allocated.
+!-----------------------------------------------------------------------
+
+integer, intent(in) :: is, js
+type (mp_input_type), intent(inout) :: Input_mp
+type (mp_output_type), intent(inout) :: Output_mp
+type (mp_tendency_type), intent(inout) :: Tend_mp
+type(conv_results_type), intent(inout) :: Conv_results
+type(mp_conv2ls_type), intent(inout) :: C2ls_mp
+type(aerosol_type), intent(in), optional :: Aerosol
!----------------------------------------------------------------------
-! dry adjustment diagnostic.
+! is,js starting i and j indices for window
+! Input_mp derived type used to transfer needed input data between
+! moist_processes and convection_driver
+! Output_mp derived type used to transfer output fields between
+! convection_driver and moist_processes
+! Tend_mp derived type used to transfer calculated tendency data
+! between convection_driver and moist_processes
+! Conv_results
+! conv_results_type variable containing variables
+! used in multiple convective parameterizations and for
+! diagnostic output
+! C2ls_mp derived type used to transfer data from convection_driver
+! to lscloud_driver via moist_processes.
+! Aerosol derived type containing model aerosol fields to be input
+! to model convective schemes
!----------------------------------------------------------------------
- id_tdt_dadj = register_diag_field ( mod_name, &
- 'tdt_dadj', axes(1:3), Time, &
- 'Temperature tendency from dry conv adj', 'deg_K/s', &
- missing_value=missing_value )
-!---------------------------------------------------------------------
-! allocate and initialize arrays to hold the diagnostic ids for each
-! active tracer. diagnostics for tendency due to convection,
-! column tendency due to convection, the tracer amount and tracer
-! column amount are available.
-!---------------------------------------------------------------------
- allocate (id_tracerdt_conv (num_prog_tracers))
- allocate (id_tracerdt_conv_col(num_prog_tracers))
- allocate (id_conv_tracer (num_prog_tracers))
- allocate (id_conv_tracer_col(num_prog_tracers))
+ real, dimension(size(Input_mp%tin,1), &
+ size(Input_mp%tin,2), size(Input_mp%tin,3)) :: &
+ f_snow_berg
+ logical, dimension(size(Input_mp%tin,1), &
+ size(Input_mp%tin,2)) :: ltemp
- id_tracerdt_conv = NO_TRACER
- id_tracerdt_conv_col = NO_TRACER
- id_conv_tracer = NO_TRACER
- id_conv_tracer_col = NO_TRACER
+ real, dimension(size(Input_mp%tin,1), &
+ size(Input_mp%tin,2)) :: temp_2d
-!------------------------------------------------------------------------
-! define the diagnostics names that are requested and register the
-! diagnostics for those tracers that were specified to be affected
-! by a convection scheme.
-!------------------------------------------------------------------------
- do n = 1,num_prog_tracers
- call get_tracer_names (MODEL_ATMOS, n, name = tracer_name, &
- units = tracer_units)
- if (Control%tracers_in_donner(n) .or. &
- Control%tracers_in_ras(n) .or. &
- Control%tracers_in_mca(n) .or. &
- Control%tracers_in_uw(n)) then
- diaglname = trim(tracer_name)// &
- ' total tendency from moist convection'
- id_tracerdt_conv(n) = &
- register_diag_field ( mod_name, &
- TRIM(tracer_name)//'dt_conv', &
- axes(1:3), Time, trim(diaglname), &
- TRIM(tracer_units)//'/s', &
- missing_value=missing_value)
+ real, dimension(size(Output_mp%rdt,1), size(Output_mp%rdt,2), &
+ size(Output_mp%rdt,3),num_ras_tracers) :: trcr
- diaglname = trim(tracer_name)// &
- ' total path tendency from moist convection'
- id_tracerdt_conv_col(n) = &
- register_diag_field ( mod_name, &
- TRIM(tracer_name)//'dt_conv_col', &
- axes(1:2), Time, trim(diaglname), &
- TRIM(tracer_units)//'*(kg/m2)/s', &
- missing_value=missing_value)
- endif
+ type(conv_tendency_type) :: Ras_tend
+ integer :: nn, n
+ integer :: nt
+ integer :: ix, jx, kx
+ logical :: used
!----------------------------------------------------------------------
-! output the distribution and column values of any tracer for which
-! they are requested, even if not transported by convection.
+! f_snow_berg fraction of snow/ice produced having IFN (ice-forming
+! nuclei)
+! ltemp temporary logical array
+! temp_2d temporary real array
+! trcr set of tracers transported by ras convection
+! Ras_tend conv_tendency_type variable containing tendency
+! output from ras convection
+! n do-loop index
+! nn counter
+! nt number of prognostic tracers
+! ix, jx, kx physics window dimensions
+! used logical used to indicate data has been received by
+! diag_manager_mod
+!-------------------------------------------------------------------
+
+!---------------------------------------------------------------------
+! turn on ras clock.
+!--------------------------------------------------------------------
+ call mpp_clock_begin (ras_clock)
+
+!---------------------------------------------------------------------
+! define physics window dimensions.
+!---------------------------------------------------------------------
+ ix = size(Input_mp%t,1)
+ jx = size(Input_mp%t,2)
+ kx = size(Input_mp%t,3)
+
+!--------------------------------------------------------------------
+! allocate and initialize the needed components of the
+! conv_tendency_type for ras convection.
+!--------------------------------------------------------------------
+ allocate (Ras_tend%rain (ix, jx)) ! rain_ras
+ allocate (Ras_tend%snow (ix, jx)) ! snow_ras
+ allocate (Ras_tend%rain3d (ix, jx, kx+1))
+ allocate (Ras_tend%snow3d (ix, jx, kx+1))
+ allocate (Ras_tend%ttnd (ix, jx, kx))
+ allocate (Ras_tend%qtnd (ix, jx, kx))
+ allocate (Ras_tend%utnd (ix, jx, kx))
+ allocate (Ras_tend%vtnd (ix, jx, kx))
+ allocate (Ras_tend%qltnd (ix, jx, kx))
+ allocate (Ras_tend%qitnd (ix, jx, kx))
+ allocate (Ras_tend%qatnd (ix, jx, kx))
+ allocate (Ras_tend%qntnd (ix, jx, kx))
+ allocate (Ras_tend%qnitnd (ix, jx, kx))
+ allocate (Ras_tend%qtr (ix, jx, kx, num_ras_tracers))
+
+ Ras_tend%rain = 0.
+ Ras_tend%snow = 0.
+ Ras_tend%rain3d = 0.
+ Ras_tend%snow3d = 0.
+ Ras_tend%ttnd = 0.
+ Ras_tend%qtnd = 0.
+ Ras_tend%utnd = 0.
+ Ras_tend%vtnd = 0.
+ Ras_tend%qltnd = 0.
+ Ras_tend%qitnd = 0.
+ Ras_tend%qatnd = 0.
+ Ras_tend%qntnd = 0.
+ Ras_tend%qnitnd = 0.
+ Ras_tend%qtr = 0.
+
!----------------------------------------------------------------------
- diaglname = trim(tracer_name)
- id_conv_tracer(n) = &
- register_diag_field ( mod_name_tr, &
- TRIM(tracer_name), &
- axes(1:3), Time, trim(diaglname), &
- TRIM(tracer_units) , &
- missing_value=missing_value)
- diaglname = ' column integrated' // trim(tracer_name)
- id_conv_tracer_col(n) = &
- register_diag_field ( mod_name_tr, &
- TRIM(tracer_name)//'_col', &
- axes(1:2), Time, trim(diaglname), &
- TRIM(tracer_units) , &
- missing_value=missing_value)
+! if any tracers are to be transported by ras convection, check each
+! active tracer to find those to be transported and fill the
+! ras_tracers array with these fields.
+!---------------------------------------------------------------------
+ nn = 1
+ do n=1, num_prog_tracers
+ if (tracers_in_ras(n)) then
+ trcr(:,:,:,nn) = Input_mp%tracer(:,:,:,n)
+ nn = nn + 1
+ endif
end do
-!------------------------------------------------------------------
-! register the diagnostics which will report the tendencies due to
-! mca component of donner convection.
-!------------------------------------------------------------------
- if (do_donner_deep) then
- allocate (id_tracerdt_mcadon (Control%num_donner_tracers))
- allocate (id_tracerdt_mcadon_col(Control%num_donner_tracers))
+!----------------------------------------------------------------------
+! call subroutine ras to obtain the temperature, specific humidity,
+! velocity, precipitation and tracer tendencies and mass flux
+! associated with the relaxed arakawa-schubert parameterization.
+!----------------------------------------------------------------------
+ if (doing_prog_clouds .and. (.not.do_liq_num)) then
+ call ras (is, js, Time, Input_mp%tin, Input_mp%qin, &
+ Input_mp%uin, Input_mp%vin, Input_mp%pfull, &
+ Input_mp%phalf, Input_mp%zhalf, Input_mp%coldT, &
+ dt, Ras_tend%ttnd, Ras_tend%qtnd, Ras_tend%utnd, &
+ Ras_tend%vtnd, Ras_tend%rain3d, Ras_tend%snow3d, &
+ Ras_tend%rain, Ras_tend%snow, trcr, Ras_tend%qtr, &
+ mc0=Conv_results%ras_mflux, &
+ det0=Conv_results%ras_det_mflux, &
+ ql0=Input_mp%tracer(:,:,:,nql), &
+ qi0=Input_mp%tracer(:,:,:,nqi), &
+ qa0=Input_mp%tracer(:,:,:,nqa), &
+ dl0=Ras_tend%qltnd, &
+ di0=Ras_tend%qitnd, &
+ da0=Ras_tend%qatnd)
+
+ elseif (doing_prog_clouds .and. do_liq_num) then
+ call ras (is, js, Time, Input_mp%tin, Input_mp%qin, &
+ Input_mp%uin, Input_mp%vin, Input_mp%pfull, &
+ Input_mp%phalf, Input_mp%zhalf, Input_mp%coldT, &
+ dt, Ras_tend%ttnd, Ras_tend%qtnd, Ras_tend%utnd, &
+ Ras_tend%vtnd, Ras_tend%rain3d, Ras_tend%snow3d, &
+ Ras_tend%rain, Ras_tend%snow, trcr, Ras_tend%qtr, &
+ mc0=Conv_results%ras_mflux, &
+ det0=Conv_results%ras_det_mflux, &
+ ql0=Input_mp%tracer(:,:,:,nql), &
+ qi0=Input_mp%tracer(:,:,:,nqi), &
+ qa0=Input_mp%tracer(:,:,:,nqa), &
+ dl0=Ras_tend%qltnd, &
+ di0=Ras_tend%qitnd, &
+ da0=Ras_tend%qatnd, &
+ qn0=Input_mp%tracer(:,:,:,nqn), &
+ dn0=Ras_tend%qntnd, &
+ do_strat=doing_prog_clouds, Aerosol=Aerosol)
+ else
+ call ras (is, js, Time, Input_mp%tin, Input_mp%qin, &
+ Input_mp%uin, Input_mp%vin, Input_mp%pfull, &
+ Input_mp%phalf, Input_mp%zhalf, Input_mp%coldT, &
+ dt, Ras_tend%ttnd, Ras_tend%qtnd, Ras_tend%utnd, &
+ Ras_tend%vtnd, Ras_tend%rain3d, Ras_tend%snow3d, &
+ Ras_tend%rain, Ras_tend%snow, trcr, Ras_tend%qtr, &
+ mc0=Conv_results%ras_mflux, &
+ det0=Conv_results%ras_det_mflux)
+ endif
- nn = 1
- do n = 1,num_prog_tracers
- call get_tracer_names (MODEL_ATMOS, n, name = tracer_name, &
- units = tracer_units)
- if (Control%tracers_in_donner(n) ) then
- diaglname = trim(tracer_name)// &
- ' tendency from donner-mca'
- id_tracerdt_mcadon(nn) = &
- register_diag_field ( mod_name, &
- TRIM(tracer_name)//'_donmca', &
- axes(1:3), Time, trim(diaglname), &
- TRIM(tracer_units)//'/s', &
- missing_value=missing_value)
+!---------------------------------------------------------------------
+! update the current tracer tendencies with the contributions
+! just obtained from ras transport.
+! NOTE : the prognostic cloud tracers are updated within ras.
+!---------------------------------------------------------------------
+ nn = 1
+ do n=1, num_prog_tracers
+ if (tracers_in_ras(n)) then
+ Output_mp%rdt(:,:,:,n) = Output_mp%rdt(:,:,:,n) + &
+ Ras_tend%qtr (:,:,:,nn)
+ nn = nn + 1
+ endif
+ end do
- diaglname = trim(tracer_name)// &
- ' total path tendency from donner-mca'
- id_tracerdt_mcadon_col(nn) = &
- register_diag_field ( mod_name, &
- TRIM(tracer_name)//'_donmca_col', &
- axes(1:2), Time, trim(diaglname), &
- TRIM(tracer_units)//'*(kg/m2)/s', &
- missing_value=missing_value)
- nn = nn + 1
- endif
- end do
+!------------------------------------------------------------------------
+! if prognostic ice number is activated, call detr_ice_num to update
+! its value after ice detrainment is calculated (proportional to ice
+! mass).
+!------------------------------------------------------------------------
+ if (doing_prog_clouds) then
+ if (do_ice_num .AND. detrain_ice_num) THEN
+ CALL detr_ice_num (Input_mp%tin, Ras_tend%qitnd(:,:,:), &
+ Ras_tend%qnitnd(:,:,:))
+ end if
endif
+!-----------------------------------------------------------------------
+! call update_outputs to update tendency fields in Output_mp% and
+! Ras_tend% that are needed later.
+!-----------------------------------------------------------------------
+ call update_outputs (Ras_tend, Output_mp, Tend_mp)
+
+!------------------------------------------------------------------------
+! initialize fields needed for call to wet deposition routine.
+!------------------------------------------------------------------------
+ f_snow_berg = 0.
+ C2ls_mp%wet_data = 0.0
+ C2ls_mp%cloud_frac = 0.1
+ C2ls_mp%cloud_wet = 1.e-3
+ Tend_mp%qtnd_wet(:,:,:) = Tend_mp%qtnd(:,:,:)
+ if (doing_prog_clouds) then
+ Tend_mp%qtnd_wet(:,:,:) = Tend_mp%qtnd_wet(:,:,:) + &
+ Tend_mp%q_tnd(:,:,:,nql) + &
+ Tend_mp%q_tnd(:,:,:,nqi)
+ end if
!---------------------------------------------------------------------
+! for each tracer for which wet deposition has been requested, call
+! subroutine wet_deposition to calculate the tracer tendency due to
+! wet deposition (wetdeptnd) caused by the convectively generated
+! precipitation (rain, snow).
+!---------------------------------------------------------------------
+ nt = size(Output_mp%rdt,4)
+ do n=1, nt
+ if (.not. cloud_tracer(n)) then
+ Tend_mp%wetdeptnd(:,:,:) = 0.0
+ call wet_deposition &
+ (n, Input_mp%t, Input_mp%pfull, Input_mp%phalf, &
+ Input_mp%zfull, Input_mp%zhalf, &
+ Ras_tend%rain, Ras_tend%snow, &
+ Tend_mp%qtnd_wet, C2ls_mp%cloud_wet, C2ls_mp%cloud_frac, &
+ f_snow_berg, Ras_tend%rain3d, Ras_tend%snow3d, &
+ Input_mp%tracer(:,:,:,n), Tend_mp%wetdeptnd, Time, &
+ 'convect', is, js, dt )
+!-----------------------------------------------------------------------
+! add this tendency to the tracer tendency due to all physics (rdt).
+! save it also in an array which will be combined with any wet
+! deposition resulting from large-scale precip producing the total wet
+! deposition for the tracer (wet_data).
+!---------------------------------------------------------------------
+ Output_mp%rdt (:,:,:,n) = Output_mp%rdt(:,:,:,n) - &
+ Tend_mp%wetdeptnd(:,:,:)
+ C2ls_mp%wet_data(:,:,:,n) = Tend_mp%wetdeptnd(:,:,:)
+ endif
+ end do
-end subroutine diag_field_init
+!------------------------------------------------------------------------
+! output ras-related convective diagnostics.
+!---------------------------------------------------------------------
+! precipitation from ras:
+ used = send_data (id_ras_precip, Ras_tend%rain + Ras_tend%snow, &
+ Time, is, js)
+! rain from ras:
+ used = send_data ( id_conv_rain3d, Ras_tend%rain3d, Time, is, js, 1 )
+! snow from ras:
+ used = send_data ( id_conv_snow3d, Ras_tend%snow3d, Time, is, js, 1 )
+! ras frequency:
+ if (id_ras_freq > 0) then
+ ltemp = Ras_tend%rain > 0. .or. Ras_tend%snow > 0.0
+ where (ltemp)
+ temp_2d = 1.
+ elsewhere
+ temp_2d = 0.
+ end where
+ used = send_data (id_ras_freq, temp_2d,Time, is, js)
+ endif
+!-----------------------------------------------------------------------
+! deallocate the components of the Ras_tend variable.
+!-----------------------------------------------------------------------
+ deallocate (Ras_tend%rain)
+ deallocate (Ras_tend%snow)
+ deallocate (Ras_tend%rain3d)
+ deallocate (Ras_tend%snow3d)
+ deallocate (Ras_tend%ttnd)
+ deallocate (Ras_tend%qtnd)
+ deallocate (Ras_tend%utnd)
+ deallocate (Ras_tend%vtnd)
+ deallocate (Ras_tend%qltnd)
+ deallocate (Ras_tend%qitnd)
+ deallocate (Ras_tend%qatnd)
+ deallocate (Ras_tend%qntnd)
+ deallocate (Ras_tend%qnitnd)
+ deallocate (Ras_tend%qtr )
+!-----------------------------------------------------------------------
+! turn off the ras clock.
+!-----------------------------------------------------------------------
+ call mpp_clock_end (ras_clock)
-!######################################################################
+!-----------------------------------------------------------------------
-subroutine convection_driver_time_vary (dt)
-real, intent(in) :: dt
+end subroutine ras_driver
-!--------------------------------------------------------------------
- if (do_donner_deep) then
- call donner_deep_time_vary (dt)
- endif
-!--------------------------------------------------------------------
+!*******************************************************************
+!
+! PRIVATE SUBROUTINES USED BY MULTIPLE CONVECTION SCHEMES
+!
+!*******************************************************************
-end subroutine convection_driver_time_vary
+!#######################################################################
+subroutine update_outputs (Conv_tend, Output_mp, Tend_mp)
+
+!-----------------------------------------------------------------------
+! subroutine update_outputs updates the physics tendency, convection
+! tendency and moist_processes tendency arrays with the contributions
+! from the current convection parameterization.
+!-----------------------------------------------------------------------
-!######################################################################
+type(conv_tendency_type), intent(in) :: Conv_tend
+type(mp_output_type), intent(inout) :: Output_mp
+type(mp_tendency_type), intent(inout) :: Tend_mp
-subroutine convection_driver_endts
+!----------------------------------------------------------------------
+! Conv_tend conv_tendency_type variable containing tendency
+! output from the current convective parameterization
+! Output_mp derived type used to transfer output fields between
+! convection_driver and moist_processes
+! Tend_mp derived type used to transfer calculated tendency data
+! between convection_driver and moist_processes
+!----------------------------------------------------------------------
!-----------------------------------------------------------------------
-
- if (do_donner_deep) then
- call donner_deep_endts
+! update the physics tendency, convection tendency and moist_processes
+! tendency arrays with the contributions from the current convection
+! scheme. dependent on scheme, some of these fields may not be relevant
+! and so are not allocated.
+!-------------------------------------------------------------------
+ if (allocated ( Conv_tend%ttnd)) then
+ Output_mp%tdt = Output_mp%tdt + Conv_tend%ttnd
+ Tend_mp%ttnd_conv = Tend_mp%ttnd_conv + Conv_tend%ttnd
+ Tend_mp%ttnd = Tend_mp%ttnd + Conv_tend%ttnd
+ endif
+ if (allocated ( Conv_tend%qtnd)) then
+ Output_mp%rdt(:,:,:,1) = Output_mp%rdt(:,:,:,1) + Conv_tend%qtnd
+ Tend_mp%qtnd_conv = Tend_mp%qtnd_conv + Conv_tend%qtnd
+ Tend_mp%qtnd = Tend_mp%qtnd + Conv_tend%qtnd
endif
+ if (allocated ( Conv_tend%utnd)) &
+ Output_mp%udt = Output_mp%udt + Conv_tend%utnd
+ if (allocated ( Conv_tend%vtnd)) &
+ Output_mp%vdt = Output_mp%vdt + Conv_tend%vtnd
+ if (allocated ( Conv_tend%rain)) &
+ Output_mp%lprec = Output_mp%lprec + Conv_tend%rain
+ if (allocated ( Conv_tend%snow)) &
+ Output_mp%fprec = Output_mp%fprec + Conv_tend%snow
!-----------------------------------------------------------------------
+! define the total precipitation rate (precip) for all schemes.
+! the different definition here is done to preserve order of
+! operations with the warsaw code release and avoid answer change
+! with this revised code.
+!-----------------------------------------------------------------------
+ if (ldonner_then_uw) then
+ Output_mp%precip = Output_mp%precip + Conv_tend%rain + &
+ Conv_tend%snow
+ else
+ Output_mp%precip = Output_mp%lprec + Output_mp%fprec
+ endif
+!-----------------------------------------------------------------------
+! define tendencies for prognostic clloud fields, if that option is
+! active.
+!-----------------------------------------------------------------------
+ if (doing_prog_clouds) then
+ if (allocated ( Conv_tend%qltnd)) &
+ Output_mp%rdt(:,:,:,nql) = Output_mp%rdt(:,:,:,nql) + &
+ Conv_tend%qltnd
+ if (allocated ( Conv_tend%qitnd)) &
+ Output_mp%rdt(:,:,:,nqi) = Output_mp%rdt(:,:,:,nqi) + &
+ Conv_tend%qitnd
+ if (allocated ( Conv_tend%qatnd)) &
+ Output_mp%rdt(:,:,:,nqa) = Output_mp%rdt(:,:,:,nqa) + &
+ Conv_tend%qatnd
+ if (allocated ( Conv_tend%qntnd)) then
+ if (do_liq_num) Output_mp%rdt(:,:,:,nqn) = &
+ Output_mp%rdt(:,:,:,nqn) + Conv_tend%qntnd
+ endif
+ if (allocated ( Conv_tend%qnitnd)) then
+ if (do_ice_num) Output_mp%rdt(:,:,:,nqni) = &
+ Output_mp%rdt(:,:,:,nqni) + Conv_tend%qnitnd
+ endif
+ endif
-end subroutine convection_driver_endts
-
-
-!######################################################################
-
-subroutine convection_driver_end
+!-----------------------------------------------------------------------
-!---------------------------------------------------------------------
-! call the destructor routines for the active convection modules.
-!---------------------------------------------------------------------
- if (do_donner_deep) call donner_deep_end
- if (do_ras ) call ras_end
- if (do_uw_conv ) call uw_conv_end
- if (do_cmt ) call cu_mo_trans_end
- call detr_ice_num_end
-!----------------------------------------------------------------------
-! deallocate module variables.
-!----------------------------------------------------------------------
- if (do_donner_deep .and. do_donner_conservation_checks) then
- deallocate (max_water_imbal_don)
- deallocate (max_enthalpy_imbal_don)
- endif
+end subroutine update_outputs
- deallocate (cloud_tracer)
- deallocate(id_tracerdt_conv) ! h1g, 2017-02-02
- deallocate (id_tracerdt_conv_col) ! h1g, 2017-02-02
- deallocate (id_conv_tracer) ! h1g, 2017-02-02
- deallocate (id_conv_tracer_col) ! h1g, 2017-02-02
- if (do_donner_deep) then ! h1g, 2017-02-02
- deallocate ( id_tracerdt_mcadon ) ! h1g, 2017-02-02
- deallocate ( id_tracerdt_mcadon_col ) ! h1g, 2017-02-02
- endif
+!########################################################################
-!--------------------------------------------------------------------
+subroutine define_and_apply_scale (Input_mp, Conv_tend, Output_conv,&
+ donner_scheme, uw_scheme, qtr)
+!-----------------------------------------------------------------------
+! subroutine define_and_apply_scale defines a factor to modify
+! predicted tendencies so that negative values of water and water
+! phases are not produced by the convection scheme, and values lower
+! than a specified minimum are not retained.
+! it is called by both the donner and uw parameterizations, but in
+! slightly different ways in earlier code versions (warsaw and earlier).
+! those differences are preserved here to avoid changing answers;
+! ultimately it is desirable to treat the functionality of this
+! subroutine in the same way whenever it is employed.
+!-----------------------------------------------------------------------
- end subroutine convection_driver_end
+type(mp_input_type), intent(in) :: Input_mp
+type(conv_tendency_type), intent(inout) :: Conv_tend
+type(conv_output_type), intent(inout) :: Output_conv
+logical, intent(in) :: donner_scheme, uw_scheme
+real, dimension(:,:,:,:), intent(inout) :: qtr
+!-----------------------------------------------------------------------
+! Input_mp derived type used to transfer needed input data between
+! moist_processes and convection_driver
+! Conv_tend conv_tendency_type variable containing tendency
+! output from the current convective parameterization
+! Output_conv
+! conv_output_type variable containing output
+! fields from the convection parameterization being processed
+! donner_scheme
+! logical indicating if the routine is to be handled as the
+! original donner convection code did
+! uw_scheme logical indicating if the routine is to be handled as the
+! original uw convection code did
+! qtr set of tracers being transported by the current convective
+! parameterization
+!------------------------------------------------------------------------
+ real, dimension(size(Input_mp%qin,1), size(Input_mp%qin,2), &
+ size(Input_mp%qin,3)) :: temp
+ real :: posdef, delta_posdef
+ integer :: ix, jx, kx
+ integer :: i, j, k, n
+ integer :: nn
-!######################################################################
+!------------------------------------------------------------------------
+! temp temporary array
+! posdef value of field that is to be kept non-negative before
+! convection was calculated
+! delta_posdef change in non-negative field due to convective
+! parameterization
+! ix, jx, kx physics window dimensions
+! i, j, k, n do loop indices
+! nn counter
+!------------------------------------------------------------------------
-subroutine convection_driver_restart (timestamp)
+!-----------------------------------------------------------------------
+! define array dimensions.
+!-----------------------------------------------------------------------
+ ix = size(Input_mp%qin,1)
+ jx = size(Input_mp%qin,2)
+ kx = size(Input_mp%qin,3)
-character(len=*), intent(in), optional :: timestamp
+ if (uw_scheme) then
+!------------------------------------------------------------------------
+! prevent the formation of negative liquid and ice, following the
+! method employed in the warsaw code for the uw parameterization.
+!------------------------------------------------------------------------
+ temp = Input_mp%tracer(:,:,:,nql)/dt + Conv_tend%qltnd
+ where (temp(:,:,:) .lt. 0.)
+ Conv_tend%ttnd = Conv_tend%ttnd - temp*HLV/CP_AIR
+ Conv_tend%qtnd = Conv_tend%qtnd + temp
+ Conv_tend%qltnd = Conv_tend%qltnd - temp
+ end where
- if (do_donner_deep) call donner_deep_restart(timestamp)
+ temp = Input_mp%tracer(:,:,:,nqi)/dt + Conv_tend%qitnd
+ where (temp .lt. 0.)
+ Conv_tend%ttnd = Conv_tend%ttnd - temp*HLS/CP_AIR
+ Conv_tend%qtnd = Conv_tend%qtnd + temp
+ Conv_tend%qitnd = Conv_tend%qitnd - temp
+ end where
+!------------------------------------------------------------------------
+! if the amount of condensate formed by convective activity is below a
+! prescribed minimum, set the change in cloud area on this step to be
+! 0.0.
+!------------------------------------------------------------------------
+ where (abs(Conv_tend%qltnd + Conv_tend%qitnd)*dt .lt. qmin)
+ Conv_tend%qatnd = 0.0
+ end where
-end subroutine convection_driver_restart
+ else if (donner_scheme) then
+!------------------------------------------------------------------------
+! prevent the formation of negative liquid and ice, following the
+! method employed in the warsaw code for the donner parameterization.
+! in this case if more evaporation is requested than there is condensate
+! available, the evaporation is limited to the amount present, and the
+! necessary changes to the temperature and specific humidity are made
+! to reflect this modification in cloud evaporation.
+!------------------------------------------------------------------------
+!--------------------------------------------------------------------------
+! in this case donner requests more cloud evaporation than there is
+! cloudwater present. Therefore we limit the conversion to be simply the
+! evaporation of the cloud water initially present to prevent the creation
+! of negative water.
+! the condensation tendencies are of opposite sign in the qv and ql
+! equations and so
+! delta_qvc = -delta_qlc
+! Thus we want to replace the delta_qlc and delta_qvc with ql_in in both
+! the qv and ql equations.
+! Adjusted tendencies:
+! delta q = delta_qvc - delta_qvc + ql_in
+! (a) = delta_qvc + (delta_qlc + ql_in)
+! delta ql = delta_qlc - delta_qlc - ql_in
+! (b) = delta_qlc - ( delta_qlc + ql_in)
+! = -ql_in
+
+! Here (a) and (b) are the expressions used below and so the new values
+! of qv and ql:
+! new qv = qv_in + delta_q = qv_in + delta_qvc + delta_qlc + ql_in
+! = qv_in + (delta_qvc + delta_qlc) + ql_in
+! = qv_in + ql_in
+! new ql = ql_in + delta_ql = ql_in - ql_in = 0.0
+! so that conservation of water substance is preserved.
+!-----------------------------------------------------------------------
+ where ((Input_mp%tracer(:,:,:,nql) + Output_conv%delta_ql) .lt. 0.)
+ Output_conv%delta_temp = Output_conv%delta_temp - &
+ (Input_mp%tracer(:,:,:,nql) + &
+ Output_conv%delta_ql)*HLV/CP_AIR
+ Output_conv%delta_q = Output_conv%delta_q + &
+ (Input_mp%tracer(:,:,:,nql) + &
+ Output_conv%delta_ql)
+ Output_conv%delta_ql = Output_conv%delta_ql - &
+ (Input_mp%tracer(:,:,:,nql) + &
+ Output_conv%delta_ql)
+ end where
-!######################################################################
+!------------------------------------------------------------------------
+! same treatment for ice as was done for liquid immediately above.
+!------------------------------------------------------------------------
+ where ((Input_mp%tracer(:,:,:,nqi) + Output_conv%delta_qi) .lt. 0.)
+ Output_conv%delta_temp = Output_conv%delta_temp - &
+ (Input_mp%tracer(:,:,:,nqi) + &
+ Output_conv%delta_qi)*HLS/CP_AIR
+ Output_conv%delta_q = Output_conv%delta_q + &
+ (Input_mp%tracer(:,:,:,nqi) + &
+ Output_conv%delta_qi)
+ Output_conv%delta_qi = Output_conv%delta_qi - &
+ (Input_mp%tracer(:,:,:,nqi)+ &
+ Output_conv%delta_qi)
+ end where
-subroutine prevent_neg_precip_fluxes (fluxh)
+!-------------------------------------------------------------------------
+! if the amount of condensate formed by convective activity is below a
+! prescribed minimum, set the change in cloud area on this step to be
+! 0.0.
+!------------------------------------------------------------------------
+ where (abs(Output_conv%delta_ql + Output_conv%delta_qi) .lt. qmin )
+ Output_conv%delta_qa = 0.0
+ end where
+ endif
-real, dimension(:,:,:), intent(inout) :: fluxh
+!-----------------------------------------------------------------------
+! compute a scaling factor for each grid point. when this factor is
+! multiplied by the predicted tendencies, they will be reduced in
+! mgnitude to prevent the creation of negative water.
+!-----------------------------------------------------------------------
+ do k=1,kx
+ do j=1,jx
+ do i=1,ix
- integer :: i,j,k
- real, dimension(size(fluxh,1), size(fluxh,2)) :: sumneg
+!-----------------------------------------------------------------------
+! the uw scheme used the total water substance as the positive definite
+! quantity that was to be preserved.
+!-----------------------------------------------------------------------
+ if (uw_scheme) then
+ posdef = Input_mp%qin(i,j,k) + Input_mp%tracer(i,j,k,nql) + &
+ Input_mp%tracer(i,j,k,nqi)
+ delta_posdef = ( Conv_tend%qtnd(i,j,k) + &
+ Conv_tend%qltnd(i,j,k) + &
+ Conv_tend%qitnd(i,j,k) )*dt
!-----------------------------------------------------------------------
-! move down each column looking for negative precip fluxes at each
-! level. if found, the negative flux is eliminated by reducing the
-! incoming precip flux from above.
+! the donner scheme used the specific humidity as the positive
+! definite quantity that was to be preserved.
!-----------------------------------------------------------------------
- sumneg(:,:) = 0.
- do k=2, size(fluxh,3)
- do j=1,size(fluxh,2)
- do i=1,size(fluxh,1)
- if (fluxh(i,j,k) > 0.0) then
- if (fluxh(i,j,k) > ABS(sumneg(i,j))) then
- fluxh(i,j,k) = fluxh(i,j,k) + sumneg(i,j)
- sumneg(i,j) = 0.
- else
- sumneg(i,j) = sumneg(i,j) + fluxh(i,j,k)
- fluxh(i,j,k) = 0.
- endif
+ else if (donner_scheme) then
+ posdef = Input_mp%qin(i,j,k)
+ delta_posdef = (Output_conv%delta_q(i,j,k) )
+ endif
+
+!-------------------------------------------------------------------------
+! if the positive definite quantity is being reduced on this step and
+! the value of that quantity after the timestep will be lower than
+! the minimum value specified, then the tendencies must be reduced to
+! preserve realizability. the percentage of predicted tendency that
+! will not cause negative values is given by the negative of the ratio
+! of the initial field value to the predicted change (temp).
+! temp will be a nonnegative number since posdef is positive.
+!------------------------------------------------------------------------
+ if (delta_posdef .lt.0 .and. &
+ posdef + delta_posdef .lt. qmin ) then
+ temp(i,j,k) = max( 0.0, -(posdef - qmin)/delta_posdef )
else
- sumneg(i,j) = sumneg(i,j) + fluxh(i,j,k)
- fluxh(i,j,k) = 0.
+ temp(i,j,k) = 1.0
endif
end do
end do
end do
-!----------------------------------------------------------------------
-
-
-end subroutine prevent_neg_precip_fluxes
-
-
-
-!#######################################################################
-
-subroutine compute_convective_area &
- (t, pfull, q, do_uw_conv, do_donner_deep, donner_humidity_area,&
- donner_humidity_factor, max_cnv_frac, humidity_ratio, &
- convective_area, shallow_cloud_area, cell_cld_frac)
-
-!-------------------------------------------------------------------------
-! subroutine compute_convective_area defines the grid box area affected
-! by the convective clouds and the ratio of the grid-box relative
-! humidity to the humidity in the environment of the convective
-! clouds.
-!-------------------------------------------------------------------------
-
-real, dimension(:,:,:), intent(in) :: t, q, pfull, &
- donner_humidity_area, &
- donner_humidity_factor
-logical, intent(in) :: do_uw_conv, do_donner_deep
-real, intent(in) :: max_cnv_frac
-real, dimension(:,:,:), intent(out) :: humidity_ratio, &
- convective_area
-real, dimension(:,:,:), intent(in),optional :: shallow_cloud_area, &
- cell_cld_frac
-
-!------------------------------------------------------------------------
-! local variables:
-!
-
- real, dimension(size(t,1), size(t,2), size(t,3)) :: qs, qrf, &
- env_fraction, &
- env_qv
- integer :: i,j,k
- integer :: ix, jx, kx
-
!-----------------------------------------------------------------------
-! define array dimensions.
+! the scaling factor for each column is defined as the minimum value
+! of that ratio that is found within that column. that value is applied
+! at each point in the column. this assures both that fields will not
+! become negative, and that column conservation of enthalpy and water
+! substance will not be affected by this adjustment.
!-----------------------------------------------------------------------
- ix = size(t,1)
- jx = size(t,2)
- kx = size(t,3)
-
-!----------------------------------------------------------------------
-! define a realizable grid box specific humidity (qrf) and the
-! saturation specific humidity (qs).
-!------------------------------------------------------------------
- qrf = MAX(q, 0.0)
- call compute_qs (t, pfull, qs)
-
-!----------------------------------------------------------------------
-! define the grid box area whose humidity is affected by the
-! convective clouds (convective_area). define the environmental
-! rh (env_qv) which is the value needed in the non-convective cloud
-! area in order to have the computed grid-box relative humidity. the
-! convective cloud area is assumed saturated for the uw clouds, in the
-! donner cell clouds and in the region of donner meso updraft, but is
-! assumed subsaturated in the donner meso downdraft layer above cloud
-! base, with the degree of saturation given by the
-! donner_humidity_factor (mesoscale area times assumed RH).
-!-------------------------------------------------------------------
- if (do_uw_conv .and. do_donner_deep) then
- convective_area = donner_humidity_area + shallow_cloud_area
- env_qv = qrf - qs*(cell_cld_frac + donner_humidity_factor + &
- shallow_cloud_area)
- else if (do_donner_deep) then
- convective_area = donner_humidity_area
- env_qv = qrf - qs*(cell_cld_frac + donner_humidity_factor)
- else if (do_uw_conv) then
- convective_area = shallow_cloud_area
- env_qv = qrf - shallow_cloud_area*qs
- else
- convective_area = 0.0
- env_qv = qrf
- endif
+ Output_conv%scale = minval( temp, dim=3 )
!-----------------------------------------------------------------------
-! define the convective area, limited by nml parameter max_cnv_frac.
-! the convective environment fraction is the remainder of the box.
+! now apply the scaling factor to the water tracer, momentum,
+! temperature, precipitation and transported tracer tendencies
+! returned from the convection scheme. NOte again that uw and donner
+! were originally treated differently, and that different treatment
+! is retained.
+! NOTE THAT THE TRANSPORTED TRACERS WERE NOT SCALED IN THE WARSAW
+! AND EARLIER CODE VERSIONS. THIS INCLUSION HERE MAY CHANGE ANSWERS.
!-----------------------------------------------------------------------
- do k=1, kx
- do j=1,jx
- do i=1,ix
- convective_area(i,j,k) = min (convective_area(i,j,k), &
- max_cnv_frac)
- env_fraction(i,j,k) = 1.0 - convective_area(i,j,k)
+ if (uw_scheme) then
+ do k=1,kx
+ Conv_tend%utnd(:,:,k) = Output_conv%scale*Conv_tend%utnd(:,:,k)
+ Conv_tend%vtnd(:,:,k) = Output_conv%scale*Conv_tend%vtnd(:,:,k)
+ Conv_tend%ttnd(:,:,k) = Output_conv%scale*Conv_tend%ttnd(:,:,k)
+ Conv_tend%qtnd(:,:,k) = Output_conv%scale*Conv_tend%qtnd(:,:,k)
+ Conv_tend%qltnd(:,:,k) = Output_conv%scale*Conv_tend%qltnd(:,:,k)
+ Conv_tend%qitnd(:,:,k) = Output_conv%scale*Conv_tend%qitnd(:,:,k)
+ Conv_tend%qatnd(:,:,k) = Output_conv%scale*Conv_tend%qatnd(:,:,k)
+ end do
-!---------------------------------------------------------------------
-! define the ratio of the grid-box relative humidity to the humidity
-! in the environment of the convective clouds. this can be done only
-! if the grid box contains vapor (qrf > 0.0) and there is some vapor
-! outside of the convective clouds (env_qv > 0.).
-!----------------------------------------------------------------------
- if (qrf(i,j,k) /= 0.0 .and. env_qv(i,j,k) > 0.0) then
+ if (do_liq_num) then
+ do k=1,kx
+ Conv_tend%qntnd(:,:,k) = Output_conv%scale* &
+ Conv_tend%qntnd(:,:,k)
+ end do
+ end if
-!--------------------------------------------------------------------
-! there must also be grid box area not filled with convective clouds.
-!--------------------------------------------------------------------
- if (env_fraction(i,j,k) > 0.0) then
- humidity_ratio(i,j,k) = &
- MAX (qrf(i,j,k)*env_fraction(i,j,k)/env_qv(i,j,k), 1.0)
+ if (do_ice_num) then
+ do k=1,kx
+ Conv_tend%qnitnd(:,:,k) = Output_conv%scale* &
+ Conv_tend%qnitnd(:,:,k)
+ end do
+ end if
+
+ Conv_tend%rain(:,:) = Output_conv%scale*Conv_tend%rain(:,:)
+ Conv_tend%snow(:,:) = Output_conv%scale*Conv_tend%snow(:,:)
-!---------------------------------------------------------------------
-! if the grid box is filled with convective clouds, set humidity ratio
-! to a flag value.
!----------------------------------------------------------------------
- else
- humidity_ratio(i,j,k) = -10.0
- endif
+! apply scaling in the donner convection manner.
+!----------------------------------------------------------------------
+ else if (donner_scheme) then
+ do j=1,jx
+ do i=1,ix
+ if (Output_conv%scale(i,j) /= 1.0) then
-!--------------------------------------------------------------------
-! if there either is no vapor in the gridbox or the vapor has been
-! taken up by the convective clouds, set the humidity_ratio to 1.0.
-!---------------------------------------------------------------------
- else
- humidity_ratio(i,j,k) = 1.0
+!-------------------------------------------------------------------------
+! scale the convective tendencies of temperature, water tracers and
+! tracers transported by the donner convection scheme. note donner
+! convection does not affect momentum, droplet number or ice crystal
+! number tendencies.
+!RSH 7/28/18: SHOULD PROBABLY AFFECT QN AND QNI, ALSO PRECIP WHICH NOT
+! MODIFIED HERE. CHECK THESE OUT AFTER COMPLETE BENCHMARK TESTING.
+! MAY USE REPRODUCE_AM4 TO MAINTAIN PREVIOUS ANSWERS.
+!-------------------------------------------------------------------------
+ do k=1,kx
+ Output_conv%delta_temp(i,j,k) = &
+ Output_conv%scale(i,j)* &
+ Output_conv%delta_temp(i,j,k)
+ Output_conv%delta_q(i,j,k) = &
+ Output_conv%scale(i,j)* &
+ Output_conv%delta_q (i,j,k)
+ Output_conv%delta_qa(i,j,k) = &
+ Output_conv%scale(i,j)* &
+ Output_conv%delta_qa(i,j,k)
+ Output_conv%delta_ql(i,j,k) = &
+ Output_conv%scale(i,j)* &
+ Output_conv%delta_ql(i,j,k)
+ Output_conv%delta_qi(i,j,k) = &
+ Output_conv%scale(i,j)* &
+ Output_conv%delta_qi(i,j,k)
+ end do
+ nn = 1
+ do n=1, num_prog_tracers
+ if (tracers_in_donner(n)) then
+ do k=1,kx
+ qtr(i,j,k,nn) = Output_conv%scale(i,j)*qtr(i,j,k,nn)
+ end do
+ nn = nn + 1
+ endif
+ end do
endif
end do
end do
- end do
+ endif
-!------------------------------------------------------------------------
+!-------------------------------------------------------------------------
-end subroutine compute_convective_area
+end subroutine define_and_apply_scale
+
+
+
+!#####################################################################
-!#######################################################################
-end module convection_driver_mod
+ end module convection_driver_mod
diff --git a/atmos_param/convection_driver/convection_utilities.F90 b/atmos_param/convection_driver/convection_utilities.F90
new file mode 100644
index 00000000..af3d5ba0
--- /dev/null
+++ b/atmos_param/convection_driver/convection_utilities.F90
@@ -0,0 +1,120 @@
+
+ module convection_utilities_mod
+
+implicit none
+private
+
+public conv_tendency_type, mp2uwconv_type, conv_output_type, &
+ donner_input_type, conv_results_type
+
+
+!-------------version number ----------------------------------------
+
+character(len=128) :: version = '$Id$'
+character(len=128) :: tagname = '$Name$'
+
+
+type conv_results_type
+
+integer, dimension(:,:), allocatable :: cldbot
+integer, dimension(:,:), allocatable :: cldtop
+real, dimension(:,:,:), allocatable :: prod_no
+
+real, dimension(:,:,:), allocatable :: ras_mflux
+real, dimension(:,:,:), allocatable :: donner_mflux
+real, dimension(:,:,:), allocatable :: donner_mflux_up
+real, dimension(:,:,:), allocatable :: uw_mflux
+real, dimension(:,:,:), allocatable :: ras_det_mflux
+real, dimension(:,:,:), allocatable :: donner_det_mflux
+real, dimension(:,:,:), allocatable :: mc_donner
+real, dimension(:,:,:), allocatable :: mc_donner_half
+real, dimension(:,:,:), allocatable :: mc_donner_up
+logical, dimension(:,: ), allocatable :: conv_calc_completed
+real , dimension(:,:,:), allocatable :: available_cf_for_uw
+
+end type conv_results_type
+
+
+type conv_tendency_type
+
+ real, dimension(:,:,:) , allocatable :: ttnd
+ real, dimension(:,:,:) , allocatable :: qtnd
+ real, dimension(:,:,:) , allocatable :: utnd
+ real, dimension(:,:,:) , allocatable :: vtnd
+ real, dimension(:,:,:) , allocatable :: qltnd
+ real, dimension(:,:,:) , allocatable :: qitnd
+ real, dimension(:,:,:) , allocatable :: qatnd
+ real, dimension(:,:,:) , allocatable :: qntnd
+ real, dimension(:,:,:) , allocatable :: qnitnd
+ real, dimension(:,:,:) , allocatable :: rain3d
+ real, dimension(:,:,:) , allocatable :: snow3d
+ real, dimension(:,: ) , allocatable :: rain
+ real, dimension(:,: ) , allocatable :: snow
+ real, dimension(:,:,:) , allocatable :: delta_q
+ real, dimension(:,:,:,:), allocatable :: qtr
+
+end type conv_tendency_type
+
+
+type mp2uwconv_type
+
+ real, dimension (:,:), allocatable :: shflx
+ real, dimension (:,:), allocatable :: lhflx
+ real, dimension (:,:,:), allocatable :: tdt_dif
+ real, dimension (:,:,:), allocatable :: qdt_dif
+
+end type mp2uwconv_type
+
+type conv_output_type
+
+ real, dimension(:,:,:), allocatable :: delta_temp
+ real, dimension(:,:,:), allocatable :: delta_vapor
+ real, dimension(:,:,:), allocatable :: delta_q
+ real, dimension(:,:,:), allocatable :: delta_qa
+ real, dimension(:,:,:), allocatable :: delta_ql
+ real, dimension(:,:,:), allocatable :: delta_qi
+ real, dimension(:,:,:), allocatable :: delta_qn
+ real, dimension(:,:,:), allocatable :: delta_qni
+ real, dimension(:,:,:), allocatable :: liquid_precip
+ real, dimension(:,:,:), allocatable :: frozen_precip
+ real, dimension(:,:,:), allocatable :: mc_donner
+ real, dimension(:,:,:), allocatable :: mc_donner_half
+ real, dimension(:,: ), allocatable :: vert_motion
+ real, dimension(:,: ), allocatable :: lheat_precip
+ real, dimension(:,: ), allocatable :: total_precip
+ real, dimension(:,: ), allocatable :: scale
+ real, dimension(:,: ), allocatable :: scale_REV
+ real, dimension(:,: ), allocatable :: precip_adjustment
+ real, dimension(:,: ), allocatable :: adjust_frac
+ real, dimension(:,:,:), allocatable :: ttnd_adjustment
+ real, dimension(:,: ), allocatable :: precip_returned
+ real, dimension(:,:,:,:), allocatable :: donner_tracer
+
+end type conv_output_type
+
+
+type donner_input_type
+
+ real, dimension(:,:,:), allocatable :: rin
+ real, dimension(:,: ), allocatable :: sfc_sh_flux
+ real, dimension(:,: ), allocatable :: sfc_vapor_flux
+ real, dimension(:,:,:), allocatable :: tr_flux
+ real, dimension(:,: ), allocatable :: ke_bl
+ integer, dimension(:,: ), allocatable :: maxTe_launch_level
+ real, dimension(:,:,:,:), allocatable :: qtr
+ real, dimension(:,:,:), allocatable :: qlin
+ real, dimension(:,:,:), allocatable :: qiin
+ real, dimension(:,:,:), allocatable :: qain
+ real, dimension(:,:,:), allocatable :: nllin
+ real, dimension(:,:,:), allocatable :: nilin
+ integer :: secs, days
+
+end type donner_input_type
+
+
+
+ contains
+
+
+
+ end module convection_utilities_mod
diff --git a/atmos_param/convection_driver/detr_ice_num.F90 b/atmos_param/convection_driver/detr_ice_num.F90
index d3fa4eab..20562ddb 100644
--- a/atmos_param/convection_driver/detr_ice_num.F90
+++ b/atmos_param/convection_driver/detr_ice_num.F90
@@ -2,9 +2,9 @@ module detr_ice_num_mod
use lscloud_constants_mod, only : lscloud_constants_init, rhoi
use mpp_mod, only : input_nml_file
-use fms_mod, only : mpp_pe, mpp_root_pe, file_exist, stdlog, &
- open_namelist_file, check_nml_error, &
- close_file, write_version_number, &
+use fms_mod, only : mpp_pe, mpp_root_pe, stdlog, &
+ check_nml_error, &
+ write_version_number, &
error_mesg, FATAL
implicit none
@@ -50,27 +50,15 @@ module detr_ice_num_mod
SUBROUTINE detr_ice_num_init
- integer :: unit, io, ierr, logunit
+ integer :: io, ierr, logunit
IF (module_is_initialized) return
!-------------------------------------------------------------------------
! process namelist.
!-------------------------------------------------------------------------
-#ifdef INTERNAL_FILE_NML
read (input_nml_file, nml=detr_ice_num_nml, iostat=io)
ierr = check_nml_error(io,'detr_ice_num_nml')
-#else
- if ( file_exist('input.nml')) then
-
- unit = open_namelist_file ( )
- ierr=1; do while (ierr /= 0)
- read (unit, nml=detr_ice_num_nml, iostat=io, end=10)
- ierr = check_nml_error(io,'detr_ice_num_nml')
- enddo
-10 call close_file (unit)
- endif
-#endif
!--------- write version and namelist to standard log ------------
diff --git a/atmos_param/convection_driver/moistproc_kernels.F90 b/atmos_param/convection_driver/moistproc_kernels.F90
deleted file mode 100644
index 2cbbc9f9..00000000
--- a/atmos_param/convection_driver/moistproc_kernels.F90
+++ /dev/null
@@ -1,862 +0,0 @@
- module moistproc_kernels_mod
-
-use time_manager_mod, only: time_type
-use constants_mod, only: CP_AIR, HLV, HLS, SECONDS_PER_DAY
-use field_manager_mod, only: MODEL_ATMOS
-use tracer_manager_mod, only: get_tracer_index
-use moist_conv_mod, only: moist_conv
-use uw_conv_mod, only: uw_conv
-use ras_mod, only: ras
-use cu_mo_trans_mod, only: cu_mo_trans
-use aerosol_types_mod, only: aerosol_type
-use detr_ice_num_mod , only: detr_ice_num
-use physics_radiation_exch_mod, only: cloud_scheme_data_type
-
-implicit none
-private
-public moistproc_mca, moistproc_ras, moistproc_cmt, &
- moistproc_uw_conv, moistproc_scale_uw, moistproc_scale_donner
-
-
-!--------------------- version number ----------------------------------
-character(len=128) :: &
-version = '$Id$'
-character(len=128) :: tagname = '$Name$'
-
-!-----------------------------------------------------------------------
-
-
-
-
- contains
-
-
-
-!#######################################################################
-
-subroutine moistproc_cmt ( Time, is, js, t, u, v, tracer, pfull, phalf, &
- zfull, zhalf, pmass, tdt, udt, vdt, rdt, &
- ttnd_conv, dt, mc_cmt, det_cmt, diff_cu_mo, &
- num_tracers)
-
-type(time_type), intent(in) :: Time
-integer, intent(in) :: is, js, num_tracers
-real, intent(in) :: dt
-real, dimension(:,:,:), intent(in) :: pfull, phalf, zfull, zhalf, &
- pmass, mc_cmt, det_cmt
-real, dimension(:,:,:), intent(inout) :: t, u, v, tdt, udt, vdt, &
- ttnd_conv, diff_cu_mo
-real, dimension(:,:,:,:), intent(inout) :: rdt, tracer
-
- real, dimension(size(t,1), size(t,2), size(t,3)) :: ttnd, utnd, vtnd
- real, dimension(size(rdt,1), size(rdt,2), &
- size(rdt,3),num_tracers) :: qtr
- integer :: n
-
-!------------------------------------------------------------------------
-! call cu_mo_trans to calculate cumulus momentum transport.
-!------------------------------------------------------------------------
- call cu_mo_trans (is, js, Time, mc_cmt, t, phalf, pfull, &
- zhalf, zfull, dt, u, v, tracer, &
- pmass, det_cmt, utnd, vtnd, ttnd, &
- qtr, diff_cu_mo )
-
-!---------------------------------------------------------------------
-! update the current tracer tendencies with the contributions
-! just obtained from cu_mo_trans.
-!---------------------------------------------------------------------
- do n=1, num_tracers
- rdt(:,:,:,n) = rdt(:,:,:,n) + qtr(:,:,:,n)
- end do
-
-!----------------------------------------------------------------------
-! add the temperature, specific humidity and momentum tendencies
-! due to cumulus transfer (ttnd, qtnd, utnd, vtnd) to the arrays
-! accumulating these tendencies from all physics processes (tdt, qdt,
-! udt, vdt).
-!----------------------------------------------------------------------
- tdt = tdt + ttnd
- udt = udt + utnd
- vdt = vdt + vtnd
- ttnd_conv = ttnd_conv + ttnd
-
-!-----------------------------------------------------------------------
-
-
-end subroutine moistproc_cmt
-
-
-
-!#######################################################################
-
-subroutine moistproc_mca &
- (Time, is, js, t, q, tracer, pfull, phalf, coldT, dtinv, &
- tdt, qdt, rdt, q_tnd, ttnd_conv, qtnd_conv, lprec, fprec, &
- doing_prog_clouds, num_tracers, tracers_in_mca, num_mca_tracers)
-
-type(time_type), intent(in) :: Time
-integer, intent(in) :: is, js, num_tracers, &
- num_mca_tracers
-real, intent(in) :: dtinv
-logical, intent(in) :: doing_prog_clouds
-logical, dimension(:), intent(in) :: tracers_in_mca
-logical, dimension(:,:), intent(in) :: coldT
-real, dimension(:,:,:), intent(in) :: pfull, phalf
-real, dimension(:,:), intent(inout) :: lprec, fprec
-real, dimension(:,:,:), intent(inout) :: t, q, tdt, qdt, ttnd_conv, &
- qtnd_conv
-real, dimension(:,:,:,:), intent(inout) :: rdt, q_tnd
-real, dimension(:,:,:,:), intent(out) :: tracer
-
- real, dimension(size(t,1), size(t,2)) :: rain, snow
- real, dimension(size(t,1), size(t,2), &
- size(t,3)) :: ttnd, qtnd
- real, dimension(size(rdt,1), size(rdt,2),&
- size(rdt,3), num_mca_tracers) :: trcr, qtr
-
- integer :: nn, n, nql, nqa, nqi, nqn
-
- nql = get_tracer_index ( MODEL_ATMOS, 'liq_wat' )
- nqi = get_tracer_index ( MODEL_ATMOS, 'ice_wat' )
- nqa = get_tracer_index ( MODEL_ATMOS, 'cld_amt' )
- nqn = get_tracer_index ( MODEL_ATMOS, 'liq_drp' )
-
-!---------------------------------------------------------------------
-! check each active tracer to find any that are to be transported
-! by moist convective adjustment and fill the mca_tracers array with
-! these fields.
-!---------------------------------------------------------------------
- nn = 1
- do n=1, num_tracers
- if (tracers_in_mca(n)) then
- trcr(:,:,:,nn) = tracer(:,:,:,n)
- nn = nn + 1
- endif
- end do
-
-!---------------------------------------------------------------------
-! call subroutine moist_conv to obtain the temperature, moisture
-! precipitation and tracer tendencies due to the moist convective
-! adjustment parameterization. currently there is no tracer tendency
-! due to this parameterization.
-!---------------------------------------------------------------------
-!++++yim Should also account for change in qn dut to moist convective adjustment.
-
- if (doing_prog_clouds) then
- call moist_conv (t, q, pfull, phalf, coldT, ttnd, qtnd, &
- rain, snow, dtinv, Time, is, js, trcr, qtr, &
- ql=tracer(:,:,:,nql), qi=tracer(:,:,:,nqi), &
- cf=tracer(:,:,:,nqa), qldel=q_tnd(:,:,:,nql), &
- qidel=q_tnd(:,:,:,nqi), cfdel=q_tnd(:,:,:,nqa))
- else
- call moist_conv (t, q, pfull, phalf, coldT, ttnd, qtnd, &
- rain, snow, dtinv, Time, is, js, &
- trcr, qtr )
- endif
-
-!---------------------------------------------------------------------
-! update the current tracer tendencies with the contributions
-! just obtained from moist convective adjustment. currently there
-! is no tracer transport by this process.
-! NOTE : the stratcloud tracers are updated within moist_conv.
-!---------------------------------------------------------------------
- nn = 1
- do n=1, num_tracers
- if (tracers_in_mca(n)) then
- rdt(:,:,:,n) = rdt(:,:,:,n) + qtr(:,:,:,nn)
- nn = nn + 1
- endif
- end do
-
-!----------------------------------------------------------------------
-! add the temperature and specific humidity tendencies from moist
-! convective adjustment (ttnd, qtnd) to the arrays accumulating
-! these tendencies from all physics processes (tdt, qdt).
-!----------------------------------------------------------------------
- tdt = tdt + ttnd
- qdt = qdt + qtnd
- ttnd_conv = ttnd_conv + ttnd
- qtnd_conv = qtnd_conv + qtnd
-
-!----------------------------------------------------------------------
-! increment the liquid, solid and total precipitation fields with
-! the contribution from moist convective adjustment.
-!----------------------------------------------------------------------
- lprec = lprec + rain
- fprec = fprec + snow
-
-!----------------------------------------------------------------------
-! if prognostic clouds are active, add the cloud liquid, ice and area
-! tendencies from moist convective adjustment to the
-! arrays accumulating these tendencies from all physics processes
-! (rdt).
-!----------------------------------------------------------------------
- if (doing_prog_clouds) then
- rdt(:,:,:,nql) = rdt(:,:,:,nql) + q_tnd(:,:,:,nql)
- rdt(:,:,:,nqi) = rdt(:,:,:,nqi) + q_tnd(:,:,:,nqi)
- rdt(:,:,:,nqa) = rdt(:,:,:,nqa) + q_tnd(:,:,:,nqa)
- endif
-
-
-end subroutine moistproc_mca
-
-
-!#######################################################################
-
-subroutine moistproc_ras &
- (Time, is, js, dt, coldT, t, q, u, v, tracer, pfull, phalf, &
- zhalf, tdt, qdt, udt, vdt, rdt, q_tnd, ttnd, qtnd, &
- ttnd_conv, qtnd_conv, mc, det0, lprec, fprec, rain, snow, &
- rain3d, snow3d, Aerosol, doing_prog_clouds, do_liq_num, &
- num_tracers, tracers_in_ras, num_ras_tracers, &
- do_ice_num, detrain_ice_num)
-
-type(time_type), intent(in) :: Time
-integer, intent(in) :: is, js, num_tracers, &
- num_ras_tracers
-logical, intent(in) :: doing_prog_clouds, &
- do_liq_num, do_ice_num,&
- detrain_ice_num
-real, intent(in) :: dt
-logical, dimension(:), intent(in) :: tracers_in_ras
-logical, dimension(:,:), intent(in) :: coldT
-real, dimension(:,:,:), intent(in) :: pfull, phalf, zhalf
-real, dimension(:,:), intent(inout) :: lprec, fprec
-real, dimension(:,:,:), intent(inout) :: t, q, u, v, tdt, qdt, &
- udt, vdt, ttnd, qtnd, &
- ttnd_conv, qtnd_conv
-real, dimension(:,:,:,:), intent(inout) :: rdt, tracer, q_tnd
-real, dimension(:,:), intent(out) :: rain, snow
-real, dimension(:,:,:), intent(out) :: rain3d, snow3d, mc, det0
-
-type(aerosol_type), intent(in), optional :: Aerosol
-
-
- real, dimension(size(t,1), size(t,2), &
- size(t,3)) :: utnd, vtnd
- real, dimension(size(rdt,1), size(rdt,2), &
- size(rdt,3),num_ras_tracers) :: trcr, qtr
-
- integer :: nn, n, nql, nqa, nqi, nqn, nqni
-
-!----------------------------------------------------------------------
-! define tracer indices of the prognostic cloud tracers.
-!----------------------------------------------------------------------
- nql = get_tracer_index ( MODEL_ATMOS, 'liq_wat' )
- nqi = get_tracer_index ( MODEL_ATMOS, 'ice_wat' )
- nqa = get_tracer_index ( MODEL_ATMOS, 'cld_amt' )
- nqn = get_tracer_index ( MODEL_ATMOS, 'liq_drp' )
- nqni = get_tracer_index ( MODEL_ATMOS, 'ice_num' )
-
-!----------------------------------------------------------------------
-! if any tracers are to be transported by ras convection, check each
-! active tracer to find those to be transported and fill the
-! ras_tracers array with these fields.
-!---------------------------------------------------------------------
- nn = 1
- do n=1, num_tracers
- if (tracers_in_ras(n)) then
- trcr(:,:,:,nn) = tracer(:,:,:,n)
- nn = nn + 1
- endif
- end do
-
-!----------------------------------------------------------------------
-! call subroutine ras to obtain the temperature, specific humidity,
-! velocity, precipitation and tracer tendencies and mass flux
-! associated with the relaxed arakawa-schubert parameterization.
-!----------------------------------------------------------------------
- if (doing_prog_clouds .and. (.not.do_liq_num)) then
- call ras (is, js, Time, t, q, u, v, pfull, phalf, zhalf, coldT, &
- dt, ttnd, qtnd, utnd, vtnd, rain3d, snow3d, rain, snow, &
- trcr, qtr, mc0=mc, det0=det0, &
- ql0=tracer(:,:,:,nql), qi0=tracer(:,:,:,nqi), &
- qa0=tracer(:,:,:,nqa), dl0=q_tnd(:,:,:,nql), &
- di0=q_tnd(:,:,:,nqi), da0=q_tnd(:,:,:,nqa))
-
- elseif (doing_prog_clouds .and. do_liq_num) then
- call ras (is, js, Time, t, q, u, v, pfull, phalf, zhalf, coldT, &
- dt, ttnd, qtnd, utnd, vtnd, rain3d, snow3d, rain, snow, &
- trcr, qtr, mc0=mc, det0=det0, &
- ql0=tracer(:,:,:,nql), qi0=tracer(:,:,:,nqi), &
- qa0=tracer(:,:,:,nqa), dl0=q_tnd(:,:,:,nql), &
- di0=q_tnd(:,:,:,nqi), da0=q_tnd(:,:,:,nqa), &
- qn0=tracer(:,:,:,nqn), dn0=q_tnd(:,:,:,nqn), &
- do_strat=doing_prog_clouds, Aerosol=Aerosol)
- else
- call ras (is, js, Time, t, q, u, v, pfull, phalf, zhalf, coldT, &
- dt, ttnd, qtnd, utnd, vtnd, rain3d, snow3d, rain, snow, &
- trcr, qtr, mc0=mc, det0=det0)
- endif
-
-!---------------------------------------------------------------------
-! update the current tracer tendencies with the contributions
-! just obtained from ras transport.
-! NOTE : the prognostic cloud tracers are updated within ras.
-!---------------------------------------------------------------------
- nn = 1
- do n=1, num_tracers
- if (tracers_in_ras(n)) then
- rdt(:,:,:,n) = rdt(:,:,:,n) + qtr (:,:,:,nn)
- nn = nn + 1
- endif
- end do
-
-!----------------------------------------------------------------------
-! add the temperature, specific humidity and momentum tendencies
-! from ras (ttnd, qtnd, utnd, vtnd) to the arrays accumulating
-! these tendencies from all physics processes (tdt, qdt, udt, vdt).
-!----------------------------------------------------------------------
- tdt = tdt + ttnd
- qdt = qdt + qtnd
- udt = udt + utnd
- vdt = vdt + vtnd
-
-!---------------------------------------------------------------------
-! update the total time tendency of temperature and specific humidity due
-! to convective processes.
-!---------------------------------------------------------------------
- ttnd_conv = ttnd_conv + ttnd
- qtnd_conv = qtnd_conv + qtnd
-
-!----------------------------------------------------------------------
-! if prognostic clouds are activated, add the cloud liquid, ice, area
-! and droplet number tendencies from ras to the arrays accumulating
-! these tendencies from all physics processes (rdt).
-!----------------------------------------------------------------------
- if (doing_prog_clouds) then
- rdt(:,:,:,nql) = rdt(:,:,:,nql) + q_tnd(:,:,:,nql)
- rdt(:,:,:,nqi) = rdt(:,:,:,nqi) + q_tnd(:,:,:,nqi)
- rdt(:,:,:,nqa) = rdt(:,:,:,nqa) + q_tnd(:,:,:,nqa)
- if (do_liq_num) rdt(:,:,:,nqn) = rdt(:,:,:,nqn) + q_tnd(:,:,:,nqn)
-
-!------------------------------------------------------------------------
-! if prognostic ice number is activated, call detr_ice_num to update
-! its value after ice detrainment is calculated (proportional to ice
-! mass).
-!------------------------------------------------------------------------
- IF (do_ice_num .AND. detrain_ice_num) THEN
- CALL detr_ice_num (t, q_tnd(:,:,:,nqi), q_tnd(:,:,:,nqni))
- rdt(:,:,:,nqni) = rdt(:,:,:,nqni) + q_tnd(:,:,:,nqni)
- END IF
- endif
-
-!----------------------------------------------------------------------
-! increment the liquid and frozen precipitation fields with
-! the contribution from ras.
-!----------------------------------------------------------------------
- lprec = lprec + rain
- fprec = fprec + snow
-
-!------------------------------------------------------------------------
-
-
-
-end subroutine moistproc_ras
-
-
-
-!#######################################################################
-
-subroutine moistproc_uw_conv ( &
- Time, is, ie, js, je, dt, t, q, u, v, tracer, &
- pfull, phalf, zfull, zhalf, omega, pblht, &
- ustar, bstar, qstar, shflx, lhflx, land, coldT, Aerosol, &
- tdt_rad, tdt_dyn, qdt_dyn, dgz_dyn, ddp_dyn, tdt_dif, &
- qdt_dif, hmint, lat, lon, cush, cbmf, cgust, tke, pblhto, &
- rkmo, taudpo, exist_shconv, exist_dpconv, &
- pblht_prev, hlsrc_prev, qtsrc_prev, cape_prev, cin_prev, &
- tke_prev, &!miz
- cmf, conv_calc_completed, &
- available_cf_for_uw, tdt, qdt, udt, vdt, rdt, &
- ttnd_conv, qtnd_conv, lprec, fprec, precip, &
- liq_precflx, ice_precflx, rain_uw, snow_uw, ttnd_uw, &
- qtnd_uw, utnd_uw, vtnd_uw, qtruw, qltnd_uw, qitnd_uw, &
- qatnd_uw, qntnd_uw, qnitnd_uw, doing_prog_clouds, &
- do_limit_uw, do_liq_num, num_tracers, tracers_in_uw, &
- num_uw_tracers, Cld_props, uw_wetdep, do_ice_num, &
- detrain_ice_num)
-
-type(time_type), intent(in) :: Time
-type(aerosol_type), intent(in) :: Aerosol
-integer, intent(in) :: is, ie,js, je, num_tracers,&
- num_uw_tracers
-real, intent(in) :: dt
-logical, intent(in) :: doing_prog_clouds, &
- do_limit_uw, do_liq_num
-logical, dimension(:), intent(in) :: tracers_in_uw
-logical, dimension(:,:), intent(in) :: coldT, conv_calc_completed
-real, dimension(:,:), intent(in) :: land, ustar, bstar, qstar, &
- pblht, shflx, lhflx, lat, &
- lon
-real, dimension(:,:,:), intent(in) :: pfull, phalf, zfull, zhalf, &
- omega, t, q, u, v, &
- available_cf_for_uw
-real, dimension(:,:,:,:), intent(in) :: tracer
-real, dimension(:,:), intent(inout) :: lprec, fprec, precip, cush, &
- cbmf, hmint, cgust
-real, dimension(:,:), intent(inout) :: tke, pblhto, rkmo, taudpo
-integer, dimension(:,:,:), intent(inout) :: exist_shconv, exist_dpconv
-real, dimension(:,:,:), intent(inout) :: pblht_prev, hlsrc_prev, &
- qtsrc_prev, cape_prev, &
- cin_prev, tke_prev !miz
-real, dimension(:,:,:), intent(in) :: tdt_rad, tdt_dyn, qdt_dyn, &
- dgz_dyn, ddp_dyn, tdt_dif, &
- qdt_dif
-real, dimension(:,:,:), intent(inout) :: tdt, qdt, udt, vdt, &
- ttnd_conv, qtnd_conv, cmf
-real, dimension(:,:,:,:), intent(inout) :: rdt
-type(cloud_scheme_data_type), intent(inout) :: Cld_props
-logical, intent(in ) :: do_ice_num, detrain_ice_num
-real, dimension(:,:,:), intent(out) :: liq_precflx, ice_precflx
-real, dimension(:,:,:), intent(out) :: uw_wetdep
-real, dimension(:,:), intent(inout) :: rain_uw, snow_uw
-real, dimension(:,:,:), intent(inout) :: ttnd_uw, qtnd_uw, utnd_uw, &
- vtnd_uw, qltnd_uw, qitnd_uw,&
- qatnd_uw, qntnd_uw, qnitnd_uw
-real, dimension(:,:,:,:), intent(inout) :: qtruw
-
-
- real, dimension(size(rdt,1), size(rdt,2), &
- size(rdt,3), num_uw_tracers) :: trcr
-
- integer :: n, nn, nql, nqi, nqa, nqn, nqni
-
-!------------------------------------------------------------------------
-! define indices of cloud tracers into tracer array.
-!------------------------------------------------------------------------
- nql = get_tracer_index ( MODEL_ATMOS, 'liq_wat' )
- nqi = get_tracer_index ( MODEL_ATMOS, 'ice_wat' )
- nqa = get_tracer_index ( MODEL_ATMOS, 'cld_amt' )
- nqn = get_tracer_index ( MODEL_ATMOS, 'liq_drp' )
- nqni = get_tracer_index ( MODEL_ATMOS, 'ice_num' )
-
-!----------------------------------------------------------------------
-! if any tracers are to be transported by UW convection, check each
-! active tracer to find those to be transported and fill the
-! trcr array with these fields.
-!---------------------------------------------------------------------
- nn = 1
- do n=1, num_tracers
- if (tracers_in_uw(n)) then
- trcr(:,:,:,nn) = tracer(:,:,:,n)
- nn = nn + 1
- endif
- end do
-
-!-------------------------------------------------------------------------
-! call uw_conv to calculate the effects of shallow convection.
-!-------------------------------------------------------------------------
- call uw_conv (is, js, Time, t, q, u, v, pfull, phalf, zfull, zhalf, &
- tracer, omega, dt, pblht, ustar, bstar, qstar, land, &
- coldT, Aerosol,lat, lon, cush, tke, doing_prog_clouds,&
- conv_calc_completed, available_cf_for_uw, ttnd_uw, &
- qtnd_uw, qltnd_uw, qitnd_uw, qatnd_uw, qntnd_uw, &
- utnd_uw, vtnd_uw, rain_uw, snow_uw, cmf, liq_precflx, &
- ice_precflx, Cld_props%liquid_amt, Cld_props%ice_amt, &
- Cld_props%cloud_area, Cld_props%droplet_number, &
- trcr, qtruw, uw_wetdep, cbmf, cgust)
-
-!-------------------------------------------------------------------------
-! call detr_ice_num to calculate the ice number tendency due to
-! detrainment, which is proportional to the ice mass.
-!-------------------------------------------------------------------------
- IF ( do_ice_num .AND. detrain_ice_num ) THEN
- CALL detr_ice_num (t, qitnd_uw(:,:,:), &
- qnitnd_uw(:,:,:) )
- END IF
-
-!-----------------------------------------------------------------------
-! if the subroutine to enforce non-negative cloud tracers is not being
-! used, update the physics tendency, convection tendency and tracer
-! tendency arrays with the contributions from uw_shallow convection.
-! if such enforcement is desired, the updates will occur later (this
-! should be further examined).
-!-----------------------------------------------------------------------
- if (.not. do_limit_uw) then
- tdt = tdt + ttnd_uw
- qdt = qdt + qtnd_uw
- udt = udt + utnd_uw
- vdt = vdt + vtnd_uw
- ttnd_conv = ttnd_conv + ttnd_uw
- qtnd_conv = qtnd_conv + qtnd_uw
- lprec = lprec + rain_uw
- fprec = fprec + snow_uw
- precip = precip + rain_uw + snow_uw
-
- if (doing_prog_clouds) then
- rdt(:,:,:,nql) = rdt(:,:,:,nql) + qltnd_uw
- rdt(:,:,:,nqi) = rdt(:,:,:,nqi) + qitnd_uw
- rdt(:,:,:,nqa) = rdt(:,:,:,nqa) + qatnd_uw
- if (do_liq_num) rdt(:,:,:,nqn) = rdt(:,:,:,nqn) + qntnd_uw
- if (do_ice_num) rdt(:,:,:,nqni) = rdt(:,:,:,nqni) + qnitnd_uw
- endif
-
-!---------------------------------------------------------------------
-! update the current tracer tendencies with the contributions
-! just obtained from uw transport.
-!---------------------------------------------------------------------
- nn = 1
- do n=1, num_tracers
- if (tracers_in_uw(n)) then
- rdt(:,:,:,n) = rdt(:,:,:,n) + qtruw(:,:,:,nn)
- nn = nn + 1
- endif
- end do
- endif !(.not. do_limit_uw)
-
-!------------------------------------------------------------------------
-
-
-end subroutine moistproc_uw_conv
-
-
-
-
-
-!#######################################################################
-
-subroutine moistproc_scale_donner &
- (is, ie, js, je, dt, q, delta_temp, delta_q, precip_returned, &
- total_precip, lheat_precip, liquid_precip, frozen_precip, &
- pmass, num_tracers, tracers_in_donner, delta_ql, delta_qi, &
- delta_qa, qlin, qiin, qtr, scale)
-
-!--------------------------------------------------------------------------
-! tendencies coming out of Donner deep are adjusted to prevent
-! the formation of negative water vapor, liquid or ice.
-!--------------------------------------------------------------------------
-
-!-------------------------------------------------------------------------
-integer, intent(in) :: is, ie, js, je, num_tracers
-real , intent(in) :: dt ! Timestep of model.
-logical, dimension(:), intent(in) :: tracers_in_donner
-real, dimension(:,:), intent(inout) :: precip_returned, total_precip, &
- lheat_precip
-real, dimension(:,:,:), intent(inout) :: q, delta_temp, delta_q, &
- liquid_precip, frozen_precip, &
- pmass, delta_ql, delta_qi, &
- delta_qa, qlin, qiin
-real, dimension(:,:,:,:), intent(inout) :: qtr
-real, dimension(:,:), intent(out) :: scale
-
-!-----------------------------------------------------------------------
-
- real, dimension(size(q,1), size(q,2), size(q,3)) :: temp
-
- integer :: n, nn, i, j, k, ix, jx, kx
- real :: qvin, dqv
-
-!------------------------------------------------------------------------
-! define array sizes.
-!------------------------------------------------------------------------
- ix = size(q,1)
- jx = size(q,2)
- kx = size(q,3)
-
-!--------------------------------------------------------------------------
-! (1) Prevent negative liquid and ice specific humidities after
-! tendencies are applied
-!--------------------------------------------------------------------------
-
- where ((qlin + delta_ql) .lt. 0.)
- delta_temp = delta_temp - (qlin + delta_ql)*HLV/CP_AIR
- delta_q = delta_q + (qlin + delta_ql)
- delta_ql = delta_ql - (qlin + delta_ql)
- end where
-
- where ((qiin + delta_qi) .lt. 0.)
- delta_temp = delta_temp - (qiin + delta_qi)*HLS/CP_AIR
- delta_q = delta_q + (qiin + delta_qi)
- delta_qi = delta_qi - (qiin + delta_qi)
- end where
-
-!------------------------------------------------------------------------
-!RSH NOTE:
-! the 1.e-10 which are used below could be changed to be qmin, as
-! defined in the physics_driver nml, and available as Exch_ctrl%qmin.
-!------------------------------------------------------------------------
- where (abs(delta_ql + delta_qi) .lt. 1.e-10 )
- delta_qa = 0.0
- end where
-
-!------------------------------------------------------------------------
-! (2) Compute limit on Donner tendencies to prevent water vapor
-! from going below 1.e-10, again the value of qmin as defined in
-! physics_driver_nml.
-!------------------------------------------------------------------------
-
-!-----------------------------------------------------------------------
-! compute a scaling factor for each grid point.
-!-----------------------------------------------------------------------
- do k=1,kx
- do j=1,jx
- do i=1,ix
- qvin = q(i,j,k)
- dqv = delta_q(i,j,k)
- if ( dqv.lt.0 .and. qvin + dqv .lt. 1.e-10 ) then
- temp(i,j,k) = max( 0.0, -(qvin - 1.e-10)/dqv )
- else
- temp(i,j,k) = 1.0
- endif
- end do
- end do
- end do
-
-!-------------------------------------------------------------------------
-! define the scaling factor for each column as the minimum value found
-! within that column.
-!-------------------------------------------------------------------------
- scale = minval( temp, dim=3 )
-
-!-------------------------------------------------------------------------
-! scale the convective tendencies of temperature, cloud tracers and
-! tracers transported by the donner convection scheme.
-!-------------------------------------------------------------------------
- do k=1,kx
- delta_temp(:,:,k) = scale*delta_temp(:,:,k)
- delta_q(:,:,k) = scale*delta_q (:,:,k)
- delta_qa(:,:,k) = scale*delta_qa(:,:,k)
- delta_ql(:,:,k) = scale*delta_ql(:,:,k)
- delta_qi(:,:,k) = scale*delta_qi(:,:,k)
- end do
-
- nn = 1
- do n=1, num_tracers
- if (tracers_in_donner(n)) then
- do k=1,kx
- qtr(:,:,k,nn) = scale(:,:) * qtr(:,:,k,nn)
- end do
- nn = nn + 1
- endif
- end do
-
-!-------------------------------------------------------------------------
-! scale the precipitation fields and associated enthalpy terms.
-! Precip returned from Donner scheme is recalculated below.
-!-------------------------------------------------------------------------
-! precip_returned = scale*precip_returned
-
- total_precip = scale*total_precip
- lheat_precip = scale*lheat_precip
- do k=1, kx
- liquid_precip(:,:,k) = scale(:,:)*liquid_precip(:,:,k)
- frozen_precip(:,:,k) = scale(:,:)*frozen_precip(:,:,k)
- end do
-
-!-------------------------------------------------------------------------
-! Limit liquid and frozen precip to not have negative values.
-!-------------------------------------------------------------------------
- where ( liquid_precip(:,:,:) .lt. 0.)
- liquid_precip(:,:,:) = 0.0
- end where
-
- where ( frozen_precip(:,:,:) .lt. 0.)
- frozen_precip(:,:,:) = 0.0
- end where
-
-!-------------------------------------------------------------------------
-! dimensions of liquid_precip is [kg(H20)/(kg s)]*(SECONDS_PER_DAY)
-! dimensions of frozen_precip is [kg(H20)/(kg s)]*(SECONDS_PER_DAY)
-
-! Note that (dt/seconds_per_day) * sum of (liquid_precip(k) +
-! frozen_precip( k) *pmass(k)) gives precip_returned.
-!-------------------------------------------------------------------------
- precip_returned(:,:) = 0.0
- do k=1, kx
- precip_returned(:,:) = precip_returned(:,:) + &
- (liquid_precip(:,:,k) + frozen_precip(:,:,k))*pmass(:,:,k) *&
- dt/SECONDS_PER_DAY
- end do
-
-!-------------------------------------------------------------------------
-
-
-end subroutine moistproc_scale_donner
-
-
-
-!#######################################################################
-
-subroutine moistproc_scale_uw &
- (is, ie, js, je, dt, q, tracer, tdt, qdt, udt, vdt, rdt, &
- ttnd_conv, qtnd_conv, lprec, fprec, precip, qtruw, rain_uw, &
- snow_uw, ttnd_uw, qtnd_uw, utnd_uw, vtnd_uw, qltnd_uw, qitnd_uw, &
- qatnd_uw, qntnd_uw, qnitnd_uw, doing_prog_clouds, do_liq_num, &
- num_tracers, tracers_in_uw, scale, do_ice_num)
-
-!------------------------------------------------------------------------
-! tendencies coming out of UW shallow are adjusted to prevent
-! the formation of negative water vapor, liquid or ice.
-!------------------------------------------------------------------------
-
-integer, intent(in) :: is, ie, js, je, num_tracers
-real, intent(in) :: dt
-logical, intent(in) :: doing_prog_clouds, do_liq_num, &
- do_ice_num
-logical, dimension(:), intent(in) :: tracers_in_uw
-real, dimension(:,:,:), intent(in) :: q
-real, dimension(:,:,:,:), intent(in) :: tracer
-real, dimension(:,:), intent(inout) :: lprec, fprec, precip
-real, dimension(:,:,:), intent(inout) :: tdt, qdt, udt, vdt, &
- ttnd_conv, qtnd_conv
-real, dimension(:,:,:,:), intent(inout) :: rdt
-real, dimension(:,:), intent(out) :: scale
-
-real, dimension(:,:), intent(inout) :: rain_uw, snow_uw
-real, dimension(:,:,:), intent(inout) :: ttnd_uw, qtnd_uw, utnd_uw, &
- vtnd_uw, qltnd_uw, qitnd_uw, &
- qatnd_uw, qntnd_uw, qnitnd_uw
-real, dimension(:,:,:,:), intent(inout) :: qtruw
-
-!------------------------------------------------------------------------
- real, dimension(size(q,1), size(q,2), size(q,3)) :: temp
-
- integer :: n, nn, i, j, k, ix, jx, kx, nql, nqi, nqa, nqn, nqni
- real :: qvin, dqv
-
-!-----------------------------------------------------------------------
-! define array dimensions and the tracer indices for the active cloud
-! tracers.
-!-----------------------------------------------------------------------
- ix = size(q,1)
- jx = size(q,2)
- kx = size(q,3)
- nql = get_tracer_index ( MODEL_ATMOS, 'liq_wat' )
- nqi = get_tracer_index ( MODEL_ATMOS, 'ice_wat' )
- nqa = get_tracer_index ( MODEL_ATMOS, 'cld_amt' )
- nqn = get_tracer_index ( MODEL_ATMOS, 'liq_drp' )
- nqni = get_tracer_index ( MODEL_ATMOS, 'ice_num' )
-
-!----------------------------------------------------------------------
-! (1) Prevent negative liquid and ice specific humidities after
-! tendencies are applied.
-!-----------------------------------------------------------------------
- temp = tracer(:,:,:,nql)/dt + qltnd_uw
- where (temp(:,:,:) .lt. 0.)
- ttnd_uw = ttnd_uw - temp*HLV/CP_AIR
- qtnd_uw = qtnd_uw + temp
- qltnd_uw = qltnd_uw - temp
- end where
-
- temp = tracer(:,:,:,nqi)/dt + qitnd_uw
- where (temp .lt. 0.)
- ttnd_uw = ttnd_uw - temp*HLS/CP_AIR
- qtnd_uw = qtnd_uw + temp
- qitnd_uw = qitnd_uw - temp
- end where
-
-!------------------------------------------------------------------------
-!RSH NOTE:
-! the 1.e-10 which are used below could be changed to be qmin, as
-! defined in the physics_driver nml, and available as Exch_ctrl%qmin.
-!------------------------------------------------------------------------
- where (abs(qltnd_uw + qitnd_uw)*dt .lt. 1.e-10 )
- qatnd_uw = 0.0
- end where
-
-!------------------------------------------------------------------------
-! (2) Compute limit on UW tendencies to prevent water vapor
-! from going below 1.e-10. The value of 1.e-10 is consistent with qmin
-! defined in physics_driver_nml, and available as Exch_ctrl%qmin.
-!------------------------------------------------------------------------
-
-!-----------------------------------------------------------------------
-! compute a scaling factor for each grid point.
-!-----------------------------------------------------------------------
- do k=1,kx
- do j=1,jx
- do i=1,ix
- qvin = q(i,j,k) + tracer(i,j,k,nql) + tracer(i,j,k,nqi)
- dqv = ( qtnd_uw(i,j,k) + qltnd_uw(i,j,k) + qitnd_uw(i,j,k) )*dt
- if ( dqv.lt.0 .and. qvin + dqv .lt. 1.e-10 ) then
- temp(i,j,k) = max( 0.0, -(qvin - 1.e-10)/dqv )
- else
- temp(i,j,k) = 1.0
- endif
- end do
- end do
- end do
-
-!-----------------------------------------------------------------------
-! the scaling factor for each column is the minimum value found
-! within that column.
-!-----------------------------------------------------------------------
- scale = minval( temp, dim=3 )
-
-!-----------------------------------------------------------------------
-! scale the cloud tracer, momentum, temperature, precipitation and
-! transported tracer tendencies returned from uw shallow convection.
-!-----------------------------------------------------------------------
- do k=1,kx
- utnd_uw(:,:,k) = scale*utnd_uw(:,:,k)
- vtnd_uw(:,:,k) = scale*vtnd_uw(:,:,k)
- ttnd_uw(:,:,k) = scale*ttnd_uw(:,:,k)
- qtnd_uw(:,:,k) = scale*qtnd_uw(:,:,k)
- qltnd_uw(:,:,k) = scale*qltnd_uw(:,:,k)
- qitnd_uw(:,:,k) = scale*qitnd_uw(:,:,k)
- qatnd_uw(:,:,k) = scale*qatnd_uw(:,:,k)
- end do
-
- if (do_liq_num) then
- do k=1,kx
- qntnd_uw(:,:,k) = scale*qntnd_uw(:,:,k)
- end do
- end if
-
- if (do_ice_num) then
- do k=1,kx
- qnitnd_uw(:,:,k) = scale*qnitnd_uw(:,:,k)
- end do
- end if
-
- rain_uw(:,:) = scale*rain_uw(:,:)
- snow_uw(:,:) = scale*snow_uw(:,:)
-
-!-----------------------------------------------------------------------
-! update total-physics and total-convection tendencies, precipitation
-! fields and the cloud tracer fields and tendencies.
-!-----------------------------------------------------------------------
- tdt = tdt + ttnd_uw
- qdt = qdt + qtnd_uw
- udt = udt + utnd_uw
- vdt = vdt + vtnd_uw
- ttnd_conv = ttnd_conv + ttnd_uw
- qtnd_conv = qtnd_conv + qtnd_uw
-
- lprec = lprec + rain_uw
- fprec = fprec + snow_uw
- precip = precip + rain_uw + snow_uw
-
- if (doing_prog_clouds) then
- rdt(:,:,:,nql) = rdt(:,:,:,nql) + qltnd_uw
- rdt(:,:,:,nqi) = rdt(:,:,:,nqi) + qitnd_uw
- rdt(:,:,:,nqa) = rdt(:,:,:,nqa) + qatnd_uw
- if (do_liq_num) rdt(:,:,:,nqn) = rdt(:,:,:,nqn) + qntnd_uw
- if (do_ice_num) rdt(:,:,:,nqni) = rdt(:,:,:,nqni) + qnitnd_uw
- endif
-
-!------------------------------------------------------------------------
-! update the current tracer tendencies with the contributions
-! obtained from uw transport.
-!------------------------------------------------------------------------
- nn = 1
- do n=1, num_tracers
- if (tracers_in_uw(n)) then
- rdt(:,:,:,n) = rdt(:,:,:,n) + qtruw (:,:,:,nn)
- nn = nn + 1
- endif
- end do
-
-!-------------------------------------------------------------------------
-
-
-end subroutine moistproc_scale_uw
-
-
-
-!#########################################################################
-
-
-
- end module moistproc_kernels_mod
diff --git a/atmos_param/cosp/MISR_simulator/MISR_simulator.F b/atmos_param/cosp/MISR_simulator/MISR_simulator.F
index c6019efd..55131239 100644
--- a/atmos_param/cosp/MISR_simulator/MISR_simulator.F
+++ b/atmos_param/cosp/MISR_simulator/MISR_simulator.F
@@ -1,9 +1,10 @@
#include "cosp_defs.H"
+! version number = 1.4.3
!
! Copyright (c) 2009, Roger Marchand, version 1.2
! All rights reserved.
! $Revision: 23 $, $Date: 2011-03-31 09:41:37 -0400 (Thu, 31 Mar 2011) $
-! $URL: http://cfmip-obs-sim.googlecode.com/svn/stable/v1.4.1/MISR_simulator/MISR_simulator.f $
+! $URL: http://cfmip-obs-sim.googlecode.com/svn/stable/v1.4.0/MISR_simulator/MISR_simulator.f $
!
! Redistribution and use in source and binary forms, with or without modification, are permitted
! provided that the following conditions are met:
@@ -329,72 +330,75 @@ SUBROUTINE MISR_simulator(
!
! This setup assumes the columns represent a about a 1 to 4 km scale
! it will need to be modified significantly, otherwise
- if(ncol.eq.1) then
+
+ ! Commented out. Should only be used with subcolumns are not randomly o rdered. Roj 4/2018
+
+! if(ncol.eq.1) then
! adjust based on neightboring points ... i.e. only 2D grid was input
- do j=2,npoints-1
+! do j=2,npoints-1
- if(box_MISR_ztop(j-1,1).gt.0 .and.
- & box_MISR_ztop(j+1,1).gt.0 ) then
-
- if( abs( box_MISR_ztop(j-1,1) -
- & box_MISR_ztop(j+1,1) ) .lt. 500
- & .and.
- & box_MISR_ztop(j,1) .lt.
- & box_MISR_ztop(j+1,1) ) then
+! if(box_MISR_ztop(j-1,1).gt.0 .and.
+! & box_MISR_ztop(j+1,1).gt.0 ) then
+
+! if( abs( box_MISR_ztop(j-1,1) -
+! & box_MISR_ztop(j+1,1) ) .lt. 500
+! & .and.
+! & box_MISR_ztop(j,1) .lt.
+! & box_MISR_ztop(j+1,1) ) then
- box_MISR_ztop(j,1) =
- & box_MISR_ztop(j+1,1)
- endif
+! box_MISR_ztop(j,1) =
+! & box_MISR_ztop(j+1,1)
+! endif
- endif
- enddo
- else
+! endif
+! enddo
+! else
! adjust based on neighboring subcolumns ....
#ifdef COSP_GFDL
!RSH ADDS j loop and uses j as index rather than just j=1:
! Not certain this is proper but it is needed to provide reproducibility
! across domain decomposition.
- do j=1,npoints
+! do j=1,npoints
#endif
- do ibox=2,ncol-1
+! do ibox=2,ncol-1
#ifndef COSP_GFDL
- if(box_MISR_ztop(1,ibox-1).gt.0 .and.
- & box_MISR_ztop(1,ibox+1).gt.0 ) then
-
- if( abs( box_MISR_ztop(1,ibox-1) -
- & box_MISR_ztop(1,ibox+1) ) .lt. 500
- & .and.
- & box_MISR_ztop(1,ibox) .lt.
- & box_MISR_ztop(1,ibox+1) ) then
+! if(box_MISR_ztop(1,ibox-1).gt.0 .and.
+! & box_MISR_ztop(1,ibox+1).gt.0 ) then
+
+! if( abs( box_MISR_ztop(1,ibox-1) -
+! & box_MISR_ztop(1,ibox+1) ) .lt. 500
+! & .and.
+! & box_MISR_ztop(1,ibox) .lt.
+! & box_MISR_ztop(1,ibox+1) ) then
- box_MISR_ztop(1,ibox) =
- & box_MISR_ztop(1,ibox+1)
+! box_MISR_ztop(1,ibox) =
+! & box_MISR_ztop(1,ibox+1)
#else
- if(box_MISR_ztop(j,ibox-1).gt.0 .and.
- & box_MISR_ztop(j,ibox+1).gt.0 ) then
+! if(box_MISR_ztop(j,ibox-1).gt.0 .and.
+! & box_MISR_ztop(j,ibox+1).gt.0 ) then
- if( abs( box_MISR_ztop(j,ibox-1) -
- & box_MISR_ztop(j,ibox+1) ) .lt. 500
- & .and.
- & box_MISR_ztop(j,ibox) .lt.
- & box_MISR_ztop(j,ibox+1) ) then
+! if( abs( box_MISR_ztop(j,ibox-1) -
+! & box_MISR_ztop(j,ibox+1) ) .lt. 500
+! & .and.
+! & box_MISR_ztop(j,ibox) .lt.
+! & box_MISR_ztop(j,ibox+1) ) then
- box_MISR_ztop(j,ibox) =
- & box_MISR_ztop(j,ibox+1)
+! box_MISR_ztop(j,ibox) =
+! & box_MISR_ztop(j,ibox+1)
#endif
- endif
+! endif
- endif
- enddo
+! endif
+! enddo
#ifdef COSP_GFDL
- enddo
+! enddo
#endif
- endif
+! endif
!
! DETERMINE CLOUD TYPE FREQUENCIES
diff --git a/atmos_param/cosp/MODIS_simulator/modis_simulator.F90 b/atmos_param/cosp/MODIS_simulator/modis_simulator.F90
index 648c6a8e..43eaa93e 100644
--- a/atmos_param/cosp/MODIS_simulator/modis_simulator.F90
+++ b/atmos_param/cosp/MODIS_simulator/modis_simulator.F90
@@ -1,9 +1,10 @@
#include "cosp_defs.H"
+! version number = 1.4.3
! (c) 2009-2010, Regents of the Unversity of Colorado
! Author: Robert Pincus, Cooperative Institute for Research in the Environmental Sciences
! All rights reserved.
! $Revision: 88 $, $Date: 2013-11-13 09:08:38 -0500 (Wed, 13 Nov 2013) $
-! $URL: http://cfmip-obs-sim.googlecode.com/svn/stable/v1.4.1/MODIS_simulator/modis_simulator.F90 $
+! $URL: http://cfmip-obs-sim.googlecode.com/svn/stable/v1.4.0/MODIS_simulator/modis_simulator.F90 $
!
! Redistribution and use in source and binary forms, with or without modification, are permitted
! provided that the following conditions are met:
@@ -503,105 +504,59 @@ subroutine modis_column(nPoints,nSubCols,phase, cloud_top_pressure, optical_thic
Cloud_Fraction_Mid_Mean(1:nPoints) = Cloud_Fraction_Total_Mean(1:nPoints) - Cloud_Fraction_High_Mean(1:nPoints)&
- Cloud_Fraction_Low_Mean(1:nPoints)
-!! UPDATE 03/2018 TER: check for (cloud_fraction == 0) FIRST because otherwise dividing by 0
-! ########################################################################################
-! Compute mean optical thickness.
-! ########################################################################################
- Optical_Thickness_Total_Mean(1:nPoints) = sum(optical_thickness, mask = cloudMask,dim = 2)
- Optical_Thickness_Water_Mean(1:nPoints) = sum(optical_thickness,mask=waterCloudMask,dim=2)
- Optical_Thickness_Ice_Mean(1:nPoints) = sum(optical_thickness,mask=iceCloudMask,dim=2)
- ! ########################################################################################
- ! We take the absolute value of optical thickness here to satisfy compilers that complains
- ! when we evaluate the logarithm of a negative number, even though it's not included in
- ! the sum.
- ! ########################################################################################
- Optical_Thickness_Total_MeanLog10(1:nPoints) = sum(log10(abs(optical_thickness)), mask = cloudMask, &
- dim = 2)
- Optical_Thickness_Water_MeanLog10(1:nPoints) = sum(log10(abs(optical_thickness)), mask = waterCloudMask,&
- dim = 2)
- Optical_Thickness_Ice_MeanLog10(1:nPoints) = sum(log10(abs(optical_thickness)), mask = iceCloudMask,&
- dim = 2)
- Cloud_Particle_Size_Water_Mean(1:nPoints) = sum(particle_size, mask = waterCloudMask, dim = 2)
- Liquid_Water_Path_Mean(1:nPoints) = LWP_conversion*sum(particle_size*optical_thickness, &
- mask=waterCloudMask,dim=2)
- Cloud_Particle_Size_Ice_Mean(1:nPoints) = sum(particle_size, mask = iceCloudMask, dim = 2)
- Ice_Water_Path_Mean(1:nPoints) = LWP_conversion * ice_density*sum(particle_size*optical_thickness,&
- mask=iceCloudMask,dim = 2)
-
-!Divide by the means if the mean is not 0, otherwise set to undefined value
-ot_and_cf: do i = 1,nPoints
-!Total
- if (Cloud_Fraction_Total_Mean (i) == 0) then
- Optical_Thickness_Total_Mean (i) = R_UNDEF
- Optical_Thickness_Total_MeanLog10 (i) = R_UNDEF
- Cloud_Top_Pressure_Total_Mean (i) = R_UNDEF
- else
- Optical_Thickness_Total_Mean (i) = Optical_Thickness_Total_Mean(i) / &
- Cloud_Fraction_Total_Mean(i)
- Optical_Thickness_Total_MeanLog10 (i) = Optical_Thickness_Total_MeanLog10(i)/ &
- Cloud_Fraction_Total_Mean(i)
-
- endif
-! water
- if (Cloud_Fraction_Water_Mean (i) == 0) then
- Optical_Thickness_Water_Mean (i) = R_UNDEF
- Optical_Thickness_Water_MeanLog10 (i) = R_UNDEF
- Cloud_Particle_Size_Water_Mean (i) = R_UNDEF
- Liquid_Water_Path_Mean (i) = R_UNDEF
- else
- Optical_Thickness_Water_Mean (i) = Optical_Thickness_Water_Mean (i)/ &
- Cloud_Fraction_Water_Mean(i)
- Optical_Thickness_Water_MeanLog10(i)= Optical_Thickness_Water_MeanLog10(i)/&
- Cloud_Fraction_Water_Mean(i)
- Cloud_Particle_Size_Water_Mean(i) = Cloud_Particle_Size_Water_Mean(i)/ &
- Cloud_Fraction_Water_Mean(i)
- Liquid_Water_Path_Mean(i) = Liquid_Water_Path_Mean(i)/&
- Cloud_Fraction_Water_Mean(i)
- endif
-! ice
- if (Cloud_Fraction_Ice_Mean(i) == 0) then
- Optical_Thickness_Ice_Mean(i) = R_UNDEF
- Optical_Thickness_Ice_MeanLog10(i) = R_UNDEF
- Cloud_Particle_Size_Ice_Mean(i) = R_UNDEF
- Ice_Water_Path_Mean(i) = R_UNDEF
- else
- Optical_Thickness_Ice_Mean(i) = Optical_Thickness_Ice_Mean(i)/ &
- Cloud_Fraction_Ice_Mean(i)
- Optical_Thickness_Ice_MeanLog10(i) = Optical_Thickness_Ice_MeanLog10(i)/ &
- Cloud_Fraction_Ice_Mean(i)
- Cloud_Particle_Size_Ice_Mean(i) = Cloud_Particle_Size_Ice_Mean(i)/ &
- Cloud_Fraction_Ice_Mean(i)
- Ice_Water_Path_Mean(i) = Ice_Water_Path_Mean(i)/&
- Cloud_Fraction_Ice_Mean(i)
- endif
-enddo ot_and_cf
-
-Cloud_Top_Pressure_Total_Mean(1:nPoints) = sum(cloud_top_pressure, mask = cloudMask, dim = 2) / &
- max(1, count(cloudMask, dim = 2))
+
+ where(Cloud_Fraction_Total_Mean(1:nPoints) > 0)
+ Optical_Thickness_Total_Mean(1:nPoints) = sum(optical_thickness, mask = cloudMask, dim = 2) / &
+ Cloud_Fraction_Total_Mean(1:nPoints)
+ Optical_Thickness_Total_MeanLog10(1:nPoints) = sum(log10(abs(optical_thickness)), mask = cloudMask, &
+ dim = 2) / Cloud_Fraction_Total_Mean(1:nPoints)
+ elsewhere
+ Optical_Thickness_Total_Mean = 0.
+ Optical_Thickness_Total_MeanLog10 = 0.
+ endwhere
+ where(Cloud_Fraction_Water_Mean(1:nPoints) > 0)
+ Optical_Thickness_Water_Mean(1:nPoints) = sum(optical_thickness, mask = waterCloudMask, dim = 2) / &
+ Cloud_Fraction_Water_Mean(1:nPoints)
+ Liquid_Water_Path_Mean(1:nPoints) = LWP_conversion*sum(particle_size*optical_thickness, &
+ mask=waterCloudMask,dim=2)/Cloud_Fraction_Water_Mean(1:nPoints)
+ Optical_Thickness_Water_MeanLog10(1:nPoints) = sum(log10(abs(optical_thickness)), mask = waterCloudMask,&
+ dim = 2) / Cloud_Fraction_Water_Mean(1:nPoints)
+ Cloud_Particle_Size_Water_Mean(1:nPoints) = sum(particle_size, mask = waterCloudMask, dim = 2) / &
+ Cloud_Fraction_Water_Mean(1:nPoints)
+ elsewhere
+ Optical_Thickness_Water_Mean = 0.
+ Optical_Thickness_Water_MeanLog10 = 0.
+ Cloud_Particle_Size_Water_Mean = 0.
+ Liquid_Water_Path_Mean = 0.
+ endwhere
+ where(Cloud_Fraction_Ice_Mean(1:nPoints) > 0)
+ Optical_Thickness_Ice_Mean(1:nPoints) = sum(optical_thickness, mask = iceCloudMask, dim = 2) / &
+ Cloud_Fraction_Ice_Mean(1:nPoints)
+ Ice_Water_Path_Mean(1:nPoints) = LWP_conversion * ice_density*sum(particle_size*optical_thickness,&
+ mask=iceCloudMask,dim = 2) /Cloud_Fraction_Ice_Mean(1:nPoints)
+ Optical_Thickness_Ice_MeanLog10(1:nPoints) = sum(log10(abs(optical_thickness)), mask = iceCloudMask,&
+ dim = 2) / Cloud_Fraction_Ice_Mean(1:nPoints)
+ Cloud_Particle_Size_Ice_Mean(1:nPoints) = sum(particle_size, mask = iceCloudMask, dim = 2) / &
+ Cloud_Fraction_Ice_Mean(1:nPoints)
+ elsewhere
+ Optical_Thickness_Ice_Mean = 0.
+ Optical_Thickness_Ice_MeanLog10 = 0.
+ Cloud_Particle_Size_Ice_Mean = 0.
+ Ice_Water_Path_Mean = 0.
+ endwhere
+ Cloud_Top_Pressure_Total_Mean = sum(cloud_top_pressure, mask = cloudMask, dim = 2) / &
+ max(1, count(cloudMask, dim = 2))
+
! ########################################################################################
! Normalize pixel counts to fraction.
! ########################################################################################
Cloud_Fraction_High_Mean(1:nPoints) = Cloud_Fraction_High_Mean(1:nPoints) /nSubcols
Cloud_Fraction_Mid_Mean(1:nPoints) = Cloud_Fraction_Mid_Mean(1:nPoints) /nSubcols
Cloud_Fraction_Low_Mean(1:nPoints) = Cloud_Fraction_Low_Mean(1:nPoints) /nSubcols
-!----------------------------------------------------------------------
-! To revert to v1.4.0, comment out the "#ifdef v1.4.0" lines,
-! uncomment the "#ifdef v1.4.1" lines.
-! To use v1.4.1, comment out the "#ifdef v1.4.1" lines,
-! uncomment the "#ifdef v1.4.0" lines.
-!----------------------------------------------------------------------
-!#ifdef v1.4.1
Cloud_Fraction_Total_Mean(1:nPoints) = Cloud_Fraction_Total_Mean(1:nPoints) /nSubcols
Cloud_Fraction_Ice_Mean(1:nPoints) = Cloud_Fraction_Ice_Mean(1:nPoints) /nSubcols
Cloud_Fraction_Water_Mean(1:nPoints) = Cloud_Fraction_Water_Mean(1:nPoints) /nSubcols
-!#endif
-#ifdef v1.4.0
- Cloud_Fraction_Total_Mean(1:nPoints) = max(0., Cloud_Fraction_Total_Mean(1:nPoints) /nSubcols)
- Cloud_Fraction_Ice_Mean(1:nPoints) = max(0., Cloud_Fraction_Ice_Mean(1:nPoints) /nSubcols)
- Cloud_Fraction_Water_Mean(1:nPoints) = max(0., Cloud_Fraction_Water_Mean(1:nPoints) /nSubcols)
-#endif
-!#ifdef v1.4.1
! ########################################################################################
! Set clear-scenes to undefined
! ########################################################################################
@@ -622,10 +577,6 @@ subroutine modis_column(nPoints,nSubCols,phase, cloud_top_pressure, optical_thic
Cloud_Particle_Size_Ice_Mean = R_UNDEF
Ice_Water_Path_Mean = R_UNDEF
endwhere
- where (Cloud_Fraction_High_Mean == 0) Cloud_Fraction_High_Mean = R_UNDEF
- where (Cloud_Fraction_Mid_Mean == 0) Cloud_Fraction_Mid_Mean = R_UNDEF
- where (Cloud_Fraction_Low_Mean == 0) Cloud_Fraction_Low_Mean = R_UNDEF
-!#endif
! ########################################################################################
! Joint histogram
@@ -1050,7 +1001,6 @@ pure function interpolate_to_min(x, y, yobs)
end function interpolate_to_min
-!#ifdef v1.4.1
! --------------------------------------------
! Optical properties
! --------------------------------------------
@@ -1112,67 +1062,6 @@ elemental function get_ssa_nir (phase, re)
end if
end function get_ssa_nir
-!#endif
-#ifdef v1.4.0
- elemental function get_g_nir (phase, re)
- !
- ! Polynomial fit for asummetry parameter g in MODIS band 7 (near IR) as a function
- ! of size for ice and water
- ! Fits from Steve Platnick
- !
-
- integer, intent(in) :: phase
- real, intent(in) :: re
- real :: get_g_nir
-
- real, dimension(3), parameter :: ice_coefficients = (/ 0.7432, 4.5563e-3, -2.8697e-5 /), &
- small_water_coefficients = (/ 0.8027, -1.0496e-2, 1.7071e-3 /), &
- big_water_coefficients = (/ 0.7931, 5.3087e-3, -7.4995e-5 /)
-
- ! approx. fits from MODIS Collection 5 LUT scattering calculations
- if(phase == phaseIsLiquid) then
- if(re < 8.) then
- get_g_nir = fit_to_quadratic(re, small_water_coefficients)
- if(re < re_water_min) get_g_nir = fit_to_quadratic(re_water_min, small_water_coefficients)
- else
- get_g_nir = fit_to_quadratic(re, big_water_coefficients)
- if(re > re_water_max) get_g_nir = fit_to_quadratic(re_water_max, big_water_coefficients)
- end if
- else
- get_g_nir = fit_to_quadratic(re, ice_coefficients)
- if(re < re_ice_min) get_g_nir = fit_to_quadratic(re_ice_min, ice_coefficients)
- if(re > re_ice_max) get_g_nir = fit_to_quadratic(re_ice_max, ice_coefficients)
- end if
-
- end function get_g_nir
-
- ! --------------------------------------------
- elemental function get_ssa_nir (phase, re)
- integer, intent(in) :: phase
- real, intent(in) :: re
- real :: get_ssa_nir
- !
- ! Polynomial fit for single scattering albedo in MODIS band 7 (near IR) as a function
- ! of size for ice and water
- ! Fits from Steve Platnick
- !
-
- real, dimension(4), parameter :: ice_coefficients = (/ 0.9994, -4.5199e-3, 3.9370e-5, -1.5235e-7 /)
- real, dimension(3), parameter :: water_coefficients = (/ 1.0008, -2.5626e-3, 1.6024e-5 /)
-
- ! approx. fits from MODIS Collection 5 LUT scattering calculations
- if(phase == phaseIsLiquid) then
- get_ssa_nir = fit_to_quadratic(re, water_coefficients)
- if(re < re_water_min) get_ssa_nir = fit_to_quadratic(re_water_min, water_coefficients)
- if(re > re_water_max) get_ssa_nir = fit_to_quadratic(re_water_max, water_coefficients)
- else
- get_ssa_nir = fit_to_cubic(re, ice_coefficients)
- if(re < re_ice_min) get_ssa_nir = fit_to_cubic(re_ice_min, ice_coefficients)
- if(re > re_ice_max) get_ssa_nir = fit_to_cubic(re_ice_max, ice_coefficients)
- end if
-
- end function get_ssa_nir
-#endif
! --------------------------------------------
pure function fit_to_cubic(x, coefficients)
real, intent(in) :: x
diff --git a/atmos_param/cosp/actsim/lidar_simulator.F90 b/atmos_param/cosp/actsim/lidar_simulator.F90
index 820e8716..395a28b9 100644
--- a/atmos_param/cosp/actsim/lidar_simulator.F90
+++ b/atmos_param/cosp/actsim/lidar_simulator.F90
@@ -1,8 +1,9 @@
#include "cosp_defs.H"
+! version number = 1.4.3
! Copyright (c) 2009, Centre National de la Recherche Scientifique
! All rights reserved.
! $Revision: 88 $, $Date: 2013-11-13 09:08:38 -0500 (Wed, 13 Nov 2013) $
-! $URL: http://cfmip-obs-sim.googlecode.com/svn/stable/v1.4.1/actsim/lidar_simulator.F90 $
+! $URL: http://cfmip-obs-sim.googlecode.com/svn/stable/v1.4.0/actsim/lidar_simulator.F90 $
!
! Redistribution and use in source and binary forms, with or without modification, are permitted
! provided that the following conditions are met:
@@ -204,6 +205,7 @@ SUBROUTINE lidar_simulator(npoints,nlev,npart,nrefl &
REAL pnorm_ice(npoints,nlev) ! lidar backscattered signal power for ice
REAL pnorm_perp_ice(npoints,nlev) ! perpendicular lidar backscattered signal power for ice
REAL pnorm_perp_liq(npoints,nlev) ! perpendicular lidar backscattered signal power for liq
+ real epsreal
! Output variable
REAL pnorm_perp_tot (npoints,nlev) ! perpendicular lidar backscattered signal power
@@ -510,23 +512,24 @@ SUBROUTINE lidar_simulator(npoints,nlev,npart,nrefl &
ENDDO
! Computation of beta_perp_ice/liq using the lidar equation
+ epsreal = epsilon(1.)
! Ice only
! Upper layer
beta_perp_ice(:,nlev) = pnorm_perp_ice(:,nlev) * (2.*tautot_ice(:,nlev)) &
& / (1.-exp(-2.0*tautot_ice(:,nlev)))
DO k= nlev-1, 1, -1
- tautot_lay_ice(:) = tautot_ice(:,k)-tautot_ice(:,k+1)
- where (tautot_ice(:,k+1).gt.120) !! hard-coded value for quick fix of large values in tautot_ice(:,k+1)
- beta_perp_ice(:,k) = pnorm_perp_ice(:,k)/ EXP(-2.0*120.0) * (2.*tautot_lay_ice(:)) &
- & / (1.-exp(-2.0*tautot_lay_ice(:)))
- elseWHERE (tautot_lay_ice(:).GT.0.)
- beta_perp_ice(:,k) = pnorm_perp_ice(:,k)/ EXP(-2.0*tautot_ice(:,k+1)) * (2.*tautot_lay_ice(:)) &
- & / (1.-exp(-2.0*tautot_lay_ice(:)))
-
- ELSEWHERE
- beta_perp_ice(:,k)=pnorm_perp_ice(:,k)/EXP(-2.0*tautot_ice(:,k+1))
- END WHERE
+ tautot_lay_ice(:) = tautot_ice(:,k)-tautot_ice(:,k+1)
+ WHERE ( EXP(-2.0*tautot_ice(:,k+1)) .gt. epsreal )
+ WHERE (tautot_lay_ice(:).GT.0.)
+ beta_perp_ice(:,k) = pnorm_perp_ice(:,k)/ EXP(-2.0*tautot_ice(:,k+1)) * (2.*tautot_lay_ice(:)) &
+ & / (1.-exp(-2.0*tautot_lay_ice(:)))
+ ELSEWHERE
+ beta_perp_ice(:,k)=pnorm_perp_ice(:,k)/EXP(-2.0*tautot_ice(:,k+1))
+ END WHERE
+ elsewhere
+ beta_perp_ice(:,k)=pnorm_perp_ice(:,k)/epsreal
+ endwhere
ENDDO
! Liquid only
@@ -534,18 +537,19 @@ SUBROUTINE lidar_simulator(npoints,nlev,npart,nrefl &
beta_perp_liq(:,nlev) = pnorm_perp_liq(:,nlev) * (2.*tautot_liq(:,nlev)) &
& / (1.-exp(-2.0*tautot_liq(:,nlev)))
+
DO k= nlev-1, 1, -1
- tautot_lay_liq(:) = tautot_liq(:,k)-tautot_liq(:,k+1)
- where (tautot_liq(:,k+1).gt.120) !! hard-coded value for quick fix of large values in tautot_ice(:,k+1)
- beta_perp_liq(:,k) = pnorm_perp_liq(:,k)/ EXP(-2.0*120.0) * (2.*tautot_lay_liq(:)) &
- & / (1.-exp(-2.0*tautot_lay_liq(:)))
- elseWHERE (tautot_lay_liq(:).GT.0.)
- beta_perp_liq(:,k) = pnorm_perp_liq(:,k)/ EXP(-2.0*tautot_liq(:,k+1)) * (2.*tautot_lay_liq(:)) &
- & / (1.-exp(-2.0*tautot_lay_liq(:)))
-
- ELSEWHERE
- beta_perp_liq(:,k)=pnorm_perp_liq(:,k)/EXP(-2.0*tautot_liq(:,k+1))
- END WHERE
+ tautot_lay_liq(:) = tautot_liq(:,k)-tautot_liq(:,k+1)
+ WHERE ( EXP(-2.0*tautot_liq(:,k+1)) .gt. epsreal )
+ WHERE (tautot_lay_liq(:).GT.0.)
+ beta_perp_liq(:,k) = pnorm_perp_liq(:,k)/ EXP(-2.0*tautot_liq(:,k+1)) * (2.*tautot_lay_liq(:)) &
+ & / (1.-exp(-2.0*tautot_lay_liq(:)))
+ ELSEWHERE
+ beta_perp_liq(:,k)=pnorm_perp_liq(:,k)/EXP(-2.0*tautot_liq(:,k+1))
+ END WHERE
+ elsewhere
+ beta_perp_liq(:,k)=pnorm_perp_liq(:,k)/epsreal
+ endwhere
ENDDO
diff --git a/atmos_param/cosp/actsim/lmd_ipsl_stats.F90 b/atmos_param/cosp/actsim/lmd_ipsl_stats.F90
index e810ffc0..80c4efde 100644
--- a/atmos_param/cosp/actsim/lmd_ipsl_stats.F90
+++ b/atmos_param/cosp/actsim/lmd_ipsl_stats.F90
@@ -1,8 +1,9 @@
#include "cosp_defs.H"
+! version number = 1.4.3
! Copyright (c) 2009, Centre National de la Recherche Scientifique
! All rights reserved.
! $Revision: 88 $, $Date: 2013-11-13 09:08:38 -0500 (Wed, 13 Nov 2013) $
-! $URL: http://cfmip-obs-sim.googlecode.com/svn/stable/v1.4.1/actsim/lmd_ipsl_stats.F90 $
+! $URL: http://cfmip-obs-sim.googlecode.com/svn/stable/v1.4.0/actsim/lmd_ipsl_stats.F90 $
!
! Redistribution and use in source and binary forms, with or without modification, are permitted
! provided that the following conditions are met:
diff --git a/atmos_param/cosp/cosp.F90 b/atmos_param/cosp/cosp.F90
index b2b36477..f521fdbc 100644
--- a/atmos_param/cosp/cosp.F90
+++ b/atmos_param/cosp/cosp.F90
@@ -1,4 +1,5 @@
#include "cosp_defs.H"
+!version number = 1.4.3
#ifdef COSP_GFDL
!---------------------------------------------------------------------
@@ -6,7 +7,6 @@
! $Id$
! $Name$
-! cosp_version = 1.4.1
#endif
diff --git a/atmos_param/cosp/cosp_constants.F90 b/atmos_param/cosp/cosp_constants.F90
index b051928e..a872bb64 100644
--- a/atmos_param/cosp/cosp_constants.F90
+++ b/atmos_param/cosp/cosp_constants.F90
@@ -1,4 +1,5 @@
#include "cosp_defs.H"
+! version number = 1.4.3
! (c) British Crown Copyright 2008, the Met Office.
! All rights reserved.
!
@@ -39,7 +40,7 @@
MODULE MOD_COSP_CONSTANTS
IMPLICIT NONE
- character(len=32) :: COSP_VERSION='COSP v1.4.1'
+ character(len=32) :: COSP_VERSION='COSP v1.4'
! Indices to address arrays of LS and CONV hydrometeors
integer,parameter :: I_LSCLIQ = 1
diff --git a/atmos_param/cosp/cosp_defs.H b/atmos_param/cosp/cosp_defs.H
index 6bedefb8..5575161c 100644
--- a/atmos_param/cosp/cosp_defs.H
+++ b/atmos_param/cosp/cosp_defs.H
@@ -1,4 +1,5 @@
#define COSP_GFDL
+! version number = 1.4.3
! (c) British Crown Copyright 2008, the Met Office.
! All rights reserved.
! $Revision: 88 $, $Date: 2013-11-13 09:08:38 -0500 (Wed, 13 Nov 2013) $
@@ -29,3 +30,6 @@
!#define SYS_SX sys_sx
#define MMF_V3_SINGLE_MOMENT mmf_v3_single_moment
!#define MMF_V3p5_TWO_MOMENT mmf_v3p5_two_moment
+
+
+
diff --git a/atmos_param/cosp/cosp_diagnostics.F90 b/atmos_param/cosp/cosp_diagnostics.F90
index f28979d5..313f22c7 100644
--- a/atmos_param/cosp/cosp_diagnostics.F90
+++ b/atmos_param/cosp/cosp_diagnostics.F90
@@ -1,4 +1,5 @@
#include "cosp_defs.H"
+! version number = 1.4.3
! (c) British Crown Copyright 2008, the Met Office.
! All rights reserved.
@@ -29,9 +30,8 @@
module cosp_diagnostics_mod
use mpp_mod, only: input_nml_file
-use fms_mod, only: open_namelist_file, open_file, &
- close_file, error_mesg, FATAL, NOTE, &
- file_exist, mpp_pe, mpp_root_pe, &
+use fms_mod, only: error_mesg, FATAL, NOTE, &
+ mpp_pe, mpp_root_pe, &
check_nml_error, write_version_number,&
stdlog
use time_manager_mod, only: set_date, time_type, operator (+), &
@@ -91,7 +91,6 @@ module cosp_diagnostics_mod
character(len=128) :: version = '$Id $'
character(len=128) :: tagname = '$Name $'
-! cosp_version = 1.4.1
!---------------------------------------------------------------------
!namelist variables
@@ -216,25 +215,10 @@ subroutine cosp_diagnostics_init &
integer, intent (in) :: nlr_in, nchannels_in
integer, dimension(:), intent(in) :: channels_in
- integer :: io, unit, ierr, logunit
+ integer :: io, ierr, logunit
-#ifdef INTERNAL_FILE_NML
read (input_nml_file, nml=cosp_diagnostics_nml, iostat=io)
ierr = check_nml_error(io,"cosp_diagnostics_nml")
-#else
-!---------------------------------------------------------------------
-! read namelist.
-!---------------------------------------------------------------------
- if ( file_exist('input.nml')) then
- unit = open_namelist_file ()
- ierr=1; do while (ierr /= 0)
- read (unit, nml=cosp_diagnostics_nml, iostat=io, end=10)
- ierr = check_nml_error(io,'cosp_diagnostics_nml')
- enddo
-10 call close_file (unit)
- endif
-#endif
-
!---------------------------------------------------------------------
! write namelist to logfile.
!---------------------------------------------------------------------
diff --git a/atmos_param/cosp/cosp_driver.F90 b/atmos_param/cosp/cosp_driver.F90
index 44cd6f8d..88dc7dc3 100644
--- a/atmos_param/cosp/cosp_driver.F90
+++ b/atmos_param/cosp/cosp_driver.F90
@@ -1,4 +1,5 @@
#include "cosp_defs.H"
+! version number = 1.4.3
module cosp_driver_mod
@@ -28,9 +29,8 @@ module cosp_driver_mod
use mpp_mod, only: input_nml_file
-use fms_mod, only: open_namelist_file, open_file, &
- close_file, error_mesg, FATAL, NOTE, &
- file_exist, mpp_pe, mpp_root_pe, &
+use fms_mod, only: error_mesg, FATAL, NOTE, &
+ mpp_pe, mpp_root_pe, &
check_nml_error, write_version_number,&
mpp_clock_id, CLOCK_MODULE, &
mpp_clock_begin, mpp_clock_end, &
@@ -105,7 +105,6 @@ module cosp_driver_mod
!---------------------------------------------------------------------
!----------- version number for this module --------------------------
-! cosp_version = 1.4.1
character(len=128) :: version = '$Id$'
character(len=128) :: tagname = '$Name$'
@@ -260,27 +259,12 @@ subroutine cosp_driver_init (lonb, latb, Time_diag, axes, kd_in, Exch_ctrl)
type(exchange_control_type), intent(inout) :: Exch_ctrl
!-----------------------------------------------------------------------
- integer :: io, unit, ierr, logunit
+ integer :: io, ierr, logunit
integer :: imax, jmax
!-----------------------------------------------------------------------
-#ifdef INTERNAL_FILE_NML
read (input_nml_file, nml=cosp_input, iostat=io)
ierr = check_nml_error(io,"cosp_input")
-#else
-!---------------------------------------------------------------------
-! read namelist.
-!---------------------------------------------------------------------
- if ( file_exist('input.nml')) then
- unit = open_namelist_file ()
- ierr=1; do while (ierr /= 0)
- read (unit, nml=cosp_input, iostat=io, end=10)
- ierr = check_nml_error(io,'cosp_input')
- enddo
-10 call close_file (unit)
- endif
-#endif
-
!---------------------------------------------------------------------
! write namelist to logfile.
!---------------------------------------------------------------------
diff --git a/atmos_param/cosp/cosp_io.F90 b/atmos_param/cosp/cosp_io.F90
index 314ed62f..7739573e 100644
--- a/atmos_param/cosp/cosp_io.F90
+++ b/atmos_param/cosp/cosp_io.F90
@@ -1,8 +1,9 @@
#include "cosp_defs.H"
+! version number = 1.4.3
! (c) British Crown Copyright 2008, the Met Office.
! All rights reserved.
! $Revision: 88 $, $Date: 2013-11-13 09:08:38 -0500 (Wed, 13 Nov 2013) $
-! $URL: http://cfmip-obs-sim.googlecode.com/svn/stable/v1.4.1/cosp_io.F90 $
+! $URL: http://cfmip-obs-sim.googlecode.com/svn/stable/v1.4.0/cosp_io.F90 $
!
! Redistribution and use in source and binary forms, with or without modification, are permitted
! provided that the following conditions are met:
@@ -49,8 +50,7 @@ MODULE MOD_COSP_IO
use MOD_COSP_Modis_Simulator
#ifdef COSP_GFDL
use mpp_mod, only: input_nml_file
- use fms_mod, only: open_namelist_file, open_file, close_file, &
- file_exist, mpp_pe, mpp_root_pe, &
+ use fms_mod, only: mpp_pe, mpp_root_pe, &
error_mesg, FATAL, &
check_nml_error, write_version_number, stdlog
#endif
@@ -1777,7 +1777,7 @@ SUBROUTINE READ_COSP_OUTPUT_NL(cosp_nl,cfg)
Ltauwlogmodis,Ltauilogmodis,Lreffclwmodis,Lreffclimodis,Lpctmodis,Llwpmodis, &
Liwpmodis,Lclmodis
#ifdef COSP_GFDL
- integer :: unit, io, ierr, logunit
+ integer :: io, ierr, logunit
#endif
do i=1,N_OUT_LIST
@@ -1786,20 +1786,8 @@ SUBROUTINE READ_COSP_OUTPUT_NL(cosp_nl,cfg)
#ifdef COSP_GFDL
!---------------------------------------------------------------------
! read namelist.
-#ifdef INTERNAL_FILE_NML
read (input_nml_file, nml=cosp_output, iostat=io)
ierr = check_nml_error(io,"cosp_output")
-#else
-!---------------------------------------------------------------------
- if ( file_exist('input.nml')) then
- unit = open_namelist_file ()
- ierr=1; do while (ierr /= 0)
- read (unit, nml=cosp_output, iostat=io, end=10)
- ierr = check_nml_error(io,'cosp_output')
- enddo
-10 call close_file (unit)
- endif
-#endif
!---------------------------------------------------------------------
! write namelist to logfile.
!---------------------------------------------------------------------
diff --git a/atmos_param/cosp/cosp_isccp_simulator.F90 b/atmos_param/cosp/cosp_isccp_simulator.F90
index 33d200df..7bc6d264 100644
--- a/atmos_param/cosp/cosp_isccp_simulator.F90
+++ b/atmos_param/cosp/cosp_isccp_simulator.F90
@@ -1,8 +1,9 @@
#include "cosp_defs.H"
+! version number = 1.4.3
! (c) British Crown Copyright 2008, the Met Office.
! All rights reserved.
! $Revision: 23 $, $Date: 2011-03-31 09:41:37 -0400 (Thu, 31 Mar 2011) $
-! $URL: http://cfmip-obs-sim.googlecode.com/svn/stable/v1.4.1/cosp_isccp_simulator.F90 $
+! $URL: http://cfmip-obs-sim.googlecode.com/svn/stable/v1.4.0/cosp_isccp_simulator.F90 $
!
! Redistribution and use in source and binary forms, with or without modification, are permitted
! provided that the following conditions are met:
@@ -30,6 +31,249 @@ MODULE MOD_COSP_ISCCP_SIMULATOR
USE MOD_COSP_TYPES
IMPLICIT NONE
+INTERFACE
+#ifdef COSP_GFDL
+ SUBROUTINE ICARUS( &
+ & debug, &
+ & debugcol, &
+ & npoints, &
+ & sunlit, &
+ & nlev, &
+ & ncol, &
+ & pfull, &
+ & phalf, &
+ & qv, &
+ & cc, &
+ & conv, &
+ & dtau_s, &
+ & dtau_c, &
+ & top_height, &
+ & top_height_direction, &
+ & overlap, &
+ & frac_out, &
+ & skt, &
+ & emsfc_lw, &
+ & at, &
+ & dem_s, &
+ & dem_c, &
+ & fq_isccp, &
+ & totalcldarea, &
+ & meanptop, &
+ & meantaucld, &
+ & meanalbedocld, &
+ & meantb, &
+ & meantbclr, &
+ & boxtau, &
+ & boxptop, &
+ & dtau_col, &
+ & dem_col &
+ &)
+#else
+ SUBROUTINE ICARUS(
+ & debug,
+ & debugcol,
+ & npoints,
+ & sunlit,
+ & nlev,
+ & ncol,
+ & pfull,
+ & phalf,
+ & qv,
+ & cc,
+ & conv,
+ & dtau_s,
+ & dtau_c,
+ & top_height,
+ & top_height_direction,
+ & overlap,
+ & frac_out,
+ & skt,
+ & emsfc_lw,
+ & at,
+ & dem_s,
+ & dem_c,
+ & fq_isccp,
+ & totalcldarea,
+ & meanptop,
+ & meantaucld,
+ & meanalbedocld,
+ & meantb,
+ & meantbclr,
+ & boxtau,
+ & boxptop
+ &)
+#endif
+
+
+#ifdef COSP_GFDL
+use mpp_mod,only: get_unit
+use fms_mod,only: stdlog, error_mesg, FATAL
+#endif
+ implicit none
+
+! NOTE: the maximum number of levels and columns is set by
+! the following parameter statement
+
+ INTEGER ncolprint
+
+! -----
+! Input
+! -----
+
+ integer debug ! set to non-zero value to print out inputs
+ ! with step debug
+ integer debugcol ! set to non-zero value to print out column
+ ! decomposition with step debugcol
+ INTEGER npoints ! number of model points in the horizontal
+ INTEGER nlev ! number of model levels in column
+ INTEGER ncol ! number of subcolumns
+
+ INTEGER sunlit(npoints) ! 1 for day points, 0 for night time
+
+ REAL pfull(npoints,nlev)
+ ! pressure of full model levels (Pascals)
+ ! pfull(npoints,1) is top level of model
+ ! pfull(npoints,nlev) is bot of model
+
+ REAL phalf(npoints,nlev+1)
+ ! pressure of half model levels (Pascals)
+ ! phalf(npoints,1) is top of model
+ ! phalf(npoints,nlev+1) is the surface pressure
+
+ REAL qv(npoints,nlev)
+ ! water vapor specific humidity (kg vapor/ kg air)
+ ! on full model levels
+
+ REAL cc(npoints,nlev)
+ ! input cloud cover in each model level (fraction)
+ ! NOTE: This is the HORIZONTAL area of each
+ ! grid box covered by clouds
+
+ REAL conv(npoints,nlev)
+ ! input convective cloud cover in each model
+ ! level (fraction)
+ ! NOTE: This is the HORIZONTAL area of each
+ ! grid box covered by convective clouds
+
+ REAL dtau_s(npoints,nlev)
+ ! mean 0.67 micron optical depth of stratiform
+ ! clouds in each model level
+ ! NOTE: this the cloud optical depth of only the
+ ! cloudy part of the grid box, it is not weighted
+ ! with the 0 cloud optical depth of the clear
+ ! part of the grid box
+
+ REAL dtau_c(npoints,nlev)
+ ! mean 0.67 micron optical depth of convective
+ ! clouds in each
+ ! model level. Same note applies as in dtau_s.
+
+ INTEGER overlap ! overlap type
+ ! 1=max
+ ! 2=rand
+ ! 3=max/rand
+
+ INTEGER top_height ! 1 = adjust top height using both a computed
+ ! infrared brightness temperature and the visible
+ ! optical depth to adjust cloud top pressure. Note
+ ! that this calculation is most appropriate to compare
+ ! to ISCCP data during sunlit hours.
+ ! 2 = do not adjust top height, that is cloud top
+ ! pressure is the actual cloud top pressure
+ ! in the model
+ ! 3 = adjust top height using only the computed
+ ! infrared brightness temperature. Note that this
+ ! calculation is most appropriate to compare to ISCCP
+ ! IR only algortihm (i.e. you can compare to nighttime
+ ! ISCCP data with this option)
+
+ INTEGER top_height_direction ! direction for finding atmosphere pressure level
+ ! with interpolated temperature equal to the radiance
+ ! determined cloud-top temperature
+ !
+ ! 1 = find the *lowest* altitude (highest pressure) level
+ ! with interpolated temperature equal to the radiance
+ ! determined cloud-top temperature
+ !
+ ! 2 = find the *highest* altitude (lowest pressure) level
+ ! with interpolated temperature equal to the radiance
+ ! determined cloud-top temperature
+ !
+ ! ONLY APPLICABLE IF top_height EQUALS 1 or 3
+ ! !
+ ! 1 = old setting: matches all versions of
+ ! ISCCP simulator with versions numbers 3.5.1 and lower
+ !
+ ! 2 = default setting: for version numbers 4.0 and higher
+!
+! The following input variables are used only if top_height = 1 or top_height = 3
+!
+ REAL skt(npoints) ! skin Temperature (K)
+ REAL emsfc_lw ! 10.5 micron emissivity of surface (fraction)
+ REAL at(npoints,nlev) ! temperature in each model level (K)
+ REAL dem_s(npoints,nlev) ! 10.5 micron longwave emissivity of stratiform
+ ! clouds in each
+ ! model level. Same note applies as in dtau_s.
+ REAL dem_c(npoints,nlev) ! 10.5 micron longwave emissivity of convective
+ ! clouds in each
+ ! model level. Same note applies as in dtau_s.
+
+ REAL frac_out(npoints,ncol,nlev) ! boxes gridbox divided up into
+ ! Equivalent of BOX in original version, but
+ ! indexed by column then row, rather than
+ ! by row then column
+
+#ifdef COSP_GFDL
+ REAL, optional :: dtau_col(npoints,ncol,nlev)
+ ! tau values obtained from model
+ ! stochastic columns
+
+ REAL, optional :: dem_col(npoints,ncol,nlev)
+ ! lw emissivity values obtained
+ ! from model stochastic columns
+
+
+#endif
+
+
+! ------
+! Output
+! ------
+
+ REAL fq_isccp(npoints,7,7) ! the fraction of the model grid box covered by
+ ! each of the 49 ISCCP D level cloud types
+
+ REAL totalcldarea(npoints) ! the fraction of model grid box columns
+ ! with cloud somewhere in them. NOTE: This diagnostic
+ ! does not count model clouds with tau < isccp_taumin
+ ! Thus this diagnostic does not equal the sum over all entries of fq_isccp.
+ ! However, this diagnostic does equal the sum over entries of fq_isccp with
+ ! itau = 2:7 (omitting itau = 1)
+
+
+ ! The following three means are averages only over the cloudy areas with tau > isccp_taumin.
+ ! If no clouds with tau > isccp_taumin are in grid box all three quantities should equal zero.
+
+ REAL meanptop(npoints) ! mean cloud top pressure (mb) - linear averaging
+ ! in cloud top pressure.
+
+ REAL meantaucld(npoints) ! mean optical thickness
+ ! linear averaging in albedo performed.
+
+ real meanalbedocld(npoints) ! mean cloud albedo
+ ! linear averaging in albedo performed
+
+ real meantb(npoints) ! mean all-sky 10.5 micron brightness temperature
+
+ real meantbclr(npoints) ! mean clear-sky 10.5 micron brightness temperature
+
+ REAL boxtau(npoints,ncol) ! optical thickness in each column
+
+ REAL boxptop(npoints,ncol) ! cloud top pressure (mb) in each column
+
+ end subroutine icarus
+
+END INTERFACE
CONTAINS
diff --git a/atmos_param/cosp/cosp_lidar.F90 b/atmos_param/cosp/cosp_lidar.F90
index 7cf91d53..6479602c 100644
--- a/atmos_param/cosp/cosp_lidar.F90
+++ b/atmos_param/cosp/cosp_lidar.F90
@@ -1,8 +1,9 @@
#include "cosp_defs.H"
+! veersion number = 1.4.3
! (c) British Crown Copyright 2008, the Met Office.
! All rights reserved.
! $Revision: 88 $, $Date: 2013-11-13 09:08:38 -0500 (Wed, 13 Nov 2013) $
-! $URL: http://cfmip-obs-sim.googlecode.com/svn/stable/v1.4.1/cosp_lidar.F90 $
+! $URL: http://cfmip-obs-sim.googlecode.com/svn/stable/v1.4.0/cosp_lidar.F90 $
!
! Redistribution and use in source and binary forms, with or without modification, are permitted
! provided that the following conditions are met:
diff --git a/atmos_param/cosp/cosp_misr_simulator.F90 b/atmos_param/cosp/cosp_misr_simulator.F90
index 73d3d3fc..22da35a6 100644
--- a/atmos_param/cosp/cosp_misr_simulator.F90
+++ b/atmos_param/cosp/cosp_misr_simulator.F90
@@ -1,8 +1,9 @@
#include "cosp_defs.H"
+! version number = 1.4.3
! (c) British Crown Copyright 2008, the Met Office.
! All rights reserved.
! $Revision: 23 $, $Date: 2011-03-31 09:41:37 -0400 (Thu, 31 Mar 2011) $
-! $URL: http://cfmip-obs-sim.googlecode.com/svn/stable/v1.4.1/cosp_misr_simulator.F90 $
+! $URL: http://cfmip-obs-sim.googlecode.com/svn/stable/v1.4.0/cosp_misr_simulator.F90 $
!
! Redistribution and use in source and binary forms, with or without modification, are permitted
! provided that the following conditions are met:
@@ -36,6 +37,105 @@ MODULE MOD_COSP_MISR_SIMULATOR
USE MOD_COSP_TYPES
IMPLICIT NONE
+INTERFACE
+
+#ifdef COSP_GFDL
+ SUBROUTINE MISR_simulator( &
+ & npoints, &
+ & nlev, &
+ & ncol, &
+ & sunlit, &
+ & zfull, &
+ & at, &
+ & dtau_s, &
+ & dtau_c, &
+ & frac_out, &
+ & missing_value, &
+ & fq_MISR_TAU_v_CTH, &
+ & dist_model_layertops, &
+ & MISR_mean_ztop, &
+ & MISR_cldarea, &
+ & dtau_col &
+ & )
+#else
+ SUBROUTINE MISR_simulator( &
+ & npoints, &
+ & nlev, &
+ & ncol, &
+ & sunlit, &
+ & zfull, &
+ & at, &
+ & dtau_s, &
+ & dtau_c, &
+ & frac_out, &
+ & missing_value, & *
+ & fq_MISR_TAU_v_CTH, &
+ & dist_model_layertops, &
+ & MISR_mean_ztop, &
+ & MISR_cldarea &
+ & )
+#endif
+
+
+ implicit none
+ integer n_MISR_CTH
+ parameter(n_MISR_CTH=16)
+
+! -----
+! Input
+! -----
+
+ INTEGER npoints ! if ncol ==1, the number of model points in the horizontal grid
+ ! else the number of GCM grid points
+
+ INTEGER nlev ! number of model vertical levels
+
+ INTEGER ncol ! number of model sub columns
+ ! (must already be generated in via scops and passed to this
+ ! routine via the variable frac_out )
+
+ INTEGER sunlit(npoints) ! 1 for day points, 0 for night time
+
+ REAL zfull(npoints,nlev) ! height (in meters) of full model levels (i.e. midpoints)
+ ! zfull(npoints,1) is top level of model
+ ! zfull(npoints,nlev) is bottom level of model (closest point to surface)
+
+ REAL at(npoints,nlev) ! temperature in each model level (K)
+
+ REAL dtau_s(npoints,nlev) ! visible wavelength cloud optical depth ... for "stratiform" condensate
+ ! NOTE: this the cloud optical depth of only the
+ ! the model cell (i,j)
+
+ REAL dtau_c(npoints,nlev) ! visible wavelength cloud optical depth ... for "convective" condensate
+ ! NOTE: this the cloud optical depth of only the
+ ! the model cell (i,j)
+
+ REAL frac_out(npoints,ncol,nlev) ! NOTE: only need if columns>1 ... subgrid scheme in use.
+
+ REAL missing_value
+#ifdef COSP_GFDL
+ REAL,optional :: dtau_col(npoints,ncol,nlev)
+ ! tau values obtained from model
+ ! stochastic columns
+
+
+#endif
+
+! ------
+! Outputs
+! ------
+
+ REAL fq_MISR_TAU_v_CTH(npoints,7,n_MISR_CTH)
+ REAL dist_model_layertops(npoints,n_MISR_CTH)
+ REAL MISR_cldarea(npoints) ! fractional area coverged by clouds
+ REAL MISR_mean_ztop(npoints) ! mean cloud top hieght(m) MISR would observe
+ ! NOTE: == 0 if area ==0
+
+
+ END SUBROUTINE MISR_simulator
+
+END INTERFACE
+
CONTAINS
diff --git a/atmos_param/cosp/cosp_modis_simulator.F90 b/atmos_param/cosp/cosp_modis_simulator.F90
index c732be36..584661b3 100644
--- a/atmos_param/cosp/cosp_modis_simulator.F90
+++ b/atmos_param/cosp/cosp_modis_simulator.F90
@@ -1,9 +1,10 @@
#include "cosp_defs.H"
+! version number = 1.4.3
! (c) 2009, Regents of the Unversity of Colorado
! Author: Robert Pincus, Cooperative Institute for Research in the Environmental Sciences
! All rights reserved.
! $Revision: 88 $, $Date: 2013-11-13 09:08:38 -0500 (Wed, 13 Nov 2013) $
-! $URL: http://cfmip-obs-sim.googlecode.com/svn/stable/v1.4.1/cosp_modis_simulator.F90 $
+! $URL: http://cfmip-obs-sim.googlecode.com/svn/stable/v1.4.0/cosp_modis_simulator.F90 $
!
! Redistribution and use in source and binary forms, with or without modification, are permitted
! provided that the following conditions are met:
diff --git a/atmos_param/cosp/cosp_rttov_simulator.F90 b/atmos_param/cosp/cosp_rttov_simulator.F90
index 899b4798..30f87a40 100644
--- a/atmos_param/cosp/cosp_rttov_simulator.F90
+++ b/atmos_param/cosp/cosp_rttov_simulator.F90
@@ -1,8 +1,9 @@
#include "cosp_defs.H"
+! version number = 1.4.3
! (c) British Crown Copyright 2008, the Met Office.
! All rights reserved.
! $Revision: 88 $, $Date: 2013-11-13 09:08:38 -0500 (Wed, 13 Nov 2013) $
-! $URL: http://cfmip-obs-sim.googlecode.com/svn/stable/v1.4.1/cosp_rttov_simulator.F90 $
+! $URL: http://cfmip-obs-sim.googlecode.com/svn/stable/v1.4.0/cosp_rttov_simulator.F90 $
!
! Redistribution and use in source and binary forms, with or without modification, are permitted
! provided that the following conditions are met:
diff --git a/atmos_param/cosp/cosp_simulator.F90 b/atmos_param/cosp/cosp_simulator.F90
index 5575aa51..8395fb5f 100644
--- a/atmos_param/cosp/cosp_simulator.F90
+++ b/atmos_param/cosp/cosp_simulator.F90
@@ -1,8 +1,9 @@
#include "cosp_defs.H"
+! version number = 1.4.3
! (c) British Crown Copyright 2008, the Met Office.
! All rights reserved.
! $Revision: 88 $, $Date: 2013-11-13 09:08:38 -0500 (Wed, 13 Nov 2013) $
-! $URL: http://cfmip-obs-sim.googlecode.com/svn/stable/v1.4.1/cosp_simulator.F90 $
+! $URL: http://cfmip-obs-sim.googlecode.com/svn/stable/v1.4.0/cosp_simulator.F90 $
!
! Redistribution and use in source and binary forms, with or without modification, are permitted
! provided that the following conditions are met:
diff --git a/atmos_param/cosp/cosp_stats.F90 b/atmos_param/cosp/cosp_stats.F90
index 2450f40b..8ad238c6 100644
--- a/atmos_param/cosp/cosp_stats.F90
+++ b/atmos_param/cosp/cosp_stats.F90
@@ -1,8 +1,10 @@
#include "cosp_defs.H"
+!version number = 1.4.3
+
! (c) British Crown Copyright 2008, the Met Office.
! All rights reserved.
! $Revision: 88 $, $Date: 2013-11-13 09:08:38 -0500 (Wed, 13 Nov 2013) $
-! $URL: http://cfmip-obs-sim.googlecode.com/svn/stable/v1.4.1/cosp_stats.F90 $
+! $URL: http://cfmip-obs-sim.googlecode.com/svn/stable/v1.4.0/cosp_stats.F90 $
!
! Redistribution and use in source and binary forms, with or without modification, are permitted
! provided that the following conditions are met:
diff --git a/atmos_param/cosp/cosp_types.F90 b/atmos_param/cosp/cosp_types.F90
index b803b01e..6d82a87d 100644
--- a/atmos_param/cosp/cosp_types.F90
+++ b/atmos_param/cosp/cosp_types.F90
@@ -1,4 +1,5 @@
#include "cosp_defs.H"
+! version number = 1.4.3
#ifdef COSP_GFDL
!---------------------------------------------------------------------
@@ -6,7 +7,6 @@
! $Id$
! $Name$
-! cosp_version = 1.4.1
#endif
diff --git a/atmos_param/cosp/cosp_utils.F90 b/atmos_param/cosp/cosp_utils.F90
index 280568e6..0189694e 100644
--- a/atmos_param/cosp/cosp_utils.F90
+++ b/atmos_param/cosp/cosp_utils.F90
@@ -1,8 +1,9 @@
#include "cosp_defs.H"
+! version number = 1.4.3
! (c) British Crown Copyright 2008, the Met Office.
! All rights reserved.
! $Revision: 23 $, $Date: 2011-03-31 09:41:37 -0400 (Thu, 31 Mar 2011) $
-! $URL: http://cfmip-obs-sim.googlecode.com/svn/stable/v1.4.1/cosp_utils.F90 $
+! $URL: http://cfmip-obs-sim.googlecode.com/svn/stable/v1.4.0/cosp_utils.F90 $
!
! Redistribution and use in source and binary forms, with or without modification, are permitted
! provided that the following conditions are met:
diff --git a/atmos_param/cosp/icarus-scops-3.7/congvec.H b/atmos_param/cosp/icarus-scops-3.7/congvec.H
index 572fb1dd..11388cfc 100644
--- a/atmos_param/cosp/icarus-scops-3.7/congvec.H
+++ b/atmos_param/cosp/icarus-scops-3.7/congvec.H
@@ -1,10 +1,11 @@
#include "cosp_defs.H"
+! version number = 1.4.3
! *****************************COPYRIGHT****************************
! (c) British Crown Copyright 2009, the Met Office.
! All rights reserved.
! $Revision: 23 $, $Date: 2011-03-31 09:41:37 -0400 (Thu, 31 Mar 2011) $
-! $URL: http://cfmip-obs-sim.googlecode.com/svn/stable/v1.4.1/icarus-scops-4.1-bsd/congvec.f $
+! $URL: http://cfmip-obs-sim.googlecode.com/svn/stable/v1.4.0/icarus-scops-4.1-bsd/congvec.f $
!
! Redistribution and use in source and binary forms, with or without
! modification, are permitted provided that the
diff --git a/atmos_param/cosp/icarus-scops-3.7/icarus.F90 b/atmos_param/cosp/icarus-scops-3.7/icarus.F90
index 58830868..1850cdc5 100644
--- a/atmos_param/cosp/icarus-scops-3.7/icarus.F90
+++ b/atmos_param/cosp/icarus-scops-3.7/icarus.F90
@@ -1,6 +1,7 @@
#include "cosp_defs.H"
+! version number = 1.4.3
! $Revision: 88 $, $Date: 2013-11-13 09:08:38 -0500 (Wed, 13 Nov 2013) $
-! $URL: http://cfmip-obs-sim.googlecode.com/svn/stable/v1.4.1/icarus-scops- 4.1-bsd/icarus.f $
+! $URL: http://cfmip-obs-sim.googlecode.com/svn/stable/v1.4.0/icarus-scops- 4.1-bsd/icarus.f $
#ifdef COSP_GFDL
SUBROUTINE ICARUS( &
diff --git a/atmos_param/cosp/icarus-scops-3.7/isccp_cloud_types.F b/atmos_param/cosp/icarus-scops-3.7/isccp_cloud_types.F
index d0cf0e6b..7c633d2c 100644
--- a/atmos_param/cosp/icarus-scops-3.7/isccp_cloud_types.F
+++ b/atmos_param/cosp/icarus-scops-3.7/isccp_cloud_types.F
@@ -1,6 +1,7 @@
#include "cosp_defs.H"
+! version number = 1.4.3
! $Revision: 23 $, $Date: 2011-03-31 09:41:37 -0400 (Thu, 31 Mar 2011) $
-! $URL: http://cfmip-obs-sim.googlecode.com/svn/stable/v1.4.1/icarus-scops-4 .1-bsd/isccp_cloud_types.f $
+! $URL: http://cfmip-obs-sim.googlecode.com/svn/stable/v1.4.0/icarus-scops-4 .1-bsd/isccp_cloud_types.f $
#ifdef COSP_GFDL
SUBROUTINE ISCCP_CLOUD_TYPES(
diff --git a/atmos_param/cosp/icarus-scops-3.7/scops.F b/atmos_param/cosp/icarus-scops-3.7/scops.F
index fc00614d..5b313b70 100644
--- a/atmos_param/cosp/icarus-scops-3.7/scops.F
+++ b/atmos_param/cosp/icarus-scops-3.7/scops.F
@@ -1,6 +1,7 @@
#include "cosp_defs.H"
+! version number = 1.4.3
! $Revision: 23 $, $Date: 2011-03-31 09:41:37 -0400 (Thu, 31 Mar 2011) $
-! $URL: http://cfmip-obs-sim.googlecode.com/svn/stable/v1.4.1/icarus-scops-4 .1-bsd/scops.f $
+! $URL: http://cfmip-obs-sim.googlecode.com/svn/stable/v1.4.0/icarus-scops-4 .1-bsd/scops.f $
subroutine scops(npoints,nlev,ncol,seed,cc,conv,
& overlap,frac_out,ncolprint)
diff --git a/atmos_param/cosp/llnl/cosp_radar.F90 b/atmos_param/cosp/llnl/cosp_radar.F90
index e6740646..d7eedb17 100644
--- a/atmos_param/cosp/llnl/cosp_radar.F90
+++ b/atmos_param/cosp/llnl/cosp_radar.F90
@@ -1,4 +1,5 @@
#include "cosp_defs.H"
+! version number = 1.4.3
#ifdef COSP_GFDL
!---------------------------------------------------------------------
@@ -6,7 +7,6 @@
! $Id$
! $Name$
-! cosp_version = 1.4.1
#endif
@@ -68,7 +68,7 @@ subroutine radar_simulator(hp,nprof,ngate,undef, &
t_matrix,rh_matrix
real*8, dimension(hp%nhclass,nprof,ngate), intent(in) :: hm_matrix
real*8, dimension(hp%nhclass,nprof,ngate), intent(inout) :: re_matrix
- real*8, dimension(hp%nhclass,nprof,ngate), intent(inout) :: Np_matrix
+ real*8, dimension(hp%nhclass,nprof,ngate), intent(in) :: Np_matrix
! ----- OUTPUTS -----
real*8, dimension(nprof,ngate), intent(out) :: Ze_non,Ze_ray, &
diff --git a/atmos_param/cosp/llnl/llnl_stats.F90 b/atmos_param/cosp/llnl/llnl_stats.F90
index 6f10de0c..ed18f349 100644
--- a/atmos_param/cosp/llnl/llnl_stats.F90
+++ b/atmos_param/cosp/llnl/llnl_stats.F90
@@ -1,8 +1,9 @@
#include "cosp_defs.H"
+! version number = 1.4.3
! (c) 2008, Lawrence Livermore National Security Limited Liability Corporation.
! All rights reserved.
! $Revision: 88 $, $Date: 2013-11-13 09:08:38 -0500 (Wed, 13 Nov 2013) $
-! $URL: http://cfmip-obs-sim.googlecode.com/svn/stable/v1.4.1/llnl/llnl_stats.F90 $
+! $URL: http://cfmip-obs-sim.googlecode.com/svn/stable/v1.4.0/llnl/llnl_stats.F90 $
!
! Redistribution and use in source and binary forms, with or without modification, are permitted
! provided that the following conditions are met:
diff --git a/atmos_param/cosp/llnl/pf_to_mr.F b/atmos_param/cosp/llnl/pf_to_mr.F
index 9f10f2ac..6df0daf8 100644
--- a/atmos_param/cosp/llnl/pf_to_mr.F
+++ b/atmos_param/cosp/llnl/pf_to_mr.F
@@ -1,8 +1,9 @@
#include "cosp_defs.H"
+! version number = 1.4.3
! (c) 2008, Lawrence Livermore National Security Limited Liability Corporation.
! All rights reserved.
! $Revision: 23 $, $Date: 2011-03-31 09:41:37 -0400 (Thu, 31 Mar 2011) $
-! $URL: http://cfmip-obs-sim.googlecode.com/svn/stable/v1.4.1/llnl/pf_to_mr.f $
+! $URL: http://cfmip-obs-sim.googlecode.com/svn/stable/v1.4.0/llnl/pf_to_mr.f $
!
! Redistribution and use in source and binary forms, with or without modification, are permitted
! provided that the following conditions are met:
diff --git a/atmos_param/cosp/llnl/prec_scops.F b/atmos_param/cosp/llnl/prec_scops.F
index 38935208..9b64f8a5 100644
--- a/atmos_param/cosp/llnl/prec_scops.F
+++ b/atmos_param/cosp/llnl/prec_scops.F
@@ -1,8 +1,9 @@
#include "cosp_defs.H"
+! version number = 1.4.3
! (c) 2008, Lawrence Livermore National Security Limited Liability Corporation.
! All rights reserved.
! $Revision: 23 $, $Date: 2011-03-31 09:41:37 -0400 (Thu, 31 Mar 2011) $
-! $URL: http://cfmip-obs-sim.googlecode.com/svn/stable/v1.4.1/llnl/prec_scops.f $
+! $URL: http://cfmip-obs-sim.googlecode.com/svn/stable/v1.4.0/llnl/prec_scops.f $
!
! Redistribution and use in source and binary forms, with or without modification, are permitted
! provided that the following conditions are met:
diff --git a/atmos_param/cosp/quickbeam/array_lib.F90 b/atmos_param/cosp/quickbeam/array_lib.F90
index 2626e476..c57b0e51 100644
--- a/atmos_param/cosp/quickbeam/array_lib.F90
+++ b/atmos_param/cosp/quickbeam/array_lib.F90
@@ -1,6 +1,7 @@
#include "cosp_defs.H"
+! version number = 1.4.3
! $Revision: 23 $, $Date: 2011-03-31 09:41:37 -0400 (Thu, 31 Mar 2011) $
-! $URL: http://cfmip-obs-sim.googlecode.com/svn/stable/v1.4.1/quickbeam/array_lib.f90 $
+! $URL: http://cfmip-obs-sim.googlecode.com/svn/stable/v1.4.0/quickbeam/array_lib.f90 $
! ARRAY_LIB: Array procedures for F90
! Compiled/Modified:
! 07/01/06 John Haynes (haynes@atmos.colostate.edu)
diff --git a/atmos_param/cosp/quickbeam/atmos_lib.F90 b/atmos_param/cosp/quickbeam/atmos_lib.F90
index 2c07e8be..b4979945 100644
--- a/atmos_param/cosp/quickbeam/atmos_lib.F90
+++ b/atmos_param/cosp/quickbeam/atmos_lib.F90
@@ -1,6 +1,7 @@
#include "cosp_defs.H"
+! version number = 1.4.3
! $Revision: 23 $, $Date: 2011-03-31 09:41:37 -0400 (Thu, 31 Mar 2011) $
-! $URL: http://cfmip-obs-sim.googlecode.com/svn/stable/v1.4.1/quickbeam/atmos_lib.f90 $
+! $URL: http://cfmip-obs-sim.googlecode.com/svn/stable/v1.4.0/quickbeam/atmos_lib.f90 $
! ATMOS_LIB: Atmospheric science procedures for F90
! Compiled/Modified:
! 07/01/06 John Haynes (haynes@atmos.colostate.edu)
diff --git a/atmos_param/cosp/quickbeam/calc_Re.F90 b/atmos_param/cosp/quickbeam/calc_Re.F90
index 33fb260a..213298e1 100644
--- a/atmos_param/cosp/quickbeam/calc_Re.F90
+++ b/atmos_param/cosp/quickbeam/calc_Re.F90
@@ -1,10 +1,10 @@
#include "cosp_defs.H"
+! version number = 1.4.3
#ifdef COSP_GFDL
!---------------------------------------------------------------------
!------------ FMS version number and tagname for this file -----------
-! cosp_version = 1.4.1
#endif
diff --git a/atmos_param/cosp/quickbeam/dsd.F90 b/atmos_param/cosp/quickbeam/dsd.F90
index 7c968143..999f7738 100644
--- a/atmos_param/cosp/quickbeam/dsd.F90
+++ b/atmos_param/cosp/quickbeam/dsd.F90
@@ -1,10 +1,10 @@
#include "cosp_defs.H"
+! version number = 1.4.3
#ifdef COSP_GFDL
!---------------------------------------------------------------------
!------------ FMS version number and tagname for this file -----------
-! cosp_version = 1.4.1
#endif
subroutine dsd(Q,Re,Np,D,N,nsizes,dtype,rho_a,tk, &
@@ -68,7 +68,8 @@ subroutine dsd(Q,Re,Np,D,N,nsizes,dtype,rho_a,tk, &
integer, intent(in) :: nsizes
integer, intent(in) :: dtype
- real*8, intent(in) :: Q,Re,Np,D(nsizes)
+ real*8, intent(in) :: Q,Np,D(nsizes)
+ real*8, intent(inout) :: Re
real*8, intent(in) :: rho_a,tk,dmin,dmax,rho_c,p1,p2,p3
real*8, intent(inout) :: apm,bpm
diff --git a/atmos_param/cosp/quickbeam/format_input.F90 b/atmos_param/cosp/quickbeam/format_input.F90
index 6dd33abb..c05836c2 100644
--- a/atmos_param/cosp/quickbeam/format_input.F90
+++ b/atmos_param/cosp/quickbeam/format_input.F90
@@ -1,6 +1,7 @@
#include "cosp_defs.H"
+! version number = 1.4.3
! $Revision: 23 $, $Date: 2011-03-31 09:41:37 -0400 (Thu, 31 Mar 2011) $
-! $URL: http://cfmip-obs-sim.googlecode.com/svn/stable/v1.4.1/quickbeam/format_input.f90 $
+! $URL: http://cfmip-obs-sim.googlecode.com/svn/stable/v1.4.0/quickbeam/format_input.f90 $
! FORMAT_INPUT: Procedures to prepare data for input to the simulator
! Compiled/Modified:
! 08/28/2006 John Haynes (haynes@atmos.colostate.edu)
diff --git a/atmos_param/cosp/quickbeam/gases.F90 b/atmos_param/cosp/quickbeam/gases.F90
index 6e594d8a..1d40fc0b 100644
--- a/atmos_param/cosp/quickbeam/gases.F90
+++ b/atmos_param/cosp/quickbeam/gases.F90
@@ -1,6 +1,7 @@
#include "cosp_defs.H"
+! version number = 1.4.3
! $Revision: 88 $, $Date: 2013-11-13 09:08:38 -0500 (Wed, 13 Nov 2013) $
-! $URL: http://cfmip-obs-sim.googlecode.com/svn/stable/v1.4.1/quickbeam/gases.f90 $
+! $URL: http://cfmip-obs-sim.googlecode.com/svn/stable/v1.4.0/quickbeam/gases.f90 $
function gases(PRES_mb,T,RH,f)
implicit none
diff --git a/atmos_param/cosp/quickbeam/math_lib.F90 b/atmos_param/cosp/quickbeam/math_lib.F90
index 6b512261..619219d5 100644
--- a/atmos_param/cosp/quickbeam/math_lib.F90
+++ b/atmos_param/cosp/quickbeam/math_lib.F90
@@ -1,6 +1,7 @@
#include "cosp_defs.H"
+! version number = 1.4.3
! $Revision: 23 $, $Date: 2011-03-31 09:41:37 -0400 (Thu, 31 Mar 2011) $
-! $URL: http://cfmip-obs-sim.googlecode.com/svn/stable/v1.4.1/quickbeam/math_lib.f90 $
+! $URL: http://cfmip-obs-sim.googlecode.com/svn/stable/v1.4.0/quickbeam/math_lib.f90 $
! MATH_LIB: Mathematics procedures for F90
! Compiled/Modified:
! 07/01/06 John Haynes (haynes@atmos.colostate.edu)
diff --git a/atmos_param/cosp/quickbeam/mrgrnk.F90 b/atmos_param/cosp/quickbeam/mrgrnk.F90
index 759791c9..8d317ef9 100644
--- a/atmos_param/cosp/quickbeam/mrgrnk.F90
+++ b/atmos_param/cosp/quickbeam/mrgrnk.F90
@@ -1,6 +1,7 @@
#include "cosp_defs.H"
+! version number = 1.4.3
! $Revision: 23 $, $Date: 2011-03-31 09:41:37 -0400 (Thu, 31 Mar 2011) $
-! $URL: http://cfmip-obs-sim.googlecode.com/svn/stable/v1.4.1/quickbeam/mrgrnk.f90 $
+! $URL: http://cfmip-obs-sim.googlecode.com/svn/stable/v1.4.0/quickbeam/mrgrnk.f90 $
Module m_mrgrnk
Integer, Parameter :: kdp = selected_real_kind(15)
public :: mrgrnk
diff --git a/atmos_param/cosp/quickbeam/optics_lib.F90 b/atmos_param/cosp/quickbeam/optics_lib.F90
index b2e52458..5d1bab13 100644
--- a/atmos_param/cosp/quickbeam/optics_lib.F90
+++ b/atmos_param/cosp/quickbeam/optics_lib.F90
@@ -1,6 +1,7 @@
#include "cosp_defs.H"
+! version number = 1.4.3
! $Revision: 88 $, $Date: 2013-11-13 09:08:38 -0500 (Wed, 13 Nov 2013) $
-! $URL: http://cfmip-obs-sim.googlecode.com/svn/stable/v1.4.1/quickbeam/optics_lib.f90 $
+! $URL: http://cfmip-obs-sim.googlecode.com/svn/stable/v1.4.0/quickbeam/optics_lib.f90 $
! OPTICS_LIB: Optical proecures for for F90
! Compiled/Modified:
! 07/01/06 John Haynes (haynes@atmos.colostate.edu)
diff --git a/atmos_param/cosp/quickbeam/radar_simulator.F90 b/atmos_param/cosp/quickbeam/radar_simulator.F90
index be520a4b..4893bc4b 100644
--- a/atmos_param/cosp/quickbeam/radar_simulator.F90
+++ b/atmos_param/cosp/quickbeam/radar_simulator.F90
@@ -1,10 +1,10 @@
#include "cosp_defs.H"
+! version number = 1.4.3
#ifdef COSP_GFDL
!---------------------------------------------------------------------
!------------ FMS version number and tagname for this file -----------
-! cosp_version = 1.4.1
#endif
diff --git a/atmos_param/cosp/quickbeam/radar_simulator_init.F90 b/atmos_param/cosp/quickbeam/radar_simulator_init.F90
index 21a33b88..6b2bde16 100644
--- a/atmos_param/cosp/quickbeam/radar_simulator_init.F90
+++ b/atmos_param/cosp/quickbeam/radar_simulator_init.F90
@@ -1,10 +1,10 @@
#include "cosp_defs.H"
+! version number = 1.4.3
#ifdef COSP_GFDL
!---------------------------------------------------------------------
!------------ FMS version number and tagname for this file -----------
-! cosp_version = 1.4.1
#endif
subroutine radar_simulator_init(freq,k2,use_gas_abs,do_ray,undef, &
diff --git a/atmos_param/cosp/quickbeam/radar_simulator_types.F90 b/atmos_param/cosp/quickbeam/radar_simulator_types.F90
index e2adfe2c..415b586a 100644
--- a/atmos_param/cosp/quickbeam/radar_simulator_types.F90
+++ b/atmos_param/cosp/quickbeam/radar_simulator_types.F90
@@ -1,10 +1,10 @@
#include "cosp_defs.H"
+! version number = 1.4.3
#ifdef COSP_GFDL
!---------------------------------------------------------------------
!------------ FMS version number and tagname for this file -----------
-! cosp_version = 1.4.1
#endif
diff --git a/atmos_param/cosp/quickbeam/scale_LUTs_io.F90 b/atmos_param/cosp/quickbeam/scale_LUTs_io.F90
index 9143f74e..b4863e96 100644
--- a/atmos_param/cosp/quickbeam/scale_LUTs_io.F90
+++ b/atmos_param/cosp/quickbeam/scale_LUTs_io.F90
@@ -1,10 +1,10 @@
#include "cosp_defs.H"
+! version number = 1.4.3
#ifdef COSP_GFDL
!---------------------------------------------------------------------
!------------ FMS version number and tagname for this file -----------
-! cosp_version = 1.4.1
#endif
diff --git a/atmos_param/cosp/quickbeam/zeff.F90 b/atmos_param/cosp/quickbeam/zeff.F90
index a0d8c797..ff6c233c 100644
--- a/atmos_param/cosp/quickbeam/zeff.F90
+++ b/atmos_param/cosp/quickbeam/zeff.F90
@@ -1,6 +1,7 @@
#include "cosp_defs.H"
+! version number = 1.4.3
! $Revision: 88 $, $Date: 2013-11-13 09:08:38 -0500 (Wed, 13 Nov 2013) $
-! $URL: http://cfmip-obs-sim.googlecode.com/svn/stable/v1.4.1/quickbeam/zeff.f90 $
+! $URL: http://cfmip-obs-sim.googlecode.com/svn/stable/v1.4.0/quickbeam/zeff.f90 $
subroutine zeff(freq,D,N,nsizes,k2,tt,ice,xr,z_eff,z_ray,kr,qe,qs,rho_e)
use math_lib
use optics_lib
diff --git a/atmos_param/cu_mo_trans/cu_mo_trans.F90 b/atmos_param/cu_mo_trans/cu_mo_trans.F90
index 1f707626..065b00e1 100644
--- a/atmos_param/cu_mo_trans/cu_mo_trans.F90
+++ b/atmos_param/cu_mo_trans/cu_mo_trans.F90
@@ -40,15 +40,16 @@ module cu_mo_trans_mod
use mpp_mod, only: input_nml_file
- use fms_mod, only: file_exist, check_nml_error, &
- open_namelist_file, close_file, &
+ use fms_mod, only: check_nml_error, &
write_version_number, &
mpp_pe, mpp_root_pe, stdlog, &
error_mesg, FATAL, NOTE
-
+ use fms2_io_mod, only: file_exists
use Diag_Manager_Mod, ONLY: register_diag_field, send_data
use Time_Manager_Mod, ONLY: time_type
+ use convection_utilities_mod, only : conv_results_type
+ use moist_proc_utils_mod, only: mp_input_type, mp_output_type, mp_nml_type
implicit none
private
@@ -70,8 +71,11 @@ module cu_mo_trans_mod
!---------------diagnostics fields-------------------------------------
-integer :: id_diff_cmt, id_utnd_cmt, id_vtnd_cmt, id_ttnd_cmt, &
- id_massflux_cmt, id_detmf_cmt
+integer :: id_ras_utnd_cmt, id_ras_vtnd_cmt, id_ras_ttnd_cmt, &
+ id_ras_massflux_cmt, id_ras_detmf_cmt
+integer :: id_diff_cmt, id_massflux_cmt
+integer :: id_donner_utnd_cmt, id_donner_vtnd_cmt, id_donner_ttnd_cmt, &
+ id_donner_massflux_cmt, id_donner_detmf_cmt
character(len=11) :: mod_name = 'cu_mo_trans'
@@ -104,6 +108,11 @@ module cu_mo_trans_mod
character(len=128) :: version = '$Id$'
character(len=128) :: tagname = '$Name$'
+logical :: cmt_uses_ras, cmt_uses_donner, cmt_uses_uw
+logical :: do_ras, do_donner_deep, do_uw_conv
+
+
+
contains
!#######################################################################
@@ -128,29 +137,26 @@ module cu_mo_trans_mod
!
!
!
-subroutine cu_mo_trans_init( axes, Time, doing_diffusive )
+subroutine cu_mo_trans_init( axes, Time, Nml_mp, cmt_mass_flux_source)
integer, intent(in) :: axes(4)
type(time_type), intent(in) :: Time
- logical, intent(out) :: doing_diffusive
+ type(mp_nml_type), intent(in) :: Nml_mp
+ character(len=64), intent(in) :: cmt_mass_flux_source
-integer :: unit, ierr, io, logunit
+integer :: ierr, io, logunit
integer, dimension(3) :: half = (/1,2,4/)
+ do_ras = Nml_mp%do_ras
+ do_donner_deep = Nml_mp%do_donner_deep
+ do_uw_conv = Nml_mp%do_uw_conv
+
+
!------ read namelist ------
- if ( file_exist('input.nml')) then
-#ifdef INTERNAL_FILE_NML
+ if ( file_exists('input.nml')) then
read (input_nml_file, nml=cu_mo_trans_nml, iostat=io)
ierr = check_nml_error(io,'cu_mo_trans_nml')
-#else
- unit = open_namelist_file ( )
- ierr=1; do while (ierr /= 0)
- read (unit, nml=cu_mo_trans_nml, iostat=io, end=10)
- ierr = check_nml_error(io,'cu_mo_trans_nml')
- enddo
- 10 call close_file (unit)
-#endif
endif
!--------- write version number and namelist ------------------
@@ -172,8 +178,6 @@ subroutine cu_mo_trans_init( axes, Time, doing_diffusive )
'invalid specification of transport_scheme', FATAL)
endif
- doing_diffusive = do_diffusive_transport
-
! --- initialize quantities for diagnostics output -------------
if (do_diffusive_transport) then
@@ -186,35 +190,303 @@ subroutine cu_mo_trans_init( axes, Time, doing_diffusive )
'cu_mo_trans mass flux', 'kg/(m2 s)', &
missing_value=missing_value )
else if (do_nonlocal_transport) then
- id_utnd_cmt = &
- register_diag_field ( mod_name, 'utnd_cmt', axes(1:3), Time, &
- 'cu_mo_trans u tendency', 'm/s2', &
+ id_ras_utnd_cmt = &
+ register_diag_field ( mod_name, 'ras_utnd_cmt', axes(1:3), Time, &
+ 'cu_mo_trans u tendency from ras', 'm/s2', &
missing_value=missing_value )
- id_vtnd_cmt = &
- register_diag_field ( mod_name, 'vtnd_cmt', axes(1:3), Time, &
- 'cu_mo_trans v tendency', 'm/s2', &
+ id_ras_vtnd_cmt = &
+ register_diag_field ( mod_name, 'ras_vtnd_cmt', axes(1:3), Time, &
+ 'cu_mo_trans v tendency from ras', 'm/s2', &
missing_value=missing_value )
- id_ttnd_cmt = &
- register_diag_field ( mod_name, 'ttnd_cmt', axes(1:3), Time, &
- 'cu_mo_trans temp tendency', 'deg K/s', &
+ id_ras_ttnd_cmt = &
+ register_diag_field ( mod_name, 'ras_ttnd_cmt', axes(1:3), Time, &
+ 'cu_mo_trans temp tendency from ras', 'deg K/s', &
missing_value=missing_value )
- id_massflux_cmt = &
- register_diag_field ( mod_name, 'massflux_cmt', axes(half), Time, &
- 'cu_mo_trans mass flux', 'kg/(m2 s)', &
+ id_ras_massflux_cmt = &
+ register_diag_field ( mod_name, 'ras_massflux_cmt', axes(half), Time,&
+ 'cu_mo_trans mass flux from ras', 'kg/(m2 s)', &
+ missing_value=missing_value )
+ id_ras_detmf_cmt = &
+ register_diag_field ( mod_name, 'ras_detmf_cmt', axes(1:3), Time, &
+ 'cu_mo_trans detrainment mass flux from ras', 'kg/(m2 s)',&
+ missing_value=missing_value )
+ id_donner_utnd_cmt = &
+ register_diag_field ( mod_name, 'donner_utnd_cmt', axes(1:3), Time, &
+ 'cu_mo_trans u tendency from donner', 'm/s2', &
+ missing_value=missing_value )
+ id_donner_vtnd_cmt = &
+ register_diag_field ( mod_name, 'donner_vtnd_cmt', axes(1:3), Time, &
+ 'cu_mo_trans v tendency from donner', 'm/s2', &
+ missing_value=missing_value )
+ id_donner_ttnd_cmt = &
+ register_diag_field ( mod_name, 'donner_ttnd_cmt', axes(1:3), Time, &
+ 'cu_mo_trans temp tendency from donner', 'deg K/s', &
+ missing_value=missing_value )
+ id_donner_massflux_cmt = &
+ register_diag_field ( mod_name, 'donner_massflux_cmt', axes(half), Time, &
+ 'cu_mo_trans mass flux from donner', 'kg/(m2 s)', &
missing_value=missing_value )
- id_detmf_cmt = &
- register_diag_field ( mod_name, 'detmf_cmt', axes(1:3), Time, &
- 'cu_mo_trans detrainment mass flux', 'kg/(m2 s)',&
+ id_donner_detmf_cmt = &
+ register_diag_field ( mod_name, 'donner_detmf_cmt', axes(1:3), Time, &
+ 'cu_mo_trans detrainment mass flux from donner', 'kg/(m2 s)',&
missing_value=missing_value )
endif
!--------------------------------------------------------------
+ if (trim(cmt_mass_flux_source) == 'ras') then
+ cmt_uses_ras = .true.
+ cmt_uses_donner = .false.
+ cmt_uses_uw = .false.
+ if (.not. do_ras) then
+ call error_mesg ('moist_processes_mod', &
+ 'if cmt_uses_ras = T, then do_ras must be T', FATAL)
+ endif
+
+ else if (trim(cmt_mass_flux_source) == 'donner') then
+ cmt_uses_ras = .false.
+ cmt_uses_donner = .true.
+ cmt_uses_uw = .false.
+ if (.not. do_donner_deep) then
+ call error_mesg ('convection_driver_init', &
+ 'if cmt_uses_donner = T, then do_donner_deep must be T', &
+ FATAL)
+ endif
+
+ else if (trim(cmt_mass_flux_source) == 'uw') then
+ cmt_uses_ras = .false.
+ cmt_uses_donner = .false.
+ cmt_uses_uw = .true.
+ if (.not. do_uw_conv) then
+ call error_mesg ('convection_driver_init', &
+ 'if cmt_uses_uw = T, then do_uw_conv must be T', FATAL)
+ endif
+
+ else if (trim(cmt_mass_flux_source) == 'donner_and_ras') then
+ cmt_uses_ras = .true.
+ if (.not. do_ras) then
+ call error_mesg ('convection_driver_init', &
+ 'if cmt_uses_ras = T, then do_ras must be T', FATAL)
+ endif
+ cmt_uses_donner = .true.
+ if (.not. do_donner_deep) then
+ call error_mesg ('convection_driver_init', &
+ 'if cmt_uses_donner = T, then do_donner_deep must be T', &
+ FATAL)
+ endif
+ cmt_uses_uw = .false.
+
+ else if (trim(cmt_mass_flux_source) == 'donner_and_uw') then
+ cmt_uses_uw = .true.
+ if (.not. do_uw_conv) then
+ call error_mesg ('convection_driver_init', &
+ 'if cmt_uses_uw = T, then do_uw_conv must be T', FATAL)
+ endif
+ cmt_uses_donner = .true.
+ if (.not. do_donner_deep) then
+ call error_mesg ('convection_driver_init', &
+ 'if cmt_uses_donner = T, then do_donner_deep must be T', &
+ FATAL)
+ endif
+ cmt_uses_ras = .false.
+
+ else if (trim(cmt_mass_flux_source) == 'ras_and_uw') then
+ cmt_uses_ras = .true.
+ if (.not. do_ras) then
+ call error_mesg ('convection_driver_init', &
+ 'if cmt_uses_ras = T, then do_ras must be T', FATAL)
+ endif
+ cmt_uses_uw = .true.
+ if (.not. do_uw_conv) then
+ call error_mesg ('convection_driver_init', &
+ 'if cmt_uses_uw = T, then do_uw_conv must be T', FATAL)
+ endif
+ cmt_uses_donner = .false.
+
+ else if &
+ (trim(cmt_mass_flux_source) == 'donner_and_ras_and_uw') then
+ cmt_uses_ras = .true.
+ if (.not. do_ras) then
+ call error_mesg ('convection_driver_init', &
+ 'if cmt_uses_ras = T, then do_ras must be T', FATAL)
+ endif
+ cmt_uses_donner = .true.
+ if (.not. do_donner_deep) then
+ call error_mesg ('convection_driver_init', &
+ 'if cmt_uses_donner = T, then do_donner_deep must be T', &
+ FATAL)
+ endif
+ cmt_uses_uw = .true.
+ if (.not. do_uw_conv) then
+ call error_mesg ('convection_driver_init', &
+ 'if cmt_uses_uw = T, then do_uw_conv must be T', FATAL)
+ endif
+ else if (trim(cmt_mass_flux_source) == 'all') then
+ if (do_ras) then
+ cmt_uses_ras = .true.
+ else
+ cmt_uses_ras = .false.
+ endif
+ if (do_donner_deep) then
+ cmt_uses_donner = .true.
+ else
+ cmt_uses_donner = .false.
+ endif
+ if (do_uw_conv) then
+ cmt_uses_uw = .true.
+ else
+ cmt_uses_uw = .false.
+ endif
+ else
+ call error_mesg ('convection_driver_init', &
+ 'invalid specification of cmt_mass_flux_source', FATAL)
+ endif
+
+ if (cmt_uses_uw .and. do_nonlocal_transport) then
+ call error_mesg ('convection_driver_init', &
+ 'currently cannot do non-local cmt with uw as mass &
+ &flux_source', FATAL)
+ endif
module_is_initialized = .true.
end subroutine cu_mo_trans_init
+!#########################################################################
+
+subroutine cu_mo_trans ( is, js, Time, dt, num_tracers, Input_mp, &
+ Conv_results, Output_mp, ttnd_conv)
+
+type(time_type), intent(in) :: Time
+integer, intent(in) :: is, js, num_tracers
+real, intent(in) :: dt
+type(mp_input_type), intent(inout) :: Input_mp
+type(mp_output_type), intent(inout) :: Output_mp
+real, dimension(:,:,:), intent(inout) :: ttnd_conv
+type(conv_results_type), intent(inout) :: Conv_results
+
+ real, dimension(size(Input_mp%tin,1), size(Input_mp%tin,2), &
+ size(Input_mp%tin,3)) :: ttnd, utnd, vtnd, &
+ det_cmt
+ real, dimension(size(Input_mp%tin,1), size(Input_mp%tin,2), &
+ size(Input_mp%tin,3)+1) :: mc_cmt
+ real, dimension(size(Output_mp%rdt,1), size(Output_mp%rdt,2), &
+ size(Output_mp%rdt,3),num_tracers) :: qtr
+ integer :: n
+ integer :: k, kx
+ integer :: im, jm, km, nq, nq_skip
+
+ kx = size(Input_mp%tin,3)
+
+!----------------------------------------------------------------------
+! if doing nonlocal cmt, call cu_mo_trans for each convective scheme
+! separately.
+!----------------------------------------------------------------------
+ if (do_nonlocal_transport) then
+ im = size(Input_mp%uin,1)
+ jm = size(Input_mp%uin,2)
+ km = size(Input_mp%uin,3)
+ nq = size(Input_mp%tracer,4)
+ nq_skip = nq
+ qtr (:,:,:,1:nq_skip) = 0.0
+ if (cmt_uses_ras) then
+ call non_local_mot (im, jm, km, is, js, Time, dt, INput_mp%tin, &
+ Input_mp%uin, Input_mp%vin, nq, nq_skip, &
+ Input_mp%tracer, Input_mp%pmass, Conv_results%ras_mflux, &
+ Conv_results%ras_det_mflux, utnd, vtnd, ttnd, &
+ qtr, .true., .false.)
+
+!---------------------------------------------------------------------
+! update the current tracer tendencies with the contributions
+! just obtained from cu_mo_trans.
+!---------------------------------------------------------------------
+ do n=1, num_tracers
+ Output_mp%rdt(:,:,:,n) = Output_mp%rdt(:,:,:,n) + qtr(:,:,:,n)
+ end do
+
+!----------------------------------------------------------------------
+! add the temperature, specific humidity and momentum tendencies
+! due to cumulus transfer (ttnd, qtnd, utnd, vtnd) to the arrays
+! accumulating these tendencies from all physics processes (tdt, qdt,
+! udt, vdt).
+!----------------------------------------------------------------------
+ Output_mp%tdt = Output_mp%tdt + ttnd
+ Output_mp%udt = Output_mp%udt + utnd
+ Output_mp%vdt = Output_mp%vdt + vtnd
+ ttnd_conv = ttnd_conv + ttnd
+ endif !(cmt_uses_ras)
+
+ if (cmt_uses_donner) then
+ call non_local_mot (im, jm, km, is, js, Time, dt, INput_mp%tin, &
+ Input_mp%uin, Input_mp%vin, nq, nq_skip, &
+ Input_mp%tracer, Input_mp%pmass, Conv_results%donner_mflux, &
+ Conv_results%donner_det_mflux, utnd, vtnd, ttnd, &
+ qtr, .false., .true.)
+
+
+!---------------------------------------------------------------------
+! update the current tracer tendencies with the contributions
+! just obtained from cu_mo_trans.
+!---------------------------------------------------------------------
+ do n=1, num_tracers
+ Output_mp%rdt(:,:,:,n) = Output_mp%rdt(:,:,:,n) + qtr(:,:,:,n)
+ end do
+
+!----------------------------------------------------------------------
+! add the temperature, specific humidity and momentum tendencies
+! due to cumulus transfer (ttnd, qtnd, utnd, vtnd) to the arrays
+! accumulating these tendencies from all physics processes (tdt, qdt,
+! udt, vdt).
+!----------------------------------------------------------------------
+ Output_mp%tdt = Output_mp%tdt + ttnd
+ Output_mp%udt = Output_mp%udt + utnd
+ Output_mp%vdt = Output_mp%vdt + vtnd
+ ttnd_conv = ttnd_conv + ttnd
+ endif
+
+ if (cmt_uses_uw) then
+
+!----------------------------------------------------------------------
+! CURRENTLY no detrained mass flux is provided from uw_conv; should only
+! use with 'diffusive' cmt scheme, not the non-local. (attempt to
+! use non-local will cause FATAL in _init routine.)
+!----------------------------------------------------------------------
+ endif
+
+ else ! (do_diffusive_transport)
+
+!-----------------------------------------------------------------------
+! if using diffusive cmt, call cu_mo_trans once with combined mass
+! fluxes from all desired convective schemes.
+!-----------------------------------------------------------------------
+ mc_cmt = 0.
+ det_cmt = 0.
+ if (cmt_uses_ras) then
+ mc_cmt = mc_cmt + Conv_results%ras_mflux
+ endif
+ if (cmt_uses_donner) then
+ mc_cmt = mc_cmt + Conv_results%donner_mflux
+ endif
+ if (cmt_uses_uw) then
+ do k=2,kx
+ mc_cmt(:,:,k) = mc_cmt(:,:,k) + Conv_results%uw_mflux(:,:,k-1)
+ end do
+ endif
+
+!------------------------------------------------------------------------
+! call cu_mo_trans to calculate cumulus momentum transport.
+!------------------------------------------------------------------------
+ call diffusive_cu_mo_trans (is, js, Time, mc_cmt, Input_mp%tin, &
+ Input_mp%phalf, Input_mp%pfull, Input_mp%zhalf, &
+ Input_mp%zfull, Output_mp%diff_cu_mo)
+ endif ! (do_nonlocal_transport)
+
+!-----------------------------------------------------------------------
+
+
+end subroutine cu_mo_trans
+
+
!#######################################################################
!
@@ -233,7 +505,7 @@ subroutine cu_mo_trans_end()
module_is_initialized = .false.
-end subroutine cu_mo_trans_end
+ end subroutine cu_mo_trans_end
!#######################################################################
@@ -296,66 +568,6 @@ end subroutine cu_mo_trans_end
-
-subroutine cu_mo_trans (is, js, Time, mass_flux, t, &
- p_half, p_full, z_half, z_full, dt, uin, vin,&
- tracer, pmass, det0, utnd, vtnd, ttnd, &
- qtrcumo, diff)
-
-type(time_type), intent(in) :: Time
-integer, intent(in) :: is, js
-
-real, intent(in) :: dt
-real, intent(inout) , dimension(:,:,:,:) :: tracer
-real, intent(inout) , dimension(:,:,:) :: uin, vin, t
-real, intent(in) , dimension(:,:,:) :: mass_flux, &
- pmass, det0, &
- p_half, p_full, z_half, z_full
-real, intent(out), dimension(:,:,:) :: utnd, vtnd
-real, intent(out), dimension(:,:,:) :: ttnd
-real, intent(out), dimension(:,:,:,:) :: qtrcumo
-real, intent(inout), dimension(:,:,:) :: diff
-
-
- integer :: im, jm, km, nq, nq_skip
-
-!-----------------------------------------------------------------------
-
- if (.not.module_is_initialized) call error_mesg ('cu_mo_trans', &
- 'cu_mo_trans_init has not been called.', FATAL)
-
-!-----------------------------------------------------------------------
-! utnd = 0.
-! vtnd = 0.
-! ttnd = 0.
-! qtrcumo = 0.
-
- if (do_diffusive_transport) then
- call diffusive_cu_mo_trans (is, js, Time, mass_flux, t, &
- p_half, p_full, z_half, z_full, diff)
- utnd = 0.
- vtnd = 0.
- ttnd = 0.
- qtrcumo = 0.
-
- else if (do_nonlocal_transport) then
-! call error_mesg ('cu_mo_trans', &
-! 'non-local transport not currently available', FATAL)
- im = size(uin,1)
- jm = size(uin,2)
- km = size(uin,3)
- nq = size(tracer,4)
- nq_skip = nq
- qtrcumo(:,:,:,1:nq_skip) = 0.0
- call non_local_mot (im, jm, km, is, js, Time, dt, t, uin, vin, &
- nq, nq_skip, &
- tracer, pmass, mass_flux, det0, utnd, vtnd, ttnd, &
- qtrcumo)
- endif
-
-end subroutine cu_mo_trans
-
-
!#######################################################################
!
@@ -494,7 +706,7 @@ end subroutine diffusive_cu_mo_trans
!#######################################################################
subroutine non_local_mot(im, jm, km, is, js, Time, dt, tin, uin, vin, nq, nq_skip, qin, pmass, mc, &
- det0, utnd, vtnd, ttnd, qtnd)
+ det0, utnd, vtnd, ttnd, qtnd, ras_cmt, donner_cmt)
!
! This is a non-local cumulus transport algorithm based on the given cloud mass fluxes (mc).
! Detrainment fluxes are computed internally by mass (or momentum) conservation.
@@ -532,6 +744,7 @@ subroutine non_local_mot(im, jm, km, is, js, Time, dt, tin, uin, vin, nq, nq_ski
real, intent(out)::qtnd(im,jm,km,nq)
real, intent(out)::utnd(im,jm,km), vtnd(im,jm,km) ! m/s**2
+ logical, intent(in) :: ras_cmt, donner_cmt
!
! Local
real dm1(km), u1(km), v1(km), u2(km), v2(km)
@@ -786,30 +999,55 @@ subroutine non_local_mot(im, jm, km, is, js, Time, dt, tin, uin, vin, nq, nq_ski
enddo
! --- diagnostics
- if ( id_utnd_cmt > 0 ) then
- used = send_data ( id_utnd_cmt, utnd, Time, is, js, 1 )
+if (ras_cmt) then
+ if ( id_ras_utnd_cmt > 0 ) then
+ used = send_data ( id_ras_utnd_cmt, utnd, Time, is, js, 1 )
endif
- if ( id_vtnd_cmt > 0 ) then
- used = send_data ( id_vtnd_cmt, vtnd, Time, is, js, 1 )
+ if ( id_ras_vtnd_cmt > 0 ) then
+ used = send_data ( id_ras_vtnd_cmt, vtnd, Time, is, js, 1 )
endif
if (conserve_te) then
- if ( id_ttnd_cmt > 0 ) then
- used = send_data ( id_ttnd_cmt, ttnd, Time, is, js, 1 )
+ if ( id_ras_ttnd_cmt > 0 ) then
+ used = send_data ( id_ras_ttnd_cmt, ttnd, Time, is, js, 1 )
endif
endif
- if ( id_massflux_cmt > 0 ) then
- used = send_data ( id_massflux_cmt, mc, Time, is, js, 1 )
+ if ( id_ras_massflux_cmt > 0 ) then
+ used = send_data ( id_ras_massflux_cmt, mc, Time, is, js, 1 )
endif
- if ( id_detmf_cmt > 0 ) then
- used = send_data ( id_detmf_cmt, det0, Time, is, js, 1 )
+ if ( id_ras_detmf_cmt > 0 ) then
+ used = send_data ( id_ras_detmf_cmt, det0, Time, is, js, 1 )
endif
+endif
+
+if(donner_cmt) then
+
+ if ( id_donner_utnd_cmt > 0 ) then
+ used = send_data ( id_donner_utnd_cmt, utnd, Time, is, js, 1 )
+ endif
+ if ( id_donner_vtnd_cmt > 0 ) then
+ used = send_data ( id_donner_vtnd_cmt, vtnd, Time, is, js, 1 )
+ endif
+ if (conserve_te) then
+ if ( id_donner_ttnd_cmt > 0 ) then
+ used = send_data ( id_donner_ttnd_cmt, ttnd, Time, is, js, 1 )
+ endif
+ endif
+ if ( id_donner_massflux_cmt > 0 ) then
+ used = send_data ( id_donner_massflux_cmt, mc, Time, is, js, 1 )
+ endif
+ if ( id_donner_detmf_cmt > 0 ) then
+ used = send_data ( id_donner_detmf_cmt, det0, Time, is, js, 1 )
+ endif
+endif
end subroutine non_local_mot
-end module cu_mo_trans_mod
-!
-!
+!#######################################################################
+
+
+
+end module cu_mo_trans_mod
diff --git a/atmos_param/damping_driver/damping_driver.F90 b/atmos_param/damping_driver/damping_driver.F90
index 4a3eb378..538a7d32 100644
--- a/atmos_param/damping_driver/damping_driver.F90
+++ b/atmos_param/damping_driver/damping_driver.F90
@@ -23,11 +23,12 @@ module damping_driver_mod
use topo_drag_mod, only: topo_drag_init, topo_drag, topo_drag_end, &
topo_drag_restart
use mpp_mod, only: input_nml_file
- use fms_mod, only: file_exist, mpp_pe, mpp_root_pe, stdlog, &
+ use mpp_domains_mod, only: domain2D
+ use fms_mod, only: mpp_pe, mpp_root_pe, stdlog, &
write_version_number, &
- open_namelist_file, error_mesg, &
+ error_mesg, &
check_nml_error, &
- FATAL, close_file
+ FATAL
use diag_manager_mod, only: register_diag_field, &
register_static_field, send_data
use atmos_cmip_diag_mod, only: register_cmip_diag_field_3d, &
@@ -424,8 +425,9 @@ end subroutine damping_driver
!#######################################################################
- subroutine damping_driver_init ( lonb, latb, pref, axes, Time, sgsmtn)
+ subroutine damping_driver_init ( domain, lonb, latb, pref, axes, Time, sgsmtn)
+ type(domain2D), target, intent(in) :: domain !< Atmosphere domain
real, intent(in) :: lonb(:,:), latb(:,:), pref(:)
integer, intent(in) :: axes(4)
type(time_type), intent(in) :: Time
@@ -444,19 +446,8 @@ subroutine damping_driver_init ( lonb, latb, pref, axes, Time, sgsmtn)
!-----------------------------------------------------------------------
!----------------- namelist (read & write) -----------------------------
-#ifdef INTERNAL_FILE_NML
read (input_nml_file, nml=damping_driver_nml, iostat=io)
ierr = check_nml_error(io,"damping_driver_nml")
-#else
- if (file_exist('input.nml')) then
- unit = open_namelist_file ()
- ierr=1; do while (ierr /= 0)
- read (unit, nml=damping_driver_nml, iostat=io, end=10)
- ierr = check_nml_error (io, 'damping_driver_nml')
- enddo
- 10 call close_file (unit)
- endif
-#endif
call write_version_number(version, tagname)
logunit = stdlog()
@@ -489,13 +480,13 @@ subroutine damping_driver_init ( lonb, latb, pref, axes, Time, sgsmtn)
!-----------------------------------------------------------------------
!----- mountain gravity wave drag -----
- if (do_mg_drag) call mg_drag_init (lonb, latb, sgsmtn)
+ if (do_mg_drag) call mg_drag_init (domain, lonb, latb, sgsmtn)
!--------------------------------------------------------------------
!----- Alexander-Dunkerton gravity wave drag -----
if (do_cg_drag) then
- call cg_drag_init (lonb, latb, pref, Time=Time, axes=axes)
+ call cg_drag_init (domain, lonb, latb, pref, Time=Time, axes=axes)
endif
!-----------------------------------------------------------------------
@@ -607,7 +598,7 @@ subroutine damping_driver_init ( lonb, latb, pref, axes, Time, sgsmtn)
if (do_topo_drag) then
- call topo_drag_init (lonb, latb)
+ call topo_drag_init (domain, lonb, latb)
sgsmtn(:,:) = -99999.
endif
diff --git a/atmos_param/diag_cloud/diag_cloud.F90 b/atmos_param/diag_cloud/diag_cloud.F90
index 0210d9d8..d1f89694 100644
--- a/atmos_param/diag_cloud/diag_cloud.F90
+++ b/atmos_param/diag_cloud/diag_cloud.F90
@@ -17,13 +17,13 @@ MODULE DIAG_CLOUD_MOD
!-------------------------------------------------------------------
use mpp_mod, only: input_nml_file
- use fms_mod, only: error_mesg, FATAL, NOTE, file_exist, &
- check_nml_error, open_namelist_file, &
- mpp_pe, mpp_root_pe, close_file, &
- read_data, write_data, &
+ use fms_mod, only: error_mesg, FATAL, NOTE, &
+ check_nml_error, &
+ mpp_pe, mpp_root_pe, &
write_version_number, stdlog
use fms_io_mod, only: register_restart_field, restart_file_type, &
save_restart, restore_state
+ use fms2_io_mod, only: file_exists
use Constants_Mod, only: Cp_Air, rdgas, rvgas, Kappa, HLv
use time_manager_mod, only: TIME_TYPE
use cloud_zonal_mod, only: CLOUD_ZONAL_INIT, GETCLD
@@ -3110,7 +3110,7 @@ SUBROUTINE DIAG_CLOUD_INIT( ix,iy,kx, ierr )
!---------------------------------------------------------------------
! (Intent local)
!---------------------------------------------------------------------
- integer unit, io, ierrnml, logunit
+ integer io, ierrnml, logunit
integer id_restart
character(len=32) :: fname
@@ -3121,22 +3121,8 @@ SUBROUTINE DIAG_CLOUD_INIT( ix,iy,kx, ierr )
! --- Read namelist
!---------------------------------------------------------------------
-#ifdef INTERNAL_FILE_NML
read (input_nml_file, nml=diag_cloud_nml, iostat=io)
ierr = check_nml_error(io,"diag_cloud_nml")
-#else
- if( FILE_EXIST( 'input.nml' ) ) then
-! -------------------------------------
- unit = open_namelist_file ('input.nml')
- ierrnml = 1
- do while( ierrnml .ne. 0 )
- READ ( unit, nml = diag_cloud_nml, iostat = io, end = 10 )
- ierrnml = check_nml_error(io,'diag_cloud_nml')
- end do
-10 call close_file (unit)
-! -------------------------------------
- end if
-#endif
!---------------------------------------------------------------------
! --- Output namelist
@@ -3177,7 +3163,7 @@ SUBROUTINE DIAG_CLOUD_INIT( ix,iy,kx, ierr )
id_restart = register_restart_field(Dia_restart, fname, 'cnvcntq_sum', cnvcntq_sum, no_domain=.true.)
id_restart = register_restart_field(Dia_restart, fname, 'convprc_sum', convprc_sum, no_domain=.true.)
- if( FILE_EXIST( 'INPUT/diag_cloud.res.nc' ) ) then
+ if( FILE_EXISTS( 'INPUT/diag_cloud.res.nc' ) ) then
if(mpp_pe() == mpp_root_pe() ) call error_mesg ('diag_cloud_mod', &
'Reading netCDF formatted restart file: INPUT/diag_cloud.res.nc', NOTE)
call restore_state(Dia_restart)
@@ -3185,7 +3171,7 @@ SUBROUTINE DIAG_CLOUD_INIT( ix,iy,kx, ierr )
qmix_sum2(:,:) = qmix_sum(:,:,size(qmix_sum,3))
ierr = 0
num_pts = tot_pts
- else if( FILE_EXIST( 'INPUT/diag_cloud.res' ) ) then
+ else if( FILE_EXISTS( 'INPUT/diag_cloud.res' ) ) then
call error_mesg ( 'diag_cloud_mod', 'Native restart capability has been removed.', &
FATAL)
else
diff --git a/atmos_param/diag_cloud_rad/diag_cloud_rad.F90 b/atmos_param/diag_cloud_rad/diag_cloud_rad.F90
index 8a0ea6e5..e4cb107f 100644
--- a/atmos_param/diag_cloud_rad/diag_cloud_rad.F90
+++ b/atmos_param/diag_cloud_rad/diag_cloud_rad.F90
@@ -28,8 +28,8 @@ MODULE DIAG_CLOUD_RAD_MOD
!-------------------------------------------------------------------
use mpp_mod, only: input_nml_file
-use fms_mod, only: file_exist, check_nml_error, open_namelist_file, &
- mpp_pe, mpp_root_pe, close_file, &
+use fms_mod, only: check_nml_error, &
+ mpp_pe, mpp_root_pe, &
write_version_number, stdlog
! Steve Klein's Cloud_Rad module
@@ -3188,7 +3188,7 @@ SUBROUTINE DIAG_CLOUD_RAD_INIT(do_crad_init)
!---------------------------------------------------------------------
! (Intent local)
!---------------------------------------------------------------------
- integer :: unit, io, logunit, ierr
+ integer :: io, logunit, ierr
!=====================================================================
@@ -3196,23 +3196,8 @@ SUBROUTINE DIAG_CLOUD_RAD_INIT(do_crad_init)
! --- Read namelist
!---------------------------------------------------------------------
-#ifdef INTERNAL_FILE_NML
read (input_nml_file, nml=diag_cloud_rad_nml, iostat=io)
ierr = check_nml_error(io,"diag_cloud_rad_nml")
-#else
- if( FILE_EXIST( 'input.nml' ) ) then
-! -------------------------------------
- unit = open_namelist_file ()
- io = 1
- do while( io .ne. 0 )
- READ ( unit, nml = diag_cloud_rad_nml, iostat = io, end = 10 )
- ierr = check_nml_error(io,'diag_cloud_rad_nml')
- end do
-10 continue
- call close_file (unit)
-! -------------------------------------
- end if
-#endif
! **** call cloud_rad_init to read namelist containing L2STREM ****
call cloud_rad_init()
diff --git a/atmos_param/diffusivity/diffusivity.F90 b/atmos_param/diffusivity/diffusivity.F90
index 91b7bcaf..531f9d7d 100644
--- a/atmos_param/diffusivity/diffusivity.F90
+++ b/atmos_param/diffusivity/diffusivity.F90
@@ -14,10 +14,11 @@ module diffusivity_mod
use constants_mod, only : grav, vonkarm, cp_air, rdgas, rvgas
use mpp_mod, only : input_nml_file
-use fms_mod, only : error_mesg, FATAL, file_exist, &
- check_nml_error, open_namelist_file, &
- mpp_pe, mpp_root_pe, close_file, &
+use fms_mod, only : error_mesg, FATAL, &
+ check_nml_error, &
+ mpp_pe, mpp_root_pe, &
write_version_number, stdlog
+use fms2_io_mod, only : file_exists
use monin_obukhov_mod, only : mo_diff
@@ -152,22 +153,13 @@ module diffusivity_mod
subroutine diffusivity_init
-integer :: unit, ierr, io, logunit
+integer :: ierr, io, logunit
!------------------- read namelist input -------------------------------
- if (file_exist('input.nml')) then
-#ifdef INTERNAL_FILE_NML
+ if (file_exists('input.nml')) then
read (input_nml_file, nml=diffusivity_nml, iostat=io)
ierr = check_nml_error(io,"diffusivity_nml")
-#else
- unit = open_namelist_file ()
- ierr=1; do while (ierr /= 0)
- read (unit, nml=diffusivity_nml, iostat=io, end=10)
- ierr = check_nml_error(io,'diffusivity_nml')
- enddo
- 10 call close_file (unit)
-#endif
!------------------- dummy checks --------------------------------------
if (frac_inner .le. 0. .or. frac_inner .ge. 1.) &
diff --git a/atmos_param/donner_deep/donner_deep.F90 b/atmos_param/donner_deep/donner_deep.F90
index d18e5cb1..d6ee2454 100644
--- a/atmos_param/donner_deep/donner_deep.F90
+++ b/atmos_param/donner_deep/donner_deep.F90
@@ -1,5 +1,6 @@
module donner_deep_mod
+use mpp_domains_mod, only: domain2D
use donner_types_mod, only: donner_initialized_type, &
donner_save_type, donner_rad_type, &
donner_nml_type, donner_param_type, &
@@ -387,6 +388,7 @@ module donner_deep_mod
logical :: running_in_fms = .true.
+logical :: doing_prog_clouds
!-----------------------------------------------------------------------
!-----------------------------------------------------------------------
@@ -405,15 +407,17 @@ module donner_deep_mod
!#####################################################################
-subroutine donner_deep_init (lonb, latb, pref, axes, secs, days, &
+subroutine donner_deep_init (domain, lonb, latb, pref, axes, secs, days, &
tracers_in_donner, do_conservation_checks,&
- using_unified_closure, using_fms_code)
+ using_unified_closure, doing_prog_clouds_in, &
+ using_fms_code)
!---------------------------------------------------------------------
! donner_deep_init is the constructor for donner_deep_mod.
!---------------------------------------------------------------------
!--------------------------------------------------------------------
+type(domain2D), target, intent(in) :: domain !< Atmosphere domain
real, dimension(:,:), intent(in) :: lonb, latb
real, dimension(:), intent(in) :: pref
integer, dimension(4), intent(in) :: axes
@@ -421,6 +425,7 @@ subroutine donner_deep_init (lonb, latb, pref, axes, secs, days, &
logical, dimension(:), intent(in) :: tracers_in_donner
logical, intent(in) :: do_conservation_checks
logical, intent(in) :: using_unified_closure
+logical, intent(in) :: doing_prog_clouds_in
logical, intent(in), optional :: &
using_fms_code
@@ -469,6 +474,8 @@ subroutine donner_deep_init (lonb, latb, pref, axes, secs, days, &
ermesg = ' '
erflag = 0
+ doing_prog_clouds = doing_prog_clouds_in
+
!---------------------------------------------------------------------
! define variable to indicated whether this module is being executed
! within the FMS infrastructure. by default it is.
@@ -828,7 +835,7 @@ subroutine donner_deep_init (lonb, latb, pref, axes, secs, days, &
!@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
if (running_in_fms) then
- call fms_donner_read_restart (Initialized, ntracers, &
+ call fms_donner_read_restart (domain, Initialized, ntracers, &
secs, days, Don_save, Nml)
else
@@ -1185,10 +1192,8 @@ subroutine donner_deep (is, ie, js, je, dt, temp, mixing_ratio, pfull, &
frozen_precip
real, dimension(:,:,:,:), intent(out) :: qtrtnd
real, dimension(:,:,:), intent(out) :: donner_wetdep
-real, dimension(:,:,:), intent(in), &
- optional :: qlin, qiin, qain
-real, dimension(:,:,:), intent(out), &
- optional :: delta_ql, delta_qi, &
+real, dimension(:,:,:), intent(in) :: qlin, qiin, qain
+real, dimension(:,:,:), intent(out) :: delta_ql, delta_qi, &
delta_qa
!--------------------------------------------------------------------
@@ -1395,39 +1400,16 @@ subroutine donner_deep (is, ie, js, je, dt, temp, mixing_ratio, pfull, &
endif
endif
-!----------------------------------------------------------------------
-! determine if the arguments needed when run with the strat_cloud_mod
-! are present; set cloud_tracers_present appropriately.
-!----------------------------------------------------------------------
- num_cld_tracers = count( (/present(qlin), present(qiin), &
- present(qain), present(delta_ql), &
- present(delta_qi),present(delta_qa)/) )
- if (num_cld_tracers == 0) then
- cloud_tracers_present = .false.
- qlin_arg = 0.
- qiin_arg = 0.
- qain_arg = 0.
- else if (num_cld_tracers == 6) then
+ if (doing_prog_clouds) then
+ num_cld_tracers = 6
cloud_tracers_present = .true.
+ else
+ num_cld_tracers = 0
+ cloud_tracers_present = .false.
+ endif
qlin_arg = qlin
qiin_arg = qiin
qain_arg = qain
- else
- ermesg = 'donner_deep: &
- &Either none or all of the cloud tracers '// &
- 'and their tendencies must be present'
- if (running_in_fms) then
- call fms_error_mesg (ermesg)
- else
-
-!---------------------------------------------------------------------
-! appropriate error processing code should be added in subroutine
-! nonfms_error_mesg. currently an error message is printed and a
-! stop command issued (dangerous on parallel machines!).
-!---------------------------------------------------------------------
- call nonfms_error_mesg (ermesg)
- endif
- endif
!--------------------------------------------------------------------
! if column diagnostics have been requested for any column, call
@@ -1693,7 +1675,8 @@ subroutine donner_deep_restart(timestamp)
integer :: ntracers
if (running_in_fms) then
- call fms_donner_write_restart (Initialized, timestamp)
+ ntracers = size(Don_save%tracername(:))
+ call fms_donner_write_restart (Initialized, ntracers, nml, Don_save, timestamp)
else
!---------------------------------------------------------------------
diff --git a/atmos_param/donner_deep/fms_donner.F90 b/atmos_param/donner_deep/fms_donner.F90
index a99bc644..01a8f39f 100644
--- a/atmos_param/donner_deep/fms_donner.F90
+++ b/atmos_param/donner_deep/fms_donner.F90
@@ -2,7 +2,6 @@ module fms_donner_mod
use time_manager_mod, only: time_type, set_time, &
set_date, get_time, &
- get_calendar_type, &
operator(-), &
operator(>=), operator (<)
use diag_manager_mod, only: register_diag_field, send_data, &
@@ -17,22 +16,19 @@ module fms_donner_mod
use atmos_tracer_utilities_mod, only : get_wetdep_param
use sat_vapor_pres_mod,only : sat_vapor_pres_init
!--lwh
-use fms_mod, only: mpp_pe, mpp_root_pe, &
- file_exist, check_nml_error, &
- error_mesg, FATAL, WARNING, NOTE, &
- close_file, open_namelist_file, &
- stdout, stdlog, write_version_number, &
- field_size, &
- read_data, write_data, lowercase
-use fms_io_mod, only: register_restart_field, restart_file_type, &
- save_restart, restore_state, get_mosaic_tile_file
-use mpp_mod, only: input_nml_file
-use mpp_io_mod, only: mpp_open, mpp_close, fieldtype, &
- mpp_read_meta, mpp_get_info, &
- mpp_get_fields, mpp_read, &
- MPP_NETCDF, MPP_SINGLE, &
- MPP_SEQUENTIAL, MPP_RDONLY, MPP_NATIVE, &
- mpp_get_field_name
+use fms_mod, only: mpp_pe, mpp_root_pe, mpp_npes, &
+ check_nml_error, &
+ error_mesg, FATAL, WARNING, NOTE, & !close_file,
+ stdlog, write_version_number, &
+ lowercase
+use fms2_io_mod, only: FmsNetcdfFile_t, FmsNetcdfDomainFile_t, &
+ register_restart_field, register_axis, unlimited, &
+ open_file, read_restart, write_restart, close_file, &
+ register_field, write_data, register_variable_attribute, &
+ get_global_io_domain_indices, file_exists
+
+use mpp_mod, only: input_nml_file, mpp_get_current_pelist
+use mpp_domains_mod, only: domain2D, mpp_get_ntile_count
use constants_mod, only: DENS_H2O, RDGAS, GRAV, CP_AIR, &
pie=>PI, KAPPA, RVGAS, &
SECONDS_PER_DAY, HLV, HLF, HLS, KELVIN
@@ -86,12 +82,11 @@ module fms_donner_mod
private &
! module subroutines called by donner_deep_init:
- register_fields, read_restart_nc, &
+ register_fields, &
process_coldstart,&
! module subroutines called by donner_deep:
- donner_deep_netcdf, donner_column_control, &
+ donner_deep_netcdf, donner_column_control
! module subroutines called from donner_deep_end:
- write_restart
!---------------------------------------------------------------------
@@ -108,10 +103,6 @@ module fms_donner_mod
!--------------------------------------------------------------------
!----private data-----------
-!--- for restart file
-type(restart_file_type), pointer, save :: Don_restart => NULL()
-type(restart_file_type), pointer, save :: Til_restart => NULL()
-logical :: in_different_file = .false.
!---------------------------------------------------------------------
! parameters stored in the donner_param derived type variable to facili-
! tate passage to kernel subroutines:
@@ -231,7 +222,7 @@ module fms_donner_mod
real , dimension(:), allocatable :: col_diag_lon, col_diag_lat
integer, dimension(:), allocatable :: col_diag_j, col_diag_i
type(time_type) :: Time_col_diagnostics
-
+type (domain2D), pointer :: don_domain !< Atmosphere domain
!-----------------------------------------------------------------------
! miscellaneous variables
@@ -293,19 +284,8 @@ subroutine fms_donner_process_nml (Nml, kpar)
!---------------------------------------------------------------------
! read namelist.
!---------------------------------------------------------------------
-#ifdef INTERNAL_FILE_NML
read (input_nml_file, nml=donner_deep_nml, iostat=io)
ierr = check_nml_error(io,'donner_deep_nml')
-#else
- if (file_exist('input.nml')) then
- unit = open_namelist_file ()
- ierr=1; do while (ierr /= 0)
- read (unit, nml=donner_deep_nml, iostat=io, end=10)
- ierr = check_nml_error (io, 'donner_deep_nml')
- enddo
-10 call close_file (unit)
- endif
-#endif
!---------------------------------------------------------------------
! write version number and namelist to logfile.
@@ -426,7 +406,8 @@ subroutine fms_donner_process_tracers (Initialized, tracers_in_donner,&
integer :: nn, n
logical :: flag
- character(len=200) :: method_name, method_control
+!RSH character(len=200) :: method_name, method_control
+ character(len=300) :: method_name, method_control
real :: frac_junk, frac_junk2
Initialized%do_donner_tracer = .true.
@@ -502,16 +483,22 @@ end subroutine fms_donner_activate_diagnostics
!#####################################################################
-subroutine fms_donner_read_restart (Initialized, ntracers, &
+subroutine fms_donner_read_restart (domain, Initialized, ntracers, &
secs, days, Don_save, Nml)
+type(domain2D), target, intent(in) :: domain !< Atmosphere domain
type(donner_initialized_type), intent(inout) :: Initialized
type(donner_save_type), intent(inout) :: Don_save
type(donner_nml_type), intent(inout) :: Nml
integer, intent(in) :: secs, days, ntracers
- type(time_type) :: Time
+type(time_type) :: Time
integer :: outunit
+type(FmsNetcdfFile_t) :: Don_restart !< Fms2io fileobj
+type(FmsNetcdfDomainFile_t) :: Til_restart !< Fms2io domain decomposed fileobj
+logical :: Don_restart_exist !< Flag indicating if the file was opened sucessfully
+logical :: Til_restart_exist !< Flag indicating if the file was opened sucessfully
+integer, dimension(:), allocatable :: pes !< Array of pes in the current pelist
Time = set_time (secs, days)
@@ -522,35 +509,47 @@ subroutine fms_donner_read_restart (Initialized, ntracers, &
!@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
!--------------------------------------------------------------------
-! if a netcdf restart file is present, call read_restart_nc to read
+! if a netcdf restart file is present, call to read
! it.
!--------------------------------------------------------------------
- !--- register restart field to be ready to be written out.
- call fms_donner_register_restart('donner_deep.res.nc', Initialized, ntracers, Don_save, Nml)
+ don_domain => domain
- if (file_exist ('INPUT/donner_deep.res.nc') ) then
- Initialized%coldstart= .false.
-! call read_restart_nc (ntracers, Initialized,Nml, Don_save)
- call restore_state(Don_restart)
- if (in_different_file) call restore_state(Til_restart)
+ !< Get the current pelist
+ allocate(pes(mpp_npes()))
+ call mpp_get_current_pelist(pes)
-!--------------------------------------------------------------------
-! if a native mode restart file is present, call read_restart
-! to read it.
-!--------------------------------------------------------------------
- else if (file_exist ('INPUT/donner_deep.res') ) then
+ !< Open the scalar file with the current pelist, so that only the root pe opens and reads the file and
+ !! distributes the data to the other pes
+ !--- register restart field to be ready to be written out.
+ Don_restart_exist = open_file(Don_restart,"INPUT/donner_deep.res.nc","read", is_restart=.true., pelist=pes)
+ if (Don_restart_exist) then !scalar file
Initialized%coldstart= .false.
- call error_mesg ( 'fms_donner_mod', 'Native restart capability has been removed.', &
- FATAL)
+ call fms_donner_register_restart_scalars(Don_restart, Initialized, Nml)
+ call read_restart(Don_restart)
+ call close_file(Don_restart)
+ endif
+ deallocate(pes)
+
+ Til_restart_exist = open_file(Til_restart,"INPUT/donner_deep.res.nc","read", don_domain, is_restart=.true.)
+ if (Til_restart_exist) then !domain file
+ Initialized%coldstart= .false.
+ call fms_donner_register_restart_domain(Til_restart, Initialized, ntracers, Don_save)
+ call read_restart(Til_restart)
+ call close_file(Til_restart)
+ endif
!--------------------------------------------------------------------
! if no restart file is present, call subroutine process_coldstart
! to define the needed variables.
!--------------------------------------------------------------------
- else
+ if (.not. Til_restart_exist .and. .not. Don_restart_exist) then
+! if a native mode restart file is present, crash
+ if (file_exists ('INPUT/donner_deep.res') ) then
+ Initialized%coldstart= .false.
+ call error_mesg ( 'fms_donner_mod', 'Native restart capability has been removed.', &
+ FATAL)
+ endif
call process_coldstart (Time, Initialized, Nml, Don_save)
endif
-
-
end subroutine fms_donner_read_restart
@@ -710,10 +709,19 @@ end subroutine fms_donner_col_diag
! the any restart file name as a prefix.
!
!
-subroutine fms_donner_write_restart (Initialized, timestamp)
- type(donner_initialized_type), intent(in) :: Initialized
+subroutine fms_donner_write_restart (Initialized, ntracers, nml, Don_save, timestamp)
+ type(donner_initialized_type), intent(inout) :: Initialized
+ integer, intent(in) :: ntracers
+ type(donner_nml_type), intent(inout) :: Nml
+ type(donner_save_type), intent(inout) :: Don_save
character(len=*), intent(in), optional :: timestamp
+ type(FmsNetcdfFile_t) :: Don_restart !< Fms2io fileobj
+ type(FmsNetcdfDomainFile_t) :: Til_restart !< Fms2io domain decomposed fileobj
+ logical :: tile_file_open !< Flag indicating if the domain decomposed file was opened sucessfully
+ character(len=128) :: filename !< String with restart filename
+ integer, dimension(:), allocatable :: pes !< Array of pes in the current pelist
+
!-------------------------------------------------------------------
! call subroutine to write restart file. NOTE: only the netcdf
! restart file is currently supported.
@@ -736,10 +744,57 @@ subroutine fms_donner_write_restart (Initialized, timestamp)
endif
endif
endif
- call save_restart(Don_restart, timestamp)
- if(in_different_file) call save_restart(Til_restart, timestamp)
-end subroutine fms_donner_write_restart
+ if (present(timestamp)) then
+ filename= "RESTART/"//trim(timestamp)//".donner_deep.res.nc"
+ else
+ filename = "RESTART/donner_deep.res.nc"
+ endif
+
+ !< Get the current pelist
+ allocate(pes(mpp_npes()))
+ call mpp_get_current_pelist(pes)
+
+ !< Open the scalar file with the current pelist, so that only the root pe opens and writes the file
+ if (open_file(Don_restart,trim(filename),"overwrite", is_restart=.true., pelist=pes)) then !scalar file
+ Initialized%coldstart= .false.
+ call fms_donner_register_restart_scalars(Don_restart, Initialized, Nml)
+ call write_restart(Don_restart)
+ call close_file(Don_restart)
+ endif
+ deallocate(pes)
+
+ if (mpp_get_ntile_count(don_domain) == 1) then
+ tile_file_open = open_file(Til_restart,trim(filename),"append", don_domain, is_restart=.true.)!domain file
+ else
+ tile_file_open = open_file(Til_restart,trim(filename),"overwrite", don_domain, is_restart=.true.) !domain file
+ endif
+
+ if(tile_file_open) then
+ Initialized%coldstart= .false.
+ call fms_donner_register_restart_domain(Til_restart, Initialized, ntracers, Don_save)
+ call write_restart(Til_restart)
+ call add_domain_dimension_data(Til_restart)
+ call close_file(Til_restart)
+ endif
+
+end subroutine fms_donner_write_restart
+
+!< Add_dimension_data: Adds dummy data for the domain decomposed axis
+subroutine add_domain_dimension_data(fileobj)
+ type(FmsNetcdfDomainFile_t) :: fileobj !< Fms2io domain decomposed fileobj
+ integer, dimension(:), allocatable :: buffer !< Buffer with axis data
+ integer :: is, ie !< Starting and Ending indices for data
+
+ call get_global_io_domain_indices(fileobj, "xaxis_1", is, ie, indices=buffer)
+ call write_data(fileobj, "xaxis_1", buffer)
+ deallocate(buffer)
+
+ call get_global_io_domain_indices(fileobj, "yaxis_1", is, ie, indices=buffer)
+ call write_data(fileobj, "yaxis_1", buffer)
+ deallocate(buffer)
+
+end subroutine add_domain_dimension_data
!#####################################################################
@@ -2342,406 +2397,77 @@ end subroutine process_coldstart
!#####################################################################
! register restart field to be written to restart file.
-subroutine fms_donner_register_restart(fname, Initialized, ntracers, Don_save, Nml)
- character(len=*), intent(in) :: fname
+subroutine fms_donner_register_restart_scalars(Don_restart, Initialized, Nml)
+ type(FmsNetcdfFile_t), intent(inout) :: Don_restart !< Fms2io fileobj
type(donner_initialized_type), intent(inout) :: Initialized
- integer, intent(in) :: ntracers
- type(donner_save_type), intent(inout) :: Don_save
type(donner_nml_type), intent(inout) :: Nml
- character(len=64) :: fname2
- integer :: id_restart, n
-
- call get_mosaic_tile_file(fname, fname2, .false. )
- allocate(Don_restart)
- if(trim(fname2) == trim(fname)) then
- Til_restart => Don_restart
- in_different_file = .false.
- else
- in_different_file = .true.
- allocate(Til_restart)
- endif
-
- id_restart = register_restart_field(Don_restart, fname, 'conv_alarm', Initialized%conv_alarm, no_domain = .true.)
- id_restart = register_restart_field(Don_restart, fname, 'donner_deep_freq', Nml%donner_deep_freq, no_domain = .true.)
-
- if (.not. (write_reduced_restart_file) .or. &
- Initialized%conv_alarm > Initialized%physics_dt) then
- id_restart = register_restart_field(Til_restart, fname, 'cemetf', Don_save%cemetf)
- id_restart = register_restart_field(Til_restart, fname, 'cememf', Don_save%cememf)
- id_restart = register_restart_field(Til_restart, fname, 'mass_flux', Don_save%mass_flux)
- id_restart = register_restart_field(Til_restart, fname, 'cell_up_mass_flux', Don_save%cell_up_mass_flux)
- id_restart = register_restart_field(Til_restart, fname, 'det_mass_flux', Don_save%det_mass_flux)
- id_restart = register_restart_field(Til_restart, fname, 'dql_strat', Don_save%dql_strat)
- id_restart = register_restart_field(Til_restart, fname, 'dqi_strat', Don_save%dqi_strat)
- id_restart = register_restart_field(Til_restart, fname, 'dqa_strat', Don_save%dqa_strat)
- id_restart = register_restart_field(Til_restart, fname, 'tprea1', Don_save%tprea1)
- id_restart = register_restart_field(Til_restart, fname, 'humidity_area', Don_save%humidity_area)
- id_restart = register_restart_field(Til_restart, fname, 'humidity_factor', Don_save%humidity_factor)
- if (Initialized%do_donner_tracer) then
- do n=1,ntracers
- id_restart = register_restart_field(Til_restart, fname, 'tracer_tends_'// trim(Don_save%tracername(n)), &
- Don_save%tracer_tends(:,:,:,n))
- end do
- endif
- endif
- id_restart = register_restart_field(Til_restart, fname, 'parcel_disp', Don_save%parcel_disp)
- id_restart = register_restart_field(Til_restart, fname, 'lag_temp', Don_save%lag_temp)
- id_restart = register_restart_field(Til_restart, fname, 'lag_vapor', Don_save%lag_vapor)
- id_restart = register_restart_field(Til_restart, fname, 'lag_press', Don_save%lag_press)
-end subroutine fms_donner_register_restart
+ character(len=8), dimension(1) :: dim_names !< Array of dimension names
+ dim_names(1) = "Time"
+ call register_axis(Don_restart, dim_names(1), unlimited)
-!#####################################################################
-!
-!
-! read_restart_nc reads a netcdf restart file containing donner_deep
-! restart information.
-!
-!
-! read_restart_nc reads a netcdf restart file containing donner_deep
-! restart information.
-!
-!
-! call read_restart_nc
-!
-!
-!
-
+ call register_restart_field(Don_restart, 'conv_alarm', Initialized%conv_alarm, dim_names)
+ call register_restart_field(Don_restart, 'donner_deep_freq', Nml%donner_deep_freq, dim_names)
-subroutine read_restart_nc (ntracers, Initialized, Nml, Don_save)
+end subroutine fms_donner_register_restart_scalars
-!-----------------------------------------------------------------------
-! subroutine read_restart_nc reads a netcdf restart file to obtain
-! the variables needed upon experiment restart.
-!-----------------------------------------------------------------------
-
-integer, intent(in) :: ntracers
-type(donner_initialized_type), intent(inout) :: Initialized
-type(donner_save_type), intent(inout) :: Don_save
-type(donner_nml_type), intent(inout) :: Nml
+subroutine fms_donner_register_restart_domain(Til_restart, Initialized, ntracers, Don_save)
+ type(FmsNetcdfDomainFile_t), intent(inout) :: Til_restart !< Fms2io domain decomposed fileobj
+ type(donner_initialized_type), intent(inout) :: Initialized
+ integer, intent(in) :: ntracers
+ type(donner_save_type), intent(inout) :: Don_save
-!----------------------------------------------------------------------
-! intent(in) variables:
-!
-! ntracers number of tracers being transported by the
-! donner deep convection parameterization in this job
-!
-!---------------------------------------------------------------------
+ integer :: n
+ character(len=8), dimension(4) :: dim_names, dim_names2 !< Array of dimension names
+ character(len=8), dimension(3) :: dim_names2d !< Array of dimension names
-!---------------------------------------------------------------------
-! local variables:
+ dim_names(1) = "xaxis_1"
+ dim_names(2) = "yaxis_1"
+ dim_names(3) = "zaxis_1"
+ dim_names(4) = "Time"
- logical, dimension(ntracers) :: success
- integer, dimension(:), allocatable :: ntindices
- type(fieldtype), dimension(:), allocatable :: tracer_fields
+ dim_names2d = (/"xaxis_1", "yaxis_1", "Time "/)
+ if (.not. Til_restart%mode_is_append) call register_axis(Til_restart, "Time", unlimited)
+ call register_axis(Til_restart, "xaxis_1", "x")
+ call register_axis(Til_restart, "yaxis_1", "y")
+ call register_axis(Til_restart, "zaxis_1", size(Don_save%lag_temp, 3))
- character(len=64) :: fname2='INPUT/donner_deep.res.tile1'
- character(len=64) :: fname='INPUT/donner_deep.res.nc'
- character(len=128) :: tname
- integer :: ndim, natt, nvar, ntime
- integer :: old_freq
- integer :: n_alltracers, iuic
- logical :: is_tracer_in_restart_file
- integer, dimension(4) :: siz
- logical :: field_found, field_found2, &
- field_found4
- integer :: it, jn, nn
+ !< Register the domain decomposed dimensions as variables so that the combiner can work
+ !! correctly
+ call register_field(Til_restart, dim_names(1), "double", (/dim_names(1)/))
+ call register_field(Til_restart, dim_names(2), "double", (/dim_names(2)/))
-!---------------------------------------------------------------------
-! local variables:
-!
-! success logical indicating if needed data for tracer n
-! was obtained from restart file
-! ntindices array of all tracer indices
-! tracer_fields field_type variable containing information on
-! all restart file variables
-! fname2 restart file name without ".nc" appended,
-! needed as argument in call to mpp_open
-! fname restart file name
-! tname contains successive variable names from
-! restart file
-! ndim number of dimensions in restart file
-! natt number of attributes in restart file
-! nvar number of variables in restart file
-! ntime number of time levels in restart file
-! old_freq donner_deep_freq as read from restart file;
-! value used during previous job
-! n_alltracers number of tracers registered with
-! tracer_manager_mod
-! iuic unit number assigned to restart file
-! is_tracer_in_restart_file
-! should we stop searching the restart file
-! for the current tracer name because it has
-! been found ?
-! siz sizes (each dimension) of netcdf variable
-! field_found is the requested variable in the restart file ?
-! if it is not, then this is a reduced restart
-! file
-! field_found2 is the requested variable in the restart file ?
-! if it is not, then Don_save%det_mass_flux and
-! Don_save%cell_up_mass_flux must be initialized
-! it, jn, nn do-loop indices
-!
-!----------------------------------------------------------------------
+ if (.not. (write_reduced_restart_file) .or. &
+ Initialized%conv_alarm > Initialized%physics_dt) then
-!--------------------------------------------------------------------
-! output a message indicating entrance into this routine.
-!--------------------------------------------------------------------
- if (mpp_pe() == mpp_root_pe() ) then
- call error_mesg ('donner_deep_mod', 'read_restart_nc:&
- &Reading netCDF formatted restart file: &
- &INPUT/donner_deep.res.nc', NOTE)
+ dim_names2 = (/"xaxis_1", "yaxis_1", "zaxis_2", "Time "/)
+ call register_axis(Til_restart, "zaxis_2", size(Don_save%cell_up_mass_flux, 3))
+
+ call register_restart_field(Til_restart, 'cemetf', Don_save%cemetf, dim_names)
+ call register_restart_field(Til_restart, 'cememf', Don_save%cememf, dim_names)
+ call register_restart_field(Til_restart, 'mass_flux', Don_save%mass_flux, dim_names)
+ call register_restart_field(Til_restart, 'cell_up_mass_flux', Don_save%cell_up_mass_flux, dim_names2)
+ call register_restart_field(Til_restart, 'det_mass_flux', Don_save%det_mass_flux, dim_names)
+ call register_restart_field(Til_restart, 'dql_strat', Don_save%dql_strat, dim_names)
+ call register_restart_field(Til_restart, 'dqi_strat', Don_save%dqi_strat, dim_names)
+ call register_restart_field(Til_restart, 'dqa_strat', Don_save%dqa_strat, dim_names)
+ call register_restart_field(Til_restart, 'tprea1', Don_save%tprea1, dim_names2d)
+ call register_restart_field(Til_restart, 'humidity_area', Don_save%humidity_area, dim_names)
+ call register_restart_field(Til_restart, 'humidity_factor', Don_save%humidity_factor, dim_names)
+ if (Initialized%do_donner_tracer) then
+ do n=1,ntracers
+ call register_restart_field(Til_restart, 'tracer_tends_'// trim(Don_save%tracername(n)), &
+ Don_save%tracer_tends(:,:,:,n), dim_names)
+ end do
endif
+ endif
+ call register_restart_field(Til_restart, 'parcel_disp', Don_save%parcel_disp, dim_names2d)
+ call register_restart_field(Til_restart, 'lag_temp', Don_save%lag_temp, dim_names)
+ call register_restart_field(Til_restart, 'lag_vapor', Don_save%lag_vapor, dim_names)
+ call register_restart_field(Til_restart, 'lag_press', Don_save%lag_press, dim_names)
-!-------------------------------------------------------------------
-! read the values of conv_alarm when the restart file was written and
-! the frequency of calculating donner deep convection effects in the
-! job which wrote the file.
-!-------------------------------------------------------------------
- call read_data(fname, 'conv_alarm', Initialized%conv_alarm, &
- no_domain=.true.)
- call read_data(fname, 'donner_deep_freq', old_freq, &
- no_domain=.true.)
-
-!----------------------------------------------------------------------
-! call field_size to determine if variable cemetf is present in the
-! restart file.
-!----------------------------------------------------------------------
- call field_size(fname, 'cemetf', siz, field_found=field_found)
-
-!---------------------------------------------------------------------
-! if the frequency of calculating deep convection has changed,
-! redefine the time remaining until the next calculation.
-!---------------------------------------------------------------------
- if (Nml%donner_deep_freq /= old_freq) then
- Initialized%conv_alarm = Initialized%conv_alarm - old_freq + &
- Nml%donner_deep_freq
- if (mpp_pe() == mpp_root_pe()) then
- call error_mesg ('donner_deep_mod', 'read_restart_nc: &
- &donner_deep time step has changed', NOTE)
- endif
-
-!----------------------------------------------------------------------
-! if cemetf is not present, then this is a reduced restart file. it
-! is not safe to change the frequency of calculating donner
-! effects when reading a reduced restart file, so a fatal error is
-! generated.
-!----------------------------------------------------------------------
- if (.not. field_found) then
- call error_mesg ('donner_deep_mod', 'read_restart_nc: &
- & cannot use reduced restart file and change donner_deep_freq&
- & within experiment and guarantee restart reproducibility', &
- FATAL)
- endif
- endif !(donner_deep_freq /= old_freq)
-
-!---------------------------------------------------------------------
-! read the restart data that is present in a full restart but absent
-! in a reduced restart.
-!---------------------------------------------------------------------
- if (field_found) then
- call read_data (fname, 'cemetf', Don_save%cemetf)
- call read_data (fname, 'cememf', Don_save%cememf)
- call read_data (fname, 'mass_flux', Don_save%mass_flux)
- call read_data (fname, 'dql_strat', Don_save%dql_strat)
- call read_data (fname, 'dqi_strat', Don_save%dqi_strat)
- call read_data (fname, 'dqa_strat', Don_save%dqa_strat)
- call read_data (fname, 'tprea1', Don_save%tprea1)
- call read_data (fname, 'humidity_area', Don_save%humidity_area)
-
-!---------------------------------------------------------------------
-! determine if humidity_factor is in file. if it is, read the values
-! into Don_Save%humidity_factor. if it is not (it is an older file),
-! it is only required if donner_deep will not be called on the first
-! step of this job.
-! if that is the case, stop with a fatal error; otherwise, continue on,
-! since humidity_factor will be calculated before it is used.
-!---------------------------------------------------------------------
- call field_size(fname, 'humidity_factor', siz, &
- field_found=field_found4)
- if (field_found4) then
- call read_data (fname, 'humidity_factor', &
- Don_save%humidity_factor)
- else if (Initialized%conv_alarm > 0) then
- call error_mesg ('donner_deep_mod', &
- 'cannot restart with this restart file unless donner_deep &
- &calculated on first step', FATAL)
- endif
-
-!----------------------------------------------------------------------
-! determine if det_mass_flux is present in the file.
-!----------------------------------------------------------------------
- call field_size(fname, 'det_mass_flux', siz, &
- field_found=field_found2)
-
-!----------------------------------------------------------------------
-! if it is present, then read det_mass_flux and cell_up_mass_flux.
-!----------------------------------------------------------------------
- if (field_found2) then
- call read_data (fname, 'det_mass_flux', Don_save%det_mass_flux)
- call read_data (fname, 'cell_up_mass_flux', &
- Don_save%cell_up_mass_flux)
-
-!----------------------------------------------------------------------
-! if it is not present (an earlier version of this file), set
-! det_mass_flux and cell_up_mass_flux to default values.
-!----------------------------------------------------------------------
- else
- Don_save%det_mass_flux = 0.0
- Don_save%cell_up_mass_flux = 0.0
- endif
-
-!------------------------------------------------------------------
-! if tracers are to be transported, see if tendencies are available
-! in the restart file.
-!------------------------------------------------------------------
- if (Initialized%do_donner_tracer) then
-
-!---------------------------------------------------------------------
-! initialize a logical array indicating whether the data for each
-! tracer is available.
-!---------------------------------------------------------------------
- success = .false.
-
-!---------------------------------------------------------------------
-! open the restart file with mpp_open so that the unit number is
-! available. obtain needed file characteristics by calling
-! mpp_read_meta and mpp_get_info.
-!---------------------------------------------------------------------
- call mpp_open(iuic, fname2, &
- action=MPP_RDONLY, form=MPP_NETCDF, threading=MPP_SINGLE )
- call mpp_read_meta (iuic)
- call mpp_get_info (iuic, ndim, nvar, natt, ntime)
-
-!---------------------------------------------------------------------
-! obtain information on the file variables by calling mpp_get_fields.
-! it is returned in a field_type variable tracer_fields; the specific
-! information needed is the variable name.
-!---------------------------------------------------------------------
- allocate (tracer_fields(nvar))
- if (mpp_pe() == mpp_root_pe()) then
- call mpp_get_fields (iuic, tracer_fields)
- endif
-
-!---------------------------------------------------------------------
-! call get_number_tracers to determine how many tracers are registered
-! with tracer manager. allocate an array to hold their tracer indices.
-! call get_tracer_indices to retrieve the tracer indices.
-!---------------------------------------------------------------------
- call get_number_tracers (MODEL_ATMOS, num_tracers=n_alltracers)
- allocate (ntindices(n_alltracers))
- call get_tracer_indices (MODEL_ATMOS, ind=ntindices)
-
-!----------------------------------------------------------------------
-! loop over the tracers, obtaining their names via a call to
-! get_tracer_names. bypass those tracers known to not be transported
-! by donner convection.
-!----------------------------------------------------------------------
- do it=1,n_alltracers
- call get_tracer_names (MODEL_ATMOS, ntindices(it), tname)
- if (tname == "sphum" ) cycle
- if (tname == "liq_wat") cycle
- if (tname == "ice_wat") cycle
- if (tname == "cld_amt") cycle
-
-!--------------------------------------------------------------------
-! initialize a logical indicating whether this tracer is in the
-! restart file.
-!--------------------------------------------------------------------
- is_tracer_in_restart_file = .FALSE.
-
-!---------------------------------------------------------------------
-! loop over the variables in the restart file to determine if the
-! current tracer's time tendency field is present.
-!---------------------------------------------------------------------
- do jn=1,nvar
- if (lowercase (trim(mpp_get_field_name(tracer_fields(jn)))) == &
- lowercase ('tracer_tends_' // trim(tname)) ) then
-
-!---------------------------------------------------------------------
-! if tracer tendency is in restart file, write a message. set the
-! logical flag indicating such to .true..
-!---------------------------------------------------------------------
- if (mpp_pe() == mpp_root_pe() ) then
- print *,'tracer_tends_' // trim(tname), ' found!'
- endif
- is_tracer_in_restart_file = .TRUE.
-
-!---------------------------------------------------------------------
-! loop over the tracers being transported by donner convection in this
-! job to determine if this tracer is one of those being transported.
-! determine the tracer index in tracername array corresponding to
-! this tracer.
-!---------------------------------------------------------------------
- do nn=1,ntracers
- if (lowercase( 'tracer_tends_' // trim(tname) ) == &
- 'tracer_tends_' // Don_save%tracername(nn) ) then
-
-!---------------------------------------------------------------------
-! if data for this tracer is needed, read data into proper section of
-! array tracer_tends. set the logical flag for this tracer indicating
-! successful retrieval. exit this loop.
-!---------------------------------------------------------------------
- call read_data (fname, &
- 'tracer_tends_' // trim(tname), &
- Don_save%tracer_tends(:,:,:,nn))
- success(nn) = .true.
- exit
- endif
- end do ! (nn)
- endif
-
-!---------------------------------------------------------------------
-! if desired tracer has been found, stop searching the restart file
-! variables for this tracer and cycle to begin searching the restart
-! file for the next field_table tracer.
-!---------------------------------------------------------------------
- if (is_tracer_in_restart_file) exit
- end do ! (jn)
- end do ! (it)
-
-!---------------------------------------------------------------------
-! initialize the time tendencies to 0.0 for any tracers that are to
-! be transported and whose time tendencies were not found on the
-! restart file. enter a message in the output file.
-!---------------------------------------------------------------------
- do nn=1,ntracers
- if (success(nn) ) then
- else
- call error_mesg ('donner_deep_mod', 'read_restart_nc: &
- &did not find tracer restart data for ' // &
- trim(Don_save%tracername(nn)) // &
- '; am initializing tendency to 0.0', NOTE)
- Don_save%tracer_tends(:,:,:,nn) = 0.0
- endif
- end do
-
-!----------------------------------------------------------------------
-! deallocate local variables.
-!----------------------------------------------------------------------
- deallocate (ntindices)
- deallocate (tracer_fields)
- endif ! (do_donner_tracer)
- endif ! (field_found)
-
-!---------------------------------------------------------------------
-! read the restart data that is present in both full and reduced
-! restart files.
-!---------------------------------------------------------------------
- call read_data (fname, 'parcel_disp', Don_save%parcel_disp)
- call read_data (fname, 'lag_temp', Don_save%lag_temp)
- call read_data (fname, 'lag_vapor', Don_save%lag_vapor)
- call read_data (fname, 'lag_press', Don_save%lag_press)
-
-!---------------------------------------------------------------------
-
-
-
-
-end subroutine read_restart_nc
-
-
+end subroutine fms_donner_register_restart_domain
!#####################################################################
@@ -3818,143 +3544,6 @@ end subroutine donner_deep_netcdf
!#####################################################################
-subroutine write_restart (ntracers, Don_save, Initialized, Nml)
-
-!--------------------------------------------------------------------
-! subroutine write_restart is a template to be used if a native mode
-! restart file MUST be generated. currently, if a native mode file is
-! requested, a netcdf file will be witten instead, and an informative
-! message provided.
-!--------------------------------------------------------------------
-
-integer, intent(in) :: ntracers
-type(donner_initialized_type), intent(inout) :: Initialized
-type(donner_save_type), intent(inout) :: Don_save
-type(donner_nml_type), intent(inout) :: Nml
-
-!----------------------------------------------------------------------
-! intent(in) variables:
-!
-! ntracers number of tracers to be transported by
-! the donner deep convection parameterization
-!
-!--------------------------------------------------------------------
-
-!--------------------------------------------------------------------
-! local variables:
-
-! integer :: unit ! unit number for restart file
-! integer :: n ! do-loop index
-
-!-------------------------------------------------------------------
-! currently code is provided only for writing netcdf restart files.
-! if a non-netcdf restart file has been requested, this routine will
-! issue a message, and then call the routine to write the netcdf file.
-! if the user is insistent on a native mode restart file, the code to
-! read and write such files (subroutines write_restart and
-! read_restart_file) must be updated to be compatible with the cur-
-! rent versions of write_restart_nc and read_restart_nc, and the
-! code immediately below eliminated. the commented code below repres-
-! ents a starting point for the write_restart routine; it is not
-! kept up-to-date as far as the variables which must be written.
-!-------------------------------------------------------------------
- call error_mesg ('donner_deep_mod', 'write_restart: &
- &writing a netcdf restart despite request for native &
- &format (not currently supported); if you must have native &
- &mode, then you must update the source code and remove &
- &this if loop.', NOTE)
-! call write_restart_nc (ntracers, Don_save, Initialized, Nml)
-
-!-------------------------------------------------------------------
-! open unit for restart file.
-!-------------------------------------------------------------------
-! unit = open_restart_file ('RESTART/donner_deep.res', 'write')
-
-!-------------------------------------------------------------------
-! file writing is currently single-threaded. write out restart
-! version, time remaining until next call to donner_deep_mod and
-! the frequency of calculating donner_deep convection.
-!-------------------------------------------------------------------
-! if (mpp_pe() == mpp_root_pe()) then
-! write (unit) restart_versions(size(restart_versions(:)))
-! write (unit) Initialized%conv_alarm, donner_deep_freq
-! endif
-
-!-------------------------------------------------------------------
-! write out the donner_deep restart variables.
-! cemetf - heating rate due to donner_deep
-! cememf - moistening rate due to donner_deep
-! xcape_lag - cape value which will be used on next step in
-! calculation od dcape/dt
-!-------------------------------------------------------------------
-! call write_data (unit, Don_save%cemetf)
-! call write_data (unit, Don_save%cememf)
-
-!--------------------------------------------------------------------
-! the following variables are needed when a prognostic cloud scheme
-! is being used. they are always present in the restart file, having
-! been initialized to zero, if prognostic clouds are not active.
-!--------------------------------------------------------------------
-! call write_data (unit, Don_save%mass_flux)
-! call write_data (unit, Don_save%dql_strat )
-! call write_data (unit, Don_save%dqi_strat )
-! call write_data (unit, Don_save%dqa_strat )
-
-!----------------------------------------------------------------------
-!
-!-------------------------------------------------------------------
-! write out more donner_deep restart variables.
-! qint_lag - column integrated water vapor mixing ratio
-! parcel_disp - time-integrated low-level vertical displacement
-! tprea1 - precipitation due to donner_deep_mod
-!----------------------------------------------------------------------
-! call write_data (unit, Don_save%parcel_disp)
-! call write_data (unit, Don_save%tprea1)
-! call write_data (unit, Don_save%lag_temp)
-! call write_data (unit, Don_save%lag_vapor)
-! call write_data (unit, Don_save%lag_press)
-! call write_data (unit, Don_save%humidity_area)
-! call write_data (unit, Don_save%humidity_ratio)
-
-!---------------------------------------------------------------------
-! write out the number of tracers that are being transported by
-! donner_deep_mod.
-!---------------------------------------------------------------------
-! if (mpp_pe() == mpp_root_pe()) then
-! write (unit) ntracers
-! endif
-
-!----------------------------------------------------------------------
-! if tracers are being transported, write out their names and
-! current time tendencies.
-!----------------------------------------------------------------------
-! if (Initialized%do_donner_tracer) then
-! do n=1,ntracers
-! if (mpp_pe() == mpp_root_pe()) then
-! write (unit) Don_save%tracername(n)
-! endif
-! call write_data(unit, Don_save%tracer_tends(:,:,:,n))
-! end do
-! endif
-
-!-------------------------------------------------------------------
-! close restart file unit.
-!------------------------------------------------------------------
-! call close_file (unit)
-
-!---------------------------------------------------------------------
-
-
-end subroutine write_restart
-
-
-
-
-!######################################################################
-
-
-
-
!######################################################################
diff --git a/atmos_param/dry_adj/dry_adj.F90 b/atmos_param/dry_adj/dry_adj.F90
index 9fca0772..8afd05fd 100644
--- a/atmos_param/dry_adj/dry_adj.F90
+++ b/atmos_param/dry_adj/dry_adj.F90
@@ -5,9 +5,9 @@ MODULE DRY_ADJ_MOD
!=======================================================================
use mpp_mod, only: input_nml_file
- use Fms_Mod, ONLY: FILE_EXIST, ERROR_MESG, OPEN_NAMELIST_FILE, &
+ use Fms_Mod, ONLY: ERROR_MESG, &
CHECK_NML_ERROR, &
- mpp_pe, mpp_root_pe, FATAL, WARNING, CLOSE_FILE, &
+ mpp_pe, mpp_root_pe, FATAL, WARNING, &
stdlog, write_version_number
use Constants_Mod, ONLY: Grav, Kappa
!---------------------------------------------------------------------
@@ -194,7 +194,7 @@ SUBROUTINE DRY_ADJ_INIT()
! (Intent local)
!---------------------------------------------------------------------
- integer :: unit, io, ierr, logunit
+ integer :: io, ierr, logunit
!=====================================================================
@@ -202,20 +202,8 @@ SUBROUTINE DRY_ADJ_INIT()
! --- READ NAMELIST
!---------------------------------------------------------------------
-#ifdef INTERNAL_FILE_NML
read (input_nml_file, nml=dry_adj_nml, iostat=io)
ierr = check_nml_error(io,"dry_adj_nml")
-#else
- if( FILE_EXIST( 'input.nml' ) ) then
- unit = OPEN_NAMELIST_FILE ()
- ierr = 1
- do while ( ierr /= 0 )
- READ( unit, nml = dry_adj_nml, iostat = io, end = 10 )
- ierr = check_nml_error(io,'dry_adj_nml')
- end do
- 10 CALL CLOSE_FILE ( unit )
- end if
-#endif
!------- write version number and namelist ---------
diff --git a/atmos_param/edt/edt.F90 b/atmos_param/edt/edt.F90
index 38cea120..8dfab8f7 100644
--- a/atmos_param/edt/edt.F90
+++ b/atmos_param/edt/edt.F90
@@ -55,13 +55,16 @@ module edt_mod
tfreeze,radian
use mpp_mod, only: input_nml_file
-use fms_mod, only: file_exist, open_namelist_file, error_mesg, FATAL,&
- NOTE, mpp_pe, mpp_root_pe, close_file, read_data, &
- write_data, write_version_number, stdlog, &
- open_file, check_nml_error
-use fms_io_mod, only: register_restart_field, restart_file_type, &
- save_restart, restore_state
-
+use mpp_domains_mod, only: domain2D
+use fms_mod, only: error_mesg, FATAL,&
+ NOTE, mpp_pe, mpp_root_pe, &
+ write_version_number, stdlog, &
+ check_nml_error
+use fms2_io_mod, only: file_exists, FmsNetcdfFile_t, FmsNetcdfDomainFile_t, &
+ register_restart_field, register_axis, unlimited, &
+ open_file, read_restart, write_restart, close_file, &
+ register_field, write_data, register_variable_attribute, &
+ get_global_io_domain_indices
use diag_manager_mod, only: register_diag_field, send_data
use time_manager_mod, only: time_type, get_date, month_name
@@ -96,8 +99,6 @@ module edt_mod
real, allocatable, dimension(:,:,:) :: sigmas ! standard deviation of
! water perturbation
! (kg water/kg air)
-
-type(restart_file_type), pointer, save :: edt_restart => NULL()
!-----------------------------------------------------------------------
!
! set default values to namelist parameters
@@ -286,6 +287,8 @@ module edt_mod
integer, dimension(1) :: restart_versions = (/ 1 /)
+ type (domain2D), pointer :: edt_domain !< Atmosphere domain
+
contains
@@ -300,7 +303,7 @@ module edt_mod
! and initializes some constants.
!
-subroutine edt_init(lonb, latb, axes,time,idim,jdim,kdim)
+subroutine edt_init(domain, lonb, latb, axes,time,idim,jdim,kdim)
!-----------------------------------------------------------------------
!
@@ -325,7 +328,7 @@ subroutine edt_init(lonb, latb, axes,time,idim,jdim,kdim)
! half indices for half level axes coordinates
!
!-----------------------------------------------------------------------
-
+type(domain2D),target,intent(in) :: domain !< Atmosphere domain
integer, intent(in) :: idim,jdim,kdim,axes(4)
type(time_type), intent(in) :: time
real, dimension(:,:), intent(in) :: lonb, latb
@@ -335,23 +338,14 @@ subroutine edt_init(lonb, latb, axes,time,idim,jdim,kdim)
character(len=4) :: chvers
integer, dimension(3) :: full = (/1,2,3/), half = (/1,2,4/)
+type(FmsNetcdfDomainFile_t) :: Edt_restart !< Fms2io domain_decomposed fileobj
+
!-----------------------------------------------------------------------
!
! namelist functions
-#ifdef INTERNAL_FILE_NML
read (input_nml_file, nml=edt_nml, iostat=io)
ierr = check_nml_error(io,'edt_nml')
-#else
- if (file_exist('input.nml')) then
- unit = open_namelist_file ()
- ierr=1 ; Do While (ierr .ne. 0)
- Read (unit, nml=edt_nml, iostat=io, End=10)
- ierr = check_nml_error(io,'edt_nml')
- enddo
-10 Call Close_File (unit)
- endif
-#endif
!------- write version number and namelist ---------
@@ -470,8 +464,7 @@ subroutine edt_init(lonb, latb, axes,time,idim,jdim,kdim)
!----------------------------------------------------------------------
! open a unit for the radiation diagnostics output.
!---------------------------------------------------------------------
- dpu = open_file ('edt.out', action='write', &
- threading='multi', form='formatted')
+ open(file="edt.out", form='formatted',action='write', newunit=dpu)
do_print = .true.
if ( mpp_pe() == mpp_root_pe() ) then
@@ -505,58 +498,20 @@ subroutine edt_init(lonb, latb, axes,time,idim,jdim,kdim)
if (allocated(sigmas)) deallocate (sigmas)
allocate(sigmas(idim,jdim,kdim+1))
+ edt_domain => domain
- allocate(edt_restart)
- id_restart = register_restart_field(edt_restart, 'edt.res.nc', 'qaturb' , qaturb )
- id_restart = register_restart_field(edt_restart, 'edt.res.nc', 'qcturb' , qcturb )
- id_restart = register_restart_field(edt_restart, 'edt.res.nc', 'tblyrtau', tblyrtau )
- id_restart = register_restart_field(edt_restart, 'edt.res.nc', 'sigmas' , sigmas )
-
- if (File_Exist('INPUT/edt.res.nc')) then
-
+ if (open_file(edt_restart,"INPUT/edt.res.nc","read", edt_domain, is_restart=.true.)) then
if (mpp_pe() == mpp_root_pe() ) then
call error_mesg ('edt_mod', 'Reading netCDF formatted restart file: INPUT/edt.res.nc', &
NOTE)
endif
- call restore_state(edt_restart)
+ call edt_register_restart(edt_restart)
+ call read_restart(edt_restart)
+ call close_file(edt_restart)
- elseif (File_Exist('INPUT/edt.res')) then
+ elseif (File_Exists('INPUT/edt.res')) then
call error_mesg ('edt_mod', 'Native format restart file read no longer supported.',&
FATAL)
-! unit = Open_restart_File (FILE='INPUT/edt.res', ACTION='read')
-! read (unit, iostat=io, err=142) vers, vers2
-!142 continue
-!
-!!--------------------------------------------------------------------
-!! if eor is not encountered, then the file includes tdtlw as the
-!! first record (which this read statement read). that data is not
-!! needed; note this and continue by reading next record.
-!!--------------------------------------------------------------------
-! if (io == 0) then
-! call error_mesg ('edt_mod', &
-! 'reading pre-version number edt.res file, '//&
-! 'ignoring tdtlw', NOTE)
-!
-!!--------------------------------------------------------------------
-!! if the first record was only one word long, then the file is a
-!! newer one, and that record was the version number, read into vers.
-!! if it is not a valid version, stop execution with a message.
-!!--------------------------------------------------------------------
-! else
-! if (.not. any(vers == restart_versions) ) then
-! write (chvers, '(i4)') vers
-! call error_mesg ('edt_mod', &
-! 'restart version ' // chvers//' cannot be read '//&
-! 'by this version of edt_mod.', FATAL)
-! endif
-! endif
-!
-!!---------------------------------------------------------------------
-! call read_data (unit, qaturb)
-! call read_data (unit, qcturb)
-! call read_data (unit, tblyrtau)
-! call read_data (unit, sigmas)
-! call Close_File (unit)
else
qaturb (:,:,:) = 0.
qcturb (:,:,:) = 0.
@@ -673,7 +628,33 @@ end subroutine edt_init
!
!=======================================================================
+!< edt_register_restart: registers the restart variables
+subroutine edt_register_restart(edt_restart)
+ type(FmsNetcdfDomainFile_t), intent(inout) :: Edt_restart !< Fms2io domain decomposed fileobj
+
+ character(len=8), dimension(4) :: dim_names !< String array of dimension names
+ character(len=8), dimension(4) :: dim_names2 !< String array of dimension names
+!---------------------------------------------------------------------
+ dim_names = (/"xaxis_1", "yaxis_1", "zaxis_1", "Time "/)
+ dim_names2 = (/"xaxis_1", "yaxis_1", "zaxis_2", "Time "/)
+
+ call register_axis(edt_restart, "Time", unlimited)
+ call register_axis(edt_restart, "xaxis_1", "x")
+ call register_axis(edt_restart, "yaxis_1", "y")
+ call register_axis(edt_restart, "zaxis_1", size(qaturb, 3))
+ call register_axis(edt_restart, "zaxis_2", size(sigmas, 3))
+
+ !< Register the domain decomposed dimensions as variables so that the combiner can work
+ !! correctly
+ call register_field(edt_restart, "xaxis_1", "double", (/"xaxis_1"/))
+ call register_field(edt_restart, "yaxis_1", "double", (/"yaxis_1"/))
+
+ call register_restart_field(edt_restart, 'qaturb' , qaturb, dim_names )
+ call register_restart_field(edt_restart, 'qcturb' , qcturb, dim_names )
+ call register_restart_field(edt_restart, 'tblyrtau', tblyrtau, dim_names )
+ call register_restart_field(edt_restart, 'sigmas' , sigmas, dim_names2 )
+end subroutine edt_register_restart
!=======================================================================
@@ -1526,7 +1507,7 @@ subroutine edt_end()
!-----------------------------------------------------------------------
!
! variables
-!
+ type(FmsNetcdfDomainFile_t) :: Edt_restart !< Fms2io domain decomposed fileobj
! --------
! internal
! --------
@@ -1537,13 +1518,21 @@ subroutine edt_end()
!
! write out restart file
!
- call save_restart(edt_restart)
-
+ if (open_file(edt_restart,"RESTART/edt.res.nc","overwrite", edt_domain, is_restart=.true.)) then
+ if (mpp_pe() == mpp_root_pe() ) then
+ call error_mesg ('edt_mod', 'Reading netCDF formatted restart file: INPUT/edt.res.nc', &
+ NOTE)
+ endif
+ call edt_register_restart(edt_restart)
+ call write_restart(edt_restart)
+ call add_domain_dimension_data(edt_restart)
+ call close_file(edt_restart)
+ endif
!-----------------------------------------------------------------------
!
! close edt output file if data was written for this window
- if (do_print ) call Close_File (dpu)
+ if (do_print ) close(dpu)
!-----------------------------------------------------------------------
!-----------------------------------------------------------------------
@@ -1553,6 +1542,22 @@ subroutine edt_end()
module_is_initialized = .false.
end subroutine edt_end
+!< Add_dimension_data: Adds dummy data for the domain decomposed axis
+subroutine add_domain_dimension_data(fileobj)
+ type(FmsNetcdfDomainFile_t) :: fileobj !< Fms2io domain decomposed fileobj
+ integer, dimension(:), allocatable :: buffer !< Buffer with axis data
+ integer :: is, ie !< Starting and Ending indices for data
+
+ call get_global_io_domain_indices(fileobj, "xaxis_1", is, ie, indices=buffer)
+ call write_data(fileobj, "xaxis_1", buffer)
+ deallocate(buffer)
+
+ call get_global_io_domain_indices(fileobj, "yaxis_1", is, ie, indices=buffer)
+ call write_data(fileobj, "yaxis_1", buffer)
+ deallocate(buffer)
+
+end subroutine add_domain_dimension_data
+
!
!=======================================================================
diff --git a/atmos_param/entrain/entrain.F90 b/atmos_param/entrain/entrain.F90
index 27e4b107..4c565c66 100644
--- a/atmos_param/entrain/entrain.F90
+++ b/atmos_param/entrain/entrain.F90
@@ -93,9 +93,8 @@ module entrain_mod
tfreeze, radian
use mpp_mod, only: input_nml_file
-use fms_mod, only: open_file, file_exist, open_namelist_file, &
- error_mesg, FATAL, check_nml_error, &
- mpp_pe, mpp_root_pe, close_file, &
+use fms_mod, only: error_mesg, FATAL, check_nml_error, &
+ mpp_pe, mpp_root_pe, &
stdlog, write_version_number
use diag_manager_mod, only: register_diag_field, send_data
@@ -357,20 +356,8 @@ subroutine entrain_init(lonb, latb, axes,time,idim,jdim,kdim)
!
! namelist functions
-#ifdef INTERNAL_FILE_NML
read (input_nml_file, nml=entrain_nml, iostat=io)
ierr = check_nml_error(io,"entrain_nml")
-#else
- If (File_Exist('input.nml')) Then
- unit = Open_namelist_File ()
- ierr=1
- Do While (ierr .ne. 0)
- Read (unit, nml=entrain_nml, iostat=io, End=10)
- ierr = check_nml_error (io, 'entrain_nml')
- EndDo
- 10 Call Close_File (unit)
- EndIf
-#endif
if ( mpp_pe() == mpp_root_pe() ) then
call write_version_number(Version, Tagname)
@@ -490,8 +477,7 @@ subroutine entrain_init(lonb, latb, axes,time,idim,jdim,kdim)
!-----------------------------------------------------------------------
! open a unit for the entrain diagnostics output.
!-----------------------------------------------------------------------
- dpu = open_file ('entrain.out', action='write', &
- threading='multi', form='formatted')
+ open(file='entrain.out', form='formatted',action='write', newunit=dpu)
do_print = .true.
if ( mpp_pe() == mpp_root_pe() ) then
call write_version_number(Version, Tagname, dpu)
diff --git a/atmos_param/grey_radiation/grey_radiation.F90 b/atmos_param/grey_radiation/grey_radiation.F90
index 46369797..4de2b4a8 100644
--- a/atmos_param/grey_radiation/grey_radiation.F90
+++ b/atmos_param/grey_radiation/grey_radiation.F90
@@ -11,9 +11,9 @@ module grey_radiation_mod
! get_domain_decomp, check_system_clock
use mpp_mod, only: input_nml_file
- use fms_mod, only: open_namelist_file, check_nml_error, &
- mpp_pe, mpp_root_pe, close_file, &
- write_version_number, stdlog, file_exist
+ use fms_mod, only: check_nml_error, &
+ mpp_pe, mpp_root_pe, &
+ write_version_number, stdlog
use constants_mod, only: stefan, cp_air, grav
@@ -122,24 +122,12 @@ subroutine grey_radiation_init(axes, Time)
type(time_type), intent(in) :: Time
!-------------------------------------------------------------------------------------
integer, dimension(3) :: half = (/1,2,4/)
-integer :: ierr, io, unit, logunit
+integer :: ierr, io, logunit
!-----------------------------------------------------------------------------------------
! read namelist and copy to logfile
-#ifdef INTERNAL_FILE_NML
read (input_nml_file, nml=grey_radiation_nml, iostat=io)
ierr = check_nml_error(io,'grey_radiation_nml')
-#else
- if ( file_exist('input.nml')) then
- unit = open_namelist_file ( )
- ierr=1
- do while (ierr /= 0)
- read (unit, nml=grey_radiation_nml, iostat=io, end=10)
- ierr = check_nml_error (io, 'grey_radiation_nml')
- enddo
-10 call close_file (unit)
- endif
-#endif
call write_version_number ( version, tagname )
if ( mpp_pe() == mpp_root_pe() ) then
diff --git a/atmos_param/lin_cloud_microphys/lin_cloud_microphys.F90 b/atmos_param/lin_cloud_microphys/lin_cloud_microphys.F90
index 9c27fc85..4429225b 100644
--- a/atmos_param/lin_cloud_microphys/lin_cloud_microphys.F90
+++ b/atmos_param/lin_cloud_microphys/lin_cloud_microphys.F90
@@ -11,8 +11,8 @@ module lin_cld_microphys_mod
use diag_manager_mod, only: register_diag_field, send_data
use time_manager_mod, only: time_type, get_time
use constants_mod, only: grav, rdgas, rvgas, cp_air, cp_vapor, hlv, hlf, kappa, pi
- use fms_mod, only: write_version_number, open_namelist_file, &
- check_nml_error, file_exist, close_file, &
+ use fms_mod, only: write_version_number, &
+ check_nml_error, &
error_mesg, FATAL
implicit none
@@ -3214,7 +3214,7 @@ subroutine lin_cld_microphys_init(id, jd, kd, axes, time, hydrostatic_in,&
type(time_type), intent(in) :: time
logical, intent(in) :: hydrostatic_in, phys_hydrostatic_in
- integer :: unit, io, ierr, k, logunit
+ integer :: io, ierr, k, logunit
logical :: flag
real :: tmp, q1, q2
@@ -3223,20 +3223,9 @@ subroutine lin_cld_microphys_init(id, jd, kd, axes, time, hydrostatic_in,&
hydrostatic = hydrostatic_in
phys_hydrostatic = phys_hydrostatic_in
-#ifdef INTERNAL_FILE_NML
read( input_nml_file, nml = lin_cld_microphys_nml, iostat = io )
ierr = check_nml_error(io,'lin_cloud_microphys_nml')
-#else
- if( file_exist( 'input.nml' ) ) then
- unit = open_namelist_file ()
- io = 1
- do while ( io .ne. 0 )
- read( unit, nml = lin_cld_microphys_nml, iostat = io, end = 10 )
- ierr = check_nml_error(io,'lin_cloud_microphys_nml')
- end do
-10 call close_file ( unit )
- end if
-#endif
+
call write_version_number (version, tagname)
logunit = stdlog()
diff --git a/atmos_param/lscale_cond/lscale_cond.F90 b/atmos_param/lscale_cond/lscale_cond.F90
index 87d09788..121a9524 100644
--- a/atmos_param/lscale_cond/lscale_cond.F90
+++ b/atmos_param/lscale_cond/lscale_cond.F90
@@ -3,9 +3,9 @@ module lscale_cond_mod
!-----------------------------------------------------------------------
use mpp_mod, only: input_nml_file
-use fms_mod, only: file_exist, error_mesg, open_namelist_file, &
+use fms_mod, only: error_mesg, &
check_nml_error, mpp_pe, mpp_root_pe, FATAL, &
- close_file, write_version_number, stdlog
+ write_version_number, stdlog
use sat_vapor_pres_mod, only: compute_qs
use constants_mod, only: HLv,HLs,Cp_Air,Grav,rdgas,rvgas
@@ -244,23 +244,12 @@ subroutine lscale_cond_init ()
!
!-----------------------------------------------------------------------
- integer unit,io,ierr, logunit
+ integer io,ierr, logunit
!----------- read namelist ---------------------------------------------
-#ifdef INTERNAL_FILE_NML
read (input_nml_file, nml=lscale_cond_nml, iostat=io)
ierr = check_nml_error(io,"lscale_cond_nml")
-#else
- if (file_exist('input.nml')) then
- unit = open_namelist_file ()
- ierr=1; do while (ierr /= 0)
- read (unit, nml=lscale_cond_nml, iostat=io, end=10)
- ierr = check_nml_error (io,'lscale_cond_nml')
- enddo
- 10 call close_file (unit)
- endif
-#endif
!---------- output namelist --------------------------------------------
diff --git a/atmos_param/lscloud_driver/lscloud_debug.F90 b/atmos_param/lscloud_driver/lscloud_debug.F90
index bbd69f7b..7c360235 100644
--- a/atmos_param/lscloud_driver/lscloud_debug.F90
+++ b/atmos_param/lscloud_driver/lscloud_debug.F90
@@ -3,9 +3,8 @@ module lscloud_debug_mod
use mpp_mod, only : input_nml_file
-use fms_mod, only : file_exist, open_namelist_file,&
- open_file, error_mesg, FATAL, NOTE, &
- mpp_pe, mpp_root_pe, close_file, &
+use fms_mod, only : error_mesg, FATAL, NOTE, &
+ mpp_pe, mpp_root_pe, &
stdlog, check_nml_error, &
write_version_number, stdout
use lscloud_types_mod, only : lscloud_types_init, lscloud_debug_type, &
@@ -105,7 +104,7 @@ subroutine lscloud_debug_init (debug_out)
! initialize the lscloud_debug module.
!------------------------------------------------------------------------
- integer :: io, ierr, logunit, unit
+ integer :: io, ierr, logunit
!------------------------------------------------------------------------
! if module is already initialized, return.
@@ -119,19 +118,8 @@ subroutine lscloud_debug_init (debug_out)
!-----------------------------------------------------------------------
! process namelist.
!-----------------------------------------------------------------------
-#ifdef INTERNAL_FILE_NML
read (input_nml_file, nml=lscloud_debug_nml, iostat=io)
ierr = check_nml_error(io,'lscloud_debug_nml')
-#else
- if ( file_exist('input.nml')) then
- unit = open_namelist_file ()
- ierr=1; do while (ierr /= 0)
- read (unit, nml=lscloud_debug_nml, iostat=io, end=10)
- ierr = check_nml_error(io,'lscloud_debug_nml')
- enddo
-10 call close_file (unit)
- endif
-#endif
!-----------------------------------------------------------------------
! write version and namelist to stdlog.
@@ -189,8 +177,7 @@ subroutine lscloud_debug_init (debug_out)
! if any debugging is desired, open a file to hold the output.
!-------------------------------------------------------------------------
if (Debug%debugo ) then
- Debug%otun = open_file (otname, threading = 'multi', &
- action = 'append')
+ open(file=otname, form='formatted',action='write', position="append", newunit=Debug%otun)
else
Debug%otun = 0
endif
diff --git a/atmos_param/lscloud_driver/lscloud_driver.F90 b/atmos_param/lscloud_driver/lscloud_driver.F90
index b348aed5..46ca8f23 100644
--- a/atmos_param/lscloud_driver/lscloud_driver.F90
+++ b/atmos_param/lscloud_driver/lscloud_driver.F90
@@ -19,17 +19,15 @@ module lscloud_driver_mod
use time_manager_mod, only: time_type
use diag_manager_mod, only: register_diag_field, send_data
use mpp_mod, only: input_nml_file
+use mpp_domains_mod, only: domain2D
use fms_mod, only: error_mesg, FATAL, NOTE, &
- file_exist, check_nml_error, &
- open_namelist_file, close_file, &
+ check_nml_error, &
write_version_number, &
- open_file, &
- stdout, open_ieee32_file, &
+ stdout, &
mpp_pe, mpp_root_pe, stdlog, &
mpp_clock_id, mpp_clock_begin, &
mpp_clock_end, CLOCK_MODULE, &
- CLOCK_MODULE_DRIVER, &
- MPP_CLOCK_SYNC
+ CLOCK_MODULE_DRIVER
use field_manager_mod, only: MODEL_ATMOS
use tracer_manager_mod, only: get_tracer_names, get_tracer_index, &
NO_TRACER
@@ -301,10 +299,11 @@ module lscloud_driver_mod
!#######################################################################
-subroutine lscloud_driver_init (id, jd, kd, axes, Time, &
+subroutine lscloud_driver_init (domain, id, jd, kd, axes, Time, &
Exch_ctrl, Nml_mp, Physics_control, &
lon, lat, phalf, pref)
+type(domain2D), target, intent(in) :: domain !< Atmosphere domain
integer, intent(in) :: id, jd, kd
integer, intent(in) :: axes(4)
type(time_type), intent(in) :: Time
@@ -473,20 +472,9 @@ subroutine lscloud_driver_init (id, jd, kd, axes, Time, &
!-----------------------------------------------------------------------
! process namelist.
-!-----------------------------------------------------------------------
-#ifdef INTERNAL_FILE_NML
+!-----------------------------------------------------------------------
read (input_nml_file, nml=lscloud_driver_nml, iostat=io)
ierr = check_nml_error(io,'lscloud_driver_nml')
-#else
- if ( file_exist('input.nml')) then
- unit = open_namelist_file ()
- ierr=1; do while (ierr /= 0)
- read (unit, nml=lscloud_driver_nml, iostat=io, end=10)
- ierr = check_nml_error(io,'lscloud_driver_nml')
- enddo
-10 call close_file (unit)
- endif
-#endif
!-----------------------------------------------------------------------
! write version and namelist to stdlog.
@@ -768,7 +756,7 @@ subroutine lscloud_driver_init (id, jd, kd, axes, Time, &
! initialize the rh_clouds module, if needed.
!----------------------------------------------------------------------
if (Nml_mp%do_rh_clouds) then
- call rh_clouds_init (id, jd, kd)
+ call rh_clouds_init (domain, id, jd, kd)
endif
call mpp_clock_end (lscalecond_init_clock)
endif
diff --git a/atmos_param/macrophysics/ls_cloud_macrophysics.F90 b/atmos_param/macrophysics/ls_cloud_macrophysics.F90
index f7c986ae..a228b5a5 100644
--- a/atmos_param/macrophysics/ls_cloud_macrophysics.F90
+++ b/atmos_param/macrophysics/ls_cloud_macrophysics.F90
@@ -17,14 +17,14 @@ module ls_cloud_macrophysics_mod
use time_manager_mod, only: time_type
use mpp_mod, only: input_nml_file
use fms_mod, only: error_mesg, FATAL, NOTE, &
- file_exist, check_nml_error, &
- open_namelist_file, close_file, &
+ check_nml_error, &
write_version_number, &
mpp_pe, mpp_root_pe, stdlog, &
mpp_clock_id, mpp_clock_begin, &
mpp_clock_end, CLOCK_MODULE, &
CLOCK_MODULE_DRIVER, &
- MPP_CLOCK_SYNC, read_data, write_data
+ MPP_CLOCK_SYNC
+use fms2_io_mod, only: file_exists
use physics_types_mod, only: physics_control_type
! atmos_param modules
@@ -125,7 +125,7 @@ subroutine ls_cloud_macrophysics_init &
!------------------------------------------------------------------------
! local variables:
- integer :: ierr, unit, io, logunit
+ integer :: ierr, io, logunit
integer :: tiedtke_init_clock, clubb_init_clock
!-----------------------------------------------------------------------
@@ -135,20 +135,9 @@ subroutine ls_cloud_macrophysics_init &
!-----------------------------------------------------------------------
! process the ls_cloud_macrophysics_nml.
!-----------------------------------------------------------------------
- if ( file_exist('input.nml')) then
-#ifdef INTERNAL_FILE_NML
+ if ( file_exists('input.nml')) then
read (input_nml_file, nml=ls_cloud_macrophysics_nml, iostat=io)
ierr = check_nml_error(io,'ls_cloud_macrophysics_nml')
-#else
-
- unit = open_namelist_file ( )
- ierr=1; do while (ierr /= 0)
- read (unit, nml=ls_cloud_macrophysics_nml, iostat=io, end=10)
- ierr = check_nml_error(io,'ls_cloud_macrophysics_nml')
- enddo
- 10 call close_file (unit)
-#endif
-
!--------- write version and namelist to standard log ------------
call write_version_number ( version, tagname )
diff --git a/atmos_param/macrophysics/tiedtke_macro.F90 b/atmos_param/macrophysics/tiedtke_macro.F90
index fee7cd7d..2ca9c6b7 100644
--- a/atmos_param/macrophysics/tiedtke_macro.F90
+++ b/atmos_param/macrophysics/tiedtke_macro.F90
@@ -2,9 +2,9 @@ module tiedtke_macro_mod
use mpp_mod, only : input_nml_file
use fms_mod, only : FATAL, error_mesg, mpp_pe, &
- mpp_root_pe, open_namelist_file, &
- check_nml_error, close_file, &
- write_version_number, file_exist, &
+ mpp_root_pe, &
+ check_nml_error, &
+ write_version_number, &
stdlog
use constants_mod, only : GRAV, TFREEZE, CP_AIR, HLV, HLS, &
RVGAS, pi
@@ -161,7 +161,7 @@ SUBROUTINE tiedtke_macro_init (Nml_mp, Nml_lsc, Constants_lsc, Exch_ctrl)
!-----------------------------------------------------------------------
!---local variables----
- integer :: unit, io, ierr, logunit
+ integer :: io, ierr, logunit
!-----------------------------------------------------------------------
if (module_is_initialized) return
@@ -169,19 +169,8 @@ SUBROUTINE tiedtke_macro_init (Nml_mp, Nml_lsc, Constants_lsc, Exch_ctrl)
!-------------------------------------------------------------------------
! process namelist.
!-------------------------------------------------------------------------
-#ifdef INTERNAL_FILE_NML
read (input_nml_file, nml=tiedtke_macro_nml, iostat=io)
ierr = check_nml_error(io,'tiedtke_macro_nml')
-#else
- if ( file_exist('input.nml')) then
- unit = open_namelist_file ( )
- ierr=1; do while (ierr /= 0)
- read (unit, nml=tiedtke_macro_nml, iostat=io, end=10)
- ierr = check_nml_error(io,'tiedtke_macro_nml')
- enddo
-10 call close_file (unit)
- endif
-#endif
!-------------------------------------------------------------------------
! write version and namelist to standard log.
diff --git a/atmos_param/mg_drag/mg_drag.F90 b/atmos_param/mg_drag/mg_drag.F90
index edf202b5..c9f674c7 100644
--- a/atmos_param/mg_drag/mg_drag.F90
+++ b/atmos_param/mg_drag/mg_drag.F90
@@ -12,11 +12,15 @@ module mg_drag_mod
use topography_mod, only: get_topog_stdev
use mpp_mod, only: input_nml_file
- use fms_mod, only: mpp_npes, field_size, file_exist, write_version_number, stdlog, &
- mpp_pe, mpp_root_pe, error_mesg, FATAL, NOTE, read_data, write_data, &
- open_namelist_file, close_file, check_nml_error, mpp_error
- use fms_io_mod, only: register_restart_field, restart_file_type
- use fms_io_mod, only: save_restart, restore_state
+ use mpp_domains_mod, only: domain2D
+ use fms_mod, only: write_version_number, stdlog, &
+ mpp_pe, mpp_root_pe, error_mesg, FATAL, NOTE, &
+ check_nml_error, mpp_error
+ use fms2_io_mod, only: file_exists, FmsNetcdfFile_t, FmsNetcdfDomainFile_t, &
+ register_restart_field, register_axis, unlimited, &
+ open_file, read_restart, write_restart, close_file, &
+ register_field, write_data, register_variable_attribute, &
+ get_global_io_domain_indices
use constants_mod, only: Grav, Kappa, RDgas, cp_air
!-----------------------------------------------------------------------
@@ -45,7 +49,7 @@ module mg_drag_mod
logical :: module_is_initialized = .false.
!--- for netcdf restart
-type(restart_file_type), save :: Mg_restart
+ type (domain2D), pointer :: mg_domain !< Atmosphere domain
!---------------------------------------------------------------------
! --- NAMELIST (mg_drag_nml)
@@ -960,7 +964,7 @@ end subroutine mgwd_tend
!#######################################################################
- subroutine mg_drag_init( lonb, latb, hprime )
+ subroutine mg_drag_init(domain, lonb, latb, hprime )
!=======================================================================
! ***** INITIALIZE Mountain Gravity Wave Drag
@@ -971,6 +975,7 @@ subroutine mg_drag_init( lonb, latb, hprime )
! lonb = longitude in radians of the grid box corners
! latb = latitude in radians of the grid box corners
!---------------------------------------------------------------------
+ type(domain2D), target, intent(in) :: domain !< Atmosphere domain
real, intent(in), dimension(:,:) :: lonb, latb
!---------------------------------------------------------------------
@@ -985,7 +990,7 @@ subroutine mg_drag_init( lonb, latb, hprime )
integer :: ix, iy, unit, io, ierr, logunit
logical :: answer
integer :: id_restart
-
+ type(FmsNetcdfDomainFile_t) :: Mg_restart !< Fms2io domain decomposed fileobj
!=====================================================================
if(module_is_initialized) return
@@ -993,25 +998,8 @@ subroutine mg_drag_init( lonb, latb, hprime )
!---------------------------------------------------------------------
! --- Read namelist
!---------------------------------------------------------------------
- if( file_exist( 'input.nml' ) ) then
-#ifdef INTERNAL_FILE_NML
read (input_nml_file, nml=mg_drag_nml, iostat=io)
ierr = check_nml_error(io,'mg_drag_nml')
-#else
-! -------------------------------------mg_drag_nml')
-
- unit = open_namelist_file()
- ierr = 1
- do while( ierr .ne. 0 )
- read ( unit, nml = mg_drag_nml, iostat = io, end = 10 )
- ierr = check_nml_error(io,'mg_drag_nml')
- end do
-10 continue
- call close_file ( unit )
-#endif
-
-! -------------------------------------
- end if
!---------------------------------------------------------------------
! --- Output version
@@ -1035,8 +1023,7 @@ subroutine mg_drag_init( lonb, latb, hprime )
!---------------------------------------------------------------------
! --- Input hprime
!---------------------------------------------------------------------
-
- id_restart = register_restart_field(Mg_restart, 'mg_drag.res.nc', 'ghprime', Ghprime)
+ mg_domain => domain
if ( trim(source_of_sgsmtn) == 'computed' ) then
answer = get_topog_stdev ( lonb, latb, Ghprime )
@@ -1045,11 +1032,13 @@ subroutine mg_drag_init( lonb, latb, hprime )
', but topography data file does not exist', FATAL)
endif
else if ( trim(source_of_sgsmtn) == 'input' .or. trim(source_of_sgsmtn) == 'input/computed' ) then
- if ( file_exist('INPUT/mg_drag.res.nc') ) then
+ if (open_file(Mg_restart,"INPUT/mg_drag.res.nc","read", mg_domain, is_restart=.true.)) then
if (mpp_pe() == mpp_root_pe()) call mpp_error ('mg_drag_mod', &
'Reading NetCDF formatted restart file: INPUT/mg_drag.res.nc', NOTE)
- call restore_state(Mg_restart)
- else if ( file_exist( 'INPUT/mg_drag.res' ) ) then
+ call mg_register_restart(Mg_restart)
+ call read_restart(Mg_restart)
+ call close_file(Mg_restart)
+ else if ( file_exists( 'INPUT/mg_drag.res' ) ) then
if (mpp_pe() == mpp_root_pe()) call mpp_error ('mg_drag_mod', &
'Native formatted restart capability removed.', FATAL)
else
@@ -1076,6 +1065,27 @@ subroutine mg_drag_init( lonb, latb, hprime )
end subroutine mg_drag_init
!#######################################################################
+!< mg_register_restart: registers the restart variables
+ subroutine mg_register_restart(Mg_restart)
+ type(FmsNetcdfDomainFile_t), intent(inout) :: Mg_restart !< Fms2io domain decomposed fileobj
+ character(len=8), dimension(3) :: dim_names !< String array of dimension names
+
+ dim_names(1) = "xaxis_1"
+ dim_names(2) = "yaxis_1"
+ dim_names(3) = "Time"
+
+ call register_axis(Mg_restart, dim_names(1), "x")
+ call register_axis(Mg_restart, dim_names(2), "y")
+ call register_axis(Mg_restart, dim_names(3), unlimited)
+
+ !< Register the domain decomposed dimensions as variables so that the combiner can work
+ !! correctly
+ call register_field(Mg_restart, dim_names(1), "double", (/dim_names(1)/))
+ call register_field(Mg_restart, dim_names(2), "double", (/dim_names(2)/))
+
+ call register_restart_field(Mg_restart, 'ghprime', Ghprime, dim_names)
+
+ end subroutine mg_register_restart
subroutine mg_drag_end
integer :: unit
@@ -1105,11 +1115,40 @@ end subroutine mg_drag_end
subroutine mg_drag_restart(timestamp)
character(len=*), intent(in), optional :: timestamp
- call save_restart(Mg_restart, timestamp)
+ type(FmsNetcdfDomainFile_t) :: Mg_restart !< Fms2io domain decomposed fileobj
+ character(len=128) :: filename !< Restart filename
+
+ if (present(timestamp)) then
+ filename = "RESTART/"//trim(timestamp)//".mg_drag.res.nc"
+ else
+ filename = "RESTART/mg_drag.res.nc"
+ endif
+
+ if (open_file(Mg_restart,trim(filename),"overwrite", mg_domain, is_restart=.true.)) then
+ call mg_register_restart(Mg_restart)
+ call write_restart(Mg_restart)
+ call add_domain_dimension_data(Mg_restart)
+ call close_file(Mg_restart)
+ endif
end subroutine mg_drag_restart
! NAME="mg_drag_restart"
!#######################################################################
+!< Add_dimension_data: Adds dummy data for the domain decomposed axis
+subroutine add_domain_dimension_data(fileobj)
+ type(FmsNetcdfDomainFile_t) :: fileobj !< Fms2io domain decomposed fileobj
+ integer, dimension(:), allocatable :: buffer !< Buffer with axis data
+ integer :: is, ie !< Starting and Ending indices for data
+
+ call get_global_io_domain_indices(fileobj, "xaxis_1", is, ie, indices=buffer)
+ call write_data(fileobj, "xaxis_1", buffer)
+ deallocate(buffer)
+
+ call get_global_io_domain_indices(fileobj, "yaxis_1", is, ie, indices=buffer)
+ call write_data(fileobj, "yaxis_1", buffer)
+ deallocate(buffer)
+
+end subroutine add_domain_dimension_data
end module mg_drag_mod
diff --git a/atmos_param/microphysics/cldwat2m_micro.F90 b/atmos_param/microphysics/cldwat2m_micro.F90
index 679cdc0b..25e0eefd 100644
--- a/atmos_param/microphysics/cldwat2m_micro.F90
+++ b/atmos_param/microphysics/cldwat2m_micro.F90
@@ -37,10 +37,10 @@ module cldwat2m_micro
use lscloud_types_mod, only: diag_id_type, diag_pt_type, &
lscloud_nml_type
use mpp_mod, only: input_nml_file
- use fms_mod, only: mpp_pe, file_exist, error_mesg, &
- open_namelist_file, FATAL, &
+ use fms_mod, only: mpp_pe, error_mesg, &
+ FATAL, &
stdlog, write_version_number, &
- check_nml_error, close_file, &
+ check_nml_error, &
mpp_root_pe
use simple_pdf_mod, only: simple_pdf
use sat_vapor_pres_mod, only: lookup_es2, lookup_es3, compute_qs
@@ -262,7 +262,7 @@ subroutine ini_micro
#ifdef GFDL_COMPATIBLE_MICROP
- INTEGER :: unit, io, ierr, logunit
+ INTEGER :: io, ierr, logunit
#endif
#ifndef GFDL_COMPATIBLE_MICROP
@@ -393,20 +393,8 @@ subroutine ini_micro
!---------------------------------------------------------------
! process namelist
!---------------------------------------------------------------
-#ifdef INTERNAL_FILE_NML
read (input_nml_file, nml=cldwat2m_micro_nml, iostat=io)
ierr = check_nml_error(io,'cldwat2m_micro_nml')
-#else
- if ( file_exist('input.nml')) then
- unit = open_namelist_file ()
- ierr=1; do while (ierr /= 0)
- read (unit, nml=cldwat2m_micro_nml, iostat=io, end=10)
- ierr = check_nml_error(io,'cldwat2m__micro_nml')
- enddo
-10 call close_file (unit)
- endif
-#endif
-
!-----------------------------------------------------------------------
! write version and namelist to stdlog.
!-----------------------------------------------------------------------
diff --git a/atmos_param/microphysics/ls_cloud_microphysics.F90 b/atmos_param/microphysics/ls_cloud_microphysics.F90
index 17d1b38c..b1db208e 100644
--- a/atmos_param/microphysics/ls_cloud_microphysics.F90
+++ b/atmos_param/microphysics/ls_cloud_microphysics.F90
@@ -17,14 +17,13 @@ module ls_cloud_microphysics_mod
use time_manager_mod, only: time_type, get_time, set_date
use mpp_mod, only: input_nml_file
use fms_mod, only: error_mesg, FATAL, NOTE, &
- file_exist, check_nml_error, &
- open_namelist_file, close_file, &
+ check_nml_error, &
write_version_number, stdlog, &
mpp_pe, mpp_root_pe, stdlog, &
mpp_clock_id, mpp_clock_begin, &
mpp_clock_end, CLOCK_MODULE, &
CLOCK_MODULE_DRIVER, &
- MPP_CLOCK_SYNC, read_data, write_data
+ MPP_CLOCK_SYNC
use field_manager_mod, only: MODEL_ATMOS
use tracer_manager_mod, only: get_tracer_index,&
get_number_tracers, &
@@ -282,19 +281,8 @@ subroutine ls_cloud_microphysics_init ( &
!-------------------------------------------------------------------------
! process namelist.
!-------------------------------------------------------------------------
-#ifdef INTERNAL_FILE_NML
read (input_nml_file, nml=ls_cloud_microphysics_nml, iostat=io)
ierr = check_nml_error(io,'ls_cloud_microphysics_nml')
-#else
- if ( file_exist('input.nml')) then
- unit = open_namelist_file ( )
- ierr=1; do while (ierr /= 0)
- read (unit, nml=ls_cloud_microphysics_nml, iostat=io, end=10)
- ierr = check_nml_error(io,'ls_cloud_microphysics_nml')
- enddo
-10 call close_file (unit)
- endif
-#endif
!-------------------------------------------------------------------------
! write version number and namelist to standard log.
diff --git a/atmos_param/microphysics/micro_mg.F90 b/atmos_param/microphysics/micro_mg.F90
index 16b03e0d..64c2222c 100644
--- a/atmos_param/microphysics/micro_mg.F90
+++ b/atmos_param/microphysics/micro_mg.F90
@@ -103,10 +103,10 @@ module micro_mg1_5
use gamma_mg_mod, only: gamma =>gamma_mg
use lscloud_types_mod, only: diag_id_type, diag_pt_type
use mpp_mod, only: input_nml_file
-use fms_mod, only: mpp_pe, file_exist, error_mesg, &
- open_namelist_file, FATAL, &
+use fms_mod, only: mpp_pe, error_mesg, &
+ FATAL, &
stdlog, write_version_number, &
- check_nml_error, close_file, &
+ check_nml_error, &
mpp_root_pe
use simple_pdf_mod, only: simple_pdf
use sat_vapor_pres_mod, only: lookup_es2, lookup_es3, compute_qs
@@ -566,19 +566,8 @@ subroutine micro_mg_init( &
!---------------------------------------------------------------
! process namelist
!---------------------------------------------------------------
-#ifdef INTERNAL_FILE_NML
read (input_nml_file, nml=micro_mg_nml, iostat=io)
ierr = check_nml_error(io,'micro_mg_nml')
-#else
- if ( file_exist('input.nml')) then
- unit = open_namelist_file ()
- ierr=1; do while (ierr /= 0)
- read (unit, nml=micro_mg_nml, iostat=io, end=10)
- ierr = check_nml_error(io,'micro_mg_nml')
- enddo
-10 call close_file (unit)
- endif
-#endif
!-----------------------------------------------------------------------
! write version and namelist to stdlog.
diff --git a/atmos_param/microphysics/morrison_gettelman_microp.F90 b/atmos_param/microphysics/morrison_gettelman_microp.F90
index 0d661ee2..451d68b6 100644
--- a/atmos_param/microphysics/morrison_gettelman_microp.F90
+++ b/atmos_param/microphysics/morrison_gettelman_microp.F90
@@ -7,10 +7,10 @@ MODULE morrison_gettelman_microp_mod
use constants_mod, only : pi, grav, rvgas, rdgas, tfreeze, &
hlv, hlf, hls, cp_air
use mpp_mod, only : input_nml_file
-use fms_mod, only : mpp_pe, file_exist, error_mesg, &
- open_namelist_file, FATAL, &
+use fms_mod, only : mpp_pe, error_mesg, &
+ FATAL, &
stdlog, write_version_number, &
- check_nml_error, close_file, &
+ check_nml_error, &
mpp_root_pe
use lscloud_debug_mod, only : record_micro_refusal
use lscloud_types_mod, only : lscloud_types_init, &
@@ -258,7 +258,7 @@ SUBROUTINE morrison_gettelman_microp_init ( Nml_lsc, Exch_ctrl)
!-----------------------------------------------------------------------
!--local variables------------------------------------------------------
- INTEGER :: unit, io, ierr, logunit
+ INTEGER :: io, ierr, logunit
!-----------------------------------------------------------------------
if (module_is_initialized) return
@@ -266,19 +266,8 @@ SUBROUTINE morrison_gettelman_microp_init ( Nml_lsc, Exch_ctrl)
!-----------------------------------------------------------------------
! process namelist.
!-----------------------------------------------------------------------
-#ifdef INTERNAL_FILE_NML
read (input_nml_file, nml=morrison_gettelman_microp_nml, iostat=io)
ierr = check_nml_error(io,'morrison_gettelman_microp_nml')
-#else
- if ( file_exist('input.nml')) then
- unit = open_namelist_file ()
- ierr=1; do while (ierr /= 0)
- read (unit, nml=morrison_gettelman_microp_nml, iostat=io, end=10)
- ierr = check_nml_error(io,'morrison_gettelman_microp_nml')
- enddo
-10 call close_file (unit)
- endif
-#endif
!-----------------------------------------------------------------------
! write version and namelist to stdlog.
diff --git a/atmos_param/microphysics/rotstayn_klein_mp.F90 b/atmos_param/microphysics/rotstayn_klein_mp.F90
index 4fc82433..1c927905 100644
--- a/atmos_param/microphysics/rotstayn_klein_mp.F90
+++ b/atmos_param/microphysics/rotstayn_klein_mp.F90
@@ -3,9 +3,9 @@ MODULE rotstayn_klein_mp_mod
use mpp_mod, only : input_nml_file
use fms_mod, only : error_mesg, FATAL, mpp_pe, mpp_root_pe, &
- open_namelist_file, check_nml_error, &
- close_file, write_version_number, &
- file_exist, stdlog
+ check_nml_error, &
+ write_version_number, &
+ stdlog
use cloud_generator_mod, only : cloud_generator_init, do_cloud_generator, &
compute_overlap_weighting
use constants_mod, only : HLV, HLF, HLS, RDGAS, CP_AIR, GRAV, &
@@ -186,7 +186,7 @@ SUBROUTINE rotstayn_klein_microp_init (Nml_lsc, Exch_ctrl)
type(exchange_control_type), intent(in) :: Exch_ctrl
!-----------------------------------------------------------------------
- integer :: unit, ierr, io, logunit
+ integer :: ierr, io, logunit
!------------------------------------------------------------------------
! if module has already been initialized, return.
@@ -205,19 +205,8 @@ SUBROUTINE rotstayn_klein_microp_init (Nml_lsc, Exch_ctrl)
!-------------------------------------------------------------------------
! process namelist.
!-------------------------------------------------------------------------
-#ifdef INTERNAL_FILE_NML
read (input_nml_file, nml=rotstayn_klein_mp_nml, iostat=io)
ierr = check_nml_error(io,'rotstayn_klein_mp_nml')
-#else
- if ( file_exist('input.nml')) then
- unit = open_namelist_file ( )
- ierr=1; do while (ierr /= 0)
- read (unit, nml=rotstayn_klein_mp_nml, iostat=io, end=10)
- ierr = check_nml_error(io,'rotstayn_klein_mp_nml')
- enddo
-10 call close_file (unit)
- endif
-#endif
!-------------------------------------------------------------------------
! write version and namelist to standard log.
diff --git a/atmos_param/moist_conv/moist_conv.F90 b/atmos_param/moist_conv/moist_conv.F90
index 0a89254d..e7f26410 100644
--- a/atmos_param/moist_conv/moist_conv.F90
+++ b/atmos_param/moist_conv/moist_conv.F90
@@ -10,8 +10,8 @@ module moist_conv_mod
use Diag_Manager_Mod, ONLY: register_diag_field, send_data
use sat_vapor_pres_mod, ONLY: lookup_es_des, compute_qs, descomp
use mpp_mod, only: input_nml_file
-use fms_mod, ONLY: error_mesg, file_exist, open_namelist_file, &
- check_nml_error, close_file, &
+use fms_mod, ONLY: error_mesg, &
+ check_nml_error, &
FATAL, WARNING, NOTE, mpp_pe, mpp_root_pe, &
write_version_number, stdlog
use constants_mod, ONLY: HLv, HLs, cp_air, grav, rdgas, rvgas
@@ -806,26 +806,15 @@ subroutine moist_conv_init (axes, Time, tracers_in_mca)
!-----------------------------------------------------------------------
- integer :: unit, io, ierr, logunit
+ integer :: io, ierr, logunit
integer :: nn, tr
character(len=128) :: diagname, diaglname, tendunits, name, units
!-----------------------------------------------------------------------
-#ifdef INTERNAL_FILE_NML
read (input_nml_file, nml=moist_conv_nml, iostat=io)
ierr = check_nml_error(io,"moist_conv_nml")
-#else
- if (file_exist('input.nml')) then
- unit = open_namelist_file ()
- ierr=1; do while (ierr /= 0)
- read (unit, nml=moist_conv_nml, iostat=io, end=10)
- ierr = check_nml_error (io,'moist_conv_nml')
- enddo
- 10 call close_file (unit)
- endif
-#endif
!---------- output namelist --------------------------------------------
diff --git a/atmos_param/moist_processes/moist_processes.F90 b/atmos_param/moist_processes/moist_processes.F90
index 8604d7df..df9320d3 100644
--- a/atmos_param/moist_processes/moist_processes.F90
+++ b/atmos_param/moist_processes/moist_processes.F90
@@ -4,7 +4,7 @@ module moist_processes_mod
!
! interface module for moisture processes
! ---------------------------------------
-! 1) sets up needed derived-type variables related to
+! 1) sets up needed derived-type variables related to
! condensation / convection parameterizations
! 2) calls convection_driver to process model convection
! 3) calls lscloud_driver to process large-scale clouds
@@ -20,21 +20,22 @@ module moist_processes_mod
use diag_axis_mod, only: get_axis_num
use diag_data_mod, only: CMOR_MISSING_VALUE
+use mpp_domains_mod, only: domain2D
use mpp_mod, only: input_nml_file
use fms_mod, only: error_mesg, FATAL, NOTE, &
- file_exist, check_nml_error, &
- open_namelist_file, close_file, &
+ check_nml_error, &
write_version_number, stdout, &
mpp_pe, mpp_root_pe, stdlog, &
mpp_clock_id, mpp_clock_begin, &
mpp_clock_end, CLOCK_MODULE, &
- MPP_CLOCK_SYNC, read_data, write_data
+ MPP_CLOCK_SYNC
+use fms2_io_mod, only: file_exists
use field_manager_mod, only: MODEL_ATMOS
use tracer_manager_mod, only: get_tracer_index,&
get_tracer_names, &
NO_TRACER
use constants_mod, only: CP_AIR, GRAV, HLV, HLS, HLF, &
- TFREEZE, WTMAIR, SECONDS_PER_DAY,WTMN
+ TFREEZE, WTMAIR, SECONDS_PER_DAY, WTMN
! atmos_param modules
use physics_types_mod, only : physics_control_type, &
physics_tendency_block_type, &
@@ -44,7 +45,7 @@ module moist_processes_mod
use physics_radiation_exch_mod, &
only : clouds_from_moist_block_type, &
exchange_control_type
-use lscloud_driver_mod, only : lscloud_driver_init, lscloud_driver, &
+use lscloud_driver_mod, only : lscloud_driver_init, lscloud_driver, &
lscloud_driver_time_vary, &
lscloud_driver_endts, &
lscloud_driver_end
@@ -56,6 +57,7 @@ module moist_processes_mod
convection_driver_restart, &
convection_driver_end, &
id_pr_g, id_prc_g, id_prsn_g
+use convection_utilities_mod, only: mp2uwconv_type
use diag_integral_mod, only : diag_integral_field_init, &
sum_diag_integral_field
use atmos_global_diag_mod, only: register_global_diag_field, &
@@ -63,14 +65,16 @@ module moist_processes_mod
send_global_diag
use vert_diff_driver_mod, only : surf_diff_type
use aerosol_types_mod, only : aerosol_type
+use atmos_tracer_utilities_mod, only : get_cmip_param, get_chem_param
use moist_proc_utils_mod, only : tempavg, column_diag, rh_calc, &
MP_input_type, MP_nml_type, &
mp_tendency_type, mp_removal_type, &
mp_removal_control_type, &
+ define_removal_mp_control_type, &
+ deallocate_mp_removal_control_type, &
mp_conv2ls_type, mp_output_type
! atmos_shared modules
-use atmos_tracer_utilities_mod, only : get_cmip_param, get_chem_param
use atmos_dust_mod, only : atmos_dust_init, dust_tracers, &
n_dust_tracers, do_dust, &
atmos_dust_wetdep_flux_set
@@ -94,7 +98,7 @@ module moist_processes_mod
moist_processes_restart, &
moist_processes_endts, moist_processes_end, &
set_cosp_precip_sources, define_cosp_precip_fluxes
-
+
!-----------------------------------------------------------------------
!-------------------- private data -------------------------------------
@@ -113,8 +117,8 @@ module moist_processes_mod
!---------------- namelist variable definitions ------------------------
!
-! do_unified_clouds =
-! switch to turn on/off a unified (LS + conv) cloud
+! do_unified_clouds =
+! switch to turn on/off a unified (LS + conv) cloud
! scheme (not yet available)
! [logical, default: do_unified_clouds=false ]
! do_lsc = switch to turn on/off large scale condensation
@@ -136,17 +140,17 @@ module moist_processes_mod
! do_bmomp = switch to turn on/off olivier's version of the betts-miller
! scheme (with separated boundary layer)
! [logical, default: do_bmomp=false ]
-! do_simple = switch to turn on alternative definition of specific
-! humidity. When true, specific humidity =
+! do_simple = switch to turn on alternative definition of specific
+! humidity. When true, specific humidity =
! (rdgas/rvgas)*esat/pressure
-! do_rh_clouds = switch to turn on/off simple relative humidity cloud
+! do_rh_clouds = switch to turn on/off simple relative humidity cloud
! scheme
! [logical, default: do_rh_clouds=false ]
! pdepth = boundary layer depth in pascals for determining mean
! temperature tfreeze (used for snowfall determination)
! [real, default =150.e2 Pa]
-! limit_conv_cloud_frac =
-! [logical, default: limit_conv_cloud_frac=false]
+! limit_conv_cloud_frac =
+! [logical, default: limit_conv_cloud_frac=false]
! include_donmca_in_cosp =
! [logical, default: include_donmca_in_cosp = true]
!
@@ -164,9 +168,9 @@ module moist_processes_mod
! carbon for nucleation
!
-logical :: do_unified_clouds = .false.
+logical :: do_unified_clouds = .false.
logical :: do_lsc = .false.
-logical :: do_mca=.false.
+logical :: do_mca=.false.
logical :: do_ras=.false.
logical :: do_uw_conv=.false.
logical :: do_donner_deep=.false.
@@ -189,7 +193,7 @@ module moist_processes_mod
namelist /moist_processes_nml/ do_unified_clouds, do_lsc, do_mca, do_ras, &
do_uw_conv, do_donner_deep, do_dryadj, do_bm, &
do_bmmass, do_bmomp, do_simple, do_rh_clouds, &
- do_diag_clouds, &
+ do_diag_clouds, &
pdepth, limit_conv_cloud_frac, include_donmca_in_cosp, &
use_online_aerosol, use_sub_seasalt, sea_salt_scale, &
om_to_oc, do_height_adjust
@@ -218,16 +222,17 @@ module moist_processes_mod
type(cmip_diag_id_type) :: ID_cl, ID_clw, ID_cli, ID_hur
-integer, dimension(:), allocatable :: id_wetdep
+integer, dimension(:), allocatable :: id_wetdep
integer, dimension(:), allocatable :: id_wetdep_uw, id_wetdep_donner, &
- id_wetdepc_donner, id_wetdepm_donner !f1p
+ id_wetdepc_donner, id_wetdepm_donner !f1p
integer, dimension(:), allocatable :: id_wetdep_kg_m2_s
real, dimension(:), allocatable :: conv_wetdep, conv_wetdep_kg_m2_s, nb_N_ox, nb_N_red, nb_N
real :: missing_value = -999.
! cmip names, long_names, standard names for wetdep diag fields
-integer :: id_wetpoa_cmip, id_wetsoa_cmip, id_wetoa_cmip, id_wetbc_cmip, id_wetdust_cmip, &
+integer :: id_wetpoa_cmip, id_wetsoa_cmip, id_wetoa_cmip, id_wetbc_cmip, &
+ id_wetdust_cmip, &
id_wetss_cmip, id_wetso4_cmip, id_wetso2_cmip, id_wetdms_cmip, id_wetnh4_cmip
integer, parameter :: NCMIP_NAMES = 10
character(len=8), dimension(NCMIP_NAMES) :: cmip_names = &
@@ -238,12 +243,12 @@ module moist_processes_mod
"Dry Aerosol Secondary Organic Matter", &
"Dry Aerosol Total Organic Matter", &
"Black Carbon Aerosol Mass", &
- "Dust", "Seasalt", "SO4", "SO2", "DMS", "NH4+NH3"]
+ "Dust", "Seasalt", "SO4", "SO2", "DMS", "NH4+NH3"]
character(len=64), dimension(NCMIP_NAMES) :: cmip_stdnames = &
[ character(len=64) :: &
"primary_particulate_organic_matter_dry_aerosol", &
"secondary_particulate_organic_matter_dry_aerosol", &
- "particulate_organic_matter_dry_aerosol", &
+ "particulate_organic_matter_dry_aerosol ", &
"elemental_carbon_dry_aerosol", "dust_dry_aerosol", &
"seasalt_dry_aerosol", "sulfate_dry_aerosol", &
"sulfur_dioxide", "dimethyl_sulfide", "ammonium_dry_aerosol"]
@@ -275,7 +280,7 @@ module moist_processes_mod
real, allocatable, dimension(:,:) :: max_enthalpy_imbal, &
max_water_imbal
-real, allocatable, dimension(:,:) :: prec_intgl
+real, allocatable, dimension(:,:) :: prec_intgl
!-----------------------------------------------------------------------
@@ -295,7 +300,7 @@ module moist_processes_mod
logical :: use_tau
integer :: nsphum, nql, nqi, nqa, nqn, nqni, nqr, nqs, nqg
integer :: num_prog_tracers
-
+real :: dt
contains
@@ -304,11 +309,12 @@ module moist_processes_mod
!########################################################################
-subroutine moist_processes_init ( id, jd, kd, lonb, latb, &
+subroutine moist_processes_init ( domain, id, jd, kd, lonb, latb, &
lon, lat, phalf, pref, axes, Time, &
Physics_control, Exch_ctrl)
!-----------------------------------------------------------------------
+type(domain2D), target, intent(in) :: domain !< Atmosphere domain
integer, intent(in) :: id, jd, kd, axes(4)
real, dimension(:,:), intent(in) :: lonb, latb
real,dimension(:,:), intent(in) :: lon, lat ! h1g
@@ -350,7 +356,7 @@ subroutine moist_processes_init ( id, jd, kd, lonb, latb, &
if ( module_is_initialized ) return
!-----------------------------------------------------------------------
-! define some variables needed in moist processes that come from the
+! define some variables needed in moist processes that come from the
! exchange_control_type variable. these variables are needed in both
! radiation and physics modules.
!-----------------------------------------------------------------------
@@ -364,14 +370,14 @@ subroutine moist_processes_init ( id, jd, kd, lonb, latb, &
! and are passed in via a physics_control_type variable.
!---------------------------------------------------------------------
nsphum = Physics_control%nsphum
- nql = Physics_control%nql
- nqi = Physics_control%nqi
- nqa = Physics_control%nqa
- nqn = Physics_control%nqn
- nqni = Physics_control%nqni
- nqr = Physics_control%nqr
- nqs = Physics_control%nqs
- nqg = Physics_control%nqg
+ nql = Physics_control%nql
+ nqi = Physics_control%nqi
+ nqa = Physics_control%nqa
+ nqn = Physics_control%nqn
+ nqni = Physics_control%nqni
+ nqr = Physics_control%nqr
+ nqs = Physics_control%nqs
+ nqg = Physics_control%nqg
num_prog_tracers = Physics_control%num_prog_tracers
use_tau = Physics_control%use_tau
@@ -379,19 +385,9 @@ subroutine moist_processes_init ( id, jd, kd, lonb, latb, &
!-----------------------------------------------------------------------
! process the moist_processes_nml.
!-----------------------------------------------------------------------
- if ( file_exist('input.nml')) then
-#ifdef INTERNAL_FILE_NML
+ if ( file_exists('input.nml')) then
read (input_nml_file, nml=moist_processes_nml, iostat=io)
ierr = check_nml_error(io,'moist_processes_nml')
-#else
-
- unit = open_namelist_file ( )
- ierr=1; do while (ierr /= 0)
- read (unit, nml=moist_processes_nml, iostat=io, end=10)
- ierr = check_nml_error(io,'moist_processes_nml')
- enddo
- 10 call close_file (unit)
-#endif
!--------- write version and namelist to standard log ------------
@@ -403,7 +399,7 @@ subroutine moist_processes_init ( id, jd, kd, lonb, latb, &
!------------------------------------------------------------------------
! define the number of cloud schemes active in the model. Define logicals
-! indicating the status of each available cloud scheme in the current
+! indicating the status of each available cloud scheme in the current
! model configuration. (prognostic LS cloud scheme already defined
! in physics_driver based on presence or absence of cloud tracers.)
!------------------------------------------------------------------------
@@ -414,7 +410,7 @@ subroutine moist_processes_init ( id, jd, kd, lonb, latb, &
endif
if (do_donner_deep) then
Exch_ctrl%ncld = Exch_ctrl%ncld + 2
- Exch_ctrl%doing_donner = .true.
+ Exch_ctrl%doing_donner = .true.
endif
if (do_uw_conv) then
Exch_ctrl%ncld = Exch_ctrl%ncld + 1
@@ -422,12 +418,12 @@ subroutine moist_processes_init ( id, jd, kd, lonb, latb, &
endif
!----------------------------------------------------------------------
-! create an mp_nml_type variable (Nml_mp) so that moist_processes_nml
+! create an mp_nml_type variable (Nml_mp) so that moist_processes_nml
! variables may be made available to other related modules as needed,
-! obviating the need for the occurrence of the same variable in mutiple
+! obviating the need for the occurrence of the same variable in mutiple
! namelists.
!----------------------------------------------------------------------
- call create_Nml_mp
+ call create_Nml_mp
!-----------------------------------------------------------------------
! consistency checks for thes namelist variables
@@ -436,7 +432,7 @@ subroutine moist_processes_init ( id, jd, kd, lonb, latb, &
call error_mesg ('moist_processes_init', &
'rh_clouds cannot be active when prognostic clouds are', FATAL)
- if (do_donner_deep .and. do_rh_clouds) &
+ if (do_donner_deep .and. do_rh_clouds) &
call error_mesg ('moist_processes_init', &
'Cannot currently activate donner_deep_mod with rh_clouds', &
FATAL)
@@ -481,11 +477,11 @@ subroutine moist_processes_init ( id, jd, kd, lonb, latb, &
nSOA = get_tracer_index(MODEL_ATMOS,'SOA')
nNH4NO3 = get_tracer_index(MODEL_ATMOS,'nh4no3')
nNH4 = get_tracer_index(MODEL_ATMOS,'nh4')
-
-
+
+
!---------------------------------------------------------------------
-! allocate and initialize arrays to hold maximum enthalpy and water
-! imbalances in each column over the course of the current job
+! allocate and initialize arrays to hold maximum enthalpy and water
+! imbalances in each column over the course of the current job
! submission.
!---------------------------------------------------------------------
allocate (max_enthalpy_imbal (id, jd))
@@ -495,52 +491,29 @@ subroutine moist_processes_init ( id, jd, kd, lonb, latb, &
!------------------------------------------------------------------------
! allocate and initialize an Mp_removal_control_type variable which will
-! indicate for each tracer whether it is to be transported by the
-! various available convective schemes. Also included is a counter of
-! the number of tracers being affected by each available convective
+! indicate for each tracer whether it is to be transported by the
+! various available convective schemes. Also included is a counter of
+! the number of tracers being affected by each available convective
! scheme.
!------------------------------------------------------------------------
-! allocate (Removal_mp%control%tracers_in_donner(num_prog_tracers))
-! allocate (Removal_mp%control%tracers_in_ras(num_prog_tracers))
-! allocate (Removal_mp%control%tracers_in_uw(num_prog_tracers))
-! allocate (Removal_mp%control%tracers_in_mca(num_prog_tracers))
-! Removal_mp%control%tracers_in_donner = .false.
-! Removal_mp%control%tracers_in_ras = .false.
-! Removal_mp%control%tracers_in_uw = .false.
-! Removal_mp%control%tracers_in_mca = .false.
-! Removal_mp%control%num_mca_tracers = 0
-! Removal_mp%control%num_ras_tracers = 0
-! Removal_mp%control%num_donner_tracers = 0
-! Removal_mp%control%num_uw_tracers = 0
- allocate (Removal_mp_control%tracers_in_donner(num_prog_tracers))
- allocate (Removal_mp_control%tracers_in_ras(num_prog_tracers))
- allocate (Removal_mp_control%tracers_in_uw(num_prog_tracers))
- allocate (Removal_mp_control%tracers_in_mca(num_prog_tracers))
- Removal_mp_control%tracers_in_donner = .false.
- Removal_mp_control%tracers_in_ras = .false.
- Removal_mp_control%tracers_in_uw = .false.
- Removal_mp_control%tracers_in_mca = .false.
- Removal_mp_control%num_mca_tracers = 0
- Removal_mp_control%num_ras_tracers = 0
- Removal_mp_control%num_donner_tracers = 0
- Removal_mp_control%num_uw_tracers = 0
+ call define_removal_mp_control_type (Removal_mp_control, &
+ num_prog_tracers)
!-----------------------------------------------------------------------
! call convection_driver_init to initialize the convection scheme(s).
!-----------------------------------------------------------------------
- call convection_driver_init (id, jd, kd, axes, Time, &
+ call convection_driver_init (domain, id, jd, kd, axes, Time, &
Physics_control, Exch_ctrl, Nml_mp, &
-! Removal_mp%control, lonb, latb, pref)
Removal_mp_control, lonb, latb, pref)
!-----------------------------------------------------------------------
! call lscloud_driver_init to initialize the large-scale cloud scheme.
!-----------------------------------------------------------------------
- call lscloud_driver_init (id,jd,kd, axes, Time, Exch_ctrl, Nml_mp, &
+ call lscloud_driver_init (domain, id,jd,kd, axes, Time, Exch_ctrl, Nml_mp, &
Physics_control, lon, lat, phalf, pref)
-
+
!-----------------------------------------------------------------------
-! initialize quantities for diagnostics output
+! initialize quantities for diagnostics output
!-----------------------------------------------------------------------
call diag_field_init ( axes, Time )
@@ -555,15 +528,18 @@ subroutine moist_processes_init ( id, jd, kd, lonb, latb, &
end subroutine moist_processes_init
!#####################################################################
+
+subroutine moist_processes_time_vary (Time_in, dt_in, i_cell, i_meso, i_shallow)
-subroutine moist_processes_time_vary (dt)
-
-real, intent(in) :: dt
+real, intent(in) :: dt_in
+type(time_type), intent(in) :: Time_in
+integer, intent(in) :: i_cell, i_meso, i_shallow
!-----------------------------------------------------------------------
- call convection_driver_time_vary (dt)
- call lscloud_driver_time_vary (dt)
+ dt = dt_in
+ call convection_driver_time_vary (Time_in, dt_in, i_cell, i_meso, i_shallow)
+ call lscloud_driver_time_vary (dt_in)
end subroutine moist_processes_time_vary
@@ -571,7 +547,7 @@ end subroutine moist_processes_time_vary
!#######################################################################
-subroutine moist_processes ( is, ie, js, je, npz, Time, dt, land, ustar, &
+subroutine moist_processes ( is, ie, js, je, npz, Time, land, ustar, &
bstar, qstar, area, lon, lat, &
Physics_input_block, Moist_clouds_block, &
Physics_tendency_block, Phys_mp_exch, &
@@ -605,41 +581,40 @@ subroutine moist_processes ( is, ie, js, je, npz, Time, dt, land, ustar, &
!
! lat latitude in radians
! [real, dimension(nlon,nlat)]
-!
+!
! Physics_input_block
-!
+!
! inout: Moist_clouds_block
! Physics_tendency_block
! Phys_mp_exch
-!
+!
!
! out: lprec liquid precipitiaton rate (rain) in kg/m2/s
! [real, dimension(nlon,nlat)]
!
! fprec frozen precipitation rate (snow) in kg/m2/s
! [real, dimension(nlon,nlat)]
-!
+!
! gust_cv gustiness from convection in m/s
! [real, dimension(nlon,nlat)]
!
! optional
! -----------------
-!
+!
! in: Aerosol
!
!-----------------------------------------------------------------------
integer, intent(in) :: is,ie,js,je, npz
type(time_type), intent(in) :: Time
-real, intent(in) :: dt
real, intent(in) , dimension(:,:) :: land, ustar, bstar, qstar
real, intent(in) , dimension(:,:) :: area, lon, lat
type(physics_input_block_type), &
- intent(in) :: Physics_input_block
+ intent(in) :: Physics_input_block
type(clouds_from_moist_block_type), &
intent(inout) :: Moist_clouds_block
type(physics_tendency_block_type), &
- intent(inout) :: Physics_tendency_block
+ intent(inout) :: Physics_tendency_block
type(phys_mp_exch_type), intent(inout) :: Phys_mp_exch
type(surf_diff_type), intent(in) :: Surf_diff
type(mp_removal_type), intent(inout) :: Removal_mp
@@ -655,6 +630,7 @@ subroutine moist_processes ( is, ie, js, je, npz, Time, dt, land, ustar, &
type(MP_output_type) :: Output_mp
type(MP_tendency_type) :: Tend_mp
type(MP_conv2ls_type) :: C2ls_mp
+ type(mp2uwconv_type) :: Mp2uwconv
real, dimension(ie-is+1, je-js+1, npz) :: tdt_init
real, dimension(ie-is+1, je-js+1, npz) :: tdt_dif, qdt_dif !miz
@@ -682,23 +658,19 @@ subroutine moist_processes ( is, ie, js, je, npz, Time, dt, land, ustar, &
!------------------------------------------------------------------------
tdt_init = Physics_tendency_block%t_dt
qdt_init = Physics_tendency_block%q_dt
- tdt_dif = Physics_tendency_block%t_dt !miz
- qdt_dif = Physics_tendency_block%q_dt(:,:,:,nsphum) + & !miz
- Physics_tendency_block%q_dt(:,:,:,nql) + &
- Physics_tendency_block%q_dt(:,:,:,nqi)
!-------------------------------------------------------------------------
-! call MP_alloc to allocate and initialize (or associate) elements of
+! call MP_alloc to allocate and initialize (or associate) elements of
! the derived type variables used in this subroutine.
!-------------------------------------------------------------------------
call MP_alloc (Physics_input_block, Physics_tendency_block, &
Phys_mp_exch, dt, area, lon, lat, land, ustar, &
bstar, qstar, Input_mp, Tend_mp, C2ls_mp, Output_mp,&
- Removal_mp)
+ Removal_mp, Mp2uwconv, shflx, lhflx)
!----------------------------------------------------------------------
! call routines to process the model clouds. If a unified cloud scheme
-! exists, call its driver; otherwise call separate drivers for the
+! exists, call its driver; otherwise call separate drivers for the
! convective and large-scale cloud schemes.
!----------------------------------------------------------------------
if (Nml_mp%do_unified_clouds) then
@@ -706,14 +678,11 @@ subroutine moist_processes ( is, ie, js, je, npz, Time, dt, land, ustar, &
'unified clouds not yet available', FATAL)
else
call convection_driver &
- (is, ie, js, je, Time, dt, Input_mp, &
- Tend_mp, C2ls_mp, Output_mp, Removal_mp, &
- Removal_mp_control, &
- Surf_diff, Phys_mp_exch, shflx, lhflx, tdt_dif, &
- qdt_dif, Moist_clouds_block, Aerosol=Aerosol)
-
+ (is, ie, js, je, Surf_diff, Phys_mp_exch, &
+ Moist_clouds_block, Input_mp, Tend_mp, C2ls_mp, &
+ Output_mp, Removal_mp, Aerosol=Aerosol)
call lscloud_driver &
- (is, ie, js, je, Time, dt, Input_mp, &
+ (is, ie, js, je, Time, dt, Input_mp, &
Physics_tendency_block%qdiag, Tend_mp, C2ls_mp, &
Output_mp, Removal_mp, &
Moist_clouds_block%cloud_data(istrat), &
@@ -721,32 +690,33 @@ subroutine moist_processes ( is, ie, js, je, npz, Time, dt, land, ustar, &
endif
!------------------------------------------------------------------------
-! call combined_MP_diagnostics to generate diagnostics that contain
+! call combined_MP_diagnostics to generate diagnostics that contain
! combined convective and large-scale cloud information and that define
! conditions after moist processes.
!------------------------------------------------------------------------
call combined_MP_diagnostics &
(is, ie, js, je, Time, tdt_init, qdt_init, Input_mp, &
- Moist_clouds_block, Output_mp, Removal_mp)
+ Moist_clouds_block, Output_mp, Removal_mp)
!------------------------------------------------------------------------
-! define needed output arguments. redefine r to be the value after
-! modification in moist_processes (only by clubb ? -- need to check why
+! define needed output arguments. redefine r to be the value after
+! modification in moist_processes (only by clubb ? -- need to check why
! this is) and pass it back to physics_driver.
!------------------------------------------------------------------------
Phys_mp_exch%convect = Output_mp%convect
- lprec = Output_mp%lprec
- fprec = Output_mp%fprec
+ lprec = Output_mp%lprec
+ fprec = Output_mp%fprec
gust_cv = Output_mp%gust_cv
if (do_clubb > 0) then
Phys_mp_exch%diff_t_clubb = Output_mp%diff_t_clubb
endif
Phys_mp_exch%diff_cu_mo = Output_mp%diff_cu_mo
-
+
!---------------------------------------------------------------------
! deallocate the derived type variables resident in moist_processes_mod.
!---------------------------------------------------------------------
- call MP_dealloc (Input_mp, Tend_mp, C2ls_mp, Output_mp, Removal_mp)
+ call MP_dealloc (Input_mp, Tend_mp, C2ls_mp, Output_mp, Removal_mp,&
+ Mp2uwconv)
!-----------------------------------------------------------------------
@@ -755,14 +725,14 @@ end subroutine moist_processes
!#####################################################################
-subroutine moist_processes_endts
-
+subroutine moist_processes_endts
+
logical :: used
!----------------------------------------------------------------------
! call convection_driver_endts to complete calcs on this timestep.
!----------------------------------------------------------------------
- call convection_driver_endts
+ call convection_driver_endts
!----------------------------------------------------------------------
! call lscloud_driver_endts to complete calcs on this timestep.
@@ -792,12 +762,12 @@ subroutine moist_processes_end ( )
!--------------------------------------------------------------------
! call lscloud_driver_end to complete operations in that module.
!--------------------------------------------------------------------
- call lscloud_driver_end
+ call lscloud_driver_end
!--------------------------------------------------------------------
! call convection_driver_end to complete operations in that module.
!--------------------------------------------------------------------
- call convection_driver_end
+ call convection_driver_end
!--------------------------------------------------------------------
! deallocate module variables.
@@ -805,16 +775,13 @@ subroutine moist_processes_end ( )
deallocate (max_water_imbal)
deallocate (max_enthalpy_imbal)
- deallocate (Removal_mp_control%tracers_in_donner ) !---> h1g, 2017-02-02
- deallocate (Removal_mp_control%tracers_in_ras ) !---> h1g, 2017-02-02
- deallocate (Removal_mp_control%tracers_in_uw ) !---> h1g, 2017-02-02
- deallocate (Removal_mp_control%tracers_in_mca ) !---> h1g, 2017-02-02
+ call deallocate_mp_removal_control_type (Removal_mp_control)
deallocate (prec_intgl) !---> h1g, 2017-02-02
-
if (allocated(id_wetdep_kg_m2_s)) deallocate(id_wetdep_kg_m2_s)
if (allocated(conv_wetdep_kg_m2_s)) deallocate(conv_wetdep_kg_m2_s)
if (allocated(conv_wetdep)) deallocate(conv_wetdep)
+
!--------------------------------------------------------------------
if (allocated(nb_N)) deallocate(nb_N)
@@ -829,7 +796,7 @@ subroutine moist_processes_end ( )
end subroutine moist_processes_end
-!#######################################################################
+!#######################################################################
subroutine set_cosp_precip_sources (cosp_precip_sources)
@@ -859,12 +826,12 @@ subroutine set_cosp_precip_sources (cosp_precip_sources)
else if (trim(cosp_precip_sources) == 'uw') then
uw_precip_in_cosp = 1.
else if (trim(cosp_precip_sources) == 'noprecip') then
-! COSP will be run without any precip input (default settings)
+! COSP will be run without any precip input (default settings)
else
call error_mesg ('moist_processes_mod:set_cosp_precip_sources', &
'cosp_precip_sources does not match any currently allowed string',&
FATAL)
- endif
+ endif
end subroutine set_cosp_precip_sources
@@ -881,7 +848,7 @@ subroutine define_cosp_precip_fluxes (is, js, Precip_flux, Removal_mp)
integer :: ii, jj
!----------------------------------------------------------------------
-! define the grid-box precip flux as the average of the interface
+! define the grid-box precip flux as the average of the interface
! fluxes.
!----------------------------------------------------------------------
do k=1, size(Removal_mp%frz_meso,3)
@@ -961,7 +928,7 @@ subroutine define_cosp_precip_fluxes (is, js, Precip_flux, Removal_mp)
end do
!-------------------------------------------------------------------------
-! deallocate the components of Removal_mp% that are used here and no
+! deallocate the components of Removal_mp% that are used here and no
! longer needed.
!-------------------------------------------------------------------------
deallocate (Removal_mp%ice_precflxh)
@@ -985,7 +952,7 @@ end subroutine define_cosp_precip_fluxes
subroutine combined_MP_diagnostics &
(is, ie, js, je, Time, tdt_init, qdt_init, &
Input_mp, Moist_clouds_block, Output_mp, Removal_mp)
-
+
integer, intent(in) :: is, ie, js, je
type(time_type), intent(in) :: Time
real, dimension(:,:,:,:), intent(in ) :: qdt_init
@@ -1005,11 +972,11 @@ subroutine combined_MP_diagnostics &
(size(Output_mp%rdt,1),size(Output_mp%rdt,2)) :: ltemp
real, dimension &
(size(Output_mp%rdt,1),size(Output_mp%rdt,2) ) :: &
- precip, temp_2d, tca2
+ precip, temp_2d, tca2
real, dimension &
(size(Output_mp%rdt,1),size(Output_mp%rdt,2)) :: &
total_wetdep_dust, total_wetdep_seasalt, &
- total_wetdep_nox, total_wetdep_nred
+ total_wetdep_nox, total_wetdep_nred
real, dimension &
(size(Output_mp%rdt,1),size(Output_mp%rdt,2), &
size(Output_mp%rdt,4)) :: &
@@ -1035,10 +1002,10 @@ subroutine combined_MP_diagnostics &
!@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
!
-! GENERAL MOISTURE DIAGNOSTICS
+! GENERAL MOISTURE DIAGNOSTICS
!
! output diagnostics reflecting the combination of convective and
-! large-scale parameterizations.
+! large-scale parameterizations.
!
!@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@ -1053,17 +1020,17 @@ subroutine combined_MP_diagnostics &
!--------------------------------------------------------------------
! obtain wet deposition removal for each tracer species n from:
! a) all precip sources combined;
-! b) from uw convection;
+! b) from uw convection;
! c) from donner convection.
-! the wet deposition removal of each species by ls precip is available
+! the wet deposition removal of each species by ls precip is available
! in ls_wetdep. The arrays holding the wet depo removal by the various
! convective schemes only have entries for those tracers designated as
-! being affected by the particular scheme,
+! being affected by the particular scheme,
!
! Update sign convention of wet deposition diagnostics to downward
! positive, to match CMIP6 data request
!--------------------------------------------------------------------
- total_wetdep = 0.
+ total_wetdep = 0.
total_wetdep_dust(:,:) = 0.
total_wetdep_seasalt(:,:) = 0.
@@ -1074,12 +1041,12 @@ subroutine combined_MP_diagnostics &
do_donner_deep) then
total_wetdep(:,:,n) = total_wetdep(:,:,n) - &
Removal_mp%donner_wetdep(:,:,m)
- total_wetdep_donner(:,:,n) = -Removal_mp%donner_wetdep(:,:,m)
+ total_wetdep_donner(:,:,n) = -Removal_mp%donner_wetdep(:,:,m)
total_wetdepc_donner(:,:,n) = -Removal_mp%donner_wetdepc(:,:,m)
total_wetdepm_donner(:,:,n) = -Removal_mp%donner_wetdepm(:,:,m)
m = m + 1
else
- total_wetdep_donner(:,:,n) = 0.
+ total_wetdep_donner(:,:,n) = 0.
endif
if (Removal_mp_control%tracers_in_uw(n) .and. do_uw_conv) then
total_wetdep(:,:,n) = total_wetdep(:,:,n) - &
@@ -1087,11 +1054,11 @@ subroutine combined_MP_diagnostics &
total_wetdep_uw (:,:,n) = -Removal_mp%uw_wetdep(:,:,mm)
mm = mm + 1
else
- total_wetdep_uw (:,:,n) = 0.
+ total_wetdep_uw (:,:,n) = 0.
endif
total_wetdep(:,:,n) = conv_wetdep(n)*total_wetdep(:,:,n)
end do
-
+
!------------------------------------------------------------------------
! Add in wet dep from large-scale clouds, which already has the proper
! conversion.
@@ -1120,7 +1087,7 @@ subroutine combined_MP_diagnostics &
Time, is, js)
endif
end do
-
+
do n=1, size(Output_mp%rdt,4)
if (id_wetdepm_donner(n) > 0) then
used = send_data (id_wetdepm_donner(n), &
@@ -1128,7 +1095,7 @@ subroutine combined_MP_diagnostics &
Time, is, js)
endif
end do
-
+
do n=1, size(Output_mp%rdt,4)
if (id_wetdepc_donner(n) > 0) then
used = send_data (id_wetdepc_donner(n), &
@@ -1136,7 +1103,7 @@ subroutine combined_MP_diagnostics &
Time, is, js)
endif
end do
-
+
do n=1, size(Output_mp%rdt,4)
if (id_wetdep_uw(n) > 0) then
used = send_data (id_wetdep_uw(n), &
@@ -1165,10 +1132,11 @@ subroutine combined_MP_diagnostics &
if (id_wetsoa_cmip > 0) then
used = send_data (id_wetsoa_cmip, total_wetdep(:,:,nSOA) , Time, is,js)
endif
+
if (id_wetoa_cmip > 0) then
used = send_data (id_wetoa_cmip, &
- total_wetdep(:,:,nomphilic)+total_wetdep(:,:,nomphobic)+total_wetdep(:,:,nSOA) , &
- Time, is,js)
+ total_wetdep(:,:,nomphilic) + total_wetdep(:,:,nomphobic) + &
+ total_wetdep(:,:,nSOA) , Time, is,js)
endif
if (id_wetdep_bc > 0) then
@@ -1184,7 +1152,7 @@ subroutine combined_MP_diagnostics &
if (id_wetdep_so4 > 0 .or. id_wetso4_cmip > 0) then
temp_2d = 0.0
- if( do_donner_deep ) temp_2d = temp_2d + (96.0/WTMAIR)*total_wetdep_donner(:,:,nso4)
+ if( do_donner_deep ) temp_2d = temp_2d + (96.0/WTMAIR)*total_wetdep_donner(:,:,nso4)
if( do_uw_conv ) temp_2d = temp_2d + (96.0/WTMAIR)*total_wetdep_uw (:,:,nso4)
if( doing_prog_clouds ) temp_2d = temp_2d - 0.096*Removal_mp%ls_wetdep(:,:,nso4)
if (id_wetdep_so4 > 0) used = send_data (id_wetdep_so4, temp_2d, Time, is,js)
@@ -1193,7 +1161,7 @@ subroutine combined_MP_diagnostics &
if (id_wetdep_so2 > 0 .or. id_wetso2_cmip > 0) then
temp_2d = 0.0
- if( do_donner_deep ) temp_2d = temp_2d + (64.0/WTMAIR)*total_wetdep_donner(:,:,nso2)
+ if( do_donner_deep ) temp_2d = temp_2d + (64.0/WTMAIR)*total_wetdep_donner(:,:,nso2)
if( do_uw_conv ) temp_2d = temp_2d + (64.0/WTMAIR)*total_wetdep_uw (:,:,nso2)
if( doing_prog_clouds ) temp_2d = temp_2d - 0.064*Removal_mp%ls_wetdep(:,:,nso2)
if (id_wetdep_so2 > 0) used = send_data (id_wetdep_so2, temp_2d, Time, is,js)
@@ -1202,7 +1170,7 @@ subroutine combined_MP_diagnostics &
if (id_wetdep_DMS > 0 .or. id_wetdms_cmip > 0) then
temp_2d = 0.0
- if( do_donner_deep ) temp_2d = temp_2d + (62.0/WTMAIR)*total_wetdep_donner(:,:,nDMS)
+ if( do_donner_deep ) temp_2d = temp_2d + (62.0/WTMAIR)*total_wetdep_donner(:,:,nDMS)
if( do_uw_conv ) temp_2d = temp_2d + (62.0/WTMAIR)*total_wetdep_uw (:,:,nDMS)
if( doing_prog_clouds ) temp_2d = temp_2d - 0.062*Removal_mp%ls_wetdep(:,:,nDMS)
if (id_wetdep_DMS > 0) used = send_data (id_wetdep_DMS, temp_2d, Time, is,js)
@@ -1225,8 +1193,8 @@ subroutine combined_MP_diagnostics &
nbin_seasalt=seasalt_tracers(n)%tr
total_wetdep_seasalt(:,:)=total_wetdep_seasalt(:,:)+total_wetdep(:,:,nbin_seasalt)
enddo
- if (id_wetdep_seasalt > 0) used = send_data (id_wetdep_seasalt, total_wetdep_seasalt, Time, is,js)
- if (id_wetss_cmip > 0) used = send_data (id_wetss_cmip, total_wetdep_seasalt, Time, is,js)
+ if (id_wetdep_seasalt > 0) used = send_data (id_wetdep_seasalt, total_wetdep_seasalt, Time, is,js)
+ if (id_wetss_cmip > 0) used = send_data (id_wetss_cmip, total_wetdep_seasalt, Time, is,js)
endif
if (id_wetdep_dust > 0 .or. id_wetdust_cmip > 0) then
@@ -1235,8 +1203,8 @@ subroutine combined_MP_diagnostics &
total_wetdep_dust(:,:)=total_wetdep_dust(:,:)+total_wetdep(:,:,nbin_dust)
enddo
call atmos_dust_wetdep_flux_set(-total_wetdep_dust, is,ie,js,je)
- if (id_wetdep_dust > 0) used = send_data (id_wetdep_dust, total_wetdep_dust, Time, is,js)
- if (id_wetdust_cmip > 0) used = send_data (id_wetdust_cmip, total_wetdep_dust, Time, is,js)
+ if (id_wetdep_dust > 0) used = send_data (id_wetdep_dust, total_wetdep_dust, Time, is,js)
+ if (id_wetdust_cmip > 0) used = send_data (id_wetdust_cmip, total_wetdep_dust, Time, is,js)
endif
@@ -1258,6 +1226,7 @@ subroutine combined_MP_diagnostics &
used = send_data ( id_n_red_wdep, total_wetdep_nred*wtmn/1000., Time, is, js)
endif
+
endif ! (wetdep_diagnostics_desired)
!---------------------------------------------------------------------
@@ -1283,7 +1252,7 @@ subroutine combined_MP_diagnostics &
!---------------------------------------------------------------------
used = send_data (id_prra, Output_mp%lprec, Time, is, js)
!---------------------------------------------------------------------
-! column integrated enthalpy and total water tendencies due to
+! column integrated enthalpy and total water tendencies due to
! moist processes and their imbalances:
!---------------------------------------------------------------------
@@ -1302,7 +1271,7 @@ subroutine combined_MP_diagnostics &
Input_mp%pmass, temp_2d)
!-----------------------------------------------------------------------
-! this diagnostic captures the extreme value seen during the model
+! this diagnostic captures the extreme value seen during the model
! segment currently being run.
!-----------------------------------------------------------------------
if (id_max_enthalpy_imbal > 0) then
@@ -1312,7 +1281,7 @@ subroutine combined_MP_diagnostics &
max_enthalpy_imbal(is:ie,js:je), Time, is, js)
endif
endif
-
+
!------------------------------------------------------------------------
! total water
@@ -1327,7 +1296,7 @@ subroutine combined_MP_diagnostics &
temp_3d2, 1.0, temp_3d3, 1.0, Input_mp%pmass, temp_2d)
!-----------------------------------------------------------------------
-! this diagnostic captures the extreme value seen during the model
+! this diagnostic captures the extreme value seen during the model
! segment currently being run.
!-----------------------------------------------------------------------
if (id_max_water_imbal > 0) then
@@ -1342,10 +1311,10 @@ subroutine combined_MP_diagnostics &
! define total_cloud_area (ls plus convective).
!----------------------------------------------------------------------
!----------------------------------------------------------------------
-! add convective cloud area contributions to total_cloud_area. define
-! total convective cloud area (conv_cld_frac) and grid-box mean
-! convective cloud condensate mass (tot_conv_cloud, tot_conv_liq,
-! tot_conv_ice).
+! add convective cloud area contributions to total_cloud_area. define
+! total convective cloud area (conv_cld_frac) and grid-box mean
+! convective cloud condensate mass (tot_conv_cloud, tot_conv_liq,
+! tot_conv_ice).
!----------------------------------------------------------------------
total_cloud_area = 0.
total_conv_cloud = 0.
@@ -1358,14 +1327,14 @@ subroutine combined_MP_diagnostics &
endif
if (i_cell > 0) then
total_cloud_area = total_cloud_area + &
- Moist_clouds_block%cloud_data(i_cell)%cloud_area
- total_conv_cloud = total_conv_cloud + &
+ Moist_clouds_block%cloud_data(i_cell)%cloud_area
+ total_conv_cloud = total_conv_cloud + &
Moist_clouds_block%cloud_data(i_cell)%cloud_area* &
Moist_clouds_block%cloud_data(i_cell)%ice_amt + &
Moist_clouds_block%cloud_data(i_cell)%cloud_area* &
Moist_clouds_block%cloud_data(i_cell)%liquid_amt
conv_cld_frac = conv_cld_frac + &
- Moist_clouds_block%cloud_data(i_cell)%cloud_area
+ Moist_clouds_block%cloud_data(i_cell)%cloud_area
tot_conv_liq = tot_conv_liq + &
Moist_clouds_block%cloud_data(i_cell)%cloud_area* &
Moist_clouds_block%cloud_data(i_cell)%liquid_amt
@@ -1375,14 +1344,14 @@ subroutine combined_MP_diagnostics &
endif
if (i_meso > 0) then
total_cloud_area = total_cloud_area + &
- Moist_clouds_block%cloud_data(i_meso)%cloud_area
+ Moist_clouds_block%cloud_data(i_meso)%cloud_area
total_conv_cloud = total_conv_cloud + &
Moist_clouds_block%cloud_data(i_meso)%cloud_area* &
Moist_clouds_block%cloud_data(i_meso)%ice_amt + &
Moist_clouds_block%cloud_data(i_meso)%cloud_area* &
Moist_clouds_block%cloud_data(i_meso)%liquid_amt
conv_cld_frac = conv_cld_frac + &
- Moist_clouds_block%cloud_data(i_meso)%cloud_area
+ Moist_clouds_block%cloud_data(i_meso)%cloud_area
tot_conv_liq = tot_conv_liq + &
Moist_clouds_block%cloud_data(i_meso)%cloud_area* &
Moist_clouds_block%cloud_data(i_meso)%liquid_amt
@@ -1399,7 +1368,7 @@ subroutine combined_MP_diagnostics &
Moist_clouds_block%cloud_data(i_shallow)%cloud_area* &
Moist_clouds_block%cloud_data(i_shallow)%liquid_amt
conv_cld_frac = conv_cld_frac + &
- Moist_clouds_block%cloud_data(i_shallow)%cloud_area
+ Moist_clouds_block%cloud_data(i_shallow)%cloud_area
tot_conv_liq = tot_conv_liq + &
Moist_clouds_block%cloud_data(i_shallow)%cloud_area* &
Moist_clouds_block%cloud_data(i_shallow)%liquid_amt
@@ -1408,7 +1377,7 @@ subroutine combined_MP_diagnostics &
Moist_clouds_block%cloud_data(i_shallow)%ice_amt
endif
-
+
!------------------------------------------------------------------------
! generate ls cloud diagnostics, normalized by total cloud, as requested
@@ -1454,29 +1423,29 @@ subroutine combined_MP_diagnostics &
Time, is, js, 1)!, rmask=mask)
!---------------------------------------------------------------------
-! define the total 2D cloud area.
+! define the total 2D cloud area.
!---------------------------------------------------------------------
if (id_tot_cld_amt > 0 ) then
tca2 = 1.0
do k=1,kx
tca2(:,:) = tca2(:,:)*(1.0 - total_cloud_area(:,:,k))
end do
- tca2 = 100.*(1. - tca2)
+ tca2 = 100.*(1. - tca2) ! cmip6 = Cloud Cover Percentage
used = send_data (id_tot_cld_amt, tca2, Time, is, js)
endif
-
+
if (id_clt > 0 ) then
tca2 = 1.0
do k=1,kx
tca2(:,:) = tca2(:,:)*(1.0 - total_cloud_area(:,:,k))
end do
- tca2 = 100.*(1. - tca2) ! cmip6 = Cloud Cover Percentage
+ tca2 = (1. - tca2) ! cmip6 = Cloud Area Fraction
used = send_data (id_clt, tca2, Time, is, js)
endif
IF (i_lsc > 0) then
!---------------------------------------------------------------------
-! define the total and convective liquid and liquid water path.
+! define the total and convective liquid and liquid water path.
!---------------------------------------------------------------------
if (id_tot_liq_amt > 0 ) &
used = send_data (id_tot_liq_amt, &
@@ -1494,7 +1463,7 @@ subroutine combined_MP_diagnostics &
used = send_data (id_conv_liq_amt, &
tot_conv_liq /(1.0 + total_conv_cloud), &
Time, is, js, 1)
-
+
if (id_LWP_all_clouds > 0 ) &
call column_diag (id_LWP_all_clouds, is, js, Time, &
Moist_clouds_block%cloud_data(i_lsc)%liquid_amt+tot_conv_liq+ &
@@ -1502,7 +1471,7 @@ subroutine combined_MP_diagnostics &
1.0, Input_mp%pmass)
!---------------------------------------------------------------------
-! define the total and convective ice and ice water path.
+! define the total and convective ice and ice water path.
!---------------------------------------------------------------------
if (id_tot_ice_amt > 0 ) &
used = send_data (id_tot_ice_amt, &
@@ -1526,19 +1495,19 @@ subroutine combined_MP_diagnostics &
call column_diag (id_IWP_all_clouds, is, js, Time, &
Moist_clouds_block%cloud_data(i_lsc)%ice_amt+tot_conv_ice+ &
Moist_clouds_block%cloud_data(i_lsc)%snow, 1.0, Input_mp%pmass)
-
+
if (id_clivi > 0 ) &
call column_diag (id_clivi, is, js, Time, &
Moist_clouds_block%cloud_data(i_lsc)%ice_amt+tot_conv_ice+ &
Moist_clouds_block%cloud_data(i_lsc)%snow, 1.0, Input_mp%pmass)
-
+
!---------------------------------------------------------------------
-! define the total water substance and condensate water path.
+! define the total water substance and condensate water path.
!---------------------------------------------------------------------
used = send_data (id_tot_h2o , &
- (Input_mp%qin(:,:,:) + &
+ (Input_mp%qin(:,:,:) + &
Moist_clouds_block%cloud_data(i_lsc)%ice_amt + &
- tot_conv_ice + &
+ tot_conv_ice + &
Moist_clouds_block%cloud_data(i_lsc)%liquid_amt + &
tot_conv_liq)/(1.0 + total_conv_cloud), &
Time, is, js, 1)
@@ -1565,7 +1534,7 @@ subroutine combined_MP_diagnostics &
ELSE ! (i_lsc > 0)
!---------------------------------------------------------------------
-! define the total and convective liquid and liquid water path.
+! define the total and convective liquid and liquid water path.
!---------------------------------------------------------------------
if (id_tot_liq_amt > 0 ) &
used = send_data (id_tot_liq_amt, &
@@ -1581,13 +1550,13 @@ subroutine combined_MP_diagnostics &
if (id_conv_liq_amt > 0 ) &
used = send_data (id_conv_liq_amt, &
tot_conv_liq /(1.0 + total_conv_cloud), Time, is, js, 1)
-
+
if (id_LWP_all_clouds > 0 ) &
call column_diag (id_LWP_all_clouds, is, js, Time, &
tot_conv_liq, 1.0, Input_mp%pmass)
!---------------------------------------------------------------------
-! define the total and convective ice and ice water path.
+! define the total and convective ice and ice water path.
!---------------------------------------------------------------------
if (id_tot_ice_amt > 0 ) &
used = send_data (id_tot_ice_amt, &
@@ -1607,16 +1576,16 @@ subroutine combined_MP_diagnostics &
if (id_IWP_all_clouds > 0 ) &
call column_diag (id_IWP_all_clouds, is, js, Time, &
tot_conv_ice, 1.0, Input_mp%pmass)
-
+
if (id_clivi > 0 ) &
call column_diag (id_clivi, is, js, Time, &
tot_conv_ice, 1.0, Input_mp%pmass)
-
+
!---------------------------------------------------------------------
-! define the total water substance and condensate water path.
+! define the total water substance and condensate water path.
!---------------------------------------------------------------------
used = send_data (id_tot_h2o , &
- (Input_mp%qin(:,:,:) + tot_conv_ice + &
+ (Input_mp%qin(:,:,:) + tot_conv_ice + &
tot_conv_liq)/(1.0 + total_conv_cloud), Time, is, js, 1)
if (id_WP_all_clouds > 0 ) &
@@ -1630,14 +1599,14 @@ subroutine combined_MP_diagnostics &
ENDIF ! (i_lsc > 0)
!---------------------------------------------------------------------
-! define the water vapor path and total vapor.
+! define the water vapor path and total vapor.
!---------------------------------------------------------------------
if (id_WVP > 0) &
call column_diag(id_WVP, is, js, Time, Input_mp%qin, 1.0, &
- Input_mp%pmass)
+ Input_mp%pmass)
if (id_prw > 0) &
call column_diag(id_prw, is, js, Time, Input_mp%qin, 1.0, &
- Input_mp%pmass)
+ Input_mp%pmass)
used = send_data (id_tot_vapor, Input_mp%qin, Time, is, js, 1)
@@ -1654,10 +1623,10 @@ subroutine combined_MP_diagnostics &
prec_intgl(is:ie,js:je) = precip(:,:)*SECONDS_PER_DAY
if (id_pr_g > 0) call buffer_global_diag (id_pr_g, precip(:,:), Time, is, js)
!---------------------------------------------------------------------
-! relative humidity:
+! relative humidity:
!---------------------------------------------------------------------
if (id_rh > 0) then
- if (.not. ( do_rh_clouds )) then
+ if (.not. ( do_rh_clouds )) then
call rh_calc (Input_mp%pfull, Input_mp%tin(:,:,:), &
Input_mp%qin(:,:,:), RH(:,:,:), do_simple )
used = send_data (id_rh, rh*100., Time, is, js, 1)
@@ -1665,7 +1634,7 @@ subroutine combined_MP_diagnostics &
endif
!---------------------------------------------------------------------
-! relative humidity (CMIP formulation):
+! relative humidity (CMIP formulation):
!---------------------------------------------------------------------
if (id_rh_cmip > 0) then
if (.not. ( do_rh_clouds )) then
@@ -1684,7 +1653,7 @@ subroutine combined_MP_diagnostics &
endif
!---------------------------------------------------------------------
-! saturation specific humidity:
+! saturation specific humidity:
!---------------------------------------------------------------------
if (id_qs > 0) then
call compute_qs (Input_mp%tin, Input_mp%pfull, qsat, &
@@ -1693,10 +1662,10 @@ subroutine combined_MP_diagnostics &
endif
!------------------------------------------------------------------------
-! call routine which calculates CAPE and CIN using model fields after
+! call routine which calculates CAPE and CIN using model fields after
! adjustment by moist_processes.
!------------------------------------------------------------------------
- call cape_cin_diagnostics (is,ie,js,je, Input_mp, Time)
+ call cape_cin_diagnostics (is,ie,js,je, Input_mp, Time)
!---------------------------------------------------------------------
@@ -1710,7 +1679,7 @@ end subroutine combined_MP_diagnostics
subroutine MP_alloc (Physics_input_block, Physics_tendency_block, &
Phys_mp_exch, dt, area, lon, lat, land, ustar, &
bstar, qstar, Input_mp,Tend_mp, C2ls_mp, Output_mp, &
- Removal_mp)
+ Removal_mp, Mp2uwconv, shflx, lhflx)
type(physics_input_block_type), &
intent(in) :: Physics_input_block
@@ -1718,13 +1687,15 @@ subroutine MP_alloc (Physics_input_block, Physics_tendency_block, &
intent(in) :: Physics_tendency_block
type(phys_mp_exch_type), intent(in) :: Phys_mp_exch
real, intent(in) :: dt
-real, dimension(:,:), intent(in) :: area, lon, lat
+real, dimension(:,:), intent(in) :: area, lon, lat
+real, dimension(:,:), intent(in) :: shflx, lhflx
real, dimension(:,:), intent(in) :: land, ustar, bstar, qstar
type(MP_input_type), intent(inout) :: Input_mp
type(MP_output_type), intent(inout) :: Output_mp
type(MP_tendency_type), intent(inout) :: Tend_mp
type(MP_conv2ls_type), intent(inout) :: C2ls_mp
type(MP_removal_type), intent(inout) :: Removal_mp
+type(mp2uwconv_type), intent(inout) :: Mp2uwconv
!------------------------------------------------------------------------
@@ -1741,24 +1712,28 @@ subroutine MP_alloc (Physics_input_block, Physics_tendency_block, &
!-------------------------------------------------------------------------
! define input array sizes.
!-------------------------------------------------------------------------
- ix = size(Physics_input_block%t,1)
- jx = size(Physics_input_block%t,2)
- kx = size(Physics_input_block%t,3)
+ ix = size(Physics_input_block%t,1)
+ jx = size(Physics_input_block%t,2)
+ kx = size(Physics_input_block%t,3)
nt = size(Physics_tendency_block%q_dt,4)
!------------------------------------------------------------------------
! allocate and initialize (or associate where possible) an mp_input_type
-! variable which will contain atmospheric field inputs needed in
+! variable which will contain atmospheric field inputs needed in
! moist_processes.
!------------------------------------------------------------------------
Input_mp%phalf => Physics_input_block%p_half
Input_mp%pfull => Physics_input_block%p_full
Input_mp%zhalf => Physics_input_block%z_half
Input_mp%zfull => Physics_input_block%z_full
- allocate (Input_mp%tin (ix,jx,kx ))
- allocate (Input_mp%qin (ix,jx,kx ))
- allocate (Input_mp%uin (ix,jx,kx ))
- allocate (Input_mp%vin (ix,jx,kx ))
+ allocate (Input_mp%tin (ix,jx,kx ))
+ allocate (Input_mp%tin_tentative (ix,jx,kx ))
+ Input_mp%tin_tentative = 0.
+ allocate (Input_mp%qin (ix,jx,kx ))
+ allocate (Input_mp%tin_orig (ix,jx,kx ))
+ allocate (Input_mp%qin_orig (ix,jx,kx ))
+ allocate (Input_mp%uin (ix,jx,kx ))
+ allocate (Input_mp%vin (ix,jx,kx ))
Input_mp%t => Physics_input_block%t
Input_mp%q => Physics_input_block%q(:,:,:,1)
Input_mp%u => Physics_input_block%u
@@ -1771,40 +1746,41 @@ subroutine MP_alloc (Physics_input_block, Physics_tendency_block, &
Input_mp%vm => Physics_input_block%vm
Input_mp%rm => Physics_input_block%qm
else
- Input_mp%tm => Physics_input_block%t
+ Input_mp%tm => Physics_input_block%t
Input_mp%qm => Physics_input_block%q (:,:,:,1)
- Input_mp%um => Physics_input_block%u
- Input_mp%vm => Physics_input_block%v
- Input_mp%rm => Physics_input_block%q
+ Input_mp%um => Physics_input_block%u
+ Input_mp%vm => Physics_input_block%v
+ Input_mp%rm => Physics_input_block%q
endif
Input_mp%omega => Physics_input_block%omega
-
+
Input_mp%r => Physics_input_block%q
Input_mp%radturbten => Phys_mp_exch%radturbten
Input_mp%diff_t => Phys_mp_exch%diff_t
- allocate (Input_mp%tracer(ix,jx,kx, size(Physics_input_block%q,4) ))
- allocate (Input_mp%area (ix,jx )) ; Input_mp%area = area
- allocate (Input_mp%lon (ix,jx )) ; Input_mp%lon = lon
- allocate (Input_mp%lat (ix,jx )) ; Input_mp%lat = lat
- allocate (Input_mp%land (ix,jx )) ; Input_mp%land = land
- Input_mp%cush => Phys_mp_exch%cush
- Input_mp%cbmf => Phys_mp_exch%cbmf
- Input_mp%pblht => Phys_mp_exch%pbltop
+ allocate (Input_mp%tracer(ix,jx,kx, size(Physics_input_block%q,4) ))
+ allocate (Input_mp%tracer_orig(ix,jx,kx, size(Physics_input_block%q,4) ))
+ allocate (Input_mp%area (ix,jx )) ; Input_mp%area = area
+ allocate (Input_mp%lon (ix,jx )) ; Input_mp%lon = lon
+ allocate (Input_mp%lat (ix,jx )) ; Input_mp%lat = lat
+ allocate (Input_mp%land (ix,jx )) ; Input_mp%land = land
+ Input_mp%cush => Phys_mp_exch%cush
+ Input_mp%cbmf => Phys_mp_exch%cbmf
+ Input_mp%pblht => Phys_mp_exch%pbltop
allocate (Input_mp%ustar (ix,jx )) ; Input_mp%ustar = ustar
allocate (Input_mp%bstar (ix,jx )) ; Input_mp%bstar = bstar
allocate (Input_mp%qstar (ix,jx )) ; Input_mp%qstar = qstar
- Input_mp%tdt_shf => Phys_mp_exch%tdt_shf
- Input_mp%qdt_lhf => Phys_mp_exch%qdt_lhf
+ Input_mp%tdt_shf => Phys_mp_exch%tdt_shf
+ Input_mp%qdt_lhf => Phys_mp_exch%qdt_lhf
allocate (Input_mp%coldT(ix,jx )) ; Input_mp%coldT = .false.
- allocate (Input_mp%pmass (ix,jx,kx))
+ allocate (Input_mp%pmass (ix,jx,kx))
!---------------------------------------------------------------------
! define input fields to be used, either the tau time level fields,
-! or the tau time level values updated with the time tendencies thus
-! far calculated on the current step. control is through variable
+! or the tau time level values updated with the time tendencies thus
+! far calculated on the current step. control is through variable
! use_tau which was obtained from Physics%control during initialization.
!---------------------------------------------------------------------
if (use_tau) then
@@ -1814,7 +1790,7 @@ subroutine MP_alloc (Physics_input_block, Physics_tendency_block, &
Input_mp%vin = Physics_input_block%v
do tr=1,size(Physics_input_block%q,4)
Input_mp%tracer(:,:,:,tr) = Physics_input_block%q(:,:,:,tr)
- end do
+ end do
else
if (associated(Physics_input_block%um)) then
Input_mp%tin = Physics_input_block%tm + &
@@ -1828,11 +1804,11 @@ subroutine MP_alloc (Physics_input_block, Physics_tendency_block, &
do tr=1,size(Physics_tendency_block%q_dt,4)
Input_mp%tracer(:,:,:,tr) = Physics_input_block%qm(:,:,:,tr) + &
Physics_tendency_block%q_dt(:,:,:,tr)*dt
- end do
+ end do
do tr=size(Physics_tendency_block%q_dt,4) +1, &
size(Physics_input_block%q,4)
Input_mp%tracer(:,:,:,tr) = Physics_input_block%q(:,:,:,tr)
- end do
+ end do
if (do_height_adjust) then
call height_adjust (Physics_input_block%tm, &
@@ -1846,10 +1822,10 @@ subroutine MP_alloc (Physics_input_block, Physics_tendency_block, &
Input_mp%zhalf = Physics_input_block%z_half + d_zhalf
Input_mp%zfull = Physics_input_block%z_full + d_zfull
else
- Input_mp%zhalf = Physics_input_block%z_half
+ Input_mp%zhalf = Physics_input_block%z_half
Input_mp%zfull = Physics_input_block%z_full
endif
-
+
else ! associated
Input_mp%tin = Physics_input_block%t + &
Physics_tendency_block%t_dt*dt
@@ -1862,11 +1838,11 @@ subroutine MP_alloc (Physics_input_block, Physics_tendency_block, &
do tr=1,size(Physics_tendency_block%q_dt,4)
Input_mp%tracer(:,:,:,tr) = Physics_input_block%q (:,:,:,tr) + &
Physics_tendency_block%q_dt(:,:,:,tr)*dt
- end do
+ end do
do tr=size(Physics_tendency_block%q_dt,4) +1, &
size(Physics_input_block%q,4)
Input_mp%tracer(:,:,:,tr) = Physics_input_block%q(:,:,:,tr)
- end do
+ end do
if (do_height_adjust) then
call height_adjust (Physics_input_block%t , &
@@ -1880,10 +1856,10 @@ subroutine MP_alloc (Physics_input_block, Physics_tendency_block, &
Input_mp%zhalf = Physics_input_block%z_half + d_zhalf
Input_mp%zfull = Physics_input_block%z_full + d_zfull
else
- Input_mp%zhalf = Physics_input_block%z_half
+ Input_mp%zhalf = Physics_input_block%z_half
Input_mp%zfull = Physics_input_block%z_full
endif
-
+
endif ! associated
endif !use_tau
@@ -1923,29 +1899,29 @@ subroutine MP_alloc (Physics_input_block, Physics_tendency_block, &
allocate (Tend_mp%qndt_conv(ix,jx,kx)) ; Tend_mp%qndt_conv = 0.
allocate (Tend_mp%qnidt_conv(ix,jx,kx)) ; Tend_mp%qnidt_conv = 0.
allocate (Tend_mp%q_tnd (ix,jx,kx,nt)) ; Tend_mp%q_tnd = 0.
-
+
!------------------------------------------------------------------------
! allocate and initialize an mp_c2ls_type variable which will
! hold quantities which need to be passed form the convection driver to
! the large-scale driver.
!------------------------------------------------------------------------
- allocate (C2ls_mp%donner_humidity_area (ix,jx,kx))
+ allocate (C2ls_mp%donner_humidity_area (ix,jx,kx))
C2ls_mp%donner_humidity_area = 0.
- allocate (C2ls_mp%donner_humidity_factor (ix,jx,kx))
+ allocate (C2ls_mp%donner_humidity_factor (ix,jx,kx))
C2ls_mp%donner_humidity_factor = 0.
- allocate (C2ls_mp%convective_humidity_area (ix,jx,kx))
+ allocate (C2ls_mp%convective_humidity_area (ix,jx,kx))
C2ls_mp%convective_humidity_area = 0.
- allocate (C2ls_mp%convective_humidity_ratio (ix,jx,kx))
+ allocate (C2ls_mp%convective_humidity_ratio (ix,jx,kx))
C2ls_mp%convective_humidity_ratio = 0.
- allocate (C2ls_mp%conv_frac_clubb (ix,jx,kx))
+ allocate (C2ls_mp%conv_frac_clubb (ix,jx,kx))
C2ls_mp%conv_frac_clubb = 0.
- allocate (C2ls_mp%convective_humidity_ratio_clubb (ix,jx,kx))
+ allocate (C2ls_mp%convective_humidity_ratio_clubb (ix,jx,kx))
C2ls_mp%convective_humidity_ratio_clubb = 0.
- allocate (C2ls_mp%wet_data (ix,jx,kx,nt)) ; C2ls_mp%wet_data = 0.
- allocate (C2ls_mp%cloud_wet (ix,jx,kx)) ; C2ls_mp%cloud_wet = 0.
- allocate (C2ls_mp%cloud_frac (ix,jx,kx)) ; C2ls_mp%cloud_frac = 0.
- allocate (C2ls_mp%mc_full (ix,jx,kx)) ; C2ls_mp%mc_full = 0.
- allocate (C2ls_mp%mc_half(ix,jx,kx+1)) ; C2ls_mp%mc_half = 0.
+ allocate (C2ls_mp%wet_data (ix,jx,kx,nt)) ; C2ls_mp%wet_data = 0.
+ allocate (C2ls_mp%cloud_wet (ix,jx,kx)) ; C2ls_mp%cloud_wet = 0.
+ allocate (C2ls_mp%cloud_frac (ix,jx,kx)) ; C2ls_mp%cloud_frac = 0.
+ allocate (C2ls_mp%mc_full (ix,jx,kx)) ; C2ls_mp%mc_full = 0.
+ allocate (C2ls_mp%mc_half(ix,jx,kx+1)) ; C2ls_mp%mc_half = 0.
!------------------------------------------------------------------------
! allocate and initialize an Mp_output_type variable which will
@@ -1955,16 +1931,20 @@ subroutine MP_alloc (Physics_input_block, Physics_tendency_block, &
Output_mp%tdt => Physics_tendency_block%t_dt
Output_mp%udt => Physics_tendency_block%u_dt
Output_mp%vdt => Physics_tendency_block%v_dt
- Output_mp%rdt => Physics_tendency_block%q_dt
- Output_mp%convect => Phys_mp_exch%convect
+ Output_mp%rdt => Physics_tendency_block%q_dt
+ allocate (Output_mp%rdt_init (ix,jx,kx,nt)) ; Output_mp%rdt_init = 0.
+ allocate (Output_mp%rdt_tentative (ix,jx,kx,nt)) ; &
+ Output_mp%rdt_tentative = 0.
+ Output_mp%convect => Phys_mp_exch%convect
Output_mp%convect = .false.
- allocate ( Output_mp%lprec (ix,jx)) ; Output_mp%lprec = 0.
- allocate ( Output_mp%fprec (ix,jx)) ; Output_mp%fprec = 0.
- allocate ( Output_mp%gust_cv(ix,jx)) ; Output_mp%gust_cv = 0.
+ allocate ( Output_mp%lprec (ix,jx)) ; Output_mp%lprec = 0.
+ allocate ( Output_mp%fprec (ix,jx)) ; Output_mp%fprec = 0.
+ allocate ( Output_mp%precip (ix,jx)) ; Output_mp%precip = 0.
+ allocate ( Output_mp%gust_cv(ix,jx)) ; Output_mp%gust_cv = 0.
Output_mp%diff_t_clubb => Phys_mp_exch%diff_t_clubb
- Output_mp%diff_t_clubb =0.
+ Output_mp%diff_t_clubb =0.
Output_mp%diff_cu_mo => Phys_mp_exch%diff_cu_mo
- Output_mp%diff_cu_mo = 0.
+ Output_mp%diff_cu_mo = 0.
!------------------------------------------------------------------------
! allocate and initialize an mp_removal_type variable which will
@@ -1972,58 +1952,72 @@ subroutine MP_alloc (Physics_input_block, Physics_tendency_block, &
! atmosphere by the convective and large-scale cloud processes.
!------------------------------------------------------------------------
- allocate ( Removal_mp%ice_precflx(ix,jx,kx))
- Removal_mp%ice_precflx= 0.
- allocate ( Removal_mp%liq_precflx(ix,jx,kx))
- Removal_mp%liq_precflx= 0.
- allocate ( Removal_mp%ice_precflxh(ix,jx,kx+1))
+ allocate ( Removal_mp%ice_precflx(ix,jx,kx))
+ Removal_mp%ice_precflx= 0.
+ allocate ( Removal_mp%liq_precflx(ix,jx,kx))
+ Removal_mp%liq_precflx= 0.
+ allocate ( Removal_mp%ice_precflxh(ix,jx,kx+1))
Removal_mp%ice_precflxh= 0.
- allocate ( Removal_mp%liq_precflxh(ix,jx,kx+1))
- Removal_mp%liq_precflxh= 0.
- allocate ( Removal_mp%frz_meso(ix,jx,kx)) ; Removal_mp%frz_meso= 0.
- allocate ( Removal_mp%liq_meso(ix,jx,kx)) ; Removal_mp%liq_meso= 0.
- allocate ( Removal_mp%frz_cell(ix,jx,kx)) ; Removal_mp%frz_cell= 0.
- allocate ( Removal_mp%liq_cell(ix,jx,kx)) ; Removal_mp%liq_cell= 0.
- allocate ( Removal_mp%frz_mesoh(ix,jx,kx+1))
- Removal_mp%frz_mesoh= 0.
- allocate ( Removal_mp%liq_mesoh(ix,jx,kx+1))
- Removal_mp%liq_mesoh= 0.
- allocate ( Removal_mp%frz_cellh(ix,jx,kx+1))
- Removal_mp%frz_cellh= 0.
- allocate ( Removal_mp%liq_cellh(ix,jx,kx+1))
- Removal_mp%liq_cellh= 0.
- allocate ( Removal_mp%mca_frz (ix,jx,kx))
- Removal_mp%mca_frz = 0.
- allocate ( Removal_mp%mca_liq (ix,jx,kx))
- Removal_mp%mca_liq = 0.
- allocate ( Removal_mp%mca_frzh (ix,jx,kx+1))
- Removal_mp%mca_frzh = 0.
- allocate ( Removal_mp%mca_liqh (ix,jx,kx+1))
- Removal_mp%mca_liqh = 0.
- allocate ( Removal_mp%rain3d (ix,jx,kx+1))
- Removal_mp%rain3d = 0.
- allocate ( Removal_mp%snow3d (ix,jx,kx+1))
- Removal_mp%snow3d = 0.
- allocate ( Removal_mp%snowclr3d (ix,jx,kx+1))
- Removal_mp%snowclr3d = 0.
+ allocate ( Removal_mp%liq_precflxh(ix,jx,kx+1))
+ Removal_mp%liq_precflxh= 0.
+ allocate ( Removal_mp%frz_meso(ix,jx,kx)) ; Removal_mp%frz_meso= 0.
+ allocate ( Removal_mp%liq_meso(ix,jx,kx)) ; Removal_mp%liq_meso= 0.
+ allocate ( Removal_mp%frz_cell(ix,jx,kx)) ; Removal_mp%frz_cell= 0.
+ allocate ( Removal_mp%liq_cell(ix,jx,kx)) ; Removal_mp%liq_cell= 0.
+ allocate ( Removal_mp%frz_mesoh(ix,jx,kx+1))
+ Removal_mp%frz_mesoh= 0.
+ allocate ( Removal_mp%liq_mesoh(ix,jx,kx+1))
+ Removal_mp%liq_mesoh= 0.
+ allocate ( Removal_mp%frz_cellh(ix,jx,kx+1))
+ Removal_mp%frz_cellh= 0.
+ allocate ( Removal_mp%liq_cellh(ix,jx,kx+1))
+ Removal_mp%liq_cellh= 0.
+ allocate ( Removal_mp%mca_frz (ix,jx,kx))
+ Removal_mp%mca_frz = 0.
+ allocate ( Removal_mp%mca_liq (ix,jx,kx))
+ Removal_mp%mca_liq = 0.
+ allocate ( Removal_mp%mca_frzh (ix,jx,kx+1))
+ Removal_mp%mca_frzh = 0.
+ allocate ( Removal_mp%mca_liqh (ix,jx,kx+1))
+ Removal_mp%mca_liqh = 0.
+ allocate ( Removal_mp%rain3d (ix,jx,kx+1))
+ Removal_mp%rain3d = 0.
+ allocate ( Removal_mp%snow3d (ix,jx,kx+1))
+ Removal_mp%snow3d = 0.
+ allocate ( Removal_mp%snowclr3d (ix,jx,kx+1))
+ Removal_mp%snowclr3d = 0.
allocate ( Removal_mp%uw_wetdep (ix,jx, &
- Removal_mp_control%num_uw_tracers))
- Removal_mp%uw_wetdep = 0.
+ Removal_mp_control%num_uw_tracers))
+ Removal_mp%uw_wetdep = 0.
allocate ( Removal_mp%donner_wetdep &
(ix,jx, &
- Removal_mp_control%num_donner_tracers))
- Removal_mp%donner_wetdep = 0.
+ Removal_mp_control%num_donner_tracers))
+ Removal_mp%donner_wetdep = 0.
allocate ( Removal_mp%donner_wetdepm &
(ix,jx, &
- Removal_mp_control%num_donner_tracers))
- Removal_mp%donner_wetdepm = 0.
+ Removal_mp_control%num_donner_tracers))
+ Removal_mp%donner_wetdepm = 0.
allocate ( Removal_mp%donner_wetdepc &
(ix,jx, &
- Removal_mp_control%num_donner_tracers))
- Removal_mp%donner_wetdepc = 0.
- allocate ( Removal_mp%ls_wetdep (ix,jx,nt))
+ Removal_mp_control%num_donner_tracers))
+ Removal_mp%donner_wetdepc = 0.
+ allocate ( Removal_mp%ls_wetdep (ix,jx,nt))
Removal_mp%ls_wetdep = 0.
+!-----------------------------------------------------------------------
+! probably associate the lhflx, shflx
+
+ allocate ( Mp2uwconv%shflx (ix,jx))
+ allocate ( Mp2uwconv%lhflx (ix,jx))
+ allocate ( Mp2uwconv%tdt_dif (ix,jx,kx))
+ allocate ( Mp2uwconv%qdt_dif (ix,jx,kx))
+ Mp2uwconv%shflx = shflx
+ Mp2uwconv%lhflx = lhflx
+ Mp2uwconv%tdt_dif = Physics_tendency_block%t_dt !miz
+ Mp2uwconv%qdt_dif = Physics_tendency_block%q_dt(:,:,:,nsphum) + & !miz
+ Physics_tendency_block%q_dt(:,:,:,nql) + &
+ Physics_tendency_block%q_dt(:,:,:,nqi)
+
!-------------------------------------------------------------------------
end subroutine MP_alloc
@@ -2031,13 +2025,15 @@ end subroutine MP_alloc
!########################################################################
-subroutine MP_dealloc (Input_mp, Tend_mp, C2ls_mp, Output_mp, Removal_mp)
+subroutine MP_dealloc (Input_mp, Tend_mp, C2ls_mp, Output_mp, Removal_mp, &
+ Mp2uwconv)
type(MP_input_type), intent(inout) :: Input_mp
type(MP_tendency_type), intent(inout) :: Tend_mp
type(MP_conv2ls_type), intent(inout) :: C2ls_mp
type(MP_output_type), intent(inout) :: Output_mp
type(MP_removal_type), intent(inout) :: Removal_mp
+type(mp2uwconv_type), intent(inout) :: Mp2uwconv
!------------------------------------------------------------------------
! deallocate the components of the derived type variables defined in
@@ -2050,7 +2046,10 @@ subroutine MP_dealloc (Input_mp, Tend_mp, C2ls_mp, Output_mp, Removal_mp)
Input_mp%zfull => null()
deallocate (Input_mp%tin )
+ deallocate (Input_mp%tin_tentative )
deallocate (Input_mp%qin )
+ deallocate (Input_mp%tin_orig )
+ deallocate (Input_mp%qin_orig )
deallocate (Input_mp%uin )
deallocate (Input_mp%vin )
@@ -2072,6 +2071,7 @@ subroutine MP_dealloc (Input_mp, Tend_mp, C2ls_mp, Output_mp, Removal_mp)
deallocate (Input_mp%lon )
deallocate (Input_mp%lat )
deallocate (Input_mp%tracer)
+ deallocate (Input_mp%tracer_orig)
deallocate (Input_mp%land )
deallocate (Input_mp%ustar )
deallocate (Input_mp%bstar )
@@ -2133,14 +2133,22 @@ subroutine MP_dealloc (Input_mp, Tend_mp, C2ls_mp, Output_mp, Removal_mp)
Output_mp%udt => null()
Output_mp%vdt => null()
Output_mp%rdt => null()
+ deallocate (Output_mp%rdt_init)
+ deallocate (Output_mp%rdt_tentative)
deallocate (Output_mp%lprec )
deallocate (Output_mp%fprec )
+ deallocate (Output_mp%precip )
deallocate (Output_mp%gust_cv)
Output_mp%convect => null()
Output_mp%diff_t_clubb => null()
Output_mp%diff_cu_mo => null()
+ deallocate (Mp2uwconv%shflx )
+ deallocate (Mp2uwconv%lhflx )
+ deallocate (Mp2uwconv%tdt_dif)
+ deallocate (Mp2uwconv%qdt_dif)
+
!--------------------------------------------------------------------
end subroutine MP_dealloc
@@ -2149,7 +2157,7 @@ end subroutine MP_dealloc
!########################################################################
-subroutine create_Nml_mp
+subroutine create_Nml_mp
Nml_mp%do_mca = do_mca
@@ -2163,7 +2171,7 @@ subroutine create_Nml_mp
Nml_mp%do_simple = do_simple
Nml_mp%do_rh_clouds = do_rh_clouds
Nml_mp%do_donner_deep = do_donner_deep
- Nml_mp%do_bm = do_bm
+ Nml_mp%do_bm = do_bm
Nml_mp%do_bmmass = do_bmmass
Nml_mp%do_bmomp = do_bmomp
Nml_mp%do_unified_clouds = do_unified_clouds
@@ -2205,8 +2213,10 @@ subroutine diag_field_init ( axes, Time )
'Frozen precip rate from all sources', 'kg(h2o)/m2/s', &
interp_method = "conserve_order1" )
+
+
id_prra = register_cmip_diag_field_2d ( mod_name, 'prra', Time, &
- 'Rainfall Rate', 'kg m-2 s-1', &
+ 'Rainfall Rate', 'kg m-2 s-1', &
standard_name = 'rainfall_flux', &
interp_method = "conserve_order1" )
@@ -2215,7 +2225,6 @@ subroutine diag_field_init ( axes, Time )
standard_name = 'snowfall_flux', &
interp_method = "conserve_order1" )
-
id_max_enthalpy_imbal = register_diag_field &
(mod_name, 'max_enth_imbal', axes(1:2), Time, &
'max enthalpy imbalance from moist_processes ', 'W/m2', &
@@ -2229,7 +2238,7 @@ subroutine diag_field_init ( axes, Time )
id_enth_moist_col = register_diag_field ( mod_name, &
'enth_moist_col', axes(1:2), Time, &
'Column enthalpy imbalance from moist processes','W/m2' )
-
+
id_wat_moist_col = register_diag_field ( mod_name, &
'wat_moist_col', axes(1:2), Time, &
'Column total water imbalance from moist processes','kg/m2/s' )
@@ -2239,6 +2248,7 @@ subroutine diag_field_init ( axes, Time )
'Total precipitation rate', 'kg/m2/s', &
interp_method = "conserve_order1" )
+
id_pr = register_cmip_diag_field_2d ( mod_name, 'pr', Time, &
'Precipitation', 'kg m-2 s-1', &
standard_name='precipitation_flux', &
@@ -2248,8 +2258,9 @@ subroutine diag_field_init ( axes, Time )
'WVP', axes(1:2), Time, &
'Column integrated water vapor', 'kg/m2' )
+
id_prw = register_cmip_diag_field_2d ( mod_name, 'prw', Time, &
- 'Water Vapor Path', 'kg m-2', &
+ 'Water Vapor Path', 'kg m-2', &
standard_name = 'atmosphere_water_vapor_content' )
!-----------------------------------------------------------------------
@@ -2266,6 +2277,7 @@ subroutine diag_field_init ( axes, Time )
'total cloud amount', 'percent', &
interp_method = 'conserve_order1' )
+
id_clt = register_cmip_diag_field_2d (mod_name, 'clt', Time, &
'Total Cloud Cover Percentage', '%', &
standard_name= 'cloud_area_fraction', &
@@ -2278,8 +2290,8 @@ subroutine diag_field_init ( axes, Time )
ID_cl = register_cmip_diag_field_3d ( mod_name, 'cl', Time, &
'Percentage Cloud Cover', '%', &
- standard_name='cloud_area_fraction_in_atmosphere_layer', &
- interp_method='conserve_order1' )
+ standard_name='cloud_area_fraction_in_atmosphere_layer', &
+ interp_method='conserve_order1' )
id_tot_h2o = register_diag_field ( mod_name, &
'tot_h2o', axes(1:3), Time, &
@@ -2292,7 +2304,7 @@ subroutine diag_field_init ( axes, Time )
id_tot_liq_amt = register_diag_field ( mod_name, &
'tot_liq_amt', axes(1:3), Time, &
'Liquid amount -- all clouds', 'kg/kg', &
- missing_value=missing_value, interp_method='conserve_order1' )
+ missing_value=missing_value, interp_method='conserve_order1' )
ID_clw = register_cmip_diag_field_3d ( mod_name, 'clw', Time, &
'Mass Fraction of Cloud Liquid Water', 'kg kg-1', &
@@ -2302,7 +2314,7 @@ subroutine diag_field_init ( axes, Time )
id_tot_ice_amt = register_diag_field ( mod_name, &
'tot_ice_amt', axes(1:3), Time, &
'Ice amount -- all clouds', 'kg/kg', &
- missing_value=missing_value, interp_method='conserve_order1' )
+ missing_value=missing_value, interp_method='conserve_order1' )
ID_cli = register_cmip_diag_field_3d ( mod_name, 'cli', Time, &
'Mass Fraction of Cloud Ice', 'kg kg-1', &
@@ -2312,33 +2324,33 @@ subroutine diag_field_init ( axes, Time )
id_lsc_cloud_area = register_diag_field ( mod_name, &
'lsc_cloud_area', axes(1:3), Time, &
'Large-scale cloud area', 'percent', &
- missing_value=missing_value, interp_method='conserve_order1' )
+ missing_value=missing_value, interp_method='conserve_order1' )
id_lsc_liq_amt = register_diag_field ( mod_name, &
'lsc_liq_amt', axes(1:3), Time, &
'Large-scale cloud liquid amount', 'kg/kg', &
- missing_value=missing_value, interp_method='conserve_order1' )
+ missing_value=missing_value, interp_method='conserve_order1' )
id_lsc_ice_amt = register_diag_field ( mod_name, &
'lsc_ice_amt', axes(1:3), Time, &
'Large-scale cloud ice amount', 'kg/kg', &
- missing_value=missing_value, interp_method='conserve_order1' )
+ missing_value=missing_value, interp_method='conserve_order1' )
id_conv_cloud_area = register_diag_field ( mod_name, &
'conv_cloud_area', axes(1:3), Time, &
- 'Convective cloud area', 'percent', missing_value=missing_value, &
+ 'Convective cloud area', 'percent', missing_value=missing_value,&
interp_method='conserve_order1' )
id_conv_liq_amt = register_diag_field ( mod_name, &
'conv_liq_amt', axes(1:3), Time, &
'Convective cloud liquid amount', 'kg/kg', &
- missing_value=missing_value, interp_method='conserve_order1' )
+ missing_value=missing_value, interp_method='conserve_order1' )
id_conv_ice_amt = register_diag_field ( mod_name, &
'conv_ice_amt', axes(1:3), Time, &
'Convective cloud ice amount', 'kg/kg', &
missing_value=missing_value, interp_method='conserve_order1' )
-
+
id_WP_all_clouds = register_diag_field ( mod_name, &
'WP_all_clouds', axes(1:2), Time, &
'Total water path -- all clouds + ls precip', 'kg/m2', &
@@ -2361,14 +2373,14 @@ subroutine diag_field_init ( axes, Time )
id_clivi = register_cmip_diag_field_2d ( mod_name, 'clivi', Time, &
'Ice Water Path', 'kg m-2', &
- standard_name='atmosphere_mass_content_of_cloud_ice', &
+ standard_name='atmosphere_mass_content_of_cloud_ice', &
interp_method='conserve_order1' )
endif
id_rh = register_diag_field ( mod_name, &
'rh', axes(1:3), Time, &
- 'relative humidity', 'percent', &
+ 'relative humidity', 'percent', &
missing_value=missing_value )
id_rh_cmip = register_diag_field ( mod_name, &
@@ -2382,11 +2394,11 @@ subroutine diag_field_init ( axes, Time )
id_qs = register_diag_field ( mod_name, &
'qs', axes(1:3), Time, &
- 'saturation specific humidity', 'kg/kg', &
+ 'saturation specific humidity', 'kg/kg', &
missing_value=missing_value )
-
+
!---------------------------------------------------------------------
-! register the diagnostics associated with convective tracer
+! register the diagnostics associated with convective tracer
! transport.
!---------------------------------------------------------------------
id_wetdep_om = register_diag_field ( mod_name, &
@@ -2441,7 +2453,6 @@ subroutine diag_field_init ( axes, Time )
missing_value=missing_value)
if (id_wetdep_dust > 0) wetdep_diagnostics_desired = .true.
-
id_n_ox_wdep = register_cmip_diag_field_2d ( mod_name, 'fam_noy_wetdep_kg_m2_s', Time, &
'wet deposition of noy incl aerosol nitrate', 'kg m-2 s-1', &
standard_name='minus_tendency_of_atmosphere_mass_content_of_noy_expressed_as_nitrogen_due_to_wet_deposition' )
@@ -2450,7 +2461,7 @@ subroutine diag_field_init ( axes, Time )
id_n_red_wdep = register_cmip_diag_field_2d ( mod_name, 'fam_nhx_wetdep_kg_m2_s', Time, &
'wet deposition of nhx', 'kg m-2 s-1', &
standard_name='minus_tendency_of_atmosphere_mass_content_of_nhx_expressed_as_nitrogen_due_to_wet_deposition' )
-
+
!-------- cmip wet deposition fields ---------
do ic = 1, size(cmip_names,1)
@@ -2496,9 +2507,9 @@ subroutine diag_field_init ( axes, Time )
id_wetdepc_donner = -1
id_wetdepm_donner = -1
id_wetdep_kg_m2_s = -1
-
- outunit = stdout()
- do n = 1, num_prog_tracers
+
+ outunit = stdout()
+ do n = 1, num_prog_tracers
call get_tracer_names (MODEL_ATMOS, n, name = tracer_name, units=tracer_units)
call get_cmip_param (n, cmip_name=cmip_name, cmip_longname=cmip_longname, cmip_longname2=cmip_longname2)
call get_chem_param (n, mw=tracer_mw, is_aerosol=cmip_is_aerosol, nb_N=nb_N(n), nb_N_Ox=nb_N_Ox(n), nb_N_red=nb_N_red(n))
@@ -2506,21 +2517,21 @@ subroutine diag_field_init ( axes, Time )
write(outunit,'(a,g14.6)') trim(tracer_name)//', tracer_mw=',tracer_mw
if (cmip_is_aerosol) then
- id_wetdep_kg_m2_s(n) = register_cmip_diag_field_2d ( mod_name, &
- trim(tracer_name)//'_wetdep_kg_m2_s', Time, &
+ id_wetdep_kg_m2_s(n) = register_cmip_diag_field_2d ( mod_name, &
+ trim(tracer_name)//'_wetdep_kg_m2_s', Time, &
'Wet Deposition Rate of '//TRIM(cmip_longname2), 'kg m-2 s-1', &
standard_name='minus_tendency_of_atmosphere_mass_content_of_'//TRIM(cmip_name)//'_dry_aerosol_particles_due_to_wet_deposition')
else
- id_wetdep_kg_m2_s(n) = register_cmip_diag_field_2d ( mod_name, &
- trim(tracer_name)//'_wetdep_kg_m2_s', Time, &
+ id_wetdep_kg_m2_s(n) = register_cmip_diag_field_2d ( mod_name, &
+ trim(tracer_name)//'_wetdep_kg_m2_s', Time, &
'Wet Deposition Rate of '//TRIM(cmip_longname2), 'kg m-2 s-1', &
standard_name='minus_tendency_of_atmosphere_mass_content_of_'//TRIM(cmip_name)//'_due_to_wet_deposition')
end if
if (id_wetdep_kg_m2_s(n) > 0) wetdep_diagnostics_desired = .true.
-
+
if (id_wetdep_kg_m2_s(n) > 0) then
if (tracer_mw < 0.0) then
- call error_mesg ('moist_processes', 'mw needs to be defined for tracer: '//trim(tracer_name), FATAL)
+ call error_mesg ('moist_processes', 'mw needs to be defined fortracer: '//trim(tracer_name), FATAL)
!else
! write(outunit,'(a,g14.6)') trim(tracer_name)//', tracer_mw=',tracer_mw
end if
@@ -2611,12 +2622,11 @@ subroutine diag_field_init ( axes, Time )
conv_wetdep(n) = 1.
conv_wetdep_kg_m2_s(n) = 1. ! no conversion needed
-
- else
- write(outunit,'(a)') 'unsupported tracer: '//trim(tracer_name)//', units='//trim(tracer_units)
+ else
+ write(outunit,'(a)') 'unsupported tracer: '//trim(tracer_name)//' , units='//trim(tracer_units)
conv_wetdep(n) = 0.
conv_wetdep_kg_m2_s(n) = 0.
- end if
+ end if
if (id_wetdep(n) > 0) wetdep_diagnostics_desired = .true.
@@ -2642,7 +2652,7 @@ end subroutine diag_field_init
!
subroutine moist_processes_restart(timestamp)
character(len=*), intent(in), optional :: timestamp
-
+
! if (doing_prog_clouds) call strat_cloud_restart(timestamp)
! if (do_diag_clouds) call diag_cloud_restart(timestamp)
! if (do_donner_deep) call donner_deep_restart(timestamp)
@@ -2691,11 +2701,11 @@ subroutine height_adjust(t, qv, r, tn, qvn, rn, &
! do k=1,kx
! dlp (:,:,k)=log(phalf(:,:,k+1))-log(phalf(:,:,k))
-! tmp1(:,:,k)=RDGAS/GRAV*tv (:,:,k)*dlp(:,:,k)
-! tmp2(:,:,k)=RDGAS/GRAV*tvn(:,:,k)*dlp(:,:,k)
-! tv (:,:,k)=zhalf_n(:,:,k)-zhalf(:,:,k)
-! tvn (:,:,k)=zfull_n(:,:,k)-zfull(:,:,k)
-! tmp (:,:,k)=(zhalf(:,:,k+1)+zhalf(:,:,k))*0.5-zfull(:,:,k)
+! tmp1(:,:,k)=RDGAS/GRAV*tv (:,:,k)*dlp(:,:,k)
+! tmp2(:,:,k)=RDGAS/GRAV*tvn(:,:,k)*dlp(:,:,k)
+! tv (:,:,k)=zhalf_n(:,:,k)-zhalf(:,:,k)
+! tvn (:,:,k)=zfull_n(:,:,k)-zfull(:,:,k)
+! tmp (:,:,k)=(zhalf(:,:,k+1)+zhalf(:,:,k))*0.5-zfull(:,:,k)
! enddo
end subroutine height_adjust
diff --git a/atmos_param/moist_processes/moist_processes_utils.F90 b/atmos_param/moist_processes/moist_processes_utils.F90
index 72e00fae..5118b2a1 100644
--- a/atmos_param/moist_processes/moist_processes_utils.F90
+++ b/atmos_param/moist_processes/moist_processes_utils.F90
@@ -29,13 +29,19 @@ module moist_proc_utils_mod
use diag_manager_mod, only: send_data
use constants_mod, only: RDGAS, RVGAS
use lscloud_types_mod, only: diag_pt_type, diag_id_type
+use field_manager_mod, only: MODEL_ATMOS
+use tracer_manager_mod, only: get_tracer_index,&
+ get_tracer_names, &
+ query_method, &
+ NO_TRACER
implicit none
private
!------------------ private and public data/interfaces -----------------
-public capecalcnew, tempavg, column_diag, rh_calc
+public capecalcnew, tempavg, column_diag, rh_calc, &
+ define_removal_mp_control_type, deallocate_mp_removal_control_type
public mp_input_type, mp_nml_type, mp_tendency_type, &
mp_removal_control_type, mp_conv2ls_type, mp_output_type, &
@@ -76,6 +82,8 @@ module moist_proc_utils_mod
real, dimension(:,:,:), pointer :: zfull => NULL()
real, dimension(:,:,:), allocatable :: tin
real, dimension(:,:,:), allocatable :: qin
+ real, dimension(:,:,:), allocatable :: tin_orig
+ real, dimension(:,:,:), allocatable :: qin_orig
real, dimension(:,:,:), allocatable :: uin
real, dimension(:,:,:), allocatable :: vin
real, dimension(:,:,:), pointer :: w => NULL()
@@ -83,6 +91,7 @@ module moist_proc_utils_mod
real, dimension(:,:,:), pointer :: radturbten => NULL()
real, dimension(:,:,:), pointer :: diff_t => NULL()
real, dimension(:,:,:,:), allocatable :: tracer
+ real, dimension(:,:,:,:), allocatable :: tracer_orig
real, dimension(:,:,:), pointer :: t => NULL()
real, dimension(:,:,:), pointer :: q => NULL()
real, dimension(:,:,:), pointer :: u => NULL()
@@ -94,6 +103,7 @@ module moist_proc_utils_mod
real, dimension(:,:,:), pointer :: vm => NULL()
real, dimension(:,:,:,:), pointer :: rm => NULL()
real, dimension(:,:,:), allocatable :: pmass
+ real, dimension(:,:,:), allocatable :: tin_tentative
end type mp_input_type
type mp_output_type
@@ -101,9 +111,12 @@ module moist_proc_utils_mod
real, dimension(:,:,:), pointer :: udt => NULL()
real, dimension(:,:,:), pointer :: vdt => NULL()
real, dimension(:,:,:,:), pointer :: rdt => NULL()
+ real, dimension(:,:,:,:), allocatable :: rdt_init
+ real, dimension(:,:,:,:), allocatable :: rdt_tentative
logical, dimension(:,:), pointer :: convect => NULL()
real, dimension(:,:), allocatable :: lprec
real, dimension(:,:), allocatable :: fprec
+ real, dimension(:,:), allocatable :: precip
real, dimension(:,:), allocatable :: gust_cv
real, dimension(:,:,:), pointer :: diff_t_clubb => NULL()
real, dimension(:,:,:), pointer :: diff_cu_mo => NULL()
@@ -993,11 +1006,124 @@ subroutine rh_calc (pfull, T, qv, RH, do_simple, do_cmip)
END SUBROUTINE rh_calc
+!#######################################################################
+
+subroutine define_removal_mp_control_type (Control, num_prog_tracers)
+
+type(mp_removal_control_type), intent(inout) :: Control
+integer, intent(in) :: num_prog_tracers
+
+
+ integer :: n
+ character(len=80) :: scheme
+
+
+
+!------------------------------------------------------------------------
+! allocate and initialize an Mp_removal_control_type variable which will
+! indicate for each tracer whether it is to be transported by the
+! various available convective schemes. Also included is a counter of
+! the number of tracers being affected by each available convective
+! scheme.
+!------------------------------------------------------------------------
+ allocate (control%tracers_in_donner(num_prog_tracers))
+ allocate (control%tracers_in_ras(num_prog_tracers))
+ allocate (control%tracers_in_uw(num_prog_tracers))
+ allocate (control%tracers_in_mca(num_prog_tracers))
+ control%tracers_in_donner = .false.
+ control%tracers_in_ras = .false.
+ control%tracers_in_uw = .false.
+ control%tracers_in_mca = .false.
+ control%num_mca_tracers = 0
+ control%num_ras_tracers = 0
+ control%num_donner_tracers = 0
+ control%num_uw_tracers = 0
+
+!----------------------------------------------------------------------
+! for each tracer, determine if it is to be transported by convect-
+! ion, and the convection schemes that are to transport it. set a
+! logical flag to .true. for each tracer that is to be transported by
+! each scheme and increment the count of tracers to be transported
+! by that scheme.
+!----------------------------------------------------------------------
+ do n=1, num_prog_tracers
+ if (query_method ('convection', MODEL_ATMOS, n, scheme)) then
+ select case (scheme)
+ case ("none")
+ case ("donner")
+ Control%num_donner_tracers = Control%num_donner_tracers + 1
+ Control%tracers_in_donner(n) = .true.
+ case ("mca")
+ Control%num_mca_tracers = Control%num_mca_tracers + 1
+ Control%tracers_in_mca(n) = .true.
+ case ("ras")
+ Control%num_ras_tracers = Control%num_ras_tracers + 1
+ Control%tracers_in_ras(n) = .true.
+ case ("uw")
+ Control%num_uw_tracers = Control%num_uw_tracers + 1
+ Control%tracers_in_uw(n) = .true.
+ case ("donner_and_ras")
+ Control%num_donner_tracers = Control%num_donner_tracers + 1
+ Control%tracers_in_donner(n) = .true.
+ Control%num_ras_tracers = Control%num_ras_tracers + 1
+ Control%tracers_in_ras(n) = .true.
+ case ("donner_and_mca")
+ Control%num_donner_tracers = Control%num_donner_tracers + 1
+ Control%tracers_in_donner(n) = .true.
+ Control%num_mca_tracers = Control%num_mca_tracers + 1
+
+ Control%tracers_in_mca(n) = .true.
+ case ("mca_and_ras")
+ Control%num_mca_tracers = Control%num_mca_tracers + 1
+ Control%tracers_in_mca(n) = .true.
+ Control%num_ras_tracers = Control%num_ras_tracers + 1
+ Control%tracers_in_ras(n) = .true.
+ case ("all")
+ Control%num_donner_tracers = Control%num_donner_tracers + 1
+ Control%tracers_in_donner(n) = .true.
+ Control%num_mca_tracers = Control%num_mca_tracers + 1
+ Control%tracers_in_mca(n) = .true.
+ Control%num_ras_tracers = Control%num_ras_tracers + 1
+ Control%tracers_in_ras(n) = .true.
+ Control%num_uw_tracers = Control%num_uw_tracers + 1
+ Control%tracers_in_uw(n) = .true.
+ case ("all_nodonner")
+ Control%num_mca_tracers = Control%num_mca_tracers + 1
+ Control%tracers_in_mca(n) = .true.
+ Control%num_ras_tracers = Control%num_ras_tracers + 1
+ Control%tracers_in_ras(n) = .true.
+ Control%num_uw_tracers = Control%num_uw_tracers + 1
+ Control%tracers_in_uw(n) = .true.
+ case default ! corresponds to "none"
+ end select
+ endif
+ end do
+
+end subroutine define_removal_mp_control_type
+
+
+!#######################################################################
+
+subroutine deallocate_mp_removal_control_type (Removal_mp_control)
+
+type(mp_removal_control_type), intent(inout) :: Removal_mp_control
+
+ deallocate (Removal_mp_control%tracers_in_donner )
+ deallocate (Removal_mp_control%tracers_in_ras )
+ deallocate (Removal_mp_control%tracers_in_uw )
+ deallocate (Removal_mp_control%tracers_in_mca )
+
+
+end subroutine deallocate_mp_removal_control_type
+
+
!#######################################################################
+
end module moist_proc_utils_mod
+
diff --git a/atmos_param/my25_turb/my25_turb.F90 b/atmos_param/my25_turb/my25_turb.F90
index 20940a7b..99a7dfcd 100644
--- a/atmos_param/my25_turb/my25_turb.F90
+++ b/atmos_param/my25_turb/my25_turb.F90
@@ -5,12 +5,16 @@ MODULE MY25_TURB_MOD
!=======================================================================
use mpp_mod, only : input_nml_file
- use fms_mod, only : file_exist, open_namelist_file, error_mesg, &
- FATAL, close_file, note, read_data, &
+ use mpp_domains_mod, only : domain2D
+ use fms_mod, only : error_mesg, &
+ FATAL, note, &
check_nml_error, mpp_pe, mpp_root_pe, &
- write_version_number, stdlog, open_restart_file
- use fms_io_mod, only : register_restart_field, restart_file_type, &
- save_restart, restore_state
+ write_version_number, stdlog
+use fms2_io_mod, only : FmsNetcdfFile_t, FmsNetcdfDomainFile_t, &
+ register_restart_field, register_axis, unlimited, &
+ open_file, read_restart, write_restart, close_file, &
+ register_field, write_data, register_variable_attribute, &
+ get_global_io_domain_indices
use tridiagonal_mod, only : tri_invert, close_tridiagonal
use constants_mod, only : grav, vonkarm
use monin_obukhov_mod, only : mo_diff
@@ -39,8 +43,8 @@ MODULE MY25_TURB_MOD
integer :: num_total_pts, pts_done
! for netcdf restart file.
- type(restart_file_type), save :: Tur_restart
+ type (domain2D), pointer :: my25_domain !< Atmosphere_domain
!---------------------------------------------------------------------
! --- CONSTANTS
!---------------------------------------------------------------------
@@ -589,7 +593,7 @@ subroutine get_tke(is, ie, js, je, tke_out)
end subroutine get_tke
!#######################################################################
- SUBROUTINE MY25_TURB_INIT( ix, jx, kx )
+ SUBROUTINE MY25_TURB_INIT(domain, ix, jx, kx )
!=======================================================================
! ***** INITIALIZE MELLOR-YAMADA
@@ -599,36 +603,22 @@ SUBROUTINE MY25_TURB_INIT( ix, jx, kx )
! ix, jx - Horizontal dimensions for global storage arrays
! kx - Number of vertical levels in model
!---------------------------------------------------------------------
+ type(domain2D), target, intent(in) :: domain !< Atmosphere domain
integer, intent(in) :: ix, jx, kx
!---------------------------------------------------------------------
! (Intent local)
!---------------------------------------------------------------------
integer :: unit, io, ierr, logunit
integer :: id_restart
-
+ type(FmsNetcdfDomainFile_t) :: Tur_restart !< Fms2io domain_decomposed fileobj
!=====================================================================
!---------------------------------------------------------------------
! --- Read namelist
!---------------------------------------------------------------------
-#ifdef INTERNAL_FILE_NML
read (input_nml_file, nml=my25_turb_nml, iostat=io)
ierr = check_nml_error(io,'my25_turb_nml')
-#else
- if( FILE_EXIST( 'input.nml' ) ) then
-! -------------------------------------
- unit = OPEN_NAMELIST_FILE ( )
- ierr = 1
- do while( ierr .ne. 0 )
- READ ( unit, nml = my25_turb_nml, iostat = io, end = 10 )
- ierr = check_nml_error (io, 'my25_turb_nml')
- end do
-10 continue
- CALL CLOSE_FILE( unit )
-! -------------------------------------
- end if
-#endif
!---------------------------------------------------------------------
! --- Output version
@@ -684,24 +674,17 @@ SUBROUTINE MY25_TURB_INIT( ix, jx, kx )
!---------------------------------------------------------------------
! --- Input TKE
!---------------------------------------------------------------------
+ my25_domain => domain
- id_restart = register_restart_field(Tur_restart, 'my25_turb.res', 'TKE', TKE)
- if (file_exist( 'INPUT/my25_turb.res.nc' )) then
+ if (open_file(Tur_restart,"INPUT/my25_turb.res.nc","read", my25_domain, is_restart=.true.)) then
if (mpp_pe() == mpp_root_pe() ) then
call error_mesg ('my25_turb_mod', 'MY25_TURB_INIT:&
&Reading netCDF formatted restart file: &
&INPUT/my25_turb.res.nc', NOTE)
endif
- call restore_state(Tur_restart)
-
- else if( FILE_EXIST( 'INPUT/my25_turb.res' ) ) then
-
- unit = OPEN_restart_FILE ( file = 'INPUT/my25_turb.res', action = 'read' )
- call read_data ( unit, TKE )
- CALL CLOSE_FILE( unit )
-
- init_tke = .false.
-
+ call my25_register_restart(Tur_restart)
+ call read_restart(Tur_restart)
+ call close_file(Tur_restart)
else
TKE = TKEmin
@@ -721,6 +704,29 @@ SUBROUTINE MY25_TURB_INIT( ix, jx, kx )
end SUBROUTINE MY25_TURB_INIT
!#######################################################################
+!< my25_register_restart: registers the restart variables
+ subroutine my25_register_restart(Tur_restart)
+ type(FmsNetcdfDomainFile_t), intent(inout) :: Tur_restart !< Fms2io domain decomposed fileobj
+ character(len=8), dimension(4) :: dim_names !< String array of dimension names
+
+ dim_names(1) = "xaxis_1"
+ dim_names(2) = "yaxis_1"
+ dim_names(3) = "zaxis_1"
+ dim_names(4) = "Time"
+
+ call register_axis(Tur_restart, "Time", unlimited)
+ call register_axis(Tur_restart, "xaxis_1", "x")
+ call register_axis(Tur_restart, "yaxis_1", "y")
+ call register_axis(Tur_restart, "zaxis_1", size(TKE, 3))
+
+ !< Register the domain decomposed dimensions as variables so that the combiner can work
+ !! correctly
+ call register_field(Tur_restart, dim_names(1), "double", (/dim_names(1)/))
+ call register_field(Tur_restart, dim_names(2), "double", (/dim_names(2)/))
+
+ call register_restart_field(Tur_restart, 'TKE', TKE, dim_names)
+
+ end subroutine my25_register_restart
SUBROUTINE MY25_TURB_END
!=======================================================================
@@ -749,6 +755,9 @@ end SUBROUTINE MY25_TURB_END
subroutine my25_turb_restart(timestamp)
character(len=*), intent(in), optional :: timestamp
+ type(FmsNetcdfDomainFile_t) :: Tur_restart !< Fms2io domain decomposed fileobj
+ character(len=128) :: filename !< Sring of restart filename
+
if(.not. present(timestamp)) then
if (mpp_pe() == mpp_root_pe() ) &
call error_mesg ('my25_turb_mod', 'my25_turb_end: &
@@ -756,17 +765,44 @@ subroutine my25_turb_restart(timestamp)
&requested: RESTART/my25_turb.res.nc', NOTE)
endif
+ if (present(timestamp)) then
+ filename = "RESTART/"//trim(timestamp)//".my25_turb.res.nc"
+ else
+ filename = "RESTART/my25_turb.res.nc"
+ endif
+
!----------------------------------------------------------------------
! write out the restart data which is always needed, regardless of
! when the first donner calculation step is after restart.
!----------------------------------------------------------------------
- call save_restart(Tur_restart, timestamp)
+ if (open_file(Tur_restart,trim(filename),"overwrite", my25_domain, is_restart=.true.)) then
+ call my25_register_restart(Tur_restart)
+ call write_restart(Tur_restart)
+ call add_domain_dimension_data(Tur_restart)
+ call close_file(Tur_restart)
+ endif
end subroutine my25_turb_restart
! NAME="my25_turb_restart"
!#######################################################################
+!< Add_dimension_data: Adds dummy data for the domain decomposed axis
+subroutine add_domain_dimension_data(fileobj)
+ type(FmsNetcdfDomainFile_t) :: fileobj !< Fms2io domain decomposed fileobj
+ integer, dimension(:), allocatable :: buffer !< Buffer with axis data
+ integer :: is, ie !< Starting and Ending indices for data
+
+ call get_global_io_domain_indices(fileobj, "xaxis_1", is, ie, indices=buffer)
+ call write_data(fileobj, "xaxis_1", buffer)
+ deallocate(buffer)
+
+ call get_global_io_domain_indices(fileobj, "yaxis_1", is, ie, indices=buffer)
+ call write_data(fileobj, "yaxis_1", buffer)
+ deallocate(buffer)
+
+end subroutine add_domain_dimension_data
+
SUBROUTINE K_PBL_DEPTH(ustar,bstar,akm,akh,zsfc,zfull,zhalf,h,kbot)
!=======================================================================
diff --git a/atmos_param/physics_driver/physics_driver.F90 b/atmos_param/physics_driver/physics_driver.F90
index ecd4b409..13d710db 100644
--- a/atmos_param/physics_driver/physics_driver.F90
+++ b/atmos_param/physics_driver/physics_driver.F90
@@ -64,20 +64,20 @@ module physics_driver_mod
atmos_tracer_driver_endts, &
atmos_tracer_driver, &
atmos_tracer_driver_end
-use mpp_mod, only: input_nml_file
+use mpp_mod, only: input_nml_file, mpp_get_current_pelist
+use mpp_domains_mod, only: domain2D, mpp_get_ntile_count
use fms_mod, only: mpp_clock_id, mpp_clock_begin, &
mpp_clock_end, CLOCK_MODULE_DRIVER, &
- fms_init, &
- open_namelist_file, stdlog, stdout, &
- write_version_number, field_size, &
- file_exist, error_mesg, FATAL, &
- WARNING, NOTE, check_nml_error, &
- close_file, mpp_pe, mpp_root_pe, &
- mpp_error, mpp_chksum, string
-use fms_io_mod, only: restore_state, &
- register_restart_field, restart_file_type, &
- save_restart, get_mosaic_tile_file
-
+ fms_init, stdlog, stdout, &
+ write_version_number, &
+ error_mesg, FATAL, &
+ NOTE, check_nml_error, mpp_pe, &
+ mpp_root_pe, mpp_chksum, string, mpp_npes
+use fms2_io_mod, only: FmsNetcdfFile_t, FmsNetcdfDomainFile_t, &
+ register_restart_field, register_axis, unlimited, &
+ open_file, read_restart, write_restart, close_file, &
+ register_field, write_data, get_global_io_domain_indices, &
+ register_variable_attribute, variable_exists
use diag_manager_mod, only: register_diag_field, send_data
! shared atmospheric package modules:
@@ -199,7 +199,7 @@ module physics_driver_mod
check_args, &
! called from physics_driver_init:
- physics_driver_register_restart, &
+ physics_driver_register_restart_domain, physics_driver_register_restart_scalars, &
! called from physics_driver_restart:
physics_driver_netcdf, &
@@ -480,10 +480,6 @@ module physics_driver_mod
real, dimension(:,:,:), allocatable :: temp_last, q_last
-!--- for netcdf restart
-type(restart_file_type), pointer, save :: Phy_restart => NULL()
-type(restart_file_type), pointer, save :: Til_restart => NULL()
-logical :: in_different_file = .false.
integer :: vers
integer :: now_doing_strat = 0
integer :: now_doing_entrain = 0
@@ -549,6 +545,8 @@ module physics_driver_mod
type(precip_flux_type) :: Precip_flux
+integer :: i_cell, i_meso, i_shallow
+type (domain2D) :: physics_domain !< Atmosphere domain
contains
@@ -658,7 +656,9 @@ subroutine physics_driver_init (Time, lonb, latb, lon, lat, axes, &
tracer_init_clock
real, dimension(:,:,:), allocatable :: phalf
real, dimension(:,:,:,:), allocatable :: trs
-
+ type(FmsNetcdfFile_t) :: Phy_restart !< Fms2io fileobj
+ type(FmsNetcdfDomainFile_t) :: Til_restart !< Fms2io domain decomposed fileobj
+ integer, dimension(:), allocatable :: pes !< Array of pes in the current pelist
!---------------------------------------------------------------------
! local variables:
!
@@ -694,19 +694,8 @@ subroutine physics_driver_init (Time, lonb, latb, lon, lat, axes, &
!--------------------------------------------------------------------
! read namelist.
!--------------------------------------------------------------------
-#ifdef INTERNAL_FILE_NML
read (input_nml_file, nml=physics_driver_nml, iostat=io)
ierr = check_nml_error(io,"physics_driver_nml")
-#else
- if ( file_exist('input.nml')) then
- unit = open_namelist_file ()
- ierr=1; do while (ierr /= 0)
- read (unit, nml=physics_driver_nml, iostat=io, end=10)
- ierr = check_nml_error(io, 'physics_driver_nml')
- enddo
-10 call close_file (unit)
- endif
-#endif
!--------------------------------------------------------------------
! consistency checks for namelist options
@@ -810,7 +799,7 @@ subroutine physics_driver_init (Time, lonb, latb, lon, lat, axes, &
Physics%control%nqr = get_tracer_index (MODEL_ATMOS, 'rainwat')
Physics%control%nqs = get_tracer_index (MODEL_ATMOS, 'snowwat')
Physics%control%nqg = get_tracer_index (MODEL_ATMOS, 'graupel')
-
+ physics_domain = Physics%control%domain
!-----------------------------------------------------------------------
! allocate a logical array to define whether a tracer is a cloud tracer
! (one of those defined above), or not.
@@ -941,7 +930,7 @@ subroutine physics_driver_init (Time, lonb, latb, lon, lat, axes, &
if (do_moist_processes) then
call mpp_clock_begin ( moist_processes_init_clock )
- call moist_processes_init (id, jd, kd, lonb, latb, lon, lat, &
+ call moist_processes_init (physics_domain, id, jd, kd, lonb, latb, lon, lat, &
phalf, Physics%glbl_qty%pref(:,1),&
axes, Time, Physics%control, Exch_ctrl)
@@ -955,7 +944,7 @@ subroutine physics_driver_init (Time, lonb, latb, lon, lat, axes, &
! initialize damping_driver_mod.
!-----------------------------------------------------------------------
call mpp_clock_begin ( damping_init_clock )
- call damping_driver_init (lonb, latb, Physics%glbl_qty%pref(:,1), &
+ call damping_driver_init (physics_domain, lonb, latb, Physics%glbl_qty%pref(:,1), &
axes, Time, sgsmtn)
call mpp_clock_end ( damping_init_clock )
@@ -963,7 +952,7 @@ subroutine physics_driver_init (Time, lonb, latb, lon, lat, axes, &
! initialize vert_turb_driver_mod.
!-----------------------------------------------------------------------
call mpp_clock_begin ( turb_init_clock )
- call vert_turb_driver_init (lonb, latb, id, jd, kd, axes, Time, &
+ call vert_turb_driver_init (physics_domain, lonb, latb, id, jd, kd, axes, Time, &
Exch_ctrl, Physics%control, &
doing_edt, doing_entrain, do_clubb)
call mpp_clock_end ( turb_init_clock )
@@ -998,7 +987,7 @@ subroutine physics_driver_init (Time, lonb, latb, lon, lat, axes, &
! initialize atmos_tracer_driver_mod.
!-----------------------------------------------------------------------
call mpp_clock_begin ( tracer_init_clock )
- call atmos_tracer_driver_init (lonb, latb, trs, axes, Time, phalf)
+ call atmos_tracer_driver_init (physics_domain, lonb, latb, trs, axes, Time, phalf)
call mpp_clock_end ( tracer_init_clock )
!---------------------------------------------------------------------
@@ -1065,6 +1054,13 @@ subroutine physics_driver_init (Time, lonb, latb, lon, lat, axes, &
call alloc_clouds_from_moist_type(Moist_clouds, Exch_ctrl, Atm_block)
+!------------------------------------------------------------------------
+! save convective cloud indices to be passed to convection_driver_mod.
+!------------------------------------------------------------------------
+ i_shallow = Moist_clouds(1)%block(1)%index_uw_conv
+ i_cell = Moist_clouds(1)%block(1)%index_donner_cell
+ i_meso = Moist_clouds(1)%block(1)%index_donner_meso
+
!--------------------------------------------------------------------
! call physics_driver_read_restart to obtain initial values for the module
! variables. Also register restart fields to be ready for intermediate
@@ -1078,11 +1074,25 @@ subroutine physics_driver_init (Time, lonb, latb, lon, lat, axes, &
id, jd, kd, Restart%Cloud_data(nc))
enddo
- call physics_driver_register_restart (Restart)
- if(file_exist('INPUT/physics_driver.res.nc')) then
- call restore_state(Phy_restart)
- if(in_different_file) call restore_state(Til_restart)
+ !< Get the current pelist
+ allocate(pes(mpp_npes()))
+ call mpp_get_current_pelist(pes)
+
+ !< Open the scalar file with the current pelist, so that only the root pe opens and reads the file and
+ !! distributes the data to the other pes
+ if (open_file(Phy_restart,"INPUT/physics_driver.res.nc","read", is_restart=.true., pelist=pes)) then !scalar file
+ call physics_driver_register_restart_scalars(Restart, Phy_restart)
+ call read_restart(Phy_restart)
+ call close_file(Phy_restart)
+ endif
+ deallocate(pes)
+
+ if (open_file(Til_restart,"INPUT/physics_driver.res.nc","read", physics_domain, is_restart=.true.)) then !domain file
+ call physics_driver_register_restart_domain(Restart, Til_restart)
+ call read_restart(Til_restart)
+ call close_file(Til_restart)
endif
+
!---------------------------------------------------------------------
! convert the real variable (r_convect) indicating columns with
! convection to a logical variable (convect). this will be used in
@@ -1457,7 +1467,7 @@ subroutine physics_driver_up_time_vary (Time, Time_next, dt, &
! call moist_processes_time_vary to pass needed time-dependent fields
! to subordinate modules.
!----------------------------------------------------------------------
- call moist_processes_time_vary (dt)
+ call moist_processes_time_vary (Time_next, dt, i_cell, i_meso, i_shallow)
endif
!----------------------------------------------------------------------
! call cosp_driver_time_vary to obtain satellite location at current
@@ -2549,7 +2559,7 @@ subroutine physics_driver_up (is, ie, js, je, npz, &
! and processes involving condenstion.
!-----------------------------------------------------------------------
call moist_processes ( &
- is, ie, js, je, npz, Time_next, dt, frac_land, u_star, &
+ is, ie, js, je, npz, Time_next, frac_land, u_star, &
b_star, q_star, area, lon, lat, Physics_input_block, &
Moist_clouds_block, Physics_tendency_block, Phys_mp_exch, &
Surf_diff, Removal_mp, shflx, lhflx, &
@@ -2607,8 +2617,8 @@ subroutine physics_driver_up (is, ie, js, je, npz, &
if (query_cmip_diag_id(ID_tntmp) .or. query_cmip_diag_id(ID_tnhusmp)) then
lphalf = log(p_half)
endif
- if (query_cmip_diag_id(ID_tntmp)) then
- used = send_cmip_data_3d (ID_tntmp, tdt(:,:,:), Time_next, is, js, 1, phalf=lphalf)
+ if (query_cmip_diag_id(ID_tntmp)) then
+ used = send_cmip_data_3d (ID_tntmp, tdt(:,:,:), Time_next, is, js,1, phalf=lphalf)
endif
if (query_cmip_diag_id(ID_tnhusmp)) then
used = send_cmip_data_3d (ID_tnhusmp, rdt(:,:,:,nsphum), Time_next, is, js, 1, phalf=lphalf)
@@ -3043,17 +3053,67 @@ end subroutine physics_driver_restart
!
subroutine physics_driver_netcdf(timestamp)
character(len=*), intent(in), optional :: timestamp
+ type(FmsNetcdfFile_t) :: Phy_restart !< Fms2io fileobj
+ type(FmsNetcdfDomainFile_t) :: Til_restart !< Fms2io domain decomposed fileobj
+ logical :: tile_file_exist !< Flag indicating if the file was opened
+ character(len=128) :: filename !< String of filename
+ integer, allocatable, dimension(:) :: pes !< Array of pes in the current pelist
+
+ r_convect = 0.
+ where(convect)
+ r_convect = 1.0
+ end where
+
+ if (present(timestamp)) then
+ filename = "RESTART/"//trim(timestamp)//".physics_driver.res.nc"
+ else
+ filename = "RESTART/physics_driver.res.nc"
+ endif
- r_convect = 0.
- where(convect)
- r_convect = 1.0
- end where
- call save_restart(Phy_restart, timestamp)
- if(in_different_file) call save_restart(Til_restart, timestamp)
+ !< Get the current pelist
+ allocate(pes(mpp_npes()))
+ call mpp_get_current_pelist(pes)
+
+ !< Open the scalar file with the current pelist, so that only the root pe opens and writes the file
+ if (open_file(Phy_restart, trim(filename),"overwrite", is_restart=.true., pelist=pes)) then !scalar file
+ call physics_driver_register_restart_scalars(Restart, Phy_restart)
+ call write_restart(Phy_restart)
+ call close_file(Phy_restart)
+ endif
+ deallocate(pes)
+
+ if (mpp_get_ntile_count(physics_domain) == 1) then
+ tile_file_exist = open_file(Til_restart, trim(filename), "append", physics_domain, is_restart=.true.)
+ else
+ tile_file_exist = open_file(Til_restart, trim(filename), "overwrite", physics_domain, is_restart=.true.)
+ endif
+
+ if (tile_file_exist) then !domain file
+ call physics_driver_register_restart_domain(Restart, Til_restart)
+ call write_restart(Til_restart)
+ call add_domain_dimension_data(Til_restart)
+ call close_file(Til_restart)
+ endif
end subroutine physics_driver_netcdf
! NAME="physics_driver_netcdf"
+!< Add_dimension_data: Adds dummy data for the domain decomposed axis
+subroutine add_domain_dimension_data(fileobj)
+ type(FmsNetcdfDomainFile_t) :: fileobj !< Fms2io domain decomposed fileobj
+ integer, dimension(:), allocatable :: buffer !< Buffer with axis data
+ integer :: is, ie !< Starting and Ending indices for data
+
+ call get_global_io_domain_indices(fileobj, "xaxis_1", is, ie, indices=buffer)
+ call write_data(fileobj, "xaxis_1", buffer)
+ deallocate(buffer)
+
+ call get_global_io_domain_indices(fileobj, "yaxis_1", is, ie, indices=buffer)
+ call write_data(fileobj, "yaxis_1", buffer)
+ deallocate(buffer)
+
+end subroutine add_domain_dimension_data
+
!#######################################################################
!
!
@@ -3175,139 +3235,176 @@ end subroutine zero_radturbten
!#####################################################################
-!
+!
!
-! physics_driver_register_restart will register restart field when do_netcdf file
-! is true.
+! physics_driver_register_restart_scalars will register restart field when do_netcdf file
+! is true.
!
-subroutine physics_driver_register_restart (Restart)
+subroutine physics_driver_register_restart_scalars (Restart, Phy_restart)
type(clouds_from_moist_block_type), intent(inout), target :: Restart
- character(len=64) :: fname, fname2
- integer :: id_restart
- integer :: nc
- logical :: reproduce_ulm_restart = .true.
- integer :: index_strat
+ type(FmsNetcdfFile_t), intent(inout) :: Phy_restart !< Fms2io fileobj
- if (do_moist_processes) then
- if(doing_prog_clouds) then
+ character(len=8), dimension(1) :: dim_names !< Array of dimension names
+
+ if (do_moist_processes) then
+ if(doing_prog_clouds) then
now_doing_strat = 1
else
now_doing_strat = 0
endif
- if(doing_edt) then
+ if(doing_edt) then
now_doing_edt = 1
else
now_doing_edt = 0
endif
- if(doing_entrain) then
+ if(doing_entrain) then
now_doing_entrain = 1
else
now_doing_entrain = 0
endif
endif
- fname = 'physics_driver.res.nc'
- call get_mosaic_tile_file(fname, fname2, .false. )
- allocate(Phy_restart)
- if(trim(fname2) == trim(fname)) then
- Til_restart => Phy_restart
- in_different_file = .false.
- else
- in_different_file = .true.
- allocate(Til_restart)
+ dim_names(1) = "Time"
+ call register_axis(Phy_restart, dim_names(1), unlimited)
+
+ call register_restart_field(Phy_restart, 'vers', vers, dim_names)
+ call register_restart_field(Phy_restart, 'doing_strat', now_doing_strat, dim_names)
+ call register_restart_field(Phy_restart, 'doing_edt', now_doing_edt, dim_names)
+ call register_restart_field(Phy_restart, 'doing_entrain', now_doing_entrain, dim_names)
+
+ if (.not. Phy_restart%is_readonly) then !If not reading the file,
+ call register_variable_attribute(Phy_restart, "vers", "long_name", "vers", str_len=len_trim("vers"))
+ call register_variable_attribute(Phy_restart, "doing_strat", "long_name", "doing_strat", str_len=len_trim("doing_strat"))
+ call register_variable_attribute(Phy_restart, "doing_edt", "long_name", "doing_edt", str_len=len_trim("doing_edt"))
+ call register_variable_attribute(Phy_restart, "doing_entrain", "long_name", "doing_entrain", str_len=len_trim("doing_entrain"))
+
+ call register_variable_attribute(Phy_restart, "vers", "units", "none", str_len=4)
+ call register_variable_attribute(Phy_restart, "doing_strat", "units", "none", str_len=4)
+ call register_variable_attribute(Phy_restart, "doing_edt", "units", "none", str_len=4)
+ call register_variable_attribute(Phy_restart, "doing_entrain", "units", "none", str_len=4)
endif
- id_restart = register_restart_field(Phy_restart, fname, 'vers', vers, no_domain=.true.)
- id_restart = register_restart_field(Phy_restart, fname, 'doing_strat', now_doing_strat, no_domain=.true.)
- id_restart = register_restart_field(Phy_restart, fname, 'doing_edt', now_doing_edt, no_domain=.true.)
- id_restart = register_restart_field(Phy_restart, fname, 'doing_entrain', now_doing_entrain, no_domain=.true.)
-
- id_restart = register_restart_field(Til_restart, fname, 'diff_cu_mo', diff_cu_mo)
- id_restart = register_restart_field(Til_restart, fname, 'pbltop', pbltop)
- id_restart = register_restart_field(Til_restart, fname, 'cush', cush, mandatory = .false.)
- id_restart = register_restart_field(Til_restart, fname, 'cbmf', cbmf, mandatory = .false.)
- id_restart = register_restart_field(Til_restart, fname, 'hmint', hmint, mandatory = .false.)
- id_restart = register_restart_field(Til_restart, fname, 'cgust', cgust, mandatory = .false.)
- id_restart = register_restart_field(Til_restart, fname, 'tke', tke, mandatory = .false.)
- id_restart = register_restart_field(Til_restart, fname, 'pblhto', pblhto, mandatory = .false.)
- id_restart = register_restart_field(Til_restart, fname, 'rkmo', rkmo, mandatory = .false.)
- id_restart = register_restart_field(Til_restart, fname, 'taudpo', taudpo, mandatory = .false.)
- id_restart = register_restart_field(Til_restart, fname, 'exist_shconv', exist_shconv, mandatory = .false.)
- id_restart = register_restart_field(Til_restart, fname, 'exist_dpconv', exist_dpconv, mandatory = .false.)
- id_restart = register_restart_field(Til_restart, fname, 'pblht_prev', pblht_prev, mandatory = .false.)
- id_restart = register_restart_field(Til_restart, fname, 'hlsrc_prev', hlsrc_prev, mandatory = .false.)
- id_restart = register_restart_field(Til_restart, fname, 'qtsrc_prev', qtsrc_prev, mandatory = .false.)
- id_restart = register_restart_field(Til_restart, fname, 'cape_prev', cape_prev, mandatory = .false.)
- id_restart = register_restart_field(Til_restart, fname, 'cin_prev', cin_prev, mandatory = .false.)
- id_restart = register_restart_field(Til_restart, fname, 'tke_prev', tke_prev, mandatory = .false.)
- id_restart = register_restart_field(Til_restart, fname, 'diff_t', diff_t)
- id_restart = register_restart_field(Til_restart, fname, 'diff_m', diff_m)
- id_restart = register_restart_field(Til_restart, fname, 'convect', r_convect)
+end subroutine physics_driver_register_restart_scalars
+
+!#####################################################################
+!
+!
+! physics_driver_register_restart_domain will register restart field when do_netcdf file
+! is true.
+!
+subroutine physics_driver_register_restart_domain (Restart, Til_restart)
+ type(clouds_from_moist_block_type), intent(inout), target :: Restart
+ type(FmsNetcdfDomainFile_t), intent(inout) :: Til_restart !< Fms2io domain decomposed fileobj
+
+ integer :: nc
+ logical :: reproduce_ulm_restart = .true.
+ integer :: index_strat
+ character(len=8), dimension(4) :: dim_names_4d, dim_names_4d2 !< Array of dimension names
+ character(len=8), dimension(3) :: dim_names_3d !< Array of dimension names
+
+ dim_names_4d = (/"xaxis_1", "yaxis_1", "zaxis_1", "Time "/)
+ dim_names_4d2 = (/"xaxis_1", "yaxis_1", "zaxis_2", "Time "/)
+ dim_names_3d = (/"xaxis_1", "yaxis_1", "Time "/)
+
+ call register_axis(Til_restart, "xaxis_1", "x")
+ call register_axis(Til_restart, "yaxis_1", "y")
+ call register_axis(Til_restart, "zaxis_1", size(diff_cu_mo, 3))
+ call register_axis(Til_restart, "zaxis_2", size(exist_shconv, 3))
+ if (.not. Til_restart%mode_is_append) call register_axis(Til_restart, "Time", unlimited)
+
+ !< Register the domain decomposed dimensions as variables so that the combiner can work
+ !! correctly
+ call register_field(Til_restart, "xaxis_1", "double", (/"xaxis_1"/))
+ call register_field(Til_restart, "yaxis_1", "double", (/"yaxis_1"/))
+
+ call register_restart_field(Til_restart, 'diff_cu_mo', diff_cu_mo, dim_names_4d)
+ call register_restart_field(Til_restart, 'pbltop', pbltop, dim_names_3d)
+ call register_restart_field(Til_restart, 'cush', cush, dim_names_3d, is_optional = .true.)
+ call register_restart_field(Til_restart, 'cbmf', cbmf, dim_names_3d, is_optional = .true.)
+ call register_restart_field(Til_restart, 'hmint', hmint, dim_names_3d, is_optional = .true.)
+ call register_restart_field(Til_restart, 'cgust', cgust, dim_names_3d, is_optional = .true.)
+ call register_restart_field(Til_restart, 'tke', tke, dim_names_3d, is_optional = .true.)
+ call register_restart_field(Til_restart, 'pblhto', pblhto, dim_names_3d, is_optional = .true.)
+ call register_restart_field(Til_restart, 'rkmo', rkmo, dim_names_3d, is_optional = .true.)
+ call register_restart_field(Til_restart, 'taudpo', taudpo, dim_names_3d, is_optional = .true.)
+ call register_restart_field(Til_restart, 'exist_shconv', exist_shconv, dim_names_4d2, is_optional = .true.)
+ call register_restart_field(Til_restart, 'exist_dpconv', exist_dpconv, dim_names_4d2, is_optional = .true.)
+ call register_restart_field(Til_restart, 'pblht_prev', pblht_prev, dim_names_4d2, is_optional = .true.)
+ call register_restart_field(Til_restart, 'hlsrc_prev', hlsrc_prev, dim_names_4d2, is_optional = .true.)
+ call register_restart_field(Til_restart, 'qtsrc_prev', qtsrc_prev, dim_names_4d2, is_optional = .true.)
+ call register_restart_field(Til_restart, 'cape_prev', cape_prev, dim_names_4d2, is_optional = .true.)
+ call register_restart_field(Til_restart, 'cin_prev', cin_prev, dim_names_4d2, is_optional = .true.)
+ call register_restart_field(Til_restart, 'tke_prev', tke_prev, dim_names_4d2, is_optional = .true.)
+ call register_restart_field(Til_restart, 'diff_t', diff_t, dim_names_4d)
+ call register_restart_field(Til_restart, 'diff_m', diff_m, dim_names_4d)
+ call register_restart_field(Til_restart, 'convect', r_convect, dim_names_3d)
+
if (do_clubb > 0) then
- id_restart = register_restart_field(Til_restart, fname, 'diff_t_clubb', diff_t_clubb, mandatory = .false.)
+ call register_restart_field(Til_restart, 'diff_t_clubb', diff_t_clubb, dim_names_4d, is_optional = .true.)
end if
if (doing_prog_clouds) then
- id_restart = register_restart_field(Til_restart, fname, 'radturbten', radturbten)
+ call register_restart_field(Til_restart, 'radturbten', radturbten, dim_names_4d)
endif
index_strat = 0
do nc = 1, size(Restart%Cloud_data,1)
if (trim(Restart%Cloud_data(nc)%scheme_name).eq.'strat_cloud' .and. .not. reproduce_ulm_restart) then
- id_restart = register_restart_field(Til_restart, fname, 'lsc_cloud_area', Restart%Cloud_data(nc)%cloud_area, mandatory = .false.)
- id_restart = register_restart_field(Til_restart, fname, 'lsc_liquid', Restart%Cloud_data(nc)%liquid_amt, mandatory = .false.)
- id_restart = register_restart_field(Til_restart, fname, 'lsc_ice', Restart%Cloud_data(nc)%ice_amt, mandatory = .false.)
- id_restart = register_restart_field(Til_restart, fname, 'lsc_droplet_number', Restart%Cloud_data(nc)%droplet_number, mandatory = .false.)
- id_restart = register_restart_field(Til_restart, fname, 'lsc_ice_number', Restart%Cloud_data(nc)%ice_number, mandatory = .false.)
- id_restart = register_restart_field(Til_restart, fname, 'lsc_snow', Restart%Cloud_data(nc)%snow, mandatory = .false.)
- id_restart = register_restart_field(Til_restart, fname, 'lsc_rain', Restart%Cloud_data(nc)%rain, mandatory = .false.)
- id_restart = register_restart_field(Til_restart, fname, 'lsc_snow_size', Restart%Cloud_data(nc)%snow_size, mandatory = .false.)
- id_restart = register_restart_field(Til_restart, fname, 'lsc_rain_size', Restart%Cloud_data(nc)%rain_size, mandatory = .false.)
+ call register_restart_field(Til_restart, 'lsc_cloud_area', Restart%Cloud_data(nc)%cloud_area, dim_names_4d, is_optional = .true.)
+ call register_restart_field(Til_restart, 'lsc_liquid', Restart%Cloud_data(nc)%liquid_amt, dim_names_4d, is_optional = .true.)
+ call register_restart_field(Til_restart, 'lsc_ice', Restart%Cloud_data(nc)%ice_amt, dim_names_4d, is_optional = .true.)
+ call register_restart_field(Til_restart, 'lsc_droplet_number', Restart%Cloud_data(nc)%droplet_number, dim_names_4d, is_optional = .true.)
+ call register_restart_field(Til_restart, 'lsc_ice_number', Restart%Cloud_data(nc)%ice_number, dim_names_4d, is_optional = .true.)
+ call register_restart_field(Til_restart, 'lsc_snow', Restart%Cloud_data(nc)%snow, dim_names_4d, is_optional = .true.)
+ call register_restart_field(Til_restart, 'lsc_rain', Restart%Cloud_data(nc)%rain, dim_names_4d, is_optional = .true.)
+ call register_restart_field(Til_restart, 'lsc_snow_size', Restart%Cloud_data(nc)%snow_size, dim_names_4d, is_optional = .true.)
+ call register_restart_field(Til_restart, 'lsc_rain_size', Restart%Cloud_data(nc)%rain_size, dim_names_4d, is_optional = .true.)
endif
if (trim(Restart%Cloud_data(nc)%scheme_name).eq.'strat_cloud' .and. reproduce_ulm_restart) index_strat = nc
if (trim(Restart%Cloud_data(nc)%scheme_name).eq.'donner_cell') then
- id_restart = register_restart_field(Til_restart, fname, 'cell_cloud_frac', Restart%Cloud_data(nc)%cloud_area, mandatory = .false.)
- id_restart = register_restart_field(Til_restart, fname, 'cell_liquid_amt', Restart%Cloud_data(nc)%liquid_amt, mandatory = .false.)
- id_restart = register_restart_field(Til_restart, fname, 'cell_liquid_size', Restart%Cloud_data(nc)%liquid_size, mandatory = .false.)
- id_restart = register_restart_field(Til_restart, fname, 'cell_ice_amt', Restart%Cloud_data(nc)%ice_amt, mandatory = .false.)
- id_restart = register_restart_field(Til_restart, fname, 'cell_ice_size', Restart%Cloud_data(nc)%ice_size, mandatory = .false.)
+ call register_restart_field(Til_restart, 'cell_cloud_frac', Restart%Cloud_data(nc)%cloud_area, dim_names_4d, is_optional = .true.)
+ call register_restart_field(Til_restart, 'cell_liquid_amt', Restart%Cloud_data(nc)%liquid_amt, dim_names_4d, is_optional = .true.)
+ call register_restart_field(Til_restart, 'cell_liquid_size', Restart%Cloud_data(nc)%liquid_size, dim_names_4d, is_optional = .true.)
+ call register_restart_field(Til_restart, 'cell_ice_amt', Restart%Cloud_data(nc)%ice_amt, dim_names_4d, is_optional = .true.)
+ call register_restart_field(Til_restart, 'cell_ice_size', Restart%Cloud_data(nc)%ice_size, dim_names_4d, is_optional = .true.)
endif
if (trim(Restart%Cloud_data(nc)%scheme_name).eq.'donner_meso') then
- id_restart = register_restart_field(Til_restart, fname, 'meso_cloud_frac', Restart%Cloud_data(nc)%cloud_area, mandatory = .false.)
- id_restart = register_restart_field(Til_restart, fname, 'meso_liquid_amt', Restart%Cloud_data(nc)%liquid_amt, mandatory = .false.)
- id_restart = register_restart_field(Til_restart, fname, 'meso_liquid_size', Restart%Cloud_data(nc)%liquid_size, mandatory = .false.)
- id_restart = register_restart_field(Til_restart, fname, 'meso_ice_amt', Restart%Cloud_data(nc)%ice_amt, mandatory = .false.)
- id_restart = register_restart_field(Til_restart, fname, 'meso_ice_size', Restart%Cloud_data(nc)%ice_size, mandatory = .false.)
- id_restart = register_restart_field(Til_restart, fname, 'nsum', Restart%Cloud_data(nc)%nsum_out, mandatory = .false.)
+ call register_restart_field(Til_restart, 'meso_cloud_frac', Restart%Cloud_data(nc)%cloud_area, dim_names_4d, is_optional = .true.)
+ call register_restart_field(Til_restart, 'meso_liquid_amt', Restart%Cloud_data(nc)%liquid_amt, dim_names_4d, is_optional = .true.)
+ call register_restart_field(Til_restart, 'meso_liquid_size', Restart%Cloud_data(nc)%liquid_size, dim_names_4d, is_optional = .true.)
+ call register_restart_field(Til_restart, 'meso_ice_amt', Restart%Cloud_data(nc)%ice_amt, dim_names_4d, is_optional = .true.)
+ call register_restart_field(Til_restart, 'meso_ice_size', Restart%Cloud_data(nc)%ice_size, dim_names_4d, is_optional = .true.)
+ call register_restart_field(Til_restart, 'nsum', Restart%Cloud_data(nc)%nsum_out, dim_names_3d, is_optional = .true.)
endif
if (trim(Restart%Cloud_data(nc)%scheme_name).eq.'uw_conv') then
- id_restart = register_restart_field(Til_restart, fname, 'shallow_cloud_area', Restart%Cloud_data(nc)%cloud_area, mandatory = .false.)
- id_restart = register_restart_field(Til_restart, fname, 'shallow_liquid', Restart%Cloud_data(nc)%liquid_amt, mandatory = .false.)
- id_restart = register_restart_field(Til_restart, fname, 'shallow_ice', Restart%Cloud_data(nc)%ice_amt, mandatory = .false.)
- id_restart = register_restart_field(Til_restart, fname, 'shallow_droplet_number', Restart%Cloud_data(nc)%droplet_number, mandatory = .false.)
- id_restart = register_restart_field(Til_restart, fname, 'shallow_ice_number', Restart%Cloud_data(nc)%ice_number, mandatory = .false.)
+ call register_restart_field(Til_restart, 'shallow_cloud_area', Restart%Cloud_data(nc)%cloud_area, dim_names_4d, is_optional = .true.)
+ call register_restart_field(Til_restart, 'shallow_liquid', Restart%Cloud_data(nc)%liquid_amt, dim_names_4d, is_optional = .true.)
+ call register_restart_field(Til_restart, 'shallow_ice', Restart%Cloud_data(nc)%ice_amt, dim_names_4d, is_optional = .true.)
+ call register_restart_field(Til_restart, 'shallow_droplet_number', Restart%Cloud_data(nc)%droplet_number, dim_names_4d, is_optional = .true.)
+ call register_restart_field(Til_restart, 'shallow_ice_number', Restart%Cloud_data(nc)%ice_number, dim_names_4d, is_optional = .true.)
endif
enddo
! save large-scale clouds last to reproduce ulm code
if (index_strat > 0) then
nc = index_strat
- id_restart = register_restart_field(Til_restart, fname, 'lsc_cloud_area', Restart%Cloud_data(nc)%cloud_area, mandatory = .false.)
- id_restart = register_restart_field(Til_restart, fname, 'lsc_liquid', Restart%Cloud_data(nc)%liquid_amt, mandatory = .false.)
- id_restart = register_restart_field(Til_restart, fname, 'lsc_ice', Restart%Cloud_data(nc)%ice_amt, mandatory = .false.)
- id_restart = register_restart_field(Til_restart, fname, 'lsc_droplet_number', Restart%Cloud_data(nc)%droplet_number, mandatory = .false.)
- id_restart = register_restart_field(Til_restart, fname, 'lsc_ice_number', Restart%Cloud_data(nc)%ice_number, mandatory = .false.)
- id_restart = register_restart_field(Til_restart, fname, 'lsc_snow', Restart%Cloud_data(nc)%snow, mandatory = .false.)
- id_restart = register_restart_field(Til_restart, fname, 'lsc_rain', Restart%Cloud_data(nc)%rain, mandatory = .false.)
- id_restart = register_restart_field(Til_restart, fname, 'lsc_snow_size', Restart%Cloud_data(nc)%snow_size, mandatory = .false.)
- id_restart = register_restart_field(Til_restart, fname, 'lsc_rain_size', Restart%Cloud_data(nc)%rain_size, mandatory = .false.)
+ call register_restart_field(Til_restart, 'lsc_cloud_area', Restart%Cloud_data(nc)%cloud_area, dim_names_4d, is_optional = .true.)
+ call register_restart_field(Til_restart, 'lsc_liquid', Restart%Cloud_data(nc)%liquid_amt, dim_names_4d, is_optional = .true.)
+ call register_restart_field(Til_restart, 'lsc_ice', Restart%Cloud_data(nc)%ice_amt, dim_names_4d, is_optional = .true.)
+ call register_restart_field(Til_restart, 'lsc_droplet_number', Restart%Cloud_data(nc)%droplet_number, dim_names_4d, is_optional = .true.)
+ call register_restart_field(Til_restart, 'lsc_ice_number', Restart%Cloud_data(nc)%ice_number, dim_names_4d, is_optional = .true.)
+ call register_restart_field(Til_restart, 'lsc_snow', Restart%Cloud_data(nc)%snow, dim_names_4d, is_optional = .true.)
+ call register_restart_field(Til_restart, 'lsc_rain', Restart%Cloud_data(nc)%rain, dim_names_4d, is_optional = .true.)
+ call register_restart_field(Til_restart, 'lsc_snow_size', Restart%Cloud_data(nc)%snow_size, dim_names_4d, is_optional = .true.)
+ call register_restart_field(Til_restart, 'lsc_rain_size', Restart%Cloud_data(nc)%rain_size, dim_names_4d, is_optional = .true.)
endif
-end subroutine physics_driver_register_restart
+end subroutine physics_driver_register_restart_domain
+
!
!#####################################################################
!
diff --git a/atmos_param/physics_driver/physics_types.F90 b/atmos_param/physics_driver/physics_types.F90
index 4a1a6737..ecb75b91 100644
--- a/atmos_param/physics_driver/physics_types.F90
+++ b/atmos_param/physics_driver/physics_types.F90
@@ -5,6 +5,7 @@ module physics_types_mod
use block_control_mod, only: block_control_type
use field_manager_mod, only: MODEL_ATMOS
use tracer_manager_mod, only: get_tracer_index, get_number_tracers
+use mpp_domains_mod, only: domain2D
!---- public data ----
public physics_control_type
@@ -16,6 +17,7 @@ module physics_types_mod
logical :: l_host_applies_sfc_fluxes
logical :: use_tau
logical, dimension(:), _ALLOCATABLE :: cloud_tracer _NULL
+ type (domain2D) :: domain !< Atmosphere domain
end type physics_control_type
!--- atmosphere inputs block structure
diff --git a/atmos_param/qe_moist_convection/qe_moist_convection.F90 b/atmos_param/qe_moist_convection/qe_moist_convection.F90
index 90b8b0fe..0c7bb04f 100644
--- a/atmos_param/qe_moist_convection/qe_moist_convection.F90
+++ b/atmos_param/qe_moist_convection/qe_moist_convection.F90
@@ -35,9 +35,9 @@ module qe_moist_convection_mod
! approximating the relation between vapor pressure and specific
! humidity.)
!----------------------------------------------------------------------
- use fms_mod, only: file_exist, error_mesg, open_file, &
- check_nml_error, mpp_pe, FATAL, &
- close_file
+ use fms_mod, only: error_mesg, &
+ check_nml_error, mpp_pe, FATAL
+ use fms_io_mod, only: close_file, open_file, file_exist
use sat_vapor_pres_mod, only: escomp, descomp
use constants_mod, only: HLv, HLs, Cp_air, Grav, rdgas, rvgas, &
kappa
diff --git a/atmos_param/radiation/aerosols/aerosolrad_driver.F90 b/atmos_param/radiation/aerosols/aerosolrad_driver.F90
index 4315cf9c..8099c039 100644
--- a/atmos_param/radiation/aerosols/aerosolrad_driver.F90
+++ b/atmos_param/radiation/aerosols/aerosolrad_driver.F90
@@ -3,10 +3,10 @@ module aerosolrad_driver_mod
use mpp_mod, only: input_nml_file
use fms_mod, only: fms_init, &
mpp_pe, mpp_root_pe, &
- open_namelist_file, stdlog, stdout, &
- close_file, write_version_number, &
+ stdlog, stdout, &
+ write_version_number, &
error_mesg, mpp_error, &
- check_nml_error, file_exist, &
+ check_nml_error, &
FATAL, WARNING, NOTE
use time_manager_mod, only: time_type
@@ -106,7 +106,7 @@ subroutine aerosolrad_driver_init (lonb, latb, kmax, &
!---------------------------------------------------------------------
! local variables
!---------------------------------------------------------------------
- integer :: unit, io, ierr, logunit
+ integer :: io, ierr, logunit
!---------------------------------------------------------------------
! if routine has already been executed, exit.
@@ -121,19 +121,8 @@ subroutine aerosolrad_driver_init (lonb, latb, kmax, &
!---------------------------------------------------------------------
! read namelist.
!---------------------------------------------------------------------
-#ifdef INTERNAL_FILE_NML
read (input_nml_file, nml=aerosolrad_driver_nml, iostat=io)
ierr = check_nml_error(io,'aerosolrad_driver_nml')
-#else
- if ( file_exist('input.nml')) then
- unit = open_namelist_file ( )
- ierr=1; do while (ierr /= 0)
- read (unit, nml=aerosolrad_driver_nml, iostat=io, end=10)
- ierr = check_nml_error(io,'aerosolrad_driver_nml')
- enddo
-10 call close_file (unit)
- endif
-#endif
!---------------------------------------------------------------------
! write version number and namelist to logfile
diff --git a/atmos_param/radiation/aerosols/aerosolrad_package.F90 b/atmos_param/radiation/aerosols/aerosolrad_package.F90
index bfc50f85..ef1ab332 100644
--- a/atmos_param/radiation/aerosols/aerosolrad_package.F90
+++ b/atmos_param/radiation/aerosols/aerosolrad_package.F90
@@ -8,15 +8,12 @@ module aerosolrad_package_mod
! shared modules:
use mpp_mod, only: input_nml_file
-use fms_mod, only: open_namelist_file, fms_init, &
+use fms_mod, only: fms_init, &
mpp_pe, mpp_root_pe, stdlog, &
- file_exist, write_version_number, &
+ write_version_number, &
check_nml_error, error_mesg, &
- FATAL, NOTE, close_file
+ FATAL, NOTE
use constants_mod, only: diffac, constants_init
-use mpp_io_mod, only: mpp_open, mpp_close, MPP_RDONLY, &
- MPP_ASCII, MPP_SEQUENTIAL, MPP_MULTI, &
- MPP_SINGLE, mpp_io_init
use time_manager_mod, only: time_type, time_manager_init, &
get_date, set_date, operator(+), &
print_date, operator(-), operator(>)
@@ -451,7 +448,6 @@ subroutine aerosolrad_package_init (kmax, aerosol_names, lonb, latb, &
type(aerosolrad_control_type), intent(inout) :: Aerosolrad_control
! local variables:
- integer :: unit !< io unit number used for namelist file
integer :: ierr !< error code
integer :: io !< error status returned from io operation
integer :: logunit
@@ -467,7 +463,6 @@ subroutine aerosolrad_package_init (kmax, aerosol_names, lonb, latb, &
!> verify that modules used by this module that are not called later
!! have already been initialized.
- call mpp_io_init
call fms_init
call constants_init
call diag_manager_init
@@ -476,19 +471,8 @@ subroutine aerosolrad_package_init (kmax, aerosol_names, lonb, latb, &
nfields_save = size(aerosol_names(:))
!> read namelist.
-#ifdef INTERNAL_FILE_NML
read (input_nml_file, nml=aerosolrad_package_nml, iostat=io)
ierr = check_nml_error(io,'aerosolrad_package_nml')
-#else
- if ( file_exist('input.nml')) then
- unit = open_namelist_file ( )
- ierr=1; do while (ierr /= 0)
- read (unit, nml=aerosolrad_package_nml, iostat=io, end=10)
- ierr = check_nml_error(io,'aerosolrad_package_nml')
- end do
-10 call close_file (unit)
- endif
-#endif
!> write version number and namelist to logfile.
call write_version_number (version, tagname)
@@ -1833,23 +1817,22 @@ subroutine read_optical_input_file
logical, dimension(:), allocatable :: found !< aerosol radiative property data has been obtained from
!! input file for the given optical properties type?
- integer :: unit, & !< io unit number used for optical properties file
+ integer :: funit, & !< io unit number used for optical properties file
num_input_categories !< number of optical properties types contained in optical data input file
character(len=64) :: name_in !< name of optical properties type being processed
integer :: n, noptical ! iterators
!> open the ASCII input file containing aerosol optical property information.
- call mpp_open (unit, 'INPUT/'//optical_filename, MPP_RDONLY, &
- MPP_ASCII, MPP_SEQUENTIAL, MPP_MULTI, MPP_SINGLE)
+ open(file='INPUT/'//optical_filename, form='formatted',action='read', newunit=funit)
!> read the dimension information contained in the input file.
- read ( unit,* ) num_wavenumbers
- read ( unit,* ) num_input_categories
+ read ( funit,* ) num_wavenumbers
+ read ( funit,* ) num_input_categories
!> read wavenumber limits for aerosol parameterization bands from the input file.
allocate (endaerwvnsf(num_wavenumbers) )
- read (unit,* )
- read (unit,* ) endaerwvnsf
+ read (funit,* )
+ read (funit,* ) endaerwvnsf
!> allocate module arrays to hold the specified sw properties for
!! each parameterization bnad and each aerosol properties type.
@@ -1869,13 +1852,13 @@ subroutine read_optical_input_file
!! appropriately. indicate that the data has been found.
found(:) = .false.
do n=1,num_input_categories
- read( unit,* ) name_in
- read( unit,* )
- read( unit,* ) aeroext_in
- read( unit,* )
- read( unit,* ) aerossalb_in
- read( unit,* )
- read( unit,* ) aeroasymm_in
+ read( funit,* ) name_in
+ read( funit,* )
+ read( funit,* ) aeroext_in
+ read( funit,* )
+ read( funit,* ) aerossalb_in
+ read( funit,* )
+ read( funit,* ) aeroasymm_in
do noptical=1,naermodels
if (aerosol_optical_names(noptical) == name_in) then
aeroextivl(:,noptical) = aeroext_in
@@ -1888,7 +1871,7 @@ subroutine read_optical_input_file
end do
!> close the ASCII input file.
- call mpp_close( unit )
+ close( funit )
!> check to make sure data for all aerosol optical property
!! categories specified in namelist were contained in ASCII
diff --git a/atmos_param/radiation/clouds/bulkphys_rad.F90 b/atmos_param/radiation/clouds/bulkphys_rad.F90
index a159e9ca..2960eff6 100644
--- a/atmos_param/radiation/clouds/bulkphys_rad.F90
+++ b/atmos_param/radiation/clouds/bulkphys_rad.F90
@@ -20,11 +20,11 @@ module bulkphys_rad_mod
! shared modules:
use mpp_mod, only: input_nml_file
-use fms_mod, only: open_namelist_file, mpp_pe, &
+use fms_mod, only: mpp_pe, &
fms_init, mpp_root_pe, stdlog, &
- write_version_number, file_exist, &
+ write_version_number, &
check_nml_error, error_mesg, &
- FATAL, close_file
+ FATAL
! individual cloud modules:
@@ -219,13 +219,12 @@ subroutine bulkphys_rad_init (min_cld_drop_rad_in, max_cld_drop_rad_in,&
!---------------------------------------------------------------------
! local variables:
- integer :: unit, ierr, io, logunit
+ integer :: ierr, io, logunit
integer :: idum
!---------------------------------------------------------------------
! local variables:
!
-! unit io unit for reading nml file and writing logfile
! ierr error code
! io error status returned from io operation
! idum dummy integer argument needed to satisfy
@@ -249,20 +248,8 @@ subroutine bulkphys_rad_init (min_cld_drop_rad_in, max_cld_drop_rad_in,&
!---------------------------------------------------------------------
! read namelist.
!---------------------------------------------------------------------
-#ifdef INTERNAL_FILE_NML
read (input_nml_file, nml=bulkphys_rad_nml, iostat=io)
ierr = check_nml_error(io,'bulkphys_rad_nml')
-#else
- if ( file_exist('input.nml')) then
- unit = open_namelist_file ()
- ierr=1; do while (ierr /= 0)
- read (unit, nml=bulkphys_rad_nml, iostat=io, end=10)
- ierr = check_nml_error(io,'bulkphys_rad_nml')
- enddo
-10 call close_file (unit)
- endif
-#endif
-
!---------------------------------------------------------------------
! write namelist to logfile.
!---------------------------------------------------------------------
diff --git a/atmos_param/radiation/clouds/cloud_spec.F90 b/atmos_param/radiation/clouds/cloud_spec.F90
index 99e6a0f4..7b3eebab 100644
--- a/atmos_param/radiation/clouds/cloud_spec.F90
+++ b/atmos_param/radiation/clouds/cloud_spec.F90
@@ -24,11 +24,12 @@ module cloud_spec_mod
use time_manager_mod, only: time_type, time_manager_init, &
set_time, operator (+)
use mpp_mod, only: input_nml_file
-use fms_mod, only: open_namelist_file, mpp_pe, &
+use fms_mod, only: mpp_pe, &
mpp_root_pe, stdlog, fms_init, &
- write_version_number, file_exist, &
+ write_version_number, &
check_nml_error, error_mesg, &
- FATAL, NOTE, close_file, stdout
+ FATAL, NOTE, stdout
+use fms2_io_mod, only: file_exists
use tracer_manager_mod, only: &
! tracer_manager_init, &
get_tracer_index, NO_TRACER
@@ -290,14 +291,13 @@ subroutine cloud_spec_init (Exch_ctrl, pref, lonb, latb, axes, Time, &
!----------------------------------------------------------------------
! local variables:
- integer :: unit, ierr, io, logunit
+ integer :: ierr, io, logunit
integer :: ndum, i, j, ii, jj
!--------------------------------------------------------------------
! local variables:
!
-! unit io unit for reading nml file and writing logfile
! ierr error code
! io error status returned from io operation
! ndum dummy argument needed for call to field_manager_init
@@ -321,20 +321,8 @@ subroutine cloud_spec_init (Exch_ctrl, pref, lonb, latb, axes, Time, &
!---------------------------------------------------------------------
! read namelist.
-#ifdef INTERNAL_FILE_NML
read (input_nml_file, nml=cloud_spec_nml, iostat=io)
ierr = check_nml_error(io,"cloud_spec_nml")
-#else
-!---------------------------------------------------------------------
- if (file_exist('input.nml')) then
- unit = open_namelist_file ( )
- ierr=1; do while (ierr /= 0)
- read (unit, nml=cloud_spec_nml, iostat=io, end=10)
- ierr = check_nml_error (io, 'cloud_spec_nml')
- enddo
-10 call close_file (unit)
- endif
-#endif
!----------------------------------------------------------------------
! write version number and namelist to logfile.
@@ -503,8 +491,8 @@ subroutine cloud_spec_init (Exch_ctrl, pref, lonb, latb, axes, Time, &
! will not be available until num_pts equals or exceeds tot_pts, so
! continue processing without issuing an error message.
!--------------------------------------------------------------------
- if (file_exist ('INPUT/tracer_cld_amt.res') .or. &
- file_exist ('INPUT/strat_cloud.res') ) then
+ if (file_exists ('INPUT/tracer_cld_amt.res') .or. &
+ file_exists ('INPUT/strat_cloud.res') ) then
num_pts = tot_pts
else
num_pts = 0
diff --git a/atmos_param/radiation/clouds/cloudrad_diagnostics.F90 b/atmos_param/radiation/clouds/cloudrad_diagnostics.F90
index 97440aa9..885a9f33 100644
--- a/atmos_param/radiation/clouds/cloudrad_diagnostics.F90
+++ b/atmos_param/radiation/clouds/cloudrad_diagnostics.F90
@@ -17,11 +17,11 @@ module cloudrad_diagnostics_mod
! shared modules:
use mpp_mod, only: input_nml_file
-use fms_mod, only: fms_init, open_namelist_file, &
+use fms_mod, only: fms_init, &
write_version_number, mpp_pe, &
- mpp_root_pe, stdlog, file_exist, &
+ mpp_root_pe, stdlog, &
check_nml_error, error_mesg, &
- FATAL, NOTE, close_file
+ FATAL, NOTE
use time_manager_mod, only: time_type, time_manager_init, &
operator(>)
use diag_manager_mod, only: register_diag_field, send_data, &
@@ -426,12 +426,11 @@ subroutine cloudrad_diagnostics_init (min_cld_drop_rad_in, &
!---------------------------------------------------------------------
! local variables:
- integer :: unit, io, ierr, logunit
+ integer :: io, ierr, logunit
!---------------------------------------------------------------------
! local variables:
!
-! unit io unit for reading nml file and writing logfile
! io error status returned from io operation
! ierr error code
!
@@ -453,20 +452,8 @@ subroutine cloudrad_diagnostics_init (min_cld_drop_rad_in, &
!---------------------------------------------------------------------
! read namelist.
!---------------------------------------------------------------------
-#ifdef INTERNAL_FILE_NML
read (input_nml_file, nml=cloudrad_diagnostics_nml, iostat=io)
ierr = check_nml_error(io,'cloudrad_diagnostics_nml')
-#else
- if ( file_exist('input.nml')) then
- unit = open_namelist_file ()
- ierr=1; do while (ierr /= 0)
- read (unit, nml=cloudrad_diagnostics_nml, iostat=io, end=10)
- ierr = check_nml_error(io,'cloudrad_diagnostics_nml')
- enddo
-10 call close_file (unit)
- endif
-#endif
-
!---------------------------------------------------------------------
! write namelist to logfile.
!---------------------------------------------------------------------
diff --git a/atmos_param/radiation/clouds/cloudrad_driver.F90 b/atmos_param/radiation/clouds/cloudrad_driver.F90
index ceab21e3..c462139d 100644
--- a/atmos_param/radiation/clouds/cloudrad_driver.F90
+++ b/atmos_param/radiation/clouds/cloudrad_driver.F90
@@ -5,14 +5,12 @@ module cloudrad_driver_mod
use fms_mod, only: fms_init, mpp_clock_id, &
mpp_clock_begin, mpp_clock_end, &
CLOCK_MODULE_DRIVER, CLOCK_MODULE, &
- field_exist, field_size, &
mpp_pe, mpp_root_pe, &
- open_namelist_file, stdlog, stdout, &
- file_exist, FATAL, WARNING, NOTE, &
- close_file, read_data, write_data, &
+ stdlog, stdout, &
+ FATAL, WARNING, NOTE, &
write_version_number, check_nml_error,&
error_mesg, mpp_chksum, &
- read_data, mpp_error
+ mpp_error
use time_manager_mod, only: time_type
use field_manager_mod, only: MODEL_ATMOS
@@ -114,7 +112,7 @@ subroutine cloudrad_driver_init (Time, rad_time_step, &
!----------------------------------------------------------------------
! local variables
- integer :: unit, io, ierr, logunit
+ integer :: io, ierr, logunit
!---------------------------------------------------------------------
! if routine has already been executed, exit.
@@ -134,19 +132,8 @@ subroutine cloudrad_driver_init (Time, rad_time_step, &
!---------------------------------------------------------------------
! read namelist.
!---------------------------------------------------------------------
-#ifdef INTERNAL_FILE_NML
read (input_nml_file, nml=cloudrad_driver_nml, iostat=io)
ierr = check_nml_error(io,'cloudrad_driver_nml')
-#else
- if ( file_exist('input.nml')) then
- unit = open_namelist_file ( )
- ierr=1; do while (ierr /= 0)
- read (unit, nml=cloudrad_driver_nml, iostat=io, end=10)
- ierr = check_nml_error(io,'cloudrad_driver_nml')
- enddo
-10 call close_file (unit)
- endif
-#endif
!---------------------------------------------------------------------
! write version number and namelist to logfile.
diff --git a/atmos_param/radiation/clouds/cloudrad_package.F90 b/atmos_param/radiation/clouds/cloudrad_package.F90
index 7165b797..c894b289 100644
--- a/atmos_param/radiation/clouds/cloudrad_package.F90
+++ b/atmos_param/radiation/clouds/cloudrad_package.F90
@@ -15,11 +15,11 @@ module cloudrad_package_mod
! shared modules:
use mpp_mod, only: input_nml_file
-use fms_mod, only: fms_init, open_namelist_file, &
+use fms_mod, only: fms_init, &
write_version_number, mpp_pe, &
- mpp_root_pe, stdlog, file_exist, &
+ mpp_root_pe, stdlog, &
check_nml_error, error_mesg, &
- FATAL, close_file
+ FATAL
use time_manager_mod, only: time_type, time_manager_init
! cloud radiation modules:
@@ -196,12 +196,11 @@ subroutine cloudrad_package_init (pref, lonb, latb, axes, Time, &
!---------------------------------------------------------------------
! local variables:
- integer :: unit, io, ierr, logunit
+ integer :: io, ierr, logunit
!---------------------------------------------------------------------
! local variables:
!
-! unit io unit for reading nml file
! io error status returned from io operation
! ierr error code
!
@@ -221,21 +220,8 @@ subroutine cloudrad_package_init (pref, lonb, latb, axes, Time, &
!---------------------------------------------------------------------
! read namelist.
-#ifdef INTERNAL_FILE_NML
read (input_nml_file, nml=cloudrad_package_nml, iostat=io)
ierr = check_nml_error(io,"cloudrad_package_nml")
-#else
-!---------------------------------------------------------------------
- if ( file_exist('input.nml')) then
- unit = open_namelist_file ()
- ierr=1; do while (ierr /= 0)
- read (unit, nml=cloudrad_package_nml, iostat=io, end=10)
- ierr = check_nml_error(io,'cloudrad_package_nml')
- enddo
-10 call close_file (unit)
- endif
-#endif
-
!---------------------------------------------------------------------
! write version number and namelist to logfile.
!---------------------------------------------------------------------
diff --git a/atmos_param/radiation/clouds/donner_deep_clouds_W.F90 b/atmos_param/radiation/clouds/donner_deep_clouds_W.F90
index b802a1d3..1c8527e4 100644
--- a/atmos_param/radiation/clouds/donner_deep_clouds_W.F90
+++ b/atmos_param/radiation/clouds/donner_deep_clouds_W.F90
@@ -19,9 +19,8 @@ module donner_deep_clouds_W_mod
use time_manager_mod, only: time_type
use mpp_mod, only: input_nml_file
-use fms_mod, only: open_namelist_file, file_exist, &
- check_nml_error, error_mesg, &
- close_file, FATAL, &
+use fms_mod, only: check_nml_error, error_mesg, &
+ FATAL, &
mpp_pe, mpp_root_pe, &
write_version_number, stdlog
use cloudrad_types_mod, only: microphysics_type
@@ -121,25 +120,14 @@ subroutine donner_deep_clouds_W_init (pref, lonb, latb, axes, Time)
integer, dimension(4), intent(in) :: axes
type(time_type), intent(in) :: Time
- integer :: unit, ierr, io, logunit
+ integer :: ierr, io, logunit
if (module_is_initialized) return
!---------------------------------------------------------------------
!----- read namelist ------
-#ifdef INTERNAL_FILE_NML
read (input_nml_file, nml=donner_deep_clouds_W_nml, iostat=io)
ierr = check_nml_error(io,"donner_deep_clouds_W_nml")
-#else
- if (file_exist('input.nml')) then
- unit = open_namelist_file ()
- ierr=1; do while (ierr /= 0)
- read (unit, nml=donner_deep_clouds_W_nml, iostat=io, end=10)
- ierr = check_nml_error (io, 'donner_deep_clouds_W_nml')
- enddo
-10 call close_file (unit)
- endif
-#endif
if ( mpp_pe() == mpp_root_pe() ) then
call write_version_number(version, tagname)
diff --git a/atmos_param/radiation/clouds/get_random_number_stream.F90 b/atmos_param/radiation/clouds/get_random_number_stream.F90
index 5bfe0e3c..ae315b27 100644
--- a/atmos_param/radiation/clouds/get_random_number_stream.F90
+++ b/atmos_param/radiation/clouds/get_random_number_stream.F90
@@ -4,10 +4,10 @@ module random_number_streams_mod
!----------------------------------------------------------------------
use mpp_mod, only: input_nml_file
-use fms_mod, only: open_namelist_file, mpp_pe, &
+use fms_mod, only: mpp_pe, &
mpp_root_pe, stdlog, fms_init, &
- write_version_number, file_exist, &
- check_nml_error, close_file, &
+ write_version_number, &
+ check_nml_error, &
error_mesg, FATAL, NOTE
use time_manager_mod, only: time_type
use constants_mod, only: RADIAN
@@ -82,7 +82,7 @@ subroutine random_number_streams_init ( lonb, latb, Cldrad_control )
!----------------------------------------------------------------------
! local variables:
- integer :: unit, ierr, io
+ integer :: ierr, io
integer :: id, jd, i, j, ii, jj
!---------------------------------------------------------------------
@@ -98,20 +98,8 @@ subroutine random_number_streams_init ( lonb, latb, Cldrad_control )
!---------------------------------------------------------------------
! read namelist.
-#ifdef INTERNAL_FILE_NML
read (input_nml_file, nml=random_number_streams_nml, iostat=io)
ierr = check_nml_error(io,"random_number_streams_nml")
-#else
- if (file_exist('input.nml')) then
- unit = open_namelist_file ( )
- ierr=1; do while (ierr /= 0)
- read (unit, nml=random_number_streams_nml, iostat=io, end=10)
- ierr = check_nml_error (io, 'random_number_streams_nml')
- enddo
-10 call close_file (unit)
- endif
-#endif
-
!----------------------------------------------------------------------
! write version number and namelist to logfile.
!---------------------------------------------------------------------
@@ -136,17 +124,17 @@ subroutine random_number_streams_init ( lonb, latb, Cldrad_control )
!---------------------------------------------------------------------
if ( force_use_of_temp_for_seed) then
use_temp_for_seed = .true.
- call error_mesg ('cloud_spec_init', &
+ call error_mesg ('random_number_streams_init', &
'Will use temp as basis for stochastic cloud seed; seed is set true', &
NOTE)
else
use_temp_for_seed = .false.
- call error_mesg ('cloud_spec_init', &
+ call error_mesg ('random_number_streams_init', &
' If model resolution is above c48, it is '// &
- 'HIGHLY RECOMMENDED that you set cloud_spec_nml variable '// &
+ 'HIGHLY RECOMMENDED that you set random_number_streams_nml variable '// &
'force_use_of_temp_for_seed to true to assure '// &
'reproducibility across pe count and domain layout', NOTE)
- call error_mesg ('cloud_spec_init', &
+ call error_mesg ('random_number_streams_init', &
'No action is needed at or below c48 resolution.', NOTE)
endif
@@ -185,12 +173,12 @@ subroutine random_number_streams_init ( lonb, latb, Cldrad_control )
if (NINT(lats(ii,jj)) == NINT(lats(i,j))) then
if (NINT(lons(ii,jj)) == NINT(lons(i,j))) then
Cldrad_control%use_temp_for_seed = .true.
- call error_mesg ('cloud_spec_init', &
+ call error_mesg ('random_number_streams_init', &
'Found grid point within 1 degree of &
&another',NOTE)
- call error_mesg ('cloud_spec_init', &
+ call error_mesg ('random_number_streams_init', &
'if reproducibility across npes and layout is &
- &desired, you must set cloud_spec_nml variable &
+ &desired, you must set random_number_streams_nml variable &
&force_use_of_temp_for_seed to true., and &
&restart the model.', NOTE)
exit jLoop
diff --git a/atmos_param/radiation/clouds/isccp_clouds.F90 b/atmos_param/radiation/clouds/isccp_clouds.F90
index 38ae1aad..c32e21d9 100644
--- a/atmos_param/radiation/clouds/isccp_clouds.F90
+++ b/atmos_param/radiation/clouds/isccp_clouds.F90
@@ -18,11 +18,11 @@ module isccp_clouds_mod
! shared modules:
use mpp_mod, only: input_nml_file
-use fms_mod, only: fms_init, open_namelist_file, &
+use fms_mod, only: fms_init, &
write_version_number, mpp_pe, &
- mpp_root_pe, stdlog, file_exist, &
+ mpp_root_pe, stdlog, &
check_nml_error, error_mesg, &
- FATAL, close_file
+ FATAL
use time_manager_mod, only: time_type, time_manager_init
use diag_manager_mod, only: register_diag_field, send_data, &
diag_manager_init
@@ -265,12 +265,11 @@ subroutine isccp_clouds_init (axes, Time)
!---------------------------------------------------------------------
! local variables:
- integer :: unit, io, ierr, logunit
+ integer :: io, ierr, logunit
!---------------------------------------------------------------------
! local variables:
!
-! unit io unit for reading nml file and writing logfile
! io error status returned from io operation
! ierr error code
!
@@ -292,20 +291,8 @@ subroutine isccp_clouds_init (axes, Time)
!---------------------------------------------------------------------
! read namelist.
!---------------------------------------------------------------------
-#ifdef INTERNAL_FILE_NML
read (input_nml_file, nml=isccp_clouds_nml, iostat=io)
ierr = check_nml_error(io,'isccp_clouds_nml')
-#else
- if ( file_exist('input.nml')) then
- unit = open_namelist_file ()
- ierr=1; do while (ierr /= 0)
- read (unit, nml=isccp_clouds_nml, iostat=io, end=10)
- ierr = check_nml_error(io,'isccp_clouds_nml')
- enddo
-10 call close_file (unit)
- endif
-#endif
-
!---------------------------------------------------------------------
! write namelist to logfile.
!---------------------------------------------------------------------
diff --git a/atmos_param/radiation/clouds/microphys_rad.F90 b/atmos_param/radiation/clouds/microphys_rad.F90
index 92266ecc..f1a841c5 100644
--- a/atmos_param/radiation/clouds/microphys_rad.F90
+++ b/atmos_param/radiation/clouds/microphys_rad.F90
@@ -15,11 +15,11 @@ module microphys_rad_mod
! shared modules:
use mpp_mod, only: input_nml_file
-use fms_mod, only: fms_init, open_namelist_file, &
+use fms_mod, only: fms_init, &
write_version_number, mpp_pe, &
- mpp_root_pe, stdlog, file_exist, &
+ mpp_root_pe, stdlog,&
check_nml_error, error_mesg, &
- FATAL, close_file, &
+ FATAL, &
string_array_index
use constants_mod, only: constants_init, diffac
use time_manager_mod, only: time_type
@@ -461,7 +461,7 @@ subroutine microphys_rad_init (min_cld_drop_rad_in, max_cld_drop_rad_in, &
sumsol5
real :: sumplanck
real :: xtemv = 233.15
- integer :: unit, ierr, io, logunit
+ integer :: ierr, io, logunit
integer :: nivl, nband
integer :: nivl1, nivl2, nivl3, nivl4, nivl5
integer :: n, ib, nw, ni
@@ -503,7 +503,6 @@ subroutine microphys_rad_init (min_cld_drop_rad_in, max_cld_drop_rad_in, &
! a water substance band
! xtemv temperature at which planck function is
! evaluated [ deg k ]
-! unit io unit for reading nml file and writing logfile
! io error status returned from io operation
! ierr error code
! nivl fu band index for lw case
@@ -536,20 +535,8 @@ subroutine microphys_rad_init (min_cld_drop_rad_in, max_cld_drop_rad_in, &
!---------------------------------------------------------------------
! read namelist.
!---------------------------------------------------------------------
-#ifdef INTERNAL_FILE_NML
read (input_nml_file, nml=microphys_rad_nml, iostat=io)
ierr = check_nml_error(io,'microphys_rad_nml')
-#else
- if ( file_exist('input.nml')) then
- unit = open_namelist_file ()
- ierr=1; do while (ierr /= 0)
- read (unit, nml=microphys_rad_nml, iostat=io, end=10)
- ierr = check_nml_error(io,'microphys_rad_nml')
- enddo
-10 call close_file (unit)
- endif
-#endif
-
!---------------------------------------------------------------------
! write namelist and version number to logfile.
!---------------------------------------------------------------------
diff --git a/atmos_param/radiation/clouds/strat_clouds_W.F90 b/atmos_param/radiation/clouds/strat_clouds_W.F90
index b834e2bf..082026c1 100644
--- a/atmos_param/radiation/clouds/strat_clouds_W.F90
+++ b/atmos_param/radiation/clouds/strat_clouds_W.F90
@@ -19,11 +19,11 @@ module strat_clouds_W_mod
use constants_mod, only: radian
use time_manager_mod, only: time_type, time_manager_init
use mpp_mod, only: input_nml_file
-use fms_mod, only: open_namelist_file, mpp_pe, &
+use fms_mod, only: mpp_pe, &
mpp_root_pe, stdlog, fms_init, &
- write_version_number, file_exist, &
+ write_version_number, &
check_nml_error, error_mesg, &
- FATAL, close_file
+ FATAL
! atmos shared modules:
@@ -142,12 +142,11 @@ subroutine strat_clouds_W_init(latb, lonb, Cldrad_control, Exch_ctrl)
!----------------------------------------------------------------------
! local variables:
- integer :: unit, ierr, io, logunit
+ integer :: ierr, io, logunit
!--------------------------------------------------------------------
! local variables:
!
-! unit io unit for reading nml file and writing logfile
! ierr error code
! io error status returned from io operation
!
@@ -179,20 +178,8 @@ subroutine strat_clouds_W_init(latb, lonb, Cldrad_control, Exch_ctrl)
!---------------------------------------------------------------------
! read namelist.
!---------------------------------------------------------------------
-#ifdef INTERNAL_FILE_NML
read (input_nml_file, nml=strat_clouds_W_nml, iostat=io)
ierr = check_nml_error(io,'strat_clouds_W_nml')
-#else
- if (file_exist('input.nml')) then
- unit = open_namelist_file ( )
- ierr=1; do while (ierr /= 0)
- read (unit, nml=strat_clouds_W_nml, iostat=io, end=10)
- ierr = check_nml_error (io, 'strat_clouds_W_nml')
- enddo
-10 call close_file (unit)
- endif
-#endif
-
!----------------------------------------------------------------------
! write version number and namelist to logfile.
!---------------------------------------------------------------------
diff --git a/atmos_param/radiation/clouds/uw_clouds_W.F90 b/atmos_param/radiation/clouds/uw_clouds_W.F90
index 3bf78116..64622dd9 100644
--- a/atmos_param/radiation/clouds/uw_clouds_W.F90
+++ b/atmos_param/radiation/clouds/uw_clouds_W.F90
@@ -19,9 +19,8 @@ module uw_clouds_W_mod
use time_manager_mod, only: time_type
use mpp_mod, only: input_nml_file
-use fms_mod, only: open_namelist_file, file_exist, &
- check_nml_error, error_mesg, &
- close_file, FATAL, NOTE, &
+use fms_mod, only: check_nml_error, error_mesg, &
+ FATAL, NOTE, &
WARNING, mpp_pe, mpp_root_pe, &
write_version_number, stdlog
use constants_mod, only: DENS_H2O, RDGAS, TFREEZE, pi
@@ -137,26 +136,15 @@ subroutine uw_clouds_W_init (Exch_ctrl)
type(exchange_control_type), intent(in) :: Exch_ctrl
- integer :: unit, ierr, io, logunit
+ integer :: ierr, io, logunit
if (module_is_initialized) return
!---------------------------------------------------------------------
!----- read namelist ------
!---------------------------------------------------------------------
-#ifdef INTERNAL_FILE_NML
read (input_nml_file, nml=uw_clouds_W_nml, iostat=io)
ierr = check_nml_error(io,"uw_clouds_W_nml")
-#else
- if (file_exist('input.nml')) then
- unit = open_namelist_file ()
- ierr=1; do while (ierr /= 0)
- read (unit, nml=uw_clouds_W_nml, iostat=io, end=10)
- ierr = check_nml_error (io, 'uw_clouds_W_nml')
- enddo
-10 call close_file (unit)
- endif
-#endif
if ( mpp_pe() == mpp_root_pe() ) then
call write_version_number(version, tagname)
diff --git a/atmos_param/radiation/driver/longwave_driver.F90 b/atmos_param/radiation/driver/longwave_driver.F90
index 22848199..83bcc859 100644
--- a/atmos_param/radiation/driver/longwave_driver.F90
+++ b/atmos_param/radiation/driver/longwave_driver.F90
@@ -15,12 +15,11 @@ module longwave_driver_mod
!
use mpp_mod, only: input_nml_file
-use fms_mod, only: open_namelist_file, fms_init, &
+use fms_mod, only: fms_init, &
mpp_pe, mpp_root_pe, stdlog, &
- file_exist, write_version_number, &
+ write_version_number, &
check_nml_error, error_mesg, &
- FATAL, close_file
-
+ FATAL
! shared radiation package modules:
use radiation_driver_types_mod, only: radiation_control_type
@@ -159,7 +158,7 @@ subroutine longwave_driver_init (pref)
!--------------------------------------------------------------------
! local variables
- integer :: unit, ierr, io, logunit
+ integer :: ierr, io, logunit
!---------------------------------------------------------------------
! local variables:
@@ -184,20 +183,8 @@ subroutine longwave_driver_init (pref)
!-----------------------------------------------------------------------
! read namelist.
!-----------------------------------------------------------------------
-#ifdef INTERNAL_FILE_NML
read (input_nml_file, nml=longwave_driver_nml, iostat=io)
ierr = check_nml_error(io,'longwave_driver_nml')
-#else
- if ( file_exist('input.nml')) then
- unit = open_namelist_file ( )
- ierr=1; do while (ierr /= 0)
- read (unit, nml=longwave_driver_nml, iostat=io, end=10)
- ierr = check_nml_error(io,'longwave_driver_nml')
- end do
-10 call close_file (unit)
- endif
-#endif
-
!---------------------------------------------------------------------
! write version number and namelist to logfile.
!---------------------------------------------------------------------
diff --git a/atmos_param/radiation/driver/rad_output_file.F90 b/atmos_param/radiation/driver/rad_output_file.F90
index b4e382f1..fe8fbec3 100644
--- a/atmos_param/radiation/driver/rad_output_file.F90
+++ b/atmos_param/radiation/driver/rad_output_file.F90
@@ -17,11 +17,11 @@ module rad_output_file_mod
! shared modules:
use mpp_mod, only: input_nml_file
-use fms_mod, only: open_namelist_file, fms_init, &
+use fms_mod, only: fms_init, &
mpp_pe, mpp_root_pe, stdlog, &
- file_exist, write_version_number, &
+ write_version_number, &
check_nml_error, error_mesg, &
- FATAL, NOTE, close_file, string, lowercase
+ FATAL, NOTE, string, lowercase
use time_manager_mod, only: time_manager_init, time_type, operator(>)
use diag_manager_mod, only: register_diag_field, diag_manager_init, &
send_data, get_diag_field_id, &
@@ -303,13 +303,12 @@ subroutine rad_output_file_init (axes, Time, names, family_names, &
!---------------------------------------------------------------------
! local variables:
- integer :: unit, io, ierr, logunit
+ integer :: io, ierr, logunit
integer :: nfields
!---------------------------------------------------------------------
! local variables:
!
-! unit io unit number used for namelist file
! ierr error code
! io error status returned from io operation
! nfields number of active aerosol fields
@@ -333,20 +332,8 @@ subroutine rad_output_file_init (axes, Time, names, family_names, &
!-----------------------------------------------------------------------
! read namelist.
!-----------------------------------------------------------------------
-#ifdef INTERNAL_FILE_NML
read (input_nml_file, nml=rad_output_file_nml, iostat=io)
ierr = check_nml_error(io,'rad_output_file_nml')
-#else
- if ( file_exist('input.nml')) then
- unit = open_namelist_file ( )
- ierr=1; do while (ierr /= 0)
- read (unit, nml=rad_output_file_nml, iostat=io, end=10)
- ierr = check_nml_error(io,'rad_output_file_nml')
- end do
-10 call close_file (unit)
- endif
-#endif
-
!---------------------------------------------------------------------
! write version number and namelist to logfile.
!---------------------------------------------------------------------
diff --git a/atmos_param/radiation/driver/radiation_driver.F90 b/atmos_param/radiation/driver/radiation_driver.F90
index dcae14b6..ab908fe8 100644
--- a/atmos_param/radiation/driver/radiation_driver.F90
+++ b/atmos_param/radiation/driver/radiation_driver.F90
@@ -38,22 +38,22 @@ module radiation_driver_mod
! shared modules:
use block_control_mod, only: block_control_type
-use mpp_mod, only: input_nml_file
+use mpp_mod, only: input_nml_file, mpp_get_current_pelist
+use mpp_domains_mod, only: domain2D, mpp_get_ntile_count
use fms_mod, only: fms_init, mpp_clock_id, &
mpp_clock_begin, mpp_clock_end, &
CLOCK_MODULE_DRIVER, CLOCK_MODULE, &
CLOCK_ROUTINE, &
- field_exist, field_size, &
- mpp_pe, mpp_root_pe, &
- open_namelist_file, stdlog, stdout, &
- file_exist, FATAL, WARNING, NOTE, &
- close_file, read_data, write_data, &
+ mpp_pe, mpp_root_pe, mpp_npes,&
+ stdlog, stdout, &
+ FATAL, WARNING, NOTE, &
write_version_number, check_nml_error,&
- error_mesg, mpp_chksum, &
- read_data, mpp_error
-use fms_io_mod, only: restore_state, &
- register_restart_field, restart_file_type, &
- save_restart, get_mosaic_tile_file
+ error_mesg, mpp_chksum
+use fms2_io_mod, only: FmsNetcdfFile_t, FmsNetcdfDomainFile_t, &
+ register_restart_field, register_axis, unlimited, &
+ open_file, read_restart, write_restart, close_file, &
+ register_field, write_data, get_global_io_domain_indices, &
+ register_variable_attribute
use time_manager_mod, only: time_type, set_date, set_time, &
get_time, operator(+), &
print_date, time_manager_init, &
@@ -534,8 +534,6 @@ module radiation_driver_mod
!---------------------------------------------------------------------
!---- private data ----
!-- for netcdf restart
-type(restart_file_type), pointer, save :: Rad_restart => NULL()
-type(restart_file_type), pointer, save :: Til_restart => NULL()
logical :: in_different_file = .false.
integer :: int_renormalize_sw_fluxes
integer :: int_do_clear_sky_pass
@@ -545,8 +543,6 @@ module radiation_driver_mod
integer :: idonner_meso = 0
integer :: idoing_donner = 0
integer :: idoing_uw_conv = 0
-type(restart_file_type), pointer, save :: Rad_restart_conc => NULL()
-type(restart_file_type), pointer, save :: Til_restart_conc => NULL()
logical :: in_different_file_conc = .false.
type(radiation_flux_block_type) :: Restart
@@ -736,6 +732,8 @@ module radiation_driver_mod
! do_stochastic => 1; do_ica_calcs => 2
integer :: flag_stoch
+type (domain2D) :: radiation_domain !< Atmosphere domain
+
!
! A restart data set called radiation_driver.res(.nc) saves the
! global fields for the current radiative tendency, net shortwave
@@ -865,8 +863,10 @@ subroutine radiation_driver_init (Time, lonb, latb, axes, &
integer :: yr, month, year, dum
integer :: ico2, ich4
integer :: num_sw_bands, num_lw_bands
-
-
+ type(FmsNetcdfFile_t) :: Rad_restart, Rad_restart_conc !< Fms2io netcdf fileobj
+ type(FmsNetcdfDomainFile_t) :: Til_restart, Til_restart_conc !< Fms2io domain decomposed fileobj
+ logical :: Rad_restart_exists, Til_restart_exists, Rad_restart_conc_exists, Til_restart_conc_exists
+ integer, allocatable, dimension(:) :: pes !< Array of pes in the current pelist
!---------------------------------------------------------------------
! local variables
!
@@ -904,19 +904,8 @@ subroutine radiation_driver_init (Time, lonb, latb, axes, &
!---------------------------------------------------------------------
! read namelist.
!---------------------------------------------------------------------
-#ifdef INTERNAL_FILE_NML
read (input_nml_file, nml=radiation_driver_nml, iostat=io)
ierr = check_nml_error(io,'radiation_driver_nml')
-#else
- if ( file_exist('input.nml')) then
- unit = open_namelist_file ( )
- ierr=1; do while (ierr /= 0)
- read (unit, nml=radiation_driver_nml, iostat=io, end=10)
- ierr = check_nml_error(io,'radiation_driver_nml')
- enddo
-10 call close_file (unit)
- endif
-#endif
!--------------------------------------------------------------------
! make sure other namelist variables are consistent with
@@ -1151,21 +1140,35 @@ subroutine radiation_driver_init (Time, lonb, latb, axes, &
Rad_control%using_restart_file = using_restart_file
+ !< Get the current pelist
+ allocate(pes(mpp_npes()))
+ call mpp_get_current_pelist(pes)
+
if (Rad_control%using_restart_file) then
!----------------------------------------------------------------------
-! Register fields to be written out to restart file.
- call rad_driver_register_restart('radiation_driver.res.nc')
-
-!-----------------------------------------------------------------------
+! Register fields to be read out to restart file.
! if a valid restart file exists, call read_restart_file to read it.
!-----------------------------------------------------------------------
- if ( file_exist('INPUT/radiation_driver.res.nc')) then
- call restore_state(Rad_restart)
- if(in_different_file) call restore_state(Til_restart)
- else if ( file_exist('INPUT/radiation_driver.res')) then
- call error_mesg ('radiation_driver_mod', &
- 'Native restarts no longer supported', FATAL)
+
+ radiation_domain = Radiation%control%domain
+ !< Open the scalar file with the current pelist, so that only the root pe opens and reads the file and
+ !! distributes the data to the other pes
+ Rad_restart_exists = open_file(Rad_restart,"INPUT/radiation_driver.nc","read", is_restart=.true., pelist=pes)
+ if (Rad_restart_exists) then !scalar file
+ call rad_driver_register_restart_scalars(Rad_Restart)
+ call read_restart(Rad_restart)
+ call close_file(Rad_restart)
+ endif
+
+ Til_restart_exists = open_file(Til_restart,"INPUT/radiation_driver.res.nc","read", radiation_domain, is_restart=.true.)
+ if (Til_restart_exists) then !domain file
+ call rad_driver_register_restart_domain(Til_Restart)
+ call read_restart(Til_restart)
+ call close_file(Til_restart)
+ endif
+
+ if (.not. Rad_restart_exists .and. .not. Til_restart_exists) then
!----------------------------------------------------------------------
! if no restart file is present, initialize the needed fields until
! the radiation package may be called. initial surface flux is set
@@ -1173,7 +1176,6 @@ subroutine radiation_driver_init (Time, lonb, latb, axes, &
! set rad_alarm to be 1 second from now, ie., on the first step of
! the job.
!-----------------------------------------------------------------------
- else
lwrad_alarm = 1
swrad_alarm = 1
if (mpp_pe() == mpp_root_pe() ) then
@@ -1188,16 +1190,9 @@ subroutine radiation_driver_init (Time, lonb, latb, axes, &
'no acceptable radiation restart file present; therefore'//&
' will initialize input fields', NOTE)
endif
- endif
+ endif
-!---------------------------------------------------------------------
-! if not using restart file, then initialize fields it would contain.
-! it is the responsibility of the user to assure restart is on a
-! radiation timestep so that restart seamlessness is maintained. if
-! restart is done on a non-radiation step, restart seamlessness will
-! be lost if a restart file is not available.
-!---------------------------------------------------------------------
- else ! (using_restart_file)
+ else ! (using_restart_file)
lwrad_alarm = 1
swrad_alarm = 1
if (mpp_pe() == mpp_root_pe() ) then
@@ -1293,7 +1288,7 @@ subroutine radiation_driver_init (Time, lonb, latb, axes, &
!---------------------------------------------------------------------
! initialize the diagnostics and solar interpolator module
!---------------------------------------------------------------------
- call radiation_driver_diag_init (Time, id, jd, kmax, axes, &
+ call radiation_driver_diag_init (radiation_domain, Time, id, jd, kmax, axes, &
Rad_control, Aerosolrad_control)
!-----------------------------------------------------------------------
@@ -1406,14 +1401,26 @@ subroutine radiation_driver_init (Time, lonb, latb, axes, &
if (do_concurrent_radiation) then
if (mpp_pe() == mpp_root_pe()) call error_mesg ('radiation_driver_mod:', &
'concurrent radiation restart active', NOTE)
- call conc_rad_register_restart('conc_radiation_driver.res.nc', &
- Rad_flux(size(Rad_flux,1)), Exch_ctrl, Atm_block)
- if (file_exist('INPUT/conc_radiation_driver.res.nc')) then
- call restore_state(Rad_restart_conc)
- if (in_different_file_conc) call restore_state(Til_restart_conc)
- else
+ !< Open the scalar file with the current pelist, so that only the root pe opens and reads the file and
+ !! distributes the data to the other pes
+ Rad_restart_conc_exists = open_file(Rad_restart_conc,"INPUT/conc_radiation_driver.nc","read", is_restart=.true., pelist=pes)
+ if (Rad_restart_conc_exists) then
+ call conc_rad_register_restart_scalars(Rad_restart_conc, Exch_ctrl=Exch_ctrl )
+ call read_restart(Rad_restart_conc)
+ call close_file(Rad_restart_conc)
+ endif
+
+ Til_restart_conc_exists = open_file(Til_restart_conc,"INPUT/conc_radiation_driver.nc","read", radiation_domain, is_restart=.true.)
+ if (Til_restart_conc_exists) then
+ call conc_rad_register_restart_domain(Til_restart_conc, Atm_block)
+ call read_restart(Til_restart_conc)
+ call close_file(Til_restart_conc)
+ endif
+
+ if (.not. Rad_restart_conc_exists .and. .not. Til_restart_conc_exists) then
call error_mesg ('radiation_driver_mod', 'restart file conc_radiation_driver.res.nc not found',NOTE)
endif
+
100 FORMAT("CHECKSUM::",A32," = ",Z20)
outunit = stdout()
write(outunit,*) 'BEGIN CHECKSUM(radiation_driver_init - concurrent):: '
@@ -1455,6 +1462,7 @@ subroutine radiation_driver_init (Time, lonb, latb, axes, &
Rad_flux(size(Rad_flux,1))%block(n)%extinction = Restart%extinction(ibs:ibe,jbs:jbe,:)
end do
endif
+ deallocate(pes)
!---run the time vary routines in order to pre-load interpolation data files
!rab call aerosol_time_vary (Time, Aerosol_rad)
@@ -3467,7 +3475,7 @@ subroutine radiation_driver_restart(Rad_flux, Atm_block, timestamp)
character(len=*), intent(in), optional :: timestamp
call radiation_driver_restart_nc (Rad_flux, Atm_block, timestamp)
- call write_solar_interp_restart_nc (timestamp)
+ call write_solar_interp_restart_nc (timestamp=timestamp)
call radiative_gases_restart (timestamp)
end subroutine radiation_driver_restart
@@ -3490,12 +3498,21 @@ subroutine radiation_driver_restart_nc(Rad_flux, Atm_block, timestamp)
!---local variables
integer :: n, ibs, ibe, jbs, jbe
+ type(FmsNetcdfFile_t) :: Rad_restart_conc !< Fms2io fileobj
+ type(FmsNetcdfDomainFile_t) :: Til_restart_conc !< Fms2io domain decomposed fileobj
+ logical :: conc_tile_file_exist !< Flag indicating if file is open
+ character(len=128) :: filename !< Restart filename
+ integer, allocatable, dimension(:) :: pes !< Array of pes in the current pelist
!---------------------------------------------------------------------
! write restart file if desired; the file is not necessary if job
! ends on step prior to radiation ts, or if restart seamlessness
! is not required.
!---------------------------------------------------------------------
+ !< Get the current pelist
+ allocate(pes(mpp_npes()))
+ call mpp_get_current_pelist(pes)
+
if (do_concurrent_radiation) then
do n = 1,size(Rad_flux%block,1)
ibs = Atm_block%ibs(n)-Atm_block%isc+1
@@ -3520,14 +3537,39 @@ subroutine radiation_driver_restart_nc(Rad_flux, Atm_block, timestamp)
Restart%extinction(ibs:ibe,jbs:jbe,:) = Rad_flux%block(n)%extinction
end do
- if (mpp_pe() == mpp_root_pe() ) then
+ if (mpp_pe() == mpp_root_pe() ) then
call error_mesg('radiation_driver_mod', 'Writing netCDF formatted restart file: '//&
'RESTART/conc_radiation_driver.res.nc', NOTE)
endif
- call save_restart(Rad_restart_conc,timestamp)
- call save_restart(Til_restart_conc,timestamp)
+ if (present(timestamp)) then
+ filename ="RESTART/"//trim(timestamp)//".conc_radiation_driver.nc"
+ else
+ filename = "RESTART/conc_radiation_driver.nc"
+ endif
+
+ !< Open the scalar file with the current pelist, so that only the root pe opens and writes the file
+ if (open_file(Rad_restart_conc,filename,"overwrite", is_restart=.true., pelist=pes)) then
+ call conc_rad_register_restart_scalars(Rad_restart_conc)
+ call write_restart(Rad_restart_conc)
+ call close_file(Rad_restart_conc)
+ endif
+
+ if (mpp_get_ntile_count(radiation_domain) == 1) then
+ conc_tile_file_exist = open_file(Til_restart_conc,filename,"append", radiation_domain, is_restart=.true.)
+ else
+ conc_tile_file_exist = open_file(Til_restart_conc,filename,"overwrite", radiation_domain, is_restart=.true.)
+ endif
+
+ if (conc_tile_file_exist) then
+ call conc_rad_register_restart_domain(Til_restart_conc, Atm_block)
+ call write_restart(Til_restart_conc)
+ call add_domain_dimension_data(Til_restart_conc)
+ call close_file(Til_restart_conc)
+ endif
+
endif
+ deallocate(pes)
if (using_restart_file) then
!---------------------------------------------------------------------
@@ -3598,6 +3640,11 @@ end subroutine radiation_diag_type_dealloc
subroutine write_restart_nc(timestamp)
character(len=*), intent(in), optional :: timestamp
+ type(FmsNetcdfFile_t) :: Rad_restart !< Fms2io fileobj
+ type(FmsNetcdfDomainFile_t) :: Til_restart !< Fms2io domain decomposed fileobj
+ logical :: tile_file_exist !< Flag indicating if file was opened
+ character(len = 128) :: filename !< Restart filename
+ integer, allocatable, dimension(:) :: pes !< Array of pes in the current pelist
if( .not. Rad_control%using_restart_file ) return
!---------------------------------------------------------------------
@@ -3619,113 +3666,189 @@ subroutine write_restart_nc(timestamp)
! Make sure that the restart_versions variable is up to date.
vers = restart_versions(size(restart_versions(:)))
- call save_restart(Rad_restart, timestamp)
- if(in_different_file) call save_restart(Til_restart, timestamp)
+
+ if (present(timestamp)) then
+ filename = "RESTART/"//trim(timestamp)//".radiation_driver.nc"
+ else
+ filename = "RESTART/radiation_driver.nc"
+ endif
+
+ !< Get the current pelist
+ allocate(pes(mpp_npes()))
+ call mpp_get_current_pelist(pes)
+
+ !< Open the scalar file with the current pelist, so that only the root pe opens and writes the file
+ if (open_file(Rad_restart,filename,"overwrite", is_restart=.true., pelist=pes)) then !scalar file
+ call rad_driver_register_restart_scalars(Rad_Restart)
+ call write_restart(Rad_restart)
+ call close_file(Rad_restart)
+ endif
+ deallocate(pes)
+
+ if (mpp_get_ntile_count(radiation_domain) == 1) then
+ tile_file_exist = open_file(Til_restart,filename,"append", radiation_domain, is_restart=.true.)
+ else
+ tile_file_exist = open_file(Til_restart,filename,"overwrite", radiation_domain, is_restart=.true.)
+ endif
+
+ if (tile_file_exist) then !domain file
+ call rad_driver_register_restart_domain(Til_Restart)
+ call write_restart(Til_restart)
+ call add_domain_dimension_data(Til_restart)
+ call close_file(Til_restart)
+ endif
+
!---------------------------------------------------------------------
end subroutine write_restart_nc
+!< Add_dimension_data: Adds dummy data for the domain decomposed axis
+subroutine add_domain_dimension_data(fileobj)
+ type(FmsNetcdfDomainFile_t) :: fileobj !< Fms2io domain decomposed fileobj
+ integer, dimension(:), allocatable :: buffer !< Buffer with axis data
+ integer :: is, ie !< Starting and Ending indices for data
+
+ call get_global_io_domain_indices(fileobj, "xaxis_1", is, ie, indices=buffer)
+ call write_data(fileobj, "xaxis_1", buffer)
+ deallocate(buffer)
+
+ call get_global_io_domain_indices(fileobj, "yaxis_1", is, ie, indices=buffer)
+ call write_data(fileobj, "yaxis_1", buffer)
+ deallocate(buffer)
+
+end subroutine add_domain_dimension_data
+
!#####################################################################
-subroutine conc_rad_register_restart(fname, Rad_flux, Exch_ctrl, Atm_block)
- character(len=*), intent(in) :: fname
- type(radiation_flux_type), intent(in) :: Rad_flux
- type(exchange_control_type), intent(in) :: Exch_ctrl
- type(block_control_type), intent(in) :: Atm_block
+subroutine conc_rad_register_restart_scalars(Rad_restart_conc, Exch_ctrl)
+ type(FmsNetcdfFile_t), intent(inout) :: Rad_restart_conc !< Fms2io fileobj
+ type(exchange_control_type), intent(in), optional :: Exch_ctrl
!---local variables
- character(len=64) :: fname2
- integer :: ix, jx, npz, id_restart
-
- call get_mosaic_tile_file(fname, fname2, .false. )
- allocate(Rad_restart_conc)
- if(trim(fname2) == trim(fname)) then
- Til_restart_conc => Rad_restart_conc
- in_different_file_conc = .false.
- else
- in_different_file_conc = .true.
- allocate(Til_restart_conc)
- endif
+ character(len=8), dimension(1) :: dim_names
+!---------------------------------------------------------------------
+
+ dim_names(1) = "Time"
+ call register_axis(Rad_restart_conc, dim_names(1), unlimited)
if (do_concurrent_radiation) ido_conc_rad = 1
- if (Exch_ctrl%donner_meso_is_largescale) idonner_meso = 1
- if (Exch_ctrl%doing_donner) idoing_donner = 1
- if (Exch_ctrl%doing_uw_conv) idoing_uw_conv = 1
-
- id_restart = register_restart_field(Rad_restart_conc, fname, 'do_concurrent_radiation', ido_conc_rad, no_domain=.true.)
- id_restart = register_restart_field(Rad_restart_conc, fname, 'donner_meso_is_largescale', idonner_meso, no_domain=.true.)
- id_restart = register_restart_field(Rad_restart_conc, fname, 'doing_donner', idoing_donner, no_domain=.true.)
- id_restart = register_restart_field(Rad_restart_conc, fname, 'doing_uw_conv', idoing_uw_conv, no_domain=.true.)
-
- ix = Atm_block%iec-Atm_block%isc+1
- jx = Atm_block%jec-Atm_block%jsc+1
- npz = Atm_block%npz
- call Restart%alloc (ix,jx,npz)
-
- id_restart = register_restart_field(Til_restart_conc, fname, 'tdt_rad', Restart%tdt_rad)
- id_restart = register_restart_field(Til_restart_conc, fname, 'tdt_lw', Restart%tdt_lw)
- id_restart = register_restart_field(Til_restart_conc, fname, 'flux_sw', Restart%flux_sw)
- id_restart = register_restart_field(Til_restart_conc, fname, 'flux_sw_dir', Restart%flux_sw_dir)
- id_restart = register_restart_field(Til_restart_conc, fname, 'flux_sw_dif', Restart%flux_sw_dif)
- id_restart = register_restart_field(Til_restart_conc, fname, 'flux_sw_down_vis_dir', Restart%flux_sw_down_vis_dir)
- id_restart = register_restart_field(Til_restart_conc, fname, 'flux_sw_down_vis_dif', Restart%flux_sw_down_vis_dif)
- id_restart = register_restart_field(Til_restart_conc, fname, 'flux_sw_down_total_dir', Restart%flux_sw_down_total_dir)
- id_restart = register_restart_field(Til_restart_conc, fname, 'flux_sw_down_total_dif', Restart%flux_sw_down_total_dif)
- id_restart = register_restart_field(Til_restart_conc, fname, 'flux_sw_vis', Restart%flux_sw_vis)
- id_restart = register_restart_field(Til_restart_conc, fname, 'flux_sw_vis_dir', Restart%flux_sw_vis_dir)
- id_restart = register_restart_field(Til_restart_conc, fname, 'flux_sw_vis_dif', Restart%flux_sw_vis_dif)
- id_restart = register_restart_field(Til_restart_conc, fname, 'flux_lw', Restart%flux_lw)
- id_restart = register_restart_field(Til_restart_conc, fname, 'coszen', Restart%coszen)
- id_restart = register_restart_field(Til_restart_conc, fname, 'extinction', Restart%extinction)
-
-end subroutine conc_rad_register_restart
+ if (present(Exch_ctrl)) then
+ if (Exch_ctrl%donner_meso_is_largescale) idonner_meso = 1
+ if (Exch_ctrl%doing_donner) idoing_donner = 1
+ if (Exch_ctrl%doing_uw_conv) idoing_uw_conv = 1
+ endif
+
+ call register_restart_field(Rad_restart_conc, 'do_concurrent_radiation', ido_conc_rad, dim_names)
+ call register_restart_field(Rad_restart_conc, 'donner_meso_is_largescale', idonner_meso, dim_names)
+ call register_restart_field(Rad_restart_conc, 'doing_donner', idoing_donner, dim_names)
+ call register_restart_field(Rad_restart_conc, 'doing_uw_conv', idoing_uw_conv, dim_names)
+
+end subroutine conc_rad_register_restart_scalars
+
+subroutine conc_rad_register_restart_domain(Til_restart_conc, Atm_block)
+
+ type(FmsNetcdfDomainFile_t), intent(inout) :: Til_restart_conc !< Fms2io domain decomposed fileobj
+ type(block_control_type), intent(in) :: Atm_block
+
+!---local variables
+ integer :: ix, jx, npz
+ character(len=8), dimension(4) :: dim_names_4d
+ character(len=8), dimension(3) :: dim_names_3d
+!---------------------------------------------------------------------
+
+ dim_names_4d = (/"xaxis_1", "yaxis_1", "zaxis_1", "Time "/)
+ dim_names_3d = (/"xaxis_1", "yaxis_1", "Time "/)
+
+ call register_axis(Til_restart_conc, "xaxis_1", "x")
+ call register_axis(Til_restart_conc, "yaxis_1", "y")
+ call register_axis(Til_restart_conc, "zaxis_1", size(Restart%tdt_rad, 3))
+ if (.not. Til_restart_conc%mode_is_append) call register_axis(Til_restart_conc, "Time", unlimited)
+
+ !< Register the domain decomposed dimensions as variables so that the combiner can work
+ !! correctly
+ call register_field(Til_restart_conc, "xaxis_1", "double", (/"xaxis_1"/))
+ call register_field(Til_restart_conc, "yaxis_1", "double", (/"yaxis_1"/))
+
+ call register_restart_field(Til_restart_conc, 'tdt_rad', Restart%tdt_rad, dim_names_4d)
+ call register_restart_field(Til_restart_conc, 'tdt_lw', Restart%tdt_lw, dim_names_4d)
+ call register_restart_field(Til_restart_conc, 'flux_sw', Restart%flux_sw, dim_names_3d)
+ call register_restart_field(Til_restart_conc, 'flux_sw_dir', Restart%flux_sw_dir, dim_names_3d)
+ call register_restart_field(Til_restart_conc, 'flux_sw_dif', Restart%flux_sw_dif, dim_names_3d)
+ call register_restart_field(Til_restart_conc, 'flux_sw_down_vis_dir', Restart%flux_sw_down_vis_dir, dim_names_3d)
+ call register_restart_field(Til_restart_conc, 'flux_sw_down_vis_dif', Restart%flux_sw_down_vis_dif, dim_names_3d)
+ call register_restart_field(Til_restart_conc, 'flux_sw_down_total_dir', Restart%flux_sw_down_total_dir, dim_names_3d)
+ call register_restart_field(Til_restart_conc, 'flux_sw_down_total_dif', Restart%flux_sw_down_total_dif, dim_names_3d)
+ call register_restart_field(Til_restart_conc, 'flux_sw_vis', Restart%flux_sw_vis, dim_names_3d)
+ call register_restart_field(Til_restart_conc, 'flux_sw_vis_dir', Restart%flux_sw_vis_dir, dim_names_3d)
+ call register_restart_field(Til_restart_conc, 'flux_sw_vis_dif', Restart%flux_sw_vis_dif, dim_names_3d)
+ call register_restart_field(Til_restart_conc, 'flux_lw', Restart%flux_lw, dim_names_3d)
+ call register_restart_field(Til_restart_conc, 'coszen', Restart%coszen, dim_names_3d)
+ call register_restart_field(Til_restart_conc, 'extinction', Restart%extinction, dim_names_4d)
+
+end subroutine conc_rad_register_restart_domain
!#####################################################################
-subroutine rad_driver_register_restart(fname)
- character(len=*), intent(in) :: fname
+subroutine rad_driver_register_restart_scalars(Rad_restart)
+ type(FmsNetcdfFile_t), intent(inout) :: Rad_restart !< Fms2io fileobj
!---------------------------------------------------------------------
- character(len=64) :: fname2
- integer :: id_restart
+ character(len=8), dimension(1) :: dim_names !< Array of dimension names
!---------------------------------------------------------------------
- call get_mosaic_tile_file(fname, fname2, .false. )
- allocate(Rad_restart)
- if(trim(fname2) == trim(fname)) then
- Til_restart => Rad_restart
- in_different_file = .false.
- else
- in_different_file = .true.
- allocate(Til_restart)
- endif
+ dim_names(1) = "Time"
+ call register_axis(Rad_restart, dim_names(1), unlimited)
+
+ call register_restart_field(Rad_restart, 'vers', vers, dim_names)
+ call register_restart_field(Rad_restart, 'lwrad_alarm', lwrad_alarm, dim_names, is_optional = .true. )
+ call register_restart_field(Rad_restart, 'swrad_alarm', swrad_alarm, dim_names, is_optional = .true. )
+ call register_restart_field(Rad_restart, 'lw_rad_time_step', lw_rad_time_step, dim_names, is_optional = .true. )
+ call register_restart_field(Rad_restart, 'sw_rad_time_step', sw_rad_time_step, dim_names, is_optional = .true. )
+ call register_restart_field(Rad_restart, 'renormalize_sw_fluxes', int_renormalize_sw_fluxes, dim_names)
+ call register_restart_field(Rad_restart, 'do_clear_sky_pass', int_do_clear_sky_pass, dim_names)
- id_restart = register_restart_field(Rad_restart, fname, 'vers', vers, no_domain=.true.)
- id_restart = register_restart_field(Rad_restart, fname, 'lwrad_alarm', lwrad_alarm, mandatory=.false.,no_domain=.true.)
- id_restart = register_restart_field(Rad_restart, fname, 'swrad_alarm', swrad_alarm, mandatory=.false.,no_domain=.true.)
- id_restart = register_restart_field(Rad_restart, fname, 'lw_rad_time_step', lw_rad_time_step, mandatory=.false.,no_domain=.true.)
- id_restart = register_restart_field(Rad_restart, fname, 'sw_rad_time_step', sw_rad_time_step, mandatory=.false.,no_domain=.true.)
- id_restart = register_restart_field(Rad_restart, fname, 'renormalize_sw_fluxes', int_renormalize_sw_fluxes,no_domain=.true.)
- id_restart = register_restart_field(Rad_restart, fname, 'do_clear_sky_pass', int_do_clear_sky_pass,no_domain=.true.)
- id_restart = register_restart_field(Til_restart, fname, 'tdt_rad', Rad_output%tdt_rad)
- id_restart = register_restart_field(Til_restart, fname, 'tdtlw', Rad_output%tdtlw)
- id_restart = register_restart_field(Til_restart, fname, 'flux_sw_surf', Rad_output%flux_sw_surf)
- id_restart = register_restart_field(Til_restart, fname, 'flux_sw_surf_dir', Rad_output%flux_sw_surf_dir)
- id_restart = register_restart_field(Til_restart, fname, 'flux_sw_surf_refl_dir', Rad_output%flux_sw_surf_refl_dir)
- id_restart = register_restart_field(Til_restart, fname, 'flux_sw_surf_dif', Rad_output%flux_sw_surf_dif)
- id_restart = register_restart_field(Til_restart, fname, 'flux_sw_down_vis_dir', Rad_output%flux_sw_down_vis_dir)
- id_restart = register_restart_field(Til_restart, fname, 'flux_sw_down_vis_dif', Rad_output%flux_sw_down_vis_dif)
- id_restart = register_restart_field(Til_restart, fname, 'flux_sw_down_total_dir', Rad_output%flux_sw_down_total_dir)
- id_restart = register_restart_field(Til_restart, fname, 'flux_sw_down_total_dif', Rad_output%flux_sw_down_total_dif)
- id_restart = register_restart_field(Til_restart, fname, 'flux_sw_vis', Rad_output%flux_sw_vis)
- id_restart = register_restart_field(Til_restart, fname, 'flux_sw_vis_dir', Rad_output%flux_sw_vis_dir)
- id_restart = register_restart_field(Til_restart, fname, 'flux_sw_refl_vis_dir', Rad_output%flux_sw_refl_vis_dir)
- id_restart = register_restart_field(Til_restart, fname, 'flux_sw_vis_dif', Rad_output%flux_sw_vis_dif)
- id_restart = register_restart_field(Til_restart, fname, 'flux_lw_surf', Rad_output%flux_lw_surf)
- id_restart = register_restart_field(Til_restart, fname, 'coszen_angle', Rad_output%coszen_angle)
-
-!---------------------------------------------------------------------
-
-end subroutine rad_driver_register_restart
+end subroutine rad_driver_register_restart_scalars
+
+subroutine rad_driver_register_restart_domain(Til_restart)
+ type(FmsNetcdfDomainFile_t), intent(inout) :: Til_restart !< Fms2io domain decomposed fileobj
+!---------------------------------------------------------------------
+ character(len=8), dimension(4) :: dim_names_4d !< Array of dimension names
+ character(len=8), dimension(3) :: dim_names_3d !< Array of dimension names
+!---------------------------------------------------------------------
+
+ dim_names_4d = (/"xaxis_1", "yaxis_1", "zaxis_1", "Time "/)
+ dim_names_3d = (/"xaxis_1", "yaxis_1", "Time "/)
+
+ call register_axis(Til_restart, "xaxis_1", "x")
+ call register_axis(Til_restart, "yaxis_1", "y")
+ call register_axis(Til_restart, "zaxis_1", size(Rad_output%tdt_rad, 3))
+ if (.not. Til_restart%mode_is_append) call register_axis(Til_restart, "Time", unlimited)
+
+ !< Register the domain decomposed dimensions as variables so that the combiner can work
+ !! correctly
+ call register_field(Til_restart, "xaxis_1", "double", (/"xaxis_1"/))
+ call register_field(Til_restart, "yaxis_1", "double", (/"yaxis_1"/))
+
+ call register_restart_field(Til_restart, 'tdt_rad', Rad_output%tdt_rad, dim_names_4d)
+ call register_restart_field(Til_restart, 'tdtlw', Rad_output%tdtlw, dim_names_4d)
+ call register_restart_field(Til_restart, 'flux_sw_surf', Rad_output%flux_sw_surf, dim_names_3d)
+ call register_restart_field(Til_restart, 'flux_sw_surf_dir', Rad_output%flux_sw_surf_dir, dim_names_3d)
+ call register_restart_field(Til_restart, 'flux_sw_surf_refl_dir', Rad_output%flux_sw_surf_refl_dir, dim_names_3d)
+ call register_restart_field(Til_restart, 'flux_sw_surf_dif', Rad_output%flux_sw_surf_dif, dim_names_3d)
+ call register_restart_field(Til_restart, 'flux_sw_down_vis_dir', Rad_output%flux_sw_down_vis_dir, dim_names_3d)
+ call register_restart_field(Til_restart, 'flux_sw_down_vis_dif', Rad_output%flux_sw_down_vis_dif, dim_names_3d)
+ call register_restart_field(Til_restart, 'flux_sw_down_total_dir', Rad_output%flux_sw_down_total_dir, dim_names_3d)
+ call register_restart_field(Til_restart, 'flux_sw_down_total_dif', Rad_output%flux_sw_down_total_dif, dim_names_3d)
+ call register_restart_field(Til_restart, 'flux_sw_vis', Rad_output%flux_sw_vis, dim_names_3d)
+ call register_restart_field(Til_restart, 'flux_sw_vis_dir', Rad_output%flux_sw_vis_dir, dim_names_3d)
+ call register_restart_field(Til_restart, 'flux_sw_refl_vis_dir', Rad_output%flux_sw_refl_vis_dir, dim_names_3d)
+ call register_restart_field(Til_restart, 'flux_sw_vis_dif', Rad_output%flux_sw_vis_dif, dim_names_3d)
+ call register_restart_field(Til_restart, 'flux_lw_surf', Rad_output%flux_lw_surf, dim_names_3d)
+ call register_restart_field(Til_restart, 'coszen_angle', Rad_output%coszen_angle, dim_names_3d)
+
+end subroutine rad_driver_register_restart_domain
+
+
+!---------------------------------------------------------------------
!######################################################################
!
diff --git a/atmos_param/radiation/driver/radiation_driver_diag.F90 b/atmos_param/radiation/driver/radiation_driver_diag.F90
index 19aab302..19a79a95 100644
--- a/atmos_param/radiation/driver/radiation_driver_diag.F90
+++ b/atmos_param/radiation/driver/radiation_driver_diag.F90
@@ -55,18 +55,17 @@ module radiation_driver_diag_mod
use mpp_mod, only: input_nml_file
-use fms_mod, only: fms_init, &
- mpp_pe, mpp_root_pe, &
- open_namelist_file, stdlog, stdout, &
- file_exist, FATAL, WARNING, NOTE, &
- close_file, &
- write_version_number, check_nml_error,&
- error_mesg
-use fms_io_mod, only: restore_state, &
- register_restart_field, restart_file_type, &
- save_restart
+use mpp_domains_mod, only: domain2D
+use fms_mod, only: fms_init, mpp_pe, mpp_root_pe, stdlog, &
+ FATAL, NOTE, &
+ write_version_number, check_nml_error, error_mesg
+use fms2_io_mod, only: FmsNetcdfDomainFile_t, &
+ register_restart_field, register_axis, unlimited, &
+ open_file, read_restart, write_restart, close_file, &
+ register_field, write_data, register_variable_attribute, &
+ get_global_io_domain_indices
use diag_manager_mod, only: register_diag_field, send_data, &
- diag_manager_init, get_base_time
+ diag_manager_init
use diag_data_mod, only: CMOR_MISSING_VALUE
use time_manager_mod, only: time_manager_init, time_type, operator(>)
use constants_mod, only: constants_init, STEFAN, SECONDS_PER_DAY, &
@@ -213,8 +212,6 @@ module radiation_driver_diag_mod
!-----------------------------------------------------------------------
!---- private data ----
!-- for netcdf restart
-type(restart_file_type), pointer, save :: Solar_restart => NULL()
-type(restart_file_type), pointer, save :: Tile_restart => NULL()
logical :: doing_netcdf_restart = .false.
! solar_save is used when renormalize_sw_fluxes is active, to save
@@ -315,7 +312,10 @@ module radiation_driver_diag_mod
logical :: do_lwaerosol_forcing
integer :: indx_swaf
integer :: indx_lwaf
+integer :: do_totcld_forcing
+logical :: doing_cloud_forcing
+type (domain2D), pointer :: radiation_diag_domain !< Atmosphere domain
!-----------------------------------------------------------------------
logical :: module_is_initialized = .false.
@@ -330,16 +330,19 @@ module radiation_driver_diag_mod
!
!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-subroutine radiation_driver_diag_init (Time, id, jd, kmax, axes, &
+subroutine radiation_driver_diag_init (domain, Time, id, jd, kmax, axes, &
Rad_control, Aerosolrad_control)
!--------------------------------------------------------------------
+type(domain2D), target, intent(in) :: domain !< Atmosphere domain
type(time_type), intent(in) :: Time
integer, intent(in) :: id, jd, kmax
integer, dimension(4), intent(in) :: axes
type(radiation_control_type), intent(in) :: Rad_control
type(aerosolrad_control_type), intent(in) :: Aerosolrad_control
!---------------------------------------------------------------------
+type(FmsNetcdfDomainFile_t) :: solar_interp !< Fms2io domain decomposed fileobj
+
! local variables
integer :: unit, io, ierr, logunit
@@ -364,19 +367,8 @@ subroutine radiation_driver_diag_init (Time, id, jd, kmax, axes, &
!---------------------------------------------------------------------
! read namelist.
!---------------------------------------------------------------------
-#ifdef INTERNAL_FILE_NML
read (input_nml_file, nml=radiation_driver_diag_nml, iostat=io)
ierr = check_nml_error(io,'radiation_driver_diag_nml')
-#else
- if ( file_exist('input.nml')) then
- unit = open_namelist_file ( )
- ierr=1; do while (ierr /= 0)
- read (unit, nml=radiation_driver_diag_nml, iostat=io, end=10)
- ierr = check_nml_error(io,'radiation_driver_diag_nml')
- enddo
-10 call close_file (unit)
- endif
-#endif
!---------------------------------------------------------------------
! write version number and namelist to logfile.
@@ -501,20 +493,20 @@ subroutine radiation_driver_diag_init (Time, id, jd, kmax, axes, &
!----------------------------------------------------------------------
if (Rad_control%using_restart_file) then
+ radiation_diag_domain => domain
!----------------------------------------------------------------------
-! Register fields to be written out to restart file.
-! Add the solar fields needed to restart the solar interplator
-!----------------------------------------------------------------------
- if (Rad_control%renormalize_sw_fluxes) then
- call solar_interp_register_restart('solar_interp.res.nc', &
- Rad_control%do_totcld_forcing)
!-----------------------------------------------------------------------
! if a valid restart file exists, then read by calling restore_state
!-----------------------------------------------------------------------
- if ( file_exist('INPUT/solar_interp.res.nc')) then
- call restore_state(Tile_restart)
- endif
+ if (Rad_control%renormalize_sw_fluxes) then
+ doing_netcdf_restart = .true.
+ doing_cloud_forcing = Rad_control%do_totcld_forcing
+ if (open_file(solar_interp,"INPUT/solar_interp.res.nc", "read", radiation_diag_domain, is_restart=.true.)) then !domain file
+ call solar_interp_register_restart(solar_interp)
+ call read_restart(solar_interp)
+ call close_file(solar_interp)
+ endif
endif
endif ! (using_restart_file)
@@ -3158,50 +3150,56 @@ end subroutine solar_flux_save_init
!###################################################################
-subroutine solar_interp_register_restart(fname, do_totcld_forcing)
- character(len=*), intent(in) :: fname
- logical, intent(in) :: do_totcld_forcing
-
- character(len=64) :: fname2
- integer :: id_restart
-
- ! all data is distributed on tile files
- !call get_mosaic_tile_file(fname, fname2, .false. )
- allocate(Tile_restart)
- doing_netcdf_restart = .true.
-
-! NOTE: there could a problem when restarting a model with renormalize_sw_fluxes = true
-! if the restart file has int_renormalize_sw_fluxes = 0 (i.e., no sw fluxes saved)
-
- id_restart = register_restart_field(Tile_restart, fname, 'solar_save', solar_save)
- id_restart = register_restart_field(Tile_restart, fname, 'flux_sw_surf_save', Sw_flux_save%flux_sw_surf)
- id_restart = register_restart_field(Tile_restart, fname, 'flux_sw_surf_dir_save', Sw_flux_save%flux_sw_surf_dir)
- id_restart = register_restart_field(Tile_restart, fname, 'flux_sw_surf_refl_dir_save', Sw_flux_save%flux_sw_surf_refl_dir)
- id_restart = register_restart_field(Tile_restart, fname, 'flux_sw_surf_dif_save', Sw_flux_save%flux_sw_surf_dif)
- id_restart = register_restart_field(Tile_restart, fname, 'flux_sw_down_vis_dir_save', Sw_flux_save%flux_sw_down_vis_dir)
- id_restart = register_restart_field(Tile_restart, fname, 'flux_sw_down_vis_dif_save', Sw_flux_save%flux_sw_down_vis_dif)
- id_restart = register_restart_field(Tile_restart, fname, 'flux_sw_down_total_dir_save', Sw_flux_save%flux_sw_down_total_dir)
- id_restart = register_restart_field(Tile_restart, fname, 'flux_sw_down_total_dif_save', Sw_flux_save%flux_sw_down_total_dif)
- id_restart = register_restart_field(Tile_restart, fname, 'flux_sw_vis_save', Sw_flux_save%flux_sw_vis)
- id_restart = register_restart_field(Tile_restart, fname, 'flux_sw_vis_dir_save', Sw_flux_save%flux_sw_vis_dir)
- id_restart = register_restart_field(Tile_restart, fname, 'flux_sw_refl_vis_dir_save', Sw_flux_save%flux_sw_refl_vis_dir)
- id_restart = register_restart_field(Tile_restart, fname, 'flux_sw_vis_dif_save', Sw_flux_save%flux_sw_vis_dif)
- id_restart = register_restart_field(Tile_restart, fname, 'sw_heating_save', Sw_flux_save%sw_heating)
- id_restart = register_restart_field(Tile_restart, fname, 'tot_heating_save', Sw_flux_save%tot_heating)
- id_restart = register_restart_field(Tile_restart, fname, 'dfsw_save', Sw_flux_save%dfsw)
- id_restart = register_restart_field(Tile_restart, fname, 'ufsw_save', Sw_flux_save%ufsw)
- id_restart = register_restart_field(Tile_restart, fname, 'fsw_save', Sw_flux_save%fsw)
- id_restart = register_restart_field(Tile_restart, fname, 'hsw_save', Sw_flux_save%hsw)
- if (do_totcld_forcing) then
- id_restart = register_restart_field(Tile_restart, fname, 'sw_heating_clr_save', Sw_flux_save%sw_heating_clr)
- id_restart = register_restart_field(Tile_restart, fname, 'tot_heating_clr_save', Sw_flux_save%tot_heating_clr)
- id_restart = register_restart_field(Tile_restart, fname, 'dfswcf_save', Sw_flux_save%dfswcf)
- id_restart = register_restart_field(Tile_restart, fname, 'ufswcf_save', Sw_flux_save%ufswcf)
- id_restart = register_restart_field(Tile_restart, fname, 'fswcf_save', Sw_flux_save%fswcf)
- id_restart = register_restart_field(Tile_restart, fname, 'hswcf_save', Sw_flux_save%hswcf)
- id_restart = register_restart_field(Tile_restart, fname, 'flux_sw_down_total_dir_clr_save', Sw_flux_save%flux_sw_down_total_dir_clr)
- id_restart = register_restart_field(Tile_restart, fname, 'flux_sw_down_total_dif_clr_save', Sw_flux_save%flux_sw_down_total_dif_clr)
- id_restart = register_restart_field(Tile_restart, fname, 'flux_sw_down_vis_clr_save', Sw_flux_save%flux_sw_down_vis_clr)
+subroutine solar_interp_register_restart(solar_interp)
+ type(FmsNetcdfDomainFile_t), intent(inout) :: solar_interp !< Fms2io domain decomposed fileobj
+ character(len=8), dimension(4) :: dim_names4d !< Array of dimension names
+ character(len=8), dimension(4) :: dim_names4d2 !< Array of dimension names
+ character(len=8), dimension(3) :: dim_names3d !< Array of dimension names
+
+ dim_names3d = (/"xaxis_1", "yaxis_1", "Time "/)
+ dim_names4d = (/"xaxis_1", "yaxis_1", "zaxis_1", "Time "/)
+ dim_names4d2 = (/"xaxis_1", "yaxis_1", "zaxis_2", "Time "/)
+
+ call register_axis(solar_interp, "Time", unlimited)
+ call register_axis(solar_interp, "xaxis_1", "x")
+ call register_axis(solar_interp, "yaxis_1", "y")
+ call register_axis(solar_interp, "zaxis_1", size(Sw_flux_save%sw_heating, 3))
+ call register_axis(solar_interp, "zaxis_2", size(Sw_flux_save%dfsw, 3))
+
+ !< Register the domain decomposed dimensions as variables so that the combiner can work
+ !! correctly
+ call register_field(solar_interp, "xaxis_1", "double", (/"xaxis_1"/))
+ call register_field(solar_interp, "yaxis_1", "double", (/"yaxis_1"/))
+
+ call register_restart_field(solar_interp, 'solar_save', solar_save, dim_names3d)
+ call register_restart_field(solar_interp, 'flux_sw_surf_save', Sw_flux_save%flux_sw_surf, dim_names3d)
+ call register_restart_field(solar_interp, 'flux_sw_surf_dir_save', Sw_flux_save%flux_sw_surf_dir, dim_names3d)
+ call register_restart_field(solar_interp, 'flux_sw_surf_refl_dir_save', Sw_flux_save%flux_sw_surf_refl_dir, dim_names3d)
+ call register_restart_field(solar_interp, 'flux_sw_surf_dif_save', Sw_flux_save%flux_sw_surf_dif, dim_names3d)
+ call register_restart_field(solar_interp, 'flux_sw_down_vis_dir_save', Sw_flux_save%flux_sw_down_vis_dir, dim_names3d)
+ call register_restart_field(solar_interp, 'flux_sw_down_vis_dif_save', Sw_flux_save%flux_sw_down_vis_dif, dim_names3d)
+ call register_restart_field(solar_interp, 'flux_sw_down_total_dir_save', Sw_flux_save%flux_sw_down_total_dir, dim_names3d)
+ call register_restart_field(solar_interp, 'flux_sw_down_total_dif_save', Sw_flux_save%flux_sw_down_total_dif, dim_names3d)
+ call register_restart_field(solar_interp, 'flux_sw_vis_save', Sw_flux_save%flux_sw_vis, dim_names3d)
+ call register_restart_field(solar_interp, 'flux_sw_vis_dir_save', Sw_flux_save%flux_sw_vis_dir, dim_names3d)
+ call register_restart_field(solar_interp, 'flux_sw_refl_vis_dir_save', Sw_flux_save%flux_sw_refl_vis_dir, dim_names3d)
+ call register_restart_field(solar_interp, 'flux_sw_vis_dif_save', Sw_flux_save%flux_sw_vis_dif, dim_names3d)
+ call register_restart_field(solar_interp, 'sw_heating_save', Sw_flux_save%sw_heating, dim_names4d)
+ call register_restart_field(solar_interp, 'tot_heating_save', Sw_flux_save%tot_heating, dim_names4d)
+ call register_restart_field(solar_interp, 'dfsw_save', Sw_flux_save%dfsw, dim_names4d2)
+ call register_restart_field(solar_interp, 'ufsw_save', Sw_flux_save%ufsw, dim_names4d2)
+ call register_restart_field(solar_interp, 'fsw_save', Sw_flux_save%fsw, dim_names4d2)
+ call register_restart_field(solar_interp, 'hsw_save', Sw_flux_save%hsw, dim_names4d)
+ if (doing_cloud_forcing) then
+ call register_restart_field(solar_interp, 'sw_heating_clr_save', Sw_flux_save%sw_heating_clr, dim_names4d)
+ call register_restart_field(solar_interp, 'tot_heating_clr_save', Sw_flux_save%tot_heating_clr, dim_names4d)
+ call register_restart_field(solar_interp, 'dfswcf_save', Sw_flux_save%dfswcf, dim_names4d2)
+ call register_restart_field(solar_interp, 'ufswcf_save', Sw_flux_save%ufswcf, dim_names4d2)
+ call register_restart_field(solar_interp, 'fswcf_save', Sw_flux_save%fswcf, dim_names4d2)
+ call register_restart_field(solar_interp, 'hswcf_save', Sw_flux_save%hswcf, dim_names4d)
+ call register_restart_field(solar_interp, 'flux_sw_down_total_dir_clr_save', Sw_flux_save%flux_sw_down_total_dir_clr, dim_names3d)
+ call register_restart_field(solar_interp, 'flux_sw_down_total_dif_clr_save', Sw_flux_save%flux_sw_down_total_dif_clr, dim_names3d)
+ call register_restart_field(solar_interp, 'flux_sw_down_vis_clr_save', Sw_flux_save%flux_sw_down_vis_clr, dim_names3d)
endif
end subroutine solar_interp_register_restart
@@ -3209,7 +3207,11 @@ end subroutine solar_interp_register_restart
!###################################################################
subroutine write_solar_interp_restart_nc (timestamp)
-character(len=*), intent(in), optional :: timestamp
+
+ character(len=*), intent(in), optional :: timestamp
+ character(len=128) :: filename !< Restart filename
+
+ type(FmsNetcdfDomainFile_t) :: solar_interp !< Fms2io domain decomposed fileobj
if (.not.doing_netcdf_restart) return
!---------------------------------------------------------------------
@@ -3227,12 +3229,39 @@ subroutine write_solar_interp_restart_nc (timestamp)
!---------------------------------------------------------------------
! Make sure that the restart_versions variable is up to date.
- call save_restart(Tile_restart, timestamp)
+ if (present(timestamp)) then
+ filename = "RESTART/"//trim(timestamp)//".solar_interp.res.nc"
+ else
+ filename = "RESTART/solar_interp.res.nc"
+ endif
+
+ if (open_file(solar_interp,filename, "overwrite", radiation_diag_domain, is_restart=.true.)) then !domain file
+ call solar_interp_register_restart(solar_interp)
+ call write_restart(solar_interp)
+ call add_domain_dimension_data(solar_interp)
+ call close_file(solar_interp)
+ endif
end subroutine write_solar_interp_restart_nc
!###################################################################
+!< Add_dimension_data: Adds dummy data for the domain decomposed axis
+subroutine add_domain_dimension_data(fileobj)
+ type(FmsNetcdfDomainFile_t) :: fileobj !< Fms2io domain decomposed fileobj
+ integer, dimension(:), allocatable :: buffer !< Buffer with axis data
+ integer :: is, ie !< Starting and Ending indices for data
+
+ call get_global_io_domain_indices(fileobj, "xaxis_1", is, ie, indices=buffer)
+ call write_data(fileobj, "xaxis_1", buffer)
+ deallocate(buffer)
+
+ call get_global_io_domain_indices(fileobj, "yaxis_1", is, ie, indices=buffer)
+ call write_data(fileobj, "yaxis_1", buffer)
+ deallocate(buffer)
+
+end subroutine add_domain_dimension_data
+
subroutine radiation_driver_diag_endts (Rad_control)
type(radiation_control_type), intent(in) :: Rad_control
diff --git a/atmos_param/radiation/driver/shortwave_driver.F90 b/atmos_param/radiation/driver/shortwave_driver.F90
index 52df0e6a..f1a0a80f 100644
--- a/atmos_param/radiation/driver/shortwave_driver.F90
+++ b/atmos_param/radiation/driver/shortwave_driver.F90
@@ -22,11 +22,11 @@ module shortwave_driver_mod
! shared modules:
use mpp_mod, only: input_nml_file
-use fms_mod, only: open_namelist_file, fms_init, &
+use fms_mod, only: fms_init, &
mpp_pe, mpp_root_pe, stdlog, &
- file_exist, write_version_number, &
+ write_version_number, &
check_nml_error, error_mesg, &
- FATAL, NOTE, close_file
+ FATAL, NOTE
use time_manager_mod, only: time_manager_init, time_type, &
set_date, get_date, print_date, &
assignment(=), operator(-), &
@@ -204,14 +204,13 @@ subroutine shortwave_driver_init (Rad_control)
!---------------------------------------------------------------------
! local variables:
- integer :: unit, io, ierr, logunit
+ integer :: io, ierr, logunit
integer :: nbands
type(time_type) :: Time_init, Solar_entry
!---------------------------------------------------------------------
! local variables:
!
-! unit io unit number used for namelist file
! ierr error code
! io error status returned from io operation
!
@@ -230,23 +229,8 @@ subroutine shortwave_driver_init (Rad_control)
call diag_manager_init
call time_manager_init
-#ifdef INTERNAL_FILE_NML
read (input_nml_file, nml=shortwave_driver_nml, iostat=io)
ierr = check_nml_error(io,"shortwave_driver_nml")
-#else
-!-----------------------------------------------------------------------
-! read namelist.
-!-----------------------------------------------------------------------
- if ( file_exist('input.nml')) then
- unit = open_namelist_file ( )
- ierr=1; do while (ierr /= 0)
- read (unit, nml=shortwave_driver_nml, iostat=io, end=10)
- ierr = check_nml_error(io,'shortwave_driver_nml')
- end do
-10 call close_file (unit)
- endif
-#endif
-
!---------------------------------------------------------------------
! write version number and namelist to logfile.
!---------------------------------------------------------------------
diff --git a/atmos_param/radiation/driver/solar_data_driver.F90 b/atmos_param/radiation/driver/solar_data_driver.F90
index 9cdef037..47b7eb85 100644
--- a/atmos_param/radiation/driver/solar_data_driver.F90
+++ b/atmos_param/radiation/driver/solar_data_driver.F90
@@ -4,10 +4,11 @@ module solar_data_driver_mod
use mpp_mod, only: input_nml_file
use fms_mod, only: fms_init, mpp_pe, mpp_root_pe, &
- open_namelist_file, stdlog, &
- file_exist, FATAL, NOTE, &
- error_mesg, close_file, &
+ stdlog, &
+ FATAL, NOTE, &
+ error_mesg, &
write_version_number, check_nml_error
+use fms2_io_mod, only: file_exists
use time_manager_mod, only: time_type, get_date, time_manager_init
!--------------------------------------------------------------------
@@ -75,7 +76,7 @@ subroutine solar_data_driver_init (nbands, ierror)
! local variables
integer :: yr, month, nband, nyr, nv
-integer :: unit, io, ierr, logunit
+integer :: io, ierr, logunit, funit
!---------------------------------------------------------------------
! if routine has already been executed, exit.
@@ -93,27 +94,15 @@ subroutine solar_data_driver_init (nbands, ierror)
!---------------------------------------------------------------------
! read namelist.
!---------------------------------------------------------------------
-#ifdef INTERNAL_FILE_NML
read (input_nml_file, nml=solar_data_driver_nml, iostat=io)
ierr = check_nml_error(io,'solar_data_driver_nml')
-#else
- if ( file_exist('input.nml')) then
- unit = open_namelist_file ( )
- ierr=1; do while (ierr /= 0)
- read (unit, nml=solar_data_driver_nml, iostat=io, end=10)
- ierr = check_nml_error(io,'solar_data_driver_nml')
- enddo
-10 call close_file (unit)
- endif
-#endif
!--------------------------------------------------------------------
! code to handle time-varying solar input
!--------------------------------------------------------------------
- if (file_exist('INPUT/lean_solar_spectral_data.dat')) then
- unit = open_namelist_file &
- ('INPUT/lean_solar_spectral_data.dat')
- read (unit, FMT = '(4i8)') first_yr_lean, last_yr_lean, &
+ if (file_exists('INPUT/lean_solar_spectral_data.dat')) then
+ open(file='INPUT/lean_solar_spectral_data.dat', form='formatted',action='read', newunit=funit)
+ read (funit, FMT = '(4i8)') first_yr_lean, last_yr_lean, &
nvalues_per_year_lean, numbands_lean
if (numbands_lean /= nbands) then
call error_mesg ('radiation_driver_mod', &
@@ -128,8 +117,8 @@ subroutine solar_data_driver_init (nbands, ierror)
allocate (solflxband_lean_ann_1882(numbands_lean))
allocate (solflxband_lean_ann_2000(numbands_lean))
- read (unit, FMT = '(2i6,f17.4)') yr, month, solflxtot_lean_ann_1882
- read (unit, FMT = '(6e12.5 )') (solflxband_lean_ann_1882(nband), nband =1,numbands_lean)
+ read (funit, FMT = '(2i6,f17.4)') yr, month, solflxtot_lean_ann_1882
+ read (funit, FMT = '(6e12.5 )') (solflxband_lean_ann_1882(nband), nband =1,numbands_lean)
if (solar_scale_factor >= 0.0) then
solflxtot_lean_ann_1882 = solflxtot_lean_ann_1882 * solar_scale_factor
do nband = 1,numbands_lean
@@ -140,8 +129,8 @@ subroutine solar_data_driver_init (nbands, ierror)
do nyr=1,years_of_data_lean
do nv=1,nvalues_per_year_lean
- read (unit, FMT = '(2i6,f17.4)') yr, month, solflxtot_lean(nyr,nv)
- read (unit, FMT = '(6e12.5 )') (solflxband_lean &
+ read (funit, FMT = '(2i6,f17.4)') yr, month, solflxtot_lean(nyr,nv)
+ read (funit, FMT = '(6e12.5 )') (solflxband_lean &
(nyr,nv,nband), nband =1,numbands_lean)
end do
end do
@@ -162,9 +151,9 @@ subroutine solar_data_driver_init (nbands, ierror)
enddo
endif
- read (unit, FMT = '(2i6,f17.4)') yr, month, solflxtot_lean_ann_2000
- read (unit, FMT = '(6e12.5 )') (solflxband_lean_ann_2000(nband), nband =1,numbands_lean)
- call close_file (unit)
+ read (funit, FMT = '(2i6,f17.4)') yr, month, solflxtot_lean_ann_2000
+ read (funit, FMT = '(6e12.5 )') (solflxband_lean_ann_2000(nband), nband =1,numbands_lean)
+ close(funit)
if (solar_scale_factor >= 0.0) then
solflxtot_lean_ann_2000 = solflxtot_lean_ann_2000 * solar_scale_factor
do nband = 1,numbands_lean
diff --git a/atmos_param/radiation/longwave/gas_tf.F90 b/atmos_param/radiation/longwave/gas_tf.F90
index 820f15f0..5992b8e8 100644
--- a/atmos_param/radiation/longwave/gas_tf.F90
+++ b/atmos_param/radiation/longwave/gas_tf.F90
@@ -15,12 +15,11 @@ module gas_tf_mod
! shared modules:
use mpp_mod, only : input_nml_file
-use fms_mod, only : open_namelist_file, fms_init, &
+use fms_mod, only : fms_init, &
mpp_pe, mpp_root_pe, stdlog, &
- file_exist, write_version_number, &
+ write_version_number, &
check_nml_error, error_mesg, &
- FATAL, close_file, &
- open_restart_file
+ FATAL
use constants_mod, only : constants_init, RDGAS, GRAV, pstd
! longwave radiation package modules:
@@ -588,7 +587,7 @@ subroutine gas_tf_init (pref)
real :: prkminh2o = 28.0
integer :: kmin, kmax
integer :: ks = 1
- integer :: unit, ierr, io, logunit
+ integer :: ierr, io, logunit
integer :: k
!--------------------------------------------------------------------
@@ -601,7 +600,6 @@ subroutine gas_tf_init (pref)
! kmin
! kmax
! ks
-! unit
! ierr
! io
! k
@@ -620,22 +618,8 @@ subroutine gas_tf_init (pref)
call fms_init
call constants_init
-#ifdef INTERNAL_FILE_NML
read (input_nml_file, nml=gas_tf_nml, iostat=io)
ierr = check_nml_error(io,"gas_tf_nml")
-#else
-!-----------------------------------------------------------------------
-! read namelist.
-!-----------------------------------------------------------------------
- if ( file_exist('input.nml')) then
- unit = open_namelist_file ( )
- ierr=1; do while (ierr /= 0)
- read (unit, nml=gas_tf_nml, iostat=io, end=10)
- ierr = check_nml_error(io,'gas_tf_nml')
- end do
-10 call close_file (unit)
- endif
-#endif
!---------------------------------------------------------------------
! write version number and namelist to logfile.
@@ -3618,46 +3602,46 @@ subroutine gas_tf_end
!---------------------------------------------------------------------
if (do_writestdco2tfs) then
if (mpp_pe() == mpp_root_pe() ) then
- tfsunit = open_restart_file ('stdco2tfs', action='write')
+ open(file='stdco2tfs', form='unformatted',action='write', newunit=tfsunit)
write (tfsunit) valid_versions(nvalids)
write (tfsunit) co2_name_save, co2_amount_save, &
nstdlvls_save, kbegin_save, kend_save
write (tfsunit) pd_save, plm_save, pa_save
- write (tfsunit) co215nbps1, co215nbps8, co2dt15nbps1, &
+ write (tfsunit) co215nbps1, co215nbps8, co2dt15nbps1, &
co2dt15nbps8, co2d2t15nbps1, co2d2t15nbps8
write (tfsunit) co251, co258, cdt51, cdt58, c2d51, c2d58, &
co2m51, co2m58, cdtm51, cdtm58, c2dm51, c2dm58
write (tfsunit) co211, co218
- call close_file (tfsunit)
+ close(tfsunit)
endif
endif
if (do_writestdco210umtfs) then
if (mpp_pe() == mpp_root_pe() ) then
- tfsunit = open_restart_file ('stdco210umtfs', action='write')
+ open(file='stdco210umtfs', form='unformatted',action='write', newunit=tfsunit)
write (tfsunit) valid_versions(nvalids)
write (tfsunit) co2_name_save, co2_amount_save, &
nstdlvls_save, kbegin_save, kend_save
write (tfsunit) pd_save, plm_save, pa_save
- write (tfsunit) co2990nbps1, co2990nbps8, co2dt990nbps1, &
+ write (tfsunit) co2990nbps1, co2990nbps8, co2dt990nbps1, &
co2dt990nbps8, co2d2t990nbps1, co2d2t990nbps8
write (tfsunit) co29901, co29908, cdt9901, cdt9908, c2d9901, c2d9908, &
co2m9901, co2m9908, cdtm9901, cdtm9908, c2dm9901, c2dm9908
- write (tfsunit) co2900nbps1, co2900nbps8, co2dt900nbps1, &
+ write (tfsunit) co2900nbps1, co2900nbps8, co2dt900nbps1, &
co2dt900nbps8, co2d2t900nbps1, co2d2t900nbps8
write (tfsunit) co29001, co29008, cdt9001, cdt9008, c2d9001, c2d9008, &
co2m9001, co2m9008, cdtm9001, cdtm9008, c2dm9001, c2dm9008
- write (tfsunit) co21070nbps1, co21070nbps8, co2dt1070nbps1, &
+ write (tfsunit) co21070nbps1, co21070nbps8, co2dt1070nbps1, &
co2dt1070nbps8, co2d2t1070nbps1, co2d2t1070nbps8
write (tfsunit) co210701, co210708, cdt10701, cdt10708, c2d10701, c2d10708, &
co2m10701, co2m10708, cdtm10701, cdtm10708, c2dm10701, c2dm10708
- call close_file (tfsunit)
+ close(tfsunit)
endif
endif
if (do_writestdn2otfs) then
if (mpp_pe() == mpp_root_pe()) then
- tfsunit = open_restart_file ('stdn2otfs', action='write')
+ open(file='stdn2otfs', form='unformatted',action='write', newunit=tfsunit)
write (tfsunit) valid_versions(nvalids)
write (tfsunit) n2o_name_save, n2o_amount_save, &
nstdlvls_save, kbegin_save, kend_save
@@ -3668,20 +3652,20 @@ subroutine gas_tf_end
n2od2t78
write (tfsunit) n2o91, n2o98, n2odt91, n2odt98, n2od2t91, &
n2od2t98
- call close_file (tfsunit)
+ close(tfsunit)
endif
endif
if (do_writestdch4tfs) then
if (mpp_pe() == mpp_root_pe()) then
- tfsunit = open_restart_file ('stdch4tfs', action='write')
+ open(file='stdch4tfs', form='unformatted',action='write', newunit=tfsunit)
write (tfsunit) valid_versions(nvalids)
write (tfsunit) ch4_name_save, ch4_amount_save, &
nstdlvls_save, kbegin_save, kend_save
write (tfsunit) pd_save, plm_save, pa_save
write (tfsunit) ch451, ch458, ch4dt51, ch4dt58, ch4d2t51, &
ch4d2t58
- call close_file (tfsunit)
+ close(tfsunit)
endif
endif
@@ -3748,7 +3732,7 @@ subroutine process_co2_input_file (gas_name, gas_amount, nstdlvls, &
!---------------------------------------------------------------------
! local variables:
- integer :: unit
+ integer :: tfsunit
!---------------------------------------------------------------------
! local variables:
@@ -3774,16 +3758,16 @@ subroutine process_co2_input_file (gas_name, gas_amount, nstdlvls, &
! read the input tf file and verify that the current model config-
! uration matches that for which the tfs were generated.
!--------------------------------------------------------------------
- unit = open_restart_file ('INPUT/stdco2tfs', action='read')
+ open(file='INPUT/stdco2tfs', form='unformatted',action='read', newunit=tfsunit)
call process_gas_input_file (gas_name, gas_amount, nstdlvls, &
- kbegin, kend, pd, plm, pa, unit)
+ kbegin, kend, pd, plm, pa, tfsunit)
- read (unit) co215nbps1, co215nbps8, co2dt15nbps1, &
+ read (tfsunit) co215nbps1, co215nbps8, co2dt15nbps1, &
co2dt15nbps8, co2d2t15nbps1, co2d2t15nbps8
- read (unit) co251, co258, cdt51, cdt58, c2d51, c2d58, &
+ read (tfsunit) co251, co258, cdt51, cdt58, c2d51, c2d58, &
co2m51, co2m58, cdtm51, cdtm58, c2dm51, c2dm58
- read (unit) co211, co218
- call close_file (unit)
+ read (tfsunit) co211, co218
+ close (tfsunit)
endif
if (do_readstdco210umtfs) then
@@ -3791,23 +3775,23 @@ subroutine process_co2_input_file (gas_name, gas_amount, nstdlvls, &
! read the input tf file and verify that the current model config-
! uration matches that for which the tfs were generated.
!--------------------------------------------------------------------
- unit = open_restart_file ('INPUT/stdco210umtfs', action='read')
+ open(file='INPUT/stdco210umtfs', form='unformatted',action='read', newunit=tfsunit)
call process_gas_input_file (gas_name, gas_amount, nstdlvls, &
- kbegin, kend, pd, plm, pa, unit)
+ kbegin, kend, pd, plm, pa, tfsunit)
- read (unit) co2990nbps1, co2990nbps8, co2dt990nbps1, &
+ read (tfsunit) co2990nbps1, co2990nbps8, co2dt990nbps1, &
co2dt990nbps8, co2d2t990nbps1, co2d2t990nbps8
- read (unit) co29901, co29908, cdt9901, cdt9908, c2d9901, c2d9908, &
+ read (tfsunit) co29901, co29908, cdt9901, cdt9908, c2d9901, c2d9908, &
co2m9901, co2m9908, cdtm9901, cdtm9908, c2dm9901, c2dm9908
- read (unit) co2900nbps1, co2900nbps8, co2dt900nbps1, &
+ read (tfsunit) co2900nbps1, co2900nbps8, co2dt900nbps1, &
co2dt900nbps8, co2d2t900nbps1, co2d2t900nbps8
- read (unit) co29001, co29008, cdt9001, cdt9008, c2d9001, c2d9008, &
+ read (tfsunit) co29001, co29008, cdt9001, cdt9008, c2d9001, c2d9008, &
co2m9001, co2m9008, cdtm9001, cdtm9008, c2dm9001, c2dm9008
- read (unit) co21070nbps1, co21070nbps8, co2dt1070nbps1, &
+ read (tfsunit) co21070nbps1, co21070nbps8, co2dt1070nbps1, &
co2dt1070nbps8, co2d2t1070nbps1, co2d2t1070nbps8
- read (unit) co210701, co210708, cdt10701, cdt10708, c2d10701, c2d10708, &
+ read (tfsunit) co210701, co210708, cdt10701, cdt10708, c2d10701, c2d10708, &
co2m10701, co2m10708, cdtm10701, cdtm10708, c2dm10701, c2dm10708
- call close_file (unit)
+ close(tfsunit)
endif
if (do_writestdco2tfs .or. do_writestdco210umtfs) then
@@ -3890,7 +3874,7 @@ subroutine process_ch4_input_file (gas_name, gas_amount, nstdlvls, &
- integer :: unit
+ integer :: tfsunit
@@ -3918,11 +3902,11 @@ subroutine process_ch4_input_file (gas_name, gas_amount, nstdlvls, &
! read the input tf file and verify that the current model config-
! uration matches that for which the tfs were generated.
!--------------------------------------------------------------------
- unit = open_restart_file ('INPUT/stdch4tfs', action='read')
+ open(file='INPUT/stdch4tfs', form='unformatted',action='read', newunit=tfsunit)
call process_gas_input_file (gas_name, gas_amount, nstdlvls, &
- kbegin, kend, pd, plm, pa, unit)
- read (unit) ch451, ch458, ch4dt51, ch4dt58, ch4d2t51, ch4d2t58
- call close_file (unit)
+ kbegin, kend, pd, plm, pa, tfsunit)
+ read (tfsunit) ch451, ch458, ch4dt51, ch4dt58, ch4d2t51, ch4d2t58
+ close(tfsunit)
!--------------------------------------------------------------------
! save the data necessary to write a tf file at the end of this job
@@ -4005,7 +3989,7 @@ subroutine process_n2o_input_file (gas_name, gas_amount, nstdlvls, &
- integer :: unit
+ integer :: tfsunit
@@ -4033,13 +4017,13 @@ subroutine process_n2o_input_file (gas_name, gas_amount, nstdlvls, &
! read the input tf file and verify that the current model config-
! uration matches that for which the tfs were generated.
!--------------------------------------------------------------------
- unit = open_restart_file ('INPUT/stdn2otfs', action='read')
+ open(file='INPUT/stdn2otfs', form='unformatted',action='read', newunit=tfsunit)
call process_gas_input_file (gas_name, gas_amount, nstdlvls, &
- kbegin, kend, pd, plm, pa, unit)
- read (unit) n2o51, n2o58, n2odt51, n2odt58, n2od2t51, n2od2t58
- read (unit) n2o71, n2o78, n2odt71, n2odt78, n2od2t71, n2od2t78
- read (unit) n2o91, n2o98, n2odt91, n2odt98, n2od2t91, n2od2t98
- call close_file (unit)
+ kbegin, kend, pd, plm, pa, tfsunit)
+ read (tfsunit) n2o51, n2o58, n2odt51, n2odt58, n2od2t51, n2od2t58
+ read (tfsunit) n2o71, n2o78, n2odt71, n2odt78, n2od2t71, n2od2t78
+ read (tfsunit) n2o91, n2o98, n2odt91, n2odt98, n2od2t91, n2od2t98
+ close (tfsunit)
!--------------------------------------------------------------------
! save the data necessary to write a tf file at the end of this job
@@ -4766,7 +4750,7 @@ end subroutine transfn_10um
!
!
subroutine process_gas_input_file (gas_name, gas_amount, nstdlvls, &
- kbegin, kend, pd, plm, pa, unit)
+ kbegin, kend, pd, plm, pa, tsfunit)
!--------------------------------------------------------------------
!
@@ -4774,7 +4758,7 @@ subroutine process_gas_input_file (gas_name, gas_amount, nstdlvls, &
character(len=*), intent(in) :: gas_name
real, intent(in) :: gas_amount
-integer, intent(in) :: nstdlvls, kbegin, kend, unit
+integer, intent(in) :: nstdlvls, kbegin, kend, tsfunit
real, dimension(:), intent(in) :: pd, plm, pa
!---------------------------------------------------------------------
@@ -4805,7 +4789,7 @@ subroutine process_gas_input_file (gas_name, gas_amount, nstdlvls, &
!--------------------------------------------------------------------
!
!--------------------------------------------------------------------
- read (unit) gastf_version
+ read (tsfunit) gastf_version
do n=1, nvalids
if (gastf_version == valid_versions(n)) then
valid = .true.
@@ -4824,7 +4808,7 @@ subroutine process_gas_input_file (gas_name, gas_amount, nstdlvls, &
!--------------------------------------------------------------------
!
!--------------------------------------------------------------------
- read (unit) gas_file, gas_amount_file, nstdlvls_file, &
+ read (tsfunit) gas_file, gas_amount_file, nstdlvls_file, &
kbegin_file, kend_file
!--------------------------------------------------------------------
@@ -4866,7 +4850,7 @@ subroutine process_gas_input_file (gas_name, gas_amount, nstdlvls, &
!--------------------------------------------------------------------
!
!--------------------------------------------------------------------
- read (unit) pd_file, plm_file, pa_file
+ read (tsfunit) pd_file, plm_file, pa_file
!--------------------------------------------------------------------
!
diff --git a/atmos_param/radiation/longwave/longwave_clouds.F90 b/atmos_param/radiation/longwave/longwave_clouds.F90
index a8dbd495..ed2ccd12 100644
--- a/atmos_param/radiation/longwave/longwave_clouds.F90
+++ b/atmos_param/radiation/longwave/longwave_clouds.F90
@@ -18,11 +18,11 @@ module longwave_clouds_mod
! shared modules:
use mpp_mod, only: input_nml_file
-use fms_mod, only: open_namelist_file, fms_init, &
+use fms_mod, only: fms_init, &
mpp_pe, mpp_root_pe, stdlog, &
- file_exist, write_version_number, &
+ write_version_number, &
check_nml_error, error_mesg, &
- FATAL, close_file
+ FATAL
use constants_mod, only: constants_init, radcon
! shared radiation package modules:
@@ -118,12 +118,11 @@ subroutine longwave_clouds_init (num_cloud_bands)
!--------------------------------------------------------------------
! local variables:
- integer :: unit, ierr, io, logunit
+ integer :: ierr, io, logunit
!---------------------------------------------------------------------
! local variables:
!
-! unit io unit number used for namelist file
! ierr error code
! io error status returned from io operation
!
@@ -144,20 +143,8 @@ subroutine longwave_clouds_init (num_cloud_bands)
!-----------------------------------------------------------------------
! read namelist.
!-----------------------------------------------------------------------
-#ifdef INTERNAL_FILE_NML
read (input_nml_file, nml=longwave_clouds_nml, iostat=io)
ierr = check_nml_error(io,'longwave_clouds_nml')
-#else
- if ( file_exist('input.nml')) then
- unit = open_namelist_file ( )
- ierr=1; do while (ierr /= 0)
- read (unit, nml=longwave_clouds_nml, iostat=io, end=10)
- ierr = check_nml_error(io,'longwave_clouds_nml')
- end do
-10 call close_file (unit)
- endif
-#endif
-
!---------------------------------------------------------------------
! write version number and namelist to logfile.
!---------------------------------------------------------------------
diff --git a/atmos_param/radiation/longwave/longwave_fluxes.F90 b/atmos_param/radiation/longwave/longwave_fluxes.F90
index de8e89e3..ebfa0f46 100644
--- a/atmos_param/radiation/longwave/longwave_fluxes.F90
+++ b/atmos_param/radiation/longwave/longwave_fluxes.F90
@@ -17,11 +17,11 @@ module longwave_fluxes_mod
! shared modules:
use mpp_mod, only: input_nml_file
-use fms_mod, only: open_namelist_file, fms_init, &
+use fms_mod, only: fms_init, &
mpp_pe, mpp_root_pe, stdlog, &
- file_exist, write_version_number, &
+ write_version_number, &
check_nml_error, error_mesg, &
- FATAL, close_file
+ FATAL
! shared radiation package modules:
@@ -101,12 +101,11 @@ subroutine longwave_fluxes_init
!---------------------------------------------------------------------
!---------------------------------------------------------------------
- integer :: unit, ierr, io, logunit
+ integer :: ierr, io, logunit
!---------------------------------------------------------------------
! local variables:
!
-! unit io unit number used for namelist file
! ierr error code
! io error status returned from io operation
!
@@ -123,23 +122,8 @@ subroutine longwave_fluxes_init
!---------------------------------------------------------------------
call fms_init
-#ifdef INTERNAL_FILE_NML
read (input_nml_file, nml=longwave_fluxes_nml, iostat=io)
ierr = check_nml_error(io,"longwave_fluxes_nml")
-#else
-!-----------------------------------------------------------------------
-! read namelist.
-!-----------------------------------------------------------------------
- if ( file_exist('input.nml')) then
- unit = open_namelist_file ( )
- ierr=1; do while (ierr /= 0)
- read (unit, nml=longwave_fluxes_nml, iostat=io, end=10)
- ierr = check_nml_error(io,'longwave_fluxes_nml')
- end do
-10 call close_file (unit)
- endif
-#endif
-
!---------------------------------------------------------------------
! write version number and namelist to logfile.
!---------------------------------------------------------------------
diff --git a/atmos_param/radiation/longwave/longwave_params.F90 b/atmos_param/radiation/longwave/longwave_params.F90
index af1ed208..b522d2ba 100644
--- a/atmos_param/radiation/longwave/longwave_params.F90
+++ b/atmos_param/radiation/longwave/longwave_params.F90
@@ -19,11 +19,11 @@ module longwave_params_mod
! shared modules:
use mpp_mod, only: input_nml_file
- use fms_mod, only: open_namelist_file, fms_init, &
+ use fms_mod, only: fms_init, &
mpp_pe, mpp_root_pe, stdlog, &
- file_exist, write_version_number, &
+ write_version_number, &
check_nml_error, error_mesg, &
- FATAL, close_file
+ FATAL
!--------------------------------------------------------------------
@@ -127,12 +127,11 @@ subroutine longwave_params_init
!------------------------------------------------------------------
! local variables:
- integer :: unit, ierr, io, logunit
+ integer :: ierr, io, logunit
!---------------------------------------------------------------------
! local variables:
!
-! unit io unit number used for namelist file
! ierr error code
! io error status returned from io operation
!
@@ -151,20 +150,8 @@ subroutine longwave_params_init
!-----------------------------------------------------------------------
! read namelist.
-#ifdef INTERNAL_FILE_NML
read (input_nml_file, nml=longwave_params_nml, iostat=io)
ierr = check_nml_error(io,"longwave_params_nml")
-#else
-!-----------------------------------------------------------------------
- if ( file_exist('input.nml')) then
- unit = open_namelist_file ( )
- ierr=1; do while (ierr /= 0)
- read (unit, nml=longwave_params_nml, iostat=io, end=10)
- ierr = check_nml_error(io,'longwave_params_nml')
- end do
-10 call close_file (unit)
- endif
-#endif
!---------------------------------------------------------------------
! write version number and namelist to logfile.
diff --git a/atmos_param/radiation/longwave/longwave_tables.F90 b/atmos_param/radiation/longwave/longwave_tables.F90
index 602548f5..f65802d2 100644
--- a/atmos_param/radiation/longwave/longwave_tables.F90
+++ b/atmos_param/radiation/longwave/longwave_tables.F90
@@ -18,11 +18,11 @@ module longwave_tables_mod
! shared modules:
use mpp_mod, only: input_nml_file
-use fms_mod, only: open_namelist_file, fms_init, &
+use fms_mod, only: fms_init, &
mpp_pe, mpp_root_pe, stdlog, &
- file_exist, write_version_number, &
+ write_version_number, &
check_nml_error, error_mesg, &
- FATAL, close_file
+ FATAL
! longwave radiation package modules:
@@ -263,7 +263,7 @@ subroutine longwave_tables_init (NBTRG_in, NBTRGE_in, OFFSET_in, &
! k4
! n4
!---------------------------------------------------------------------
- integer :: unit, ierr, io, logunit
+ integer :: ierr, io, logunit
!---------------------------------------------------------------------
@@ -279,20 +279,9 @@ subroutine longwave_tables_init (NBTRG_in, NBTRGE_in, OFFSET_in, &
!-----------------------------------------------------------------------
! read namelist.
-#ifdef INTERNAL_FILE_NML
read (input_nml_file, nml=longwave_tables_nml, iostat=io)
ierr = check_nml_error(io,"longwave_tables_nml")
-#else
-!-----------------------------------------------------------------------
- if ( file_exist('input.nml')) then
- unit = open_namelist_file ( )
- ierr=1; do while (ierr /= 0)
- read (unit, nml=longwave_tables_nml, iostat=io, end=10)
- ierr = check_nml_error(io,'longwave_tables_nml')
- end do
-10 call close_file (unit)
- endif
-#endif
+
!---------------------------------------------------------------------
! write version number and namelist to logfile.
!---------------------------------------------------------------------
@@ -312,7 +301,7 @@ subroutine longwave_tables_init (NBTRG_in, NBTRGE_in, OFFSET_in, &
!---------------------------------------------------------------------
!
!---------------------------------------------------------------------
- inrad = open_namelist_file ('INPUT/h2ocoeff_ckd_speccombwidebds_hi92')
+ inrad = longwave_open_file ('INPUT/h2ocoeff_ckd_speccombwidebds_hi92')
read (inrad,9000) dum
read (inrad,9000) dum
read (inrad,9000) apwd_c ! ckd capphi coeff for 560-800 band
@@ -336,7 +325,7 @@ subroutine longwave_tables_init (NBTRG_in, NBTRGE_in, OFFSET_in, &
!
!---------------------------------------------------------------------
else if (trim(Sealw99_control%continuum_form) == 'rsb' ) then
- inrad = open_namelist_file ('INPUT/h2ocoeff_rsb_speccombwidebds_hi92')
+ inrad = longwave_open_file ('INPUT/h2ocoeff_rsb_speccombwidebds_hi92')
read (inrad,9000) dum
read (inrad,9000) dum
read (inrad,9000) apwd_n ! rsb capphi coeff for 560-800 band
@@ -366,7 +355,7 @@ subroutine longwave_tables_init (NBTRG_in, NBTRGE_in, OFFSET_in, &
if (trim(Sealw99_control%continuum_form) == 'ckd2.1' .or. &
trim(Sealw99_control%continuum_form) == 'ckd2.4' .or. &
trim(Sealw99_control%continuum_form) == 'mt_ckd2.5') then
- inrad = open_namelist_file ('INPUT/h2ocoeff_ckd_speccombwidebds_hi00')
+ inrad = longwave_open_file ('INPUT/h2ocoeff_ckd_speccombwidebds_hi00')
read (inrad,9000) dum
read (inrad,9000) dum
read (inrad,9000) apwd_c ! ckd capphi coeff for 560-800 band
@@ -390,7 +379,7 @@ subroutine longwave_tables_init (NBTRG_in, NBTRGE_in, OFFSET_in, &
!
!---------------------------------------------------------------------
else if (trim(Sealw99_control%continuum_form) == 'rsb' ) then
- inrad = open_namelist_file ('INPUT/h2ocoeff_rsb_speccombwidebds_hi00')
+ inrad = longwave_open_file ('INPUT/h2ocoeff_rsb_speccombwidebds_hi00')
read (inrad,9000) dum
read (inrad,9000) dum
read (inrad,9000) apwd_n ! rsb capphi coeff for 560-800 band
@@ -416,7 +405,7 @@ subroutine longwave_tables_init (NBTRG_in, NBTRGE_in, OFFSET_in, &
if (trim(Sealw99_control%continuum_form) == 'ckd2.1' .or. &
trim(Sealw99_control%continuum_form) == 'ckd2.4' .or. &
trim(Sealw99_control%continuum_form) == 'mt_ckd2.5') then
- inrad = open_namelist_file ('INPUT/h2o_ckd_widebds_hi12')
+ inrad = longwave_open_file ('INPUT/h2o_ckd_widebds_hi12')
! ckd lo/hi freq for 40 bands (160-560) and 8 wide bands (560-1400)
read (inrad,9000) (bdlocm_c(k),k=1,NBLY_CKD)
read (inrad,9000) (bdhicm_c(k),k=1,NBLY_CKD)
@@ -427,7 +416,7 @@ subroutine longwave_tables_init (NBTRG_in, NBTRGE_in, OFFSET_in, &
apcm_c = 0.0; bpcm_c = 0.0
atpcm_c = 0.0; btpcm_c = 0.0
else if (trim(Sealw99_control%continuum_form) == 'rsb' ) then
- inrad = open_namelist_file ('INPUT/h2o_rsb_widebds_hi12')
+ inrad = longwave_open_file ('INPUT/h2o_rsb_widebds_hi12')
! rsb lo/hi freq for 8 comb bands (160-560) and 8 wide bands (560-1400)
read (inrad,9000) (bdlocm_n(k),k=1,NBLY_RSB)
read (inrad,9000) (bdhicm_n(k),k=1,NBLY_RSB)
@@ -438,7 +427,7 @@ subroutine longwave_tables_init (NBTRG_in, NBTRGE_in, OFFSET_in, &
apcm_n = 0.0; bpcm_n = 0.0
atpcm_n = 0.0; btpcm_n = 0.0
else if (trim(Sealw99_control%continuum_form) == 'bps2.0' ) then
- inrad = open_namelist_file ('INPUT/h2o_BPS_widebds_hi12')
+ inrad = longwave_open_file ('INPUT/h2o_BPS_widebds_hi12')
! ckd lo/hi freq for 40 bands (160-560) and 8 wide bands (560-1400)
read (inrad,9000) (bdlocm_n(k),k=1,NBLY_CKD)
read (inrad,9000) (bdhicm_n(k),k=1,NBLY_CKD)
@@ -451,7 +440,7 @@ subroutine longwave_tables_init (NBTRG_in, NBTRGE_in, OFFSET_in, &
endif
endif
- call close_file (inrad)
+ close (inrad)
!----------------------------------------------------------------------
! set private module variables
@@ -484,16 +473,16 @@ subroutine longwave_tables_init (NBTRG_in, NBTRGE_in, OFFSET_in, &
!---------------------------------------------------------------------
if (NBTRGE > 0) then
if (trim(Sealw99_control%linecatalog_form) == 'hitran_1992') then
- inrad = open_namelist_file ('INPUT/h2o12001400_hi92_data')
+ inrad = longwave_open_file ('INPUT/h2o12001400_hi92_data')
else if(trim(Sealw99_control%linecatalog_form) == 'hitran_2000') then
- inrad = open_namelist_file ('INPUT/h2o12001400_hi00_data')
+ inrad = longwave_open_file ('INPUT/h2o12001400_hi00_data')
else if(trim(Sealw99_control%linecatalog_form) == 'hitran_2012') then
if (trim(Sealw99_control%continuum_form) == 'ckd2.1' .or. &
trim(Sealw99_control%continuum_form) == 'ckd2.4' .or. &
trim(Sealw99_control%continuum_form) == 'mt_ckd2.5' ) then
- inrad = open_namelist_file ('INPUT/bandpar_h2o_ckdsea_12001400_hi12_data')
+ inrad = longwave_open_file ('INPUT/bandpar_h2o_ckdsea_12001400_hi12_data')
else if(trim(Sealw99_control%linecatalog_form) == 'bps2.0') then
- inrad = open_namelist_file ('INPUT/bandpar_h2o_BPS_12001400_hi12_data')
+ inrad = longwave_open_file ('INPUT/bandpar_h2o_BPS_12001400_hi12_data')
endif
endif
@@ -549,7 +538,7 @@ subroutine longwave_tables_init (NBTRG_in, NBTRGE_in, OFFSET_in, &
'NBTRGE is inconsistent with available data', FATAL)
endif
end do
- call close_file(inrad)
+ close(inrad)
endif ! NBTRGE > 0
!----------------------------------------------------------------------
@@ -791,9 +780,9 @@ subroutine idrbtsh2o
! the following roberts continuum coefficients are computed using the
! program (gasbnd) over the 0-3000 cm-1 range with 10 cm-1 bandwidth.
!-----------------------------------------------------------------------
- inrad = open_namelist_file ('INPUT/id2h2orbts')
+ inrad = longwave_open_file ('INPUT/id2h2orbts')
read (inrad, FMT = '(5e14.6)') (betad(k),k=1,NBLW)
- call close_file (inrad)
+ close (inrad)
!---------------------------------------------------------------------
@@ -842,7 +831,7 @@ subroutine id2h2o (filename)
! the 0-3000 cm-1 range, with 10 cm-1 bandwidth. other parameter
! values used in the program are obtained separately.
!-----------------------------------------------------------------------
- inrad = open_namelist_file (filename)
+ inrad = longwave_open_file (filename)
read (inrad,9000) (arndm(k),k=1,NBLW)
read (inrad,9000) (brndm(k),k=1,NBLW)
read (inrad,9000) (dummy(k),k=1,NBLW)
@@ -851,7 +840,7 @@ subroutine id2h2o (filename)
read (inrad,9000) (dummy(k),k=1,NBLW)
read (inrad,9000) (bandlo(k),k=1,NBLW)
read (inrad,9000) (bandhi(k),k=1,NBLW)
- call close_file (inrad)
+ close (inrad)
!--------------------------------------------------------------------
9000 format(5e14.6)
@@ -1563,6 +1552,15 @@ subroutine table (tabsr, tab1, tab2, tab3, tab1w, tab1a, tab2a, tab3a)
end subroutine table
+!> @brief This function is just a wrapper for Fortran's `open`
+!! @return Unique unit number
+function longwave_open_file (filename) result (funit)
+ character(len=*), intent(in), optional :: filename
+ integer :: funit
+
+ open(file=filename, form='formatted',action='read', newunit=funit)
+
+end function longwave_open_file
!####################################################################
diff --git a/atmos_param/radiation/longwave/lw_gases_stdtf.F90 b/atmos_param/radiation/longwave/lw_gases_stdtf.F90
index 4b1eb5bc..06c9bfc3 100644
--- a/atmos_param/radiation/longwave/lw_gases_stdtf.F90
+++ b/atmos_param/radiation/longwave/lw_gases_stdtf.F90
@@ -16,14 +16,12 @@ module lw_gases_stdtf_mod
! shared modules:
use mpp_mod, only: input_nml_file
-use fms_mod, only: open_namelist_file, fms_init, &
+use fms_mod, only: fms_init, &
mpp_pe, mpp_root_pe, stdlog, &
- file_exist, write_version_number, &
+ write_version_number, &
check_nml_error, error_mesg, &
- FATAL, NOTE, close_file, &
- open_direct_file
-use fms_io_mod, only: read_data
-
+ FATAL, NOTE
+use fms2_io_mod, only: FmsNetcdfFile_t, open_file, read_data, close_file, ascii_read
! longwave radiation package modules
use longwave_utilities_mod, only: optical_path_type, &
@@ -390,20 +388,9 @@ subroutine lw_gases_stdtf_init ( pref)
!-----------------------------------------------------------------------
! read namelist.
-#ifdef INTERNAL_FILE_NML
+!-----------------------------------------------------------------------
read (input_nml_file, nml=lw_gases_stdtf_nml, iostat=io)
ierr = check_nml_error(io,"lw_gases_stdtf_nml")
-#else
-!-----------------------------------------------------------------------
- if ( file_exist('input.nml')) then
- unit = open_namelist_file ( )
- ierr=1; do while (ierr /= 0)
- read (unit, nml=lw_gases_stdtf_nml, iostat=io, end=10)
- ierr = check_nml_error(io,'lw_gases_stdtf_nml')
- end do
-10 call close_file (unit)
- endif
-#endif
!---------------------------------------------------------------------
! write version number and namelist to logfile.
@@ -2007,7 +1994,7 @@ subroutine std_lblpressures
!---------------------------------------------------------------------
! local variables
real :: fact15, fact30, dummy
- integer :: unit
+ character(len=:), dimension(:), allocatable :: stdlvls_file !< stdlvls file saved as a string
!---------------------------------------------------------------------
! local variables
@@ -2034,11 +2021,11 @@ subroutine std_lblpressures
pa(k+1)=pa(k)*fact30
enddo
else if (NSTDCO2LVLS .EQ. 496) then
- unit = open_namelist_file ('INPUT/stdlvls')
+ call ascii_read('INPUT/stdlvls', stdlvls_file)
do k=1,496
- read (unit,FMT = '(4E20.10)') pa(k),dummy,dummy,dummy
+ read (stdlvls_file(k),FMT = '(4E20.10)') pa(k),dummy,dummy,dummy
enddo
- call close_file (unit)
+ deallocate(stdlvls_file)
endif
!---------------------------------------------------------------------
@@ -5508,6 +5495,7 @@ subroutine read_lbltfs_old (gas_type, callrctrns, nstd_lo, nstd_hi, nf, &
character(len=80) name_lo
character(len=80) name_hi
character(len=80) filename, ncname
+ type(FmsNetcdfFile_t) :: lw_data_file !< Fms2io fileobj
real, dimension(NSTDCO2LVLS,NSTDCO2LVLS) :: trns_in
@@ -5636,22 +5624,11 @@ subroutine read_lbltfs_old (gas_type, callrctrns, nstd_lo, nstd_hi, nf, &
!-------------------------------------------------------------------
filename = 'INPUT/' // trim(name_hi)
ncname = trim(filename) // '.nc'
- if(file_exist(trim(ncname))) then
- if (mpp_pe() == mpp_root_pe()) call error_mesg ('lw_gases_stdtf_mod', &
- 'Reading NetCDF formatted input data file: ' // ncname, NOTE)
- call read_data(ncname, 'trns_std_nf', trns_std_hi_nf(:,:,1:ntbnd(nf)), no_domain=.true.)
- else
+ if (open_file(lw_data_file, trim(ncname), "read", is_restart = .false.)) then
if (mpp_pe() == mpp_root_pe()) call error_mesg ('lw_gases_stdtf_mod', &
- 'Reading native formatted input data file: ' // filename, NOTE)
- inrad = open_direct_file (file=filename, action='read', &
- recl = NSTDCO2LVLS*NSTDCO2LVLS*8)
- nrec_inhi = 0
- do nt=1,ntbnd(nf)
- nrec_inhi = nrec_inhi + 1
- read (inrad, rec = nrec_inhi) trns_in
- trns_std_hi_nf(:,:,nt) = trns_in(:,:)
- enddo
- call close_file (inrad)
+ 'Reading NetCDF formatted input data file with new io: ' // ncname, NOTE)
+ call read_data(lw_data_file, 'trns_std_nf', trns_std_hi_nf(:,:,1:ntbnd(nf)))
+ call close_file(lw_data_file)
endif
!--------------------------------------------------------------------
@@ -5660,22 +5637,11 @@ subroutine read_lbltfs_old (gas_type, callrctrns, nstd_lo, nstd_hi, nf, &
if (callrctrns) then
filename = 'INPUT/' // trim(name_lo )
ncname = trim(filename) // '.nc'
- if(file_exist(trim(ncname))) then
+ if (open_file(lw_data_file, trim(ncname), "read", is_restart = .false.)) then
if (mpp_pe() == mpp_root_pe()) call error_mesg ('lw_gases_stdtf_mod', &
- 'Reading NetCDF formatted input data file: ' // ncname, NOTE)
- call read_data(ncname, 'trns_std_nf', trns_std_lo_nf(:,:,1:ntbnd(nf)), no_domain=.true.)
- else
- if (mpp_pe() == mpp_root_pe()) call error_mesg ('lw_gases_stdtf_mod', &
- 'Reading native formatted input data file: ' // filename, NOTE)
- inrad = open_direct_file (file=filename, action='read', &
- recl = NSTDCO2LVLS*NSTDCO2LVLS*8)
- nrec_inlo = 0
- do nt=1,ntbnd(nf)
- nrec_inlo = nrec_inlo + 1
- read (inrad, rec = nrec_inlo) trns_in
- trns_std_lo_nf(:,:,nt) = trns_in(:,:)
- enddo
- call close_file (inrad)
+ 'Reading NetCDF formatted input data file with new io: ' // ncname, NOTE)
+ call read_data(lw_data_file, 'trns_std_nf', trns_std_lo_nf(:,:,1:ntbnd(nf)))
+ call close_file(lw_data_file)
endif
endif
@@ -5729,6 +5695,7 @@ subroutine read_lbltfs (gas_type, callrctrns, nstd_lo, nstd_hi, nf, &
character(len=80) name_lo
character(len=80) name_hi
character(len=80) filename, ncname
+ type(FmsNetcdfFile_t) :: lw_data_file
real, dimension(NSTDCO2LVLS,NSTDCO2LVLS) :: trns_in
@@ -5859,22 +5826,11 @@ subroutine read_lbltfs (gas_type, callrctrns, nstd_lo, nstd_hi, nf, &
!-------------------------------------------------------------------
filename = 'INPUT/' // trim(name_hi)
ncname = trim(filename) // '.nc'
- if(file_exist(trim(ncname))) then
- if (mpp_pe() == mpp_root_pe()) call error_mesg ('lw_gases_stdtf_mod', &
- 'Reading NetCDF formatted input data file: ' // ncname, NOTE)
- call read_data(ncname, 'trns_std_nf', trns_std_hi_nf(:,:,1:ntbnd(nf)), no_domain=.true.)
- else
+ if (open_file(lw_data_file, trim(ncname), "read", is_restart = .false.)) then
if (mpp_pe() == mpp_root_pe()) call error_mesg ('lw_gases_stdtf_mod', &
- 'Reading native formatted input data file: ' // filename, NOTE)
- inrad = open_direct_file (file=filename, action='read', &
- recl = NSTDCO2LVLS*NSTDCO2LVLS*8)
- nrec_inhi = 0
- do nt=1,ntbnd(nf)
- nrec_inhi = nrec_inhi + 1
- read (inrad, rec = nrec_inhi) trns_in
- trns_std_hi_nf(:,:,nt) = trns_in(:,:)
- enddo
- call close_file (inrad)
+ 'Reading NetCDF formatted input data file with new io: ' // ncname, NOTE)
+ call read_data(lw_data_file, 'trns_std_nf', trns_std_hi_nf(:,:,1:ntbnd(nf)))
+ call close_file(lw_data_file)
endif
!--------------------------------------------------------------------
@@ -5883,22 +5839,11 @@ subroutine read_lbltfs (gas_type, callrctrns, nstd_lo, nstd_hi, nf, &
if (callrctrns) then
filename = 'INPUT/' // trim(name_lo )
ncname = trim(filename) // '.nc'
- if(file_exist(trim(ncname))) then
- if (mpp_pe() == mpp_root_pe()) call error_mesg ('lw_gases_stdtf_mod', &
- 'Reading NetCDF formatted input data file: ' // ncname, NOTE)
- call read_data(ncname, 'trns_std_nf', trns_std_lo_nf(:,:,1:ntbnd(nf)), no_domain=.true.)
- else
+ if (open_file(lw_data_file, trim(ncname), "read", is_restart = .false.)) then
if (mpp_pe() == mpp_root_pe()) call error_mesg ('lw_gases_stdtf_mod', &
- 'Reading native formatted input data file: ' // filename, NOTE)
- inrad = open_direct_file (file=filename, action='read', &
- recl = NSTDCO2LVLS*NSTDCO2LVLS*8)
- nrec_inlo = 0
- do nt=1,ntbnd(nf)
- nrec_inlo = nrec_inlo + 1
- read (inrad, rec = nrec_inlo) trns_in
- trns_std_lo_nf(:,:,nt) = trns_in(:,:)
- enddo
- call close_file (inrad)
+ 'Reading NetCDF formatted input data file with new io: ' // ncname, NOTE)
+ call read_data(lw_data_file, 'trns_std_nf', trns_std_lo_nf(:,:,1:ntbnd(nf)))
+ call close_file(lw_data_file)
endif
endif
diff --git a/atmos_param/radiation/longwave/optical_path.F90 b/atmos_param/radiation/longwave/optical_path.F90
index 5a641525..1400d7e7 100644
--- a/atmos_param/radiation/longwave/optical_path.F90
+++ b/atmos_param/radiation/longwave/optical_path.F90
@@ -17,11 +17,11 @@ module optical_path_mod
! shared modules:
use mpp_mod, only: input_nml_file
-use fms_mod, only: open_namelist_file, fms_init, &
+use fms_mod, only: fms_init, &
mpp_pe, mpp_root_pe, stdlog, &
- file_exist, write_version_number, &
+ write_version_number, &
check_nml_error, error_mesg, &
- FATAL, close_file
+ FATAL
use constants_mod, only: RDGAS, RVGAS, GRAV, wtmair, &
avogno, pstd, diffac, tfreeze, &
constants_init
@@ -287,7 +287,7 @@ subroutine optical_path_init(pref, nbtrge_in)
ap_12001400, bp_12001400, &
atp_12001400, btp_12001400, &
fbdlo_12001400, fbdhi_12001400
- integer :: unit, ierr, io, logunit
+ integer :: ierr, io, logunit
integer :: inrad, k, m
integer :: subb
@@ -342,24 +342,12 @@ subroutine optical_path_init(pref, nbtrge_in)
call constants_init
call lw_gases_stdtf_init(pref)
-#ifdef INTERNAL_FILE_NML
- read (input_nml_file, nml=optical_path_nml, iostat=io)
- ierr = check_nml_error(io,"optical_path_nml")
-#else
!-----------------------------------------------------------------------
! read namelist.
-!-----------------------------------------------------------------------
- if ( file_exist('input.nml')) then
- unit = open_namelist_file ( )
- ierr=1; do while (ierr /= 0)
- read (unit, nml=optical_path_nml, iostat=io, end=10)
- ierr = check_nml_error(io,'optical_path_nml')
- end do
-10 call close_file (unit)
- endif
-#endif
-
!---------------------------------------------------------------------
+ read (input_nml_file, nml=optical_path_nml, iostat=io)
+ ierr = check_nml_error(io,"optical_path_nml")
+
! write version number and namelist to logfile.
!---------------------------------------------------------------------
call write_version_number (version, tagname)
@@ -383,11 +371,11 @@ subroutine optical_path_init(pref, nbtrge_in)
if (trim(Sealw99_control%linecatalog_form) == 'hitran_1992' ) then
if (trim(Sealw99_control%continuum_form) == 'ckd2.1' .or. &
trim(Sealw99_control%continuum_form) == 'ckd2.4' ) then
- inrad = open_namelist_file('INPUT/h2ocoeff_ckd_speccombwidebds_hi92')
+ inrad = optical_path_open_file('INPUT/h2ocoeff_ckd_speccombwidebds_hi92')
read (inrad,9000) awide_c ! ckd rndm coeff for 560-800 band
read (inrad,9000) bwide_c ! ckd rndm coeff for 560-800 band
else if (trim(Sealw99_control%continuum_form) == 'rsb' ) then
- inrad = open_namelist_file('INPUT/h2ocoeff_rsb_speccombwidebds_hi92')
+ inrad = optical_path_open_file('INPUT/h2ocoeff_rsb_speccombwidebds_hi92')
read (inrad,9000) awide_n ! rsb rndm coeff for 560-800 band
read (inrad,9000) bwide_n ! rsb rndm coeff for 560-800 band
read (inrad,9000) dum
@@ -411,11 +399,11 @@ subroutine optical_path_init(pref, nbtrge_in)
else if (trim(Sealw99_control%linecatalog_form) == 'hitran_2000' ) then
if (trim(Sealw99_control%continuum_form) == 'ckd2.1' .or. &
trim(Sealw99_control%continuum_form) == 'ckd2.4' ) then
- inrad = open_namelist_file('INPUT/h2ocoeff_ckd_speccombwidebds_hi00')
+ inrad = optical_path_open_file('INPUT/h2ocoeff_ckd_speccombwidebds_hi00')
read (inrad,9000) awide_c ! ckd rndm coeff for 560-800 band
read (inrad,9000) bwide_c ! ckd rndm coeff for 560-800 band
else if (trim(Sealw99_control%continuum_form) == 'rsb' ) then
- inrad = open_namelist_file('INPUT/h2ocoeff_rsb_speccombwidebds_hi00')
+ inrad = optical_path_open_file('INPUT/h2ocoeff_rsb_speccombwidebds_hi00')
read (inrad,9000) awide_n ! rsb rndm coeff for 560-800 band
read (inrad,9000) bwide_n ! rsb rndm coeff for 560-800 band
read (inrad,9000) dum
@@ -441,11 +429,11 @@ subroutine optical_path_init(pref, nbtrge_in)
trim(Sealw99_control%continuum_form) == 'ckd2.4' .or. &
trim(Sealw99_control%continuum_form) == 'mt_ckd2.5' ) then
! ckd rndm coeff for 560-800 band
- inrad = open_namelist_file('INPUT/bandpar_h2o_ckd_560800')
+ inrad = optical_path_open_file('INPUT/bandpar_h2o_ckd_560800')
read (inrad,9000) awide_c ! ckd rndm coeff for 560-800 band
read (inrad,9000) bwide_c ! ckd rndm coeff for 560-800 band
else if (trim(Sealw99_control%continuum_form) == 'rsb' ) then
- inrad = open_namelist_file('INPUT/h2ocoeff_rsb_speccombwidebds_hi00')
+ inrad = optical_path_open_file('INPUT/h2ocoeff_rsb_speccombwidebds_hi00')
read (inrad,9000) awide_n ! rsb rndm coeff for 560-800 band
read (inrad,9000) bwide_n ! rsb rndm coeff for 560-800 band
read (inrad,9000) dum
@@ -468,7 +456,7 @@ subroutine optical_path_init(pref, nbtrge_in)
endif
endif
9000 format(5e14.6)
- call close_file (inrad)
+ close (inrad)
!---------------------------------------------------------------------
!
@@ -491,11 +479,11 @@ subroutine optical_path_init(pref, nbtrge_in)
ab15wd = awide*bwide
if (trim(Sealw99_control%linecatalog_form) == 'hitran_1992') then
- inrad = open_namelist_file('INPUT/o39001200_hi92_data')
+ inrad = optical_path_open_file('INPUT/o39001200_hi92_data')
else if (trim(Sealw99_control%linecatalog_form) == 'hitran_2000') then
- inrad = open_namelist_file('INPUT/o39001200_hi00_data')
+ inrad = optical_path_open_file('INPUT/o39001200_hi00_data')
else if (trim(Sealw99_control%linecatalog_form) == 'hitran_2012') then
- inrad = open_namelist_file('INPUT/o39001200_hi12_data')
+ inrad = optical_path_open_file('INPUT/o39001200_hi12_data')
endif
read (inrad,fmt='(3e14.6)') (ao3rnd(k),k=1,3)
read (inrad,fmt='(3e14.6)') (bo3rnd(k),k=1,3)
@@ -504,13 +492,13 @@ subroutine optical_path_init(pref, nbtrge_in)
if (NBTRGE > 0) then
allocate ( csfah2o(2, NBTRGE) )
if (trim(Sealw99_control%linecatalog_form) == 'hitran_1992') then
- inrad = open_namelist_file('INPUT/h2o12001400_hi92_data')
+ inrad = optical_path_open_file('INPUT/h2o12001400_hi92_data')
else if (trim(Sealw99_control%linecatalog_form) == &
'hitran_2000') then
- inrad = open_namelist_file('INPUT/h2o12001400_hi00_data')
+ inrad = optical_path_open_file('INPUT/h2o12001400_hi00_data')
else if (trim(Sealw99_control%linecatalog_form) == &
'hitran_2012') then
- inrad = open_namelist_file('INPUT/bandpar_h2o_ckdsea_12001400_hi12_data')
+ inrad = optical_path_open_file('INPUT/bandpar_h2o_ckdsea_12001400_hi12_data')
endif
!----------------------------------------------------------------------
@@ -561,7 +549,7 @@ subroutine optical_path_init(pref, nbtrge_in)
endif
end do
2001 format(5e14.6)
- call close_file(inrad)
+ close(inrad)
endif
!------------------------------------------------------------------
@@ -2420,7 +2408,7 @@ subroutine optical_ckd_init
!-------------------------------------------------------------------
if (trim(Sealw99_control%continuum_form) == 'ckd2.1' .or. &
trim(Sealw99_control%continuum_form) == 'ckd2.4') then
- inrad = open_namelist_file ('INPUT/h2ockd2.1_data')
+ inrad = optical_path_open_file ('INPUT/h2ockd2.1_data')
read (inrad,fmt='(3f12.1,i8)') v1sh2o_296, v2sh2o_296, dvsh2o_296, &
nptsh2o_296
read (inrad,fmt='(5e14.5)') (ssh2o_296(k),k=1,2000)
@@ -2432,7 +2420,7 @@ subroutine optical_ckd_init
9001 format (3f12.1,i8)
9002 format (5e14.5)
- call close_file (inrad)
+ close (inrad)
!--------------------------------------------------------------------
! read h2o (mt_ckd2.5) data
@@ -2440,7 +2428,7 @@ subroutine optical_ckd_init
! no need for correction factors
!-------------------------------------------------------------------
else if (trim(Sealw99_control%continuum_form) == 'mt_ckd2.5') then
- inrad = open_namelist_file ('INPUT/h2omt_ckd2.5_data')
+ inrad = optical_path_open_file ('INPUT/h2omt_ckd2.5_data')
read (inrad,fmt='(3f12.1,i8)') v1sh2o_296, v2sh2o_296, dvsh2o_296, &
nptsh2o_296
read (inrad,fmt='(5e14.5)') (ssh2o_296(k),k=1,2000)
@@ -2450,7 +2438,7 @@ subroutine optical_ckd_init
read (inrad,fmt='(3f12.1,i8)') v1fh2o, v2fh2o, dvfh2o, nptfh2o
read (inrad,fmt='(5e14.5)') (sfh2o(k),k=1,2000)
- call close_file(inrad)
+ close(inrad)
endif
@@ -2460,9 +2448,9 @@ subroutine optical_ckd_init
if (trim(Sealw99_control%continuum_form) == 'ckd2.1' .or. &
trim(Sealw99_control%continuum_form) == 'ckd2.4') then
if (trim(Sealw99_control%continuum_form) == 'ckd2.1') then
- inrad = open_namelist_file ('INPUT/h2ockd2.1_corrdata')
+ inrad = optical_path_open_file ('INPUT/h2ockd2.1_corrdata')
else if (trim(Sealw99_control%continuum_form) == 'ckd2.4') then
- inrad = open_namelist_file ('INPUT/h2ockd2.4_corrdata')
+ inrad = optical_path_open_file ('INPUT/h2ockd2.4_corrdata')
endif
read (inrad,9007) (sfac(k),k=1,2000)
read (inrad,9007) (fscal(k),k=1,2000)
@@ -2470,16 +2458,16 @@ subroutine optical_ckd_init
endif
9007 format (5e13.6)
- call close_file (inrad)
+ close (inrad)
!--------------------------------------------------------------------
! read radfn data
!--------------------------------------------------------------------
- inrad = open_namelist_file ('INPUT/radfn_5-2995_100-490k')
+ inrad = optical_path_open_file ('INPUT/radfn_5-2995_100-490k')
read (inrad,9000) ((radfunc%vae(k,j),radfunc%td(k,j),k=1,40), &
j=1,300)
9000 format (8f14.6)
- call close_file (inrad)
+ close (inrad)
!---------------------------------------------------------------------
do k=1,40
@@ -3463,6 +3451,15 @@ end subroutine cfc_optical_depth
!#####################################################################
+!> @brief This function is just a wrapper for Fortran's `open`
+!! @return Unique unit number
+function optical_path_open_file (filename) result (funit)
+ character(len=*), intent(in), optional :: filename
+ integer :: funit
+
+ open(file=filename, form='formatted',action='read', newunit=funit)
+
+end function optical_path_open_file
end module optical_path_mod
diff --git a/atmos_param/radiation/longwave/sealw99.F90 b/atmos_param/radiation/longwave/sealw99.F90
index 5f32c10d..e383b241 100644
--- a/atmos_param/radiation/longwave/sealw99.F90
+++ b/atmos_param/radiation/longwave/sealw99.F90
@@ -18,11 +18,11 @@ module sealw99_mod
! shared modules:
use mpp_mod, only: input_nml_file
-use fms_mod, only: open_namelist_file, fms_init, &
+use fms_mod, only: fms_init, &
mpp_pe, mpp_root_pe, stdlog, &
- file_exist, write_version_number, &
+ write_version_number, &
check_nml_error, error_mesg, &
- FATAL, NOTE, close_file
+ FATAL, NOTE
use constants_mod, only: constants_init, diffac, radcon_mks, &
SECONDS_PER_DAY, radcon
@@ -325,7 +325,7 @@ subroutine sealw99_init (pref, do_h2o, do_o3, do_ch4, &
real, dimension (NBCO215) :: cent, del
real :: cent990, del990, cent900, del900, cent1070, del1070
- integer :: unit, ierr, io, k, n, nn, logunit
+ integer :: ierr, io, k, n, nn, logunit
integer :: ioffset
real :: prnlte
integer :: kmax, kmin
@@ -385,20 +385,9 @@ subroutine sealw99_init (pref, do_h2o, do_o3, do_ch4, &
!-----------------------------------------------------------------------
! read namelist.
-#ifdef INTERNAL_FILE_NML
read (input_nml_file, nml=sealw99_nml, iostat=io)
ierr = check_nml_error(io,"sealw99_nml")
-#else
!-----------------------------------------------------------------------
- if ( file_exist('input.nml')) then
- unit = open_namelist_file ( )
- ierr=1; do while (ierr /= 0)
- read (unit, nml=sealw99_nml, iostat=io, end=10)
- ierr = check_nml_error(io,'sealw99_nml')
- end do
-10 call close_file (unit)
- endif
-#endif
!---------------------------------------------------------------------
! write version number and namelist to logfile.
@@ -489,7 +478,7 @@ subroutine sealw99_init (pref, do_h2o, do_o3, do_ch4, &
if (trim(Sealw99_control%linecatalog_form) == 'hitran_1992' ) then
if (trim(Sealw99_control%continuum_form) == 'ckd2.1' .or. &
trim(Sealw99_control%continuum_form) == 'ckd2.4' ) then
- inrad = open_namelist_file ('INPUT/h2ocoeff_ckd_speccombwidebds_hi92')
+ inrad = seal_open_file ('INPUT/h2ocoeff_ckd_speccombwidebds_hi92')
read (inrad,9000) dum
read (inrad,9000) dum
read (inrad,9000) dum ! ckd capphi coeff for 560-800 band
@@ -506,7 +495,7 @@ subroutine sealw99_init (pref, do_h2o, do_o3, do_ch4, &
read (inrad,9000) (atpcm_c(k),k=1,NBLY_CKD)
read (inrad,9000) (btpcm_c(k),k=1,NBLY_CKD)
else if (trim(Sealw99_control%continuum_form) == 'rsb' ) then
- inrad = open_namelist_file ('INPUT/h2ocoeff_rsb_speccombwidebds_hi92')
+ inrad = seal_open_file ('INPUT/h2ocoeff_rsb_speccombwidebds_hi92')
read (inrad,9000) dum
read (inrad,9000) dum
read (inrad,9000) dum ! rsb capphi coeff for 560-800 band
@@ -527,7 +516,7 @@ subroutine sealw99_init (pref, do_h2o, do_o3, do_ch4, &
else if (trim(Sealw99_control%linecatalog_form) == 'hitran_2000' ) then
if (trim(Sealw99_control%continuum_form) == 'ckd2.1' .or. &
trim(Sealw99_control%continuum_form) == 'ckd2.4' ) then
- inrad = open_namelist_file ('INPUT/h2ocoeff_ckd_speccombwidebds_hi00')
+ inrad = seal_open_file ('INPUT/h2ocoeff_ckd_speccombwidebds_hi00')
read (inrad,9000) dum
read (inrad,9000) dum
read (inrad,9000) dum ! ckd capphi coeff for 560-800 band
@@ -544,7 +533,7 @@ subroutine sealw99_init (pref, do_h2o, do_o3, do_ch4, &
read (inrad,9000) (atpcm_c(k),k=1,NBLY_CKD)
read (inrad,9000) (btpcm_c(k),k=1,NBLY_CKD)
else if (trim(Sealw99_control%continuum_form) == 'rsb' ) then
- inrad = open_namelist_file ('INPUT/h2ocoeff_rsb_speccombwidebds_hi00')
+ inrad = seal_open_file ('INPUT/h2ocoeff_rsb_speccombwidebds_hi00')
read (inrad,9000) dum
read (inrad,9000) dum
read (inrad,9000) dum ! rsb capphi coeff for 560-800 band
@@ -566,7 +555,7 @@ subroutine sealw99_init (pref, do_h2o, do_o3, do_ch4, &
if (trim(Sealw99_control%continuum_form) == 'ckd2.1' .or. &
trim(Sealw99_control%continuum_form) == 'ckd2.4' .or. &
trim(Sealw99_control%continuum_form) == 'mt_ckd2.5' ) then
- inrad = open_namelist_file ('INPUT/h2ocoeff_ckdsea_speccombwidebds_hi12')
+ inrad = seal_open_file ('INPUT/h2ocoeff_ckdsea_speccombwidebds_hi12')
! ckd rndm coeff for 40 bands (160-560) and 8 wide bands (560-1400)
read (inrad,9000) (acomb_c(k),k=1,NBLY_CKD)
read (inrad,9000) (bcomb_c(k),k=1,NBLY_CKD)
@@ -575,7 +564,7 @@ subroutine sealw99_init (pref, do_h2o, do_o3, do_ch4, &
read (inrad,9000) (atpcm_c(k),k=1,NBLY_CKD)
read (inrad,9000) (btpcm_c(k),k=1,NBLY_CKD)
else if (trim(Sealw99_control%continuum_form) == 'rsb' ) then
- inrad = open_namelist_file ('INPUT/h2ocoeff_rsb_speccombwidebds_hi00')
+ inrad = seal_open_file ('INPUT/h2ocoeff_rsb_speccombwidebds_hi00')
! rsb rndm coeff for 8 comb bands (160-560) and 8 wide bands (560-1400)
read (inrad,9000) (acomb_n(k),k=1,NBLY_RSB)
read (inrad,9000) (bcomb_n(k),k=1,NBLY_RSB)
@@ -584,7 +573,7 @@ subroutine sealw99_init (pref, do_h2o, do_o3, do_ch4, &
read (inrad,9000) (atpcm_n(k),k=1,NBLY_RSB)
read (inrad,9000) (btpcm_n(k),k=1,NBLY_RSB)
else if (trim(Sealw99_control%continuum_form) == 'bps2.0' ) then
- inrad = open_namelist_file ('INPUT/h2ocoeff_BPS_speccombwidebds_hi12')
+ inrad = seal_open_file ('INPUT/h2ocoeff_BPS_speccombwidebds_hi12')
! BPS rndm coeff for 40 bands (160-560) and 8 wide bands (560-1400)
read (inrad,9000) (acomb_c(k),k=1,NBLY_CKD)
read (inrad,9000) (bcomb_c(k),k=1,NBLY_CKD)
@@ -595,7 +584,7 @@ subroutine sealw99_init (pref, do_h2o, do_o3, do_ch4, &
endif
endif
9000 format (5e14.6)
- call close_file (inrad)
+ close(inrad)
!---------------------------------------------------------------------
!
@@ -7258,7 +7247,15 @@ subroutine sealw99_get_tables (Lw_tables_ptr)
end subroutine sealw99_get_tables
!####################################################################
+!> @brief This function is just a wrapper for Fortran's `open`
+!! @return Unique unit number
+function seal_open_file (filename) result (funit)
+ character(len=*), intent(in), optional :: filename
+ integer :: funit
+
+ open(file=filename, form='formatted',action='read', newunit=funit)
+end function seal_open_file
end module sealw99_mod
diff --git a/atmos_param/radiation/radiative_gases/ozone.F90 b/atmos_param/radiation/radiative_gases/ozone.F90
index 455a8daa..4d00e6aa 100644
--- a/atmos_param/radiation/radiative_gases/ozone.F90
+++ b/atmos_param/radiation/radiative_gases/ozone.F90
@@ -19,12 +19,11 @@ module ozone_mod
! shared modules:
use mpp_mod, only: input_nml_file
-use fms_mod, only: open_namelist_file, file_exist, &
- check_nml_error, error_mesg, &
+use fms_mod, only: check_nml_error, error_mesg, &
fms_init, stdlog, &
write_version_number, FATAL, NOTE, &
- WARNING, mpp_pe, mpp_root_pe, close_file
-use fms_io_mod, only: read_data
+ WARNING, mpp_pe, mpp_root_pe
+use fms2_io_mod, only: FmsNetcdfFile_t, open_file, read_data, close_file, file_exists
use time_manager_mod, only: time_type, &
time_manager_init, operator(+), &
set_date, operator(-), print_date, &
@@ -284,13 +283,12 @@ subroutine ozone_init (latb, lonb)
!-----------------------------------------------------------------
! local variables:
- integer :: unit, ierr, io, logunit
+ integer :: ierr, io, logunit
integer :: n, no3
!---------------------------------------------------------------------
! local variables:
!
-! unit io unit number
! ierr error code
! io error status returned from io operation
!
@@ -312,22 +310,11 @@ subroutine ozone_init (latb, lonb)
call time_interp_init
call constants_init
-#ifdef INTERNAL_FILE_NML
- read (input_nml_file, nml=ozone_nml, iostat=io)
- ierr = check_nml_error(io,"ozone_nml")
-#else
!-----------------------------------------------------------------------
! read namelist.
!-----------------------------------------------------------------------
- if ( file_exist('input.nml')) then
- unit = open_namelist_file ( )
- ierr=1; do while (ierr /= 0)
- read (unit, nml=ozone_nml, iostat=io, end=10)
- ierr = check_nml_error(io, 'ozone_nml')
- end do
-10 call close_file (unit)
- endif
-#endif
+ read (input_nml_file, nml=ozone_nml, iostat=io)
+ ierr = check_nml_error(io,"ozone_nml")
!---------------------------------------------------------------------
! write version number and namelist to logfile.
@@ -890,7 +877,7 @@ subroutine obtain_input_file_data
! determine if a netcdf input data file exists. if so, read the
! number of data records in the file.
!---------------------------------------------------------------------
- if (file_exist ( 'INPUT/id1o3.nc') ) then
+ if (file_exists ( 'INPUT/id1o3.nc') ) then
ncid = ncopn ('INPUT/id1o3.nc', 0, rcode)
call ncinq (ncid, ndims, nvars, ngatts, recdim, rcode)
do i=1,ndims
@@ -919,8 +906,8 @@ subroutine obtain_input_file_data
! determine if the input data input file exists in ascii format.
! if so, read the number of data records in the file.
!---------------------------------------------------------------------
- else if (file_exist ( 'INPUT/id1o3') ) then
- iounit = open_namelist_file ('INPUT/id1o3')
+ else if (file_exists ( 'INPUT/id1o3') ) then
+ open(file='INPUT/id1o3', form='formatted',action='read', newunit=iounit)
read (iounit,FMT = '(i4)') kmax_file
!-------------------------------------------------------------------
@@ -929,7 +916,7 @@ subroutine obtain_input_file_data
!---------------------------------------------------------------------
allocate (qqo3(kmax_file) )
read (iounit,FMT = '(5e18.10)') (qqo3(k),k=1,kmax_file)
- call close_file (iounit)
+ close(iounit)
!---------------------------------------------------------------------
! if file is not present, write an error message.
@@ -1007,7 +994,7 @@ subroutine obtain_gfdl_zonal_ozone_data (season)
character(len=48) :: err_string
integer :: iounit
integer :: j, k, kk, n
-
+ type(FmsNetcdfFile_t) :: ozone_data_file !< Fms2io fileobj
!-----------------------------------------------------------------------
! local variables:
!
@@ -1066,16 +1053,17 @@ subroutine obtain_gfdl_zonal_ozone_data (season)
! open the file and read the data set. close the file upon
! completion. if it is not present, write an error message.
!---------------------------------------------------------------------
- if (file_exist ( 'INPUT/zonal_ozone_data.nc')) then
+ if (open_file(ozone_data_file, 'INPUT/zonal_ozone_data.nc' , "read", is_restart = .false.)) then
if(mpp_pe() == mpp_root_pe()) &
call error_mesg('ozone_mod','Reading netCDF input data: zonal_ozone_data.nc',NOTE)
- call read_data('INPUT/zonal_ozone_data.nc', 'ph3', ph3, no_domain=.true.)
- call read_data('INPUT/zonal_ozone_data.nc', 'o3hi', o3hi, no_domain=.true.)
- call read_data('INPUT/zonal_ozone_data.nc', 'o3lo1', o3lo1, no_domain=.true.)
- call read_data('INPUT/zonal_ozone_data.nc', 'o3lo2', o3lo2, no_domain=.true.)
- call read_data('INPUT/zonal_ozone_data.nc', 'o3lo3', o3lo3, no_domain=.true.)
- call read_data('INPUT/zonal_ozone_data.nc', 'o3lo4', o3lo4, no_domain=.true.)
- else if (file_exist ( 'INPUT/zonal_ozone_data') ) then
+ call read_data(ozone_data_file, 'ph3', ph3)
+ call read_data(ozone_data_file, 'o3hi', o3hi)
+ call read_data(ozone_data_file, 'o3lo1', o3lo1)
+ call read_data(ozone_data_file, 'o3lo2', o3lo2)
+ call read_data(ozone_data_file, 'o3lo3', o3lo3)
+ call read_data(ozone_data_file, 'o3lo4', o3lo4)
+ call close_file(ozone_data_file)
+ else if (file_exists ( 'INPUT/zonal_ozone_data') ) then
call error_mesg('ozone_mod','Reading native input data zonal_ozone_data no longer supported',FATAL)
else
call error_mesg ( 'ozone_mod', &
diff --git a/atmos_param/radiation/radiative_gases/radiative_gases.F90 b/atmos_param/radiation/radiative_gases/radiative_gases.F90
index 84e040dc..fd89fb8a 100644
--- a/atmos_param/radiation/radiative_gases/radiative_gases.F90
+++ b/atmos_param/radiation/radiative_gases/radiative_gases.F90
@@ -30,16 +30,18 @@ module radiative_gases_mod
days_in_year, get_time, length_of_year, &
assignment(=)
use diag_manager_mod, only: diag_manager_init, get_base_time
-use mpp_mod, only: input_nml_file
-use fms_mod, only: open_namelist_file, fms_init, &
- mpp_pe, mpp_root_pe, stdlog, &
- file_exist, write_version_number, &
+use mpp_mod, only: input_nml_file, mpp_get_current_pelist
+use fms_mod, only: fms_init, &
+ mpp_pe, mpp_root_pe, mpp_npes, stdlog, &
+ write_version_number, &
check_nml_error, error_mesg, &
- FATAL, WARNING, NOTE, close_file, &
- open_restart_file, read_data
-use fms_io_mod, only: get_restart_io_mode, &
- register_restart_field, restart_file_type, &
- save_restart, restore_state, query_initialized
+ FATAL, WARNING, NOTE
+use fms2_io_mod, only: FmsNetcdfFile_t, FmsNetcdfDomainFile_t, &
+ register_restart_field, register_axis, unlimited, &
+ open_file, read_restart, write_restart, close_file, &
+ register_field, write_data, register_variable_attribute, &
+ file_exists
+
use time_interp_mod, only: time_interp_init, time_interp
use tracer_manager_mod, only: get_tracer_index, NO_TRACER
use field_manager_mod, only: MODEL_ATMOS
@@ -93,10 +95,7 @@ module radiative_gases_mod
! called from radiative_gases_time_vary:
define_gas_amount, &
- obtain_gas_tfs, &
-
-! called from radiative_gases_end:
- write_restart_radiative_gases
+ obtain_gas_tfs
!---------------------------------------------------------------------
!-------- namelist ---------
@@ -416,7 +415,6 @@ module radiative_gases_mod
!------- private data ------
!--- for netcdf restart
-type(restart_file_type), save :: Rad_restart
logical :: do_netcdf_restart= .true.
integer :: vers ! version number of restart file
!---------------------------------------------------------------------
@@ -613,7 +611,6 @@ subroutine radiative_gases_init (lw_rad_time_step, pref, latb, lonb)
!---------------------------------------------------------------------
! radiative_gases_init is the constructor for radiative_gases_mod.
!---------------------------------------------------------------------
-
integer, intent(in) :: lw_rad_time_step
real, dimension(:,:), intent(in) :: pref
real, dimension(:,:), intent(in) :: latb, lonb
@@ -640,7 +637,8 @@ subroutine radiative_gases_init (lw_rad_time_step, pref, latb, lonb)
character(len=32) :: restart_file
integer :: id_restart
integer :: logunit ! unit number for writing to logfile.
-
+ type(FmsNetcdfFile_t) :: Rad_restart !< Fms2io fileobj
+ integer, allocatable, dimension(:) :: pes !< Array of pes in the current pelist
!---------------------------------------------------------------------
! if routine has already been executed, exit.
!---------------------------------------------------------------------
@@ -658,20 +656,10 @@ subroutine radiative_gases_init (lw_rad_time_step, pref, latb, lonb)
!-----------------------------------------------------------------------
! read namelist.
!-----------------------------------------------------------------------
-#ifdef INTERNAL_FILE_NML
read (input_nml_file, nml=radiative_gases_nml, iostat=io)
ierr = check_nml_error(io,'radiative_gases_nml')
-#else
- if ( file_exist('input.nml')) then
- unit = open_namelist_file ( )
- ierr=1; do while (ierr /= 0)
- read (unit, nml=radiative_gases_nml, iostat=io, end=10)
- ierr = check_nml_error(io,'radiative_gases_nml')
- end do
-10 call close_file (unit)
- endif
-#endif
- call get_restart_io_mode(do_netcdf_restart)
+
+ do_netcdf_restart = .true.
!---------------------------------------------------------------------
@@ -768,48 +756,38 @@ subroutine radiative_gases_init (lw_rad_time_step, pref, latb, lonb)
! if present, read the radiative gases restart file. set a flag
! indicating the presence of the file.
!---------------------------------------------------------------------
- restart_file = 'radiative_gases.res.nc'
- if(do_netcdf_restart) then
- id_restart = register_restart_field(Rad_restart, restart_file, 'vers', vers, no_domain = .true. )
- id_restart = register_restart_field(Rad_restart, restart_file, 'rco2', rco2, no_domain = .true. )
- id_restart = register_restart_field(Rad_restart, restart_file, 'rf11', rf11, no_domain = .true. )
- id_restart = register_restart_field(Rad_restart, restart_file, 'rf12', rf12, no_domain = .true. )
- id_restart = register_restart_field(Rad_restart, restart_file, 'rf113', rf113, no_domain = .true. )
- id_restart = register_restart_field(Rad_restart, restart_file, 'rf22', rf22, no_domain = .true. )
- id_restart = register_restart_field(Rad_restart, restart_file, 'rch4', rch4, no_domain = .true. )
- id_restart = register_restart_field(Rad_restart, restart_file, 'rn2o', rn2o, no_domain = .true. )
- id_restart = register_restart_field(Rad_restart, restart_file, 'co2_for_last_tf_calc', &
- co2_for_last_tf_calc, mandatory=.false., no_domain = .true. )
- id_restart = register_restart_field(Rad_restart, restart_file, 'ch4_for_last_tf_calc', &
- ch4_for_last_tf_calc, mandatory=.false., no_domain = .true. )
- id_restart = register_restart_field(Rad_restart, restart_file, 'n2o_for_last_tf_calc', &
- n2o_for_last_tf_calc, mandatory=.false., no_domain = .true. )
- endif
+ !< Get the current pelist
+ allocate(pes(mpp_npes()))
+ call mpp_get_current_pelist(pes)
+
+ !< Open the scalar file with the current pelist, so that only the root pe opens and reads the file and
+ !! distributes the data to the other pes
restart_present = .false.
- if (file_exist('INPUT/radiative_gases.res.nc')) then
+ if (open_file(Rad_restart,"INPUT/radiative_gases.res.nc","read", is_restart=.true., pelist=pes)) then
if (mpp_pe() == mpp_root_pe()) call error_mesg ('radiative_gases_mod', &
'Reading NetCDF formatted restart file: INPUT/radiative_gases.res.nc', NOTE)
if(.not. do_netcdf_restart) call error_mesg ('radiative_gases_mod', &
'netcdf format restart file INPUT/radiative_gases.res.nc exist, but do_netcdf_restart is false.', FATAL)
- call restore_state(Rad_restart)
+
+ call radiative_gases_register_restart(Rad_restart)
+ call read_restart(Rad_restart)
+ call close_file(Rad_restart)
+
restart_present = .true.
- if(vers >= 3) then
- if(.NOT. query_initialized(Rad_restart, id_restart) ) call error_mesg('radiative_gases_mod', &
- 'vers >=3 and INPUT/radiative_gases.res.nc exist, but field n2o_for_last_tf_calc does not in that file', FATAL)
- else
+ if(vers <= 3) then
define_co2_for_last_tf_calc = .true.
define_ch4_for_last_tf_calc = .true.
define_n2o_for_last_tf_calc = .true.
endif
vers = restart_versions(size(restart_versions(:)))
else
- if (file_exist ('INPUT/radiative_gases.res')) then
+ if (file_exists ('INPUT/radiative_gases.res')) then
call error_mesg ('radiative_gases_mod', &
'Native formatted restart file no longer supported.', FATAL)
endif
endif
-
+ deallocate(pes)
!---------------------------------------------------------------------
! call a routine for each gas to initialize its mixing ratio
! and set a flag indicating whether it is fixed in time or time-
@@ -1063,10 +1041,35 @@ subroutine radiative_gases_init (lw_rad_time_step, pref, latb, lonb)
end subroutine radiative_gases_init
+!< radiative_gases_register_restart: register netcdf restart variable
+subroutine radiative_gases_register_restart(Rad_restart)
+ type(FmsNetcdfFile_t), intent(inout) :: Rad_restart !< Fms2io fileobj
-!####################################################################
+!--------------------------------------------------------------------
+ character(len=8), dimension(1) :: dim_names !< Array of dimension names
+ dim_names(1) = "Time"
+ call register_axis(Rad_restart, dim_names(1), unlimited)
+
+ call register_restart_field(Rad_restart, 'vers', vers, dim_names)
+ call register_restart_field(Rad_restart, 'rco2', rco2, dim_names)
+ call register_restart_field(Rad_restart, 'rf11', rf11, dim_names)
+ call register_restart_field(Rad_restart, 'rf12', rf12, dim_names)
+ call register_restart_field(Rad_restart, 'rf113', rf113, dim_names)
+ call register_restart_field(Rad_restart, 'rf22', rf22, dim_names)
+ call register_restart_field(Rad_restart, 'rch4', rch4, dim_names)
+ call register_restart_field(Rad_restart, 'rn2o', rn2o, dim_names)
+ call register_restart_field(Rad_restart, 'co2_for_last_tf_calc', &
+ co2_for_last_tf_calc, dim_names, is_optional = .true.)
+ call register_restart_field(Rad_restart, 'ch4_for_last_tf_calc', &
+ ch4_for_last_tf_calc, dim_names, is_optional = .true.)
+ call register_restart_field(Rad_restart, 'n2o_for_last_tf_calc', &
+ n2o_for_last_tf_calc, dim_names, is_optional = .true.)
+
+end subroutine radiative_gases_register_restart
+
+!####################################################################
!
!
@@ -1986,14 +1989,35 @@ end subroutine radiative_gases_end
!
subroutine radiative_gases_restart(timestamp)
character(len=*), intent(in), optional :: timestamp
+ character(len=128) :: filename !< Restart filename
+
+ type(FmsNetcdfFile_t) :: Rad_restart !< Fms2io fileobj
+ integer, allocatable, dimension(:) :: pes !< Array of pes in the current pelist
! Make sure that the restart_versions variable is up to date.
- vers = restart_versions(size(restart_versions(:)))
+ vers = restart_versions(size(restart_versions(:)))
if( do_netcdf_restart ) then
if(mpp_pe() == mpp_root_pe() ) then
call error_mesg ('radiative_gases_mod', 'Writing NetCDF formatted restart file: RESTART/radiative_gases.res.nc', NOTE)
endif
- call save_restart(Rad_restart, timestamp)
+
+ if (present(timestamp)) then
+ filename = "RESTART/"//trim(timestamp)//".radiative_gases.res.nc"
+ else
+ filename = "RESTART/radiative_gases.res.nc"
+ endif
+
+ !< Get the current pelist
+ allocate(pes(mpp_npes()))
+ call mpp_get_current_pelist(pes)
+
+ !< Open the scalar file with the current pelist, so that only the root pe opens and writes the file
+ if (open_file(Rad_restart,filename,"overwrite", is_restart=.true., pelist=pes)) then
+ call radiative_gases_register_restart(Rad_restart)
+ call write_restart(Rad_restart)
+ call close_file(Rad_restart)
+ endif
+ deallocate(pes)
else
call error_mesg ('radiative_gases_mod', &
'Native intermediate restart files are not supported.', FATAL)
@@ -3425,8 +3449,9 @@ subroutine read_gas_timeseries (gas, gas_value, Gas_time_list, &
!--------------------------------------------------------------------
! process the gas timeseries file.
!--------------------------------------------------------------------
- if (file_exist (file_name) ) then
- inrad = open_namelist_file (file_name)
+ if (file_exists (file_name) ) then
+
+ open(file=file_name, form='formatted',action='read', newunit=inrad)
!--------------------------------------------------------------------
! read the number of data points in the timeseries.
@@ -3466,7 +3491,7 @@ subroutine read_gas_timeseries (gas, gas_value, Gas_time_list, &
!---------------------------------------------------------------------
! close the input file.
!---------------------------------------------------------------------
- call close_file (inrad)
+ close (inrad)
!---------------------------------------------------------------------
! convert the time stamps of the series to time_type variables.
@@ -4734,50 +4759,6 @@ subroutine obtain_gas_tfs (gas, Rad_time, Gas_time, gas_tf_calc_intrvl,&
end subroutine obtain_gas_tfs
-!####################################################################
-!
-!
-! Subroutine to write the radiative restart files
-!
-!
-! Subroutine to write the radiative restart files
-!
-!
-! call write_restart_radiative_gases
-!
-!
-!
-subroutine write_restart_radiative_gases
-
-!---------------------------------------------------------------------
-! write_restart_radiative_gases writes the radiative_gases.res file.
-!---------------------------------------------------------------------
-
- integer :: unit ! unit number for i/o
-
-
-
-!---------------------------------------------------------------------
-! open unit and write radiative gas restart file.
-!---------------------------------------------------------------------
- if (mpp_pe() == mpp_root_pe() ) then
- call error_mesg ('radiative_gases_mod', 'Writing native formatted restart file: RESTART/radiative_gases.res', NOTE)
- unit = open_restart_file ('RESTART/radiative_gases.res', &
- action= 'write')
- write (unit) restart_versions(size(restart_versions(:)))
- write (unit) rrvco2
- write (unit) rrvf11, rrvf12, rrvf113, rrvf22
- write (unit) rrvch4, rrvn2o
- write (unit) co2_for_last_tf_calc
- write (unit) ch4_for_last_tf_calc
- write (unit) n2o_for_last_tf_calc
- call close_file (unit)
- endif
-
-!----------------------------------------------------------------------
-
-end subroutine write_restart_radiative_gases
-
!####################################################################
end module radiative_gases_mod
diff --git a/atmos_param/radiation/shortwave/esfsw_driver.F90 b/atmos_param/radiation/shortwave/esfsw_driver.F90
index 57422aa9..1befa3c6 100644
--- a/atmos_param/radiation/shortwave/esfsw_driver.F90
+++ b/atmos_param/radiation/shortwave/esfsw_driver.F90
@@ -24,11 +24,11 @@ module esfsw_driver_mod
! shared modules:
use mpp_mod, only: input_nml_file, mpp_chksum
-use fms_mod, only: open_namelist_file, fms_init, &
+use fms_mod, only: fms_init, &
mpp_pe, mpp_root_pe, stdlog, &
- file_exist, write_version_number, &
+ write_version_number, &
check_nml_error, error_mesg, &
- FATAL, NOTE, close_file, string, stdout
+ FATAL, NOTE, string, stdout
use constants_mod, only: PI, GRAV, radcon_mks, o2mixrat, &
rhoair, pstd_mks, WTMAIR, &
constants_init
@@ -354,7 +354,7 @@ subroutine esfsw_driver_init
twopiesq, densmolrefsqt3, wavelength, &
freqsq, ristdm1, ri
integer :: iounit, nband, nf, ni, nw, nw1, nw2, nintsolar
- integer :: unit, io, ierr, logunit
+ integer :: io, ierr, logunit
integer :: i
integer :: n
real :: input_flag = 1.0e-99
@@ -426,20 +426,9 @@ subroutine esfsw_driver_init
!-----------------------------------------------------------------------
! read namelist.
!-----------------------------------------------------------------------
-#ifdef INTERNAL_FILE_NML
read (input_nml_file, nml=esfsw_driver_nml, iostat=io)
ierr = check_nml_error(io,'esfsw_driver_nml')
-#else
- if ( file_exist('input.nml')) then
- unit = open_namelist_file ( )
- ierr=1; do while (ierr /= 0)
- read (unit, nml=esfsw_driver_nml, iostat=io, end=10)
- ierr = check_nml_error(io,'esfsw_driver_nml')
- end do
-10 call close_file (unit)
- endif
-#endif
-
+
!---------------------------------------------------------------------
! write version number and namelist to logfile.
!---------------------------------------------------------------------
@@ -585,8 +574,9 @@ subroutine esfsw_driver_init
call error_mesg ( 'esfsw_driver_mod', &
'reading solar band data from file '//trim(file_name), NOTE)
-
- iounit = open_namelist_file (file_name)
+
+ open(file=file_name, form='formatted',action='read', newunit=iounit)
+
read(iounit,101) ( solflxbandref(nband), nband=1,NBANDS )
read(iounit,102) ( nfreqpts(nband), nband=1,NBANDS )
read(iounit,103) ( endwvnbands(nband), nband=1,NBANDS )
@@ -674,7 +664,7 @@ subroutine esfsw_driver_init
read(iounit,107) nwvnsolar (ni),solint(ni)
end do
- call close_file (iounit)
+ close (iounit)
if (tot_wvnums /= endwvnbands(nbands)) then
call error_mesg ('esfsw_driver_mod', &
diff --git a/atmos_param/radiation/shortwave/esfsw_parameters.F90 b/atmos_param/radiation/shortwave/esfsw_parameters.F90
index 5d21f367..479305d0 100644
--- a/atmos_param/radiation/shortwave/esfsw_parameters.F90
+++ b/atmos_param/radiation/shortwave/esfsw_parameters.F90
@@ -24,11 +24,11 @@ module esfsw_parameters_mod
! shared modules:
use mpp_mod, only: input_nml_file
-use fms_mod, only: open_namelist_file, fms_init, &
+use fms_mod, only: fms_init, &
mpp_pe, mpp_root_pe, stdlog, &
- file_exist, write_version_number, &
+ write_version_number, &
check_nml_error, error_mesg, &
- FATAL, close_file
+ FATAL
!--------------------------------------------------------------------
@@ -148,12 +148,11 @@ subroutine esfsw_parameters_init (nbands, nfrqpts, nh2obands, &
!------------------------------------------------------------------
! local variables:
- integer :: unit, ierr, io, logunit
+ integer :: ierr, io, logunit
!---------------------------------------------------------------------
! local variables:
!
-! unit io unit number used for namelist file
! ierr error code
! io error status returned from io operation
!
@@ -173,19 +172,8 @@ subroutine esfsw_parameters_init (nbands, nfrqpts, nh2obands, &
!-----------------------------------------------------------------------
! read namelist.
!-----------------------------------------------------------------------
-#ifdef INTERNAL_FILE_NML
read (input_nml_file, nml=esfsw_parameters_nml, iostat=io)
ierr = check_nml_error(io,'esfsw_parameters_nml')
-#else
- if ( file_exist('input.nml')) then
- unit = open_namelist_file ( )
- ierr=1; do while (ierr /= 0)
- read (unit, nml=esfsw_parameters_nml, iostat=io, end=10)
- ierr = check_nml_error(io,'esfsw_parameters_nml')
- end do
-10 call close_file (unit)
- endif
-#endif
!--------------------------------------------------------------------
! process the namelist entries to obtain the parameters specifying
diff --git a/atmos_param/radiation/util/radiation_diag.F90 b/atmos_param/radiation/util/radiation_diag.F90
index 7ec2c892..ce852db0 100644
--- a/atmos_param/radiation/util/radiation_diag.F90
+++ b/atmos_param/radiation/util/radiation_diag.F90
@@ -18,12 +18,11 @@ module radiation_diag_mod
! shared modules:
use mpp_mod, only: input_nml_file
-use fms_mod, only: open_namelist_file, fms_init, &
+use fms_mod, only: fms_init, &
mpp_pe, mpp_root_pe, stdlog, &
- file_exist, write_version_number, &
+ write_version_number, &
check_nml_error, error_mesg, &
- FATAL, close_file, &
- open_file
+ FATAL
use constants_mod, only: constants_init, radcon_mks, radian
! shared radiation package modules:
@@ -197,14 +196,13 @@ subroutine radiation_diag_init (lonb, latb, npts)
!--------------------------------------------------------------------
! local variables
- integer :: unit, ierr, io, logunit
+ integer :: ierr, io, logunit
integer :: nn, j, i
real :: dellat, dellon
!--------------------------------------------------------------------
! local variables
!
-! unit
!
!-------------------------------------------------------------------
@@ -223,19 +221,8 @@ subroutine radiation_diag_init (lonb, latb, npts)
!-----------------------------------------------------------------------
! read namelist.
!-----------------------------------------------------------------------
-#ifdef INTERNAL_FILE_NML
read (input_nml_file, nml=radiation_diag_nml, iostat=io)
ierr = check_nml_error(io,'radiation_diag_nml')
-#else
- if ( file_exist('input.nml')) then
- unit = open_namelist_file ( )
- ierr=1; do while (ierr /= 0)
- read (unit, nml=radiation_diag_nml, iostat=io, end=10)
- ierr = check_nml_error(io,'radiation_diag_nml')
- end do
-10 call close_file (unit)
- endif
-#endif
!---------------------------------------------------------------------
! write version number and namelist to logfile.
@@ -357,8 +344,7 @@ subroutine radiation_diag_init (lonb, latb, npts)
!----------------------------------------------------------------------
! open a unit for the radiation diagnostics output.
!---------------------------------------------------------------------
- radiag_unit = open_file ('radiation_diag.out', action='write', &
- threading='multi', form='formatted')
+ if (mpp_pe() == mpp_root_pe() ) open(newunit = radiag_unit, file='radiation_diag.out', status='replace', form='formatted')
!----------------------------------------------------------------------
! save the input fields from the lw_tables_type variable that will
@@ -503,7 +489,7 @@ subroutine radiation_diag_end
!--------------------------------------------------------------------
! close the radiation_diag.out file.
!--------------------------------------------------------------------
- call close_file (radiag_unit)
+ if (mpp_pe() == mpp_root_pe() ) close(radiag_unit)
!--------------------------------------------------------------------
! deallocate module arrays.
@@ -843,19 +829,19 @@ subroutine radiag (is, ie, js, je, jrow, Rad_diag)
! write out the latitude and longitude of the model point for which
! diagnostics will be produced.
!---------------------------------------------------------------------
- write (radiag_unit,99000) deglon1(nn), deglat1(nn)
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,99000) deglon1(nn), deglat1(nn)
!----------------------------------------------------------------------
! write longwave cloud data. determine if any clouds are present
! in the column. if there are, define the number of lw cloud bands.
!----------------------------------------------------------------------
- write (radiag_unit,9009)
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9009)
!bw nmxolw = Cld_spec%nmxolw(iloc, jloc)
!bw nrndlw = Cld_spec%nrndlw(iloc, jloc)
nmxolw = count(Rad_diag%cmxolw(iloc, jloc, ks:ke) > 0.0)
nrndlw = count(Rad_diag%crndlw(iloc, jloc, ks:ke, 1) > 0.0) ! what about stochastic clouds?
if (nmxolw > 0 .OR. nrndlw > 0) then
- write (radiag_unit,9010) nmxolw, nrndlw
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9010) nmxolw, nrndlw
nlwcldb = size (Rad_diag%emmxolw,4)
!----------------------------------------------------------------------
! write longwave cloud amounts and emissivities for each cloud band.
@@ -865,11 +851,11 @@ subroutine radiag (is, ie, js, je, jrow, Rad_diag)
! [ dimensionless ]
!----------------------------------------------------------------------
do n=1,nlwcldb
- write (radiag_unit,9041) n
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9041) n
do k = ks,ke
! what if stochastic clouds = true?
if (Rad_diag%cmxolw(iloc,jloc,k) > 0.0 .or. Rad_diag%crndlw(iloc,jloc,k,1) > 0.0) then
- write (radiag_unit,9030) k, &
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9030) k, &
Rad_diag%cmxolw(iloc,jloc,k), Rad_diag%emmxolw(iloc,jloc,k,n,1),&
Rad_diag%crndlw(iloc,jloc,k,1), Rad_diag%emrndlw(iloc,jloc,k,n,1)
endif
@@ -880,7 +866,7 @@ subroutine radiag (is, ie, js, je, jrow, Rad_diag)
! if no clouds are present, write a message.
!--------------------------------------------------------------------
else
- write (radiag_unit, 9052)
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit, 9052)
endif
!----------------------------------------------------------------------
@@ -888,8 +874,8 @@ subroutine radiag (is, ie, js, je, jrow, Rad_diag)
!----------------------------------------------------------------------
!bw ncldsw = Cld_spec%ncldsw(iloc, jloc)
ncldsw = count(Rad_diag%camtsw(iloc,jloc,ks:ke,1) > 0.0) ! stochastic clouds?
- write (radiag_unit, 9018)
- write (radiag_unit, 9019) ncldsw
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit, 9018)
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit, 9019) ncldsw
!----------------------------------------------------------------------
! if clouds exist, write shortwave cloud data.
@@ -913,7 +899,7 @@ subroutine radiag (is, ie, js, je, jrow, Rad_diag)
! %deltaz model vertical grid interval [ meters ]
!---------------------------------------------------------------------
do n=1,size(Rad_diag%cldext,4)
- write (radiag_unit,9040) n
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9040) n
do k=ks,ke
if (Rad_diag%camtsw(iloc,jloc,k,1) > 0.0) then ! stochastic clouds?
cldextdz = Rad_diag%cldext(iloc,jloc,k,n,1) !DEL* &
@@ -925,7 +911,7 @@ subroutine radiag (is, ie, js, je, jrow, Rad_diag)
else
cldssalb = 0.0
endif
- write (radiag_unit,9050) k, &
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9050) k, &
Rad_diag%camtsw (iloc,jloc,k,1), & ! stochastic clouds?
cldextdz, cldssalb, &
Rad_diag%cldasymm(iloc,jloc,k,n,1)
@@ -945,7 +931,7 @@ subroutine radiag (is, ie, js, je, jrow, Rad_diag)
! if no clouds are present in the column, write out a message.
!----------------------------------------------------------------------
else
- write (radiag_unit, 9053)
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit, 9053)
endif
!--------------------------------------------------------------------
@@ -955,36 +941,36 @@ subroutine radiag (is, ie, js, je, jrow, Rad_diag)
cirrfgd_dir = Rad_diag%asfc_nir_dir(iloc,jloc)
cvisrfgd_dif = Rad_diag%asfc_vis_dif(iloc,jloc)
cirrfgd_dif = Rad_diag%asfc_nir_dif(iloc,jloc)
- write (radiag_unit,9059)
- write (radiag_unit,9060) cvisrfgd_dir, cirrfgd_dir, &
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9059)
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9060) cvisrfgd_dir, cirrfgd_dir, &
cvisrfgd_dif, cirrfgd_dif
!----------------------------------------------------------------------
! write out the amounts of the radiative gases that the radiation
! code sees.
!--------------------------------------------------------------------
- write (radiag_unit,9069)
- write (radiag_unit,9070) Rad_diag%rrvco2
- write (radiag_unit,9071) Rad_diag%rrvf11
- write (radiag_unit,9072) Rad_diag%rrvf12
- write (radiag_unit,9075) Rad_diag%rrvf113
- write (radiag_unit,9076) Rad_diag%rrvf22
- write (radiag_unit,9073) Rad_diag%rrvch4
- write (radiag_unit,9074) Rad_diag%rrvn2o
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9069)
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9070) Rad_diag%rrvco2
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9071) Rad_diag%rrvf11
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9072) Rad_diag%rrvf12
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9075) Rad_diag%rrvf113
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9076) Rad_diag%rrvf22
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9073) Rad_diag%rrvch4
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9074) Rad_diag%rrvn2o
!---------------------------------------------------------------------
! define the shortwave parameterization being employed. define the
! assumption used to specify the solar zenith angle.
!---------------------------------------------------------------------
- write (radiag_unit, 9079)
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit, 9079)
if (Rad_diag%do_diurnal) then
- write (radiag_unit,99020)
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,99020)
else if (Rad_diag%do_annual) then
- write (radiag_unit,99025)
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,99025)
else if (Rad_diag%do_daily_mean) then
- write (radiag_unit,99030)
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,99030)
else ! (if all 3 are false)
- write (radiag_unit,99040)
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,99040)
endif
!----------------------------------------------------------------------
@@ -998,7 +984,7 @@ subroutine radiag (is, ie, js, je, jrow, Rad_diag)
! %rrsun earth-sun distance relative to mean distance
! [ dimensionless ]
!----------------------------------------------------------------------
- write (radiag_unit,9080) &
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9080) &
Rad_diag%solar_constant*Rad_diag%rrsun, &
Rad_diag%cosz(iloc,jloc), &
Rad_diag%fracday(iloc,jloc)
@@ -1054,19 +1040,19 @@ subroutine radiag (is, ie, js, je, jrow, Rad_diag)
! %hsw sw radiation heating rates.
! [ degrees K / day ]
!----------------------------------------------------------------------
- write (radiag_unit,9130)
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9130)
!DEL if (Sw_control%do_esfsw) then
- write (radiag_unit, 99016)
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit, 99016)
!DEL endif
- !write (radiag_unit, 9082) nz
- write (radiag_unit,9140)
- write (radiag_unit,9150) (k, press(k), &
+ !if (mpp_pe() == mpp_root_pe() ) write (radiag_unit, 9082) nz
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9140)
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9150) (k, press(k), &
Rad_diag%Sw_output(1)%hsw (iloc,jloc,k), &
Rad_diag%Sw_output(1)%fsw (iloc,jloc,k), &
Rad_diag%Sw_output(1)%dfsw (iloc,jloc,k), &
Rad_diag%Sw_output(1)%ufsw (iloc,jloc,k),&
pflux (k), k=ks,ke)
- write (radiag_unit,6556) press(ke+1), &
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,6556) press(ke+1), &
Rad_diag%Sw_output(1)%fsw (iloc,jloc,ke+1), &
Rad_diag%Sw_output(1)%dfsw (iloc,jloc,ke+1), &
Rad_diag%Sw_output(1)%ufsw (iloc,jloc,ke+1), &
@@ -1083,7 +1069,7 @@ subroutine radiag (is, ie, js, je, jrow, Rad_diag)
Rad_diag%Sw_output(1)%ufsw_vis_sfc(iloc,jloc)
ufsw_nir_dif = Rad_diag%Sw_output(1)%ufsw_dif_sfc(iloc,jloc) - &
Rad_diag%Sw_output(1)%ufsw_vis_sfc_dif(iloc,jloc)
- write (radiag_unit, 99026) &
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit, 99026) &
Rad_diag%Sw_output(1)%dfsw_vis_sfc(iloc,jloc), &
Rad_diag%Sw_output(1)%ufsw_vis_sfc(iloc,jloc), &
Rad_diag%Sw_output(1)%dfsw_vis_sfc_dir(iloc,jloc), &
@@ -1106,12 +1092,12 @@ subroutine radiag (is, ie, js, je, jrow, Rad_diag)
hlwsw(k) = Rad_diag%Sw_output(1)%hsw (iloc,jloc,k) + &
Rad_diag%Lw_output(1)%heatra (iloc,jloc,k)
end do
- write (radiag_unit,9160)
- write (radiag_unit,9170)
- write (radiag_unit,9190) (k, press(k), &
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9160)
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9170)
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9190) (k, press(k), &
hlwsw(k), flwsw(k), &
pflux(k), k=ks,ke)
- write (radiag_unit,9180) press(ke+1), flwsw(ke+1), &
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9180) press(ke+1), flwsw(ke+1), &
pflux(ke+1)
if (Rad_diag%do_totcld_forcing) then
@@ -1126,16 +1112,16 @@ subroutine radiag (is, ie, js, je, jrow, Rad_diag)
! cloud.
! [ Watts / m**2 , or kg / sec**3 ]
!----------------------------------------------------------------------
- write (radiag_unit,9400)
- write (radiag_unit,9100)
- write (radiag_unit,9110) (k, press (k), &
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9400)
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9100)
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9110) (k, press (k), &
Rad_diag%temp (iloc,jloc,k), &
Rad_diag%rh2o (iloc,jloc,k), &
Rad_diag%qo3 (iloc,jloc,k), &
Rad_diag%Lw_output(1)%heatracf(iloc,jloc,k), &
Rad_diag%Lw_output(1)%flxnetcf(iloc,jloc,k), &
pflux (k), k=ks,ke)
- write (radiag_unit,9120) press (ke+1), &
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9120) press (ke+1), &
Rad_diag%temp (iloc,jloc,ke+1),&
Rad_diag%Lw_output(1)%flxnetcf(iloc,jloc,ke+1),&
pflux(ke+1)
@@ -1152,16 +1138,16 @@ subroutine radiag (is, ie, js, je, jrow, Rad_diag)
! %hswcf sw radiation heating rates in the absence of clouds.
! [ degrees K / day ]
!----------------------------------------------------------------------
- write (radiag_unit,9410)
- !write (radiag_unit, 9082) nz
- write (radiag_unit,9140)
- write (radiag_unit,9150) (k, press(k), &
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9410)
+ !if (mpp_pe() == mpp_root_pe() ) write (radiag_unit, 9082) nz
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9140)
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9150) (k, press(k), &
Rad_diag%Sw_output(1)%hswcf (iloc,jloc,k), &
Rad_diag%Sw_output(1)%fswcf (iloc,jloc,k), &
Rad_diag%Sw_output(1)%dfswcf(iloc,jloc,k),&
Rad_diag%Sw_output(1)%ufswcf(iloc,jloc,k), &
pflux(k), k=ks,ke)
- write (radiag_unit,6556) &
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,6556) &
press(ke+1), &
Rad_diag%Sw_output(1)%fswcf(iloc,jloc,ke+1),&
Rad_diag%Sw_output(1)%dfswcf(iloc,jloc,ke+1), &
@@ -1181,11 +1167,11 @@ subroutine radiag (is, ie, js, je, jrow, Rad_diag)
Rad_diag%Lw_output(1)%heatracf(iloc,jloc,k)
end do
- write (radiag_unit,9420)
- write (radiag_unit,9170)
- write (radiag_unit,9190) (k, press(k), hlwswcf(k), &
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9420)
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9170)
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9190) (k, press(k), hlwswcf(k), &
flwswcf(k), pflux(k), k=ks,ke)
- write (radiag_unit,9180) press(ke+1), flwswcf(ke+1), &
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9180) press(ke+1), flwswcf(ke+1), &
pflux(ke+1)
endif
@@ -1208,40 +1194,40 @@ subroutine radiag (is, ie, js, je, jrow, Rad_diag)
!----------------------------------------------------------------------
if (Rad_diag%do_lwaerosol) then
! climate includes aerosol effects, lw aerosol forcing by exclusion
- write (radiag_unit,9603)
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9603)
else
! climate includes no aerosol effects, lw aerosol forcing by inclusion
- write (radiag_unit,9601)
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9601)
endif
- write (radiag_unit,9100)
- write (radiag_unit,9110) (k, press (k), &
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9100)
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9110) (k, press (k), &
Rad_diag%temp (iloc,jloc,k), &
Rad_diag%rh2o (iloc,jloc,k), &
Rad_diag%qo3 (iloc,jloc,k), &
Lw_output_ad%heatra(iloc,jloc,k), &
Lw_output_ad%flxnet(iloc,jloc,k), &
pflux (k), k=ks,ke)
- write (radiag_unit,9120) press (ke+1), &
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9120) press (ke+1), &
Rad_diag%temp (iloc,jloc,ke+1),&
Lw_output_ad%flxnet(iloc,jloc,ke+1),&
pflux(ke+1)
! clear-sky results
if (Rad_diag%do_lwaerosol) then
! climate includes aerosol effects, lw aerosol forcing by exclusion
- write (radiag_unit,9604)
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9604)
else
! climate includes no aerosol effects, lw aerosol forcing by inclusion
- write (radiag_unit,9602)
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9602)
endif
- write (radiag_unit,9100)
- write (radiag_unit,9110) (k, press (k), &
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9100)
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9110) (k, press (k), &
Rad_diag%temp (iloc,jloc,k), &
Rad_diag%rh2o (iloc,jloc,k), &
Rad_diag%qo3 (iloc,jloc,k), &
Lw_output_ad%heatracf(iloc,jloc,k), &
Lw_output_ad%flxnetcf(iloc,jloc,k), &
pflux (k), k=ks,ke)
- write (radiag_unit,9120) press (ke+1), &
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9120) press (ke+1), &
Rad_diag%temp (iloc,jloc,ke+1),&
Lw_output_ad%flxnetcf(iloc,jloc,ke+1),&
pflux(ke+1)
@@ -1271,19 +1257,19 @@ subroutine radiag (is, ie, js, je, jrow, Rad_diag)
!----------------------------------------------------------------------
if (Rad_diag%do_swaerosol) then
! climate includes aerosol effects, sw aerosol forcing by exclusion
- write (radiag_unit,9703)
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9703)
else
! climate includes no aerosol effects, sw aerosol forcing by inclusion
- write (radiag_unit,9701)
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9701)
endif
- write (radiag_unit,9140)
- write (radiag_unit,9150) (k, press(k), &
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9140)
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9150) (k, press(k), &
Sw_output_ad%hsw (iloc,jloc,k), &
Sw_output_ad%fsw (iloc,jloc,k), &
Sw_output_ad%dfsw(iloc,jloc,k),&
Sw_output_ad%ufsw(iloc,jloc,k), &
pflux(k), k=ks,ke)
- write (radiag_unit,6556) &
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,6556) &
press(ke+1), &
Sw_output_ad%fsw(iloc,jloc,ke+1),&
Sw_output_ad%dfsw(iloc,jloc,ke+1), &
@@ -1292,19 +1278,19 @@ subroutine radiag (is, ie, js, je, jrow, Rad_diag)
! clear-sky results
if (Rad_diag%do_swaerosol) then
! climate includes aerosol effects, sw aerosol forcing by exclusion
- write (radiag_unit,9704)
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9704)
else
! climate includes no aerosol effects, sw aerosol forcing by inclusion
- write (radiag_unit,9702)
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9702)
endif
- write (radiag_unit,9140)
- write (radiag_unit,9150) (k, press(k), &
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9140)
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9150) (k, press(k), &
Sw_output_ad%hswcf (iloc,jloc,k), &
Sw_output_ad%fswcf (iloc,jloc,k), &
Sw_output_ad%dfswcf(iloc,jloc,k),&
Sw_output_ad%ufswcf(iloc,jloc,k), &
pflux(k), k=ks,ke)
- write (radiag_unit,6556) &
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,6556) &
press(ke+1), &
Sw_output_ad%fswcf(iloc,jloc,ke+1),&
Sw_output_ad%dfswcf(iloc,jloc,ke+1), &
@@ -1332,19 +1318,19 @@ subroutine radiag (is, ie, js, je, jrow, Rad_diag)
Lw_output_ad%heatracf(iloc,jloc,k)
end do
- write (radiag_unit,9801)
- write (radiag_unit,9170)
- write (radiag_unit,9190) (k, press(k), &
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9801)
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9170)
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9190) (k, press(k), &
hlwsw(k), flwsw(k), &
pflux(k), k=ks,ke)
- write (radiag_unit,9180) press(ke+1), flwsw(ke+1), &
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9180) press(ke+1), flwsw(ke+1), &
pflux(ke+1)
- write (radiag_unit,9802)
- write (radiag_unit,9170)
- write (radiag_unit,9190) (k, press(k), hlwswcf(k), &
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9802)
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9170)
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9190) (k, press(k), hlwswcf(k), &
flwswcf(k), pflux(k), k=ks,ke)
- write (radiag_unit,9180) press(ke+1), flwswcf(ke+1), &
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9180) press(ke+1), flwswcf(ke+1), &
pflux(ke+1)
endif
@@ -1436,42 +1422,42 @@ subroutine radiag (is, ie, js, je, jrow, Rad_diag)
! write approximate emissivity heating rates.
!----------------------------------------------------------------------
if (nbtrge == 0) then
- write (radiag_unit,9200)
- write (radiag_unit,9210) (k, press(k), htem1(k), &
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9200)
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9210) (k, press(k), htem1(k), &
htem2(k), htem3(k), htem4(k), &
htem5(k), htem6(k), htem(k), &
k=ks,ke)
else
if (nbtrge .EQ. 1) then
- write (radiag_unit,9201)
- write (radiag_unit,9211) (k, press(k), htem1(k), &
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9201)
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9211) (k, press(k), htem1(k), &
htem2(k), htem3(k), htem4(k), &
htem5(k), htem6(k), &
htem7(k,1), htem(k),k=ks,ke)
else if (nbtrge .EQ. 2) then
- write (radiag_unit,9202)
- write (radiag_unit,9212) (k, press(k), htem1(k), &
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9202)
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9212) (k, press(k), htem1(k), &
htem2(k), htem3(k), htem4(k), &
htem5(k), htem6(k), &
(htem7(k,n),n=1,nbtrge), &
htem7t(k), htem(k),k=ks,ke)
else if (nbtrge .EQ. 4) then
- write (radiag_unit,9203)
- write (radiag_unit,9213) (k, press(k), htem1(k), &
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9203)
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9213) (k, press(k), htem1(k), &
htem2(k), htem3(k), htem4(k),&
htem5(k), htem6(k), &
(htem7(k,n),n=1,nbtrge), &
htem7t(k), htem(k),k=ks,ke)
else if (nbtrge .EQ. 10) then
- write (radiag_unit,9201)
- write (radiag_unit,9211) (k, press(k), htem1(k), &
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9201)
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9211) (k, press(k), htem1(k), &
htem2(k), htem3(k), htem4(k), &
htem5(k), htem6(k), &
htem7t(k), &
htem(k),k=ks,ke)
else if (nbtrge .EQ. 20) then
- write (radiag_unit,9201)
- write (radiag_unit,9211) (k, press(k), htem1(k), &
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9201)
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9211) (k, press(k), htem1(k), &
htem2(k), htem3(k), htem4(k), &
htem5(k), htem6(k), &
htem7t(k), &
@@ -1499,8 +1485,8 @@ subroutine radiag (is, ie, js, je, jrow, Rad_diag)
ctst(k) = ctso3(k) + ctsco2(k) + cts(k)
end do
- write (radiag_unit,9220)
- write (radiag_unit,9230) (k, press(k), cts(k), ctsco2(k), &
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9220)
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9230) (k, press(k), cts(k), ctsco2(k), &
ctso3(k), ctst(k), k=ks,ke)
!----------------------------------------------------------------------
@@ -1517,25 +1503,25 @@ subroutine radiag (is, ie, js, je, jrow, Rad_diag)
exctsn(k,n) = Rad_diag%Lw_diagnostics%exctsn(iloc,jloc,k,n)
end do
end do
- write (radiag_unit,9240)
- write (radiag_unit,9250) (k, press(k), &
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9240)
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9250) (k, press(k), &
Rad_diag%Lw_diagnostics%excts(iloc,jloc,k),&
(exctsn(k,n), n=1,7) , k=ks,ke)
- write (radiag_unit,9260)
- write (radiag_unit,9250) (k, press(k), &
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9260)
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9250) (k, press(k), &
(exctsn(k,n), n=8,15) , k=ks,ke)
if (nbly == 48) then
- write (radiag_unit,9261)
- write (radiag_unit,9250) (k, press(k), &
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9261)
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9250) (k, press(k), &
(exctsn(k,n), n=16,23) , k=ks,ke)
- write (radiag_unit,9262)
- write (radiag_unit,9250) (k, press(k), &
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9262)
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9250) (k, press(k), &
(exctsn(k,n), n=24,31) , k=ks,ke)
- write (radiag_unit,9263)
- write (radiag_unit,9250) (k, press(k), &
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9263)
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9250) (k, press(k), &
(exctsn(k,n), n=32,39) , k=ks,ke)
- write (radiag_unit,9264)
- write (radiag_unit,9250) (k, press(k), &
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9264)
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9250) (k, press(k), &
(exctsn(k,n), n=40,47) , k=ks,ke)
endif
@@ -1600,7 +1586,7 @@ subroutine radiag (is, ie, js, je, jrow, Rad_diag)
fdiff = Rad_diag%Lw_diagnostics%gxcts(iloc,jloc) + &
Rad_diag%Lw_diagnostics%flx1e1(iloc,jloc) - &
Rad_diag%Lw_output(1)%flxnet(iloc,jloc,ke+1)
- write (radiag_unit,9270) &
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9270) &
Rad_diag%Lw_diagnostics%gxcts(iloc,jloc), &
Rad_diag%Lw_diagnostics%flx1e1(iloc,jloc), &
Rad_diag%Lw_diagnostics%gxcts(iloc,jloc)+ &
@@ -1609,7 +1595,7 @@ subroutine radiag (is, ie, js, je, jrow, Rad_diag)
fdiff
if (nbtrge > 0) then
do m=1,nbtrge
- write (radiag_unit,9271) m, &
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9271) m, &
Rad_diag%Lw_diagnostics%flx1e1f(iloc,jloc,m)
end do
ftopeft = 0.0E+00
@@ -1617,7 +1603,7 @@ subroutine radiag (is, ie, js, je, jrow, Rad_diag)
ftopeft = ftopeft + &
Rad_diag%Lw_diagnostics%flx1e1f(iloc,jloc,m)
end do
- write (radiag_unit,9272) ftopeft
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9272) ftopeft
endif
!----------------------------------------------------------------------
@@ -1631,14 +1617,14 @@ subroutine radiag (is, ie, js, je, jrow, Rad_diag)
do nx=1,n_continuum_bands
if (Rad_diag%Lw_tables%iband(nx) .EQ. ny) then
if (nprt .EQ. 1) then
- write (radiag_unit,9290) ny, &
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9290) ny, &
Rad_diag%Lw_tables%bandlo(nx+16), &
Rad_diag%Lw_tables%bandhi(nx+16), &
ftopn(ny), ftopac(ny), &
Rad_diag%Lw_diagnostics%fctsg(iloc,jloc,ny), vsumac(ny)
nprt = 0
else
- write (radiag_unit,9300) Rad_diag%Lw_tables%bandlo(nx+16), &
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9300) Rad_diag%Lw_tables%bandlo(nx+16), &
Rad_diag%Lw_tables%bandhi(nx+16)
endif
endif
@@ -1649,7 +1635,7 @@ subroutine radiag (is, ie, js, je, jrow, Rad_diag)
! write out toa and sfc fluxes for remaining bands.
!----------------------------------------------------------------------
do ny =nbly-7, nbly
- write (radiag_unit,9290) ny, &
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9290) ny, &
Rad_diag%Lw_tables%bdlocm(ny), &
Rad_diag%Lw_tables%bdhicm(ny), ftopn(ny),ftopac(ny), &
Rad_diag%Lw_diagnostics%fctsg(iloc,jloc,ny), vsumac(ny)
@@ -1658,31 +1644,31 @@ subroutine radiag (is, ie, js, je, jrow, Rad_diag)
!----------------------------------------------------------------------
! write out emissivity fluxes.
!----------------------------------------------------------------------
- write (radiag_unit,9310)
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9310)
if (nbtrge == 0) then
- write (radiag_unit,9320)
- write (radiag_unit,9330) (k, flx1(k),flx2(k), flx3(k), &
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9320)
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9330) (k, flx1(k),flx2(k), flx3(k), &
flx4(k), flx5(k), flx6(k), &
flxem(k), k=ks,ke+1)
else
if (nbtrge .EQ. 1) then
- write (radiag_unit,9321)
- write (radiag_unit,9331) (k, flx1(k),flx2(k), &
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9321)
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9331) (k, flx1(k),flx2(k), &
flx3(k),flx4(k), &
flx5(k), flx6(k), &
flxemch4n2o(k), flxem(k), &
k=ks,ke+1)
else if (nbtrge .EQ. 2) then
- write (radiag_unit,9322)
- write (radiag_unit,9332) (k, flx1(k),flx2(k), &
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9322)
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9332) (k, flx1(k),flx2(k), &
flx3(k),flx4(k), &
flx5(k), flx6(k), &
(flx7(k,m ),m=1,nbtrge), &
flxemch4n2o(k), flxem(k), &
k=ks,ke+1)
else if (nbtrge .EQ. 4) then
- write (radiag_unit,9323)
- write (radiag_unit,9333) (k, flx1(k),flx2(k), &
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9323)
+ if (mpp_pe() == mpp_root_pe() ) write (radiag_unit,9333) (k, flx1(k),flx2(k), &
flx3(k),flx4(k), &
flx5(k), flx6(k),&
(flx7(k,m),m=1,nbtrge),&
diff --git a/atmos_param/ras/ras.F90 b/atmos_param/ras/ras.F90
index 703468ef..144e5334 100644
--- a/atmos_param/ras/ras.F90
+++ b/atmos_param/ras/ras.F90
@@ -22,9 +22,9 @@ MODULE RAS_MOD
use Diag_Manager_Mod, ONLY: register_diag_field, send_data
use Time_Manager_Mod, ONLY: time_type
use mpp_mod, only: input_nml_file
- use fms_mod, only: write_version_number, open_namelist_file, &
- FILE_EXIST, ERROR_MESG, check_nml_error, &
- CLOSE_FILE, FATAL
+ use fms_mod, only: write_version_number,&
+ ERROR_MESG, check_nml_error, &
+ FATAL
use field_manager_mod, only: MODEL_ATMOS
use tracer_manager_mod, only: get_tracer_index, &
get_number_tracers, &
@@ -223,7 +223,7 @@ SUBROUTINE RAS_INIT( do_strat, do_liq_num, axes, Time, &
! (Intent local)
!---------------------------------------------------------------------
- integer :: unit, io, ierr
+ integer :: io, ierr
real :: actp, facm
real, dimension(15) :: au, tem
integer, dimension(3) :: half = (/1,2,4/)
@@ -237,19 +237,8 @@ SUBROUTINE RAS_INIT( do_strat, do_liq_num, axes, Time, &
! --- Read namelist
!---------------------------------------------------------------------
-#ifdef INTERNAL_FILE_NML
read (input_nml_file, nml=ras_nml, iostat=io)
ierr = check_nml_error(io,"ras_nml")
-#else
- if( FILE_EXIST( 'input.nml' ) ) then
- unit = OPEN_NAMELIST_FILE ()
- ierr = 1 ; do while ( ierr .ne. 0 )
- READ( unit, nml = ras_nml, iostat = io, end = 10 )
- ierr = check_nml_error (io, 'ras_nml')
- end do
-10 CALL CLOSE_FILE ( unit )
- end if
-#endif
!---------------------------------------------------------------------
! --- Write namelist
diff --git a/atmos_param/rh_clouds/rh_clouds.F90 b/atmos_param/rh_clouds/rh_clouds.F90
index 04cdadd5..c5b9b030 100644
--- a/atmos_param/rh_clouds/rh_clouds.F90
+++ b/atmos_param/rh_clouds/rh_clouds.F90
@@ -8,13 +8,14 @@ module rh_clouds_mod
!=======================================================================
use mpp_mod, only : input_nml_file
-use fms_mod, only : error_mesg, FATAL, file_exist, &
- check_nml_error, open_namelist_file, &
- close_file, mpp_pe, mpp_root_pe, &
- write_version_number, stdlog
-use fms_io_mod, only : restore_state, &
- register_restart_field, restart_file_type, &
- save_restart, get_mosaic_tile_file
+use mpp_domains_mod, only: domain2D
+use fms_mod, only : error_mesg, FATAL, check_nml_error, &
+ mpp_pe, mpp_root_pe, write_version_number, stdlog
+use fms2_io_mod, only: FmsNetcdfFile_t, FmsNetcdfDomainFile_t, &
+ register_restart_field, register_axis, unlimited, &
+ open_file, read_restart, write_restart, close_file, &
+ register_field, write_data, register_variable_attribute, &
+ get_global_io_domain_indices, file_exists
!=======================================================================
@@ -145,7 +146,7 @@ module rh_clouds_mod
! OTHER MODULE VARIABLES
!--- for netcdf restart
-type(restart_file_type), pointer, save :: RH_restart => NULL()
+type (domain2D), pointer :: rh_domain !< Atmosphere domain
logical :: module_is_initialized = .false.
@@ -153,29 +154,19 @@ module rh_clouds_mod
!#######################################################################
-subroutine rh_clouds_init (nlon, nlat, nlev)
+subroutine rh_clouds_init (domain, nlon, nlat, nlev)
+type(domain2D), target, intent(in) :: domain !< Atmosphere domain
integer, intent(in) :: nlon, nlat, nlev
-
-integer :: unit, ierr, io, logunit, id_restart
+integer :: unit, ierr, io, logunit
+type(FmsNetcdfDomainFile_t) :: RH_restart !< Fms2io domain decomposed fileobj
if (module_is_initialized) return
!------------------- read namelist input -------------------------------
-#ifdef INTERNAL_FILE_NML
read (input_nml_file, nml=rh_clouds_nml, iostat=io)
ierr = check_nml_error(io,'rh_clouds_nml')
-#else
- if (file_exist('input.nml')) then
- unit = open_namelist_file ()
- ierr=1; do while (ierr /= 0)
- read (unit, nml=rh_clouds_nml, iostat=io, end=10)
- ierr = check_nml_error(io,'rh_clouds_nml')
- enddo
- 10 call close_file (unit)
- endif
-#endif
!---------- output namelist to log-------------------------------------
@@ -188,19 +179,15 @@ subroutine rh_clouds_init (nlon, nlat, nlev)
!---------- initialize for rh cloud averaging -------------------------
allocate (rhsum(nlon,nlat,nlev), nsum(nlon,nlat))
- allocate(RH_restart)
- id_restart = register_restart_field(RH_restart, 'rh_clouds.res.nc', 'nsum', nsum)
- id_restart = register_restart_field(RH_restart, 'rh_clouds.res.nc', 'rhsum', rhsum)
- if (file_exist('INPUT/rh_clouds.res.nc')) then
- call restore_state(RH_restart)
- else if (file_exist('INPUT/rh_clouds.res')) then
+ rh_domain => domain
+ if (open_file(RH_restart,"INPUT/rh_clouds.res.nc","read", rh_domain, is_restart=.true.)) then
+ call rh_register_restart(RH_restart)
+ call read_restart(RH_restart)
+ call close_file(RH_restart)
+ else if (file_exists('INPUT/rh_clouds.res')) then
call error_mesg ('rh_clouds_init', &
'Native restart files no longer supported.', FATAL)
-! unit = open_restart_file ('INPUT/rh_clouds.res', action='read')
-! call read_data (unit, nsum)
-! call read_data (unit, rhsum)
-! call close_file (unit)
else
rhsum = 0.0; nsum = 0
endif
@@ -213,15 +200,61 @@ subroutine rh_clouds_init (nlon, nlat, nlev)
end subroutine rh_clouds_init
!#######################################################################
+!< rh_register_restart: Register the netcdf restart variables
+subroutine rh_register_restart(RH_restart)
+type(FmsNetcdfDomainFile_t), intent(inout) :: RH_restart !< Fms2io netcdf file obj
+character(len=8), dimension(4) :: dim_names !< Array of dimension names
+
+ dim_names(1) = "xaxis_1"
+ dim_names(2) = "yaxis_1"
+ dim_names(3) = "zaxis_1"
+ dim_names(4) = "Time"
+
+ call register_axis(RH_restart, "Time", unlimited)
+ call register_axis(RH_restart, "xaxis_1", "x")
+ call register_axis(RH_restart, "yaxis_1", "y")
+ call register_axis(RH_restart, "zaxis_1", size(rhsum, 3))
+
+ !< Register the domain decomposed dimensions as variables so that the combiner can work
+ !! correctly
+ call register_field(RH_restart, dim_names(1), "double", (/dim_names(1)/))
+ call register_field(RH_restart, dim_names(2), "double", (/dim_names(2)/))
-subroutine rh_clouds_end
+ call register_restart_field(RH_restart, 'nsum', nsum, (/"xaxis_1", "yaxis_1", "Time "/))
+ call register_restart_field(RH_restart, 'rhsum', rhsum, dim_names)
- call save_restart(RH_restart)
+end subroutine rh_register_restart
+
+subroutine rh_clouds_end
+type(FmsNetcdfDomainFile_t) :: RH_restart
+
+ if (open_file(RH_restart,"RESTART/rh_clouds.res.nc","overwrite", rh_domain, is_restart=.true.)) then
+ call rh_register_restart(RH_restart)
+ call write_restart(RH_restart)
+ call add_domain_dimension_data(RH_restart)
+ call close_file(RH_restart)
+ endif
module_is_initialized = .false.
end subroutine rh_clouds_end
+!< Add_dimension_data: Adds dummy data for the domain decomposed axis
+subroutine add_domain_dimension_data(fileobj)
+ type(FmsNetcdfDomainFile_t) :: fileobj !< Fms2io domain decomposed fileobj
+ integer, dimension(:), allocatable :: buffer !< Buffer with axis data
+ integer :: is, ie !< Starting and Ending indices for data
+
+ call get_global_io_domain_indices(fileobj, "xaxis_1", is, ie, indices=buffer)
+ call write_data(fileobj, "xaxis_1", buffer)
+ deallocate(buffer)
+
+ call get_global_io_domain_indices(fileobj, "yaxis_1", is, ie, indices=buffer)
+ call write_data(fileobj, "yaxis_1", buffer)
+ deallocate(buffer)
+
+end subroutine add_domain_dimension_data
+
!#######################################################################
function do_rh_clouds ( ) result (answer)
diff --git a/atmos_param/shallow_conv/shallow_conv.F90 b/atmos_param/shallow_conv/shallow_conv.F90
index de23bafd..e6c5a93f 100644
--- a/atmos_param/shallow_conv/shallow_conv.F90
+++ b/atmos_param/shallow_conv/shallow_conv.F90
@@ -6,9 +6,9 @@ MODULE SHALLOW_CONV_MOD
use Sat_Vapor_Pres_Mod, ONLY: compute_qs, lookup_es_des
use mpp_mod, only: input_nml_file
- use Fms_Mod, ONLY: FILE_EXIST, ERROR_MESG, FATAL, &
- CHECK_NML_ERROR, OPEN_NAMELIST_FILE, &
- CLOSE_FILE, mpp_pe, mpp_root_pe, &
+ use Fms_Mod, ONLY: ERROR_MESG, FATAL, &
+ CHECK_NML_ERROR, &
+ mpp_pe, mpp_root_pe, &
write_version_number, stdlog
use constants_mod, only: Hlv, Cp_Air, RDgas, RVgas, Kappa, grav
@@ -77,7 +77,7 @@ SUBROUTINE SHALLOW_CONV_INIT( kx )
!---------------------------------------------------------------------
! (Intent local)
!---------------------------------------------------------------------
- integer :: unit, io, ierr, logunit
+ integer :: io, ierr, logunit
!=====================================================================
@@ -87,23 +87,8 @@ SUBROUTINE SHALLOW_CONV_INIT( kx )
! --- Read namelist
!---------------------------------------------------------------------
-#ifdef INTERNAL_FILE_NML
read (input_nml_file, nml=shallow_conv_nml, iostat=io)
ierr = check_nml_error(io,"shallow_conv_nml")
-#else
- if( FILE_EXIST( 'input.nml' ) ) then
-! -------------------------------------
- unit = OPEN_NAMELIST_FILE ( )
- ierr = 1
- do while( ierr .ne. 0 )
- READ ( unit, nml = shallow_conv_nml, iostat = io, end = 10 )
- ierr = CHECK_NML_ERROR(io,'shallow_conv_nml')
- end do
-10 continue
- CALL CLOSE_FILE ( unit )
-! -------------------------------------
- end if
-#endif
!------- write version number and namelist ---------
diff --git a/atmos_param/shallow_cu/conv_plumes_k.F90 b/atmos_param/shallow_cu/conv_plumes_k.F90
index b958428f..74c80d6d 100644
--- a/atmos_param/shallow_cu/conv_plumes_k.F90
+++ b/atmos_param/shallow_cu/conv_plumes_k.F90
@@ -543,7 +543,10 @@ subroutine cumulus_plume_k (cpn, sd, ac, cp, rkm, cbmf, wrel, scaleh,&
! yim's CONVECTIVE NUCLEATION
!==================================================
ptmp=(sd%dp(krel-1)/Uw_p%grav)/sd%dz(krel-1)*1.0e-3
- totalmass1(:)=sd%amx(krel-1,1:4)*ptmp !convert mixing ratio kg/kg to g/cm3
+ totalmass1(1)=sd%amx1(krel-1)*ptmp !convert mixing ratio kg/kg to g/cm3
+ totalmass1(2)=sd%amx2(krel-1)*ptmp !convert mixing ratio kg/kg to g/cm3
+ totalmass1(3)=sd%amx3(krel-1)*ptmp !convert mixing ratio kg/kg to g/cm3
+ totalmass1(4)=sd%amx4(krel-1)*ptmp !convert mixing ratio kg/kg to g/cm3
if (cpn%do_new_qnact) then
totalmass = totalmass1
@@ -774,7 +777,10 @@ subroutine cumulus_plume_k (cpn, sd, ac, cp, rkm, cbmf, wrel, scaleh,&
if (cpn%do_new_qnact) then
if(cpn%do_2nd_act) then
emass=cp%fer(k)*cp%dp(k) !entrained ambient air mass (kg) per unit kg of updraft air mass
- totalmass(:)=sd%amx(k,1:4)*emass; !entrained aerosol mass per unit kg of updraft air mass
+ totalmass(1)=sd%amx1(k)*emass; !entrained aerosol mass per unit kg of updraft air mass
+ totalmass(2)=sd%amx2(k)*emass; !entrained aerosol mass per unit kg of updraft air mass
+ totalmass(3)=sd%amx3(k)*emass; !entrained aerosol mass per unit kg of updraft air mass
+ totalmass(4)=sd%amx4(k)*emass; !entrained aerosol mass per unit kg of updraft air mass
totalmass(:)=totalmass(:)*sd%rho(k)*1.0e-3 !convert mixing ratio kg/kg to g/cm3
wlev = cp%wu(k-1)
diff --git a/atmos_param/shallow_cu/conv_utilities_k.F90 b/atmos_param/shallow_cu/conv_utilities_k.F90
index e475f43e..db618781 100644
--- a/atmos_param/shallow_cu/conv_utilities_k.F90
+++ b/atmos_param/shallow_cu/conv_utilities_k.F90
@@ -47,6 +47,8 @@ MODULE CONV_UTILITIES_k_MOD
real, _ALLOCATABLE :: thvtop(:)_NULL, qn (:)_NULL, qs (:)_NULL
real, _ALLOCATABLE :: am1 (:)_NULL, am2 (:)_NULL, am3 (:)_NULL
real, _ALLOCATABLE :: am4 (:)_NULL, dthvdp(:)_NULL
+ real, _ALLOCATABLE :: amx1 (:)_NULL, amx2 (:)_NULL, amx3 (:)_NULL
+ real, _ALLOCATABLE :: amx4 (:)_NULL
real, _ALLOCATABLE :: tdt_rad(:)_NULL
real, _ALLOCATABLE :: tdt_dyn(:)_NULL,qvdt_dyn(:)_NULL,qidt_dyn(:)_NULL
real, _ALLOCATABLE :: tdt_dif(:)_NULL,qvdt_dif(:)_NULL,qidt_dif(:)_NULL
@@ -59,7 +61,7 @@ MODULE CONV_UTILITIES_k_MOD
real, _ALLOCATABLE :: hf0 (:)_NULL, ddp_dyn(:)_NULL, hdp_dyn(:)_NULL
real, _ALLOCATABLE :: hfint(:)_NULL, hfintn(:)_NULL, dpint(:)_NULL
!++++yim
- real, _ALLOCATABLE :: tr (:,:)_NULL, sstr(:,:)_NULL, amx(:,:)_NULL
+ real, _ALLOCATABLE :: tr (:,:)_NULL, sstr(:,:)_NULL
end type sounding
public adicloud
@@ -227,7 +229,10 @@ subroutine sd_init_k(kd, num_tracers, sd)
allocate ( sd%am2 (1:kd)); sd%am2 =0.;
allocate ( sd%am3 (1:kd)); sd%am3 =0.;
allocate ( sd%am4 (1:kd)); sd%am4 =0.;
- allocate ( sd%amx (1:kd,1:5));sd%amx=0.;
+ allocate ( sd%amx1 (1:kd)); sd%amx1 =0.;
+ allocate ( sd%amx2 (1:kd)); sd%amx2 =0.;
+ allocate ( sd%amx3 (1:kd)); sd%amx3 =0.;
+ allocate ( sd%amx4 (1:kd)); sd%amx4 =0.;
allocate ( sd%dthvdp(1:kd)); sd%dthvdp=0.;
allocate ( sd%hl (1:kd)); sd%hl =0.;
allocate ( sd%hm (1:kd)); sd%hm =0.;
@@ -311,7 +316,9 @@ subroutine sd_copy_k(sd, sd1)
sd1%ql = sd%ql; sd1%qi =sd%qi;
sd1%qa = sd%qa; sd1%qn =sd%qn;
sd1%am1 = sd%am1; sd1%am2 =sd%am2;
- sd1%am3 = sd%am3; sd1%am4 =sd%am4; sd1%amx=sd%amx;
+ sd1%am3 = sd%am3; sd1%am4 =sd%am4;
+ sd1%amx1 = sd%amx1; sd1%amx2 =sd%amx2;
+ sd1%amx3 = sd%amx3; sd1%amx4 =sd%amx4;
sd1%hl = sd%hl; sd1%sshl =sd%sshl;
sd1%hm = sd%hm; sd1%hms =sd%hms;
sd1%omg = sd%omg; sd1%hf0 = sd%hf0;
@@ -328,7 +335,8 @@ subroutine sd_end_k(sd)
sd%thv, sd%rh, sd%p, sd%z, sd%dp, sd%dz, sd%rho, sd%nu, sd%leff, &
sd%exner, sd%ps, sd%exners, sd%zs, sd%ssthc, sd%ssqct, sd%dudp, &
sd%dvdp, sd%thvbot, sd%thvtop, sd%qn, sd%am1, sd%am2, sd%am3, sd%am4,&
- sd%qs, sd%hl, sd%hm, sd%hf0, sd%hms, sd%sshl, sd%tr, sd%sstr, sd%amx,&
+ sd%amx1, sd%amx2, sd%amx3, sd%amx4, &
+ sd%qs, sd%hl, sd%hm, sd%hf0, sd%hms, sd%sshl, sd%tr, sd%sstr, &
sd%omg, sd%qtflx_up, sd%qtflx_dn, sd%omega_up, sd%omega_dn, &
sd%hdt_vadv, sd%hdt_forc )
end subroutine sd_end_k
@@ -397,7 +405,8 @@ end subroutine ac_end_k
!#####################################################################
subroutine pack_sd_k (land, coldT, delt, pmid, pint, zmid, zint, &
- u, v, omg, t, qv, ql, qi, qa, qn, am1, am2, am3, am4, amx,&
+ u, v, omg, t, qv, ql, qi, qa, qn, am1, am2, am3, am4, &
+ amx1, amx2, amx3, amx4, &
tracers, src_choice, tdt_rad, tdt_dyn, qvdt_dyn, qidt_dyn,&
dgz_dyn, ddp_dyn, tdt_dif, dgz_phy, qvdt_dif, qidt_dif, sd, Uw_p)
@@ -410,10 +419,11 @@ subroutine pack_sd_k (land, coldT, delt, pmid, pint, zmid, zint, &
real, intent(in), dimension(:) :: u, v, omg !wind profile (m/s)
real, intent(in), dimension(:) :: t, qv !temperature and specific humidity
real, intent(in), dimension(:) :: ql, qi, qa, qn !cloud tracers
- real, intent(in), dimension(:) :: am1, am2, am3, am4 ! aerosal species
+ real, intent(in), dimension(:) :: am1, am2, am3, am4 ! aerosal species
+ real, intent(in), dimension(:) :: amx1, amx2, amx3, amx4 ! aerosal species
real, intent(in), dimension(:) :: tdt_rad, tdt_dyn, qvdt_dyn, qidt_dyn, dgz_dyn, ddp_dyn, dgz_phy
real, intent(in), dimension(:) :: tdt_dif, qvdt_dif, qidt_dif
- real, intent(in), dimension(:,:) :: tracers, amx !env. tracers
+ real, intent(in), dimension(:,:) :: tracers !env. tracers
type(sounding), intent(inout) :: sd
type(uw_params), intent(inout) :: Uw_p
@@ -452,7 +462,10 @@ subroutine pack_sd_k (land, coldT, delt, pmid, pint, zmid, zint, &
sd % am2 (k) = am2(nk)
sd % am3 (k) = am3(nk)
sd % am4 (k) = am4(nk)
- sd % amx(k,:) = amx(nk,:)
+ sd % amx1 (k) = amx1(nk)
+ sd % amx2 (k) = amx2(nk)
+ sd % amx3 (k) = amx3(nk)
+ sd % amx4 (k) = amx4(nk)
sd % tdt_rad (k) = tdt_rad(nk)
sd % tdt_dyn (k) = tdt_dyn(nk)
sd % qvdt_dyn(k) = qvdt_dyn(nk)
diff --git a/atmos_param/shallow_cu/uw_conv.F90 b/atmos_param/shallow_cu/uw_conv.F90
index 10bb7218..dec90f21 100644
--- a/atmos_param/shallow_cu/uw_conv.F90
+++ b/atmos_param/shallow_cu/uw_conv.F90
@@ -6,10 +6,10 @@ MODULE UW_CONV_MOD
use Diag_Manager_Mod, ONLY: register_diag_field, send_data
use Time_Manager_Mod, ONLY: time_type, get_time
use mpp_mod, only : input_nml_file
- use fms_mod, only : write_version_number, open_namelist_file, check_nml_error,&
- FILE_EXIST, ERROR_MESG, &
+ use fms_mod, only : write_version_number, check_nml_error,&
+ ERROR_MESG, &
lowercase, &
- CLOSE_FILE, FATAL, NOTE
+ FATAL, NOTE
use field_manager_mod, only: MODEL_ATMOS
use tracer_manager_mod, only: get_tracer_names, query_method, &
get_tracer_index, NO_TRACER
@@ -407,7 +407,7 @@ SUBROUTINE UW_CONV_INIT(do_strat, axes, Time, kd, Nml_mp, tracers_in_uw)
!
!-------------------------------------------------------------------
- integer :: unit, io
+ integer :: io
integer :: ntracers, n, nn, ierr, logunit
logical :: flag
@@ -426,7 +426,6 @@ SUBROUTINE UW_CONV_INIT(do_strat, axes, Time, kd, Nml_mp, tracers_in_uw)
call exn_init_k (Uw_p)
call findt_init_k (Uw_p)
-#ifdef INTERNAL_FILE_NML
read (input_nml_file, nml=uw_closure_nml, iostat=io)
ierr = check_nml_error(io,'uw_closure_nml')
read (input_nml_file, nml=uw_conv_nml, iostat=io)
@@ -437,52 +436,6 @@ SUBROUTINE UW_CONV_INIT(do_strat, axes, Time, kd, Nml_mp, tracers_in_uw)
ierr = check_nml_error(io,'deep_conv_nml')
read (input_nml_file, nml=idealized_forcing_nml, iostat=io)
ierr = check_nml_error(io,'idealized_forcing_nml')
-#else
- if( FILE_EXIST( 'input.nml' ) ) then
- unit = OPEN_NAMELIST_FILE ()
- io = 1
- do while ( io .ne. 0 )
- READ( unit, nml = uw_closure_nml, iostat = io, end = 10 )
- ierr = check_nml_error(io,'uw_closure_nml')
- end do
-10 call close_file ( unit )
-
- unit = OPEN_NAMELIST_FILE ()
- io = 1
- do while ( io .ne. 0 )
- READ( unit, nml = uw_conv_nml, iostat = io, end = 20 )
- ierr = check_nml_error(io,'uw_conv_nml')
- end do
-20 call close_file ( unit )
-
- unit = OPEN_NAMELIST_FILE ()
- io = 1
- do while ( io .ne. 0 )
- READ( unit, nml = uw_plume_nml, iostat = io, end = 30 )
- ierr = check_nml_error(io,'uw_plume_nml')
- end do
-30 call close_file ( unit )
-
-!========Option for deep convection=======================================
- unit = OPEN_NAMELIST_FILE ()
- io = 1
- do while ( io .ne. 0 )
- READ( unit, nml = deep_conv_nml, iostat = io, end = 40 )
- ierr = check_nml_error(io,'deep_conv_nml')
- end do
-40 call close_file ( unit )
-!========Option for deep convection=======================================
-!========Option for idealized forcing=====================================
- unit = OPEN_NAMELIST_FILE ()
- io = 1
- do while ( io .ne. 0 )
- READ( unit, nml = idealized_forcing_nml, iostat = io, end = 40 )
- ierr = check_nml_error(io,'idealized_forcing_nml')
- end do
-50 call close_file ( unit )
-!========Option for idealized forcing=====================================
- end if
-#endif
use_online_aerosol = Nml_mp%use_online_aerosol
use_sub_seasalt = Nml_mp%use_sub_seasalt
@@ -1308,8 +1261,9 @@ SUBROUTINE uw_conv(is, js, Time, tb, qv, ub, vb, pmid,pint,zmid,zint, & !input
integer :: seedperm = 0
!========Option for deep convection=======================================
- real, dimension(size(tb,3)) :: am1, am2, am3, am4, am5, qntmp
- real, dimension(size(tb,3),5) :: amx
+ real, dimension(size(tb,3)) :: qntmp
+ real, dimension(size(tb,1),size(tb,2),size(tb,3)) :: am1, am2, am3, am4, am5, am_tmp
+ real, dimension(size(tb,1),size(tb,2),size(tb,3)) :: amx1, amx2, amx3, amx4, amx5, amx_tmp
real, dimension(size(tb,1),size(tb,2),size(tb,3)) :: pmass ! layer mass (kg/m2)
real, dimension(size(tb,1),size(tb,2)) :: tempdiag ! temporary diagnostic variable
@@ -1528,7 +1482,9 @@ SUBROUTINE uw_conv(is, js, Time, tb, qv, ub, vb, pmid,pint,zmid,zint, & !input
cqa =0.; cql =0.; cqi =0.; cqn =0.;
cqa_s=0.; cql_s=0.; cqi_s=0.; cqn_s=0.;
- hlflx=0.; qtflx=0.; nqtflx=0.; pflx=0.; am1=0.; am2=0.; am3=0.; am4=0.; amx=0.;
+ hlflx=0.; qtflx=0.; nqtflx=0.; pflx=0.;
+ am1=0.; am2=0.; am3=0.; am4=0.; am5=0.;
+ amx1=0.; amx2=0.; amx3=0.; amx4=0.; amx5=0.;
tten_pevap=0.; qvten_pevap=0.; temp=0.;
ice_pflx = 0. ; liq_pflx = 0.; qtflx_up=0.; qtflx_dn=0.;
omega_up=0.; omega_dn=0.; omgmc_up=0.;
@@ -1592,35 +1548,150 @@ SUBROUTINE uw_conv(is, js, Time, tb, qv, ub, vb, pmid,pint,zmid,zint, & !input
end if
do k=1,kmax
- do j = 1, jmax
- do i=1, imax
- pmass(i,j,k) = (pint(i,j,k+1) - pint(i,j,k))/GRAV
- enddo
- enddo
+ pmass(:,:,k) = (pint(:,:,k+1) - pint(:,:,k))/GRAV
enddo
- do j = 1, jmax
- do i=1, imax
- trtend_t=0.; trwet_t=0.;
+
+ if(use_online_aerosol) then
+
+ do k=1,kmax
+ am_tmp(:,:,k) = 1./(zint(:,:,k)-zint(:,:,k+1)) * 1.0e-3
+ amx_tmp(:,:,k) = 1./pmass(:,:,k)
+ end do
+
+ do na = 1,naer
+ if(asol%aerosol_names(na) == 'so4' .or. &
+ asol%aerosol_names(na) == 'so4_anthro' .or. &
+ asol%aerosol_names(na) == 'so4_natural') then !aerosol unit: kg/m2
+ do k=1,kmax
+ do j = 1, jmax
+ do i=1, imax
+ am1(i,j,k)=am1(i,j,k)+asol%aerosol(i,j,k,na)*am_tmp(i,j,k) !am1 unit: g/cm3
+ amx1(i,j,k)=amx1(i,j,k)+asol%aerosol(i,j,k,na)*amx_tmp(i,j,k) !amx unit: kg/kg
+ end do
+ end do
+ end do
+ else if(asol%aerosol_names(na) == 'omphilic' .or. &
+ asol%aerosol_names(na) == 'omphobic') then
+ do k=1,kmax
+ do j = 1, jmax
+ do i=1, imax
+ am4(i,j,k)=am4(i,j,k)+asol%aerosol(i,j,k,na)*am_tmp(i,j,k)
+ amx4(i,j,k)=amx4(i,j,k)+asol%aerosol(i,j,k,na)*amx_tmp(i,j,k)
+ end do
+ end do
+ end do
+ else if(asol%aerosol_names(na) == 'bcphilic' .or. &
+ asol%aerosol_names(na) == 'bcphobic' .or. &
+ asol%aerosol_names(na) == 'dust1' .or. &
+ asol%aerosol_names(na) == 'dust2' .or. &
+ asol%aerosol_names(na) == 'dust3' .or. &
+ asol%aerosol_names(na) == 'dust_mode1_of_2') then !h1g, 2015-09-19
+ do k=1,kmax
+ do j = 1, jmax
+ do i=1, imax
+ am2(i,j,k)=am2(i,j,k)+asol%aerosol(i,j,k,na)*am_tmp(i,j,k)
+ amx2(i,j,k)=amx2(i,j,k)+asol%aerosol(i,j,k,na)*amx_tmp(i,j,k)
+ end do
+ end do
+ end do
+ else if(asol%aerosol_names(na) == 'seasalt1' .or. &
+ asol%aerosol_names(na) == 'seasalt2' .or. &
+ asol%aerosol_names(na) == 'seasalt_aitken' .or. & !h1g, 2015-09-19
+ asol%aerosol_names(na) == 'seasalt_fine' ) then !h1g, 2015-09-19
+ do k=1,kmax
+ do j = 1, jmax
+ do i=1, imax
+ am3(i,j,k)=am3(i,j,k)+asol%aerosol(i,j,k,na)*am_tmp(i,j,k)
+ amx3(i,j,k)=amx3(i,j,k)+asol%aerosol(i,j,k,na)*amx_tmp(i,j,k)
+ end do
+ end do
+ end do
+ else if(.not. use_sub_seasalt) then
+ if(asol%aerosol_names(na) == 'seasalt3' .or. &
+ asol%aerosol_names(na) == 'seasalt4' .or. &
+ asol%aerosol_names(na) == 'seasalt5' .or. &
+ asol%aerosol_names(na) == 'seasalt_coarse') then !h1g, 2015-09-19
+ do k=1,kmax
+ do j = 1, jmax
+ do i=1, imax
+ am5(i,j,k)=am5(i,j,k)+asol%aerosol(i,j,k,na)*am_tmp(i,j,k)
+ amx5(i,j,k)=amx5(i,j,k)+asol%aerosol(i,j,k,na)*amx_tmp(i,j,k)
+ end do
+ end do
+ end do
+ end if
+ end if
+ end do
+
+ am2(:,:,:) =am2(:,:,:) +am3(:,:,:) +am4(:,:,:)
+ amx2(:,:,:)=amx2(:,:,:)+amx3(:,:,:)+amx4(:,:,:)
+ if(.not. use_sub_seasalt) then
+ am3(:,:,:)=am3(:,:,:)+am5(:,:,:)
+ amx3(:,:,:)=amx3(:,:,:)+amx5(:,:,:)
+ end if
+ else ! use_online_aerosol
+ do k=1,kmax
+ do j = 1, jmax
+ do i=1, imax
+ am2(i,j,k) = asol%aerosol(i,j,k,1)*am_tmp(i,j,k)
+ amx2(i,j,k)= asol%aerosol(i,j,k,1)*amx_tmp(i,j,k)
+ end do
+ end do
+ end do
+ do k=1,kmax
+ do j = 1, jmax
+ do i=1, imax
+ am1(i,j,k) = asol%aerosol(i,j,k,2)*am_tmp(i,j,k)
+ amx1(i,j,k)= asol%aerosol(i,j,k,2)*amx_tmp(i,j,k)
+ end do
+ end do
+ end do
+ do k=1,kmax
+ do j = 1, jmax
+ do i=1, imax
+ am4(i,j,k) = om_to_oc*asol%aerosol(i,j,k,3)*am_tmp(i,j,k)
+ amx4(i,j,k)= om_to_oc*asol%aerosol(i,j,k,3)*amx_tmp(i,j,k)
+ end do
+ end do
+ end do
+ do k=1,kmax
+ do j = 1, jmax
+ do i=1, imax
+ am3(i,j,k) = sea_salt_scale*asol%aerosol(i,j,k,5)*am_tmp(i,j,k)
+ amx3(i,j,k)= sea_salt_scale*asol%aerosol(i,j,k,5)*amx_tmp(i,j,k)
+ end do
+ end do
+ end do
+ endif ! use_online_aerosol
+
!relaxation TKE back to 0 with time-scale of disscale
!tkeavg = ustar(i,j)*bstar(i,j)*disscale
!dissipate tke with length-scale of disscale
!tkeavg=(ustar(i,j)*bstar(i,j)*disscale)**(2./3.)
!below following Holtslag and Boville 1993
+ do j = 1, jmax
+ do i=1, imax
+ if (pblht(i,j).lt.0.) then
+ temp_1=0.0
+ elseif (pblht(i,j).gt.5000.) then
+ temp_1=5000.
+ else
+ temp_1=pblht(i,j)
+ endif
+
+! bflux(i,j) = 0.5*(0.6*ustar(i,j)*bstar(i,j)*temp_1)**(2./3.)
+ temp_1=ustar(i,j)**3.+0.6*ustar(i,j)*bstar(i,j)*temp_1
+ if (temp_1 .gt. 0.) temp_1 = 0.5*temp_1**(2./3.)
+ tkeo(i,j) = MAX (tkemin, temp_1)
+ end do
+ end do
- if (pblht(i,j).lt.0.) then
- temp_1=0.0
- elseif (pblht(i,j).gt.5000.) then
- temp_1=5000.
- else
- temp_1=pblht(i,j)
- endif
-! bflux(i,j) = 0.5*(0.6*ustar(i,j)*bstar(i,j)*temp_1)**(2./3.)
- temp_1=ustar(i,j)**3.+0.6*ustar(i,j)*bstar(i,j)*temp_1
- if (temp_1 .gt. 0.) temp_1 = 0.5*temp_1**(2./3.)
- tkeo(i,j) = MAX (tkemin, temp_1)
+ do j = 1, jmax
+ do i=1, imax
+ trtend_t=0.; trwet_t=0.;
cbmf_shallow=0. ! Set cbmf_shallow to avoid usage before assignment.
if (skip_calculation(i,j)) then
ocode(i,j) = 6
@@ -1637,62 +1708,6 @@ SUBROUTINE uw_conv(is, js, Time, tb, qv, ub, vb, pmid,pint,zmid,zint, & !input
cush(i,j) = -1.;
if(cc%scaleh.le.0.0) cc%scaleh=1000.
- am1(:) = 0.; am2(:) = 0.; am3(:) = 0.; am4(:) = 0.; am5(:) = 0.;
- amx(:,:)=0. !amx contains mixing ratio (kg/kg)
-
- do k=1,kmax
- tmp=1. / (zint(i,j,k)-zint(i,j,k+1)) * 1.0e9 * 1.0e-12
- tmp1=1./pmass(i,j,k)
- if(use_online_aerosol) then
- do na = 1,naer
- if(asol%aerosol_names(na) == 'so4' .or. &
- asol%aerosol_names(na) == 'so4_anthro' .or. &
- asol%aerosol_names(na) == 'so4_natural') then !aerosol unit: kg/m2
- am1(k)=am1(k)+asol%aerosol(i,j,k,na)*tmp !am1 unit: g/cm3
- amx(k,1)=amx(k,1)+asol%aerosol(i,j,k,na)*tmp1 !am1 unit: kg/kg
- else if(asol%aerosol_names(na) == 'omphilic' .or. &
- asol%aerosol_names(na) == 'omphobic') then
- am4(k)=am4(k)+asol%aerosol(i,j,k,na)*tmp
- amx(k,4)=amx(k,4)+asol%aerosol(i,j,k,na)*tmp1
- else if(asol%aerosol_names(na) == 'bcphilic' .or. &
- asol%aerosol_names(na) == 'bcphobic' .or. &
- asol%aerosol_names(na) == 'dust1' .or. &
- asol%aerosol_names(na) == 'dust2' .or. &
- asol%aerosol_names(na) == 'dust3' .or. &
- asol%aerosol_names(na) == 'dust_mode1_of_2') then !h1g, 2015-09-19
- am2(k)=am2(k)+asol%aerosol(i,j,k,na)*tmp
- amx(k,2)=amx(k,2)+asol%aerosol(i,j,k,na)*tmp1
- else if(asol%aerosol_names(na) == 'seasalt1' .or. &
- asol%aerosol_names(na) == 'seasalt2' .or. &
- asol%aerosol_names(na) == 'seasalt_aitken' .or. & !h1g, 2015-09-19
- asol%aerosol_names(na) == 'seasalt_fine' ) then !h1g, 2015-09-19
- am3(k)=am3(k)+asol%aerosol(i,j,k,na)*tmp
- amx(k,3)=amx(k,3)+asol%aerosol(i,j,k,na)*tmp1
- else if(asol%aerosol_names(na) == 'seasalt3' .or. &
- asol%aerosol_names(na) == 'seasalt4' .or. &
- asol%aerosol_names(na) == 'seasalt5' .or. &
- asol%aerosol_names(na) == 'seasalt_coarse') then !h1g, 2015-09-19
- am5(k)=am5(k)+asol%aerosol(i,j,k,na)*tmp
- amx(k,5)=amx(k,5)+asol%aerosol(i,j,k,na)*tmp1
- end if
- end do
- am2(k)=am2(k)+am3(k)+am4(k)
- amx(k,2)=amx(k,2)+amx(k,3)+amx(k,4)
- if(.not. use_sub_seasalt) then
- am3(k)=am3(k)+am5(k)
- amx(k,3)=amx(k,3)+amx(k,5)
- end if
- else
- am1(k)= asol%aerosol(i,j,k,2)*tmp
- am2(k)= asol%aerosol(i,j,k,1)*tmp
- am3(k)= sea_salt_scale*asol%aerosol(i,j,k,5)*tmp
- am4(k)= om_to_oc*asol%aerosol(i,j,k,3)*tmp
- amx(k,1)= asol%aerosol(i,j,k,2)*tmp1
- amx(k,2)= asol%aerosol(i,j,k,1)*tmp1
- amx(k,3)= sea_salt_scale*asol%aerosol(i,j,k,5)*tmp1
- amx(k,4)= om_to_oc*asol%aerosol(i,j,k,3)*tmp1
- endif
- end do
!========Pack column properties into a sounding structure====================
@@ -1703,10 +1718,13 @@ SUBROUTINE uw_conv(is, js, Time, tb, qv, ub, vb, pmid,pint,zmid,zint, & !input
end if
ksrc=1
tdt_dif(i,j,:)=tdt_tot(i,j,:)-tdt_rad(i,j,:);
+
call pack_sd_k(land(i,j), coldT(i,j), delt, pmid(i,j,:), pint(i,j,:), &
zmid(i,j,:), zint(i,j,:), ub(i,j,:), vb(i,j,:), omega(i,j,:), tb(i,j,:), &
qv(i,j,:), qtr(i,j,:,nql), qtr(i,j,:,nqi), qtr(i,j,:,nqa), qntmp, &
- am1(:), am2(:), am3(:), am4(:), amx(:,:), tracers(i,j,:,:), src_choice, &
+ am1(i,j,:), am2(i,j,:), am3(i,j,:), am4(i,j,:), &
+ amx1(i,j,:), amx2(i,j,:), amx3(i,j,:), amx4(i,j,:), &
+ tracers(i,j,:,:), src_choice, &
tdt_rad(i,j,:), tdt_dyn(i,j,:), qvdt_dyn(i,j,:), qidt_dyn(i,j,:), &
dgz_dyn(i,j,:), ddp_dyn(i,j,:), tdt_dif(i,j,:), dgz_phy(i,j,:), &
qvdt_dif(i,j,:), qidt_dif(i,j,:), sd, Uw_p)
@@ -1889,7 +1907,8 @@ SUBROUTINE uw_conv(is, js, Time, tb, qv, ub, vb, pmid,pint,zmid,zint, & !input
end if
if (do_eis_limitn) then
if (sd%eis .gt. eis_max) then
- ocode(i,j)=10; cbmf_shallow=0.; goto 200
+ ocode(i,j)=10; cbmf_shallow=0.;
+ goto 200
end if
end if
if (do_lts_limit) then
@@ -1899,7 +1918,8 @@ SUBROUTINE uw_conv(is, js, Time, tb, qv, ub, vb, pmid,pint,zmid,zint, & !input
end if
if (do_lts_limitn) then
if (sd%lts .gt. eis_max) then
- ocode(i,j)=10; cbmf_shallow=0.; goto 200
+ ocode(i,j)=10; cbmf_shallow=0.;
+ goto 200
end if
end if
@@ -1972,11 +1992,15 @@ SUBROUTINE uw_conv(is, js, Time, tb, qv, ub, vb, pmid,pint,zmid,zint, & !input
fero_s(i,j,nk) = cp%fer(k)
fdro_s(i,j,nk) = cp%fdr(k)
fdrso_s(i,j,nk)= cp%fdrsat(k)*cp%fdr(k)!*cp%umf(k)
+ enddo
- do n = 1, size(trtend,4)
+ do n = 1, size(trtend,4)
+ do k = 1,cp%ltop
+ nk = kmax+1-k
trevp_s(i,j,nk,n) = ct%trevp(k,n)
- enddo
+ enddo
enddo
+
cush_s(i,j) = cp%cush
snow (i,j) = ct%snow
rain (i,j) = ct%rain
@@ -2000,9 +2024,9 @@ SUBROUTINE uw_conv(is, js, Time, tb, qv, ub, vb, pmid,pint,zmid,zint, & !input
! cp%tr, ct%trten, ct%trwet)
call check_tracer_realizability (kmax, size(trtend,4), delt, &
cp%tr, ct%trten, ct%trwet, pmass(i,j,:), tracer_check_type, rn = rn )
- do k = 1,cp%ltop
- nk = kmax+1-k
- do n = 1, size(trtend,4)
+ do n = 1, size(trtend,4)
+ do k = 1,cp%ltop
+ nk = kmax+1-k
trtend(i,j,nk,n) = ct%trten(k,n) + ct%trwet(k,n)
trwet(i,j,nk,n) = ct%trwet(k,n)
rn_diag(i,j,nk,n) = rn(k,n)
@@ -2173,80 +2197,103 @@ SUBROUTINE uw_conv(is, js, Time, tb, qv, ub, vb, pmid,pint,zmid,zint, & !input
enddo
enddo
- uten (i,j,:) = uten (i,j,:) + uten_d (i,j,:)
- vten (i,j,:) = vten (i,j,:) + vten_d (i,j,:)
- qlten (i,j,:) = qlten (i,j,:) + qlten_d (i,j,:)
- qiten (i,j,:) = qiten (i,j,:) + qiten_d (i,j,:)
- qaten (i,j,:) = qaten (i,j,:) + qaten_d (i,j,:)
- qnten (i,j,:) = qnten (i,j,:) + qnten_d (i,j,:)
- qvten (i,j,:) = qvten (i,j,:) + qvten_d (i,j,:)
- tten (i,j,:) = tten (i,j,:) + tten_d (i,j,:)
- pflx (i,j,:) = pflx (i,j,:) + pflx_d (i,j,:)
- hlflx (i,j,:) = hlflx (i,j,:) + hlflx_d (i,j,:)
- qtflx (i,j,:) = qtflx (i,j,:) + qtflx_d (i,j,:)
- nqtflx(i,j,:) = nqtflx(i,j,:) + nqtflx_d(i,j,:)
- cmf (i,j,:) = cmf_s (i,j,:) + cmf_d (i,j,:)
- tten_pevap (i,j,:)=tten_pevap (i,j,:) + tten_pevap_d (i,j,:)
- qvten_pevap(i,j,:)=qvten_pevap(i,j,:) + qvten_pevap_d(i,j,:)
-
- if (do_new_convcld) then
- cqa(kmax+1)=0.; cql(kmax+1)=0.; cqi(kmax+1)=0.; cqn(kmax+1)=0.;
- do k = 1,kmax
- cqa(k) =cqa_s(i,j,k)+cqa_d(i,j,k)
- if (cqa(k).ne.0.) then
- cql(k)=(cql_s(i,j,k)*cqa_s(i,j,k)+cql_d(i,j,k)*cqa_d(i,j,k))/cqa(k)
- cqi(k)=(cqi_s(i,j,k)*cqa_s(i,j,k)+cqi_d(i,j,k)*cqa_d(i,j,k))/cqa(k)
- cqn(k)=(cqn_s(i,j,k)*cqa_s(i,j,k)+cqn_d(i,j,k)*cqa_d(i,j,k))/cqa(k)
- else
- cql(k)=0.
- cqi(k)=0.
- cqn(k)=0.
- end if
- cqa(k) = min(cqa(k),1.0)
- end do
- do k = 1,kmax
- cldqa(i,j,k)=(cqa(k)+cqa(k+1))*0.5
- cldql(i,j,k)=(cql(k)+cql(k+1))*0.5
- cldqi(i,j,k)=(cqi(k)+cqi(k+1))*0.5
- cldqn(i,j,k)=(cqn(k)+cqn(k+1))*0.5
- end do
-
- do k = 1,kmax
- cltc (i,j) = max(cltc(i,j),cldqa(i,j,k)) !assuming maximum overlap
- end do
- end if
-
- snow (i,j) = snow (i,j) + snow_d (i,j)
- rain (i,j) = rain (i,j) + rain_d (i,j)
- denth (i,j) = denth (i,j) + denth_d (i,j)
- dting (i,j) = dting (i,j) + dting_d (i,j)
- dqtmp (i,j) = dqtmp (i,j) + dqtmp_d (i,j)
cpool (i,j) = cpool (i,j) + ct1%cpool
-
- feq_c (i,j) = max(feq_s(i,j), feq_d(i,j))
- pcb_c (i,j) = max(pcb_s(i,j), pcb_d(i,j))
- pct_c (i,j) = min(max(pct_s(i,j),0.), max(pct_d(i,j),0.))
!cbmfo (i,j) = cc%cbmf
!cwfno (i,j) = cc%cwfn
end if
-!========End of do_deep, Option for deep convection=======================================
+ enddo
+ enddo
-200 if (do_prog_gust) then
- gusto(i,j)=(gusto(i,j)+geff*cpool(i,j)*delt)/(1+delt/tau_gust)
- endif
+ if (do_deep) then
+ do k = 1,kmax
+ do j = 1,jmax
+ do i = 1,imax
+ uten (i,j,k) = uten (i,j,k) + uten_d (i,j,k)
+ vten (i,j,k) = vten (i,j,k) + vten_d (i,j,k)
+ qlten (i,j,k) = qlten (i,j,k) + qlten_d (i,j,k)
+ qiten (i,j,k) = qiten (i,j,k) + qiten_d (i,j,k)
+ qaten (i,j,k) = qaten (i,j,k) + qaten_d (i,j,k)
+ qnten (i,j,k) = qnten (i,j,k) + qnten_d (i,j,k)
+ qvten (i,j,k) = qvten (i,j,k) + qvten_d (i,j,k)
+ tten (i,j,k) = tten (i,j,k) + tten_d (i,j,k)
+ pflx (i,j,k) = pflx (i,j,k) + pflx_d (i,j,k)
+ hlflx (i,j,k) = hlflx (i,j,k) + hlflx_d (i,j,k)
+ qtflx (i,j,k) = qtflx (i,j,k) + qtflx_d (i,j,k)
+ nqtflx(i,j,k) = nqtflx(i,j,k) + nqtflx_d(i,j,k)
+ cmf (i,j,k) = cmf_s (i,j,k) + cmf_d (i,j,k)
+ tten_pevap (i,j,k)=tten_pevap (i,j,k) + tten_pevap_d (i,j,k)
+ qvten_pevap(i,j,k)=qvten_pevap(i,j,k) + qvten_pevap_d(i,j,k)
+ enddo
+ enddo
+ enddo
-!subtract parameterized convective mass flux
- do k = 1,kmax
- tmp=cmf(i,j,k)*Uw_p%grav;
- if ((-omega_up(i,j,k).gt.tmp) .and. (tmp.gt.0)) then
- omgmc_up(i,j,k) = omega_up(i,j,k)+tmp;
- else
- omgmc_up(i,j,k) = omega_up(i,j,k);
- endif
+ do j = 1,jmax
+ do i = 1,imax
+ snow (i,j) = snow (i,j) + snow_d (i,j)
+ rain (i,j) = rain (i,j) + rain_d (i,j)
+ denth (i,j) = denth (i,j) + denth_d (i,j)
+ dting (i,j) = dting (i,j) + dting_d (i,j)
+ dqtmp (i,j) = dqtmp (i,j) + dqtmp_d (i,j)
+
+ feq_c (i,j) = max(feq_s(i,j), feq_d(i,j))
+ pcb_c (i,j) = max(pcb_s(i,j), pcb_d(i,j))
+ pct_c (i,j) = min(max(pct_s(i,j),0.), max(pct_d(i,j),0.))
enddo
+ enddo
- enddo
- enddo
+ if (do_new_convcld) then
+ do j = 1,jmax
+ do i = 1,imax
+ cqa(kmax+1)=0.; cql(kmax+1)=0.; cqi(kmax+1)=0.; cqn(kmax+1)=0.;
+ do k = 1,kmax
+ cqa(k) =cqa_s(i,j,k)+cqa_d(i,j,k)
+ if (cqa(k).ne.0.) then
+ cql(k)=(cql_s(i,j,k)*cqa_s(i,j,k)+cql_d(i,j,k)*cqa_d(i,j,k))/cqa(k)
+ cqi(k)=(cqi_s(i,j,k)*cqa_s(i,j,k)+cqi_d(i,j,k)*cqa_d(i,j,k))/cqa(k)
+ cqn(k)=(cqn_s(i,j,k)*cqa_s(i,j,k)+cqn_d(i,j,k)*cqa_d(i,j,k))/cqa(k)
+ else
+ cql(k)=0.
+ cqi(k)=0.
+ cqn(k)=0.
+ end if
+ cqa(k) = min(cqa(k),1.0)
+ end do
+ do k = 1,kmax
+ cldqa(i,j,k)=(cqa(k)+cqa(k+1))*0.5
+ cldql(i,j,k)=(cql(k)+cql(k+1))*0.5
+ cldqi(i,j,k)=(cqi(k)+cqi(k+1))*0.5
+ cldqn(i,j,k)=(cqn(k)+cqn(k+1))*0.5
+ end do
+
+ do k = 1,kmax
+ cltc (i,j) = max(cltc(i,j),cldqa(i,j,k)) !assuming maximum overlap
+ end do
+ enddo
+ enddo
+ end if
+ end if
+!========End of do_deep, Option for deep convection=======================================
+
+200 if (do_prog_gust) then
+ do j = 1,jmax
+ do i = 1,imax
+ gusto(i,j)=(gusto(i,j)+geff*cpool(i,j)*delt)/(1+delt/tau_gust)
+ enddo
+ enddo
+ endif
+!subtract parameterized convective mass flux
+ do k = 1,kmax
+ do j = 1,jmax
+ do i = 1,imax
+ tmp=cmf(i,j,k)*Uw_p%grav;
+ if ((-omega_up(i,j,k).gt.tmp) .and. (tmp.gt.0)) then
+ omgmc_up(i,j,k) = omega_up(i,j,k)+tmp
+ else
+ omgmc_up(i,j,k) = omega_up(i,j,k)
+ endif
+ enddo
+ enddo
+ enddo
call sd_end_k(sd)
call sd_end_k(sd1)
@@ -2270,8 +2317,8 @@ SUBROUTINE uw_conv(is, js, Time, tb, qv, ub, vb, pmid,pint,zmid,zint, & !input
(vb(:,:,:) + half_delt*vten(:,:,:))*vten(:,:,:))*cp_inv
!tten(:,:,:) = tten(:,:,:) + dissipative_heat(:,:,:)
else
- uten=0.;
- vten=0.;
+ uten=0.
+ vten=0.
end if
if ( prevent_unreasonable ) then
@@ -2362,17 +2409,29 @@ SUBROUTINE uw_conv(is, js, Time, tb, qv, ub, vb, pmid,pint,zmid,zint, & !input
qlten(i,j,k) = scale_uw(i,j) * qlten(i,j,k)
qiten(i,j,k) = scale_uw(i,j) * qiten(i,j,k)
qaten(i,j,k) = scale_uw(i,j) * qaten(i,j,k)
- if (do_qn) qnten(i,j,k) = scale_uw(i,j) * qnten(i,j,k)
- if (k.eq.kmax) then
- rain(i,j) = scale_uw(i,j) * rain(i,j)
- snow(i,j) = scale_uw(i,j) * snow(i,j)
- rain_d(i,j)=scale_uw(i,j) * rain_d(i,j)
- snow_d(i,j)=scale_uw(i,j) * snow_d(i,j)
- cpool(i,j)= scale_uw(i,j) * cpool(i,j)
- endif
end do
end do
end do
+
+ if (do_qn) then
+ do k=1,kmax
+ do j=1,jmax
+ do i=1,imax
+ qnten(i,j,k) = scale_uw(i,j) * qnten(i,j,k)
+ end do
+ end do
+ end do
+ endif
+
+ do j=1,jmax
+ do i=1,imax
+ rain(i,j) = scale_uw(i,j) * rain(i,j)
+ snow(i,j) = scale_uw(i,j) * snow(i,j)
+ rain_d(i,j)=scale_uw(i,j) * rain_d(i,j)
+ snow_d(i,j)=scale_uw(i,j) * snow_d(i,j)
+ cpool(i,j)= scale_uw(i,j) * cpool(i,j)
+ end do
+ end do
end if
endif !end of prevent_unreasonable
@@ -2391,10 +2450,10 @@ SUBROUTINE uw_conv(is, js, Time, tb, qv, ub, vb, pmid,pint,zmid,zint, & !input
dgz_conv_int(:,:,:)= Uw_p%grav*(zmid_n(:,:,:)-zmid(:,:,:))/delt * pmass(:,:,:)
tdt_conv_int(:,:,:)= Uw_p%cp_air * tten(:,:,:) * pmass(:,:,:)
qdt_conv_int(:,:,:)=(Uw_p%HLv*qvten(:,:,:) - Uw_p%HLf*qiten(:,:,:)) * pmass(:,:,:)
- do k=2, kmax
- dgz_conv_int(:,:,k)= dgz_conv_int(:,:,k)+dgz_conv_int(:,:,k-1)
- tdt_conv_int(:,:,k)= tdt_conv_int(:,:,k)+tdt_conv_int(:,:,k-1)
- qdt_conv_int(:,:,k)= qdt_conv_int(:,:,k)+qdt_conv_int(:,:,k-1)
+ do k=1, kmax-1
+ dgz_conv_int(:,:,k+1)= dgz_conv_int(:,:,k+1)+dgz_conv_int(:,:,k)
+ tdt_conv_int(:,:,k+1)= tdt_conv_int(:,:,k+1)+tdt_conv_int(:,:,k)
+ qdt_conv_int(:,:,k+1)= qdt_conv_int(:,:,k+1)+qdt_conv_int(:,:,k)
end do
hdt_conv_int(:,:,:) = tdt_conv_int(:,:,:)+qdt_conv_int(:,:,:)+dgz_conv_int(:,:,:)
endif !do_mse_budget
@@ -2402,8 +2461,8 @@ SUBROUTINE uw_conv(is, js, Time, tb, qv, ub, vb, pmid,pint,zmid,zint, & !input
cush(:,:) = cush_s(:,:)
do j = 1,jmax
do i = 1,imax
- if (cush_s(i,j) .gt. 0) feq_s(i,j)=1.;
- if (cush_d(i,j) .gt. 0) feq_d(i,j)=1.;
+ if (cush_s(i,j) .gt. 0) feq_s(i,j)=1.
+ if (cush_d(i,j) .gt. 0) feq_d(i,j)=1.
enddo
enddo
@@ -2421,16 +2480,16 @@ SUBROUTINE uw_conv(is, js, Time, tb, qv, ub, vb, pmid,pint,zmid,zint, & !input
if (do_imposing_rad_cooling) then
tten_rad(:,:,:) = 0.0
- do j = 1,jmax
- do i=1,imax
- do k = 1,kmax
- if (tb(i,j,k) .gt. t_thresh) then
- tten_rad (i,j,k) = cooling_rate/86400.
- else
- tten_rad (i,j,k) = (t_strato-tb(i,j,k))/(tau_rad*86400.)
- end if
- enddo
- enddo
+ do k = 1,kmax
+ do j = 1,jmax
+ do i=1,imax
+ if (tb(i,j,k) .gt. t_thresh) then
+ tten_rad (i,j,k) = cooling_rate/86400.
+ else
+ tten_rad (i,j,k) = (t_strato-tb(i,j,k))/(tau_rad*86400.)
+ end if
+ enddo
+ enddo
enddo
! used = send_data( id_tten_rad_uwc,tten_rad*aday,Time, is, js, 1)
end if
@@ -2438,34 +2497,39 @@ SUBROUTINE uw_conv(is, js, Time, tb, qv, ub, vb, pmid,pint,zmid,zint, & !input
if (do_imposing_forcing) then
tten_forc(:,:,:) = 0.0
qten_forc(:,:,:) = 0.0
- do j = 1,jmax
- do i=1,imax
- tten_forc(i,j,:)=0;
- qten_forc(i,j,:)=0;
- if (use_klevel) then
- k = klevel
- tten_forc(i,j,k)=tdt_rate/86400.
- qten_forc(i,j,k)=qdt_rate/86400.
- else
- kbot_tmp=1;
- ktop_tmp=kmax;
- do k=1,kmax
- if (pmid(i,j,k)>=7500) then
- ktop_tmp=k
- end if
- if (pmid(i,j,k)>=85000) then
- kbot_tmp=k
- end if
- enddo
- do k = kbot_tmp,ktop_tmp
- if (pmid(i,j,k)>pres_min .and. pmid(i,j,k)<=pres_max) then
- tten_forc(i,j,k)=tdt_rate/86400.
- qten_forc(i,j,k)=qdt_rate/86400.
- end if
- enddo
- end if
+ if (use_klevel) then
+ k = klevel
+ do j = 1,jmax
+ do i=1,imax
+ tten_forc(i,j,k)=tdt_rate/86400.
+ qten_forc(i,j,k)=qdt_rate/86400.
+ enddo
enddo
- enddo
+ else
+ ! Strided memory accesses here, but k depends on i and j
+ do j = 1,jmax
+ do i=1,imax
+ kbot_tmp = 1
+ ktop_tmp = kmax
+ do k=1,kmax
+ if (pmid(i,j,k)>=7500) then
+ ktop_tmp = k
+ end if
+ if (pmid(i,j,k)>=85000) then
+ kbot_tmp = k
+ end if
+ enddo
+ do k = kbot_tmp,ktop_tmp
+ if (pmid(i,j,k)>pres_min .and. pmid(i,j,k)<=pres_max) then
+ tten_forc(i,j,k)=tdt_rate/86400.
+ qten_forc(i,j,k)=qdt_rate/86400.
+ end if
+ enddo
+ enddo
+ enddo
+ end if
+
+
used = send_data( id_tdt_forc_uwc,tten_forc*aday,Time, is, js, 1)
used = send_data( id_qdt_forc_uwc,qten_forc*aday,Time, is, js, 1)
end if
@@ -2831,11 +2895,11 @@ SUBROUTINE uw_conv(is, js, Time, tb, qv, ub, vb, pmid,pint,zmid,zint, & !input
end if
if (do_imposing_rad_cooling) then
- tten(:,:,:) = tten(:,:,:) + tten_rad(:,:,:)
+ tten(:,:,:) = tten (:,:,:) + tten_rad (:,:,:)
end if
if (do_imposing_forcing) then
- tten(:,:,:) = tten(:,:,:) + tten_forc(:,:,:)
+ tten (:,:,:) = tten (:,:,:) + tten_forc(:,:,:)
qvten(:,:,:) = qvten(:,:,:) + qten_forc(:,:,:)
end if
@@ -2844,7 +2908,7 @@ SUBROUTINE uw_conv(is, js, Time, tb, qv, ub, vb, pmid,pint,zmid,zint, & !input
do k = 1,kmax
do j = 1,jmax
do i = 1,imax
- hten(i,j)=hten(i,j)+(cp_air*tten(i,j,k)+HLv*qvten(i,j,k)-HLv*qiten(i,j,k))*pmass(i,j,k)
+ hten(i,j) = hten(i,j) + (cp_air*tten(i,j,k)+HLv*qvten(i,j,k)-HLv*qiten(i,j,k))*pmass(i,j,k)
enddo
enddo
enddo
diff --git a/atmos_param/shallow_physics/shallow_physics.F90 b/atmos_param/shallow_physics/shallow_physics.F90
index b1a8608c..22dd4521 100644
--- a/atmos_param/shallow_physics/shallow_physics.F90
+++ b/atmos_param/shallow_physics/shallow_physics.F90
@@ -1,8 +1,7 @@
module shallow_physics_mod
use mpp_mod, only: input_nml_file
-use fms_mod, only: open_namelist_file, file_exist, &
- close_file, check_nml_error, &
+use fms_mod, only: check_nml_error, &
error_mesg, FATAL, WARNING, &
write_version_number, stdlog, &
mpp_pe, mpp_root_pe
@@ -61,7 +60,7 @@ subroutine shallow_physics_init_2d (axes, Time, lon, lat)
type(time_type), intent(in) :: Time
real, intent(in) :: lon(:,:), lat(:,:) ! longitude and latitude in radians
-integer :: i, j, unit, ierr, io, logunit
+integer :: i, j, ierr, io, logunit
real :: xm, ym, dm, di
real :: lon_m, lat_m, width_m, width_i, deg2rad
@@ -72,20 +71,8 @@ subroutine shallow_physics_init_2d (axes, Time, lon, lat)
endif
! read the namelist
-#ifdef INTERNAL_FILE_NML
read (input_nml_file, nml=shallow_physics_nml, iostat=io)
ierr = check_nml_error(io,"shallow_physics_nml")
-#else
- if (file_exist('input.nml')) then
- unit = open_namelist_file ()
- ierr=1
- do while (ierr /= 0)
- read (unit, nml=shallow_physics_nml, iostat=io, end=10)
- ierr = check_nml_error (io, 'shallow_physics_nml')
- enddo
- 10 call close_file (unit)
- endif
-#endif
! write version info and namelist to logfile
diff --git a/atmos_param/stable_bl_turb/stable_bl_turb.F90 b/atmos_param/stable_bl_turb/stable_bl_turb.F90
index 856a4bad..6fa37e26 100644
--- a/atmos_param/stable_bl_turb/stable_bl_turb.F90
+++ b/atmos_param/stable_bl_turb/stable_bl_turb.F90
@@ -3,9 +3,7 @@ MODULE STABLE_BL_TURB_MOD
!=======================================================================
use mpp_mod, only: input_nml_file
- use fms_Mod, ONLY: FILE_EXIST, OPEN_NAMELIST_FILE, &
- ERROR_MESG, FATAL, mpp_pe, mpp_root_pe, &
- CLOSE_FILE, &
+ use fms_Mod, ONLY: ERROR_MESG, FATAL, mpp_pe, mpp_root_pe, &
check_nml_error, write_version_number, &
stdlog
use Diag_Manager_Mod, ONLY: register_diag_field, send_data
@@ -507,7 +505,7 @@ subroutine STABLE_BL_TURB_INIT ( axes, Time )
integer, intent(in) :: axes(4)
type(time_type), intent(in) :: Time
- integer :: unit, io, ierr
+ integer :: logunit, io, ierr
!=======================================================================
@@ -515,23 +513,8 @@ subroutine STABLE_BL_TURB_INIT ( axes, Time )
! --- Read namelist
!---------------------------------------------------------------------
-#ifdef INTERNAL_FILE_NML
read (input_nml_file, nml=stable_bl_turb_nml, iostat=io)
ierr = check_nml_error(io,'stable_bl_turb_nml')
-#else
-! -------------------------------------
- if( FILE_EXIST( 'input.nml' ) ) then
- unit = OPEN_NAMELIST_FILE ( file = 'input.nml')
- ierr = 1
- do while( ierr .ne. 0 )
- READ ( unit, nml = stable_bl_turb_nml, iostat = io, end = 10 )
- ierr = check_nml_error (io, 'stable_bl_turb_nml')
- end do
-10 continue
- CALL CLOSE_FILE( unit )
-! -------------------------------------
- end if
-#endif
!---------------------------------------------------------------------
! --- Output version
@@ -539,8 +522,8 @@ subroutine STABLE_BL_TURB_INIT ( axes, Time )
if ( mpp_pe() == mpp_root_pe() ) then
call write_version_number(version, tagname)
- unit = stdlog()
- WRITE( unit, nml = stable_bl_turb_nml )
+ logunit = stdlog()
+ WRITE( logunit, nml = stable_bl_turb_nml )
endif
!---------------------------------------------------------------------
diff --git a/atmos_param/strat_cloud/strat_cloud.F90 b/atmos_param/strat_cloud/strat_cloud.F90
index d3f3fcb0..86a5f773 100644
--- a/atmos_param/strat_cloud/strat_cloud.F90
+++ b/atmos_param/strat_cloud/strat_cloud.F90
@@ -93,10 +93,8 @@ module strat_cloud_mod
use mpp_mod, only : mpp_clock_id, mpp_clock_begin, &
mpp_clock_end, CLOCK_LOOP, &
input_nml_file
-use fms_mod, only : file_exist, open_namelist_file,&
- open_file, error_mesg, FATAL, NOTE, &
- mpp_pe, mpp_root_pe, close_file, &
- open_ieee32_file, &
+use fms_mod, only : error_mesg, FATAL, NOTE, &
+ mpp_pe, mpp_root_pe, &
stdlog, mpp_error, check_nml_error, &
write_version_number, stdout
use constants_mod, only : RDGAS, RVGAS, HLV, HLS, HLF, &
@@ -432,7 +430,7 @@ subroutine strat_cloud_init (Nml_mp, Nml_lsc, Exch_ctrl, Physics_control)
!------------------------------------------------------------------------
!---local variables------------------------------------------------------
- integer :: unit, io, ierr, logunit
+ integer :: io, ierr, logunit
@@ -444,19 +442,8 @@ subroutine strat_cloud_init (Nml_mp, Nml_lsc, Exch_ctrl, Physics_control)
!-----------------------------------------------------------------------
! process namelist.
!-----------------------------------------------------------------------
-#ifdef INTERNAL_FILE_NML
read (input_nml_file, nml=strat_cloud_nml, iostat=io)
ierr = check_nml_error(io,'strat_cloud_nml')
-#else
- if ( file_exist('input.nml')) then
- unit = open_namelist_file ()
- ierr=1; do while (ierr /= 0)
- read (unit, nml=strat_cloud_nml, iostat=io, end=10)
- ierr = check_nml_error(io,'strat_cloud_nml')
- enddo
-10 call close_file (unit)
- endif
-#endif
!-----------------------------------------------------------------------
! write version and namelist to stdlog.
@@ -1397,7 +1384,7 @@ subroutine strat_cloud_legacy ( &
integer :: idim,jdim,kdim
integer :: id,jd,ns
integer :: j,ipt,jpt
- integer :: i,unit,nn
+ integer :: i,funit,nn
real :: inv_dtcloud, Si0
real :: icbp, icbp1, pnorm
real, dimension(size(T,1),size(T,2),size(T,3)) :: airdens
@@ -4355,14 +4342,14 @@ subroutine strat_cloud_legacy ( &
strat_pts(2,nn) >= js .and. strat_pts(2,nn) <= je) then
ipt=strat_pts(1,nn); jpt=strat_pts(2,nn)
i=ipt-is+1; j=jpt-js+1
- unit = open_ieee32_file ('strat.data', action='append')
- write (unit) ipt,jpt, ql(i,j,:)+SL(i,j,:)
- write (unit) ipt,jpt, qi(i,j,:)+SI(i,j,:)
- write (unit) ipt,jpt, qa(i,j,:)+SA(i,j,:)
- write (unit) ipt,jpt, T(i,j,:)+ST(i,j,:)
- write (unit) ipt,jpt, qv(i,j,:)+SQ(i,j,:)
- write (unit) ipt,jpt, pfull(i,j,:)
- call close_file(unit)
+ open(file="strat.data", form='unformatted',action='write', position="append", newunit=funit)
+ write (funit) ipt,jpt, ql(i,j,:)+SL(i,j,:)
+ write (funit) ipt,jpt, qi(i,j,:)+SI(i,j,:)
+ write (funit) ipt,jpt, qa(i,j,:)+SA(i,j,:)
+ write (funit) ipt,jpt, T(i,j,:)+ST(i,j,:)
+ write (funit) ipt,jpt, qv(i,j,:)+SQ(i,j,:)
+ write (funit) ipt,jpt, pfull(i,j,:)
+ close(funit)
endif
enddo
endif
diff --git a/atmos_param/tke_turb/tke_turb.F90 b/atmos_param/tke_turb/tke_turb.F90
index 3c674aec..1c764393 100644
--- a/atmos_param/tke_turb/tke_turb.F90
+++ b/atmos_param/tke_turb/tke_turb.F90
@@ -11,8 +11,7 @@ module tke_turb_mod
use mpp_mod, only: input_nml_file
- use fms_mod, only: file_exist, open_namelist_file, &
- error_mesg, FATAL, close_file, note, &
+ use fms_mod, only: error_mesg, FATAL, note, &
check_nml_error, mpp_pe, mpp_root_pe, &
write_version_number, stdlog, stdout, &
mpp_chksum
@@ -1242,23 +1241,8 @@ subroutine tke_turb_init(lonb, latb, axes, time, idim, jdim, kdim)
! --- Read namelist
!---------------------------------------------------------------------
-#ifdef INTERNAL_FILE_NML
read (input_nml_file, nml=tke_turb_nml, iostat=io)
ierr = check_nml_error(io,'tke_turb_nml')
-#else
- if( file_exist( 'input.nml' ) ) then
-! -------------------------------------
- unit = open_namelist_file( )
- ierr = 1
- do while( ierr .ne. 0 )
- READ ( unit, nml = tke_turb_nml, iostat = io, end = 10 )
- ierr = check_nml_error (io, 'tke_turb_nml')
- end do
-10 continue
- call close_file( unit )
-! -------------------------------------
- end if
-#endif
!---------------------------------------------------------------------
! --- Output version
diff --git a/atmos_param/topo_drag/topo_drag.F90 b/atmos_param/topo_drag/topo_drag.F90
index 0cdc7916..66b0a0ef 100644
--- a/atmos_param/topo_drag/topo_drag.F90
+++ b/atmos_param/topo_drag/topo_drag.F90
@@ -9,13 +9,16 @@ module topo_drag_mod
!-----------------------------------------------------------------------
use mpp_mod, only: input_nml_file
-use fms_mod, only: file_exist, open_namelist_file, &
- close_file, error_mesg, FATAL, NOTE, &
+use mpp_domains_mod, only: domain2D
+use fms_mod, only: error_mesg, FATAL, NOTE, &
mpp_pe, mpp_root_pe, stdout, stdlog, &
check_nml_error, write_version_number
-use fms_io_mod, only: read_data, field_size, field_exist
-use fms_io_mod, only: register_restart_field, restart_file_type
-use fms_io_mod, only: save_restart, restore_state
+use fms2_io_mod, only: read_data, get_variable_size, variable_exists, file_exists, &
+ FmsNetcdfDomainFile_t, register_variable_attribute, &
+ register_restart_field, register_axis, unlimited, &
+ open_file, read_restart, write_restart, close_file, &
+ register_field, write_data, get_global_io_domain_indices, &
+ FmsNetcdfFile_t
use constants_mod, only: Grav, Cp_Air, Rdgas, Pi, Radian
use horiz_interp_mod, only: horiz_interp_type, horiz_interp_init, &
horiz_interp_new, horiz_interp, horiz_interp_del
@@ -54,8 +57,7 @@ module topo_drag_mod
integer, parameter :: ipts=360*resolution
integer, parameter :: jpts=180*resolution
-!--- for netcdf restart
-type(restart_file_type), save :: Top_restart
+type(domain2D), pointer :: topo_domain
! parameters in namelist (topo_drag_nml):
@@ -708,13 +710,39 @@ subroutine get_pbl ( atmp, zfull, pfull, phalf, kpbl, knod, kcut )
end subroutine get_pbl
!=======================================================================
+ subroutine topo_drag_register_tile_restart(restart)
-subroutine topo_drag_init (lonb, latb)
+ type(FmsNetcdfDomainFile_t), intent(inout) :: restart
+ character(len=8), dimension(3) :: dim_names
+ dim_names(1) = "xaxis_1"
+ dim_names(2) = "yaxis_1"
+ dim_names(3) = "Time"
+ call register_axis(restart, dim_names(1), "x")
+ call register_axis(restart, dim_names(2), "y")
+ call register_axis(restart, dim_names(3), unlimited)
+
+ !< Register the domain decomposed dimensions as variables so that the combiner can work
+ !! correctly
+ call register_field(restart, dim_names(1), "double", (/dim_names(1)/))
+ call register_field(restart, dim_names(2), "double", (/dim_names(2)/))
+
+ call register_restart_field(restart, "t11", t11, dim_names)
+ call register_restart_field(restart, "t12", t12, dim_names)
+ call register_restart_field(restart, "t21", t21, dim_names)
+ call register_restart_field(restart, "t22", t22, dim_names)
+ call register_restart_field(restart, "hmin", hmin, dim_names)
+ call register_restart_field(restart, "hmax", hmax, dim_names)
+
+end subroutine
+
+subroutine topo_drag_init (domain, lonb, latb)
+
+type(domain2D), target, intent(in) :: domain
real, intent(in), dimension(:,:) :: lonb, latb
character(len=128) :: msg
-character(len=64) :: restart_file='topo_drag.res.nc'
+character(len=64) :: restart_fname='INPUT/topo_drag.res.nc'
character(len=64) :: topography_file='INPUT/poztopog.nc'
character(len=64) :: dragtensor_file='INPUT/dragelements.nc'
character(len=3) :: tensornames(4) = (/ 't11', 't21', 't12', 't22' /)
@@ -732,7 +760,8 @@ subroutine topo_drag_init (lonb, latb)
integer :: io, ierr, unit_nml, logunit
integer :: i, j
integer :: siz(4)
-integer :: id_restart
+type(FmsNetcdfDomainFile_t) :: Topo_restart !< Fms2io domain decomposed fileobj
+type(FmsNetcdfFile_t) :: topography_fileobj, dragtensor_fileobj !< Fms2io fileobj
if (module_is_initialized) return
@@ -741,18 +770,8 @@ subroutine topo_drag_init (lonb, latb)
! read namelist
-#ifdef INTERNAL_FILE_NML
read (input_nml_file, nml=topo_drag_nml, iostat=io)
ierr = check_nml_error(io,'topo_drag_nml')
-#else
- unit_nml = open_namelist_file ( )
- ierr = 1
- do while ( ierr /= 0 )
- read( unit_nml, nml = topo_drag_nml, iostat = io, end = 10 )
- ierr = check_nml_error (io, 'topo_drag_nml')
- end do
-10 call close_file ( unit_nml )
-#endif
! write version number and namelist to logfile
@@ -761,6 +780,7 @@ subroutine topo_drag_init (lonb, latb)
if (mpp_pe() == mpp_root_pe()) &
write (logunit, nml=topo_drag_nml)
+ topo_domain => domain
allocate (t11(nlon,nlat))
allocate (t21(nlon,nlat))
allocate (t12(nlon,nlat))
@@ -772,24 +792,19 @@ subroutine topo_drag_init (lonb, latb)
! read restart file
- id_restart = register_restart_field(Top_restart, restart_file, 't11', t11)
- id_restart = register_restart_field(Top_restart, restart_file, 't21', t21)
- id_restart = register_restart_field(Top_restart, restart_file, 't12', t12)
- id_restart = register_restart_field(Top_restart, restart_file, 't22', t22)
- id_restart = register_restart_field(Top_restart, restart_file, 'hmin', hmin)
- id_restart = register_restart_field(Top_restart, restart_file, 'hmax', hmax)
- restart_file = 'INPUT/'//trim(restart_file)
-
- if ( file_exist(restart_file) ) then
+ if ( open_file(Topo_restart, restart_fname, "read", topo_domain, is_restart = .true.) ) then
if (mpp_pe() == mpp_root_pe()) then
- write ( msg, '("Reading restart file: ",a40)' ) restart_file
+ write ( msg, '("Reading restart file: ",a40)' ) restart_fname
call error_mesg('topo_drag_mod', msg, NOTE)
endif
- call restore_state(Top_restart)
- else if (file_exist(topography_file) .and. &
- file_exist(dragtensor_file)) then
+ call topo_drag_register_tile_restart(Topo_restart)
+ call read_restart(Topo_restart)
+ call close_file(Topo_restart)
+
+ else if (file_exists(topography_file) .and. &
+ file_exists(dragtensor_file)) then
! read and interpolate topography datasets
@@ -799,8 +814,16 @@ subroutine topo_drag_init (lonb, latb)
call error_mesg('topo_drag_mod', msg, NOTE)
endif
+ if( .not. open_file(topography_fileobj, topography_file, "read")) then
+ call error_mesg('topo_drag_mod', "Error opening topography file", FATAL)
+ endif
+
+ if( .not. open_file(dragtensor_fileobj, dragtensor_file, "read")) then
+ call error_mesg('topo_drag_mod', "Error opening dragtensor file", FATAL)
+ endif
+
! check for correct field size in topography
- call field_size (topography_file, 'hpos', siz)
+ call get_variable_size(topography_fileobj, 'hpos', siz)
if (siz(1) /= ipts .or. siz(2) /= jpts) then
call error_mesg('topo_drag_mod', 'Field \"hpos\" in file '// &
trim(topography_file)//' has the wrong size', FATAL)
@@ -831,7 +854,8 @@ subroutine topo_drag_init (lonb, latb)
call horiz_interp_init
call horiz_interp_new ( Interp, xdatb, ydatb, lonb, latb, interp_method="conservative" )
- call read_data (topography_file, 'hpos', zdat, no_domain=.true.)
+ call read_data (topography_fileobj, 'hpos', zdat)
+
exponent = 2. - gamma
zdat = max(0., zdat)**exponent
call horiz_interp ( Interp, zdat, zout )
@@ -848,16 +872,16 @@ subroutine topo_drag_init (lonb, latb)
! check for correct field size in tensor file
- call field_size (dragtensor_file, tensornames(1), siz)
+ call get_variable_size(dragtensor_fileobj, tensornames(1), siz)
if (siz(1) /= ipts .or. siz(2) /= jpts) then
call error_mesg('topo_drag_mod', 'Fields in file ' &
//trim(dragtensor_file)//' have the wrong size', FATAL)
endif
do n=1,4
- found_field(n) = field_exist(dragtensor_file, tensornames(n))
+ found_field(n) = variable_exists(dragtensor_fileobj, tensornames(n))
if (.not. found_field(n)) cycle
- call read_data (dragtensor_file, tensornames(n), zdat, no_domain=.true.)
+ call read_data (dragtensor_fileobj, tensornames(n), zdat)
call horiz_interp ( Interp, zdat, zout )
if ( tensornames(n) == 't11' ) then
t11 = zout/bfscale
@@ -875,6 +899,9 @@ subroutine topo_drag_init (lonb, latb)
deallocate (zdat, zout)
call horiz_interp_del ( Interp )
+ call close_file(topography_fileobj)
+ call close_file(dragtensor_fileobj)
+
else
call ERROR_MESG ('topo_drag_init', &
@@ -914,13 +941,43 @@ end subroutine topo_drag_end
!
!
subroutine topo_drag_restart(timestamp)
- character(len=*), intent(in), optional :: timestamp
-
- call save_restart(Top_restart, timestamp)
-
+ character(len=*), intent(in), optional :: timestamp
+ type(FmsNetcdfDomainFile_t) :: Topo_restart
+ character(len=128) :: restart_fname
+
+ if (present(timestamp)) then
+ restart_fname='RESTART/'//trim(timestamp)//'.topo_drag.res.nc'
+ else
+ restart_fname='RESTART/topo_drag.res.nc'
+ endif
+
+ if (.not. open_file(Topo_restart, restart_fname, "overwrite", topo_domain, is_restart = .true.)) then
+ call error_mesg("topo_drag_mod", "The topo_drag tiled restart file does not exist", fatal)
+ endif
+
+ call topo_drag_register_tile_restart(Topo_restart)
+ call write_restart(Topo_restart)
+ call add_domain_dimension_data(Topo_restart)
+ call close_file(Topo_restart)
end subroutine topo_drag_restart
!
!#######################################################################
+!< Add_dimension_data: Adds dummy data for the domain decomposed axis
+subroutine add_domain_dimension_data(fileobj)
+ type(FmsNetcdfDomainFile_t) :: fileobj !< Fms2io domain decomposed fileobj
+ integer, dimension(:), allocatable :: buffer !< Buffer with axis data
+ integer :: is, ie !< Starting and Ending indices for data
+
+ call get_global_io_domain_indices(fileobj, "xaxis_1", is, ie, indices=buffer)
+ call write_data(fileobj, "xaxis_1", buffer)
+ deallocate(buffer)
+
+ call get_global_io_domain_indices(fileobj, "yaxis_1", is, ie, indices=buffer)
+ call write_data(fileobj, "yaxis_1", buffer)
+ deallocate(buffer)
+
+end subroutine add_domain_dimension_data
+
endmodule topo_drag_mod
diff --git a/atmos_param/two_stream_gray_rad/two_stream_gray_rad.F90 b/atmos_param/two_stream_gray_rad/two_stream_gray_rad.F90
index 2893df10..4277d08a 100644
--- a/atmos_param/two_stream_gray_rad/two_stream_gray_rad.F90
+++ b/atmos_param/two_stream_gray_rad/two_stream_gray_rad.F90
@@ -24,9 +24,8 @@ module two_stream_gray_rad_mod
! ==================================================================================
! ==================================================================================
- use fms_mod, only: open_file, check_nml_error, &
- mpp_pe, close_file
-
+ use fms_mod, only: check_nml_error
+ use mpp_mod, only: mpp_pe, mpp_root_pe, input_nml_file, stdlog
use constants_mod, only: stefan, cp_air, grav, pstd_mks
use diag_manager_mod, only: register_diag_field, send_data
@@ -106,24 +105,19 @@ subroutine two_stream_gray_rad_init(is, ie, js, je, num_levels, axes, Time)
integer, intent(in) :: is, ie, js, je, num_levels
!-------------------------------------------------------------------------------------
integer, dimension(3) :: half = (/1,2,4/)
-integer :: ierr, io, unit
+integer :: ierr, io, file_unit
!-----------------------------------------------------------------------------------------
! read namelist and copy to logfile
-unit = open_file ('input.nml', action='read')
-ierr=1
-do while (ierr /= 0)
- read (unit, nml=two_stream_gray_rad_nml, iostat=io, end=10)
- ierr = check_nml_error (io, 'two_stream_gray_rad_nml')
-enddo
-10 call close_file (unit)
-
-unit = open_file ('logfile.out', action='append')
-if ( mpp_pe() == 0 ) then
- write (unit,'(/,80("="),/(a))') trim(version), trim(tag)
- write (unit, nml=two_stream_gray_rad_nml)
+
+read (input_nml_file, nml=two_stream_gray_rad_nml, iostat=io)
+ierr = check_nml_error (io, 'two_stream_gray_rad_nml')
+
+if ( mpp_pe() == mpp_root_pe() ) then
+ file_unit=stdlog()
+ write (file_unit,'(/,80("="),/(a))') trim(version), trim(tag)
+ write (file_unit, nml=two_stream_gray_rad_nml)
endif
-call close_file (unit)
pi = 4. * atan(1.)
deg_to_rad = pi/180.
diff --git a/atmos_param/vert_diff_driver/vert_diff_driver.F90 b/atmos_param/vert_diff_driver/vert_diff_driver.F90
index 909c12dc..797eb610 100644
--- a/atmos_param/vert_diff_driver/vert_diff_driver.F90
+++ b/atmos_param/vert_diff_driver/vert_diff_driver.F90
@@ -17,9 +17,9 @@ module vert_diff_driver_mod
use time_manager_mod, only: time_type
use mpp_mod, only: input_nml_file
-use fms_mod, only: file_exist, open_namelist_file, error_mesg, &
+use fms_mod, only: error_mesg, &
check_nml_error, FATAL, mpp_pe, mpp_root_pe, &
- close_file, write_version_number, stdlog
+ write_version_number, stdlog
use constants_mod, only: CP_AIR, GRAV
@@ -462,7 +462,7 @@ subroutine vert_diff_driver_init ( Surf_diff, idim, jdim, kdim, &
integer, intent(in) :: do_clubb
!<--cjg
- integer :: unit, io, ierr, tr, logunit
+ integer :: io, ierr, tr, logunit
integer :: ntprog ! number of prognostic tracers in the atmosphere
character(len=32) :: name, units ! name of the tracer
character(len=128) :: longname ! long name of the tracer
@@ -470,19 +470,8 @@ subroutine vert_diff_driver_init ( Surf_diff, idim, jdim, kdim, &
!-----------------------------------------------------------------------
!------ read namelist ------
-#ifdef INTERNAL_FILE_NML
read (input_nml_file, nml=vert_diff_driver_nml, iostat=io)
ierr = check_nml_error(io,'vert_diff_driver_nml')
-#else
- if ( file_exist('input.nml')) then
- unit = open_namelist_file ()
- ierr=1; do while (ierr /= 0)
- read (unit, nml=vert_diff_driver_nml, iostat=io, end=10)
- ierr = check_nml_error(io,'vert_diff_driver_nml')
- enddo
- 10 call close_file (unit)
- endif
-#endif
!--------- write version number and namelist ------------------
diff --git a/atmos_param/vert_turb_driver/vert_turb_driver.F90 b/atmos_param/vert_turb_driver/vert_turb_driver.F90
index e80bf03a..427158cb 100644
--- a/atmos_param/vert_turb_driver/vert_turb_driver.F90
+++ b/atmos_param/vert_turb_driver/vert_turb_driver.F90
@@ -41,9 +41,10 @@ module vert_turb_driver_mod
use constants_mod, only: rdgas, rvgas, kappa, grav
use mpp_mod, only: input_nml_file
+use mpp_domains_mod, only: domain2D
use fms_mod, only: mpp_pe, mpp_root_pe, stdlog, &
- error_mesg, open_namelist_file, file_exist, &
- check_nml_error, close_file, FATAL, &
+ error_mesg, &
+ check_nml_error, FATAL, &
write_version_number, &
stdout, mpp_chksum
@@ -749,11 +750,12 @@ end subroutine vert_turb_driver
!#######################################################################
-subroutine vert_turb_driver_init (lonb, latb, id, jd, kd, axes, Time, &
+subroutine vert_turb_driver_init (domain, lonb, latb, id, jd, kd, axes, Time, &
Exch_ctrl, Physics_control, &
doing_edt, doing_entrain, do_clubb_in)
!-----------------------------------------------------------------------
+ type(domain2D), target, intent(in) :: domain !< Atmosphere domain
real, dimension(:,:), intent(in) :: lonb, latb
integer, intent(in) :: id, jd, kd, axes(4)
type(exchange_control_type), intent(in) :: Exch_ctrl
@@ -776,19 +778,8 @@ subroutine vert_turb_driver_init (lonb, latb, id, jd, kd, axes, Time, &
!-----------------------------------------------------------------------
!--------------- read namelist ------------------
-#ifdef INTERNAL_FILE_NML
read (input_nml_file, nml=vert_turb_driver_nml, iostat=io)
ierr = check_nml_error(io,'vert_turb_driver_nml')
-#else
- if (file_exist('input.nml')) then
- unit = open_namelist_file (file='input.nml')
- ierr=1; do while (ierr /= 0)
- read (unit, nml=vert_turb_driver_nml, iostat=io, end=10)
- ierr = check_nml_error (io, 'vert_turb_driver_nml')
- enddo
- 10 call close_file (unit)
- endif
-#endif
!---------- output namelist --------------------------------------------
@@ -865,7 +856,7 @@ subroutine vert_turb_driver_init (lonb, latb, id, jd, kd, axes, Time, &
!----------------------------------------------------------------------
- if (do_mellor_yamada) call my25_turb_init (id, jd, kd)
+ if (do_mellor_yamada) call my25_turb_init (domain, id, jd, kd)
if (do_tke_turb) then
ntke = get_tracer_index ( MODEL_ATMOS, 'tke' )
@@ -879,7 +870,7 @@ subroutine vert_turb_driver_init (lonb, latb, id, jd, kd, axes, Time, &
if (do_stable_bl) call stable_bl_turb_init ( axes, Time )
- if (do_edt) call edt_init (lonb, latb, axes,Time,id,jd,kd)
+ if (do_edt) call edt_init (domain, lonb, latb, axes,Time,id,jd,kd)
if (do_entrain) call entrain_init (lonb, latb, axes,Time,id,jd,kd)
diff --git a/atmos_shared/aerosol/aerosol.F90 b/atmos_shared/aerosol/aerosol.F90
index 81473422..c64948fc 100644
--- a/atmos_shared/aerosol/aerosol.F90
+++ b/atmos_shared/aerosol/aerosol.F90
@@ -33,21 +33,19 @@ module aerosol_mod
MAX_TRACER_FIELDS, &
query_method
use mpp_mod, only: input_nml_file
-use fms_mod, only: open_namelist_file, fms_init, &
+use fms_mod, only: fms_init, &
mpp_pe, mpp_root_pe, stdlog, &
- file_exist, write_version_number, &
+ write_version_number, &
check_nml_error, error_mesg, &
- FATAL, NOTE, WARNING, close_file, &
+ FATAL, NOTE, WARNING, &
lowercase
-use fms_io_mod, only: string
+use fms2_io_mod, only: file_exists
+use fms_mod, only: string
use interpolator_mod, only: interpolate_type, interpolator_init, &
interpolator, interpolator_end, &
obtain_interpolator_time_slices, &
unset_interpolator_time_flag, &
CONSTANT, INTERP_WEIGHTED_P
-use mpp_io_mod, only: mpp_open, mpp_close, MPP_RDONLY, &
- MPP_ASCII, MPP_SEQUENTIAL, MPP_MULTI, &
- MPP_SINGLE, mpp_io_init
use constants_mod, only: constants_init, RADIAN, GRAV
use data_override_mod, only: data_override
@@ -329,7 +327,7 @@ subroutine aerosol_init (lonb, latb, Aerosol_tv, &
character(len=256) ::tr_rad_name, tr_clim_name
character(len=256) :: name,control
real ::tr_rad_scale_factor
- integer :: unit, ierr, io, logunit
+ integer :: ierr, io, logunit
integer :: ntrace
integer :: n
@@ -353,7 +351,6 @@ subroutine aerosol_init (lonb, latb, Aerosol_tv, &
! verify that modules used by this module that are not called later
! have already been initialized.
!---------------------------------------------------------------------
- call mpp_io_init
call fms_init
call diag_manager_init
!BW call rad_utilities_init
@@ -363,21 +360,8 @@ subroutine aerosol_init (lonb, latb, Aerosol_tv, &
!-----------------------------------------------------------------------
! read namelist.
!-----------------------------------------------------------------------
-#ifdef INTERNAL_FILE_NML
read (input_nml_file, nml=aerosol_nml, iostat=io)
ierr = check_nml_error(io,'aerosol_nml')
-#else
- if ( file_exist('input.nml')) then
- unit = open_namelist_file ( )
- ierr=1; do while (ierr /= 0)
- read (unit, nml=aerosol_nml, iostat=io, &
- end=10)
- ierr = check_nml_error(io,'aerosol_nml')
- end do
-10 call close_file (unit)
- endif
-#endif
-
!---------------------------------------------------------------------
! write version number and namelist to logfile.
!---------------------------------------------------------------------
@@ -1586,7 +1570,7 @@ subroutine obtain_input_file_data
! determine if a netcdf input data file exists. if so, read the
! number of data records in the file.
!---------------------------------------------------------------------
- if (file_exist ( 'INPUT/id1aero.nc') ) then
+ if (file_exists ( 'INPUT/id1aero.nc') ) then
ncid = ncopn ('INPUT/id1aero.nc', 0, rcode)
call ncinq (ncid, ndims, nvars, ngatts, recdim, rcode)
do i=1,ndims
@@ -1616,8 +1600,8 @@ subroutine obtain_input_file_data
! determine if the input data input file exists in ascii format. if
! so, read the number of data records in the file.
!---------------------------------------------------------------------
- else if (file_exist ( 'INPUT/id1aero') ) then
- iounit = open_namelist_file ('INPUT/id1aero')
+ else if (file_exists ( 'INPUT/id1aero') ) then
+ open(file='INPUT/id1aero', form='formatted',action='read', newunit=iounit)
read (iounit,FMT = '(i4)') kmax_file
!-------------------------------------------------------------------
@@ -1627,7 +1611,7 @@ subroutine obtain_input_file_data
allocate (specified_aerosol(kmax_file) )
read (iounit,FMT = '(5e18.10)') &
(specified_aerosol(k),k=1,kmax_file)
- call close_file (iounit)
+ close (iounit)
!---------------------------------------------------------------------
! if file is not present, write an error message.
@@ -1688,7 +1672,6 @@ program main
use aerosol_mod
use mpp_mod
-use mpp_io_mod
use mpp_domains_mod
use time_manager_mod
use diag_manager_mod
@@ -1714,7 +1697,6 @@ program main
pi = 4.*atan(1.)
call mpp_init
-call mpp_io_init
call mpp_domains_init
call diag_manager_init
call set_calendar_type(JULIAN)
diff --git a/atmos_shared/atmos_cmip_diag/atmos_cmip_diag.F90 b/atmos_shared/atmos_cmip_diag/atmos_cmip_diag.F90
index a1e9a339..4b0e91cc 100644
--- a/atmos_shared/atmos_cmip_diag/atmos_cmip_diag.F90
+++ b/atmos_shared/atmos_cmip_diag/atmos_cmip_diag.F90
@@ -10,9 +10,9 @@ module atmos_cmip_diag_mod
!----------------------------------------------------------------------
use mpp_mod, only: input_nml_file
-use fms_mod, only: open_namelist_file, check_nml_error, &
- close_file, stdlog, mpp_pe, mpp_root_pe, &
- write_version_number, file_exist, &
+use fms_mod, only: check_nml_error, &
+ stdlog, mpp_pe, mpp_root_pe, &
+ write_version_number, &
error_mesg, FATAL, WARNING, NOTE, &
lowercase, string
use time_manager_mod, only: time_type
@@ -181,20 +181,8 @@ subroutine atmos_cmip_diag_init ( ak, bk, ptop, axes, Time )
!-----------------------------------------------------------------------
!----- read namelist -----
-#ifdef INTERNAL_FILE_NML
read (input_nml_file, nml=atmos_cmip_diag_nml, iostat=io)
ierr = check_nml_error (io, 'atmos_cmip_diag_nml')
-#else
- if (file_exist('input.nml') ) then
- iunit = open_namelist_file()
- ierr=1
- do while (ierr /= 0)
- read (iunit, nml=atmos_cmip_diag_nml, iostat=io, end=10)
- ierr = check_nml_error (io, 'atmos_cmip_diag_nml')
- enddo
-10 call close_file (iunit)
- endif
-#endif
!----- write version and namelist to log file -----
diff --git a/atmos_shared/atmos_cmip_diag/atmos_global_diag.F90 b/atmos_shared/atmos_cmip_diag/atmos_global_diag.F90
index 8aa8d0cf..fbe7fd18 100644
--- a/atmos_shared/atmos_cmip_diag/atmos_global_diag.F90
+++ b/atmos_shared/atmos_cmip_diag/atmos_global_diag.F90
@@ -8,9 +8,9 @@ module atmos_global_diag_mod
use mpp_mod, only: input_nml_file
use mpp_domains_mod, only: domain2d, mpp_global_sum, BITWISE_EFP_SUM, &
null_domain2d, operator(.eq.)
-use fms_mod, only: open_namelist_file, check_nml_error, &
- close_file, stdlog, mpp_pe, mpp_root_pe, &
- write_version_number, file_exist, &
+use fms_mod, only: check_nml_error, &
+ stdlog, mpp_pe, mpp_root_pe, &
+ write_version_number, &
error_mesg, FATAL, WARNING
use time_manager_mod, only: time_type
use diag_manager_mod, only: register_diag_field, send_data, &
@@ -104,20 +104,8 @@ subroutine atmos_global_diag_init (axes, area)
!-----------------------------------------------------------------------
!----- read namelist -----
-#ifdef INTERNAL_FILE_NML
read (input_nml_file, nml=atmos_global_diag_nml, iostat=io)
ierr = check_nml_error (io, 'atmos_global_diag_nml')
-#else
- if (file_exist('input.nml') ) then
- iunit = open_namelist_file()
- ierr=1
- do while (ierr /= 0)
- read (iunit, nml=atmos_global_diag_nml, iostat=io, end=10)
- ierr = check_nml_error (io, 'atmos_global_diag_nml')
- enddo
-10 call close_file (iunit)
- endif
-#endif
!----- write version and namelist to log file -----
diff --git a/atmos_shared/atmos_nudge/atmos_nudge.F90 b/atmos_shared/atmos_nudge/atmos_nudge.F90
index a008f209..6132cb70 100644
--- a/atmos_shared/atmos_nudge/atmos_nudge.F90
+++ b/atmos_shared/atmos_nudge/atmos_nudge.F90
@@ -1,12 +1,8 @@
module atmos_nudge_mod
-#ifdef INTERNAL_FILE_NML
use mpp_mod, only: input_nml_file
-#else
-use fms_mod, only: open_namelist_file
-#endif
-use fms_mod, only: check_nml_error, close_file, &
+use fms_mod, only: check_nml_error, &
stdlog, mpp_pe, mpp_root_pe, write_version_number, &
error_mesg, FATAL, WARNING
use time_manager_mod, only: time_type, set_time, get_date, &
@@ -296,24 +292,15 @@ subroutine atmos_nudge_init ( Time, axes, flag )
type (time_type), intent(in) :: Time
integer, dimension(3), intent(in) :: axes
logical, optional, intent(out) :: flag
-integer :: ierr, io, unit, logunit
+integer :: ierr, io, logunit
real :: eps
character(len=64) :: desc
real :: missing_value = -1.e10
! read namelist
-#ifdef INTERNAL_FILE_NML
read (input_nml_file, nml=atmos_nudge_nml, iostat=io)
ierr = check_nml_error(io, 'atmos_nudge_nml')
-#else
- unit = open_namelist_file()
- ierr=1
- do while (ierr /= 0)
- read (unit, nml=atmos_nudge_nml, iostat=io, end=10)
- ierr = check_nml_error (io, 'atmos_nudge_nml')
- enddo
-10 call close_file (unit)
-#endif
+
call write_version_number (version, tagname)
logunit=stdlog()
if (mpp_pe() == mpp_root_pe()) write (logunit, nml=atmos_nudge_nml)
diff --git a/atmos_shared/tracer_driver/aer_ccn_act/aer_ccn_act.F90 b/atmos_shared/tracer_driver/aer_ccn_act/aer_ccn_act.F90
index 066c7ff0..3e75e0ff 100644
--- a/atmos_shared/tracer_driver/aer_ccn_act/aer_ccn_act.F90
+++ b/atmos_shared/tracer_driver/aer_ccn_act/aer_ccn_act.F90
@@ -1,9 +1,10 @@
module aer_ccn_act_mod
-use fms_mod, only: error_mesg, FATAL, open_namelist_file, &
+use fms_mod, only: error_mesg, FATAL, &
mpp_pe, mpp_root_pe, stdlog, &
- file_exist, write_version_number, &
- check_nml_error, open_file, close_file, read_distributed
+ write_version_number, &
+ check_nml_error
+use fms2_io_mod, only: file_exists, ascii_read
use mpp_mod, only: input_nml_file, get_unit
use aer_ccn_act_k_mod, only: aer_ccn_act_k, aer_ccn_act2_k, &
aer_ccn_act_wpdf_k, aer_ccn_act_k_init, &
@@ -185,20 +186,10 @@ subroutine aer_ccn_act_init ()
!---------------------------------------------------------------------
! read namelist.
!--------------------------------------------------------------------
- if ( file_exist('input.nml')) then
-#ifdef INTERNAL_FILE_NML
+ if ( file_exists('input.nml')) then
read (input_nml_file, nml=aer_ccn_act_nml, iostat=io)
ierr = check_nml_error(io,'aer_ccn_act_nmliostat=io')
-#else
- unit = open_namelist_file ( )
- ierr=1; do while (ierr /= 0)
- read (unit, nml=aer_ccn_act_nml, iostat=io, &
- end=10)
- ierr = check_nml_error(io,'aer_ccn_act_nml')
- end do
-10 call close_file (unit)
-#endif
- endif
+ endif
!---------------------------------------------------------------------
! write version number and namelist to logfile.
!--------------------------------------------------------------------
@@ -224,17 +215,20 @@ end subroutine aer_ccn_act_init
subroutine Loading(droplets, droplets2)
real, dimension(:,:,:,:,:), intent(out) :: droplets, droplets2
-integer :: unit, ios=0
- unit = open_file(file='INPUT/droplets.dat',action='read',dist=.true.)
- call read_distributed(unit,fmt='*',iostat=ios,data=droplets)
+character(len=:), dimension(:), allocatable :: droplets_file !< Restart file saved as a string
+integer :: ios=0
+
+ call ascii_read('INPUT/droplets.dat', droplets_file)
+ read(droplets_file,fmt=*,iostat=ios) droplets
if (ios /= 0) call error_mesg ('aer_ccn_act_init', 'Read of INPUT/droplets.dat failed', FATAL)
- call close_file(unit,dist=.true.)
+ deallocate(droplets_file)
- unit = open_file(file='INPUT/droplets2.dat',action='read',dist=.true.)
- call read_distributed(unit,fmt='*',iostat=ios,data=droplets2)
+ call ascii_read('INPUT/droplets2.dat', droplets_file)
+ read(droplets_file,fmt=*,iostat=ios) droplets2
if (ios /= 0) call error_mesg ('aer_ccn_act_init', 'Read of INPUT/droplets2.dat failed', FATAL)
- call close_file(unit,dist=.true.)
+ deallocate(droplets_file)
+
end subroutine Loading
diff --git a/atmos_shared/tracer_driver/aer_ccn_act/ice_nucl.F90 b/atmos_shared/tracer_driver/aer_ccn_act/ice_nucl.F90
index b4fa25b5..88ce7e76 100644
--- a/atmos_shared/tracer_driver/aer_ccn_act/ice_nucl.F90
+++ b/atmos_shared/tracer_driver/aer_ccn_act/ice_nucl.F90
@@ -9,9 +9,9 @@ MODULE ice_nucl_mod
use mpp_mod, only : input_nml_file
use fms_mod, only : error_mesg, FATAL, mpp_pe, mpp_root_pe, &
- open_namelist_file, check_nml_error, &
- close_file, write_version_number, &
- file_exist, stdlog
+ check_nml_error, &
+ write_version_number, &
+ stdlog
use aer_ccn_act_k_mod, only : ghquad, dlocate
use aerosol_params_mod,only : aerosol_params_init, rho_sulf, sigma_sulf, &
rho_bc, sigma_bc, Nfact_du1, Nfact_du2, &
@@ -116,7 +116,7 @@ MODULE ice_nucl_mod
SUBROUTINE ice_nucl_wpdf_init
- integer :: unit, io, ierr, logunit
+ integer :: io, ierr, logunit
!------------------------------------------------------------------------
IF (module_is_initialized) return
@@ -124,20 +124,8 @@ SUBROUTINE ice_nucl_wpdf_init
!-------------------------------------------------------------------------
! process namelist.
!-------------------------------------------------------------------------
-#ifdef INTERNAL_FILE_NML
read (input_nml_file, nml=ice_nucl_nml, iostat=io)
ierr = check_nml_error(io,'ice_nucl_nml')
-#else
- if ( file_exist('input.nml')) then
-
- unit = open_namelist_file ( )
- ierr=1; do while (ierr /= 0)
- read (unit, nml=ice_nucl_nml, iostat=io, end=10)
- ierr = check_nml_error(io,'ice_nucl_nml')
- enddo
-10 call close_file (unit)
- endif
-#endif
!--------- write version and namelist to standard log ------------
diff --git a/atmos_shared/tracer_driver/atmos_age_tracer.F90 b/atmos_shared/tracer_driver/atmos_age_tracer.F90
index fdaa1a10..c050eb75 100644
--- a/atmos_shared/tracer_driver/atmos_age_tracer.F90
+++ b/atmos_shared/tracer_driver/atmos_age_tracer.F90
@@ -20,15 +20,19 @@ module atmos_age_tracer_mod
!-----------------------------------------------------------------------
-use fms_mod, only : file_exist, &
- field_exist, &
- write_version_number, &
+use fms_mod, only : write_version_number, &
mpp_pe, &
mpp_root_pe, &
lowercase, &
error_mesg, &
FATAL,WARNING, NOTE, &
stdlog
+use fms2_io_mod, only : file_exists, &
+ open_file, &
+ close_file, &
+ FmsNetcdfDomainFile_t,&
+ variable_exists
+use mpp_domains_mod, only : domain2D
use time_manager_mod, only : time_type
use diag_manager_mod, only : send_data, &
register_static_field
@@ -205,7 +209,7 @@ end subroutine atmos_age_tracer
!
! Pressure on the model half levels (Pa)
!
- subroutine atmos_age_tracer_init( r, axes, Time, nage, &
+ subroutine atmos_age_tracer_init( domain, r, axes, Time, nage, &
lonb_mod, latb_mod, phalf, mask)
!-----------------------------------------------------------------------
@@ -216,6 +220,7 @@ subroutine atmos_age_tracer_init( r, axes, Time, nage, &
! (nlon,nlat,nlev).
!
!-----------------------------------------------------------------------
+type(domain2D),target,intent(in) :: domain !< Atmosphere domain
real, intent(inout), dimension(:,:,:,:) :: r
type(time_type), intent(in) :: Time
integer, intent(in) :: axes(4)
@@ -252,11 +257,8 @@ subroutine atmos_age_tracer_init( r, axes, Time, nage, &
! ... Initial conditions
!-----------------------------------------------------------------------
tracer_initialized = .false.
- if ( field_exist('INPUT/atmos_tracers.res.nc', 'age') .or. &
- field_exist('INPUT/fv_tracer.res.nc', 'age') .or. &
- field_exist('INPUT/tracer_age.res', 'age') ) then
- tracer_initialized = .true.
- end if
+ tracer_initialized = check_if_tracer_initialized("age", domain)
+
if(.not. tracer_initialized) then
! if((.not. tracer_initialized) .and. (nage /= -1)) then
if( query_method('init_conc',MODEL_ATMOS,n,name,control) ) then
@@ -308,6 +310,30 @@ subroutine atmos_age_tracer_end
end subroutine atmos_age_tracer_end
!
+!> @brief This function just checks if a tracer initialized in a set of files
+!! @return flag indicating if a tracer initialized
+function check_if_tracer_initialized(tracername, domain) result (tracer_initialized)
+ character(len=*), intent(in), optional :: tracername
+ type(domain2D),target,intent(in) :: domain !< Atmosphere domain
+
+ logical :: tracer_initialized
+
+ type(FmsNetcdfDomainFile_t) :: fileobj !< fms2io fileobj for domain decomposed
+
+ tracer_initialized = .false.
+
+ if (open_file(fileobj, 'INPUT/atmos_tracers.res.nc', "read", domain)) then
+ tracer_initialized = variable_exists(fileobj, tracername)
+ call close_file(fileobj)
+ elseif (open_file(fileobj, 'INPUT/fv_tracer.res.nc', "read", domain)) then
+ tracer_initialized = variable_exists(fileobj, tracername)
+ call close_file(fileobj)
+ elseif (open_file(fileobj, 'INPUT/tracer_'//trim(lowercase(tracername))//'.res', "read", domain)) then
+ tracer_initialized = variable_exists(fileobj, tracername)
+ call close_file(fileobj)
+ endif
+
+end function check_if_tracer_initialized
end module atmos_age_tracer_mod
diff --git a/atmos_shared/tracer_driver/atmos_carbon_aerosol.F90 b/atmos_shared/tracer_driver/atmos_carbon_aerosol.F90
index 469fc27c..989cc7ea 100644
--- a/atmos_shared/tracer_driver/atmos_carbon_aerosol.F90
+++ b/atmos_shared/tracer_driver/atmos_carbon_aerosol.F90
@@ -4,12 +4,11 @@ Module atmos_carbon_aerosol_mod
! Shekar Reddy
!
use mpp_mod, only: input_nml_file
-use fms_mod, only : file_exist, close_file, &
- write_version_number, &
+use fms_mod, only : write_version_number, &
mpp_pe, mpp_root_pE, &
- open_namelist_file, &
check_nml_error, error_mesg, &
stdlog, FATAL, NOTE, WARNING
+use fms2_io_mod, only : file_exists
use time_manager_mod, only : time_type, &
days_in_month, days_in_year, &
set_date, set_time, get_date_julian, &
@@ -1082,24 +1081,15 @@ subroutine atmos_carbon_aerosol_init (lonb, latb, axes, Time, mask)
real, intent(in), dimension(:,:,:), optional :: mask
character(len=7), parameter :: mod_name = 'tracers'
integer :: n
-integer :: unit, ierr, io, logunit
+integer :: ierr, io, logunit
if (module_is_initialized) return
!----------------------------------
!namelist files
- if ( file_exist('input.nml')) then
-#ifdef INTERNAL_FILE_NML
+ if ( file_exists('input.nml')) then
read (input_nml_file, nml=carbon_aerosol_nml, iostat=io)
ierr = check_nml_error(io,'carbon_aerosol_nml')
-#else
- unit = open_namelist_file ( )
- ierr=1; do while (ierr /= 0)
- read (unit, nml=carbon_aerosol_nml, iostat=io, end=10)
- ierr = check_nml_error(io,'carbon_aerosol_nml')
- end do
-10 call close_file (unit)
-#endif
endif
!---------------------------------------------------------------------
! write version number and namelist to logfile.
diff --git a/atmos_shared/tracer_driver/atmos_ch3i.F90 b/atmos_shared/tracer_driver/atmos_ch3i.F90
index 856a0560..d8b2b402 100644
--- a/atmos_shared/tracer_driver/atmos_ch3i.F90
+++ b/atmos_shared/tracer_driver/atmos_ch3i.F90
@@ -1,18 +1,16 @@
module atmos_ch3i_mod
-use mpp_mod, only: input_nml_file
-use fms_mod, only : file_exist, &
- write_version_number, &
+use mpp_mod, only: input_nml_file
+use fms2_io_mod, only : file_exists
+use fms_mod, only : write_version_number, &
error_mesg, &
FATAL, &
NOTE, &
mpp_pe, &
mpp_root_pe, &
lowercase, &
- open_namelist_file, &
check_nml_error, &
- close_file, &
stdlog
use field_manager_mod, only : MODEL_ATMOS, &
parse
@@ -86,7 +84,7 @@ subroutine atmos_ch3i_init( lonb_mod, latb_mod, axes, Time, mask )
!-----------------------------------------------------------------------
- integer :: unit, nfields, flag_file
+ integer :: nfields, flag_file
integer :: ierr, io, logunit
character(len=128) :: tracer_name, tracer_units, name, control
@@ -105,18 +103,9 @@ subroutine atmos_ch3i_init( lonb_mod, latb_mod, axes, Time, mask )
!-----------------------------------------------------------------------
! ... read namelist
!-----------------------------------------------------------------------
- if ( file_exist('input.nml')) then
-#ifdef INTERNAL_FILE_NML
+ if ( file_exists('input.nml')) then
read (input_nml_file, nml=atmos_ch3i_nml, iostat=io)
ierr = check_nml_error(io, 'atmos_ch3i_nml')
-#else
- unit = open_namelist_file ()
- ierr=1; do while (ierr /= 0)
- read (unit, nml=atmos_ch3i_nml, iostat=io, end=10)
- ierr = check_nml_error(io, 'atmos_ch3i_nml')
- enddo
-10 call close_file (unit)
-#endif
endif
diff --git a/atmos_shared/tracer_driver/atmos_ch4.F90 b/atmos_shared/tracer_driver/atmos_ch4.F90
index 1d6cd799..5a965e2e 100644
--- a/atmos_shared/tracer_driver/atmos_ch4.F90
+++ b/atmos_shared/tracer_driver/atmos_ch4.F90
@@ -19,12 +19,12 @@ module atmos_ch4_mod
use mpp_mod, only: input_nml_file
-use fms_mod, only : file_exist, write_version_number, &
+use fms_mod, only : write_version_number, &
mpp_pe, mpp_root_pe, &
- close_file, stdlog, stdout, &
+ stdlog, stdout, &
check_nml_error, error_mesg, &
- open_namelist_file, FATAL, NOTE, WARNING
-
+ FATAL, NOTE, WARNING
+use fms2_io_mod, only : file_exists
use tracer_manager_mod, only : get_tracer_index, tracer_manager_init
use field_manager_mod, only : MODEL_ATMOS
use time_manager_mod, only : time_type
@@ -161,7 +161,7 @@ subroutine atmos_ch4_rad_init
! io error status returned from io operation
!-----------------------------------------------------------------------
!
-integer :: ierr, unit, io
+integer :: ierr, io
integer :: n
integer :: outunit
!
@@ -186,18 +186,9 @@ subroutine atmos_ch4_rad_init
!-----------------------------------------------------------------------
! read namelist.
!-----------------------------------------------------------------------
- if ( file_exist('input.nml')) then
-#ifdef INTERNAL_FILE_NML
+ if ( file_exists('input.nml')) then
read (input_nml_file, nml=atmos_ch4_nml, iostat=io)
ierr = check_nml_error(io,'atmos_ch4_nml')
-#else
- unit = open_namelist_file ( )
- ierr=1; do while (ierr /= 0)
- read (unit, nml=atmos_ch4_nml, iostat=io, end=10)
- ierr = check_nml_error(io,'atmos_ch4_nml')
- end do
-10 call close_file (unit)
-#endif
endif
!---------------------------------------------------------------------
diff --git a/atmos_shared/tracer_driver/atmos_co2.F90 b/atmos_shared/tracer_driver/atmos_co2.F90
index 74588f28..8a9db640 100644
--- a/atmos_shared/tracer_driver/atmos_co2.F90
+++ b/atmos_shared/tracer_driver/atmos_co2.F90
@@ -17,12 +17,12 @@ module atmos_co2_mod
use mpp_mod, only: input_nml_file
-use fms_mod, only : file_exist, write_version_number, &
+use fms_mod, only : write_version_number, &
mpp_pe, mpp_root_pe, &
- close_file, stdlog, stdout, &
+ stdlog, stdout, &
check_nml_error, error_mesg, &
- open_namelist_file, FATAL, NOTE, WARNING
-
+ FATAL, NOTE, WARNING
+use fms2_io_mod, only : file_exists
use tracer_manager_mod, only : get_tracer_index, tracer_manager_init
use field_manager_mod, only : MODEL_ATMOS
use diag_manager_mod, only : register_diag_field, send_data
@@ -655,7 +655,7 @@ subroutine atmos_co2_init (Time, id, jd, axes)
! io error status returned from io operation
!-----------------------------------------------------------------------
!
-integer :: ierr, unit, io
+integer :: ierr, io
integer :: n
real :: missing_value = -1.e10
character(len=64) :: desc
@@ -682,18 +682,9 @@ subroutine atmos_co2_init (Time, id, jd, axes)
!-----------------------------------------------------------------------
! read namelist.
!-----------------------------------------------------------------------
- if ( file_exist('input.nml')) then
-#ifdef INTERNAL_FILE_NML
+ if ( file_exists('input.nml')) then
read (input_nml_file, nml=atmos_co2_nml, iostat=io)
ierr = check_nml_error(io,'atmos_co2_nml')
-#else
- unit = open_namelist_file ( )
- ierr=1; do while (ierr /= 0)
- read (unit, nml=atmos_co2_nml, iostat=io, end=10)
- ierr = check_nml_error(io,'atmos_co2_nml')
- end do
-10 call close_file (unit)
-#endif
endif
!---------------------------------------------------------------------
diff --git a/atmos_shared/tracer_driver/atmos_convection_tracer.F90 b/atmos_shared/tracer_driver/atmos_convection_tracer.F90
index 39d78088..57eb05f2 100644
--- a/atmos_shared/tracer_driver/atmos_convection_tracer.F90
+++ b/atmos_shared/tracer_driver/atmos_convection_tracer.F90
@@ -24,11 +24,12 @@ module atmos_convection_tracer_mod
!-----------------------------------------------------------------------
-use fms_mod, only : file_exist, &
+use fms_mod, only : &
write_version_number, &
error_mesg, &
FATAL,WARNING,NOTE, &
mpp_pe, mpp_root_pe, stdlog
+use fms2_io_mod, only : file_exists
use time_manager_mod, only : time_type
use diag_manager_mod, only : send_data, &
register_static_field
@@ -274,7 +275,7 @@ subroutine atmos_convection_tracer_init (r, phalf, axes, Time, &
do nn = 1, ncopies_cnvct_trcr
if (nconvect(nn) > 0) then
filename = 'INPUT/tracer_' //trim(search_name(nn)) // '.res'
- if (file_exist (filename)) then
+ if (file_exists (filename)) then
!--------------------------------------------------------------------
! if a .res file does not exist, initialize the convection_tracer.
diff --git a/atmos_shared/tracer_driver/atmos_dust.F90 b/atmos_shared/tracer_driver/atmos_dust.F90
index 8738c687..2c51d098 100644
--- a/atmos_shared/tracer_driver/atmos_dust.F90
+++ b/atmos_shared/tracer_driver/atmos_dust.F90
@@ -13,13 +13,13 @@ module atmos_dust_mod
!
!-----------------------------------------------------------------------
-use constants_mod, only : PI, GRAV, RDGAS, DENS_H2O, PSTD_MKS, WTMAIR
+use constants_mod, only : PI, GRAV, RDGAS, DENS_H2O, WTMAIR
use mpp_mod, only : input_nml_file
use fms_mod, only : write_version_number, mpp_pe, mpp_root_pe, &
- open_namelist_file, close_file, file_exist, &
check_nml_error, error_mesg, &
stdlog, stdout, string, lowercase, &
NOTE, FATAL
+use fms2_io_mod, only : file_exists
use time_manager_mod, only : time_type
use diag_manager_mod, only : send_data, register_diag_field
use atmos_cmip_diag_mod, only : register_cmip_diag_field_2d
@@ -27,7 +27,8 @@ module atmos_dust_mod
get_tracer_names, set_tracer_atts, &
query_method, NO_TRACER
use field_manager_mod, only : parse, MODEL_ATMOS, MODEL_LAND
-use atmos_tracer_utilities_mod, only : wet_deposition, dry_deposition
+use atmos_tracer_utilities_mod, only : wet_deposition, dry_deposition, &
+ sedimentation_velocity, sedimentation_flux
use interpolator_mod, only: interpolate_type, interpolator_init, &
obtain_interpolator_time_slices, &
unset_interpolator_time_flag, &
@@ -260,7 +261,7 @@ subroutine atmos_dust_sourcesink1 ( &
! ---- local vars
integer :: outunit, unit, ierr, io
integer i, j, k, id, jd, kd, kb
- real, dimension(size(dust,3)) :: vdep, setl, dz, air_dens, qn, qn1
+ real, dimension(size(dust,3)) :: vdep, setl, dz, air_dens
real, parameter :: mtcm = 100. ! meter to cm
real, parameter :: mtv = 1. ! factor conversion for mixing ratio of dust
@@ -312,37 +313,9 @@ subroutine atmos_dust_sourcesink1 ( &
rho_wet_dust = ratio_r*dustden+(1.-ratio_r)*DENS_H2O ! Density of wet aerosol [kg/m3]
vdep(k) = sedimentation_velocity(t(i,j,k),pfull(i,j,k),rwet,rho_wet_dust) ! Settling velocity [m/s]
enddo
- if (use_sj_sedimentation_solver) then
- qn(:)=dust(i,j,:)
- qn1(1)=qn(1)*dz(1)/(dz(1)+dt*vdep(1))
- do k=2,kb
- qn1(k)=(qn(k)*dz(k)+dt*qn1(k-1)*vdep(k-1)*air_dens(k-1)/air_dens(k))/(dz(k)+dt*vdep(k))
- enddo
- dust_dt(i,j,:)=dust_dt(i,j,:)+(qn1(:)-qn(:))/dt
- setl(kb) = qn1(kb)*air_dens(kb)/mtv*vdep(kb) !! ter, 2016-05-13 vdep(k) is outside of loop, so k > kb. Switched k to kb
-
-!---> h1g, 2016-04-05
- if( dust_debug ) then
-!$OMP CRITICAL
-
- ! if (mpp_pe()==mpp_root_pe()) then
- ! write(logunit,'("DUST ",2i5," qn(kb)=",e12.4," qn1(kb)=",e12.4," vdep(kb)=",e12.4," air_dens(kb)=",e12.4," dz(kb)=",e12.4," dt=",e12.4," dust_dt=",e12.4," setl=",e12.4)') &
- ! i,j,qn(kb),qn1(kb),vdep(kb),air_dens(kb),dz(kb),dt,dust_dt(i,j,kb),setl(kb)
- ! endif
-!$OMP END CRITICAL
- end if ! dust_debug
-!<--- h1g, 2016-04-05
-
- else
- do k=1,kb
- if (dust(i,j,k) > 0.0) then
- setl(k)=dust(i,j,k)*air_dens(k)/mtv*vdep(k) ! settling flux [kg/m2/s]
- endif
- enddo
- dust_dt(i,j,1)=dust_dt(i,j,1)-setl(1)/pwt(i,j,1)*mtv
- dust_dt(i,j,2:kb)=dust_dt(i,j,2:kb) &
- + ( setl(1:kb-1) - setl(2:kb) )/pwt(i,j,2:kb)*mtv
- endif
+ call sedimentation_flux(use_sj_sedimentation_solver,kb, &
+ dt,mtv,dz,vdep,air_dens,&
+ pwt(i,j,:),dust(i,j,:),dust_dt(i,j,:),setl)
dust_setl(i,j) = setl(kb) ! at the bottom of the atmos
rho_air = air_dens(kb) ! rho_air is not defined
dsetl_dtr(i,j) = rho_air/mtv*vdep(kb) ! derivative of settling flux w.r.t tracer conc
@@ -355,23 +328,6 @@ subroutine atmos_dust_sourcesink1 ( &
end subroutine atmos_dust_sourcesink1
-!#######################################################################
-! calculates the vertical velocity of dust settling
-elemental real function sedimentation_velocity(T,p,rwet,rho_wet_dust) result(vdep)
- real, intent(in) :: T ! air temperature, deg K
- real, intent(in) :: p ! pressure, Pa
- real, intent(in) :: rwet ! radius of dust particles, m
- real, intent(in) :: rho_wet_dust ! density of dust particles, kg/m3
-
- real :: viscosity, free_path, C_c
- viscosity = 1.458E-6 * T**1.5/(T+110.4) ! Dynamic viscosity
- free_path = 6.6e-8*T/293.15*(PSTD_MKS/p)
- C_c = 1.0 + free_path/rwet * & ! Slip correction [none]
- (1.257+0.4*exp(-1.1*rwet/free_path))
- vdep = 2./9.*C_c*GRAV*rho_wet_dust*rwet**2/viscosity ! Settling velocity [m/s]
-end function sedimentation_velocity
-
-
!######################################################################
! given a tracer index, returns TRUE if this is one of dust tracers
function is_dust_tracer(tr) result(ret)
@@ -882,23 +838,12 @@ end subroutine atmos_dust_end
subroutine read_nml_file()
integer :: io
integer :: ierr
- integer :: funit
integer :: logunit
if (read_nml) then
!read namelist.
- if (file_exist('input.nml')) then
-#ifdef INTERNAL_FILE_NML
+ if (file_exists('input.nml')) then
read (input_nml_file,nml=dust_nml,iostat=io)
ierr = check_nml_error(io,'dust_nml')
-#else
- funit = open_namelist_file()
- ierr = 1
- do while (ierr .ne. 0)
- read(funit,nml=dust_nml,iostat=io,end=10)
- ierr = check_nml_error(io,'dust_nml')
- enddo
-10 call close_file(funit)
-#endif
endif
!write namelist to the log file
if (mpp_pe() .eq. mpp_root_pe()) then
diff --git a/atmos_shared/tracer_driver/atmos_nh3_tag.F90 b/atmos_shared/tracer_driver/atmos_nh3_tag.F90
new file mode 100644
index 00000000..d652eab5
--- /dev/null
+++ b/atmos_shared/tracer_driver/atmos_nh3_tag.F90
@@ -0,0 +1,780 @@
+module atmos_nh3_tag_mod
+
+ use astronomy_mod, only : astronomy_init, diurnal_solar, universal_time
+ use atmos_cmip_diag_mod, only : register_cmip_diag_field_2d
+ use atmos_ocean_fluxes_mod, only : aof_set_coupler_flux
+ use atmos_tracer_utilities_mod, only : &
+ get_cmip_param, get_chem_param
+ use constants_mod, only : grav, rdgas, WTMAIR, WTMH2O, AVOGNO, &
+ PI, DEG_TO_RAD, SECONDS_PER_DAY, epsln, WTMN
+ use coupler_types_mod, only : coupler_2d_bc_type, ind_pcair
+ use data_override_mod, only : data_override
+ use diag_manager_mod, only : send_data, &
+ register_diag_field, &
+ register_static_field, &
+ get_base_time
+ use field_manager_mod, only : MODEL_ATMOS, MODEL_LAND, parse
+ use fms_mod, only : write_version_number, &
+ mpp_pe, &
+ mpp_root_pe, &
+ lowercase, &
+ uppercase, &
+ stdlog, &
+ check_nml_error, &
+ error_mesg, &
+ FATAL, &
+ WARNING, &
+ NOTE
+ use fms2_io_mod, only: file_exists
+ use interpolator_mod, only : interpolate_type, &
+ interpolate_type_eq, &
+ interpolator_init, &
+ obtain_interpolator_time_slices, &
+ unset_interpolator_time_flag, &
+ interpolator_end, &
+ interpolator, &
+ query_interpolator, &
+ init_clim_diag, &
+ CONSTANT, &
+ INTERP_WEIGHTED_P
+ use mpp_mod, only : input_nml_file
+ use time_manager_mod, only : time_type, &
+ get_date, &
+ set_date, &
+ set_time, &
+ days_in_year, &
+ real_to_time_type, &
+ time_type_to_real, &
+ operator(+), operator(-)
+ use tracer_manager_mod, only : get_tracer_index, &
+ query_method
+
+ implicit none
+ private
+
+ public :: atmos_nh3_tag_driver, &
+ atmos_nh3_tag_init, &
+ atmos_nh3_tag_time_vary, &
+ atmos_nh3_tag_end, &
+ atmos_nh3_tag_endts, &
+ atmos_nh3_tag_adjust, &
+ atmos_nh3_tag_gather_data, &
+ atmos_nh3_tag_flux_init, &
+ is_nh3_tag_tracer
+
+ character(len=7), parameter :: mod_name = 'nh3_tag'
+ character(len=64), parameter:: sub_name = 'atmos_nh3_tag_init'
+
+ character(len=80) :: file_emis = ' '
+ character(len=80) :: file_emis3d = ' '
+ logical :: debug = .true.
+ integer :: nb_tag_max = 10
+ logical :: read_nml = .true.
+
+!---- version number -----
+ character(len=128) :: version = '$Id$'
+ character(len=128) :: tagname = '$Name$'
+
+
+ namelist /atmos_nh3_tag_nml/ &
+ file_emis,file_emis3d, &
+ debug,nb_tag_max
+
+
+ character(len=7), parameter :: module_name = 'tracers'
+
+ type :: field_init_type
+ character(len=64), pointer :: field_names(:)
+ character(len=64) :: keep_field
+ logical :: is_ag
+ character(len=64) :: exclude_field(3)
+ character(len=64) :: mask_name
+ logical :: do_mask_emis
+ end type field_init_type
+
+ type(field_init_type), allocatable :: emis_field_names(:), &
+ emis3d_field_names(:)
+
+ type(interpolate_type), allocatable :: inter_emis(:), inter_emis3d(:)
+
+ integer :: nnh3,nnh4,noh, nb_tag
+ integer, allocatable :: id_loss_mol(:)
+ integer, allocatable :: id_emis(:)
+ integer, allocatable :: id_emis3d(:)
+ integer, allocatable :: id_emis_tag(:)
+
+ real, allocatable :: mask_emis(:,:,:),mask_emis3d(:,:,:)
+
+ logical, allocatable :: is_nh3_tag(:)
+ logical, allocatable :: has_emis(:), has_emis3d(:), &
+ land_does_emission(:), &
+ diurnal_emis(:), diurnal_emis3d(:)
+
+ real, parameter :: g_to_kg = 1.e-3, & !conversion factor (kg/g)
+ m2_to_cm2 = 1.e4, & !conversion factor (cm2/m2)
+ twopi = 2.*PI
+ real, parameter :: emis_cons = WTMAIR * g_to_kg * m2_to_cm2 / AVOGNO
+
+ integer, allocatable :: nnh3_tag(:), nnh4_tag(:)
+ integer, allocatable :: ind_nh3_flux(:)
+
+ logical :: module_is_initialized=.false., first = .true.
+
+contains
+
+ subroutine atmos_nh3_tag_driver( lon, lat, land, ocn_flx_fraction, pwt, r, rm, rdt, &
+ Time, phalf, pfull, t, is, ie, js, je, dt, &
+ z_half, z_full, coszen, &
+ half_day, &
+ Time_next, kbot, emis_ag_masage )
+
+ real, intent(in), dimension(:,:) :: lon, lat
+ real, intent(in), dimension(:,:) :: land ! land fraction
+ real, intent(in), dimension(:,:) :: ocn_flx_fraction ! grid box fraction over which DMS flux from ocean occurs
+ real, intent(in), dimension(:,:,:) :: pwt
+ real, intent(in), dimension(:,:,:,:) :: r, rm
+ real, intent(inout), dimension(:,:,:,:) :: rdt
+ type(time_type), intent(in) :: Time, Time_next
+ integer, intent(in) :: is, ie, js, je
+ real, intent(in), dimension(:,:,:) :: phalf,pfull,t
+ real, intent(in) :: dt ! timestep (s)
+ real, intent(in), dimension(:,:,:) :: z_half ! height in meters at half levels
+ real, intent(in), dimension(:,:,:) :: z_full ! height in meters at full levels
+ real, intent(in), dimension(:,:) :: coszen ! cosine of solar zenith angle
+ real, intent(in), dimension(:,:) :: half_day! half-day length (0 to pi)
+ integer, intent(in), dimension(:,:), optional :: kbot
+ real, intent(in), dimension(:,:), optional :: emis_ag_masage !
+
+ !local variables
+ real, dimension(size(r,1),size(r,2),size(r,3),nb_tag) :: emis_source, oh_chem_dt
+ real, dimension(size(r,1),size(r,2),nb_tag) :: emisz
+ real, dimension(size(r,1),size(r,2),size(r,3)) :: cnh4,cnhx,f_aero
+ real, dimension(size(r,1),size(r,2)) :: emis!, mask_emis
+ real, dimension(size(r,1),size(r,2),size(r,3)) :: emis3d
+
+ integer :: i,j,k,n,kb,id,jd,kd
+ real :: air_dens,k_nh3_oh
+
+ logical :: used
+
+ if (.not. module_is_initialized) &
+ call error_mesg ('atmos_nh3_tag_driver','atmos_nh3_tag_init must be called first.', FATAL)
+
+ id=size(r,1); jd=size(r,2); kd=size(r,3)
+
+ emis_source(:,:,:,:) = 0.0
+ emisz(:,:,:) = 0.0
+
+ do n = 1, nb_tag
+
+ emis3d(:,:,:) = 0.0
+ emis(:,:) = 0.0
+
+ !read emissions
+ if (has_emis(n)) then
+ call read_2D_emis_data( inter_emis(n), emis, Time, Time_next, &
+ emis_field_names(n)%field_names, &
+ diurnal_emis(n), coszen, half_day, lon, &
+ is, js, emis_field_names(n)%keep_field, emis_field_names(n)%exclude_field)
+
+ if (emis_field_names(n)%is_ag .and. present(emis_ag_masage)) then
+ emis = emis+emis_ag_masage
+ end if
+
+ if (emis_field_names(n)%do_mask_emis) then
+ ! call data_override('ATM', trim(emis_field_names(n)%mask_name), mask_emis, time, override=used, is_in=is, ie_in=ie, js_in=js, je_in=je)
+ do j=1,jd
+ do i=1,id
+ emis(i,j) = emis(i,j)*mask_emis(i+is-1,j+js-1,n)
+ end do
+ end do
+ end if
+
+
+ if (id_emis(n) > 0) then
+ used = send_data(id_emis(n),emis,Time_next,is_in=is,js_in=js)
+ end if
+ end if
+
+ !read emissions 3d
+ if (has_emis3d(n)) then
+ call read_3D_emis_data( inter_emis3d(n), emis3d, Time, Time_next,phalf, &
+ emis3d_field_names(n)%field_names, &
+ diurnal_emis3d(n), coszen, half_day, lon, &
+ is, js )
+
+ if (emis3d_field_names(n)%do_mask_emis) then
+ ! call data_override('ATM', trim(emis3d_field_names(n)%mask_name), mask_emis, time, override=used, is_in=is, ie_in=ie, js_in=js, je_in=je)
+ do k=1,size(emis3d,3)
+ do j=1,jd
+ do i=1,id
+ emis3d(i,j,k) = emis3d(i,j,k)*mask_emis3d(i+is-1,j+js-1,n)
+ end do
+ end do
+ end do
+ end if
+ if (id_emis3d(n) > 0) then
+ used = send_data(id_emis3d(n),emis3d,Time_next,is_in=is,js_in=js)
+ end if
+ end if
+
+ if (present(kbot)) then
+ do j=1,jd
+ do i=1,id
+ kb=kbot(i,j)
+ emis_source(i,j,kb,n) = emis(i,j)/pwt(i,j,kb) * emis_cons
+ end do
+ end do
+ else
+ emis_source(:,:,kd,n) = emis(:,:)/pwt(:,:,kd) * emis_cons
+ end if
+
+ emis_source(:,:,:,n) = emis_source(:,:,:,n) &
+ + emis3d(:,:,:)/pwt(:,:,:) * emis_cons
+
+ emisz(:,:,n) = emis(:,:)
+ do k=1, size(emis3d,3)
+ emisz(:,:,n) = emisz(:,:,n) + emis3d(:,:,k)
+ end do
+
+ end do
+
+ !chemical loss by OH
+ do i=1,id
+ do j=1,jd
+ do k=1,kd
+ air_dens = pfull(i,j,k)/(rdgas*wtmair*1e-3*t(i,j,k)) * AVOGNO * 1e-6 ! molec/cm3
+ k_nh3_oh = 1.7e-12*exp(-710./t(i,j,k))
+ do n=1,nb_tag
+ oh_chem_dt(i,j,k,n) = -k_nh3_oh*r(i,j,k,noh)*r(i,j,k,nnh3_tag(n))*air_dens
+ end do
+ end do
+ end do
+ end do
+
+ do n=1,nb_tag
+ if(id_loss_mol(n)>0) then
+ used = send_data(id_loss_mol(n),-oh_chem_dt(:,:,:,n)*pwt(:,:,:)*1.e3/WTMAIR, &
+ Time_next,is_in=is,js_in=js)
+ end if
+ if(id_emis_tag(n)>0) then
+ used = send_data(id_emis_tag(n), emisz(:,:,n)*1.0e04*0.017/AVOGNO, Time_next, is_in=is,js_in=js)
+ endif
+ end do
+
+ !update nh3 tendency
+ do n = 1, nb_tag
+ rdt(:,:,:,nnh3_tag(n)) = emis_source(:,:,:,n) + oh_chem_dt(:,:,:,n) + rdt(:,:,:,nnh3_tag(n))
+ end do
+
+ !adjustment due to partioning
+ cNH4 = rm(:,:,:,nnh4)+rdt(:,:,:,nnh4)*dt
+ cNHx = rm(:,:,:,nnh3)+rdt(:,:,:,nnh3)*dt+cNH4
+ f_aero = min(max(cNH4/(max(cNHx,epsln)),0.),1.)
+
+ do i=1,nb_tag
+ cNH4 = rm(:,:,:,nnh4_tag(i))+rdt(:,:,:,nnh4_tag(i))*dt
+ cNHx = rm(:,:,:,nnh3_tag(i))+rdt(:,:,:,nnh3_tag(i))*dt+cNH4
+
+ rdt(:,:,:,nnh4_tag(i)) = (cNHx*f_aero-rm(:,:,:,nnh4_tag(i)))/dt
+ rdt(:,:,:,nnh3_tag(i)) = (cNHx*(1.-f_aero)-rm(:,:,:,nnh3_tag(i)))/dt
+ end do
+
+
+ end subroutine atmos_nh3_tag_driver
+
+ function atmos_nh3_tag_init(nt,axes,Time,lonb_mod,latb_mod,do_nh3_atm_ocean_exchange,do_masage) result(do_nh3_tag)
+
+ integer, intent(in) :: nt
+ integer , intent(in) :: axes(4)
+ type(time_type), intent(in) :: Time
+ real, intent(in), dimension(:,:) :: lonb_mod
+ real, intent(in), dimension(:,:) :: latb_mod
+ logical, intent(in) :: do_nh3_atm_ocean_exchange
+ logical, intent(in), optional :: do_masage
+ logical :: do_nh3_tag
+
+ character*9 :: fld !nh3_tag01
+ integer :: ierr, io, logunit
+ integer :: i
+
+ character(len=256) :: cmip_name
+
+ if (module_is_initialized) return
+
+ if (debug .and. mpp_pe().eq.mpp_root_pe()) write(*,*) 'starting atmos_nh3_tag'
+
+ !-----------------------------------------------------------------------
+ ! ... read namelist
+ !-----------------------------------------------------------------------
+ call read_nml_file()
+
+ nNH4 = get_tracer_index(MODEL_ATMOS,'nh4')
+ nNH3 = get_tracer_index(MODEL_ATMOS,'nh3')
+ nOH = get_tracer_index(MODEL_ATMOS,'oh')
+
+ allocate(is_nh3_tag(nt))
+ allocate(nnh3_tag(nb_tag_max))
+ allocate(nnh4_tag(nb_tag_max))
+
+ is_nh3_tag(:) = .false.
+
+ nb_tag = 0
+
+ do_nh3_tag = .false.
+
+ if (nnh4.gt.0.and.nnh3.gt.0) then
+ ! find out if there are tag nh3 tracers dust tracers
+ do i=1,nb_tag_max
+ write(fld,'(A7,I2.2)') 'nh3_tag',i
+ nNH3_tag(i) = get_tracer_index(MODEL_ATMOS,fld)
+ if (debug .and. mpp_root_pe().eq.mpp_pe() .and. nNH3_tag(i).gt.0) write(*,*) fld,nNH3_tag(i)
+ write(fld,'(A7,I2.2)') 'nh4_tag',i
+ nNH4_tag(i) = get_tracer_index(MODEL_ATMOS,fld)
+ if (debug .and. mpp_root_pe().eq.mpp_pe() .and. nNH4_tag(i).gt.0) write(*,*) fld,nNH4_tag(i)
+ if (nNH3_tag(i).gt.0.and.nNH4_tag(i).gt.0) then
+ do_nh3_tag=.true.
+ nb_tag = nb_tag+1
+ is_nh3_tag(nnh3_tag(i)) = .true.
+ elseif (nNH3_tag(i).gt.0.and.nNH4_tag(i).le.0) then
+ call error_mesg ('Tracer_driver','NH3 tag without NH4 tag', FATAL)
+ elseif (nNH4_tag(i).gt.0.and.nNH3_tag(i).le.0) then
+ call error_mesg ('Tracer_driver','NH4 tag without NH3 tag', FATAL)
+ end if
+ end do
+
+ if (mpp_root_pe().eq.mpp_pe()) write(*,*) 'nb_nh3_tag=',nb_tag
+
+ if (do_nh3_tag) then
+ allocate(inter_emis(nb_tag))
+ allocate(inter_emis3d(nb_tag))
+ allocate(has_emis(nb_tag))
+ allocate(has_emis3d(nb_tag))
+ allocate(land_does_emission(nb_tag))
+ allocate(diurnal_emis(nb_tag))
+ allocate(diurnal_emis3d(nb_tag))
+ allocate(emis_field_names(nb_tag))
+ allocate(emis3d_field_names(nb_tag))
+ allocate(id_loss_mol(nb_tag))
+ allocate(id_emis(nb_tag))
+ allocate(id_emis3d(nb_tag))
+ allocate(id_emis_tag(nb_tag))
+ allocate(mask_emis(size(lonb_mod,1)-1,size(latb_mod,2)-1,nb_tag))
+ allocate(mask_emis3d(size(lonb_mod,1)-1,size(latb_mod,2)-1,nb_tag))
+
+ mask_emis = 0.
+ mask_emis3d = 0.
+
+ do i = 1,nb_tag
+
+ write(fld,'(A7,I2.2)') 'nh3_tag',i
+ if (mpp_root_pe().eq.mpp_pe()) write(*,*) fld
+
+ call init_emis_data( inter_emis(i), MODEL_ATMOS, 'emissions', nNH3_tag(i), &
+ lonb_mod, latb_mod, emis_field_names(i), &
+ has_emis(i), diurnal_emis(i), axes, Time, land_does_emis=land_does_emission(i), do_nh3_atm_ocean_exchange=do_nh3_atm_ocean_exchange, do_masage=do_masage )
+ call init_emis_data( inter_emis3d(i), MODEL_ATMOS, 'emissions3d', nNH3_tag(i), &
+ lonb_mod, latb_mod, emis3d_field_names(i), &
+ has_emis3d(i), diurnal_emis3d(i), axes, Time )
+
+ write(fld,'(A7,I2.2)') 'nh3_tag',i
+ id_loss_mol(i) = register_diag_field( module_name, fld//'_lossm', axes(1:3), &
+ Time, fld//'_lossm','mole/m2/s')
+
+ if( has_emis(i) ) then
+ id_emis(i) = register_diag_field( module_name, fld//'_emis', axes(1:2), &
+ Time, fld//'_emis', 'molec/cm2/s')
+ else
+ id_emis(i) = 0
+ end if
+ if( has_emis3d(i) ) then
+ id_emis3d(i) = register_diag_field( module_name, fld//'_emis3d', axes(1:3), &
+ Time, fld//'_emis3d', 'molec/cm2/s')
+ else
+ id_emis3d(i) = 0
+ end if
+
+ !register regardless
+ call get_cmip_param (nNH3_tag(i), cmip_name=cmip_name)
+
+ id_emis_tag(i) = register_diag_field( module_name, 'emi'//fld, axes(1:2), &
+ Time, 'emi'//fld, 'kg/m2/s', &
+ standard_name='emission '//trim(cmip_name))
+
+ end do
+ end if
+ end if
+
+ module_is_initialized = .true.
+
+ end function atmos_nh3_tag_init
+
+ subroutine atmos_nh3_tag_end
+
+ if (allocated(inter_emis)) deallocate(inter_emis)
+ if (allocated(inter_emis3d)) deallocate(inter_emis3d)
+ if (allocated(has_emis)) deallocate(has_emis)
+ if (allocated(has_emis3d)) deallocate(has_emis3d)
+ if (allocated(land_does_emission)) deallocate(land_does_emission)
+ if (allocated(diurnal_emis)) deallocate(diurnal_emis)
+ if (allocated(diurnal_emis3d)) deallocate(diurnal_emis3d)
+ if (allocated(emis_field_names)) deallocate(emis_field_names)
+ if (allocated(emis3d_field_names)) deallocate(emis3d_field_names)
+ if (allocated(id_emis)) deallocate(id_emis)
+ if (allocated(id_emis3d)) deallocate(id_emis3d)
+ if (allocated(id_loss_mol)) deallocate(id_loss_mol)
+ if (allocated(nnh3_tag)) deallocate(nnh3_tag)
+ if (allocated(nnh4_tag)) deallocate(nnh4_tag)
+ if (allocated(mask_emis)) deallocate(mask_emis)
+ if (allocated(mask_emis3d)) deallocate(mask_emis3d)
+ if (allocated(ind_nh3_flux)) deallocate(ind_nh3_flux)
+
+ module_is_initialized = .false.
+
+ end subroutine atmos_nh3_tag_end
+
+ subroutine atmos_nh3_tag_endts
+
+ integer :: n
+
+ do n=1,size(inter_emis,1)
+ if (has_emis(n)) then
+ call unset_interpolator_time_flag(inter_emis(n))
+ end if
+ end do
+ do n=1,size(inter_emis3d,1)
+ if (has_emis(n)) then
+ call unset_interpolator_time_flag(inter_emis3d(n))
+ end if
+ end do
+ end subroutine atmos_nh3_tag_endts
+
+ subroutine atmos_nh3_tag_time_vary(Time)
+
+ type(time_type), intent(in) :: Time
+ integer :: n
+ logical :: used
+
+ do n=1, size(inter_emis,1)
+ if (has_emis(n)) then
+ call obtain_interpolator_time_slices (inter_emis(n), Time)
+ endif
+ end do
+
+ do n=1, size(inter_emis3d,1)
+ if (has_emis3d(n)) then
+ call obtain_interpolator_time_slices (inter_emis3d(n), Time)
+ endif
+ end do
+
+ if (first) then
+ do n = 1,nb_tag
+ if (emis_field_names(n)%do_mask_emis) then
+ call data_override('ATM', trim(emis_field_names(n)%mask_name), mask_emis(:,:,n), time, override=used)
+ end if
+ if (emis3d_field_names(n)%do_mask_emis) then
+ call data_override('ATM', trim(emis3d_field_names(n)%mask_name), mask_emis3d(:,:,n), time, override=used)
+ end if
+ end do
+ first=.false.
+ end if
+
+ end subroutine atmos_nh3_tag_time_vary
+
+ !copied from tropchem_driver
+ subroutine read_2D_emis_data( emis_type, emis, Time, Time_next, &
+ field_names, &
+ Ldiurnal, coszen, half_day, lon, &
+ is, js, keep_field, skip_field )
+
+ type(interpolate_type),intent(inout) :: emis_type
+ real, dimension(:,:),intent(out) :: emis
+ type(time_type),intent(in) :: Time, Time_next
+ character(len=*),dimension(:), intent(in) :: field_names
+ character(len=*), intent(in) :: keep_field
+ character(len=*), intent(in) :: skip_field(:)
+ logical, intent(in) :: Ldiurnal
+ real, dimension(:,:), intent(in) :: coszen, half_day, lon
+ integer, intent(in) :: is, js
+ integer :: i, j, k, k2
+ logical :: used
+ real, dimension(size(emis,1),size(emis,2)) :: temp_data
+ real :: diurnal_scale_factor, gmt, iso_on, iso_off, dayfrac
+ real :: local_angle, factor_tmp
+ logical :: found
+
+ emis(:,:) = 0.
+ temp_data(:,:) = 0.
+
+ do k = 1,size(field_names)
+ temp_data(:,:) = 0.
+ found=.false.
+
+ do k2 = 1,size(skip_field)
+ if (trim(field_names(k)).eq.trim(skip_field(k2))) found=.true.
+ end do
+
+ if (.not. found) then
+ if (trim(keep_field).eq.'N/A' .or. trim(field_names(k)).eq.trim(keep_field)) then
+ call interpolator(emis_type,Time,temp_data,field_names(k),is,js)
+ end if
+ end if
+ emis(:,:) = emis(:,:) + temp_data(:,:)
+ end do
+
+ if (Ldiurnal) then
+ do j=1,size(emis,2)
+ do i=1,size(emis,1)
+ if( coszen(i,j) < 0. ) then
+ diurnal_scale_factor = 0.
+ else
+ iso_off = .8 * half_day(i,j)
+ iso_on = -iso_off
+ dayfrac = iso_off/PI
+ gmt = universal_time(Time)
+ local_angle = gmt + lon(i,j) - PI
+ if (local_angle >= PI) local_angle = local_angle - twopi
+ if (local_angle < -PI) local_angle = local_angle + twopi
+ if( local_angle >= iso_off .or. local_angle <= iso_on ) then
+ diurnal_scale_factor = 0.
+ else
+ factor_tmp = local_angle - iso_on
+ factor_tmp = factor_tmp / MAX(2.*iso_off,1.e-6)
+ diurnal_scale_factor = 2. / dayfrac * (sin(PI*factor_tmp))**2
+ end if
+ end if
+ emis(i,j) = emis(i,j) * diurnal_scale_factor
+ end do
+ end do
+ end if
+ end subroutine read_2D_emis_data
+
+
+ subroutine read_3D_emis_data( emis_type, emis, Time, Time_next, phalf, &
+ field_names, &
+ Ldiurnal, coszen, half_day, lon, &
+ is, js)
+
+ type(interpolate_type),intent(inout) :: emis_type
+ real, dimension(:,:,:),intent(in) :: phalf
+ real, dimension(:,:,:),intent(out) :: emis
+ type(time_type),intent(in) :: Time, Time_next
+ character(len=*),dimension(:), intent(in) :: field_names
+ logical, intent(in) :: Ldiurnal
+ real, dimension(:,:), intent(in) :: coszen, half_day, lon
+ integer, intent(in) :: is, js
+
+ integer :: i, j, k
+ logical :: used
+ real, dimension(size(emis,1),size(emis,2),size(emis,3)) :: temp_data
+ real :: diurnal_scale_factor, gmt, iso_on, iso_off, dayfrac
+ real :: local_angle, factor_tmp
+
+ emis(:,:,:) = 0.
+ temp_data(:,:,:) = 0.
+ do k = 1,size(field_names)
+ call interpolator(emis_type,Time,phalf,temp_data,field_names(k),is,js)
+ emis(:,:,:) = emis(:,:,:) + temp_data(:,:,:)
+ end do
+ if (Ldiurnal) then
+ do j=1,size(emis,2)
+ do i=1,size(emis,1)
+ if( coszen(i,j) < 0. ) then
+ diurnal_scale_factor = 0.
+ else
+ iso_off = .8 * half_day(i,j)
+ iso_on = -iso_off
+ dayfrac = iso_off/PI
+ gmt = universal_time(Time)
+ local_angle = gmt + lon(i,j) + PI
+ if (local_angle >= PI) local_angle = local_angle - twopi
+ if (local_angle < -PI) local_angle = local_angle + twopi
+ if( local_angle >= iso_off .or. local_angle <= iso_on ) then
+ diurnal_scale_factor = 0.
+ else
+ factor_tmp = local_angle - iso_on
+ factor_tmp = factor_tmp / MAX(2.*iso_off,1.e-6)
+ diurnal_scale_factor = 2. / dayfrac * (sin(PI*factor_tmp))**2
+ end if
+ end if
+ emis(i,j,:) = emis(i,j,:) * diurnal_scale_factor
+ end do
+ end do
+ end if
+
+ end subroutine read_3D_emis_data
+
+
+ subroutine init_emis_data( emis_type, model, method_type, pos, &
+ lonb_mod, latb_mod, field_type, flag, diurnal, &
+ axes, Time, land_does_emis, do_nh3_atm_ocean_exchange, do_masage )
+
+ type(interpolate_type),intent(inout) :: emis_type
+ integer, intent(in) :: model,pos
+ character(len=*),intent(in) :: method_type
+ real,intent(in),dimension(:,:) :: lonb_mod,latb_mod
+ type(field_init_type),intent(out) :: field_type
+ logical, intent(out) :: flag, diurnal
+ logical, intent(out), optional :: land_does_emis
+ logical, intent(in), optional :: do_nh3_atm_ocean_exchange, do_masage
+ integer , intent(in) :: axes(4)
+ type(time_type), intent(in) :: Time
+ character(len=64) ::file_name
+
+ character(len=64) :: name, control, mask
+ integer :: nfields
+ integer :: flag_file, flag_diurnal, flag_name, flag_field, flag_mask
+ character(len=64) :: emis_file, control_diurnal, exclude_field, keep_field
+
+ logical :: used
+
+ flag = .false.
+ diurnal = .false.
+ control = ''
+
+ if( query_method(trim(method_type),model,pos,name,control) ) then
+ if( trim(name(1:4)) == 'file' ) then
+ flag = .true.
+ flag_file = parse(control, 'file', emis_file)
+ flag_diurnal = parse(control, 'diurnal', control_diurnal)
+ if(flag_file > 0) then
+ file_name = trim(emis_file)
+ else
+ select case (trim(method_type))
+ case ('emissions3d')
+ file_name = trim(file_emis3d)
+ case default
+ file_name = trim(file_emis)
+ end select
+ end if
+ flag_field = parse(control, 'keep_field', keep_field)
+ if (flag_field>0) then
+ field_type%keep_field = keep_field
+ if (trim(keep_field) .eq. 'agriculture') then
+ field_type%is_ag = .true.
+ end if
+ else
+ field_type%keep_field = 'N/A'
+ end if
+ flag_field = parse(control, 'exclude_field',exclude_field)
+ if (flag_field>0) then
+ field_type%exclude_field(1) = exclude_field
+ else
+ field_type%exclude_field(1) = 'N/A'
+ end if
+ if (present(do_nh3_atm_ocean_exchange) .and. do_nh3_atm_ocean_exchange) then
+ field_type%exclude_field(2) = 'ocean'
+ else
+ field_type%exclude_field(2) = 'N/A'
+ end if
+ if (present(do_masage) .and. do_masage) then
+ field_type%exclude_field(3) = 'agriculture'
+ else
+ field_type%exclude_field(3) = 'N/A'
+ end if
+ diurnal = (flag_diurnal > 0)
+ call interpolator_init( emis_type, trim(file_name), &
+ lonb_mod, latb_mod, &
+ data_out_of_bounds=(/CONSTANT/), &
+ vert_interp=(/INTERP_WEIGHTED_P/) )
+ call query_interpolator(emis_type,nfields=nfields)
+ allocate(field_type%field_names(nfields))
+ call query_interpolator(emis_type,field_names=field_type%field_names)
+ end if
+ if ( present(land_does_emis) ) land_does_emis = (index(lowercase(name),'land:lm3')>0)
+
+ if (mpp_root_pe().eq.mpp_pe()) then
+ write(*,*) 'file= ',file_name
+ write(*,*) 'field_names ',field_type%field_names
+ write(*,*) 'exclude field_names',field_type%exclude_field
+ write(*,*) 'keep field_names ',field_type%keep_field
+ end if
+ else
+ field_type%exclude_field='N/A'
+ field_type%keep_field='N/A'
+ end if
+
+ flag_mask = parse(control, 'mask', mask)
+ if (flag_mask.le.0) then
+ field_type%do_mask_emis = .false.
+ field_type%mask_name = 'N/A'
+ else
+ field_type%do_mask_emis = .true.
+ field_type%mask_name = trim(mask)
+ if (mpp_root_pe().eq.mpp_pe()) write(*,*) 'mask_name=',trim(mask)
+ end if
+
+ end subroutine init_emis_data
+
+ function is_nh3_tag_tracer(tr) result(ret)
+ logical :: ret
+ integer, intent(in) :: tr
+ ret = (is_nh3_tag(tr))
+ end function is_nh3_tag_tracer
+
+ subroutine atmos_nh3_tag_adjust()
+
+ end subroutine atmos_nh3_tag_adjust
+
+ subroutine atmos_nh3_tag_gather_data(gas_fields,tr_bot)
+ type(coupler_2d_bc_type), intent(inout) :: gas_fields
+ real, dimension(:,:,:), intent(in) :: tr_bot
+
+ integer :: n
+
+ do n=1,nb_tag
+ if (ind_nh3_flux(n) .gt. 0) then
+ gas_fields%bc(ind_nh3_flux(n))%field(ind_pcair)%values(:,:) = tr_bot(:,:,nnh3_tag(n))
+ end if
+ end do
+
+ end subroutine atmos_nh3_tag_gather_data
+
+ subroutine atmos_nh3_tag_flux_init
+
+ integer :: n
+ integer :: nnh3_tag_for_flux
+ character*14 :: fld !nh3_tag01
+
+ if (mpp_root_pe().eq.mpp_pe()) write(*,*) 'setting up nh3_tag_flux (atmos)'
+
+ call read_nml_file()
+ allocate(ind_nh3_flux(nb_tag_max))
+ ind_nh3_flux = 0
+
+ do n=1,nb_tag_max
+ write(fld,'(A7,I2.2)') 'nh3_tag',n
+ nnh3_tag_for_flux = get_tracer_index(MODEL_ATMOS,fld)
+ if (nnh3_tag_for_flux.gt.0) then
+ write(fld,'(A7,I2.2,A5)') 'nh3_tag',n,'_flux'
+ ind_nh3_flux(n) = aof_set_coupler_flux(fld, &
+ flux_type = 'air_sea_gas_flux_generic', implementation = 'johnson', &
+ atm_tr_index = nnh3_tag_for_flux, &
+ mol_wt = WTMN, param = (/ 17.,25. /), &
+ caller = trim(mod_name) // '(' // trim(sub_name) // ')')
+ end if
+ end do
+
+ end subroutine atmos_nh3_tag_flux_init
+
+ subroutine read_nml_file()
+ integer :: io
+ integer :: ierr
+ integer :: logunit
+ if (read_nml) then
+ if (file_exists('input.nml')) then
+ read (input_nml_file, nml=atmos_nh3_tag_nml, iostat=io)
+ ierr = check_nml_error(io,'atmos_nh3_tag_nml')
+ endif
+ !--------- write version and namelist to standard log ------------
+ call write_version_number(version,tagname)
+ logunit = stdlog()
+ if (mpp_pe() .eq. mpp_root_pe()) then
+ write(logunit,nml=atmos_nh3_tag_nml)
+ endif
+ read_nml = .false.
+ endif
+ end subroutine read_nml_file
+
+end module atmos_nh3_tag_mod
+
diff --git a/atmos_shared/tracer_driver/atmos_radon.F90 b/atmos_shared/tracer_driver/atmos_radon.F90
index 1ff8b933..028b2031 100644
--- a/atmos_shared/tracer_driver/atmos_radon.F90
+++ b/atmos_shared/tracer_driver/atmos_radon.F90
@@ -24,7 +24,7 @@ module atmos_radon_mod
!-----------------------------------------------------------------------
-use fms_mod, only : file_exist, &
+use fms_mod, only : &
write_version_number, &
mpp_pe, &
mpp_root_pe, &
diff --git a/atmos_shared/tracer_driver/atmos_regional_tracer_driver.F90 b/atmos_shared/tracer_driver/atmos_regional_tracer_driver.F90
index 8a4e6985..b97cd156 100644
--- a/atmos_shared/tracer_driver/atmos_regional_tracer_driver.F90
+++ b/atmos_shared/tracer_driver/atmos_regional_tracer_driver.F90
@@ -21,19 +21,17 @@ module atmos_regional_tracer_driver_mod
!-----------------------------------------------------------------------
-use fms_mod, only : file_exist, &
- field_exist, &
- write_version_number, &
+use fms_mod, only : write_version_number, &
mpp_pe, &
mpp_root_pe, &
- open_namelist_file, &
- close_file, &
stdlog, &
check_nml_error, &
error_mesg, &
FATAL, &
WARNING, &
NOTE
+use mpp_mod, only : input_nml_file
+use fms2_io_mod, only : file_exists
use time_manager_mod, only : time_type
use diag_manager_mod, only : send_data, &
register_diag_field
@@ -387,7 +385,6 @@ subroutine regional_tracer_driver_init( lonb_mod, latb_mod, axes, Time, mask )
character(len=64) :: trname
character(len=64) :: diag_name
integer :: ierr, io
- integer :: unit
integer :: omp_get_num_threads
@@ -408,15 +405,9 @@ subroutine regional_tracer_driver_init( lonb_mod, latb_mod, axes, Time, mask )
!-----------------------------------------------------------------------
! ... read namelist
!-----------------------------------------------------------------------
- if(file_exist('input.nml')) then
- unit = open_namelist_file('input.nml')
- ierr=1; do while (ierr /= 0)
- read(unit, nml = regional_tracer_driver_nml, iostat=io, end=10)
- ierr = check_nml_error (io, 'regional_tracer_driver_nml')
- end do
-10 call close_file(unit)
- end if
-
+ read (input_nml_file, nml=regional_tracer_driver_nml, iostat=io)
+ ierr = check_nml_error(io,'regional_tracer_driver_nml')
+
if(mpp_pe() == mpp_root_pe()) then
write(stdlog(), nml=regional_tracer_driver_nml)
end if
diff --git a/atmos_shared/tracer_driver/atmos_sea_salt.F90 b/atmos_shared/tracer_driver/atmos_sea_salt.F90
index 00a5ae8c..316038ce 100644
--- a/atmos_shared/tracer_driver/atmos_sea_salt.F90
+++ b/atmos_shared/tracer_driver/atmos_sea_salt.F90
@@ -13,10 +13,10 @@ module atmos_sea_salt_mod
use constants_mod, only : PI, GRAV, RDGAS, DENS_H2O, PSTD_MKS, WTMAIR
use mpp_mod, only : input_nml_file
use fms_mod, only : write_version_number, mpp_pe, mpp_root_pe, &
- open_namelist_file, close_file, file_exist, &
check_nml_error, error_mesg, &
stdlog, stdout, string, lowercase, &
NOTE, FATAL
+use fms2_io_mod, only : file_exists
use time_manager_mod, only : time_type
use diag_manager_mod, only : send_data, register_diag_field
use atmos_cmip_diag_mod, only : register_cmip_diag_field_2d
@@ -24,7 +24,8 @@ module atmos_sea_salt_mod
get_tracer_names, set_tracer_atts, &
query_method, NO_TRACER
use field_manager_mod, only : parse, MODEL_ATMOS
-use atmos_tracer_utilities_mod, only : wet_deposition, dry_deposition
+use atmos_tracer_utilities_mod, only : wet_deposition, dry_deposition, &
+ sedimentation_velocity,sedimentation_flux
implicit none
private
@@ -267,7 +268,7 @@ subroutine atmos_seasalt_sourcesink1 ( &
real :: rho_air
real :: a1, a2, Bcoef, r, dr, rmid
real, dimension(size(pfull,3)) :: vdep, seasalt_conc0, seasalt_conc1
- real, dimension(size(pfull,3)) :: dz, air_dens, qn, qn1
+ real, dimension(size(pfull,3)) :: dz, air_dens
real :: sst
integer :: istep, nstep
@@ -422,26 +423,10 @@ subroutine atmos_seasalt_sourcesink1 ( &
endif
enddo
if (use_sj_sedimentation_solver) then
- qn(:)=seasalt(i,j,:)
- qn1(1)=qn(1)*dz(1)/(dz(1)+dt*vdep(1))
- do k=2,kb
- qn1(k)=(qn(k)*dz(k)+dt*qn1(k-1)*vdep(k-1)*air_dens(k-1)/air_dens(k))/(dz(k)+dt*vdep(k))
- enddo
- seasalt_dt(i,j,:)=seasalt_dt(i,j,:)+(qn1(:)-qn(:))/dt
- seasalt_setl(i,j) = qn1(kb)*air_dens(kb)/mtv*vdep(kb)
-
-!---> h1g, 2016-04-05
- if( ssalt_debug ) then
-!$OMP CRITICAL
-
-! if (mpp_pe()==mpp_root_pe()) then
-! write(logunit,'("SALT ",2i5," qn(kb)=",e12.4," qn1(kb)=",e12.4," vdep(kb)=",e12.4," air_dens(kb)=",e12.4," dz(kb)=",e12.4," dt=",e12.4," dust_dt=",e12.4," setl=",e12.4)') &
-! i,j,qn(kb),qn1(kb),vdep(kb),air_dens(kb),dz(kb),dt,seasalt_dt(i,j,kb),seasalt_setl(i,j)
-! endif
-!$OMP END CRITICAL
- end if ! ssalt_debug
-!<--- h1g, 2016-04-05
-
+ call sedimentation_flux(use_sj_sedimentation_solver,kb, &
+ dt,mtv,dz,vdep,air_dens,&
+ pwt(i,j,:),seasalt(i,j,:),seasalt_dt(i,j,:),setl)
+ seasalt_setl(i,j) = setl(kb)
else
do k=1,kb
step = (zhalf(i,j,k)-zhalf(i,j,k+1)) / vdep(k) / 2.
@@ -484,24 +469,6 @@ subroutine atmos_seasalt_sourcesink1 ( &
end subroutine atmos_seasalt_sourcesink1
-
-!#######################################################################
-! calculates the vertical velocity of seasalt settling
-elemental real function sedimentation_velocity(T,p,rwet,rho_wet_seasalt) result(vdep)
- real, intent(in) :: T ! air temperature, deg K
- real, intent(in) :: p ! pressure, Pa
- real, intent(in) :: rwet ! radius of seasalt particles, m
- real, intent(in) :: rho_wet_seasalt ! density of seasalt particles, kg/m3
-
- real :: viscosity, free_path, C_c
- viscosity = 1.458E-6 * T**1.5/(T+110.4) ! Dynamic viscosity
- free_path = 6.6e-8*T/293.15*(PSTD_MKS/p)
- C_c = 1.0 + free_path/rwet * & ! Slip correction [none]
- (1.257+0.4*exp(-1.1*rwet/free_path))
- vdep = 2./9.*C_c*GRAV*rho_wet_seasalt*rwet**2/viscosity ! Settling velocity [m/s]
-end function sedimentation_velocity
-
-
!######################################################################
! given a tracer index, returns TRUE if this is one of seasalt tracers
function is_seasalt_tracer(tr) result(ret)
@@ -566,7 +533,7 @@ subroutine atmos_sea_salt_init (lonb, latb, axes, Time, mask)
real, optional, intent(in) :: mask(:,:,:)
! ---- local vars
- integer :: outunit, unit, ierr, io
+ integer :: outunit, ierr, io
integer :: n_atm_tracers ! number of prognostic atmos tracers
integer :: tr ! atmos tracer iterator
integer :: i ! running index of seasalt tracers
@@ -583,18 +550,9 @@ subroutine atmos_sea_salt_init (lonb, latb, axes, Time, mask)
outunit = stdout()
! read namelist.
- if ( file_exist('input.nml')) then
-#ifdef INTERNAL_FILE_NML
+ if ( file_exists('input.nml')) then
read (input_nml_file, nml=ssalt_nml, iostat=io)
ierr = check_nml_error(io,'ssalt_nml')
-#else
- unit = open_namelist_file ( )
- ierr=1; do while (ierr /= 0)
- read (unit, nml=ssalt_nml, iostat=io, end=10)
- ierr = check_nml_error(io, 'ssalt_nml')
- end do
-10 call close_file (unit)
-#endif
endif
! write namelist to the log file
diff --git a/atmos_shared/tracer_driver/atmos_soa.F90 b/atmos_shared/tracer_driver/atmos_soa.F90
index 5b6e3883..7258475d 100644
--- a/atmos_shared/tracer_driver/atmos_soa.F90
+++ b/atmos_shared/tracer_driver/atmos_soa.F90
@@ -17,14 +17,13 @@ module atmos_soa_mod
!-----------------------------------------------------------------------
use mpp_mod, only: input_nml_file
-use fms_mod, only : file_exist, &
- write_version_number, &
+use fms_mod, only : write_version_number, &
mpp_pe, &
mpp_root_pE, &
- close_file, &
stdout, stdlog, &
check_nml_error, error_mesg, &
- open_namelist_file, FATAL, NOTE
+ FATAL, NOTE
+use fms2_io_mod, only : file_exists
use time_manager_mod, only : time_type, &
days_in_month, &
set_date, set_time, print_date, get_date, &
@@ -184,7 +183,7 @@ subroutine atmos_SOA_init ( lonb, latb, nlev, axes, Time, mask)
!
!-----------------------------------------------------------------------
!
- integer unit,io,ierr, logunit, outunit
+ integer io,ierr, logunit, outunit
character(len=3) :: SOA_tracer
!
data SOA_tracer/'SOA'/
@@ -193,18 +192,9 @@ subroutine atmos_SOA_init ( lonb, latb, nlev, axes, Time, mask)
if (module_is_initialized) return
! read namelist.
!-----------------------------------------------------------------------
- if ( file_exist('input.nml')) then
-#ifdef INTERNAL_FILE_NML
+ if ( file_exists('input.nml')) then
read (input_nml_file, nml=secondary_organics_nml, iostat=io)
ierr = check_nml_error(io,'secondary_organics_nml')
-#else
- unit = open_namelist_file ( )
- ierr=1; do while (ierr /= 0)
- read (unit, nml=secondary_organics_nml, iostat=io, end=10)
- ierr = check_nml_error(io,'secondary_organics_nml')
- end do
-10 call close_file (unit)
-#endif
endif
!---------------------------------------------------------------------
@@ -227,7 +217,7 @@ subroutine atmos_SOA_init ( lonb, latb, nlev, axes, Time, mask)
write (logunit,30) SOA_tracer,nsoa
endif
- 30 format (A,' was initialized as tracer number ',i2)
+ 30 format (A,' was initialized as tracer number ',i3)
!----- check for other required tracers ------------
diff --git a/atmos_shared/tracer_driver/atmos_sulfate.F90 b/atmos_shared/tracer_driver/atmos_sulfate.F90
index 86ac4b03..9bc64af0 100644
--- a/atmos_shared/tracer_driver/atmos_sulfate.F90
+++ b/atmos_shared/tracer_driver/atmos_sulfate.F90
@@ -21,15 +21,14 @@ module atmos_sulfate_mod
!-----------------------------------------------------------------------
use mpp_mod, only : input_nml_file
-use fms_mod, only : file_exist, &
- write_version_number, &
+use fms_mod, only : write_version_number, &
mpp_pe, &
mpp_root_pE, &
- close_file, &
stdlog, &
check_nml_error, error_mesg, &
- open_namelist_file, FATAL, NOTE, WARNING, &
+ FATAL, NOTE, WARNING, &
lowercase !f1p
+use fms2_io_mod, only : file_exists
use time_manager_mod, only : time_type, &
days_in_month, days_in_year, &
set_date, set_time, get_date_julian, &
@@ -332,7 +331,7 @@ subroutine atmos_sulfate_init ( lonb, latb, nlev, axes, Time, mask)
!-----------------------------------------------------------------------
!
- integer unit,io, logunit
+ integer io, logunit
character(len=12) :: SOx_tracer(5)
!
! 1. DMS = Dimethyl sulfide = CH3SCH3
@@ -356,18 +355,9 @@ subroutine atmos_sulfate_init ( lonb, latb, nlev, axes, Time, mask)
! read namelist.
!-----------------------------------------------------------------------
- if ( file_exist('input.nml')) then
-#ifdef INTERNAL_FILE_NML
+ if ( file_exists('input.nml')) then
read (input_nml_file, nml=simple_sulfate_nml, iostat=io)
ierr = check_nml_error(io,'simple_sulfate_nml')
-#else
- unit = open_namelist_file ( )
- ierr=1; do while (ierr /= 0)
- read (unit, nml=simple_sulfate_nml, iostat=io, end=10)
- ierr = check_nml_error(io,'simple_sulfate_nml')
- end do
-10 call close_file (unit)
-#endif
endif
!---------------------------------------------------------------------
diff --git a/atmos_shared/tracer_driver/atmos_sulfur_hex.F90 b/atmos_shared/tracer_driver/atmos_sulfur_hex.F90
index 25086794..7a63d3d7 100644
--- a/atmos_shared/tracer_driver/atmos_sulfur_hex.F90
+++ b/atmos_shared/tracer_driver/atmos_sulfur_hex.F90
@@ -40,12 +40,9 @@ module atmos_sulfur_hex_mod
!
!
-use fms_mod, only : file_exist, &
-! open_file, &
- mpp_pe, &
+use fms_mod, only : mpp_pe, &
mpp_root_pe, &
stdlog, stdout, &
- close_file, &
write_version_number
use mpp_mod, only : get_unit
use time_manager_mod, only : time_type, &
diff --git a/atmos_shared/tracer_driver/atmos_tracer_driver.F90 b/atmos_shared/tracer_driver/atmos_tracer_driver.F90
index 7003f23c..a88e1798 100644
--- a/atmos_shared/tracer_driver/atmos_tracer_driver.F90
+++ b/atmos_shared/tracer_driver/atmos_tracer_driver.F90
@@ -92,8 +92,9 @@ module atmos_tracer_driver_mod
!-----------------------------------------------------------------------
use mpp_mod, only : input_nml_file
-use fms_mod, only : file_exist, close_file,&
- open_namelist_file, check_nml_error, &
+use mpp_domains_mod, only : domain2D
+use fms2_io_mod, only : file_exists
+use fms_mod, only : check_nml_error, &
write_version_number, &
error_mesg, &
FATAL, &
@@ -183,6 +184,15 @@ module atmos_tracer_driver_mod
atmos_SOA_endts, &
atmos_SOA_end, &
atmos_SOA_chem
+use atmos_nh3_tag_mod, only : atmos_nh3_tag_init, &
+ atmos_nh3_tag_time_vary, &
+ atmos_nh3_tag_end, &
+ atmos_nh3_tag_endts, &
+ atmos_nh3_tag_driver, &
+ atmos_nh3_tag_flux_init, &
+ atmos_nh3_tag_gather_data, &
+ is_nh3_tag_tracer
+
use tropchem_driver_mod, only : tropchem_driver, &
tropchem_driver_time_vary, &
tropchem_driver_endts, &
@@ -275,6 +285,7 @@ module atmos_tracer_driver_mod
integer :: tropopause_clock = 0
logical :: do_tropchem = .false. ! Do tropospheric chemistry?
+logical :: do_nh3_tag = .false.
logical :: do_coupled_stratozone = .FALSE. !Do stratospheric chemistry?
integer :: nsphum ! Specific humidity parameter
@@ -763,7 +774,7 @@ subroutine atmos_tracer_driver (is, ie, js, je, Time, lon, lat, &
tracer(:,:,kd,n), Time, Time_next, &
lon, half_day, &
drydep_data(n),con_atm)
- if (do_nh3_atm_ocean_exchange .and. n.eq.nNH3) then
+ if (do_nh3_atm_ocean_exchange .and. (n.eq.nNH3.or.is_nh3_tag_tracer(n))) then
!f1p: scale dry deposition of nh3 by the land fraction since ocean exchange is handled separately
dsinku(:,:,n) = dsinku(:,:,n)*max(1.-frac_open_sea,0.)
!f1p: archive the dry deposition of nh3, since it needs to be forced to 0. for the ocean
@@ -809,6 +820,8 @@ subroutine atmos_tracer_driver (is, ie, js, je, Time, lon, lat, &
!---- cmip variables ----
if (id_n_ox_ddep > 0) used = send_data (id_n_ox_ddep, sum_n_ox_ddep, Time_next, &
is_in=is, js_in=js)
+ if (id_n_red_ddep > 0) used = send_data (id_n_red_ddep, sum_n_red_ddep, Time_next, &
+ is_in=is, js_in=js)
if (id_dryso2 > 0) then
if (nSO2_cmip > 0) then
@@ -1659,6 +1672,17 @@ subroutine atmos_tracer_driver (is, ie, js, je, Time, lon, lat, &
!f1p: remove nh3_ddep from sum_n_red_ddep if nh3 is exchanged between atmosphere and ocean
call atmos_nitrogen_drydep_flux_set(max(sum_n_red_ddep-nh3_ddep,0.),sum_n_ox_ddep, is,ie,js,je)
+!tag nh3
+ if (do_nh3_tag) then
+ call atmos_nh3_tag_driver( lon, lat, land, ocn_flx_fraction, pwt, &
+ tracer,rm, rdt, &
+ Time, phalf, pfull, t, is, ie, js, je, dt, &
+ z_half, z_full, coszen, &
+ half_day, &
+ Time_next, &
+ kbot)
+ end if
+
end subroutine atmos_tracer_driver
!
@@ -1701,9 +1725,10 @@ end subroutine atmos_tracer_driver
!
! Tracer fields dimensioned as (nlon,nlat,nlev,ntrace).
!
- subroutine atmos_tracer_driver_init (lonb, latb, r, axes, Time, phalf, mask)
+ subroutine atmos_tracer_driver_init (domain, lonb, latb, r, axes, Time, phalf, mask)
!-----------------------------------------------------------------------
+type(domain2D),target,intent(in) :: domain !< Atmosphere domain
real, intent(in), dimension(:,:) :: lonb, latb
real, intent(inout), dimension(:,:,:,:) :: r
type(time_type), intent(in) :: Time
@@ -1740,7 +1765,7 @@ subroutine atmos_tracer_driver_init (lonb, latb, r, axes, Time, phalf, mask)
!------------------------------------------------------------------------
! read namelist.
!------------------------------------------------------------------------
- call read_nml_file()
+
!---------------------------------------------------------------------
! make sure that astronomy_mod has been initialized (if radiation
! not being called in this run, it will not have previously been
@@ -1767,7 +1792,7 @@ subroutine atmos_tracer_driver_init (lonb, latb, r, axes, Time, phalf, mask)
!----- initialize the age tracer ------------
- call atmos_age_tracer_init( r, axes, Time, nage, lonb, latb, phalf, mask)
+ call atmos_age_tracer_init( domain, r, axes, Time, nage, lonb, latb, phalf, mask)
age_tracer_clock = mpp_clock_id( 'Tracer: Age tracer', grain=CLOCK_MODULE )
call get_number_tracers (MODEL_ATMOS, num_tracers=nt, &
@@ -1791,15 +1816,13 @@ subroutine atmos_tracer_driver_init (lonb, latb, r, axes, Time, phalf, mask)
!------------------------------------------------------------------------
-! Initialize tropospheric chemistry
+! Initialize tropospheric chemistry and dry deposition
!------------------------------------------------------------------------
- allocate( drydep_data(nt) )
- do_tropchem = tropchem_driver_init(r,mask,axes,Time,lonb,latb,phalf,drydep_data)
- if ( .not. do_tropchem ) then
- do n = 1,ntp
- call dry_deposition_init(n,lonb,latb,drydep_data(n))
- end do
- end if
+ allocate( drydep_data(ntp) )
+ do_tropchem = tropchem_driver_init(domain, r,mask,axes,Time,lonb,latb,phalf)
+ do n = 1,ntp
+ call dry_deposition_init(n,lonb,latb,drydep_data(n))
+ end do
tropchem_clock = mpp_clock_id( 'Tracer: Tropospheric chemistry', &
grain=CLOCK_MODULE )
@@ -1957,7 +1980,7 @@ subroutine atmos_tracer_driver_init (lonb, latb, r, axes, Time, phalf, mask)
write(*,*) 'Allocating xactive_ndx, number of xactive tracers = ', nxactive
ENDIF
ALLOCATE( xactive_ndx (nxactive) )
- call xactive_bvoc_init(lonb, latb, Time, axes, xactive_ndx )
+ call xactive_bvoc_init(domain, lonb, latb, Time, axes, xactive_ndx )
xbvoc_clock = mpp_clock_id( 'xactive_bvocs', &
grain=CLOCK_MODULE )
endif
@@ -1978,6 +2001,9 @@ subroutine atmos_tracer_driver_init (lonb, latb, r, axes, Time, phalf, mask)
call get_number_tracers (MODEL_ATMOS, num_tracers=nt, &
num_prog=ntp)
+!initialized nh3 tag
+ do_nh3_tag = atmos_nh3_tag_init(nt,axes,Time,lonb,latb,do_nh3_atm_ocean_exchange)
+
id_landfr = register_diag_field ( mod_name, &
'landfr_atm', axes(1:2), Time, &
'land fraction', &
@@ -2484,6 +2510,11 @@ subroutine atmos_nitrogen_flux_init
atm_tr_index = nNH3, &
mol_wt = WTMN, param = (/ 17.,25. /), &
caller = trim(mod_name) // '(' // trim(sub_name) // ')')
+
+! if (do_nh3_tag) call atmos_nh3_tag_flux_init
+!do_nh3_tag is not set up at this stage any more so call routine all the time
+ call atmos_nh3_tag_flux_init
+
end if
endif
@@ -2532,7 +2563,9 @@ subroutine atmos_tracer_driver_time_vary (Time)
call tropchem_driver_time_vary (Time)
endif
-
+ if (do_nh3_tag) then
+ call atmos_nh3_tag_time_vary (Time)
+ end if
end subroutine atmos_tracer_driver_time_vary
@@ -2544,6 +2577,9 @@ subroutine atmos_tracer_driver_endts
if (do_tropchem) then
call tropchem_driver_endts
endif
+ if (do_nh3_tag) then
+ call atmos_nh3_tag_endts
+ end if
if (nbcphobic > 0 .and. nbcphilic > 0 .and. &
nomphobic > 0 .and. nomphilic > 0) then
call atmos_carbon_aerosol_endts
@@ -2702,6 +2738,9 @@ subroutine atmos_tracer_driver_gather_data(gas_fields, tr_bot)
if (ind_nh3_flux .gt. 0) then
gas_fields%bc(ind_nh3_flux)%field(ind_pcair)%values(:,:) = tr_bot(:,:,nNH3)
end if
+
+ if (do_nh3_tag) call atmos_nh3_tag_gather_data(gas_fields,tr_bot)
+
!-----------------------------------------------------------------------
end subroutine atmos_tracer_driver_gather_data
@@ -2796,22 +2835,11 @@ end subroutine atmos_nitrogen_drydep_flux_set
subroutine read_nml_file()
integer :: io
integer :: ierr
- integer :: funit
integer :: logunit
if (read_nml) then
- if (file_exist('input.nml')) then
-#ifdef INTERNAL_FILE_NML
+ if (file_exists('input.nml')) then
read(input_nml_file,nml=atmos_tracer_driver_nml,iostat=io)
ierr = check_nml_error(io,'atmos_tracer_driver_nml')
-#else
- funit = open_namelist_file()
- ierr = 1
- do while (ierr .ne. 0)
- read(funit,nml=atmos_tracer_driver_nml,iostat=io,end=10)
- ierr = check_nml_error(io,'atmos_tracer_driver_nml')
- enddo
-10 call close_file(funit)
-#endif
endif
!--------- write version and namelist to standard log ------------
call write_version_number(version,tagname)
diff --git a/atmos_shared/tracer_driver/atmos_tracer_utilities.F90 b/atmos_shared/tracer_driver/atmos_tracer_utilities.F90
index b3ce548d..caaf3c2b 100644
--- a/atmos_shared/tracer_driver/atmos_tracer_utilities.F90
+++ b/atmos_shared/tracer_driver/atmos_tracer_utilities.F90
@@ -25,11 +25,11 @@ module atmos_tracer_utilities_mod
! --->h1g, add a scale factor for aerosol wet deposition, 2014-04-10
use mpp_mod, only: input_nml_file
- use fms_mod, only: open_namelist_file, fms_init, &
+ use fms_mod, only: fms_init, &
mpp_pe, mpp_root_pe, stdlog, &
- file_exist, write_version_number, &
+ write_version_number, &
check_nml_error, error_mesg, &
- FATAL, close_file
+ FATAL
! <---h1g,
use fms_mod, only : lowercase, uppercase, &
@@ -67,7 +67,8 @@ module atmos_tracer_utilities_mod
DENS_H2O, & ! Water density [kg/m3]
WTMH2O, & ! Water molecular weight [g/mole]
WTMAIR, & ! Air molecular weight [g/mole]
- AVOGNO ! Avogadro's number
+ AVOGNO, & ! Avogadro's number
+ PSTD_MKS
use interpolator_mod, only : interpolator, &
obtain_interpolator_time_slices, &
unset_interpolator_time_flag, &
@@ -96,7 +97,9 @@ module atmos_tracer_utilities_mod
get_cldf, &
sjl_fillz, &
get_cmip_param, &
- get_chem_param
+ get_chem_param, &
+ sedimentation_velocity, &
+ sedimentation_flux
!---- version number -----
character(len=128) :: version = '$Id$'
@@ -184,7 +187,7 @@ module atmos_tracer_utilities_mod
logical :: drydep_exp = .false.
real :: T_snow_dep = 263.15
real :: kbs_val = 50. ! surface conductance of rough sea (m/s)
- namelist /wetdep_nml/ scale_aerosol_wetdep, scale_aerosol_wetdep_snow, file_dry, drydep_exp, T_snow_dep, &
+ namelist /atmos_tracer_utilities_nml/ scale_aerosol_wetdep, scale_aerosol_wetdep_snow, file_dry, drydep_exp, T_snow_dep, &
kbs_val
! <---h1g,
contains
@@ -238,7 +241,7 @@ subroutine atmos_tracer_utilities_init(lonb, latb, mass_axes, Time)
! --->h1g, add a scale factor for aerosol wet deposition, 2014-04-10
! local variables:
- integer :: unit, io, ierr
+ integer :: io, ierr
! <---h1g,
! Make local copies of the local domain dimensions for use
@@ -304,19 +307,8 @@ subroutine atmos_tracer_utilities_init(lonb, latb, mass_axes, Time)
!-----------------------------------------------------------------------
! read namelist.
!-----------------------------------------------------------------------
-#ifdef INTERNAL_FILE_NML
- read (input_nml_file, nml=wetdep_nml, iostat=io)
- ierr = check_nml_error(io,'wetdep_nml')
-#else
- if ( file_exist('input.nml')) then
- unit = open_namelist_file ( )
- ierr=1; do while (ierr /= 0)
- read (unit, nml=wetdep_nml, iostat=io, end=10)
- ierr = check_nml_error(io,'wetdep_nml')
- end do
-10 call close_file (unit)
- endif
-#endif
+ read (input_nml_file, nml=atmos_tracer_utilities_nml, iostat=io)
+ ierr = check_nml_error(io,'atmos_tracer_utilities_nml')
flag = query_method ('wet_deposition',MODEL_ATMOS,n, &
Wetdep(n)%text_in_scheme,Wetdep(n)%control)
@@ -2059,7 +2051,7 @@ subroutine get_cmip_param(n,cmip_name,cmip_longname,cmip_longname2)
integer, intent(in) :: n
character(len=*), intent(out), optional :: cmip_name, cmip_longname, cmip_longname2
- character(len=100) :: cmip_data, cmip_scheme
+ character(len=200) :: cmip_data, cmip_scheme
logical flag
real :: mw
integer :: iflag
@@ -2564,6 +2556,58 @@ subroutine sjl_fillz(im, km, nq, q, dp)
enddo
enddo
end subroutine sjl_fillz
+!#######################################################################
+! calculates the vertical velocity of dust settling
+elemental real function sedimentation_velocity(T,p,rwet,rho_wet_dust) result(vdep)
+ real, intent(in) :: T ! air temperature, deg K
+ real, intent(in) :: p ! pressure, Pa
+ real, intent(in) :: rwet ! radius of dust particles, m
+ real, intent(in) :: rho_wet_dust ! density of dust particles, kg/m3
+
+ real :: viscosity, free_path, C_c
+ viscosity = 1.458E-6 * T**1.5/(T+110.4) ! Dynamic viscosity
+ free_path = 6.6e-8*T/293.15*(PSTD_MKS/p)
+ C_c = 1.0 + free_path/rwet * & ! Slip correction [none]
+ (1.257+0.4*exp(-1.1*rwet/free_path))
+ vdep = 2./9.*C_c*GRAV*rho_wet_dust*rwet**2/viscosity ! Settling velocity [m/s]
+end function sedimentation_velocity
+!#######################################################################
+subroutine sedimentation_flux(sj_scheme,kb,dt,mtv,dz,vdep,air_dens,&
+ pwt,tracer,tracer_dt,setl)
+ implicit none
+ integer, intent(in) :: kb !< index for the buttom layer
+ real, intent(in) :: dt, mtv !< model timestep , mixing ratio factor conversion
+ logical, intent(in) :: sj_scheme !< .true. if using SJ's scheme
+ real, intent(in), dimension(:) :: dz, air_dens, pwt ! 0.0) then
+ setl(k)=tracer(k)*air_dens(k)/mtv*vdep(k) ! settling flux [kg/m2/s]
+ endif
+ enddo
+ tracer_dt(1)=tracer_dt(1)-setl(1)/pwt(1)*mtv
+ tracer_dt(2:kb)=tracer_dt(2:kb) &
+ + ( setl(1:kb-1) - setl(2:kb) )/pwt(2:kb)*mtv
+ endif
+end subroutine sedimentation_flux
+! ==============================================================================
end module atmos_tracer_utilities_mod
diff --git a/atmos_shared/tracer_driver/atmos_tropopause.F90 b/atmos_shared/tracer_driver/atmos_tropopause.F90
index cb3e883e..be058d2a 100644
--- a/atmos_shared/tracer_driver/atmos_tropopause.F90
+++ b/atmos_shared/tracer_driver/atmos_tropopause.F90
@@ -12,11 +12,12 @@ module atmos_tropopause_mod
!
-use fms_mod, only : file_exist, write_version_number, &
+use fms_mod, only : write_version_number, &
mpp_pe, mpp_root_pe, &
- close_file, stdlog, stdout, &
+ stdlog, stdout, &
check_nml_error, error_mesg, &
- open_namelist_file, FATAL, NOTE, WARNING
+ FATAL, NOTE, WARNING
+use fms2_io_mod, only : file_exists
use diag_manager_mod, only : send_data
use atmos_cmip_diag_mod, only : register_cmip_diag_field_2d
use time_manager_mod, only : time_type
@@ -194,7 +195,7 @@ subroutine atmos_tropopause_init (Time)
! io error status returned from io operation
!-----------------------------------------------------------------------
!
-integer :: ierr, unit, io
+integer :: ierr, io
!
!-----------------------------------------------------------------------
! local parameters
@@ -208,18 +209,9 @@ subroutine atmos_tropopause_init (Time)
!-----------------------------------------------------------------------
! read namelist.
!-----------------------------------------------------------------------
- if ( file_exist('input.nml')) then
-#ifdef INTERNAL_FILE_NML
+ if ( file_exists('input.nml')) then
read (input_nml_file, nml=atmos_tropopause_nml, iostat=io)
ierr = check_nml_error(io,'atmos_tropopause_nml')
-#else
- unit = open_namelist_file ( )
- ierr=1; do while (ierr /= 0)
- read (unit, nml=atmos_tropopause_nml, iostat=io, end=10)
- ierr = check_nml_error(io,'atmos_tropopause_nml')
- end do
-10 call close_file (unit)
-#endif
end if
!---------------------------------------------------------------------
diff --git a/atmos_shared/tracer_driver/stratchem/strat_chem_driver.F90 b/atmos_shared/tracer_driver/stratchem/strat_chem_driver.F90
index 10d8932f..6e5fb1a7 100644
--- a/atmos_shared/tracer_driver/stratchem/strat_chem_driver.F90
+++ b/atmos_shared/tracer_driver/stratchem/strat_chem_driver.F90
@@ -2,14 +2,10 @@ module strat_chem_driver_mod
use mpp_mod, only: input_nml_file
-use fms_mod, only : file_exist, &
- check_nml_error, &
- close_file, open_namelist_file, &
+use fms_mod, only : check_nml_error, &
stdlog, write_version_number, &
error_mesg, FATAL
-use mpp_io_mod, only: mpp_open, mpp_close, &
- MPP_NATIVE, MPP_RDONLY, MPP_DELETE
-
+use fms2_io_mod, only: file_exists
use tracer_manager_mod, only : get_tracer_index, NO_TRACER
use field_manager_mod, only : MODEL_ATMOS
@@ -96,24 +92,15 @@ module strat_chem_driver_mod
function strat_chem_driver_init()
logical :: strat_chem_driver_init
- integer :: unit, ierr, io, logunit
+ integer :: ierr, io, logunit
!---------------------------------------------------------------------
! read strat_chem namelist.
!---------------------------------------------------------------------
- if (file_exist('input.nml')) then
-#ifdef INTERNAL_FILE_NML
+ if (file_exists('input.nml')) then
read (input_nml_file, nml=strat_chem_nml, iostat=io)
ierr = check_nml_error(io,'strat_chem_nml')
-#else
- unit = open_namelist_file ( )
- ierr=1; do while (ierr /= 0)
- read (unit, nml=strat_chem_nml, iostat=io, end=10)
- ierr = check_nml_error (io, 'strat_chem_nml')
- enddo
- 10 call close_file (unit)
-#endif
endif
strat_chem_driver_init = do_coupled_stratozone
@@ -152,7 +139,7 @@ subroutine chem_startup()
!
! local variables:
- integer :: unit, outunit
+ integer :: funit, outunit
if(run_startup) then
run_startup = .false.
@@ -208,49 +195,51 @@ subroutine chem_startup()
! read in chemical lower boundary
!
outunit = stdout()
- call mpp_open( unit, 'INPUT/chemlbf',action=MPP_RDONLY )
+ open(file='INPUT/chemlbf', form='formatted',action='read', newunit=funit)
if (mpp_pe() == mpp_root_pe()) WRITE(outunit,*) 'INPUT/chemlbf'
DO NC = 1,15
- READ(unit,'(6E13.6)') (CHLB(JL,NC),JL=1,90)
+ READ(funit,'(6E13.6)') (CHLB(JL,NC),JL=1,90)
ENDDO
- READ(unit,'(6E13.6)') OZB
- read(unit,'(6e13.6)') tropc
- call mpp_close(unit)
+ READ(funit,'(6E13.6)') OZB
+ read(funit,'(6e13.6)') tropc
+ close(funit)
!
! read in photolysis files
!
- call mpp_open( unit, 'INPUT/photolsmax', action=MPP_RDONLY )
+ open(file='INPUT/photolsmax', form='formatted',action='read', newunit=funit)
if (mpp_pe() == mpp_root_pe()) WRITE(outunit,*) 'INPUT/photolsmax'
DO LEV = 1,48
DO IPZ = 1,11
DO ICZ = 1,14
- READ(unit,'(I4,E12.4,2F10.4,5(/6E12.4),/3E12.4)') &
+ READ(funit,'(I4,E12.4,2F10.4,5(/6E12.4),/3E12.4)') &
LV,OZON(IPZ,LEV),COSP(ICZ),COSPHC(LEV), &
(PHOTO(IR,ICZ,IPZ,LEV),IR=1,33)
- READ(unit,'(5(6E12.4/),3E12.4)') &
+ READ(funit,'(5(6E12.4/),3E12.4)') &
(PHOTO(IR,ICZ,IPZ,LEV),IR=34,66)
enddo
enddo
enddo
- call mpp_close(unit)
- call mpp_open( unit, 'INPUT/photolsmin', action=MPP_RDONLY )
+ close(funit)
+
+ open(file='INPUT/photolsmin', form='formatted',action='read', newunit=funit)
if (mpp_pe() == mpp_root_pe()) WRITE(outunit,*) 'INPUT/photolsmin'
DO LEV = 1,48
DO IPZ = 1,11
DO ICZ = 1,14
- READ(unit,'(I4,E12.4,2F10.4,5(/6E12.4),/3E12.4)') &
+ READ(funit,'(I4,E12.4,2F10.4,5(/6E12.4),/3E12.4)') &
LV,OZON(IPZ,LEV),COSP(ICZ),COSPHC(LEV), &
(PHOTO(IR,ICZ,IPZ,LEV),IR=67,99)
- READ(unit,'(5(6E12.4/),3E12.4)') &
+ READ(funit,'(5(6E12.4/),3E12.4)') &
(PHOTO(IR,ICZ,IPZ,LEV),IR=100,132)
enddo
enddo
enddo
- call mpp_close(unit)
- call mpp_open( unit, 'INPUT/solar_f107.dat', action=MPP_RDONLY )
+ close(funit)
+
+ open(file='INPUT/solar_f107.dat', form='formatted',action='read', newunit=funit)
if (mpp_pe() == mpp_root_pe()) WRITE(outunit,*) 'INPUT/solar_f107.dat'
- read(unit,'(f6.0,5f7.0)') solardata
- call mpp_close(unit)
+ read(funit,'(f6.0,5f7.0)') solardata
+ close(funit)
DO LEV = 1,48
DO IPZ = 1,11
DO ICZ = 1,14
@@ -263,18 +252,18 @@ subroutine chem_startup()
!
! read in data for Cly and Bry computation
!
- call mpp_open( unit, 'INPUT/dfdage.dat', action=MPP_RDONLY )
+ open(file='INPUT/dfdage.dat', form='formatted',action='read', newunit=funit)
if (mpp_pe() == mpp_root_pe()) WRITE(outunit,*) 'INPUT/dfdage.dat'
- read(unit,'(6e13.6)') age
- read(unit,'(6e13.6)') dfdage
- call mpp_close(unit)
+ read(funit,'(6e13.6)') age
+ read(funit,'(6e13.6)') dfdage
+ close(funit)
!
! read in data for NOy tropospheric relaxation
!
- call mpp_open( unit, 'INPUT/noy_annual.dat', action=MPP_RDONLY )
+ open(file='INPUT/noy_annual.dat', form='formatted',action='read', newunit=funit)
if (mpp_pe() == mpp_root_pe()) WRITE(outunit,*) 'INPUT/noy_annual.dat'
- read(unit,'(6e13.6)') anoy
- call mpp_close(unit)
+ read(funit,'(6e13.6)') anoy
+ close(funit)
endif
diff --git a/atmos_shared/tracer_driver/tropchem/AM3_chem/AM3_fastjx.F90 b/atmos_shared/tracer_driver/tropchem/AM3_chem/AM3_fastjx.F90
index f2af039f..40540a3a 100644
--- a/atmos_shared/tracer_driver/tropchem/AM3_chem/AM3_fastjx.F90
+++ b/atmos_shared/tracer_driver/tropchem/AM3_chem/AM3_fastjx.F90
@@ -239,19 +239,14 @@ module AM3_FASTJX_MOD
! MATINW (B,A)
!
!-----------------------------------------------------------------------
- use fms_mod, only : file_exist, &
- write_version_number, &
+ use fms_mod, only : write_version_number, &
mpp_pe, &
mpp_root_pE, &
- close_file, &
stdlog, &
mpp_clock_begin, mpp_clock_end, &
mpp_clock_id, CLOCK_MODULE, &
check_nml_error, error_mesg, &
- open_namelist_file, FATAL
- use mpp_io_mod, only : mpp_open, mpp_close, MPP_RDONLY, &
- MPP_ASCII, MPP_SEQUENTIAL, &
- MPP_MULTI, MPP_SINGLE
+ FATAL
implicit none
@@ -1214,8 +1209,7 @@ subroutine RD_JS(NAMFIL)
! Reread the chem_Js.dat file to map photolysis rate to reaction
! Read in quantum yield jfacta and fastj2 label jlab
IPR = 0
- call mpp_open (NJ1, trim(NAMFIL), MPP_RDONLY, MPP_ASCII, &
- MPP_SEQUENTIAL, MPP_MULTI, MPP_SINGLE)
+ open(file=trim(NAMFIL), form='formatted',action='read', newunit=NJ1)
10 read (NJ1,'(A)',err=20) CLINE
if (IPR .eq. JVN_) goto 20
@@ -1232,7 +1226,7 @@ subroutine RD_JS(NAMFIL)
JFACTA(IPR) = JFACTA(IPR)/100.d0
go to 10
endif
- 20 call mpp_close(NJ1)
+ 20 close(NJ1)
NRATJ = IPR
@@ -2061,9 +2055,8 @@ subroutine RD_XXX(NAMFIL)
! note NQQQ is not used outside this subroutine!
! >>>> W_ = 12 <<<< means trop-only, discard WL #1-4 and #9-10, some X-s
-
- call mpp_open (NJ1, trim(NAMFIL), MPP_RDONLY, MPP_ASCII, &
- MPP_SEQUENTIAL, MPP_MULTI, MPP_SINGLE)
+
+ open(file=trim(NAMFIL), form='formatted',action='read', newunit=NJ1)
read (NJ1,100) TITLE0
read (NJ1,101) NJVAL,NQRD, NWWW
NW1 = 1
@@ -2198,7 +2191,7 @@ subroutine RD_XXX(NAMFIL)
TITLEJ(NJVAL-1) = 'Acet-a'
TITLEJ(NJVAL) = 'Acet-b'
- call mpp_close (NJ1)
+ close (NJ1)
100 format(a)
101 format(10x,5i5)
@@ -2243,9 +2236,7 @@ subroutine RD_MIE(NAMFIL)
! WAA(K,J),QAA(K,J),SAA(K,J),PAA(I,K,J)
!
!jul--
- call mpp_open (NJ1, trim(NAMFIL), MPP_RDONLY, MPP_ASCII, &
- MPP_SEQUENTIAL, MPP_MULTI, MPP_SINGLE)
-
+ open(file=trim(NAMFIL), form='formatted',action='read', newunit=NJ1)
read (NJ1,'(i2,a78)') NAA,TITLE0
if (NAA .gt. A_) then
write(*,*) 'ATMOS:fastjx_init: too many scat-data sets:', NAA, A_
@@ -2269,7 +2260,7 @@ subroutine RD_MIE(NAMFIL)
enddo
enddo
- call mpp_close (NJ1)
+ close (NJ1)
if (mpp_pe() == mpp_root_pe()) then
write(*,'(a,9f8.1)') ' ATMOS:fastjx_init: RD_MIE: Aerosol optical: r-eff/rho/Q(@wavel):' &
,(WAA(K,1),K=1,5)
@@ -2322,8 +2313,7 @@ subroutine RD_MIE_AM3(NAMFIL)
! WAA(K,J),QAA(K,J),SAA(K,J),PAA(I,K,J)
!
!jul--
- call mpp_open (NJ1, trim(NAMFIL), MPP_RDONLY, MPP_ASCII, &
- MPP_SEQUENTIAL, MPP_MULTI, MPP_SINGLE)
+ open(file=trim(NAMFIL), form='formatted',action='read', newunit=NJ1)
read (NJ1,'(i4,a78)') NAA_AM3, TITLE0_AM3
if (NAA_AM3 .gt. A_AM3) then
@@ -2358,7 +2348,7 @@ subroutine RD_MIE_AM3(NAMFIL)
enddo
enddo
- call mpp_close (NJ1)
+ close (NJ1)
! if (mpp_pe() == mpp_root_pe()) then
! write(*,'(a,9f8.1)') ' ATMOS:fastjx_init: RD_MIE: Aerosol optical: r-eff/rho/Q(@wavel):' &
! ,(WAA_AM3(K,1),K=1,5)
@@ -2399,9 +2389,8 @@ subroutine RD_UM(NAMFIL)
character(*), intent(in) :: NAMFIL
integer I, J, K, L, NJ1
-
- call mpp_open (NJ1, trim(NAMFIL), MPP_RDONLY, MPP_ASCII, &
- MPP_SEQUENTIAL, MPP_MULTI, MPP_SINGLE)
+
+ open(file=trim(NAMFIL), form='formatted',action='read', newunit=NJ1)
read (NJ1,'(a78)') TITLE0
! write(6,*) 'UMichigan Aerosol optical data'
@@ -2419,7 +2408,7 @@ subroutine RD_UM(NAMFIL)
enddo
enddo
- call mpp_close (NJ1)
+ close (NJ1)
! write(6,'(7(i5,1x,a4))') (L,TITLUM(L), L=1,33)
diff --git a/atmos_shared/tracer_driver/tropchem/AM4_chem/mo_fastjx.F90 b/atmos_shared/tracer_driver/tropchem/AM4_chem/mo_fastjx.F90
index 57edc92e..27dd4aa6 100644
--- a/atmos_shared/tracer_driver/tropchem/AM4_chem/mo_fastjx.F90
+++ b/atmos_shared/tracer_driver/tropchem/AM4_chem/mo_fastjx.F90
@@ -409,19 +409,14 @@ module MO_FASTJX_MOD
! END MODULE FJX_SUB_MOD
!----------------------------------------------------------------------------------
- use fms_mod, only : file_exist, &
- write_version_number, &
+ use fms_mod, only : write_version_number, &
mpp_pe, &
mpp_root_pE, &
- close_file, &
stdlog, &
mpp_clock_begin, mpp_clock_end, &
mpp_clock_id, CLOCK_MODULE, &
check_nml_error, error_mesg, &
- open_namelist_file, FATAL
- use mpp_io_mod, only : mpp_open, mpp_close, MPP_RDONLY, &
- MPP_ASCII, MPP_SEQUENTIAL, &
- MPP_MULTI, MPP_SINGLE
+ FATAL
use time_manager_mod, only : time_type, get_date
use tropchem_types_mod, only : tropchem_opt
implicit none
@@ -1383,8 +1378,7 @@ subroutine RD_XXX(NAMFIL)
! >>>> W_ = 12 <<<< means trop-only, discard WL #1-4 and #9-10, some X-sects
! open (NUN,FILE=NAMFIL,status='old',form='formatted')
- call mpp_open (NUN, trim(NAMFIL), MPP_RDONLY, MPP_ASCII, &
- MPP_SEQUENTIAL, MPP_MULTI, MPP_SINGLE)
+ NUN = MO_open_file(trim(NAMFIL))
read (NUN,100) TITLE0
@@ -1576,7 +1570,7 @@ subroutine RD_XXX(NAMFIL)
endif
endif
- call mpp_close (NUN)
+ close (NUN)
100 format(a)
101 format(10x,5i5)
@@ -1615,9 +1609,7 @@ subroutine RD_CLD(NAMFIL)
character*20 TITLAA(A_) ! TITLAA: Title for scatering data
! open (NUN,FILE=NAMFIL,status='old',form='formatted')
- call mpp_open (NUN, trim(NAMFIL), MPP_RDONLY, MPP_ASCII, &
- MPP_SEQUENTIAL, MPP_MULTI, MPP_SINGLE)
-
+ NUN = MO_open_file(trim(NAMFIL))
read (NUN,'(i2,a78)') NCC,TITLE0
if (NCC .gt. C_) then
@@ -1638,7 +1630,7 @@ subroutine RD_CLD(NAMFIL)
enddo
enddo
- call mpp_close(NUN)
+ close(NUN)
! write(*,'(a,9f8.1)') ' Aerosol optical: r-eff/rho/Q(@wavel):' &
! ,(WCC(K,1),K=1,5)
@@ -1676,9 +1668,7 @@ subroutine RD_MIE(NAMFIL)
character*20 TITLAA(A_) ! TITLAA: Title for scatering data
! open (NUN,FILE=NAMFIL,status='old',form='formatted')
- call mpp_open (NUN, trim(NAMFIL), MPP_RDONLY, MPP_ASCII, &
- MPP_SEQUENTIAL, MPP_MULTI, MPP_SINGLE)
-
+ NUN = MO_open_file(trim(NAMFIL))
read (NUN,'(i2,a78)') NAA,TITLE0
if (NAA .gt. A_) then
write(*,*)' too many aerosol-data sets: NAA > A_'
@@ -1698,7 +1688,7 @@ subroutine RD_MIE(NAMFIL)
enddo
enddo
- call mpp_close(NUN)
+ close(NUN)
! write(*,'(a,9f8.1)') ' Aerosol optical: r-eff/rho/Q(@wavel):' &
! ,(WAA(K,1),K=1,5)
@@ -1726,9 +1716,7 @@ subroutine RD_UM(NAMFIL)
character*20 TITLUM(33) ! TITLUM: Title for U Michigan aerosol data set
! open (NUN,FILE=NAMFIL,status='old',form='formatted')
- call mpp_open (NUN, trim(NAMFIL), MPP_RDONLY, MPP_ASCII, &
- MPP_SEQUENTIAL, MPP_MULTI, MPP_SINGLE)
-
+ NUN = MO_open_file(trim(NAMFIL))
read (NUN,'(a78)') TITLE0
! write(*,*) 'UMichigan Aerosols', TITLE0
read(NUN,'(5x,10f5.0)') WMM
@@ -1746,7 +1734,7 @@ subroutine RD_UM(NAMFIL)
enddo
enddo
- call mpp_close(NUN)
+ close(NUN)
! write(*,'(a)') 'collapse UM wavelengths, drop 550 nm'
WMM(4) = WMM(5)
@@ -1855,10 +1843,7 @@ subroutine RD_JS_JX(NAMFIL,TITLEJX,NJX)
JFACTA(:) = 0.d0
! open (NUNIT,file=NAMFIL,status='old',form='formatted')
- call mpp_open (NUNIT, trim(NAMFIL), MPP_RDONLY, MPP_ASCII, &
- MPP_SEQUENTIAL, MPP_MULTI, MPP_SINGLE)
-
-
+ NUNIT = MO_open_file(trim(NAMFIL))
read (NUNIT,'(a)') CLINE
! write(*,'(a)') CLINE
do J = 1,JVN_
@@ -1870,7 +1855,7 @@ subroutine RD_JS_JX(NAMFIL,TITLEJX,NJX)
NRATJ = JJ
enddo
- 20 call mpp_close(NUNIT)
+ 20 close(NUNIT)
!---Zero / Set index arrays that map Jvalue(j) onto rates
do K = 1,NRATJ
@@ -1904,8 +1889,7 @@ subroutine RD_SOLAR(NAMFIL)
character(*), intent(in) :: NAMFIL
integer NUN, year, month,nyr,nv,nband
- call mpp_open (NUN, trim(NAMFIL), MPP_RDONLY, MPP_ASCII, &
- MPP_SEQUENTIAL, MPP_MULTI, MPP_SINGLE)
+ NUN = MO_open_file(trim(NAMFIL))
read (NUN, FMT = '(4i8)') first_yr, last_yr, &
nvalues_per_year, numbands
if (numbands /= nbands) then
@@ -1933,7 +1917,7 @@ subroutine RD_SOLAR(NAMFIL)
read (NUN, FMT = '(2i6,e12.5)') year, month, solflxtot_ann_2300
read (NUN, FMT = '(6e12.5 )') (solflxband_ann_2300(nband), nband =1,numbands)
- call mpp_close(NUN)
+ close(NUN)
END SUBROUTINE RD_SOLAR
@@ -3797,8 +3781,7 @@ subroutine RD_MIE_AM3(NAMFIL)
! WAA(K,J),QAA(K,J),SAA(K,J),PAA(I,K,J)
!
!jul--
- call mpp_open (NJ1, trim(NAMFIL), MPP_RDONLY, MPP_ASCII, &
- MPP_SEQUENTIAL, MPP_MULTI, MPP_SINGLE)
+ NJ1 = MO_open_file(trim(NAMFIL))
read (NJ1,'(i4,a78)') NAA_AM3, TITLE0_AM3
if (NAA_AM3 .gt. A_AM3) then
@@ -3833,7 +3816,7 @@ subroutine RD_MIE_AM3(NAMFIL)
enddo
enddo
- call mpp_close (NJ1)
+ close (NJ1)
! if (mpp_pe() == mpp_root_pe()) then
! write(*,'(a,9f8.1)') ' ATMOS:fastjx_init: RD_MIE: Aerosol optical: r-eff/rho/Q(@wavel):' &
! ,(WAA_AM3(K,1),K=1,5)
@@ -3873,4 +3856,16 @@ real*8 FUNCTION FLINT (TINT,T1,T2,T3,F1,F2,F3)
endif
return
END FUNCTION FLINT
+
+!> @brief This function is just a wrapper for Fortran's `open`
+!! @return Unique unit number
+function MO_open_file (filename) result (funit)
+ character(len=*), intent(in), optional :: filename
+ integer :: funit
+
+ open(file=filename, form='formatted',action='read', newunit=funit)
+
+end function MO_open_file
+
+
end module MO_FASTJX_MOD
diff --git a/atmos_shared/tracer_driver/tropchem/isoropiaIIcode.F b/atmos_shared/tracer_driver/tropchem/isoropiaIIcode.F
index 050aacbc..3fa0d6cd 100644
--- a/atmos_shared/tracer_driver/tropchem/isoropiaIIcode.F
+++ b/atmos_shared/tracer_driver/tropchem/isoropiaIIcode.F
@@ -491,7 +491,7 @@ BLOCK DATA BLKISO
!
DATA IPROB/0/, METSTBL/0/
!
- DATA VERSION /'2.0 (03/19/07)'/
+ DATA version /'2.0 (03/19/07)'/
!
! *** OTHER PARAMETERS ***********************************************
!
diff --git a/atmos_shared/tracer_driver/tropchem/isrpia.inc b/atmos_shared/tracer_driver/tropchem/isrpia.inc
index 04ee244b..678491f7 100644
--- a/atmos_shared/tracer_driver/tropchem/isrpia.inc
+++ b/atmos_shared/tracer_driver/tropchem/isrpia.inc
@@ -264,8 +264,8 @@
! Generic Variables
!=================================================================
- CHARACTER(LEN=15) :: VERSION
- COMMON /CGEN/ VERSION
+ CHARACTER(LEN=15) :: version
+ COMMON /CGEN/ version
! CGEN is read-only
REAL*8 :: GREAT, TINY, TINY2, ZERO, ONE
diff --git a/atmos_shared/tracer_driver/tropchem/mo_photo.F90 b/atmos_shared/tracer_driver/tropchem/mo_photo.F90
index b40301a2..60194f2e 100644
--- a/atmos_shared/tracer_driver/tropchem/mo_photo.F90
+++ b/atmos_shared/tracer_driver/tropchem/mo_photo.F90
@@ -5,8 +5,6 @@ module MO_PHOTO_MOD
use fms_mod, only : mpp_clock_begin, mpp_clock_id, &
mpp_clock_end, CLOCK_MODULE
use mpp_mod, only : mpp_error, FATAL
- use mpp_io_mod, only : mpp_open, MPP_RDONLY, MPP_ASCII,MPP_MULTI, &
- MPP_SINGLE, mpp_close
use time_manager_mod, only : time_type, get_date
use constants_mod, only : PI
@@ -154,7 +152,7 @@ subroutine prate_init( filename, filename_solarmin, lpath, mspath, &
!----------------------------------------------------------------------
integer :: it500, it200, izen, ialb, idob
integer :: ios
- integer :: unit
+ integer :: funit
! integer :: retval
! logical :: cosb
! real :: temp(tabdim)
@@ -206,17 +204,15 @@ subroutine prate_init( filename, filename_solarmin, lpath, mspath, &
! end if
!----------------------------------------------------------------------
-! ... open file using mpp_open
+! ... open file using open
!----------------------------------------------------------------------
- call mpp_open( unit, trim(lpath)//trim(filename), MPP_RDONLY, MPP_ASCII, &
- threading = MPP_MULTI, fileset = MPP_SINGLE, &
- recl = 4500)
+ open(file=trim(lpath)//trim(filename), form='formatted',action='read', newunit=funit)
!----------------------------------------------------------------------
! ... Readin the reference o3 column and photorate table
!----------------------------------------------------------------------
- read(unit,*,iostat=ios) vo3
+ read(funit,*,iostat=ios) vo3
if( ios /= 0 ) then
msg = ' PRATE_INIT: Failed to read o3 column'
call ENDRUN(msg)
@@ -227,7 +223,7 @@ subroutine prate_init( filename, filename_solarmin, lpath, mspath, &
do izen = 1,zangdim
do ialb = 1,albdim
do idob = 1,o3ratdim
- read(unit,*,iostat=ios) ajl(:,:,izen,idob,ialb,it500,it200)
+ read(funit,*,iostat=ios) ajl(:,:,izen,idob,ialb,it500,it200)
if( ios /= 0 ) then
msg = ' PRATE_INIT: Failed to read photo table; error = '//char(ios)
call ENDRUN(msg)
@@ -257,8 +253,7 @@ subroutine prate_init( filename, filename_solarmin, lpath, mspath, &
offset(6) = offset(5)*t500dim
offset(7) = SUM( offset(1:6) )
-! close( unit )
- call mpp_close( unit )
+ close( funit )
!-----------------------------------------------------------------
! ... check whether using solar cycle
@@ -269,17 +264,14 @@ subroutine prate_init( filename, filename_solarmin, lpath, mspath, &
use_solar_cycle = .true.
!----------------------------------------------------------------------
-! ... open file using mpp_open
+! ... open file using open
!----------------------------------------------------------------------
- call mpp_open( unit, trim(lpath)//trim(filename_solarmin), MPP_RDONLY, MPP_ASCII, &
- threading = MPP_MULTI, fileset = MPP_SINGLE, &
- recl = 4500)
-
+ open(file=trim(lpath)//trim(filename_solarmin), form='formatted',action='read', newunit=funit)
!----------------------------------------------------------------------
! ... Readin the reference o3 column and photorate table
! for solar minimum
!----------------------------------------------------------------------
- read(unit,*,iostat=ios) vo3_solarmin
+ read(funit,*,iostat=ios) vo3_solarmin
if( ios /= 0 ) then
msg = ' PRATE_INIT: Failed to read solarmin o3 column'
call ENDRUN(msg)
@@ -290,7 +282,7 @@ subroutine prate_init( filename, filename_solarmin, lpath, mspath, &
do izen = 1,zangdim
do ialb = 1,albdim
do idob = 1,o3ratdim
- read(unit,*,iostat=ios) ajl_solarmin(:,:,izen,idob,ialb,it500,it200)
+ read(funit,*,iostat=ios) ajl_solarmin(:,:,izen,idob,ialb,it500,it200)
if( ios /= 0 ) then
msg = ' PRATE_INIT: Failed to read solarmin photo table; error = '//char(ios)
call ENDRUN(msg)
@@ -300,7 +292,7 @@ subroutine prate_init( filename, filename_solarmin, lpath, mspath, &
end do
end do
end do
- call mpp_close( unit )
+ close( funit )
end if
!-----------------------------------------------------------------
diff --git a/atmos_shared/tracer_driver/tropchem/mo_read_sim_chm.F90 b/atmos_shared/tracer_driver/tropchem/mo_read_sim_chm.F90
index a56dfebd..92addc5c 100644
--- a/atmos_shared/tracer_driver/tropchem/mo_read_sim_chm.F90
+++ b/atmos_shared/tracer_driver/tropchem/mo_read_sim_chm.F90
@@ -1,9 +1,7 @@
module MO_READ_SIM_CHM_MOD
- use mpp_mod, only : mpp_error, FATAL
- use mpp_io_mod, only : mpp_open, MPP_RDONLY, MPP_ASCII,MPP_MULTI, &
- MPP_SINGLE, mpp_close
- use fms_mod, only : open_file, close_file, read_distributed
+ use mpp_mod, only : mpp_error, FATAL, mpp_pe, mpp_root_pe
+ use fms_io_mod, only : open_file, close_file, read_distributed
implicit none
character(len=128), parameter :: version = '$Id$'
@@ -73,6 +71,8 @@ subroutine READ_SIM_CHM( sim_data_flsp, &
!--------------------------------------------------------
! ... Read map info from data file
!--------------------------------------------------------
+ if (mpp_pe() == mpp_root_pe() ) print *, "mo reading: ", sim_data_flsp
+
if( explicit%clscnt > 0 ) then
call read_distributed(funit,'(4i4)',iostat=ios,data=explicit%cls_rxt_cnt)
if( ios /= 0 ) then
diff --git a/atmos_shared/tracer_driver/tropchem/mo_usrrxt.F90 b/atmos_shared/tracer_driver/tropchem/mo_usrrxt.F90
index 413b1160..13af99be 100644
--- a/atmos_shared/tracer_driver/tropchem/mo_usrrxt.F90
+++ b/atmos_shared/tracer_driver/tropchem/mo_usrrxt.F90
@@ -9,7 +9,7 @@ module mo_usrrxt_mod
use tracer_manager_mod, only : get_tracer_index, query_method
use field_manager_mod, only: parse
use tropchem_types_mod, only : tropchem_opt, tropchem_diag
- use fms_mod, only : open_file, close_file
+ use mpp_mod, only: mpp_root_pe, mpp_pe
implicit none
public :: usrrxt_init, usrrxt
@@ -158,9 +158,7 @@ subroutine usrrxt_init( verbose, trop_option )
! RAA Effective radius associated with aerosol type
! SAA Single scattering albedo
!-----------------------------------------------------------------------
- funit = open_file(FILE='INPUT/am3_uptake.dat',form='formatted',action='read',threading='multi', &
- dist=.false.)
-
+ open(FILE='INPUT/am3_uptake.dat',form='formatted',action='read', newunit=funit)
read (funit,'(i4,a78)') NAA_HET, TITLE0_HET
if (NAA_HET .gt. A_HET) then
write(*,*) 'ATMOS:fastjx_init: too many scat-data sets for AM3:', NAA_HET, A_HET
@@ -178,7 +176,7 @@ subroutine usrrxt_init( verbose, trop_option )
enddo
enddo
- call close_file(funit,dist=.false.)
+ close(funit)
end subroutine usrrxt_init
diff --git a/atmos_shared/tracer_driver/tropchem/strat_chem_utilities.F90 b/atmos_shared/tracer_driver/tropchem/strat_chem_utilities.F90
index e494c987..b0f01c1a 100644
--- a/atmos_shared/tracer_driver/tropchem/strat_chem_utilities.F90
+++ b/atmos_shared/tracer_driver/tropchem/strat_chem_utilities.F90
@@ -1,9 +1,8 @@
module strat_chem_utilities_mod
-use mpp_io_mod, only : mpp_open, mpp_close, MPP_RDONLY
use mpp_mod, only : mpp_pe, mpp_root_pe, stdout
-use fms_mod, only : file_exist, open_namelist_file, close_file, &
- error_mesg, FATAL
+use fms_mod, only : error_mesg, FATAL
+use fms2_io_mod, only : file_exists
use constants_mod, only : PI, DEG_TO_RAD, AVOGNO, PSTD_MKS, SECONDS_PER_DAY
use time_manager_mod, only : time_type, get_date, days_in_month, days_in_year, &
set_date, increment_time, set_time, &
@@ -106,7 +105,7 @@ subroutine strat_chem_utilities_init( lonb, latb, age_factor_in, dclydt_factor_i
! local variables
real :: chlb_dummy(nlat_input,nspecies_lbc), &
ozb_dummy(nlon_input, nlat_input, 12)
- integer :: unit, nc, n, year, outunit
+ integer :: funit, nc, n, year, outunit
type(time_type) :: Model_init_time
if (module_is_initialized) return
@@ -125,15 +124,15 @@ subroutine strat_chem_utilities_init( lonb, latb, age_factor_in, dclydt_factor_i
!-----------------------------------------------------------------------
! ... read in chemical lower boundary
!-----------------------------------------------------------------------
- call mpp_open( unit, 'INPUT/' // TRIM(cfc_lbc_filename),action=MPP_RDONLY )
+ open(file='INPUT/' // TRIM(cfc_lbc_filename), form='formatted',action='read', newunit=funit)
outunit= stdout()
- if (mpp_pe() == mpp_root_pe()) WRITE(outunit,*) 'reading INPUT/' // TRIM(cfc_lbc_filename)
+ if (mpp_pe() == mpp_root_pe()) WRITE(outunit,*) 'reading: INPUT/' // TRIM(cfc_lbc_filename)
do nc = 1,15
- read(unit,'(6E13.6)') chlb_dummy(:,nc)
+ read(funit,'(6E13.6)') chlb_dummy(:,nc)
end do
- read(unit,'(6E13.6)') ozb_dummy
- read(unit,'(6e13.6)') tropc
- call mpp_close(unit)
+ read(funit,'(6E13.6)') ozb_dummy
+ read(funit,'(6e13.6)') tropc
+ close(funit)
!++lwh
!---------------------------------------------------------------------
@@ -1351,8 +1350,8 @@ subroutine strat_chem_extra_h2o_init( ch4_filename, ch4_scale_factor, &
filename = 'INPUT/' // trim(ch4_filename)
-if( file_exist(filename) ) then
- flb = open_namelist_file( filename )
+if( file_exists(filename) ) then
+ open(file=filename, form='formatted',action='read', newunit=flb)
read(flb, FMT='(i12)') series_length
allocate( ch4_value(series_length), &
input_time(series_length), &
@@ -1361,7 +1360,7 @@ subroutine strat_chem_extra_h2o_init( ch4_filename, ch4_scale_factor, &
read (flb, FMT = '(2f12.4)') input_time(n), ch4_value(n)
end do
ch4_value(:) = ch4_value(:) * ch4_scale_factor
- call close_file( flb )
+ close( flb )
!---------------------------------------------------------------------
! convert the time stamps of the series to time_type variables.
!---------------------------------------------------------------------
diff --git a/atmos_shared/tracer_driver/tropchem_driver.F90 b/atmos_shared/tracer_driver/tropchem_driver.F90
index c6d01562..6c9fd116 100644
--- a/atmos_shared/tracer_driver/tropchem_driver.F90
+++ b/atmos_shared/tracer_driver/tropchem_driver.F90
@@ -24,15 +24,13 @@ module tropchem_driver_mod
!-----------------------------------------------------------------------
use mpp_mod, only : input_nml_file
-use fms_mod, only : file_exist, &
- field_exist, &
- write_version_number, &
+use fms2_io_mod, only : file_exists, open_file, close_file, FmsNetcdfDomainFile_t, variable_exists
+use mpp_domains_mod, only : domain2D
+use fms_mod, only : write_version_number, &
mpp_pe, &
mpp_root_pe, &
lowercase, &
uppercase, &
- open_namelist_file, &
- close_file, &
stdlog, &
check_nml_error, &
error_mesg, &
@@ -110,7 +108,6 @@ module tropchem_driver_mod
use astronomy_mod, only : diurnal_solar, universal_time
use horiz_interp_mod, only: horiz_interp_type, horiz_interp_init, &
horiz_interp_new, horiz_interp
-use fms_io_mod, only: read_data
use cloud_chem, only: CLOUD_CHEM_PH_LEGACY, CLOUD_CHEM_PH_BISECTION, &
CLOUD_CHEM_PH_CUBIC, CLOUD_CHEM_F1P,&
@@ -159,8 +156,7 @@ module tropchem_driver_mod
file_emis3d_1 = 'emissions3d.', & ! NetCDF file name (beginning) for 3-D emissions
file_emis3d_2 = '.nc', & ! NetCDF file name (end) for 3-D emissions
file_ub = 'ub_vals.nc' ! NetCDF file for chemical upper boundary conditions
-character(len=64) :: file_dry = 'depvel.nc', & ! NetCDF file for dry deposition velocities
- file_aircraft = 'aircraft.nc', & ! NetCDF file for aircraft emissions
+character(len=64) :: file_aircraft = 'aircraft.nc', & ! NetCDF file for aircraft emissions
file_jval_lut = 'jvals.v5', & ! ascii file for photolysis rate lookup table
file_jval_lut_min = '' ! ascii file for photolysis rate LUT (for solar min)
character(len=10), dimension(maxinv) :: inv_list ='' ! list of invariant (fixed) tracers
@@ -239,6 +235,8 @@ module tropchem_driver_mod
type(tropchem_diag), save :: trop_diag
type(tropchem_opt), save :: trop_option
+type (domain2D), pointer :: tropchem_domain !< Atmosphere domain
+
namelist /tropchem_driver_nml/ &
relaxed_dt, &
@@ -252,7 +250,6 @@ module tropchem_driver_mod
file_emis3d_1, &
file_emis3d_2, &
file_ub, &
- file_dry, &
inv_list, &
file_aircraft,&
aircraft_scale_factor, &
@@ -408,7 +405,6 @@ module tropchem_driver_mod
type(time_type) :: fixed_entry
end type co2_type
type(co2_type) :: co2_t
-type(interpolate_type), save :: drydep_data_default
integer :: clock_id,ndiag
!++van
@@ -1504,8 +1500,7 @@ end subroutine tropchem_driver
!
!
! Ltropchem = tropchem_driver_init( r, mask, axes, Time, &
-! lonb_mod, latb_mod, phalf, &
-! drydep_data )
+! lonb_mod, latb_mod, phalf)
!
!
! optional mask that designates which grid points
@@ -1536,9 +1531,8 @@ end subroutine tropchem_driver
! Tracer mixing ratios (tropchem tracers in VMR)
!
-function tropchem_driver_init( r, mask, axes, Time, &
- lonb_mod, latb_mod, phalf, &
- drydep_data ) result(Ltropchem)
+function tropchem_driver_init( domain, r, mask, axes, Time, &
+ lonb_mod, latb_mod, phalf) result(Ltropchem)
!-----------------------------------------------------------------------
!
@@ -1548,6 +1542,7 @@ function tropchem_driver_init( r, mask, axes, Time, &
! (nlon,nlat,nlev).
!
!-----------------------------------------------------------------------
+ type(domain2D),target,intent(in) :: domain !< Atmosphere domain
real, intent(inout), dimension(:,:,:,:) :: r
real, intent(in), dimension(:,:,:), optional :: mask
type(time_type), intent(in) :: Time
@@ -1555,7 +1550,6 @@ function tropchem_driver_init( r, mask, axes, Time, &
real, intent(in), dimension(:,:) :: lonb_mod
real, intent(in), dimension(:,:) :: latb_mod
real, intent(in),dimension(:,:,:) :: phalf
- type(interpolate_type), intent(out) :: drydep_data(:)
real :: small_value
@@ -1579,7 +1573,6 @@ function tropchem_driver_init( r, mask, axes, Time, &
airc_files
logical :: tracer_initialized
- integer :: unit
character(len=16) :: fld
character(len=32) :: tracer_name
@@ -1600,18 +1593,9 @@ function tropchem_driver_init( r, mask, axes, Time, &
!-----------------------------------------------------------------------
! ... read namelist
!-----------------------------------------------------------------------
- if(file_exist('input.nml')) then
-#ifdef INTERNAL_FILE_NML
+ if(file_exists('input.nml')) then
read (input_nml_file, nml=tropchem_driver_nml, iostat=io)
ierr = check_nml_error(io,'tropchem_driver_nml')
-#else
- unit = open_namelist_file('input.nml')
- ierr=1; do while (ierr /= 0)
- read(unit, nml = tropchem_driver_nml, iostat=io, end=10)
- ierr = check_nml_error (io, 'tropchem_driver_nml')
- end do
-10 call close_file(unit)
-#endif
end if
logunit = stdlog()
@@ -1625,6 +1609,8 @@ function tropchem_driver_init( r, mask, axes, Time, &
return
end if
+ tropchem_domain => domain
+
!-------------------------------------------------------------------------
! ... Make sure input value for clouds_in_fastjx is a valid option.
!-------------------------------------------------------------------------
@@ -1860,13 +1846,6 @@ function tropchem_driver_init( r, mask, axes, Time, &
end do
!--van
-!-----------------------------------------------------------------------
-! ... Setup dry deposition
-!-----------------------------------------------------------------------
- call tropchem_drydep_init( dry_files, dry_names, &
- lonb_mod, latb_mod, &
- drydep_data )
-
!-----------------------------------------------------------------------
! ... Setup upper boundary condition data
!-----------------------------------------------------------------------
@@ -1954,8 +1933,8 @@ function tropchem_driver_init( r, mask, axes, Time, &
flag_fixed = parse(control, 'fixed_year', fixed_year)
if( flag_file > 0 ) then
lb_files(i) = 'INPUT/' // trim(filename)
- if( file_exist(lb_files(i)) ) then
- flb = open_namelist_file( lb_files(i) )
+ if( file_exists(lb_files(i)) ) then
+ flb = tropchem_open_file( lb_files(i) )
read(flb, FMT='(i12)') series_length
allocate( lb(i)%gas_value(series_length), &
lb(i)%gas_time(series_length) )
@@ -1973,7 +1952,7 @@ function tropchem_driver_init( r, mask, axes, Time, &
if (flag_spec > 0) then
lb(i)%gas_value(:) = lb(i)%gas_value(:) * scale_factor
end if
- call close_file( flb )
+ close ( flb )
if( flag_fixed > 0 ) then
fixed_lbc_time(i) = .true.
year = INT(fixed_year)
@@ -1997,12 +1976,7 @@ function tropchem_driver_init( r, mask, axes, Time, &
!-----------------------------------------------------------------------
! ... Initial conditions
!-----------------------------------------------------------------------
- tracer_initialized = .false.
- if ( field_exist('INPUT/atmos_tracers.res.nc', lowercase(tracnam(i))) .or. &
- field_exist('INPUT/fv_tracer.res.nc', lowercase(tracnam(i))) .or. &
- field_exist('INPUT/tracer_'//trim(lowercase(tracnam(i)))//'.res', lowercase(tracnam(i))) ) then
- tracer_initialized = .true.
- end if
+ tracer_initialized = check_if_tracer_initialized(lowercase(tracnam(i)))
if(.not. tracer_initialized) then
if( query_method('init_conc',MODEL_ATMOS,indices(i),name,control) ) then
@@ -2075,10 +2049,10 @@ function tropchem_driver_init( r, mask, axes, Time, &
!move CO2 input out of the loop of "do i = 1,pcnstm1", 2016-07-25
!fp
!CO2
- if ( file_exist('INPUT/' // trim(co2_filename) ) ) then
+ if ( file_exists('INPUT/' // trim(co2_filename) ) ) then
co2_t%use_fix_value = .false.
!read from file
- flb = open_namelist_file( 'INPUT/' // trim(co2_filename) )
+ flb = tropchem_open_file( 'INPUT/' // trim(co2_filename) )
read(flb,FMT='(i12)') series_length
allocate( co2_t%gas_value(series_length), co2_t%gas_time(series_length) )
do n = 1,series_length
@@ -2089,7 +2063,7 @@ function tropchem_driver_init( r, mask, axes, Time, &
extra_seconds = (input_time - year)*diy*SECONDS_PER_DAY
co2_t%gas_time(n) = Year_t + set_time(NINT(extra_seconds), 0)
end do
- call close_file(flb)
+ close(flb)
if (co2_scale_factor .gt. 0) then
co2_t%gas_value = co2_t%gas_value * co2_scale_factor
end if
@@ -2904,76 +2878,38 @@ subroutine init_xactive_emis( model, method_type, index, species, &
end subroutine init_xactive_emis
!
+!> @brief This function is just a wrapper for Fortran's `open`
+!! @return Unique unit number
+function tropchem_open_file (filename) result (funit)
+ character(len=*), intent(in), optional :: filename
+ integer :: funit
+ open(file=filename, form='formatted',action='read', newunit=funit)
-!############################################################################
-
-!
-!
-! Open dry deposition file
-!
-!
-! Opens NetCDF file of tracer dry deposition velocities for reading,
-! and set up interpolation to model grid/time
-!
-!
-! call tropchem_drydep_init( dry_files, dry_names, &
-! lonb_mod, latb_mod, &
-! drydep_data )
-!
-
-subroutine tropchem_drydep_init( dry_files, dry_names, &
- lonb_mod, latb_mod, &
- drydep_data )
-
-!-----------------------------------------------------------------------
-
- real, intent(in), dimension(:,:) :: lonb_mod, latb_mod
- character(len=64), intent(out), dimension(:) :: dry_files, dry_names
- type(interpolate_type), intent(out) :: drydep_data(:)
-
-!-----------------------------------------------------------------------
-
- integer :: i
- integer :: flag_file, flag_spec
- character(len=64) :: filename,specname
- character(len=64) :: name='', control=''
+end function tropchem_open_file
-!-----------------------------------------------------------------------
+!> @brief This function just checks if a tracer initialized in a set of files
+!! @return flag indicating if a tracer initialized
+function check_if_tracer_initialized(tracername) result (tracer_initialized)
+ character(len=*), intent(in), optional :: tracername
+ logical :: tracer_initialized
-!---------- Set interpolator type for dry deposition
- call interpolator_init( drydep_data_default, trim(file_dry), lonb_mod, latb_mod, &
- data_out_of_bounds=(/CONSTANT/), &
- vert_interp=(/INTERP_WEIGHTED_P/))
+ type(FmsNetcdfDomainFile_t) :: fileobj !< fms2io fileobj for domain decomposed
- do i = 1,pcnstm1
- dry_files(i) = ''
- dry_names(i) = ''
- if( query_method('dry_deposition',MODEL_ATMOS,indices(i),name,control) )then
- if( trim(name(1:4)) == 'file' ) then
- flag_file = parse(control, 'file',filename)
- flag_spec = parse(control, 'name',specname)
- if(flag_file > 0 .and. trim(filename) /= trim(file_dry)) then
- dry_files(i) = trim(filename)
- call interpolator_init( drydep_data(indices(i)), trim(filename), lonb_mod, latb_mod,&
- data_out_of_bounds=(/CONSTANT/), &
- vert_interp=(/INTERP_WEIGHTED_P/))
- else
- dry_files(i) = trim(file_dry)
- drydep_data(indices(i)) = drydep_data_default
+ tracer_initialized = .false.
- end if
- if(flag_spec >0) then
- dry_names(i) = trim(specname)
- else
- dry_names(i) = trim(lowercase(tracnam(i)))
- end if
- end if
- end if
- end do
+ if (open_file(fileobj, 'INPUT/atmos_tracers.res.nc', "read", tropchem_domain)) then
+ tracer_initialized = variable_exists(fileobj, tracername)
+ call close_file(fileobj)
+ elseif (open_file(fileobj, 'INPUT/fv_tracer.res.nc', "read", tropchem_domain)) then
+ tracer_initialized = variable_exists(fileobj, tracername)
+ call close_file(fileobj)
+ elseif (open_file(fileobj, 'INPUT/tracer_'//trim(lowercase(tracername))//'.res', "read", tropchem_domain)) then
+ tracer_initialized = variable_exists(fileobj, tracername)
+ call close_file(fileobj)
+ endif
-end subroutine tropchem_drydep_init
-!
+end function check_if_tracer_initialized
!############################################################################
end module tropchem_driver_mod
diff --git a/atmos_shared/tracer_driver/xactive_bvoc.F90 b/atmos_shared/tracer_driver/xactive_bvoc.F90
index 3a1a494b..c1b82443 100644
--- a/atmos_shared/tracer_driver/xactive_bvoc.F90
+++ b/atmos_shared/tracer_driver/xactive_bvoc.F90
@@ -134,29 +134,24 @@ module xactive_bvoc_mod
!------------------------------------------------------------------------------
-use mpp_mod, only : input_nml_file
-use fms_mod, only : file_exist, &
- write_version_number, &
+use mpp_mod, only : input_nml_file, mpp_get_current_pelist
+use fms_mod, only : write_version_number, &
mpp_pe, &
mpp_root_pe, &
- open_namelist_file, &
- close_file, &
+ mpp_npes, &
stdlog, &
check_nml_error, &
error_mesg, &
FATAL, &
WARNING, &
NOTE
-
+use mpp_domains_mod, only : domain2D, mpp_get_ntile_count
use MO_GRID_MOD, only : pcnstm1
-
-use fms_io_mod, only : read_data, &
- register_restart_field,&
- restore_state, &
- save_restart, &
- restart_file_type, &
- get_mosaic_tile_file
-
+use fms2_io_mod, only : FmsNetcdfFile_t, FmsNetcdfDomainFile_t, &
+ register_restart_field, register_axis, unlimited, &
+ open_file, read_restart, write_restart, close_file, &
+ register_field, write_data, get_global_io_domain_indices, &
+ register_variable_attribute, read_data, file_exists
use M_TRACNAME_MOD, only : tracnam
use tracer_manager_mod, only : get_tracer_index, &
query_method
@@ -334,9 +329,7 @@ module xactive_bvoc_mod
real, allocatable, dimension(:,:) :: CO2_STORE, &
SOILM, WILT
-
-type(restart_file_type), pointer, save :: Xbvoc_restart => NULL()
-type(restart_file_type), pointer, save :: Til_restart => NULL()
+type (domain2D), pointer :: xactive_domain !< Atmosphere domain
logical :: in_different_file = .false.
integer :: vers = 1
@@ -762,9 +755,9 @@ end subroutine xactive_bvoc
! the tracer array
!
-subroutine xactive_bvoc_init(lonb, latb, Time, axes, xactive_ndx)
-
+subroutine xactive_bvoc_init(domain, lonb, latb, Time, axes, xactive_ndx)
+ type(domain2D),target,intent(in) :: domain !< Atmosphere domain
real, intent(in), dimension(:,:) :: lonb, latb ! Lat/Lon corners
type(time_type), intent(in) :: Time ! Model time
integer, intent(in) :: axes(4) ! Diagnostics axes
@@ -796,7 +789,7 @@ subroutine xactive_bvoc_init(lonb, latb, Time, axes, xactive_ndx)
'mw '/)
integer :: nlon, nlat, i, j, k, n, xknt, nTERP, nxactive
- integer :: ierr, unit, io, logunit, nPARAMS
+ integer :: ierr, io, logunit, nPARAMS
integer, parameter :: nlonin = 720, nlatin = 360
real, dimension(nlonin) :: inlon
@@ -821,7 +814,11 @@ subroutine xactive_bvoc_init(lonb, latb, Time, axes, xactive_ndx)
character(len=64) :: name=''
integer, parameter :: nPARAMS_megan2 = 9
integer, parameter :: nPARAMS_megan3 = 20
-
+ type(FmsNetcdfFile_t) :: Xbvoc_restart !< Netcdf fileobj
+ type(FmsNetcdfFile_t) :: megan3_isop !< Netcdf fileobj
+ type(FmsNetcdfFile_t) :: ecfile_obj !< Netcdf fileobj
+ type(FmsNetcdfDomainFile_t) :: Til_restart !< Domain decomposed fileobj
+ integer, allocatable, dimension(:) :: pes !< Array of pes in the current pelist
nlon = size(lonb,1) - 1
nlat = size(latb,2) - 1
@@ -840,18 +837,9 @@ subroutine xactive_bvoc_init(lonb, latb, Time, axes, xactive_ndx)
!-----------------------------------------------------------------------
! ... read namelist
!-----------------------------------------------------------------------
- IF (file_exist('input.nml')) THEN
-#ifdef INTERNAL_FILE_NML
+ IF (file_exists('input.nml')) THEN
read (input_nml_file, nml=xactive_bvoc_nml, iostat=io)
ierr = check_nml_error(io,'xactive_bvoc_nml')
-#else
- unit = open_namelist_file('input.nml')
- ierr=1; do while (ierr /= 0)
- read(unit, nml = xactive_bvoc_nml, iostat=io, end=10)
- ierr = check_nml_error (io, 'xactive_bvoc_nml')
- end do
-10 call close_file(unit)
-#endif
ENDIF
logunit = stdlog()
@@ -889,8 +877,11 @@ subroutine xactive_bvoc_init(lonb, latb, Time, axes, xactive_ndx)
ALLOCATE ( ECBVOC_MEGAN3(nlon,nlat,nxactive) )
ALLOCATE ( LDFg(nlon,nlat,nxactive) )
! Populate these so it doesn't need to be done each time a new species is read in
- call read_data ('INPUT/megan3.xactive.ISOP.nc', 'lon', m3inlon, no_domain=.true.)
- call read_data ('INPUT/megan3.xactive.ISOP.nc', 'lat', m3inlat, no_domain=.true.)
+ if (open_file(megan3_isop,"INPUT/megan3.xactive.ISOP.nc","read")) then
+ call read_data (megan3_isop, 'lon', m3inlon)
+ call read_data (megan3_isop, 'lat', m3inlat)
+ call close_file(megan3_isop)
+ endif
m3inlon = m3inlon*DEG_TO_RAD
m3inlat = m3inlat*DEG_TO_RAD
dlat = m3inlat(2)-m3inlat(1)
@@ -1032,9 +1023,9 @@ subroutine xactive_bvoc_init(lonb, latb, Time, axes, xactive_ndx)
!--------------------------------------------------------------------------------------
IF ( trim(tracnam(i))=='ISOP' .AND. do_AM3_ISOP ) THEN
ecfile = 'INPUT/megan.ISOP.nc'
- IF ( file_exist(ecfile) ) THEN
- call read_data (ecfile, 'lon', inlon, no_domain=.true.)
- call read_data (ecfile, 'lat', inlat, no_domain=.true.)
+ if (open_file(ecfile_obj,ecfile,"read")) then
+ call read_data (ecfile_obj, 'lon', inlon)
+ call read_data (ecfile_obj, 'lat', inlat)
inlon = inlon*DEG_TO_RAD
inlat = inlat*DEG_TO_RAD
dlat = inlat(2)-inlat(1)
@@ -1046,9 +1037,10 @@ subroutine xactive_bvoc_init(lonb, latb, Time, axes, xactive_ndx)
call horiz_interp_init
call horiz_interp_new ( Interp, inlone, inlate, lonb, latb )
DO j = 1, nVEG
- call read_data (ecfile,vegnames(j),AM3_ISOP_DATAIN, no_domain=.true.)
+ call read_data (ecfile_obj,vegnames(j),AM3_ISOP_DATAIN)
call horiz_interp (Interp,AM3_ISOP_DATAIN,ECISOP_AM3(:,:,j), verbose=verbose)
ENDDO
+ call close_file(ecfile_obj)
ELSE
call error_mesg ('xactive_bvoc_init', &
' AM3 isoprene emission capacity file does not exist', FATAL)
@@ -1059,99 +1051,109 @@ subroutine xactive_bvoc_init(lonb, latb, Time, axes, xactive_ndx)
! Both mono- and sesq- terpenes are included in this file,
! but sesq may not be used (i.e., if do_SESQTERP = .false.')
ecfile = 'INPUT/megan2.xactive.parsed_terpenes.nc'
+ if (open_file(ecfile_obj,ecfile,"read")) then
+ DO k = 1, nTERP
+ DO j = 1, nPFT
+ call read_data(ecfile_obj,terpnames_megan2(k)//'_'//pftnames(j), &
+ toss)
+ ECTERP(:,:,j,k) = toss
+ ENDDO
+ ENDDO
+ call close_file(ecfile_obj)
+ else
+ call error_mesg ('xactive_bvoc_init', &
+ 'MEGAN file (megan2.xactive.parsed_terpenes.nc) for '//trim(tracnam(i))//' does not exist', FATAL)
+ endif
ELSE
IF ( do_SESQTERP ) THEN
ecfile = 'INPUT/megan2.xactive.lumped_terpenes_sesq.nc'
ELSE
ecfile = 'INPUT/megan2.xactive.lumped_terpenes_mono.nc'
ENDIF
- ENDIF
- IF ( file_exist(ecfile) ) THEN
- IF ( do_PARSED_TERP) THEN
- DO k = 1, nTERP
- DO j = 1, nPFT
- call read_data(ecfile,terpnames_megan2(k)//'_'//pftnames(j), &
- toss, no_domain=.true.)
- ECTERP(:,:,j,k) = toss
- ENDDO
- ENDDO
- ELSE
- DO j = 1, nPFT
- call read_data(ecfile,pftnames(j),toss, no_domain=.true.)
- ECBVOC(:,:,j,xknt) = toss
- ENDDO
- ENDIF
- ELSE
- call error_mesg ('xactive_bvoc_init', &
- 'MEGAN file for '//trim(tracnam(i))//' does not exist', FATAL)
+ if (open_file(ecfile_obj,ecfile,"read")) then
+ DO j = 1, nPFT
+ call read_data(ecfile_obj,pftnames(j),toss)
+ ECBVOC(:,:,j,xknt) = toss
+ ENDDO
+ call close_file(ecfile_obj)
+ else
+ call error_mesg ('xactive_bvoc_init', &
+ 'MEGAN file '//trim(ecfile)//'for '//trim(tracnam(i))//' does not exist', FATAL)
+ endif
ENDIF
ELSE IF ( xactive_algorithm == 'MEGAN3' ) THEN
IF ( do_PARSED_TERP ) THEN
! Both mono- and sesq- terpenes are included in this file,
! but sesq may not be used (i.e., if do_SESQTERP = .false.')
ecfile = 'INPUT/megan3.xactive.parsed_terpenes.nc'
+ if (open_file(ecfile_obj,ecfile,"read")) then
+ call horiz_interp_init
+ call horiz_interp_new ( Interp, m3inlone, m3inlate, lonb, latb )
+ DO k = 1, nTERP
+ call read_data (ecfile_obj,trim(terpnames_megan3(k))//'_EF', &
+ MEGAN3_DATAIN)
+ call horiz_interp (Interp,MEGAN3_DATAIN, &
+ ECTERP_MEGAN3(:,:,k), verbose=verbose)
+ call read_data (ecfile_obj,trim(terpnames_megan3(k))//'_LDF', &
+ MEGAN3_DATAIN)
+ call horiz_interp (Interp,MEGAN3_DATAIN, &
+ LDFg_TERP(:,:,k), verbose=verbose)
+ ENDDO!nterp
+ call close_file(ecfile_obj)
+ else
+ call error_mesg ('xactive_bvoc_init', &
+ 'MEGAN file '//trim(ecfile)//'for '//trim(tracnam(i))//' does not exist', FATAL)
+ endif
ELSE
IF ( do_SESQTERP ) THEN
ecfile = 'INPUT/megan3.xactive.lumped_terpenes_sesq.nc'
ELSE
ecfile = 'INPUT/megan3.xactive.lumped_terpenes_mono.nc'
ENDIF
- ENDIF
- IF ( file_exist(ecfile) ) THEN
- IF ( do_PARSED_TERP) THEN
- call horiz_interp_init
- call horiz_interp_new ( Interp, m3inlone, m3inlate, lonb, latb )
- DO k = 1, nTERP
- call read_data (ecfile,trim(terpnames_megan3(k))//'_EF', &
- MEGAN3_DATAIN, no_domain=.true.)
- call horiz_interp (Interp,MEGAN3_DATAIN, &
- ECTERP_MEGAN3(:,:,k), verbose=verbose)
- call read_data (ecfile,trim(terpnames_megan3(k))//'_LDF', &
- MEGAN3_DATAIN,no_domain=.true.)
- call horiz_interp (Interp,MEGAN3_DATAIN, &
- LDFg_TERP(:,:,k), verbose=verbose)
- ENDDO!nterp
- ELSE
- call horiz_interp_init
- call horiz_interp_new (Interp, m3inlone, m3inlate, lonb, latb )
- call read_data (ecfile,'EF',MEGAN3_DATAIN, no_domain=.true.)
- call horiz_interp (Interp, MEGAN3_DATAIN,ECBVOC_MEGAN3(:,:,xknt))
- call read_data (ecfile,'LDF',MEGAN3_DATAIN, no_domain=.true.)
- call horiz_interp (Interp, MEGAN3_DATAIN, LDFg(:,:,xknt ))
- ENDIF
- ELSE
- call error_mesg ('xactive_bvoc_init', &
- 'MEGAN file for '//trim(tracnam(i))//' does not exist', FATAL)
+ if (open_file(ecfile_obj,ecfile,"read")) then
+ call horiz_interp_init
+ call horiz_interp_new (Interp, m3inlone, m3inlate, lonb, latb )
+ call read_data (ecfile_obj,'EF',MEGAN3_DATAIN)
+ call horiz_interp (Interp, MEGAN3_DATAIN,ECBVOC_MEGAN3(:,:,xknt))
+ call read_data (ecfile_obj,'LDF',MEGAN3_DATAIN)
+ call horiz_interp (Interp, MEGAN3_DATAIN, LDFg(:,:,xknt ))
+ call close_file(ecfile_obj)
+ else
+ call error_mesg ('xactive_bvoc_init', &
+ 'MEGAN file '//trim(ecfile)//'for '//trim(tracnam(i))//' does not exist', FATAL)
+ endif
ENDIF
ENDIF
ELSE
IF ( xactive_algorithm == 'MEGAN2') THEN
ecfile = 'INPUT/megan2.xactive.'//trim(tracnam(i))//'.nc'
- IF ( file_exist(ecfile) ) THEN
+ if (open_file(ecfile_obj,ecfile,"read")) then
IF (mpp_pe() == mpp_root_pe()) call error_mesg ( 'xactive_bvoc_init', &
'Reading EF from file ' //ecfile, NOTE)
DO j = 1, nPFT
- call read_data(ecfile,pftnames(j),toss, no_domain=.TRUE.)
+ call read_data(ecfile_obj,pftnames(j),toss)
IF ( trim(tracnam(i)) == 'ISOP' ) THEN
toss = megan2_isop_sf * toss
ENDIF
ECBVOC(:,:,j,xknt) = toss
ENDDO
+ call close_file(ecfile_obj)
ELSE
call error_mesg ('xactive_bvoc_init', &
'MEGAN file for '//trim(tracnam(i))//' does not exist', FATAL)
ENDIF
ELSE IF ( xactive_algorithm == 'MEGAN3') THEN
ecfile = 'INPUT/megan3.xactive.'//trim(tracnam(i))//'.nc'
- IF ( file_exist(ecfile) ) THEN
+ IF (open_file(ecfile_obj,ecfile,"read")) then
IF (mpp_pe() == mpp_root_pe()) call error_mesg ( 'xactive_bvoc_init', &
'Reading EF from file ' //ecfile, NOTE)
call horiz_interp_init
call horiz_interp_new ( Interp, m3inlone, m3inlate, lonb, latb )
- call read_data (ecfile,'EF',MEGAN3_DATAIN, no_domain=.true.)
+ call read_data (ecfile_obj,'EF',MEGAN3_DATAIN)
call horiz_interp (Interp,MEGAN3_DATAIN,ECBVOC_MEGAN3(:,:,xknt), verbose=verbose)
- call read_data (ecfile,'LDF',MEGAN3_DATAIN, no_domain=.true.)
+ call read_data (ecfile_obj,'LDF',MEGAN3_DATAIN)
call horiz_interp (Interp,MEGAN3_DATAIN,LDFg(:,:,xknt), verbose=verbose)
+ call close_file(ecfile_obj)
ENDIF
ENDIF ! xactive_algorithm
ENDIF ! AM3 isop, terpene, other
@@ -1190,39 +1192,44 @@ subroutine xactive_bvoc_init(lonb, latb, Time, axes, xactive_ndx)
IF ( mpp_pe() == mpp_root_pe()) call error_mesg ('xactive_bvoc_init', &
'MEGAN Parameters for AM3 ISOP hardcoded in subroutine, skipping',NOTE)
ELSE
+ IF (.not. open_file(ecfile_obj,ecfile,"read")) then
+ call error_mesg ('xactive_bvoc_init', &
+ 'File '//trim(ecfile)//'for '//trim(tracnam(i))//' does not exist', FATAL)
+ ENDIF
DO j = 1, nPARAMS
IF ( trim(tracnam(i))=='C10H16') THEN
IF ( do_PARSED_TERP ) THEN
DO k = 1, nTERP
IF ( xactive_algorithm == 'MEGAN2' ) THEN
- call read_data(ecfile, &
+ call read_data(ecfile_obj, &
trim(paramnames_megan2(j))//'_'//terpnames_megan2(k), &
- TERP_PARAM(j,k), no_domain=.true.)
+ TERP_PARAM(j,k))
ELSE IF ( xactive_algorithm == 'MEGAN3' ) THEN
- call read_data(ecfile, &
+ call read_data(ecfile_obj, &
trim(paramnames_megan3(j))//'_'//trim(terpnames_megan3(k)), &
- TERP_PARAM(j,k), no_domain=.true.)
+ TERP_PARAM(j,k))
ENDIF
ENDDO
ELSE
IF ( xactive_algorithm == 'MEGAN2' ) THEN
- call read_data(ecfile, trim(paramnames_megan2(j)), &
- MEGAN_PARAM(j,xknt), no_domain=.true.)
+ call read_data(ecfile_obj, trim(paramnames_megan2(j)), &
+ MEGAN_PARAM(j,xknt))
ELSE IF ( xactive_algorithm == 'MEGAN3' ) THEN
- call read_data(ecfile, trim(paramnames_megan3(j)), &
- MEGAN_PARAM(j,xknt), no_domain=.true.)
+ call read_data(ecfile_obj, trim(paramnames_megan3(j)), &
+ MEGAN_PARAM(j,xknt))
ENDIF
ENDIF
ELSE
IF ( xactive_algorithm == 'MEGAN2' ) THEN
- call read_data(ecfile, trim(paramnames_megan2(j)), &
- MEGAN_PARAM(j,xknt), no_domain=.true.)
+ call read_data(ecfile_obj, trim(paramnames_megan2(j)), &
+ MEGAN_PARAM(j,xknt))
ELSE IF (xactive_algorithm == 'MEGAN3' ) THEN
- call read_data(ecfile, trim(paramnames_megan3(j)), &
- MEGAN_PARAM(j,xknt), no_domain=.true.)
+ call read_data(ecfile_obj, trim(paramnames_megan3(j)), &
+ MEGAN_PARAM(j,xknt))
ENDIF
ENDIF
ENDDO ! j/ nparams
+ call close_file(ecfile_obj)
ENDIF !/if do_AM3_ISOP
ENDIF ! has_xactive
ENDDO ! i/ species
@@ -1406,15 +1413,30 @@ subroutine xactive_bvoc_init(lonb, latb, Time, axes, xactive_ndx)
ENDIF
ENDIF
+ xactive_domain => domain
if (Ldebug .and. mpp_pe()==mpp_root_pe()) &
write(*,*) 'xactive_bvoc_init: calling xactive_bvoc_register_restart'
- call xactive_bvoc_register_restart
- if(file_exist('INPUT/xactive_bvoc.res.nc')) then
+
+ !< Get the current pelist
+ allocate(pes(mpp_npes()))
+ call mpp_get_current_pelist(pes)
+
+ !< Open the scalar file with the current pelist, so that only the root pe opens and reads the file and
+ !! distributes the data to the other pes
+ if (open_file(Xbvoc_restart,"INPUT/xactive_bvoc.res.nc","read", is_restart=.true., pelist=pes)) then
if (mpp_pe() == mpp_root_pe() ) &
- call error_mesg ('xactive_bvoc_mod', 'xactive_bvoc_init:&
- &Reading netCDF formatted restart file: xactive_bvoc.res.nc', NOTE)
- call restore_state(Xbvoc_restart)
- if (in_different_file) call restore_state(Til_restart)
+ call error_mesg ('xactive_bvoc_mod', 'xactive_bvoc_init:&
+ &Reading netCDF formatted restart file: xactive_bvoc.res.nc', NOTE)
+ call xactive_bvoc_register_restart_scalars(Xbvoc_restart)
+ call read_restart(Xbvoc_restart)
+ call close_file(Xbvoc_restart)
+ endif
+ deallocate(pes)
+
+ if (open_file(Til_restart,"INPUT/xactive_bvoc.res.nc","read", xactive_domain, is_restart=.true.)) then
+ call xactive_bvoc_register_restart_domains(Til_restart)
+ call read_restart(Til_restart)
+ call close_file(Til_restart)
endif
module_is_initialized = .TRUE.
@@ -2815,17 +2837,18 @@ subroutine temp_init_AM3(lonb,latb,axes)
integer, dimension(12) :: mos
logical :: used
real :: dlat, dlon
+ type(FmsNetcdfFile_t) :: tasfile_obj !< Fms2io fileobj
nlon = size(lonb,1) - 1
nlat = size(latb,2) - 1
- IF ( file_exist(tasfile) ) THEN
+ IF (open_file(tasfile_obj,tasfile,"read")) then
IF (mpp_pe() == mpp_root_pe()) call error_mesg ('temp_init_AM3', &
'Reading NetCDF formatted input file: tas_monthly_clim_1980-2000.nc',NOTE)
!read in lat & lon from input file, get boundaries and convert to radians
- call read_data (tasfile, 'lon', metlon, no_domain=.true.)
- call read_data (tasfile, 'lat', metlat, no_domain=.true.)
+ call read_data (tasfile_obj, 'lon', metlon)
+ call read_data (tasfile_obj, 'lat', metlat)
dlon = 0.5*(metlon(1)-metlon(2))
dlat = 0.5*(metlat(2)-metlat(1))
@@ -2847,8 +2870,8 @@ subroutine temp_init_AM3(lonb,latb,axes)
call horiz_interp_init
call horiz_interp_new ( Interp, metlone, metlate, lonb, latb )
- call read_data (tasfile, 'time', mos, no_domain=.true.)
- call read_data (tasfile,'tas_clim', tas(:,:,:), no_domain=.true.)
+ call read_data (tasfile_obj, 'time', mos)
+ call read_data (tasfile_obj,'tas_clim', tas(:,:,:))
DO m = 1, 12
call horiz_interp (Interp, tas(:,:,m), Tmo(:,:,m), verbose=verbose)
@@ -2860,6 +2883,7 @@ subroutine temp_init_AM3(lonb,latb,axes)
used = send_data(id_tas(m),Tmo(:,:,m))
ENDIF
ENDDO
+ call close_file(tasfile_obj)
ELSE
call error_mesg ('temp_init_AM3', &
'tasfile :'//tasfile//' does not exist', FATAL)
@@ -2899,21 +2923,22 @@ subroutine ppfd_init_AM3 (lonb, latb, axes)
logical :: used
real :: dlat, dlon
real, parameter :: const0 = 4.766
+ type(FmsNetcdfFile_t) :: dswfile_obj !< Fms2io fileobj
nlon = size(lonb,1) - 1
nlat = size(latb,2) - 1
! --- check existence of input file containing climatological (1980-2000)
! monthly surface down SW radiation --------
- IF (file_exist(dswfile)) THEN
+ IF (open_file(dswfile_obj,dswfile,"read")) then
!set up for input grid
IF (mpp_pe() == mpp_root_pe()) call error_mesg ('ppfd_init_AM3', &
'Reading NetCDF formatted input file: dswrf_monthly_clim_1980-2000.nc', NOTE)
!read in lat & lon from input file, get boundaries and convert to radians
- call read_data (dswfile, 'lon', metlon, no_domain=.true.)
- call read_data (dswfile, 'lat', metlat, no_domain=.true.)
+ call read_data (dswfile_obj, 'lon', metlon)
+ call read_data (dswfile_obj, 'lat', metlat)
dlon = 0.5*(metlon(1)-metlon(2))
dlat = 0.5*(metlat(2)-metlat(1))
@@ -2935,8 +2960,8 @@ subroutine ppfd_init_AM3 (lonb, latb, axes)
call horiz_interp_init
call horiz_interp_new ( Interp, metlone, metlate, lonb, latb )
- call read_data (dswfile, 'time', mos, no_domain=.true.)
- call read_data (dswfile,'dswrf_clim', dswrf(:,:,:), no_domain=.true.)
+ call read_data (dswfile_obj, 'time', mos)
+ call read_data (dswfile_obj,'dswrf_clim', dswrf(:,:,:))
DO m = 1, 12
call horiz_interp (Interp, dswrf(:,:,m), Pmo(:,:,m),verbose=verbose)
@@ -2950,7 +2975,7 @@ subroutine ppfd_init_AM3 (lonb, latb, axes)
used = send_data(id_dsw(m),Pmo(:,:,m))
ENDIF
ENDDO
-
+ call close_file(dswfile_obj)
ELSE
call error_mesg ('ppfd_init_AM3', &
'dswfile does not exist', FATAL)
@@ -2997,7 +3022,7 @@ subroutine pft_init_AM3( lonb, latb, axes )
integer :: id_pft(nPFT)
real, dimension(nlonin,nlatin,nPFT) :: datapft
-
+ type(FmsNetcdfFile_t) :: file_PFT_obj !< Fms2io fileobj
nlon = size(lonb,1) - 1
nlat = size(latb,1) - 1
@@ -3008,16 +3033,16 @@ subroutine pft_init_AM3( lonb, latb, axes )
file_PFT = 'INPUT/mksrf_pft.060929.nc'
ENDIF
- IF ( file_exist(file_PFT) ) THEN
+ IF ( open_file(file_PFT_obj, file_PFT, "read") ) THEN
IF ( mpp_pe() == mpp_root_pe() ) call error_mesg ( 'pft_init_AM3', &
'Reading NetCDF formatted input file: mksrf_pft.060929.nc', NOTE)
! Read in lat & lon from input file, get boundaries and convert to radians
- call read_data (file_PFT, 'lon', lonpft, no_domain=.true.)
- call read_data (file_PFT, 'lat', latpft, no_domain=.true.)
- call read_data (file_PFT, 'EDGEW', edgew, no_domain=.true.)
- call read_data (file_PFT, 'EDGES', edges, no_domain=.true.)
- call read_data (file_PFT, 'EDGEE', edgee, no_domain=.true.)
- call read_data (file_PFT, 'EDGEN', edgen, no_domain=.true.)
+ call read_data (file_PFT_obj, 'lon', lonpft)
+ call read_data (file_PFT_obj, 'lat', latpft)
+ call read_data (file_PFT_obj, 'EDGEW', edgew)
+ call read_data (file_PFT_obj, 'EDGES', edges)
+ call read_data (file_PFT_obj, 'EDGEE', edgee)
+ call read_data (file_PFT_obj, 'EDGEN', edgen)
lonpfte(1) = edgew
latpfte(1) = edges
@@ -3040,10 +3065,10 @@ subroutine pft_init_AM3( lonb, latb, axes )
call horiz_interp_init
call horiz_interp_new ( Interp, lonpfte, latpfte, lonb, latb )
- call read_data (file_PFT, 'pft', pft, no_domain=.true.)
+ call read_data (file_PFT_obj, 'pft', pft)
! Read pct_pft field
- call read_data (file_PFT, 'PCT_PFT', datapft, no_domain=.true.)
+ call read_data (file_PFT_obj, 'PCT_PFT', datapft)
! Loop over pftnames
DO i = 1, nPFT
@@ -3058,6 +3083,7 @@ subroutine pft_init_AM3( lonb, latb, axes )
ENDDO
! Scale the percentages to a fraction
PCTPFT(:,:,:) = 0.01 * PCTPFT(:,:,:)
+ call close_file(file_PFT_obj)
ELSE
call error_mesg ('lai_pft_init', &
'PFT file: '//file_PFT//' does not exist.', FATAL )
@@ -3096,6 +3122,7 @@ subroutine lai_init_AM3( lonb,latb, axes )
integer, dimension(nMOS) :: mos
logical :: used
real, dimension(nlonin,nlatin,nPFT,nMOS) :: datalai
+ type(FmsNetcdfFile_t) :: file_LAI_obj !< Fms2io fileobj
character(len=5) :: lainames(nPFT) = (/'lai01','lai02','lai03','lai04', &
'lai05','lai06','lai07','lai08', &
'lai09','lai10','lai11','lai12', &
@@ -3112,17 +3139,17 @@ subroutine lai_init_AM3( lonb,latb, axes )
! --- check existence of input file containing monthly lai, for each pft
! --------
- IF (file_exist(file_LAI)) THEN
+ IF (open_file(file_LAI_obj, file_LAI, "read")) THEN
! Set up for input grid
IF(mpp_pe() == mpp_root_pe()) call error_mesg ('lai_pft_init', &
'Reading NetCDF formatted input file: mksrf_lai.060929.nc', NOTE)
! Read in lat & lon from input file, get boundaries and convert to radians
- call read_data (file_LAI, 'lon', lonlai, no_domain=.true.)
- call read_data (file_LAI, 'lat', latlai, no_domain=.true.)
- call read_data (file_LAI, 'EDGEW', edgew, no_domain=.true.)
- call read_data (file_LAI, 'EDGES', edges, no_domain=.true.)
- call read_data (file_LAI, 'EDGEE', edgee, no_domain=.true.)
- call read_data (file_LAI, 'EDGEN', edgen, no_domain=.true.)
+ call read_data (file_LAI_obj, 'lon', lonlai)
+ call read_data (file_LAI_obj, 'lat', latlai)
+ call read_data (file_LAI_obj, 'EDGEW', edgew)
+ call read_data (file_LAI_obj, 'EDGES', edges)
+ call read_data (file_LAI_obj, 'EDGEE', edgee)
+ call read_data (file_LAI_obj, 'EDGEN', edgen)
! Get lat/lon edges and spacing
lonlaie(1) = edgew
latlaie(1) = edges
@@ -3142,10 +3169,10 @@ subroutine lai_init_AM3( lonb,latb, axes )
call horiz_interp_init
call horiz_interp_new ( Interp, lonlaie, latlaie, lonb, latb )
! Read in pft and time dimensions from lai file
- call read_data (file_LAI, 'time', mos, no_domain=.true.)
+ call read_data (file_LAI_obj, 'time', mos)
! Loop over pftnames
DO i = 1, nPFT
- call read_data (file_LAI,lainames(i),datalai(:,:,i,:), no_domain=.true.)
+ call read_data (file_LAI_obj,lainames(i),datalai(:,:,i,:))
DO m = 1, nMOS
call horiz_interp (Interp, datalai(:,:,i,m), &
MLAI(:,:,i,m),verbose=verbose)
@@ -3161,6 +3188,7 @@ subroutine lai_init_AM3( lonb,latb, axes )
ENDIF
ENDDO
ENDDO
+ call close_file(file_LAI_obj)
ELSE
call error_mesg ('lai_init_AM3', &
'laifile: '//file_LAI//' does not exist', FATAL)
@@ -3199,7 +3227,7 @@ subroutine lai_init_megan3( lonb,latb, axes )
integer :: id_lai
logical :: used
real, dimension(nlonin,nlatin,nMOS) :: datalai
-
+ type(FmsNetcdfFile_t) :: file_LAI_obj !< Fms2io fileobj
IF ( file_LAI =='INPUT/mksrf_lai.060929.nc' ) THEN
call error_mesg ('lai_init_megan3, incorrect file for MEGAN3', &
@@ -3207,13 +3235,13 @@ subroutine lai_init_megan3( lonb,latb, axes )
file_LAI = 'INPUT/mksrf_lai.060929.combined_pft.nc'
ENDIF
- IF (file_exist(file_LAI)) THEN
+ IF (open_file(file_LAI_obj, file_LAI, "read")) THEN
! Set up for input grid
IF (mpp_pe() == mpp_root_pe()) call error_mesg ('lai_init_megan3', &
'Reading NetCDF formatted input file'//file_LAI, NOTE)
- call read_data (file_LAI, 'lon', inlon, no_domain=.true.)
- call read_data (file_LAI, 'lat', inlat, no_domain=.true.)
+ call read_data (file_LAI_obj, 'lon', inlon)
+ call read_data (file_LAI_obj, 'lat', inlat)
inlon = inlon*DEG_TO_RAD
inlat = inlat*DEG_TO_RAD
dlat = inlat(2)-inlat(1)
@@ -3225,7 +3253,7 @@ subroutine lai_init_megan3( lonb,latb, axes )
call horiz_interp_init
call horiz_interp_new ( Interp, inlone, inlate, lonb, latb )
- call read_data (file_LAI,'LAI',datalai, no_domain=.true.)
+ call read_data (file_LAI_obj,'LAI',datalai)
DO m = 1, nMOS
call horiz_interp (Interp, datalai(:,:,m), MLAI_MEGAN3(:,:,m),verbose=verbose)
! Store diagnostics for one month only - choose July for now
@@ -3239,6 +3267,7 @@ subroutine lai_init_megan3( lonb,latb, axes )
ENDIF
ENDIF
ENDDO
+ call close_file(file_LAI_obj)
ELSE
call error_mesg ('lai_init_megan3', &
'laifile: '//file_LAI//' does not exist', FATAL)
@@ -3276,15 +3305,15 @@ subroutine fcover_init_megan3( lonb,latb, axes )
integer :: id_fcover
logical :: used
real, dimension(nlonin,nlatin,nMOS) :: datain
+ type(FmsNetcdfFile_t) :: file_FCOVER_obj !< Fms2io fileobj
-
- IF (file_exist(file_FCOVER)) THEN
+ IF (open_file(file_FCOVER_obj, file_FCOVER, "read")) THEN
! Set up for input grid
IF (mpp_pe() == mpp_root_pe()) call error_mesg ('fcover_init_megan3', &
'Reading NetCDF formatted input file'//file_FCOVER, NOTE)
- call read_data (file_FCOVER, 'lon', inlon, no_domain=.true.)
- call read_data (file_FCOVER, 'lat', inlat, no_domain=.true.)
+ call read_data (file_FCOVER_obj, 'lon', inlon)
+ call read_data (file_FCOVER_obj, 'lat', inlat)
inlon = inlon*DEG_TO_RAD
inlat = inlat*DEG_TO_RAD
dlat = inlat(2)-inlat(1)
@@ -3296,7 +3325,7 @@ subroutine fcover_init_megan3( lonb,latb, axes )
call horiz_interp_init
call horiz_interp_new ( Interp, inlone, inlate, lonb, latb )
- call read_data (file_FCOVER,'FCOVER',datain(:,:,:), no_domain=.true.)
+ call read_data (file_FCOVER_obj,'FCOVER',datain(:,:,:))
DO m = 1, nMOS
call horiz_interp (Interp, datain(:,:,m), FCOVER(:,:,m),verbose=verbose)
! Store diagnostics for one month only - choose July for now
@@ -3323,45 +3352,54 @@ end subroutine fcover_init_megan3
!
! xactive_bvoc_register_restart registers restart fields
!
-subroutine xactive_bvoc_register_restart
+subroutine xactive_bvoc_register_restart_scalars(Xbvoc_restart)
+ type(FmsNetcdfFile_t), intent(inout) :: Xbvoc_restart !< Fms2io fileobj
+ character(len=8), dimension(1) :: dim_names !< Array of dimension names
+
+ dim_names = (/"Time"/)
+ call register_axis(Xbvoc_restart, "Time", unlimited)
- character(len=64) :: fname, fname2
- character(len=2) :: mon_string
- integer :: id_restart, ihour
+ call register_restart_field(Xbvoc_restart, 'version', vers)
- fname = 'xactive_bvoc.res.nc'
- call get_mosaic_tile_file(fname, fname2, .false. )
- allocate(Xbvoc_restart)
- if(trim(fname2) == trim(fname)) then
- Til_restart => Xbvoc_restart
- in_different_file = .false.
- else
- in_different_file = .true.
- allocate(Til_restart)
- endif
+end subroutine xactive_bvoc_register_restart_scalars
- id_restart = register_restart_field(Xbvoc_restart, fname, 'version', vers, no_domain = .true. )
+!< xactive_bvoc_register_restart_domains: register netcdf restart variables
+subroutine xactive_bvoc_register_restart_domains(Til_restart)
+ type(FmsNetcdfDomainFile_t), intent(inout) :: Til_restart !< Fms2io domain decomposed fileobj
+ character(len=2) :: mon_string
+ character(len=8), dimension(3) :: dim_names !< Array of dimension names
+ integer :: ihour
if (Ldebug .and. mpp_pe()==mpp_root_pe()) &
write(*,*) 'xactive_bvoc_register_restart: ', &
'T24_STORE,P24_STORE,WS_STORE,O3_STORE=', ALLOCATED(T24_STORE), &
ALLOCATED(P24_STORE), ALLOCATED(WS_STORE), ALLOCATED(O3_STORE)
+ dim_names = (/"xaxis_1", "yaxis_1", "Time "/)
+
+ call register_axis(Til_restart, "xaxis_1", "x")
+ call register_axis(Til_restart, "yaxis_1", "y")
+ call register_axis(Til_restart, "Time", unlimited)
+
+ !< Register the domain decomposed dimensions as variables so that the combiner can work
+ !! correctly
+ call register_field(Til_restart, dim_names(1), "double", (/dim_names(1)/))
+ call register_field(Til_restart, dim_names(2), "double", (/dim_names(2)/))
+
do ihour = 1,24
write(mon_string,'(i2.2)') ihour
if (Ldebug .and. mpp_pe()==mpp_root_pe()) &
write(*,*) 'xactive_bvoc_register_restart: register field T24_STORE_'//mon_string
- if (ALLOCATED(T24_STORE)) id_restart = &
- register_restart_field(Til_restart, fname, 'T24_STORE_'//mon_string, T24_STORE(:,:,ihour), mandatory=.false.)
- if (ALLOCATED(P24_STORE)) id_restart = &
- register_restart_field(Til_restart, fname, 'P24_STORE_'//mon_string, P24_STORE(:,:,ihour), mandatory=.false.)
- if (ALLOCATED(WS_STORE)) id_restart = &
- register_restart_field(Til_restart, fname, 'WS_STORE_'//mon_string, WS_STORE(:,:,ihour), mandatory=.false.)
- if (ALLOCATED(O3_STORE)) id_restart = &
- register_restart_field(Til_restart, fname, 'O3_STORE_'//mon_string, O3_STORE(:,:,ihour), mandatory=.false.)
+ if (ALLOCATED(T24_STORE)) call &
+ register_restart_field(Til_restart, 'T24_STORE_'//mon_string, T24_STORE(:,:,ihour), dim_names, is_optional = .true.)
+ if (ALLOCATED(P24_STORE)) call &
+ register_restart_field(Til_restart, 'P24_STORE_'//mon_string, P24_STORE(:,:,ihour), dim_names, is_optional = .true.)
+ if (ALLOCATED(WS_STORE)) call &
+ register_restart_field(Til_restart, 'WS_STORE_'//mon_string, WS_STORE(:,:,ihour), dim_names, is_optional = .true.)
+ if (ALLOCATED(O3_STORE)) call &
+ register_restart_field(Til_restart, 'O3_STORE_'//mon_string, O3_STORE(:,:,ihour), dim_names, is_optional = .true.)
end do
-
-end subroutine xactive_bvoc_register_restart
+end subroutine xactive_bvoc_register_restart_domains
!
@@ -3375,11 +3413,39 @@ end subroutine xactive_bvoc_register_restart
!
!
subroutine xactive_bvoc_end
+ type(FmsNetcdfFile_t) :: Xbvoc_restart !< Fms2io fileobj
+ type(FmsNetcdfDomainFile_t) :: Til_restart !< Fms2io domain decomposed fileobj
+ logical :: tile_file_open !< Flag indicated whether the restart file was opened sucessfully
+ integer, allocatable, dimension(:) :: pes !< Array of pes in the current pelist
if (Ldebug .and. mpp_pe()==mpp_root_pe()) write(*,*) 'xactive_bvoc_end: calling save_restart'
- call save_restart(Xbvoc_restart)
+
+ !< Get the current pelist
+ allocate(pes(mpp_npes()))
+ call mpp_get_current_pelist(pes)
+
+ !< Open the scalar file with the current pelist, so that only the root pe opens and writes the file
+ if (open_file(Xbvoc_restart,"RESTART/xactive_bvoc.res.nc","overwrite", is_restart=.true., pelist=pes)) then
+ call xactive_bvoc_register_restart_scalars(Xbvoc_restart)
+ call write_restart(Xbvoc_restart)
+ call close_file(Xbvoc_restart)
+ endif
+ deallocate(pes)
+
if (Ldebug .and. mpp_pe()==mpp_root_pe()) write(*,*) 'xactive_bvoc_end: calling save_restart_Til'
- if (in_different_file) call save_restart(Til_restart)
+ if (mpp_get_ntile_count(xactive_domain) == 1) then
+ tile_file_open = open_file(Til_restart,"RESTART/xactive_bvoc.res.nc","append", xactive_domain, is_restart=.true.)
+ else
+ tile_file_open = open_file(Til_restart,"RESTART/xactive_bvoc.res.nc","overwrite", xactive_domain, is_restart=.true.)
+ endif
+
+ if (tile_file_open) then
+ call xactive_bvoc_register_restart_domains(Til_restart)
+ call write_restart(Til_restart)
+ call add_domain_dimension_data(Til_restart)
+ call close_file(Til_restart)
+ endif
+
if (Ldebug .and. mpp_pe()==mpp_root_pe()) write(*,*) 'xactive_bvoc_end: back from save_restart_Til'
IF (mpp_pe() == mpp_root_pe()) THEN
@@ -3432,5 +3498,22 @@ subroutine xactive_bvoc_end
end subroutine xactive_bvoc_end
!
+!< Add_dimension_data: Adds dummy data for the domain decomposed axis
+subroutine add_domain_dimension_data(fileobj)
+ type(FmsNetcdfDomainFile_t) :: fileobj !< Fms2io domain decomposed fileobj
+ integer, dimension(:), allocatable :: buffer !< Buffer with axis data
+ integer :: is, ie !< Starting and Ending indices for data
+
+ call get_global_io_domain_indices(fileobj, "xaxis_1", is, ie, indices=buffer)
+ call write_data(fileobj, "xaxis_1", buffer)
+ deallocate(buffer)
+
+ call get_global_io_domain_indices(fileobj, "yaxis_1", is, ie, indices=buffer)
+ call write_data(fileobj, "yaxis_1", buffer)
+ deallocate(buffer)
+
+end subroutine add_domain_dimension_data
+
+
!############################################################################
end module xactive_bvoc_mod
diff --git a/configure.ac b/configure.ac
new file mode 100644
index 00000000..adb68bd1
--- /dev/null
+++ b/configure.ac
@@ -0,0 +1,110 @@
+#***********************************************************************
+#* GNU Lesser General Public License
+#*
+#* This file is part of the GFDL Flexible Modeling System (FMS).
+#*
+#* FMS is free software: you can redistribute it and/or modify it under
+#* the terms of the GNU Lesser General Public License as published by
+#* the Free Software Foundation, either version 3 of the License, or (at
+#* your option) any later version.
+#*
+#* FMS is distributed in the hope that it will be useful, but WITHOUT
+#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+#* for more details.
+#*
+#* You should have received a copy of the GNU Lesser General Public
+#* License along with FMS. If not, see .
+#***********************************************************************
+
+AC_PREREQ([2.59])
+
+# Initialize with name, version, and support email address.
+AC_INIT([GFDL atmos_phys Library],
+ [main],
+ [gfdl.climate.model.info@noaa.gov],
+ [atmos_phys],
+ [https://www.gfdl.noaa.gov/atmos_phys])
+
+# Find out about the host we're building on.
+AC_CANONICAL_HOST
+AC_CANONICAL_BUILD
+
+# Find out about the target we're building for.
+AC_CANONICAL_TARGET
+
+AM_INIT_AUTOMAKE([foreign dist-zip subdir-objects])
+AC_REQUIRE_AUX_FILE([tap-driver.sh])
+
+# Keep libtool macros in an m4 directory.
+AC_CONFIG_MACRO_DIR([m4])
+
+# Set up libtool.
+LT_PREREQ([2.4])
+LT_INIT()
+
+AC_ARG_ENABLE([setting-flags],
+ [AS_HELP_STRING([--enable-setting-flags],
+ [Allow configure to set some compiler flags. Disabling this will also disable any other --with or --enable options that set flags, and will only use user-provided falgs. (Default yes)])])
+AS_IF([test ${enable_setting_flags:-yes} = yes],
+ [enable_setting_flags=yes],
+ [enable_setting_flags=no])
+
+# Find the C compiler.
+AC_PROG_CC
+AM_PROG_CC_C_O
+AC_C_CONST
+AC_PROG_CPP
+
+# Find the Fortran compiler.
+AC_PROG_FC
+AC_PROG_F77
+
+# Find the install program.
+AC_PROG_INSTALL
+
+# Check to see if any macros must be set to enable large (>2GB) files.
+AC_SYS_LARGEFILE
+
+# Fortran specific checks
+AC_LANG_PUSH(Fortran)
+AC_OPENMP()
+if test $enable_setting_flags = yes; then
+ # Make sure the compiler is seeing this as free-formatted, not
+ # fixed-formatted, fortran code.
+ AC_FC_FREEFORM()
+
+ # Check that long lines of Fortran code can be handled. This will add
+ # necessary fortran flags.
+ AC_FC_LINE_LENGTH([unlimited])
+ GX_FC_DEFAULT_REAL_KIND8_FLAG([dnl
+ FCFLAGS="$FCFLAGS $FC_DEFAULT_REAL_KIND8_FLAG"])
+ FFLAGS="$FFLAGS $FC_DEFAULT_REAL_KIND8_FLAG"
+ # Add OpenMP flags
+ if test ! -z "$OPENMP_CFLAGS"; then
+ CFLAGS="$CFLAGS $OPENMP_CFLAGS"
+ CPPFLAGS="$CPPFLAGS $OPENMP_CFLAGS"
+ fi
+ if test ! -z "$OPENMP_FCFLAGS"; then
+ FCFLAGS="$FCFLAGS $OPENMP_FCFLAGS"
+ FFLAGS="$FFLAGS $OPENMP_FCFLAGS"
+ fi
+fi
+GX_FC_CHECK_MOD([fms_mod], [], [], [AC_MSG_ERROR([Can't find the FMS module. Set CPPFLAGS/FCFLAGS])])
+GX_FORTRAN_SEARCH_LIBS([fms_init], [FMS], [use fms_mod], [call fms_init()], [],
+ [AC_MSG_ERROR([Can't find the FMS library. Set LDFLAGS/LIBS])])
+AC_LANG_POP(Fortran)
+
+# Define an AM_CONDITIONAL to determine if you are on a CRAY
+AM_CONDITIONAL([CRAY], [test `env | grep CRAY | wc -l` -gt 0])
+
+# Find which mpi launcher to use
+AC_CHECK_PROGS([MPI_LAUNCHER],[srun aprun mpirun])
+
+# Check if the launcher can oversubscribe the MPI processes
+AS_IF([$MPI_LAUNCHER --oversubscribe hostname >/dev/null 2>&1], \
+ [ AC_SUBST([OVERSUBSCRIBE], [--oversubscribe])])
+
+# These files will be created when the configure script is run.
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT()
diff --git a/m4/gx_compiler_bug_checks.m4 b/m4/gx_compiler_bug_checks.m4
new file mode 100644
index 00000000..7c046714
--- /dev/null
+++ b/m4/gx_compiler_bug_checks.m4
@@ -0,0 +1,73 @@
+#***********************************************************************
+#* GNU Lesser General Public License
+#*
+#* This file is part of the GFDL Flexible Modeling System (FMS).
+#*
+#* FMS is free software: you can redistribute it and/or modify it under
+#* the terms of the GNU Lesser General Public License as published by
+#* the Free Software Foundation, either version 3 of the License, or (at
+#* your option) any later version.
+#*
+#* FMS is distributed in the hope that it will be useful, but WITHOUT
+#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+#* for more details.
+#*
+#* You should have received a copy of the GNU Lesser General Public
+#* License along with FMS. If not, see .
+#***********************************************************************
+
+# ===========================================================================
+#
+# SYNOPSIS
+#
+# GX_FC_CLASS_CHAR_ARRAY_BUG_CHECK([ACTION-IF-BUG-PRESENT = FAILURE])
+#
+# DESCRIPTION
+#
+# Set of functions to check if the compilers have any known bugs.
+# Full descriptions are available below.
+#
+# LICENSE
+#
+# Copyright (c) 2020 Seth Underwood , @uramirez8707
+#
+# This program is free software: you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or (at
+# your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with FMS. If not, see .
+
+# GX_FC_CLASS_CHAR_ARRAY_BUG_CHECK([ACTION-IF-BUG-PRESENT = FAILURE])
+# ----------------------------------------------------------------------
+# Check if the Fortran compiler supports has the class character array
+# assign bug. If the Fortran compiler does have the bug, call
+# ACTION-IF-BUG-PRESENT (defaults to failing).
+AC_DEFUN([GX_FC_CLASS_CHAR_ARRAY_BUG_CHECK],[
+_AC_FORTRAN_ASSERT()dnl
+AC_CACHE_CHECK([if $[]_AC_FC[] has the class character array assign bug], [gx_cv_class_char_array_bug_check],[dnl
+gx_cv_class_char_array_bug_check=yes
+AC_COMPILE_IFELSE([[ subroutine test_sub(ctype)
+ class(*), intent(out) :: ctype
+
+ select type(ctype)
+ type is (character(len=*))
+ ctype(:) = ""
+ end select
+ end subroutine test_sub]],
+ [gx_cv_class_char_array_bug_check=no])
+])
+AS_IF([test "x$gx_cv_class_char_array_bug_check" = xyes],[dnl
+ AC_DEFINE([HAVE_CLASS_CHAR_ARRAY_BUG], 1,
+ [Define to 1 if the Fortran compiler has the class character array bug])
+ m4_default([$1],
+ [AC_MSG_ERROR([The Fortran compiler has the class, character array assing bug. libFMS cannot be built with this compiler.])])
+])dnl
+])
diff --git a/m4/gx_f08_support.m4 b/m4/gx_f08_support.m4
new file mode 100644
index 00000000..b19b60ae
--- /dev/null
+++ b/m4/gx_f08_support.m4
@@ -0,0 +1,79 @@
+#***********************************************************************
+#* GNU Lesser General Public License
+#*
+#* This file is part of the GFDL Flexible Modeling System (FMS).
+#*
+#* FMS is free software: you can redistribute it and/or modify it under
+#* the terms of the GNU Lesser General Public License as published by
+#* the Free Software Foundation, either version 3 of the License, or (at
+#* your option) any later version.
+#*
+#* FMS is distributed in the hope that it will be useful, but WITHOUT
+#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+#* for more details.
+#*
+#* You should have received a copy of the GNU Lesser General Public
+#* License along with FMS. If not, see .
+#***********************************************************************
+
+# ===========================================================================
+#
+# SYNOPSIS
+#
+# GX_FC_08_OPEN_NEWUNIT([ACTION-IF-SUCCESS], [ACTION-IF-FAILURE = FAILURE])
+#
+# DESCRIPTION
+#
+# Set of functions that check if the Fortran compiler supports certain
+# Fortran 2008 features, or if a specific compiler flag is needed to support
+# the feature. Full descriptions are avalable below.
+#
+# LICENSE
+#
+# Copyright (c) 2020 Seth Underwood
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 3 of the License, or (at your
+# option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+# Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program. If not, see .
+#
+# As a special exception, the respective Autoconf Macro's copyright owner
+# gives unlimited permission to copy, distribute and modify the configure
+# scripts that are the output of Autoconf when processing the Macro. You
+# need not follow the terms of the GNU General Public License when using
+# or distributing such scripts, even though portions of the text of the
+# Macro appear in them. The GNU General Public License (GPL) does govern
+# all other use of the material that constitutes the Autoconf Macro.
+
+# GX_FC_08_OPEN_NEWUNIT([ACTION-IF-SUCCESS], [ACTION-IF-FAILURE])
+# ----------------------------------------------------------------------
+# Check if the Fortran compiler supports OPEN(NEWUNIT=iunit,...). The
+# NEWUNIT option for OPEN will select, automatically, a new free unit
+# number. If the compiler supports this, the preprocessor macro
+# HAVE_OPEN_NEWUNIT will be set.
+AC_DEFUN([GX_FC_08_OPEN_NEWUNIT],[
+_AC_FORTRAN_ASSERT()dnl
+AC_CACHE_CHECK([if $[]_AC_FC[] supports OPEN(NEWUNIT=iunit,...)], [gx_cv_fc_08_open_newfile],[dnl
+gx_cv_fc_08_open_newfile=no
+AC_COMPILE_IFELSE([[ program test
+ integer :: funit
+ open(NEWUNIT=funit, STATUS='SCRATCH')
+ close(funit)
+ end program test]],
+ [gx_cv_fc_08_open_newfile=yes])
+])
+AS_IF([test "x$gx_cv_fc_08_open_newfile" = xno],[$2],[dnl
+ AC_DEFINE([HAVE_OPEN_NEWUNIT], 1,
+ [Define to 1 if the Fotran compiler supports OPEN(NEWUNIT=iunit,...)])
+ $1
+])dnl
+])# GC_FC_08_OPEN_NEWUNIT
diff --git a/m4/gx_fortran_options.m4 b/m4/gx_fortran_options.m4
new file mode 100644
index 00000000..5c65e3b9
--- /dev/null
+++ b/m4/gx_fortran_options.m4
@@ -0,0 +1,403 @@
+#***********************************************************************
+#* GNU Lesser General Public License
+#*
+#* This file is part of the GFDL Flexible Modeling System (FMS).
+#*
+#* FMS is free software: you can redistribute it and/or modify it under
+#* the terms of the GNU Lesser General Public License as published by
+#* the Free Software Foundation, either version 3 of the License, or (at
+#* your option) any later version.
+#*
+#* FMS is distributed in the hope that it will be useful, but WITHOUT
+#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+#* for more details.
+#*
+#* You should have received a copy of the GNU Lesser General Public
+#* License along with FMS. If not, see .
+#***********************************************************************
+
+# ===========================================================================
+#
+# SYNOPSIS
+#
+# GX_FC_DEFAULT_REAL_KIND8_FLAG([ACTION-IF-SUCCESS], [ACTION-IF-FAILURE = FAILURE])
+# GX_FC_DEFAULT_REAL_KIND4_FLAG([ACTION-IF-SUCCESS], [ACTION-IF-FAILURE = FAILURE])
+# GX_FC_QUAD_PRECISION()
+# GX_FC_CRAY_POINTER_FLAG([ACTION-IF-SUCCESS], [ACTION-IF-FAILURE = FAILURE])
+# GX_FC_INTERNAL_FILE_NML()
+# GX_FC_CHECK_MOD(module-name, [only], [action-if-found], [action-if-not-found])
+#
+# DESCRIPTION
+#
+# Set of functions that check if the Fortran compiler supports certain
+# Fortran feature, or if a specific compiler flag is needed to support
+# the feature. Full descriptions are avalable below.
+#
+# LICENSE
+#
+# Copyright (c) 2019,2020 Seth Underwood
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 3 of the License, or (at your
+# option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+# Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program. If not, see .
+#
+# As a special exception, the respective Autoconf Macro's copyright owner
+# gives unlimited permission to copy, distribute and modify the configure
+# scripts that are the output of Autoconf when processing the Macro. You
+# need not follow the terms of the GNU General Public License when using
+# or distributing such scripts, even though portions of the text of the
+# Macro appear in them. The GNU General Public License (GPL) does govern
+# all other use of the material that constitutes the Autoconf Macro.
+
+# GX_FC_DEFAULT_REAL_KIND8_FLAG([ACTION-IF-SUCCESS], [ACTION-IF-FAILURE = FAILURE])
+# ----------------------------------------------------------------------
+# Look for the compiler flag that sets the default REAL kind to KIND=8.
+# Call ACTION-IF-SUCCESS (defaults to nothing) if successful (i.e. can
+# compile with default REAL(KIND=8)) and ACTION-IF-FAILURE (defaults
+# to failing with an error message) if not.
+#
+# Sets the variable FC_DEFAULT_REAL_KIND8_FLAG to hold the flag.
+#
+# The known flags are:
+# -fdefault-real-8: gfortran
+# -real_size 64: Intel compiler
+# -s real64: Cray
+# -r8: Portland Group compiler
+# -qrealsize=8: IBM compiler
+AC_DEFUN([GX_FC_DEFAULT_REAL_KIND8_FLAG],[
+AC_LANG_PUSH([Fortran])
+AC_CACHE_CHECK([for Fortran flag needed to accept default REAL(KIND=8)], [gx_cv_fc_default_real_kind8_flag],[
+gx_cv_fc_default_real_kind8_flag=unknown
+gx_fc_default_real_kind8_flag_FCFLAGS_save=$FCFLAGS
+for ac_flag in none \
+ '-fdefault-real-8' \
+ '-real_size 64' \
+ '-s real64' \
+ '-r8' \
+ '-qrealsize=8'; do
+ test "x$ac_flag" != xnone && FCFLAGS="$gx_fc_default_real_kind8_flag_FCFLAGS_save ${ac_flag}"
+ AC_COMPILE_IFELSE([[ program test
+ interface
+ subroutine test_sub(a)
+ real(kind=selected_real_kind(15,307)) :: a
+ end subroutine test_sub
+ end interface
+ real :: b=1.0
+ call test_sub(b)
+ end program test]],
+ [gx_cv_fc_default_real_kind8_flag=$ac_flag; break])
+done
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+FCFLAGS=$gx_fc_default_real_kind8_flag_FCFLAGS_save
+])
+if test "x$gx_cv_fc_default_real_kind8_flag" = xunknown; then
+ m4_default([$2],
+ [AC_MSG_ERROR([Fortran cannot set default real kind to 8])])
+else
+ FC_DEFAULT_REAL_KIND8_FLAG=$gx_cv_fc_default_real_kind8_flag
+ if test "x$FC_DEFAULT_REAL_KIND8_FLAG" = xnone; then
+ FC_DEFAULT_REAL_KIND8_FLAG=
+ fi
+ $1
+fi
+AC_LANG_POP([Fortran])
+AC_SUBST([FC_DEFAULT_REAL_KIND8_FLAG])
+])
+
+# GX_FC_DEFAULT_REAL_KIND4_FLAG([ACTION-IF-SUCCESS], [ACTION-IF-FAILURE = FAILURE])
+# ----------------------------------------------------------------------
+# Look for the compiler flag that sets the default REAL kind to KIND=4.
+# Call ACTION-IF-SUCCESS (defaults to nothing) if successful (i.e. can
+# compile with default REAL(KIND=4)) and ACTION-IF-FAILURE (defaults
+# to failing with an error message) if not.
+#
+# Sets the variable FC_DEFAULT_REAL_KIND4_FLAG to hold the flag.
+#
+# The known flags are:
+# none: gfortran (gfortran does not have an option to set the
+# default REAL kind to KIND=4)
+# -real_size 32: Intel compiler
+# -s real32: Cray
+# -r4: Portland Group compiler
+# -qrealsize=4: IBM compiler
+AC_DEFUN([GX_FC_DEFAULT_REAL_KIND4_FLAG],[
+AC_LANG_PUSH([Fortran])
+AC_CACHE_CHECK([for Fortran flag needed to accept default REAL(KIND=4)], [gx_cv_fc_default_real_kind4_flag],[
+gx_cv_fc_default_real_kind4_flag=unknown
+gx_fc_default_real_kind4_flag_FCFLAGS_save=$FCFLAGS
+for ac_flag in none \
+ '-fdefault-real-4' \
+ '-real_size 32' \
+ '-s real32' \
+ '-r4' \
+ '-qrealsize=4'; do
+ test "x$ac_flag" != xnone && FCFLAGS="$gx_fc_default_real_kind4_flag_FCFLAGS_save ${ac_flag}"
+ AC_COMPILE_IFELSE([[ program test
+ interface
+ subroutine test_sub(a)
+ real(kind=selected_real_kind(6, 37)) :: a
+ end subroutine test_sub
+ end interface
+ real :: b=1.0
+ call test_sub(b)
+ end program test]],
+ [gx_cv_fc_default_real_kind4_flag=$ac_flag; break])
+done
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+FCFLAGS=$gx_fc_default_real_kind4_flag_FCFLAGS_save
+])
+if test "x$gx_cv_fc_default_real_kind4_flag" = xunknown; then
+ m4_default([$2],
+ [AC_MSG_ERROR([Fortran cannot set default real kind to 4])])
+else
+ FC_DEFAULT_REAL_KIND4_FLAG=$gx_cv_fc_real_kind4_flag
+ if test "x$FC_DEFAULT_REAL_KIND4_FLAG" = xnone; then
+ FC_DEFAULT_REAL_KIND4_FLAG=
+ fi
+ $1
+fi
+AC_LANG_POP([Fortran])
+AC_SUBST([FC_DEFAULT_REAL_KIND4_FLAG])
+])
+
+# GX_FC_QUAD_PRECISION
+# -----------------------------------------------------------------------------
+# Determine if the Fortran compiler and target system have support for IEEE 754,
+# quadruple precision. If supported, sets the define HAVE_QUAD_PRECISION.
+AC_DEFUN([GX_FC_QUAD_PRECISION],[
+AC_LANG_PUSH([Fortran])
+AC_CACHE_CHECK([if Fortran and target have IEEE 754 support], [gx_cv_fc_quad_precision],[
+gx_cv_fc_quad_precision=unknown
+AC_COMPILE_IFELSE([[ program test
+ real(KIND=selected_real_kind(33, 4931)) :: quad
+ end program test]],
+ [gx_cv_fc_quad_precision=yes],
+ [gx_cv_fc_quad_precision=no])])
+if test "x$gx_cv_fc_quad_precision" = "xyes"; then
+ AC_DEFINE([HAVE_QUAD_PRECISION], 1,
+ [Define to 1 if your Fortran and system have IEEE 754 support])
+fi
+AC_LANG_POP([Fortran])
+])
+
+# GX_FC_CRAY_POINTER_FLAG([ACTION-IF-SUCCESS], [ACTION-IF-FAILURE = FAILURE])
+# -----------------------------------------------------------------------------
+# Look for the compiler flag that allows Fortran Cray Pointers. Cray
+# pointers are an are part of a non-standard extension that provides a
+# C-like pointer in Fortran. Call ACTION-IF-SUCCESS (defaults to
+# nothing) if successful (i.e. can use Cray pointers) and
+# ACTION-IF-FAILURE (defaults to failing with an error message) if not.
+#
+# Sets the variable FC_CRAY_POINTER_FLAG to hold the flag, and defines
+# HAVE_CRAY_POINTER.
+#
+# The known flags are:
+# -fcray-pointer: gfortran
+# none: Intel compiler (No option required for Cray Pointers)
+# unknown: Cray
+# -Mcray=pointer: Portland Group compiler
+# none: IBM compiler (No option required for Cray Pointers)
+AC_DEFUN([GX_FC_CRAY_POINTER_FLAG],[
+AC_LANG_PUSH([Fortran])
+AC_CACHE_CHECK([for Fortran flag needed to accept Cray pointers], [gx_cv_fc_cray_ptr_flag],[
+gx_cv_fc_cray_ptr_flag=unknown
+gx_cray_ptr_flag_FCFLAGS_save=$FCFLAGS
+for ac_flag in none \
+ '-fcray-pointer' \
+ '-Mcray=pointer'; do
+ test "x$ac_flag" != xnone && FCFLAGS="$gx_cray_ptr_flag_FCFLAGS_save ${ac_flag}"
+ AC_COMPILE_IFELSE([[ program test
+ integer iarri(10)
+ pointer (ipt, iarr)
+ end program test]],
+ [gx_cv_fc_cray_ptr_flag=$ac_flag; break])
+done
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+FCFLAGS=$gx_cray_ptr_flag_FCFLAGS_save
+])
+if test "x$gx_cv_fc_cray_ptr_flag" = "xunknown"; then
+ m4_default([$2],
+ [AC_MSG_ERROR([Fortran cannot use Cray pointers])])
+else
+ AC_DEFINE([HAVE_CRAY_POINTER], 1,
+ [Define to 1 if your Fortran compiler supports cray pointers])
+ FC_CRAY_POINTER_FLAG=$gx_cv_fc_cray_ptr_flag
+ if test "x$FC_CRAY_POINTER_FLAG" = xnone; then
+ FC_CRAY_POINTER_FLAG=
+ fi
+ $1
+fi
+AC_LANG_POP([Fortran])
+AC_SUBST([FC_CRAY_POINTER_FLAG])
+])
+
+# GX_FC_INTERNAL_FILE_NML
+# -----------------------------------------------------------------------------
+# Determine if the Fortran compiler supports reading Fortran namelists from
+# an internal file. If supported, sets the define HAVE_INTERNAL_NML.
+AC_DEFUN([GX_FC_INTERNAL_FILE_NML],[
+AC_LANG_PUSH([Fortran])
+AC_CACHE_CHECK([if $[]_AC_FC[] supports reading namelists from internal files], [gx_cv_fc_internal_file_nml],[
+gx_cv_fc_internal_file_nml=unknown
+AC_COMPILE_IFELSE([[ program test
+ implicit none
+ integer :: a = 1
+ real :: b = 0.1
+ character(LEN=20) :: internal_nml ="&test_nml a=2 b=1.0/"
+ namelist /test_nml/ a, b
+ read(internal_nml,test_nml)
+ end program test]],
+ [gx_cv_fc_internal_file_nml=yes],
+ [gx_cv_fc_internal_file_nml=no])])
+if test "x$gx_cv_fc_internal_file_nml" = "xyes"; then
+ AC_DEFINE([HAVE_INTERNAL_NML], 1,
+ [Define to 1 if your Fortran compiler supports reading namelists
+ from internal files])
+fi
+AC_LANG_POP([Fortran])
+])
+
+# GX_FC_CHECK_MOD(module-name, [only], [action-if-found], [action-if-not-found])
+# -----------------------------------------------------------------------------
+# Check if a Fortran module module-name is available. Execute shell commands
+# action-if-found, otherwise execute action-if-not-found. If only is specified
+# then check if the Fortran module has the given symbol.
+AC_DEFUN([GX_FC_CHECK_MOD],[
+_AC_FORTRAN_ASSERT()dnl
+m4_ifval([$2],[gx_fc_check_mod_only=",only:$2"],[gx_fc_check_mod_only=""])
+AS_LITERAL_WORD_IF([$1],
+ [AS_VAR_PUSHDEF([gx_mod], [gx_cv_fc_check_mod_$1])],
+ [AS_VAR_PUSHDEF([gx_mod], AS_TR_SH([gx_cv_check_mod_$1]))])
+dnl Autoconf does not pass CPPFLAGS to the Fortran tests. As the user may
+dnl define the include options in CPPFLAGS instead of FFLAGS or FCFLAGS, we
+dnl force CPPFLAGS te be part of FFLAGS/FCFLAGS
+gx_save_[]_AC_LANG_PREFIX[]FLAGS=${[]_AC_LANG_PREFIX[]FLAGS}
+_AC_LANG_PREFIX[]FLAGS="${[]_AC_LANG_PREFIX[]FLAGS} $CPPFLAGS"
+AC_CACHE_CHECK([for Fortran module $1], [gx_mod],
+ [AC_COMPILE_IFELSE([[ program test
+ use $1$gx_fc_check_mod_only
+ end program test]],
+ [AS_VAR_SET([gx_mod], [yes])],
+ [AS_VAR_SET([gx_mod], [no])])])
+_AC_LANG_PREFIX[]FLAGS="${gx_save_[]_AC_LANG_PREFIX[]FLAGS}"
+AS_VAR_IF([gx_mod], [yes],
+ [m4_default([$3],
+ [AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_MOD_$1), 1, [Define to 1 if the Fortran module $1 is found])])],
+ [$4])
+AS_VAR_POPDEF([gx_mod])
+])#GX_FC_CHECK_MOD
+
+# GX_FORTRAN_CHECK_HEADERS(header, [action-if-found], [action-if-not-found])
+# -----------------------------------------------------------------------
+# Check if a Fortran include file is available.
+AC_DEFUN([GX_FORTRAN_CHECK_HEADERS], [
+_AC_FORTRAN_ASSERT()dnl
+AS_LITERAL_WORD_IF([$1],
+ [AS_VAR_PUSHDEF([gx_header], [gx_cv_fortran_check_headers_$1])],
+ [AS_VAR_PUSHDEF([gx_header], [AS_TR_SH([gx_cv_fortran_check_headers_$1])])])
+dnl Ensure the Fortran compiler will run the preprocessor
+_GX_FORTRAN_PP_SRCEXT_PUSH([F])
+dnl Autoconf does not pass CPPFLAGS to the Fortran tests. As the user may
+dnl define the include options in CPPFLAGS instead of FFLAGS or FCFLAGS, we
+dnl force CPPFLAGS te be part of FFLAGS/FCFLAGS
+gx_save_[]_AC_LANG_PREFIX[]FLAGS=${[]_AC_LANG_PREFIX[]FLAGS}
+_AC_LANG_PREFIX[]FLAGS="${[]_AC_LANG_PREFIX[]FLAGS} $CPPFLAGS"
+AC_CACHE_CHECK([for $1 usability], [gx_header],
+ [AC_COMPILE_IFELSE(AC_LANG_PROGRAM([],
+ [@%:@include <$1>]),
+ [AS_VAR_SET([gx_header], [yes])],
+ [AS_VAR_SET([gx_header], [no])])])
+_AC_LANG_PREFIX[]FLAGS="${gx_save_[]_AC_LANG_PREFIX[]FLAGS}"
+_GX_FORTRAN_PP_SRCEXT_POP([F])
+AS_VAR_IF([gx_header], [yes],
+ [m4_default([$2],
+ [AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_$1), 1, [Define to 1 if the Fortran include file $1 is found])])],
+ [$3])
+AS_VAR_POPDEF([gx_header])
+])# GX_FC_CHECK_HEADERS
+
+# GX_FORTRAN_SEARCH_LIBS(FUNCTION, SEARCH-LIBS, [CALL_PREFIX], [CALL_SYNTAX],
+# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND],
+# [OTHER-LIBRARIES])
+# ------------------------------------------------------------------------------
+# Search for a Fortran library defining FUNCTION, if it's not already availabe.
+#
+# This expands AC_SEARCH_LIBS for Fortran as the AC function does not work in
+# all cases for Fortran.
+AC_DEFUN([GX_FORTRAN_SEARCH_LIBS], [
+_AC_FORTRAN_ASSERT()dnl
+AS_VAR_PUSHDEF([gx_search], [gx_cv_fortran_search_libs_$1])
+dnl Ensure the Fortran compiler will run the preprocessor
+_GX_FORTRAN_PP_SRCEXT_PUSH([F])
+dnl Autoconf does not pass CPPFLAGS to the Fortran tests. As the user may
+dnl define the include options in CPPFLAGS instead of FFLAGS or FCFLAGS, we
+dnl force CPPFLAGS te be part of FFLAGS/FCFLAGS
+gx_save_FLAGS="${[]_AC_LANG_PREFIX[]FLAGS}"
+_AC_LANG_PREFIX[]FLAGS="${[]_AC_LANG_PREFIX[]FLAGS} $CPPFLAGS"
+dnl Prepare the prefix and syntax sections so they will compile correctly
+dnl with the Fortran compiler
+m4_foreach(gx_line, m4_split($3, m4_newline()),
+ [m4_append([_gx_fortran_sanitized_call_prefix], m4_bmatch(gx_line, [^\w.*], [ ]gx_line, [gx_line]), m4_newline())dnl
+])
+gx_fortran_sanitized_call_prefix="_gx_fortran_sanitized_call_prefix"
+gx_fortran_func_line="m4_bregexp([$4], [^.*$], [ \&])"
+AC_CACHE_CHECK([for library containing $1], [gx_search],
+[gx_fortran_search_libs_save_LIBS=$LIBS
+AC_LANG_CONFTEST([AC_LANG_PROGRAM([],[[$gx_fortran_sanitized_call_prefix
+$gx_fortran_func_line]])])
+dnl Search for the library
+for gx_lib in '' $2; do
+ if test -z "$gx_lib"; then
+ gx_res="none required"
+ else
+ gx_res=-l$gx_lib
+ LIBS="$gx_res $7 $gx_fortran_search_libs_save_LIBS"
+ fi
+ AC_LINK_IFELSE([], [AS_VAR_SET([gx_search], [$gx_res])])
+ AS_VAR_SET_IF([gx_search], [break])
+done
+AS_VAR_SET_IF([gx_search], , [AS_VAR_SET([gx_search], [no])])
+rm conftest.$ac_ext
+LIBS=$gx_fortran_search_libs_save_LIBS])
+AS_VAR_COPY([gx_res], [gx_search])
+AS_IF([test "$gx_res" != no],
+ [test "$gx_res" = "none required" || LIBS="$gx_res $LIBS"
+ $5],
+ [$6])
+_AC_LANG_PREFIX[]FLAGS="$gx_save_FLAGS"
+_GX_FORTRAN_PP_SRCEXT_POP([F])
+AS_VAR_POPDEF([gx_search])
+m4_ifdef([gx_line], [m4_undefine([gx_line])])
+m4_ifdef([_gx_fortran_sanitized_call_prefix], [m4_undefine([_gx_fortran_sanitized_call_prefix])])
+])# GX_FORTRAN_SEARCH_LIBS
+
+# _GX_FORTRAN_PP_SRCEXT_PUSH(EXT) will ensure the Fortran test extension (stored
+# in ac_ext) will cause the Fortran compiler to preprocess the test source file.
+# Most Fortran compilers will preprocess the file based on the file extension,
+# and of the known extension, F appears to work for all compilers. This
+# function accepts the file extension (without the preceeding .), similar
+# to the AC_FC_SRCEXT and AC_FC_PP_SRCEXT macros. If the extension is not
+# provided, the default is 'F'.
+# Unfortunately, this will not work for compilers that require a specific flag.
+AC_DEFUN([_GX_FORTRAN_PP_SRCEXT_PUSH],[
+_gx_fortran_pp_srcext_save=$ac_ext
+AS_VAR_SET_IF([1], [ac_ext=$1], [ac_ext="F"])
+])# _GX_FORTRAN_PP_SRCEXT_PUSH
+
+# _GX_FORTRAN_PP_SRCEXT_POP() reverses the extension change done in
+# _GX_FORTRAN_PP_SRCEXT_PUSH. If this pop is called without a preceeding
+# push, the default Fortran file extension (f) will be used.
+AC_DEFUN([_GX_FORTRAN_PP_SRCEXT_POP], [
+AS_VAR_SET_IF([_gx_fortran_pp_srcext_save], [ac_ext=${_gx_fortran_pp_srcext_save}], [ac_ext="f"])
+unset _gx_fortran_pp_srcext_save
+])# _GX_FORTRAN_PP_SRCEXT_POP