From 31aba8b7c481b7e6d645b261dc42d28bd69784cf Mon Sep 17 00:00:00 2001 From: Daniel Williams Date: Wed, 16 Dec 2020 13:54:30 +0000 Subject: [PATCH 01/10] First draft of documentation for docs page (relies on future changes for non-water generalisation) --- docs/source/modules/constants.rst | 119 ++++++++++++++++++++++++++++++ 1 file changed, 119 insertions(+) create mode 100644 docs/source/modules/constants.rst diff --git a/docs/source/modules/constants.rst b/docs/source/modules/constants.rst new file mode 100644 index 000000000..b90ee37db --- /dev/null +++ b/docs/source/modules/constants.rst @@ -0,0 +1,119 @@ + +Constants: Atmospheric and Planetary Parameters. +================================================ + +Documentation for ``constants.f90``. + +Summary +------- + +``constants.F90`` provides a number of controls that set the fundamental parameters of the planet being studied in Isca. By default, Isca models a planet equivalent to earth in terms of physical characteristics such as size, surface gravity and rotational period. In addition, water is set as the default condensate for any moist physics modules that may be used. + +Planetary Parameters +"""""""""""""""""""" + + ++-------------------+--------------+----------------------------------+----------------------------------------+ +| Name | Default | Units | Description | ++===================+==============+==================================+========================================+ +|``radius`` | 6371.e3 | m | Radius of planet | ++-------------------+--------------+----------------------------------+----------------------------------------+ +|``gravity`` | 9.80 | ms :math:`^{-1}` | Surface gravitational acceleration | ++-------------------+--------------+----------------------------------+----------------------------------------+ +|``omega`` | 7.2921150e-5 | rad :math:`\cdot`s :math:`^{-1}` | Rotation rate of planet | ++-------------------+--------------+----------------------------------+----------------------------------------+ +|``rotation_period``| -1.0 | s | Rotation period of planet | ++-------------------+--------------+----------------------------------+----------------------------------------+ +|``orbital_period`` | 31557600 | s | Orbital period of planet | ++-------------------+--------------+----------------------------------+----------------------------------------+ +|``orbital_rate`` | | rad :math:`\cdot`s :math:`^{-1}` | Orbital rate of planet | ++-------------------+--------------+----------------------------------+----------------------------------------+ + + +Dry Atmosphere +"""""""""""""" + +Changing the dry atmosphere values allows atmospheres with a wide range of compositions to be studied, including both terrestrial planets (e.g. Earth) and gas giants such as Jupiter. In the case of Earth, the reference surface pressure is taken to be the mean sea level pressure. + +The dry air gas constant for any homogeneous atmosphere can be calculated from its chemical composition. It is calculated by dividing the universal gas constant by the average molar mass of the atmosphere -- taking Jupiter as an example (approximately 90% hydrogen and 10% helium) we obtain + +.. math:: + R_{\text{dry}} = \frac{R}{\left(0.9 * 1\right) + \left(0.1 * 4\right)} + +which using R=8.314 and converting from g to kg gives 6395 :math:`^{-1}`K :math:`^{-1}`. + + +**Note:** If the mean surface pressure value is changed here, it is necessary to also set ``reference_sea_level_press`` from the ``spectral_dynamics_nml`` namelist, else the output file will not extend to the pressure specified. + ++------------+-----------------------+----------------------------------+----------------------------------------+ +| Name | Default | Units | Description | ++============+=======================+==================================+========================================+ +|``pstd_mks``| 101325.0 | Pa / Nm :math:`^{-2}` | Mean (reference) surface pressure (SI) | ++------------+-----------------------+----------------------------------+----------------------------------------+ +|``pstd`` | 1.013250E+06 | Ba / dyncm :math:`^{-2}` | Mean (reference) surface pressure (cgs)| ++------------+-----------------------+----------------------------------+----------------------------------------+ +|``rdgas`` | 287.04 | Jkg :math:`^{-1}`K :math:`^{-1}` | Dry air gas constant | ++------------+-----------------------+----------------------------------+----------------------------------------+ +|``kappa`` | 2/7 | dimensionless | Heat capacity ratio | ++------------+-----------------------+----------------------------------+----------------------------------------+ +|``cp_air`` | ``rvgas`` / ``kappa`` | Jkg :math:`^{-1}`K :math:`^{-1}` | Dry air heat capcity | ++------------+-----------------------+----------------------------------+----------------------------------------+ + + + +Moist Atmosphere +"""""""""""""""" + +With the addition of moist physics, a number of additional namelist parameters can be used to change the primary condensate present in the atmosphere. This allows atmospheres in temperature regimes significantly different from Earth to be modelled, including Titan, which has an active methane cycle. + ++--------------+-------------------+----------------------------------+-------------------------------------------+ +| Name | Default | Units | Description | ++==============+===================+==================================+===========================================+ +|``rvgas`` | 461.50 | Jkg :math:`^{-1}`K :math:`^{-1}` | Vapour gas constant | ++--------------+-------------------+----------------------------------+-------------------------------------------+ +|``cp_vapor`` | 4 * ``rvgas`` | Jkg :math:`^{-1}`K :math:`^{-1}` | Vapour heat capacity | ++--------------+-------------------+----------------------------------+-------------------------------------------+ +|``dens_vapor``| 1000 | kgm :math:`^{-3}` | Density of condensate in the liquid phase | ++--------------+-------------------+----------------------------------+-------------------------------------------+ +|``hlv`` | 2.500e6 | Jkg :math:`^{-1}` | Latent heat of vapourisation of condensate| ++--------------+-------------------+----------------------------------+-------------------------------------------+ +|``hlf`` | 3.34e5 | Jkg :math:`^{-1}` | Latent heat of fusion of condensate | ++--------------+-------------------+----------------------------------+-------------------------------------------+ +|``hls`` | ``hlv`` + ``hlf`` | Jkg :math:`^{-1}` | Latent heat of sublimation of condensate | ++--------------+-------------------+----------------------------------+-------------------------------------------+ +|``tfreeze`` | 273.16 | K | Freezing point of condensate | ++--------------+-------------------+----------------------------------+-------------------------------------------+ +|``tppress`` | 610.78 | Pa / Nm :math:`^{-2}` | Triple point pressure of condensate | ++--------------+-------------------+----------------------------------+-------------------------------------------+ + + + + +Relevant modules and subroutines +-------------------------------- + +TO BE EDITED!!!!! + + +Key physics modules managed from this module include: + +* ``vert_turb_driver_mod`` +* ``vert_diff_mod`` +* ``two_stream_gray_rad_mod`` +* RRTM: see ``Isca/src/atmos_param/rrtm_radiation/`` +* SOCRATES: see ``Isca/src/atmos_param/socrates/`` +* ``mixed_layer_mod`` +* ``lscale_cond_mod`` +* ``qe_moist_convection_mod`` +* ``ras_mod`` +* ``betts_miller_mod`` +* ``dry_convection_mod`` +* ``surface_flux_mod`` +* ``damping_driver_mod`` +* ``rayleigh_bottom_drag_mod`` + + +Authors +------- +This documentation was written by Daniel Williams, peer reviewed by YY, and quality controlled by ZZ. + From 3f275c84bf6e0a76865a270d2ec8bec92d00780f Mon Sep 17 00:00:00 2001 From: Daniel Williams Date: Fri, 22 Jan 2021 14:21:41 +0000 Subject: [PATCH 02/10] Testing single file change for trip tests. --- src/shared/constants/constants.F90 | 57 +++++++++++++++++++++--------- 1 file changed, 40 insertions(+), 17 deletions(-) diff --git a/src/shared/constants/constants.F90 b/src/shared/constants/constants.F90 index 97c6d87d5..8c7c83e9e 100644 --- a/src/shared/constants/constants.F90 +++ b/src/shared/constants/constants.F90 @@ -94,36 +94,41 @@ module constants_mod ! Humidity factor. Controls the humidity content of the atmosphere through ! the Saturation Vapour Pressure expression when using DO_SIMPLE. ! -! +! ! gas constant for water vapor ! -! +! ! specific heat capacity of water vapor at constant pressure ! ! ! density of liquid water ! -! -! latent heat of evaporation +! +! latent heat of evaporation for water ! -! -! latent heat of fusion +! +! latent heat of fusion for water ! -! -! latent heat of sublimation +! +! latent heat of sublimation for water ! -! +! ! temp where fresh water freezes ! +! +! Pressure of Triple Point: prefactor in version of +! Clausius-Clapeyron when using DO_SIMPLE. +! real, public, parameter :: DEF_ES0 = 1.0 -real, public, parameter :: RVGAS = 461.50 -real, public, parameter :: CP_VAPOR = 4.0*RVGAS +real, public, parameter :: RVGAS_H20 = 461.50 +real, public, parameter :: CP_VAPOR_H20 = 4.0*RVGAS_H20 real, public, parameter :: DENS_H2O = 1000. -real, public, parameter :: HLV = 2.500e6 -real, public, parameter :: HLF = 3.34e5 -real, public, parameter :: HLS = HLV + HLF -real, public, parameter :: TFREEZE = 273.16 +real, public, parameter :: HLV_H20 = 2.500e6 +real, public, parameter :: HLF_H20 = 3.34e5 +real, public, parameter :: HLS_H20 = HLV_H20 + HLF_H20 +real, public, parameter :: TFREEZE_H20 = 273.16 +real, public, parameter :: TPPRESS_H20 = 610.78 !-------------- radiation constants ----------------- @@ -164,7 +169,7 @@ module constants_mod ! real, public, parameter :: WTMAIR = 2.896440E+01 -real, public, parameter :: WTMH2O = WTMAIR*(EARTH_RDGAS/RVGAS) !pjp OK to change value because not used yet. +real, public, parameter :: WTMH2O = WTMAIR*(EARTH_RDGAS/RVGAS_H20) !pjp OK to change value because not used yet. !real, public, parameter :: WTMO3 = 47.99820E+01 real, public, parameter :: WTMOZONE = 47.99820 real, public, parameter :: WTMC = 12.00000 @@ -254,6 +259,7 @@ module constants_mod real, public :: RADIUS = 6376.0e3 real, public :: GRAV = EARTH_GRAV real, public :: OMEGA = EARTH_OMEGA ! planetary rotation rate in s^-1 +real, public :: ROTATION_PERIOD = -1.0 real, public :: ORBITAL_PERIOD = EARTH_ORBITAL_PERIOD ! orbital period (periapse -> periapse) in s real, public :: SECONDS_PER_SOL = SECONDS_PER_DAY real, public :: orbital_rate ! this is calculated from 2pi/orbital_period @@ -262,12 +268,20 @@ module constants_mod real, public :: PSTD = 1.013250E+06 real, public :: PSTD_MKS = PSTD_MKS_EARTH real, public :: RDGAS = EARTH_RDGAS +real, public :: RVGAS = RVGAS_H20 +real, public :: CP_VAPOR = 4.0*RVGAS_H20 +real, public :: DENS_VAPOR = DENS_H2O real, public :: KAPPA = EARTH_KAPPA real, public :: CP_AIR = EARTH_CP_AIR +real, public :: HLV = HLV_H20 +real, public :: HLF = HLF_H20 +real, public :: HLS = HLS_H20 +real, public :: TFREEZE = TFREEZE_H20 +real, public :: TPPRESS = TPPRESS_H20 real, public :: es0 = DEF_ES0 logical :: earthday_multiple = .false. -namelist/constants_nml/ radius, grav, omega, orbital_period, pstd, pstd_mks, rdgas, kappa, solar_const, earthday_multiple, es0 +namelist/constants_nml/ radius, grav, omega, orbital_period, orbital_rate, rotation_period, pstd, pstd_mks, rdgas, rvgas, kappa, hlv, hlf, tfreeze, tppress, dens_vapor, solar_const, earthday_multiple, es0 !----------------------------------------------------------------------- ! version and tagname published @@ -298,6 +312,13 @@ subroutine constants_init 10 call close_file (unit) if (mpp_pe() == mpp_root_pe()) write (stdlog(),nml=constants_nml) + + if (rotation_period.gt.0) then + omega = 2.*pi/rotation_period + + call error_mesg( 'constants_init','rotation_period has been specified, so omega calculated from rotation_period', NOTE) + + endif !> SECONDS_PER_SOL is the exoplanet equivalent of seconds_per_day. !! It is the number of seconds between sucessive solar zeniths at longitude 0. @@ -314,6 +335,8 @@ subroutine constants_init endif CP_AIR = RDGAS/KAPPA + CP_VAPOR = 4.0*RVGAS + HLS = HLV + HLF constants_initialised = .true. From e5aa3df45e7264424224b319278327b1c9b0ef54 Mon Sep 17 00:00:00 2001 From: Daniel Williams Date: Fri, 22 Jan 2021 17:38:21 +0000 Subject: [PATCH 03/10] Checking idealised_moist_physics changes with trip tests. --- src/atmos_spectral/driver/solo/idealized_moist_phys.F90 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/atmos_spectral/driver/solo/idealized_moist_phys.F90 b/src/atmos_spectral/driver/solo/idealized_moist_phys.F90 index 8115c08a2..b23cbeb19 100644 --- a/src/atmos_spectral/driver/solo/idealized_moist_phys.F90 +++ b/src/atmos_spectral/driver/solo/idealized_moist_phys.F90 @@ -8,7 +8,7 @@ module idealized_moist_phys_mod use fms_mod, only: write_version_number, file_exist, close_file, stdlog, error_mesg, NOTE, FATAL, read_data, field_size, uppercase, mpp_pe -use constants_mod, only: grav, rdgas, rvgas, cp_air, PSTD_MKS, dens_h2o !mj cp_air needed for rrtmg !s pstd_mks needed for pref calculation +use constants_mod, only: grav, rdgas, rvgas, cp_air, PSTD_MKS, dens_vapor !mj cp_air needed for rrtmg !s pstd_mks needed for pref calculation use time_manager_mod, only: time_type, get_time, operator( + ) @@ -829,7 +829,7 @@ subroutine idealized_moist_phys(Time, p_half, p_full, z_half, z_full, ug, vg, tg conv_dt_tg = conv_dt_tg/delta_t conv_dt_qg = conv_dt_qg/delta_t - depth_change_conv = rain/dens_h2o ! RG Add bucket + depth_change_conv = rain/dens_vapor ! RG Add bucket rain = rain/delta_t precip = rain @@ -858,7 +858,7 @@ subroutine idealized_moist_phys(Time, p_half, p_full, z_half, z_full, ug, vg, tg conv_dt_tg = conv_dt_tg/delta_t conv_dt_qg = conv_dt_qg/delta_t - depth_change_conv = rain/dens_h2o ! RG Add bucket + depth_change_conv = rain/dens_vapor ! RG Add bucket rain = rain/delta_t precip = rain @@ -937,7 +937,7 @@ subroutine idealized_moist_phys(Time, p_half, p_full, z_half, z_full, ug, vg, tg cond_dt_tg = cond_dt_tg/delta_t cond_dt_qg = cond_dt_qg/delta_t - depth_change_cond = rain/dens_h2o ! RG Add bucket + depth_change_cond = rain/dens_vapor ! RG Add bucket rain = rain/delta_t snow = snow/delta_t precip = precip + rain + snow From c88d20fab4379d27cb025622ef38142c03ef0471 Mon Sep 17 00:00:00 2001 From: Daniel Williams Date: Wed, 10 Feb 2021 17:04:25 +0000 Subject: [PATCH 04/10] Changed surface flux file for trip test --- src/coupler/surface_flux.F90 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/coupler/surface_flux.F90 b/src/coupler/surface_flux.F90 index 97a207f51..759c57e35 100644 --- a/src/coupler/surface_flux.F90 +++ b/src/coupler/surface_flux.F90 @@ -39,7 +39,7 @@ module surface_flux_mod use fms_mod, only: file_exist, check_nml_error, open_namelist_file, stdlog use monin_obukhov_mod, only: mo_drag, mo_profile use sat_vapor_pres_mod, only: escomp, descomp -use constants_mod, only: cp_air, hlv, stefan, rdgas, rvgas, grav, vonkarm, dens_h2o +use constants_mod, only: cp_air, hlv, stefan, rdgas, rvgas, grav, vonkarm, dens_vapor use mpp_mod, only: input_nml_file implicit none @@ -601,10 +601,10 @@ subroutine surface_flux_1d ( & flux_q = rho_drag * (q_surf0 - q_atm) ! flux of water vapor (Kg/(m**2 s)) end where - depth_change_lh_1d = flux_q * dt/dens_h2o + depth_change_lh_1d = flux_q * dt/dens_vapor where (flux_q > 0.0 .and. bucket_depth < depth_change_lh_1d) ! where more evaporation than what's in bucket, empty bucket - flux_q = bucket_depth * dens_h2o / dt - depth_change_lh_1d = flux_q * dt / dens_h2o + flux_q = bucket_depth * dens_vapor / dt + depth_change_lh_1d = flux_q * dt / dens_vapor end where where (bucket_depth <= 0.0) From 7b5d61ace44fa3ea561a9316cec6030ae6f3da01 Mon Sep 17 00:00:00 2001 From: Daniel Williams Date: Wed, 10 Feb 2021 18:31:41 +0000 Subject: [PATCH 05/10] Added sat_vapor file for trip test --- src/shared/sat_vapor_pres/sat_vapor_pres.F90 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/shared/sat_vapor_pres/sat_vapor_pres.F90 b/src/shared/sat_vapor_pres/sat_vapor_pres.F90 index 1e1a6f3aa..2d8b40460 100644 --- a/src/shared/sat_vapor_pres/sat_vapor_pres.F90 +++ b/src/shared/sat_vapor_pres/sat_vapor_pres.F90 @@ -132,7 +132,7 @@ module sat_vapor_pres_mod ! Description summarizing public interface. ! - use constants_mod, only: TFREEZE, RDGAS, RVGAS, HLV, ES0 + use constants_mod, only: TFREEZE, TFREEZE_H20, RDGAS, RVGAS, HLV, ES0, TPPRESS use fms_mod, only: write_version_number, stdout, stdlog, mpp_pe, mpp_root_pe, & mpp_error, FATAL, fms_error_handler, open_namelist_file, & error_mesg, & @@ -2309,8 +2309,8 @@ subroutine sat_vapor_pres_init(err_msg) endif nsize = (tcmax-tcmin)*esres+1 nlim = nsize-1 - call sat_vapor_pres_init_k(nsize, real(tcmin), real(tcmax), TFREEZE, HLV, & - RVGAS, ES0, err_msg_local, use_exact_qs, do_simple, & + call sat_vapor_pres_init_k(nsize, real(tcmin), real(tcmax), TFREEZE, TFREEZE_H20, HLV, & + RVGAS, ES0, TPPRESS, err_msg_local, use_exact_qs, do_simple, & construct_table_wrt_liq, & construct_table_wrt_liq_and_ice, & teps, tmin, dtinv) From 6dc1856b90ae19479a81c346781a641f9aaced9f Mon Sep 17 00:00:00 2001 From: Daniel Williams Date: Wed, 10 Feb 2021 22:20:34 +0000 Subject: [PATCH 06/10] Added new two_stream (changes for slow rotators) for trip test --- .../two_stream_gray_rad/two_stream_gray_rad.F90 | 9 +++++---- src/shared/sat_vapor_pres/sat_vapor_pres_k.F90 | 8 ++++---- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/atmos_param/two_stream_gray_rad/two_stream_gray_rad.F90 b/src/atmos_param/two_stream_gray_rad/two_stream_gray_rad.F90 index 9849c30c0..0e1e047b6 100644 --- a/src/atmos_param/two_stream_gray_rad/two_stream_gray_rad.F90 +++ b/src/atmos_param/two_stream_gray_rad/two_stream_gray_rad.F90 @@ -418,16 +418,17 @@ subroutine two_stream_gray_rad_down (is, js, Time_diag, lat, lon, p_half, t, ! Seasonal Cycle: Use astronomical parameters to calculate insolation call get_time(Time_diag, seconds, days) call get_time(length_of_year(), year_in_s) - r_seconds = real(seconds) day_in_s = length_of_day() - frac_of_day = r_seconds / day_in_s + r_seconds = real(seconds) + r_days=real(days) + r_total_seconds=r_seconds+(r_days*86400.) + + frac_of_day = r_total_seconds / day_in_s if(solday .ge. 0) then r_solday=real(solday) frac_of_year = (r_solday*day_in_s) / year_in_s else - r_days=real(days) - r_total_seconds=r_seconds+(r_days*day_in_s) frac_of_year = r_total_seconds / year_in_s endif diff --git a/src/shared/sat_vapor_pres/sat_vapor_pres_k.F90 b/src/shared/sat_vapor_pres/sat_vapor_pres_k.F90 index 1c1cded34..e7380a9fb 100644 --- a/src/shared/sat_vapor_pres/sat_vapor_pres_k.F90 +++ b/src/shared/sat_vapor_pres/sat_vapor_pres_k.F90 @@ -158,7 +158,7 @@ module sat_vapor_pres_k_mod contains - subroutine sat_vapor_pres_init_k(table_size, tcmin, tcmax, TFREEZE, HLV, RVGAS, ES0, err_msg, & + subroutine sat_vapor_pres_init_k(table_size, tcmin, tcmax, TFREEZE, TFREEZE_H20, HLV, RVGAS, ES0, TPPRESS, err_msg, & use_exact_qs_input, do_simple, & construct_table_wrt_liq, & construct_table_wrt_liq_and_ice, & @@ -169,7 +169,7 @@ subroutine sat_vapor_pres_init_k(table_size, tcmin, tcmax, TFREEZE, HLV, RVGAS, integer, intent(in) :: table_size real, intent(in) :: tcmin ! TABLE(1) = sat vapor pressure at temperature tcmin (deg C) real, intent(in) :: tcmax ! TABLE(table_size) = sat vapor pressure at temperature tcmax (deg C) - real, intent(in) :: TFREEZE, HLV, RVGAS, ES0 + real, intent(in) :: TFREEZE, TFREEZE_H20, HLV, RVGAS, ES0, TPPRESS logical, intent(in) :: use_exact_qs_input, do_simple logical, intent(in) :: construct_table_wrt_liq logical, intent(in) :: construct_table_wrt_liq_and_ice @@ -212,7 +212,7 @@ subroutine sat_vapor_pres_init_k(table_size, tcmin, tcmax, TFREEZE, HLV, RVGAS, table_siz = table_size dtres = (tcmax - tcmin)/(table_size-1) - tminl = real(tcmin)+TFREEZE ! minimum valid temp in table + tminl = real(tcmin)+TFREEZE_H20 ! minimum valid temp in table. Always use TFREEZE_WATER here, as this is just converting tcmin from celcius to kelvin. dtinvl = 1./dtres tepsl = .5*dtres tinrc = .1*dtres @@ -234,7 +234,7 @@ subroutine sat_vapor_pres_init_k(table_size, tcmin, tcmax, TFREEZE, HLV, RVGAS, do i = 1, table_size tem(1) = tminl + dtres*real(i-1) - TABLE(i) = ES0*610.78*exp(-hlv/rvgas*(1./tem(1) - 1./tfreeze)) + TABLE(i) = ES0*tppress*exp(-hlv/rvgas*(1./tem(1) - 1./tfreeze)) DTABLE(i) = hlv*TABLE(i)/rvgas/tem(1)**2. enddo From c623e4622e788d35abcb540351049bdfe40e3d14 Mon Sep 17 00:00:00 2001 From: Daniel Williams Date: Wed, 10 Feb 2021 22:22:47 +0000 Subject: [PATCH 07/10] Testing modification to bucket initialisation --- src/atmos_spectral/driver/solo/idealized_moist_phys.F90 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/atmos_spectral/driver/solo/idealized_moist_phys.F90 b/src/atmos_spectral/driver/solo/idealized_moist_phys.F90 index b23cbeb19..9e4a10345 100644 --- a/src/atmos_spectral/driver/solo/idealized_moist_phys.F90 +++ b/src/atmos_spectral/driver/solo/idealized_moist_phys.F90 @@ -424,9 +424,9 @@ subroutine idealized_moist_phys_init(Time, Time_step_in, nhum, rad_lon_2d, rad_l allocate (dt_bucket (is:ie, js:je)); dt_bucket = 0.0 ! RG Add bucket allocate (filt (is:ie, js:je)); filt = 0.0 ! RG Add bucket allocate(bucket_depth (is:ie, js:je, num_time_levels)); bucket_depth = init_bucket_depth ! RG Add bucket -allocate(depth_change_lh(is:ie, js:je)) ! RG Add bucket -allocate(depth_change_cond(is:ie, js:je)) ! RG Add bucket -allocate(depth_change_conv(is:ie, js:je)) ! RG Add bucket +allocate(depth_change_lh(is:ie, js:je)) ; depth_change_lh = 0.0 ! RG Add bucket +allocate(depth_change_cond(is:ie, js:je)) ; depth_change_cond = 0.0 ! RG Add bucket +allocate(depth_change_conv(is:ie, js:je)) ; depth_change_conv = 0.0 ! RG Add bucket allocate(z_surf (is:ie, js:je)) allocate(t_surf (is:ie, js:je)) allocate(q_surf (is:ie, js:je)); q_surf = 0.0 From 992b90e3d20cedaa0269c5f4bd2341c11d4efe08 Mon Sep 17 00:00:00 2001 From: Daniel Williams Date: Thu, 11 Feb 2021 12:10:02 +0000 Subject: [PATCH 08/10] Removed docs file as it forms part of separate PR. --- docs/source/modules/constants.rst | 119 ------------------------------ 1 file changed, 119 deletions(-) delete mode 100644 docs/source/modules/constants.rst diff --git a/docs/source/modules/constants.rst b/docs/source/modules/constants.rst deleted file mode 100644 index b90ee37db..000000000 --- a/docs/source/modules/constants.rst +++ /dev/null @@ -1,119 +0,0 @@ - -Constants: Atmospheric and Planetary Parameters. -================================================ - -Documentation for ``constants.f90``. - -Summary -------- - -``constants.F90`` provides a number of controls that set the fundamental parameters of the planet being studied in Isca. By default, Isca models a planet equivalent to earth in terms of physical characteristics such as size, surface gravity and rotational period. In addition, water is set as the default condensate for any moist physics modules that may be used. - -Planetary Parameters -"""""""""""""""""""" - - -+-------------------+--------------+----------------------------------+----------------------------------------+ -| Name | Default | Units | Description | -+===================+==============+==================================+========================================+ -|``radius`` | 6371.e3 | m | Radius of planet | -+-------------------+--------------+----------------------------------+----------------------------------------+ -|``gravity`` | 9.80 | ms :math:`^{-1}` | Surface gravitational acceleration | -+-------------------+--------------+----------------------------------+----------------------------------------+ -|``omega`` | 7.2921150e-5 | rad :math:`\cdot`s :math:`^{-1}` | Rotation rate of planet | -+-------------------+--------------+----------------------------------+----------------------------------------+ -|``rotation_period``| -1.0 | s | Rotation period of planet | -+-------------------+--------------+----------------------------------+----------------------------------------+ -|``orbital_period`` | 31557600 | s | Orbital period of planet | -+-------------------+--------------+----------------------------------+----------------------------------------+ -|``orbital_rate`` | | rad :math:`\cdot`s :math:`^{-1}` | Orbital rate of planet | -+-------------------+--------------+----------------------------------+----------------------------------------+ - - -Dry Atmosphere -"""""""""""""" - -Changing the dry atmosphere values allows atmospheres with a wide range of compositions to be studied, including both terrestrial planets (e.g. Earth) and gas giants such as Jupiter. In the case of Earth, the reference surface pressure is taken to be the mean sea level pressure. - -The dry air gas constant for any homogeneous atmosphere can be calculated from its chemical composition. It is calculated by dividing the universal gas constant by the average molar mass of the atmosphere -- taking Jupiter as an example (approximately 90% hydrogen and 10% helium) we obtain - -.. math:: - R_{\text{dry}} = \frac{R}{\left(0.9 * 1\right) + \left(0.1 * 4\right)} - -which using R=8.314 and converting from g to kg gives 6395 :math:`^{-1}`K :math:`^{-1}`. - - -**Note:** If the mean surface pressure value is changed here, it is necessary to also set ``reference_sea_level_press`` from the ``spectral_dynamics_nml`` namelist, else the output file will not extend to the pressure specified. - -+------------+-----------------------+----------------------------------+----------------------------------------+ -| Name | Default | Units | Description | -+============+=======================+==================================+========================================+ -|``pstd_mks``| 101325.0 | Pa / Nm :math:`^{-2}` | Mean (reference) surface pressure (SI) | -+------------+-----------------------+----------------------------------+----------------------------------------+ -|``pstd`` | 1.013250E+06 | Ba / dyncm :math:`^{-2}` | Mean (reference) surface pressure (cgs)| -+------------+-----------------------+----------------------------------+----------------------------------------+ -|``rdgas`` | 287.04 | Jkg :math:`^{-1}`K :math:`^{-1}` | Dry air gas constant | -+------------+-----------------------+----------------------------------+----------------------------------------+ -|``kappa`` | 2/7 | dimensionless | Heat capacity ratio | -+------------+-----------------------+----------------------------------+----------------------------------------+ -|``cp_air`` | ``rvgas`` / ``kappa`` | Jkg :math:`^{-1}`K :math:`^{-1}` | Dry air heat capcity | -+------------+-----------------------+----------------------------------+----------------------------------------+ - - - -Moist Atmosphere -"""""""""""""""" - -With the addition of moist physics, a number of additional namelist parameters can be used to change the primary condensate present in the atmosphere. This allows atmospheres in temperature regimes significantly different from Earth to be modelled, including Titan, which has an active methane cycle. - -+--------------+-------------------+----------------------------------+-------------------------------------------+ -| Name | Default | Units | Description | -+==============+===================+==================================+===========================================+ -|``rvgas`` | 461.50 | Jkg :math:`^{-1}`K :math:`^{-1}` | Vapour gas constant | -+--------------+-------------------+----------------------------------+-------------------------------------------+ -|``cp_vapor`` | 4 * ``rvgas`` | Jkg :math:`^{-1}`K :math:`^{-1}` | Vapour heat capacity | -+--------------+-------------------+----------------------------------+-------------------------------------------+ -|``dens_vapor``| 1000 | kgm :math:`^{-3}` | Density of condensate in the liquid phase | -+--------------+-------------------+----------------------------------+-------------------------------------------+ -|``hlv`` | 2.500e6 | Jkg :math:`^{-1}` | Latent heat of vapourisation of condensate| -+--------------+-------------------+----------------------------------+-------------------------------------------+ -|``hlf`` | 3.34e5 | Jkg :math:`^{-1}` | Latent heat of fusion of condensate | -+--------------+-------------------+----------------------------------+-------------------------------------------+ -|``hls`` | ``hlv`` + ``hlf`` | Jkg :math:`^{-1}` | Latent heat of sublimation of condensate | -+--------------+-------------------+----------------------------------+-------------------------------------------+ -|``tfreeze`` | 273.16 | K | Freezing point of condensate | -+--------------+-------------------+----------------------------------+-------------------------------------------+ -|``tppress`` | 610.78 | Pa / Nm :math:`^{-2}` | Triple point pressure of condensate | -+--------------+-------------------+----------------------------------+-------------------------------------------+ - - - - -Relevant modules and subroutines --------------------------------- - -TO BE EDITED!!!!! - - -Key physics modules managed from this module include: - -* ``vert_turb_driver_mod`` -* ``vert_diff_mod`` -* ``two_stream_gray_rad_mod`` -* RRTM: see ``Isca/src/atmos_param/rrtm_radiation/`` -* SOCRATES: see ``Isca/src/atmos_param/socrates/`` -* ``mixed_layer_mod`` -* ``lscale_cond_mod`` -* ``qe_moist_convection_mod`` -* ``ras_mod`` -* ``betts_miller_mod`` -* ``dry_convection_mod`` -* ``surface_flux_mod`` -* ``damping_driver_mod`` -* ``rayleigh_bottom_drag_mod`` - - -Authors -------- -This documentation was written by Daniel Williams, peer reviewed by YY, and quality controlled by ZZ. - From 26a3f4f0b71ea4d5ba0e329a04fddcd1ca8d0af6 Mon Sep 17 00:00:00 2001 From: Daniel Williams Date: Mon, 15 Mar 2021 16:55:33 +0000 Subject: [PATCH 09/10] Renaming dens_vapor to dens_liquid to avoid possible confusion over terminology. --- src/atmos_spectral/driver/solo/idealized_moist_phys.F90 | 8 ++++---- src/coupler/surface_flux.F90 | 8 ++++---- src/shared/constants/constants.F90 | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/atmos_spectral/driver/solo/idealized_moist_phys.F90 b/src/atmos_spectral/driver/solo/idealized_moist_phys.F90 index 9e4a10345..1877fcbb1 100644 --- a/src/atmos_spectral/driver/solo/idealized_moist_phys.F90 +++ b/src/atmos_spectral/driver/solo/idealized_moist_phys.F90 @@ -8,7 +8,7 @@ module idealized_moist_phys_mod use fms_mod, only: write_version_number, file_exist, close_file, stdlog, error_mesg, NOTE, FATAL, read_data, field_size, uppercase, mpp_pe -use constants_mod, only: grav, rdgas, rvgas, cp_air, PSTD_MKS, dens_vapor !mj cp_air needed for rrtmg !s pstd_mks needed for pref calculation +use constants_mod, only: grav, rdgas, rvgas, cp_air, PSTD_MKS, dens_liquid !mj cp_air needed for rrtmg !s pstd_mks needed for pref calculation use time_manager_mod, only: time_type, get_time, operator( + ) @@ -829,7 +829,7 @@ subroutine idealized_moist_phys(Time, p_half, p_full, z_half, z_full, ug, vg, tg conv_dt_tg = conv_dt_tg/delta_t conv_dt_qg = conv_dt_qg/delta_t - depth_change_conv = rain/dens_vapor ! RG Add bucket + depth_change_conv = rain/dens_liquid ! RG Add bucket rain = rain/delta_t precip = rain @@ -858,7 +858,7 @@ subroutine idealized_moist_phys(Time, p_half, p_full, z_half, z_full, ug, vg, tg conv_dt_tg = conv_dt_tg/delta_t conv_dt_qg = conv_dt_qg/delta_t - depth_change_conv = rain/dens_vapor ! RG Add bucket + depth_change_conv = rain/dens_liquid ! RG Add bucket rain = rain/delta_t precip = rain @@ -937,7 +937,7 @@ subroutine idealized_moist_phys(Time, p_half, p_full, z_half, z_full, ug, vg, tg cond_dt_tg = cond_dt_tg/delta_t cond_dt_qg = cond_dt_qg/delta_t - depth_change_cond = rain/dens_vapor ! RG Add bucket + depth_change_cond = rain/dens_liquid ! RG Add bucket rain = rain/delta_t snow = snow/delta_t precip = precip + rain + snow diff --git a/src/coupler/surface_flux.F90 b/src/coupler/surface_flux.F90 index 759c57e35..d802351e7 100644 --- a/src/coupler/surface_flux.F90 +++ b/src/coupler/surface_flux.F90 @@ -39,7 +39,7 @@ module surface_flux_mod use fms_mod, only: file_exist, check_nml_error, open_namelist_file, stdlog use monin_obukhov_mod, only: mo_drag, mo_profile use sat_vapor_pres_mod, only: escomp, descomp -use constants_mod, only: cp_air, hlv, stefan, rdgas, rvgas, grav, vonkarm, dens_vapor +use constants_mod, only: cp_air, hlv, stefan, rdgas, rvgas, grav, vonkarm, dens_liquid use mpp_mod, only: input_nml_file implicit none @@ -601,10 +601,10 @@ subroutine surface_flux_1d ( & flux_q = rho_drag * (q_surf0 - q_atm) ! flux of water vapor (Kg/(m**2 s)) end where - depth_change_lh_1d = flux_q * dt/dens_vapor + depth_change_lh_1d = flux_q * dt/dens_liquid where (flux_q > 0.0 .and. bucket_depth < depth_change_lh_1d) ! where more evaporation than what's in bucket, empty bucket - flux_q = bucket_depth * dens_vapor / dt - depth_change_lh_1d = flux_q * dt / dens_vapor + flux_q = bucket_depth * dens_liquid / dt + depth_change_lh_1d = flux_q * dt / dens_liquid end where where (bucket_depth <= 0.0) diff --git a/src/shared/constants/constants.F90 b/src/shared/constants/constants.F90 index 8c7c83e9e..1d2601150 100644 --- a/src/shared/constants/constants.F90 +++ b/src/shared/constants/constants.F90 @@ -270,7 +270,7 @@ module constants_mod real, public :: RDGAS = EARTH_RDGAS real, public :: RVGAS = RVGAS_H20 real, public :: CP_VAPOR = 4.0*RVGAS_H20 -real, public :: DENS_VAPOR = DENS_H2O +real, public :: DENS_LIQUID = DENS_H2O real, public :: KAPPA = EARTH_KAPPA real, public :: CP_AIR = EARTH_CP_AIR real, public :: HLV = HLV_H20 @@ -281,7 +281,7 @@ module constants_mod real, public :: es0 = DEF_ES0 logical :: earthday_multiple = .false. -namelist/constants_nml/ radius, grav, omega, orbital_period, orbital_rate, rotation_period, pstd, pstd_mks, rdgas, rvgas, kappa, hlv, hlf, tfreeze, tppress, dens_vapor, solar_const, earthday_multiple, es0 +namelist/constants_nml/ radius, grav, omega, orbital_period, orbital_rate, rotation_period, pstd, pstd_mks, rdgas, rvgas, kappa, hlv, hlf, tfreeze, tppress, dens_liquid, solar_const, earthday_multiple, es0 !----------------------------------------------------------------------- ! version and tagname published From 4e0c05fde5360e658758c62aaf61e57444a6459a Mon Sep 17 00:00:00 2001 From: Daniel Williams Date: Mon, 29 Mar 2021 09:34:14 +0100 Subject: [PATCH 10/10] Correction of variable name --- src/shared/constants/constants.F90 | 44 +++++++++---------- src/shared/sat_vapor_pres/sat_vapor_pres.F90 | 4 +- .../sat_vapor_pres/sat_vapor_pres_k.F90 | 6 +-- 3 files changed, 27 insertions(+), 27 deletions(-) diff --git a/src/shared/constants/constants.F90 b/src/shared/constants/constants.F90 index 1d2601150..34e8379c4 100644 --- a/src/shared/constants/constants.F90 +++ b/src/shared/constants/constants.F90 @@ -94,41 +94,41 @@ module constants_mod ! Humidity factor. Controls the humidity content of the atmosphere through ! the Saturation Vapour Pressure expression when using DO_SIMPLE. ! -! +! ! gas constant for water vapor ! -! +! ! specific heat capacity of water vapor at constant pressure ! ! ! density of liquid water ! -! +! ! latent heat of evaporation for water ! -! +! ! latent heat of fusion for water ! -! +! ! latent heat of sublimation for water ! -! +! ! temp where fresh water freezes ! -! +! ! Pressure of Triple Point: prefactor in version of ! Clausius-Clapeyron when using DO_SIMPLE. ! real, public, parameter :: DEF_ES0 = 1.0 -real, public, parameter :: RVGAS_H20 = 461.50 -real, public, parameter :: CP_VAPOR_H20 = 4.0*RVGAS_H20 +real, public, parameter :: RVGAS_H2O = 461.50 +real, public, parameter :: CP_VAPOR_H2O = 4.0*RVGAS_H2O real, public, parameter :: DENS_H2O = 1000. -real, public, parameter :: HLV_H20 = 2.500e6 -real, public, parameter :: HLF_H20 = 3.34e5 -real, public, parameter :: HLS_H20 = HLV_H20 + HLF_H20 -real, public, parameter :: TFREEZE_H20 = 273.16 -real, public, parameter :: TPPRESS_H20 = 610.78 +real, public, parameter :: HLV_H2O = 2.500e6 +real, public, parameter :: HLF_H2O = 3.34e5 +real, public, parameter :: HLS_H2O = HLV_H2O + HLF_H2O +real, public, parameter :: TFREEZE_H2O = 273.16 +real, public, parameter :: TPPRESS_H2O = 610.78 !-------------- radiation constants ----------------- @@ -169,7 +169,7 @@ module constants_mod ! real, public, parameter :: WTMAIR = 2.896440E+01 -real, public, parameter :: WTMH2O = WTMAIR*(EARTH_RDGAS/RVGAS_H20) !pjp OK to change value because not used yet. +real, public, parameter :: WTMH2O = WTMAIR*(EARTH_RDGAS/RVGAS_H2O) !pjp OK to change value because not used yet. !real, public, parameter :: WTMO3 = 47.99820E+01 real, public, parameter :: WTMOZONE = 47.99820 real, public, parameter :: WTMC = 12.00000 @@ -268,16 +268,16 @@ module constants_mod real, public :: PSTD = 1.013250E+06 real, public :: PSTD_MKS = PSTD_MKS_EARTH real, public :: RDGAS = EARTH_RDGAS -real, public :: RVGAS = RVGAS_H20 -real, public :: CP_VAPOR = 4.0*RVGAS_H20 +real, public :: RVGAS = RVGAS_H2O +real, public :: CP_VAPOR = 4.0*RVGAS_H2O real, public :: DENS_LIQUID = DENS_H2O real, public :: KAPPA = EARTH_KAPPA real, public :: CP_AIR = EARTH_CP_AIR -real, public :: HLV = HLV_H20 -real, public :: HLF = HLF_H20 -real, public :: HLS = HLS_H20 -real, public :: TFREEZE = TFREEZE_H20 -real, public :: TPPRESS = TPPRESS_H20 +real, public :: HLV = HLV_H2O +real, public :: HLF = HLF_H2O +real, public :: HLS = HLS_H2O +real, public :: TFREEZE = TFREEZE_H2O +real, public :: TPPRESS = TPPRESS_H2O real, public :: es0 = DEF_ES0 logical :: earthday_multiple = .false. diff --git a/src/shared/sat_vapor_pres/sat_vapor_pres.F90 b/src/shared/sat_vapor_pres/sat_vapor_pres.F90 index 2d8b40460..127035814 100644 --- a/src/shared/sat_vapor_pres/sat_vapor_pres.F90 +++ b/src/shared/sat_vapor_pres/sat_vapor_pres.F90 @@ -132,7 +132,7 @@ module sat_vapor_pres_mod ! Description summarizing public interface. ! - use constants_mod, only: TFREEZE, TFREEZE_H20, RDGAS, RVGAS, HLV, ES0, TPPRESS + use constants_mod, only: TFREEZE, TFREEZE_H2O, RDGAS, RVGAS, HLV, ES0, TPPRESS use fms_mod, only: write_version_number, stdout, stdlog, mpp_pe, mpp_root_pe, & mpp_error, FATAL, fms_error_handler, open_namelist_file, & error_mesg, & @@ -2309,7 +2309,7 @@ subroutine sat_vapor_pres_init(err_msg) endif nsize = (tcmax-tcmin)*esres+1 nlim = nsize-1 - call sat_vapor_pres_init_k(nsize, real(tcmin), real(tcmax), TFREEZE, TFREEZE_H20, HLV, & + call sat_vapor_pres_init_k(nsize, real(tcmin), real(tcmax), TFREEZE, TFREEZE_H2O, HLV, & RVGAS, ES0, TPPRESS, err_msg_local, use_exact_qs, do_simple, & construct_table_wrt_liq, & construct_table_wrt_liq_and_ice, & diff --git a/src/shared/sat_vapor_pres/sat_vapor_pres_k.F90 b/src/shared/sat_vapor_pres/sat_vapor_pres_k.F90 index e7380a9fb..f17997034 100644 --- a/src/shared/sat_vapor_pres/sat_vapor_pres_k.F90 +++ b/src/shared/sat_vapor_pres/sat_vapor_pres_k.F90 @@ -158,7 +158,7 @@ module sat_vapor_pres_k_mod contains - subroutine sat_vapor_pres_init_k(table_size, tcmin, tcmax, TFREEZE, TFREEZE_H20, HLV, RVGAS, ES0, TPPRESS, err_msg, & + subroutine sat_vapor_pres_init_k(table_size, tcmin, tcmax, TFREEZE, TFREEZE_H2O, HLV, RVGAS, ES0, TPPRESS, err_msg, & use_exact_qs_input, do_simple, & construct_table_wrt_liq, & construct_table_wrt_liq_and_ice, & @@ -169,7 +169,7 @@ subroutine sat_vapor_pres_init_k(table_size, tcmin, tcmax, TFREEZE, TFREEZE_H20, integer, intent(in) :: table_size real, intent(in) :: tcmin ! TABLE(1) = sat vapor pressure at temperature tcmin (deg C) real, intent(in) :: tcmax ! TABLE(table_size) = sat vapor pressure at temperature tcmax (deg C) - real, intent(in) :: TFREEZE, TFREEZE_H20, HLV, RVGAS, ES0, TPPRESS + real, intent(in) :: TFREEZE, TFREEZE_H2O, HLV, RVGAS, ES0, TPPRESS logical, intent(in) :: use_exact_qs_input, do_simple logical, intent(in) :: construct_table_wrt_liq logical, intent(in) :: construct_table_wrt_liq_and_ice @@ -212,7 +212,7 @@ subroutine sat_vapor_pres_init_k(table_size, tcmin, tcmax, TFREEZE, TFREEZE_H20, table_siz = table_size dtres = (tcmax - tcmin)/(table_size-1) - tminl = real(tcmin)+TFREEZE_H20 ! minimum valid temp in table. Always use TFREEZE_WATER here, as this is just converting tcmin from celcius to kelvin. + tminl = real(tcmin)+TFREEZE_H2O ! minimum valid temp in table. Always use TFREEZE_WATER here, as this is just converting tcmin from celcius to kelvin. dtinvl = 1./dtres tepsl = .5*dtres tinrc = .1*dtres