From 8e26de14a007373188ee36b53370bd9a97264327 Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Wed, 5 Sep 2018 16:18:11 +0100
Subject: [PATCH 001/304] Add file to paths and namelist variables in test
scripts
---
.gitignore | 1 +
exp/test_cases/MiMA/MiMA_test_case.py | 12 +++++++++++-
.../socrates_test/socrates_aquaplanet.py | 15 +++++++++++++--
src/extra/model/isca/path_names | 1 +
src/extra/model/socrates/path_names | 1 +
5 files changed, 27 insertions(+), 3 deletions(-)
diff --git a/.gitignore b/.gitignore
index 3ab2fcb09..48d028c01 100644
--- a/.gitignore
+++ b/.gitignore
@@ -26,3 +26,4 @@ src/extra/python/scripts/*.nc
src/extra/python/scripts/archived/
mima_pz.txt
*.sh.*
+src/atmos_param/socrates/src/trunk/*
diff --git a/exp/test_cases/MiMA/MiMA_test_case.py b/exp/test_cases/MiMA/MiMA_test_case.py
index 270596744..f21ba6404 100644
--- a/exp/test_cases/MiMA/MiMA_test_case.py
+++ b/exp/test_cases/MiMA/MiMA_test_case.py
@@ -73,7 +73,17 @@
'do_simple': True,
'roughness_mom':3.21e-05,
'roughness_heat':3.21e-05,
- 'roughness_moist':3.21e-05,
+ 'roughness_moist':3.21e-05,
+ 'do_cloud_simple': True,
+ },
+ 'cloud_simple_nml': {
+ 'simple_cca':0.0,
+ 'rhcsfc': 0.95,
+ 'rhc700': 0.7,
+ 'rhc200': 0.3,
+ 'rhmsfc': 0.95,
+ 'rhm700': 0.7,
+ 'rhm200': 0.3,
},
'vert_turb_driver_nml': {
diff --git a/exp/test_cases/socrates_test/socrates_aquaplanet.py b/exp/test_cases/socrates_test/socrates_aquaplanet.py
index a288c0272..7b926d6b7 100644
--- a/exp/test_cases/socrates_test/socrates_aquaplanet.py
+++ b/exp/test_cases/socrates_test/socrates_aquaplanet.py
@@ -91,6 +91,17 @@
'two_stream_gray': False, #Use the grey radiation scheme
'do_socrates_radiation': True,
'convection_scheme': 'SIMPLE_BETTS_MILLER', #Use simple Betts miller convection
+ 'do_cloud_simple': True,
+ },
+
+ 'cloud_simple_nml': {
+ 'simple_cca':0.0,
+ 'rhcsfc': 0.95,
+ 'rhc700': 0.7,
+ 'rhc200': 0.3,
+ 'rhmsfc': 0.95,
+ 'rhm700': 0.7,
+ 'rhm200': 0.3,
},
'vert_turb_driver_nml': {
@@ -193,5 +204,5 @@
exp.namelist = namelist.copy()
exp.run(1, use_restart=False, num_cores=NCORES)
- for i in range(2,121):
- exp.run(i, num_cores=NCORES)
+# for i in range(2,121):
+# exp.run(i, num_cores=NCORES)
diff --git a/src/extra/model/isca/path_names b/src/extra/model/isca/path_names
index ee73b2499..eebdfd2b0 100644
--- a/src/extra/model/isca/path_names
+++ b/src/extra/model/isca/path_names
@@ -11,6 +11,7 @@ atmos_param/sea_esf_rad/null/rad_utilities.F90
atmos_param/shallow_conv/shallow_conv.F90
atmos_param/stable_bl_turb/stable_bl_turb.F90
atmos_param/strat_cloud/null/strat_cloud.F90
+atmos_param/cloud_simple/cloud_simple.F90
atmos_param/two_stream_gray_rad/two_stream_gray_rad.F90
atmos_param/qflux/qflux.f90
atmos_param/monin_obukhov/monin_obukhov_interfaces.h
diff --git a/src/extra/model/socrates/path_names b/src/extra/model/socrates/path_names
index 6cb698ede..2f4dac9eb 100644
--- a/src/extra/model/socrates/path_names
+++ b/src/extra/model/socrates/path_names
@@ -11,6 +11,7 @@ atmos_param/sea_esf_rad/null/rad_utilities.F90
atmos_param/shallow_conv/shallow_conv.F90
atmos_param/stable_bl_turb/stable_bl_turb.F90
atmos_param/strat_cloud/null/strat_cloud.F90
+atmos_param/cloud_simple/cloud_simple.F90
atmos_param/two_stream_gray_rad/two_stream_gray_rad.F90
atmos_param/qflux/qflux.f90
atmos_param/monin_obukhov/monin_obukhov_interfaces.h
From 0d134dd44cb5c243fb54769cafef0a31dc619e30 Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Wed, 5 Sep 2018 16:18:53 +0100
Subject: [PATCH 002/304] Additions to RRTM and ideal mosist phys to use the
simple cloud scheme
---
.../rrtm_radiation/rrtm_radiation.f90 | 51 ++++++++++++++-----
.../driver/solo/idealized_moist_phys.F90 | 27 +++++++++-
2 files changed, 63 insertions(+), 15 deletions(-)
diff --git a/src/atmos_param/rrtm_radiation/rrtm_radiation.f90 b/src/atmos_param/rrtm_radiation/rrtm_radiation.f90
index 59afc67cf..f342a04b6 100644
--- a/src/atmos_param/rrtm_radiation/rrtm_radiation.f90
+++ b/src/atmos_param/rrtm_radiation/rrtm_radiation.f90
@@ -522,7 +522,10 @@ subroutine interp_temp(z_full,z_half,t, Time)
end subroutine interp_temp
!*****************************************************************************************
!*****************************************************************************************
- subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half,albedo,q,t,t_surf_rad,tdt,coszen,flux_sw,flux_lw)
+ subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half, &
+ albedo,q,t,t_surf_rad,tdt, &
+ coszen,flux_sw,flux_lw,cfa_rad,reff_rad, &
+ do_cloud_simple)
!
! Driver for RRTMG radiation scheme.
! Prepares all inputs, calls SW and LW radiation schemes,
@@ -568,6 +571,11 @@ subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half,albedo,q,t,t_surf_rad,tdt,
real(kind=rb),dimension(:,:),intent(out),optional :: flux_sw,flux_lw ! surface fluxes [W/m2]
! dimension (lat x lon)
! need to have both or none!
+ real(kind=rb), dimension(:,:,:), intent(in) :: cfa_rad,reff_rad !cloud properties
+
+ logical, intent(in) :: do_cloud_simple
+
+
!---------------------------------------------------------------------------------------------------------------
! Local variables
integer k,j,i,ij,j1,i1,ij1,kend,dyofyr,seconds,days
@@ -575,7 +583,7 @@ subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half,albedo,q,t,t_surf_rad,tdt,
real(kind=rb),dimension(size(q,1),size(q,2),size(q,3)) :: o3f
real(kind=rb),dimension(size(q,1),size(q,2),size(q,3)) :: co2f,co2f_temp
real(kind=rb),dimension(ncols_rrt,nlay_rrt) :: pfull,tfull,fracday&
- , hr,hrc, swhr, swhrc
+ , hr,hrc, swhr, swhrc, cldfr, reliq, reice
real(kind=rb),dimension(size(tdt,1),size(tdt,2),size(tdt,3)) :: tdt_rrtm
real(kind=rb),dimension(ncols_rrt,nlay_rrt+1) :: uflx, dflx, uflxc, dflxc&
,swuflx, swdflx, swuflxc, swdflxc
@@ -589,11 +597,10 @@ subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half,albedo,q,t,t_surf_rad,tdt,
real(kind=rb),dimension(size(q,1),size(q,2),size(q,3)) :: q_tmp, h2o_vmr
real(kind=rb),dimension(size(q,1),size(q,2)) :: fracsun
- integer :: year_in_s
+ integer :: year_in_s
real :: r_seconds, r_days, r_total_seconds, frac_of_day, frac_of_year, gmt, time_since_ae, rrsun, dt_rad_radians, day_in_s, r_solday, r_dt_rad_avg
-
! debug
integer :: indx2(2),indx(3),ii,ji,ki
logical :: used
@@ -805,6 +812,20 @@ subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half,albedo,q,t,t_surf_rad,tdt,
! anything lower than 0.01 (about 15min) is set to zero
! where(cosz_rr < 1.e-2)cosz_rr=0.
+ if (do_cloud_simple) then
+ inflglw = 2 !RRTM responsible for calculating optical properties of clouds
+ liqflglw = 1 !Sets liquid water radii to be used rather than being inactive (zero is inactive)
+ cldfr = reshape( cfa_rad (1:si:lonstep,:,sk :1:-1),(/ si*sj/lonstep,sk /))
+ reliq = reshape(reff_rad (1:si:lonstep,:,sk :1:-1),(/ si*sj/lonstep,sk /))
+ reice = zeros !Ice particle radii not used as iceflglw=0 meaning it is inactive. Setting to fill value of zeros
+ else
+ cldfr = zeros
+ reliq = 10*ones
+ reice = 10*ones
+ endif
+
+
+
if(include_secondary_gases)then
call rrtmg_sw &
(ncols_rrt, nlay_rrt , icld , iaer , &
@@ -812,13 +833,14 @@ subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half,albedo,q,t,t_surf_rad,tdt,
h2o , o3 , co2 , ch4_val*ones , n2o_val*ones , o2_val*ones , &
albedo_rr , albedo_rr, albedo_rr, albedo_rr, &
cosz_rr , solrad , dyofyr , solr_cnst, &
- inflglw , iceflglw , liqflglw , &
+ inflglw , iceflglw , liqflglw , &
! cloud parameters
- zeros , taucld , sw_zro , sw_zro , sw_zro , &
- zeros , zeros , 10*ones , 10*ones , &
- tauaer , zro_sw , zro_sw , zro_sw , &
+ cldfr, &
+ taucld , sw_zro , sw_zro , sw_zro , &
+ zeros , zeros , reice , reliq , &
+ tauaer , zro_sw , zro_sw , zro_sw , &
! output
- swuflx , swdflx , swhr , swuflxc , swdflxc, swhrc)
+ swuflx , swdflx , swhr , swuflxc , swdflxc, swhrc)
else
call rrtmg_sw &
(ncols_rrt, nlay_rrt , icld , iaer , &
@@ -826,10 +848,11 @@ subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half,albedo,q,t,t_surf_rad,tdt,
h2o , o3 , co2 , zeros , zeros, zeros, &
albedo_rr , albedo_rr, albedo_rr, albedo_rr, &
cosz_rr , solrad , dyofyr , solr_cnst, &
- inflglw , iceflglw , liqflglw , &
+ inflglw , iceflglw , liqflglw , &
! cloud parameters
- zeros , taucld , sw_zro , sw_zro , sw_zro , &
- zeros , zeros , 10*ones , 10*ones , &
+ cldfr, &
+ taucld , sw_zro , sw_zro , sw_zro , &
+ zeros , zeros , reice , reliq , &
tauaer , zro_sw , zro_sw , zro_sw , &
! output
swuflx , swdflx , swhr , swuflxc , swdflxc, swhrc)
@@ -861,7 +884,7 @@ subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half,albedo,q,t,t_surf_rad,tdt,
! emissivity and cloud composition
emis , inflglw , iceflglw , liqflglw , &
! cloud parameters
- zeros , taucld , zeros , zeros , 10*ones, 10*ones, &
+ cldfr , taucld , zeros , zeros , reice, reliq, &
tauaer , &
! output
uflx , dflx , hr , uflxc , dflxc , hrc)
@@ -874,7 +897,7 @@ subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half,albedo,q,t,t_surf_rad,tdt,
! emissivity and cloud composition
emis , inflglw , iceflglw, liqflglw, &
! cloud parameters
- zeros , taucld , zeros , zeros, 10*ones, 10*ones, &
+ cldfr , taucld , zeros , zeros, reice, reliq, &
tauaer , &
! output
uflx , dflx , hr , uflxc, dflxc , hrc)
diff --git a/src/atmos_spectral/driver/solo/idealized_moist_phys.F90 b/src/atmos_spectral/driver/solo/idealized_moist_phys.F90
index 4cc45f26a..c20746b43 100644
--- a/src/atmos_spectral/driver/solo/idealized_moist_phys.F90
+++ b/src/atmos_spectral/driver/solo/idealized_moist_phys.F90
@@ -18,6 +18,8 @@ module idealized_moist_phys_mod
use two_stream_gray_rad_mod, only: two_stream_gray_rad_init, two_stream_gray_rad_down, two_stream_gray_rad_up, two_stream_gray_rad_end
+use cloud_simple_mod, only: cloud_simple_init, cloud_simple_end, cloud_simple
+
use mixed_layer_mod, only: mixed_layer_init, mixed_layer, mixed_layer_end, albedo_calc
use lscale_cond_mod, only: lscale_cond_init, lscale_cond, lscale_cond_end
@@ -107,6 +109,9 @@ module idealized_moist_phys_mod
logical :: do_bm = .false.
logical :: do_ras = .false.
+! Cloud options
+logical :: do_cloud_simple = .false.
+
!s Radiation options
logical :: two_stream_gray = .true.
logical :: do_rrtm_radiation = .false.
@@ -142,6 +147,7 @@ module idealized_moist_phys_mod
! end RG Add bucket
namelist / idealized_moist_phys_nml / turb, lwet_convection, do_bm, do_ras, roughness_heat, &
+ do_cloud_simple, &
two_stream_gray, do_rrtm_radiation, do_damping,&
mixed_layer_bc, do_simple, &
roughness_moist, roughness_mom, do_virtual, &
@@ -745,6 +751,8 @@ subroutine idealized_moist_phys(Time, p_half, p_full, z_half, z_full, ug, vg, tg
real :: delta_t
real, dimension(size(ug,1), size(ug,2), size(ug,3)) :: tg_tmp, qg_tmp, RH,tg_interp, mc, dt_ug_conv, dt_vg_conv
+! Simple cloud scheme variabilies to pass to radiation
+real, dimension(size(ug,1), size(ug,2), size(ug,3)) :: cfa_rad, reff_rad
real, intent(in) , dimension(:,:,:), optional :: mask
integer, intent(in) , dimension(:,:), optional :: kbot
@@ -908,6 +916,20 @@ subroutine idealized_moist_phys(Time, p_half, p_full, z_half, z_full, ug, vg, tg
endif
+! Call the simple cloud scheme in line with SPOOKIE-2 requirements
+! Using start of time step variables
+! using soecific humidity NOT mixing ratios
+if(do_cloud_simple) then
+ call cloud_simple(p_half(:,:,:,current), p_full(:,:,:,current), &
+ Time, &
+ tg(:,:,:,previous), &
+ grid_tracers(:,:,:,previous,nsphum), &
+ ! outs -
+ cfa_rad(:,:,:), reff_rad(:,:,:) &
+ )
+
+endif
+
! Begin the radiation calculation by computing downward fluxes.
! This part of the calculation does not depend on the surface temperature.
@@ -1005,7 +1027,10 @@ subroutine idealized_moist_phys(Time, p_half, p_full, z_half, z_full, ug, vg, tg
!need t at half grid
tg_interp=tg(:,:,:,previous)
call interp_temp(z_full(:,:,:,current),z_half(:,:,:,current),tg_interp, Time)
- call run_rrtmg(is,js,Time,rad_lat(:,:),rad_lon(:,:),p_full(:,:,:,current),p_half(:,:,:,current),albedo,grid_tracers(:,:,:,previous,nsphum),tg_interp,t_surf(:,:),dt_tg(:,:,:),coszen,net_surf_sw_down(:,:),surf_lw_down(:,:))
+ call run_rrtmg(is,js,Time,rad_lat(:,:),rad_lon(:,:),p_full(:,:,:,current),p_half(:,:,:,current), &
+ albedo,grid_tracers(:,:,:,previous,nsphum),tg_interp,t_surf(:,:),dt_tg(:,:,:), &
+ coszen,net_surf_sw_down(:,:),surf_lw_down(:,:), cfa_rad(:,:,:), reff_rad(:,:,:), &
+ do_cloud_simple )
endif
#endif
From e141924f791e6162773bbacd8d00f1ac0ebd1d8c Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Wed, 5 Sep 2018 16:19:54 +0100
Subject: [PATCH 003/304] Fist drafted simple cloud scheme - need to check
hooks to rrtm and work out approach for socrities
---
src/atmos_param/cloud_simple/cloud_simple.F90 | 203 ++++++++++++++++++
1 file changed, 203 insertions(+)
create mode 100644 src/atmos_param/cloud_simple/cloud_simple.F90
diff --git a/src/atmos_param/cloud_simple/cloud_simple.F90 b/src/atmos_param/cloud_simple/cloud_simple.F90
new file mode 100644
index 000000000..c9c09de75
--- /dev/null
+++ b/src/atmos_param/cloud_simple/cloud_simple.F90
@@ -0,0 +1,203 @@
+module cloud_simple_mod
+
+#ifdef INTERNAL_FILE_NML
+ use mpp_mod, only: input_nml_file
+#else
+ use fms_mod, only: open_namelist_file, close_file
+#endif
+
+ use fms_mod, only: stdlog, FATAL, WARNING, error_mesg
+ use time_manager_mod, only: time_type
+
+ implicit none
+
+ logical :: do_init = .true. ! Do I still need to do init?
+
+ real :: simple_cca = 0.0
+ real :: rhcsfc = 0.95
+ real :: rhc700 = 0.7
+ real :: rhc200 = 0.3
+ real :: rhmsfc = 0.95
+ real :: rhm700 = 0.7
+ real :: rhm200 = 0.3
+
+ namelist /cloud_simple_nml/ simple_cca, rhcsfc, rhc700, rhc200, &
+ rhmsfc, rhm700, rhm200
+ real :: zerodegc = 273.15
+
+
+ contains
+
+ !-----------------------------------------------
+
+
+ subroutine cloud_simple_init ()
+
+ integer :: io ,stdlog_unit
+
+#ifdef INTERNAL_FILE_NML
+ read (input_nml_file, nml=cloud_simple_nml, iostat=io)
+#else
+ if ( file_exist('input.nml') ) then
+ nml_unit = open_namelist_file()
+ read (nml_unit, cloud_simple_nml, iostat=io)
+ call close_file(nml_unit)
+ endif
+#endif
+ stdlog_unit = stdlog()
+ write(stdlog_unit, cloud_simple_nml)
+
+ do_init = .false. !initialisation completed
+
+ end subroutine cloud_simple_init
+
+ !-----------------------------------------------
+
+ subroutine cloud_simple (p_half, p_full, Time, &
+ temp, q_hum, &
+ ! outs
+ cfa_rad, reff_rad )
+
+ real , intent(in), dimension(:,:,:) :: temp, q_hum, p_full, p_half
+ type(time_type) , intent(in) :: Time
+
+ real , intent(out), dimension(:,:,:) :: cfa_rad, reff_rad
+
+ real, dimension(size(temp,1), size(temp, 2), size(temp, 3)) :: qs, qcl_rad
+ real :: frac_liq, cf_rad, simple_rhcrit
+
+ integer :: i, j, k, k_surf
+
+ logical :: es_over_liq_and_ice=.true.
+
+ !check initiation has been done - ie read in parameters
+ if (do_init) call error_mesg ('cloud_simple', &
+ 'cloud_simple_init has not been called.', FATAL)
+
+ ! Get the saturated specific humidity TOTAL (ie ice and vap) ***double check maths!
+ call compute_qs(temp, p_full, qs, es_over_liq_and_ice) !qs=qsat in um
+
+ k_surf = size(temp, 3)
+
+ do i=1, size(temp, 1)
+ do j=1, size(temp, 2)
+ do k=1, size(temp, 3)
+
+ !caluclate the frac_liq
+ call calc_liq_frac(temp(i,j,k), frac_liq)
+ call calc_reff(frac_liq, reff_rad(i,j,k))
+ call calc_rhcrit(p_full(i,j,k), p_full(i,j,k_surf), simple_rhcrit)
+ call calc_cf_rad(q_hum(i,j,k), qs(i,j,k), simple_rhcrit, cf_rad)
+ call calc_qcl_rad(p_full(i,j,k), cf_rad, qcl_rad(i,j,k) )
+ end do
+ end do
+ end do
+
+ !WHAT ARE THE UNITS
+ !add diagnostics
+
+ end subroutine cloud_simple
+
+ subroutine calc_liq_frac(temp, frac_liq)
+ ! All liquid if above zero and all ice below -40C
+ ! linearly interpolate between T=0 and -40C
+
+ real, intent(in) :: temp
+ real, intent(out) :: frac_liq
+
+
+ if (temp > zerodegc) then
+ frac_liq = 1.0
+ else if (temp < zerodegc-40.0) then
+ frac_liq = 0.0
+ else
+ frac_liq = 1.0 - (zerodegc-temp) / 40.0
+ end if
+
+
+ end subroutine calc_liq_frac
+
+ subroutine calc_reff(frac_liq, reff_rad)
+
+ real, intent(in) :: frac_liq
+ real, intent(out) :: reff_rad
+
+ reff_rad = 1.0e-6 * ( 10.0 * frac_liq + 20.0 * (1.0 - frac_liq) )
+
+ end subroutine calc_reff
+
+ subroutine calc_rhcrit(p_full, p_surf, simple_rhcrit) !need to check p_full - > p_layer_centres
+
+ real, intent(in) :: p_full, p_surf
+ real, intent(out) :: simple_rhcrit
+
+ ! Calculate RHcrit as function of pressure
+ if (p_full > 70000.0 ) then
+
+ simple_rhcrit = rhcsfc - ( rhcsfc - rhc700 ) * &
+ ( p_surf - p_full ) / ( p_surf - 70000.0 )
+
+ else if ( p_full > 20000.0 ) then
+
+ simple_rhcrit = rhc700 - ( rhc700 - rhc200 ) * &
+ ( 70000.0 - p_full) / 50000.0
+
+ else
+ simple_rhcrit = rhc200
+ endif
+
+ end subroutine calc_rhcrit
+
+ subroutine calc_cf_rad (q_hum, qsat, simple_rhcrit, cf_rad)
+ ! Calculate LS (stratiform) cloud fraction
+ ! as a simple linear function of RH
+
+ real, intent(in) :: q_hum, qsat, simple_rhcrit
+ real, intent(out) :: cf_rad
+
+ real :: rh, cca
+
+ rh = q_hum/qsat
+ cf_rad = MAX( 0.0, MIN( 1.0, ( rh - simple_rhcrit ) / ( 1.0 - simple_rhcrit ) ))
+
+ ! include simple convective cloud fraction where present
+
+ cca = 0.0 ! no convective cloud fraction is calculated
+ ! left in for fture use
+
+ if (cca > 0.0) then
+ cf_rad = MAX( simple_cca, cf_rad )
+ end if
+
+ end subroutine calc_cf_rad
+
+ subroutine calc_qcl_rad(p_full, cf_rad, qcl_rad)
+ ! calculate simple water content
+
+ real , intent(in) :: p_full, cf_rad
+ real , intent(out) :: qcl_rad
+
+ real :: in_cloud_qcl
+
+ in_cloud_qcl = 3.0e-4 + &
+ (1.0-3.0e-4)*(p_full-20000.0)/80000.0
+
+ in_cloud_qcl = MAX ( 0.0, in_cloud_qcl/1000.0 ) ! convert to kg/kg
+
+ qcl_rad = cf_rad * in_cloud_qcl
+
+ end subroutine calc_qcl_rad
+
+
+ !-----------------------------------------------
+
+
+ subroutine cloud_simple_end ()
+
+ ! do we deallocate anything?
+
+ end subroutine cloud_simple_end
+
+ !-----------------------------------------------
+
+end module cloud_simple_mod
From 1d1ed9dd41b81b0c5c47cca31e0edeae500e9c8a Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Wed, 5 Sep 2018 17:30:24 +0100
Subject: [PATCH 004/304] Changes so code will now compile
---
src/atmos_param/cloud_simple/cloud_simple.F90 | 9 +++++----
src/atmos_spectral/driver/solo/idealized_moist_phys.F90 | 5 +++++
2 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/src/atmos_param/cloud_simple/cloud_simple.F90 b/src/atmos_param/cloud_simple/cloud_simple.F90
index c9c09de75..a04d92b5b 100644
--- a/src/atmos_param/cloud_simple/cloud_simple.F90
+++ b/src/atmos_param/cloud_simple/cloud_simple.F90
@@ -6,8 +6,9 @@ module cloud_simple_mod
use fms_mod, only: open_namelist_file, close_file
#endif
- use fms_mod, only: stdlog, FATAL, WARNING, error_mesg
- use time_manager_mod, only: time_type
+ use fms_mod, only: stdlog, FATAL, WARNING, error_mesg
+ use time_manager_mod, only: time_type
+ use sat_vapor_pres_mod, only: compute_qs
implicit none
@@ -68,14 +69,14 @@ subroutine cloud_simple (p_half, p_full, Time, &
integer :: i, j, k, k_surf
- logical :: es_over_liq_and_ice=.true.
+ logical :: es_over_liq_and_ice
!check initiation has been done - ie read in parameters
if (do_init) call error_mesg ('cloud_simple', &
'cloud_simple_init has not been called.', FATAL)
! Get the saturated specific humidity TOTAL (ie ice and vap) ***double check maths!
- call compute_qs(temp, p_full, qs, es_over_liq_and_ice) !qs=qsat in um
+ call compute_qs(temp, p_full, qs, es_over_liq_and_ice=.true.) !qs=qsat in um
k_surf = size(temp, 3)
diff --git a/src/atmos_spectral/driver/solo/idealized_moist_phys.F90 b/src/atmos_spectral/driver/solo/idealized_moist_phys.F90
index c20746b43..c8b921050 100644
--- a/src/atmos_spectral/driver/solo/idealized_moist_phys.F90
+++ b/src/atmos_spectral/driver/solo/idealized_moist_phys.F90
@@ -332,6 +332,10 @@ subroutine idealized_moist_phys_init(Time, Time_step_in, nhum, rad_lon_2d, rad_l
d622 = rdgas/rvgas
d378 = 1.-d622
+if(do_cloud_simple) then
+ call cloud_simple_init()
+end if
+
!s need to make sure that gray radiation and rrtm radiation are not both called.
if(two_stream_gray .and. do_rrtm_radiation) &
call error_mesg('physics_driver_init','do_grey_radiation and do_rrtm_radiation cannot both be .true.',FATAL)
@@ -920,6 +924,7 @@ subroutine idealized_moist_phys(Time, p_half, p_full, z_half, z_full, ug, vg, tg
! Using start of time step variables
! using soecific humidity NOT mixing ratios
if(do_cloud_simple) then
+
call cloud_simple(p_half(:,:,:,current), p_full(:,:,:,current), &
Time, &
tg(:,:,:,previous), &
From 1f373a9c2a275671136f856cd04357f0868981a3 Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Wed, 5 Sep 2018 17:31:07 +0100
Subject: [PATCH 005/304] Now building sat specific humidity tables and shorter
run on more cores
---
exp/test_cases/MiMA/MiMA_test_case.py | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/exp/test_cases/MiMA/MiMA_test_case.py b/exp/test_cases/MiMA/MiMA_test_case.py
index f21ba6404..61472cc25 100644
--- a/exp/test_cases/MiMA/MiMA_test_case.py
+++ b/exp/test_cases/MiMA/MiMA_test_case.py
@@ -4,7 +4,7 @@
from isca import IscaCodeBase, DiagTable, Experiment, Namelist, GFDL_BASE
-NCORES = 4
+NCORES = 16
# a CodeBase can be a directory on the computer,
# useful for iterative development
@@ -131,7 +131,8 @@
},
'sat_vapor_pres_nml': {
- 'do_simple':True
+ 'do_simple':True,
+ 'construct_table_wrt_liq_and_ice':True
},
'damping_driver_nml': {
@@ -185,5 +186,5 @@
#Lets do a run!
if __name__=="__main__":
exp.run(1, use_restart=False, num_cores=NCORES)
- for i in range(2,121):
+ for i in range(2,25):
exp.run(i, num_cores=NCORES)
From 31702ca2becb2705fec204cfeeb91174a5569e57 Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Thu, 6 Sep 2018 12:24:50 +0100
Subject: [PATCH 006/304] exp/test_cases/MiMA/MiMA_test_case.py
---
src/atmos_param/cloud_simple/cloud_simple.F90 | 91 ++++++++++++++++---
.../rrtm_radiation/rrtm_radiation.f90 | 20 ++--
.../driver/solo/idealized_moist_phys.F90 | 15 ++-
3 files changed, 99 insertions(+), 27 deletions(-)
diff --git a/src/atmos_param/cloud_simple/cloud_simple.F90 b/src/atmos_param/cloud_simple/cloud_simple.F90
index a04d92b5b..c35708ad3 100644
--- a/src/atmos_param/cloud_simple/cloud_simple.F90
+++ b/src/atmos_param/cloud_simple/cloud_simple.F90
@@ -10,9 +10,11 @@ module cloud_simple_mod
use time_manager_mod, only: time_type
use sat_vapor_pres_mod, only: compute_qs
+ use diag_manager_mod, only: register_diag_field, send_data
+
implicit none
- logical :: do_init = .true. ! Do I still need to do init?
+ logical :: do_init = .true. ! Check if init needs to be run
real :: simple_cca = 0.0
real :: rhcsfc = 0.95
@@ -26,16 +28,22 @@ module cloud_simple_mod
rhmsfc, rhm700, rhm200
real :: zerodegc = 273.15
+ integer :: id_cf_rad, id_reff_rad, id_frac_liq, id_qcl_rad
+ character(len=14), parameter :: mod_name_cld = "cloud_simple"
contains
!-----------------------------------------------
- subroutine cloud_simple_init ()
+ subroutine cloud_simple_init (axes, Time)
+
+ type(time_type), intent(in) :: Time
+ integer, intent(in), dimension(4) :: axes
integer :: io ,stdlog_unit
+
#ifdef INTERNAL_FILE_NML
read (input_nml_file, nml=cloud_simple_nml, iostat=io)
#else
@@ -48,6 +56,26 @@ subroutine cloud_simple_init ()
stdlog_unit = stdlog()
write(stdlog_unit, cloud_simple_nml)
+ !register diagnostics
+ id_cf_rad = &
+ register_diag_field ( mod_name_cld, 'cf_rad', axes(1:3), Time, &
+ 'Cloud fraction for the simple cloud scheme', 'unitless: values 0-1')
+
+ id_frac_liq = &
+ register_diag_field ( mod_name_cld, 'frac_liq', axes(1:3), Time, &
+ 'Liquid cloud fraction (liquid, mixed-ice phase, ice)', &
+ 'unitless: values 0-1')
+
+ id_reff_rad = &
+ register_diag_field ( mod_name_cld, 'reff_rad', axes(1:3), Time, &
+ 'Effective cloud particle radius', &
+ 'microns')
+
+ id_qcl_rad = &
+ register_diag_field ( mod_name_cld, 'qcl_rad', axes(1:3), Time, &
+ 'Specific humidity of cloud liquid', &
+ 'kg/kg')
+
do_init = .false. !initialisation completed
end subroutine cloud_simple_init
@@ -57,20 +85,22 @@ end subroutine cloud_simple_init
subroutine cloud_simple (p_half, p_full, Time, &
temp, q_hum, &
! outs
- cfa_rad, reff_rad )
+ cf_rad, reff_rad, qcl_rad )
real , intent(in), dimension(:,:,:) :: temp, q_hum, p_full, p_half
type(time_type) , intent(in) :: Time
- real , intent(out), dimension(:,:,:) :: cfa_rad, reff_rad
+ real , intent(out), dimension(:,:,:) :: cf_rad, reff_rad, qcl_rad
- real, dimension(size(temp,1), size(temp, 2), size(temp, 3)) :: qs, qcl_rad
- real :: frac_liq, cf_rad, simple_rhcrit
+ real, dimension(size(temp,1), size(temp, 2), size(temp, 3)) :: qs, frac_liq
+ real :: simple_rhcrit
integer :: i, j, k, k_surf
logical :: es_over_liq_and_ice
+ real :: tmp1, tmp2 !remove tmp1 and tmp2 after debugging
+
!check initiation has been done - ie read in parameters
if (do_init) call error_mesg ('cloud_simple', &
'cloud_simple_init has not been called.', FATAL)
@@ -85,17 +115,22 @@ subroutine cloud_simple (p_half, p_full, Time, &
do k=1, size(temp, 3)
!caluclate the frac_liq
- call calc_liq_frac(temp(i,j,k), frac_liq)
- call calc_reff(frac_liq, reff_rad(i,j,k))
+ call calc_liq_frac(temp(i,j,k), frac_liq(i,j,k))
+ call calc_reff(frac_liq(i,j,k), reff_rad(i,j,k))
call calc_rhcrit(p_full(i,j,k), p_full(i,j,k_surf), simple_rhcrit)
- call calc_cf_rad(q_hum(i,j,k), qs(i,j,k), simple_rhcrit, cf_rad)
- call calc_qcl_rad(p_full(i,j,k), cf_rad, qcl_rad(i,j,k) )
+ call calc_cf_rad(q_hum(i,j,k), qs(i,j,k), simple_rhcrit, cf_rad(i,j,k))
+ call calc_qcl_rad(p_full(i,j,k), cf_rad(i,j,k), qcl_rad(i,j,k) )
end do
end do
end do
- !WHAT ARE THE UNITS
- !add diagnostics
+ !save some diagnotics
+ call output_cloud_diags(cf_rad, reff_rad, frac_liq, qcl_rad, Time )
+
+tmp2 = maxval(cf_rad)
+tmp1 = maxval(reff_rad)
+tmp2 = maxval(cf_rad)
+
end subroutine cloud_simple
@@ -123,7 +158,7 @@ subroutine calc_reff(frac_liq, reff_rad)
real, intent(in) :: frac_liq
real, intent(out) :: reff_rad
- reff_rad = 1.0e-6 * ( 10.0 * frac_liq + 20.0 * (1.0 - frac_liq) )
+ reff_rad = 10.0 * frac_liq + 20.0 * (1.0 - frac_liq) !units in microns
end subroutine calc_reff
@@ -170,6 +205,8 @@ subroutine calc_cf_rad (q_hum, qsat, simple_rhcrit, cf_rad)
cf_rad = MAX( simple_cca, cf_rad )
end if
+
+
end subroutine calc_cf_rad
subroutine calc_qcl_rad(p_full, cf_rad, qcl_rad)
@@ -190,6 +227,34 @@ subroutine calc_qcl_rad(p_full, cf_rad, qcl_rad)
end subroutine calc_qcl_rad
+
+ subroutine output_cloud_diags(cf_rad, reff_rad, frac_liq, qcl_rad, Time)
+
+ real, intent(in), dimension(:,:,:) :: cf_rad, reff_rad, frac_liq, qcl_rad
+
+ type(time_type) , intent(in) :: Time
+
+ real :: used
+
+ if ( id_cf_rad > 0 ) then
+ used = send_data ( id_cf_rad, cf_rad, Time)
+ endif
+
+ if ( id_reff_rad > 0 ) then
+ used = send_data ( id_reff_rad, reff_rad, Time)
+ endif
+
+ if ( id_frac_liq > 0 ) then
+ used = send_data ( id_frac_liq, frac_liq, Time)
+ endif
+
+ if ( id_qcl_rad > 0 ) then
+ used = send_data ( id_qcl_rad, qcl_rad, Time)
+ endif
+
+
+ end subroutine output_cloud_diags
+
!-----------------------------------------------
diff --git a/src/atmos_param/rrtm_radiation/rrtm_radiation.f90 b/src/atmos_param/rrtm_radiation/rrtm_radiation.f90
index f342a04b6..7aeb76ef1 100644
--- a/src/atmos_param/rrtm_radiation/rrtm_radiation.f90
+++ b/src/atmos_param/rrtm_radiation/rrtm_radiation.f90
@@ -524,7 +524,7 @@ end subroutine interp_temp
!*****************************************************************************************
subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half, &
albedo,q,t,t_surf_rad,tdt, &
- coszen,flux_sw,flux_lw,cfa_rad,reff_rad, &
+ coszen,flux_sw,flux_lw,cf_rad,reff_rad, &
do_cloud_simple)
!
! Driver for RRTMG radiation scheme.
@@ -571,7 +571,7 @@ subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half, &
real(kind=rb),dimension(:,:),intent(out),optional :: flux_sw,flux_lw ! surface fluxes [W/m2]
! dimension (lat x lon)
! need to have both or none!
- real(kind=rb), dimension(:,:,:), intent(in) :: cfa_rad,reff_rad !cloud properties
+ real(kind=rb), dimension(:,:,:), intent(in) :: cf_rad,reff_rad !cloud properties
logical, intent(in) :: do_cloud_simple
@@ -602,6 +602,8 @@ subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half, &
! debug
+ real :: tmp1, tmp2 !remove tmp1 and tmp2 after debugging
+
integer :: indx2(2),indx(3),ii,ji,ki
logical :: used
!---------------------------------------------------------------------------------------------------------------
@@ -815,16 +817,16 @@ subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half, &
if (do_cloud_simple) then
inflglw = 2 !RRTM responsible for calculating optical properties of clouds
liqflglw = 1 !Sets liquid water radii to be used rather than being inactive (zero is inactive)
- cldfr = reshape( cfa_rad (1:si:lonstep,:,sk :1:-1),(/ si*sj/lonstep,sk /))
- reliq = reshape(reff_rad (1:si:lonstep,:,sk :1:-1),(/ si*sj/lonstep,sk /))
- reice = zeros !Ice particle radii not used as iceflglw=0 meaning it is inactive. Setting to fill value of zeros
+ cldfr = reshape( cf_rad (1:si:lonstep,:,sk :1:-1),(/ si*sj/lonstep,sk /))
+ reliq = reshape(reff_rad (1:si:lonstep,:,sk :1:-1),(/ si*sj/lonstep,sk /)) !already in microns
+ reice = 10*ones !Ice particle radii not used as iceflglw=0 meaning it is inactive. Setting to fill value of zeros
else
cldfr = zeros
- reliq = 10*ones
- reice = 10*ones
+ reliq = 10*ones ! not requires to be 10 microns but assumed a valid number
+ reice = 10*ones ! needs to be 10 microns
endif
-
-
+ tmp1 = maxval(reff_rad)
+ tmp2 = maxval(cf_rad)
if(include_secondary_gases)then
call rrtmg_sw &
diff --git a/src/atmos_spectral/driver/solo/idealized_moist_phys.F90 b/src/atmos_spectral/driver/solo/idealized_moist_phys.F90
index c8b921050..6f63b36ac 100644
--- a/src/atmos_spectral/driver/solo/idealized_moist_phys.F90
+++ b/src/atmos_spectral/driver/solo/idealized_moist_phys.F90
@@ -333,7 +333,7 @@ subroutine idealized_moist_phys_init(Time, Time_step_in, nhum, rad_lon_2d, rad_l
d378 = 1.-d622
if(do_cloud_simple) then
- call cloud_simple_init()
+ call cloud_simple_init(get_axis_id(), Time)
end if
!s need to make sure that gray radiation and rrtm radiation are not both called.
@@ -756,7 +756,7 @@ subroutine idealized_moist_phys(Time, p_half, p_full, z_half, z_full, ug, vg, tg
real, dimension(size(ug,1), size(ug,2), size(ug,3)) :: tg_tmp, qg_tmp, RH,tg_interp, mc, dt_ug_conv, dt_vg_conv
! Simple cloud scheme variabilies to pass to radiation
-real, dimension(size(ug,1), size(ug,2), size(ug,3)) :: cfa_rad, reff_rad
+real, dimension(size(ug,1), size(ug,2), size(ug,3)) :: cf_rad, reff_rad, qcl_rad
real, intent(in) , dimension(:,:,:), optional :: mask
integer, intent(in) , dimension(:,:), optional :: kbot
@@ -764,6 +764,8 @@ subroutine idealized_moist_phys(Time, p_half, p_full, z_half, z_full, ug, vg, tg
real, dimension(1,1,1):: tracer, tracertnd
integer :: nql, nqi, nqa ! tracer indices for stratiform clouds
+real :: tmp1, tmp2 !remove tmp1 and tmp2 after debugging
+
if(current == previous) then
delta_t = dt_real
else
@@ -930,11 +932,14 @@ subroutine idealized_moist_phys(Time, p_half, p_full, z_half, z_full, ug, vg, tg
tg(:,:,:,previous), &
grid_tracers(:,:,:,previous,nsphum), &
! outs -
- cfa_rad(:,:,:), reff_rad(:,:,:) &
+ cf_rad(:,:,:), reff_rad(:,:,:), &
+ qcl_rad(:,:,:) &
)
-
+
endif
+tmp1 = maxval(reff_rad)
+tmp2 = maxval(cf_rad)
! Begin the radiation calculation by computing downward fluxes.
! This part of the calculation does not depend on the surface temperature.
@@ -1034,7 +1039,7 @@ subroutine idealized_moist_phys(Time, p_half, p_full, z_half, z_full, ug, vg, tg
call interp_temp(z_full(:,:,:,current),z_half(:,:,:,current),tg_interp, Time)
call run_rrtmg(is,js,Time,rad_lat(:,:),rad_lon(:,:),p_full(:,:,:,current),p_half(:,:,:,current), &
albedo,grid_tracers(:,:,:,previous,nsphum),tg_interp,t_surf(:,:),dt_tg(:,:,:), &
- coszen,net_surf_sw_down(:,:),surf_lw_down(:,:), cfa_rad(:,:,:), reff_rad(:,:,:), &
+ coszen,net_surf_sw_down(:,:),surf_lw_down(:,:), cf_rad(:,:,:), reff_rad(:,:,:), &
do_cloud_simple )
endif
#endif
From 9bb69768b536bda1671bf672855356c6c6a1153d Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Thu, 6 Sep 2018 12:25:51 +0100
Subject: [PATCH 007/304] Previous commit did not have all files: attempting to
debug why cloud fraction is not passed out of the simple cloud scheme
---
exp/test_cases/MiMA/MiMA_test_case.py | 19 +-
.../MiMA/MiMA_test_case_no_cloud.py | 191 ++++++++++++++++++
2 files changed, 203 insertions(+), 7 deletions(-)
create mode 100644 exp/test_cases/MiMA/MiMA_test_case_no_cloud.py
diff --git a/exp/test_cases/MiMA/MiMA_test_case.py b/exp/test_cases/MiMA/MiMA_test_case.py
index 61472cc25..06ab56cf5 100644
--- a/exp/test_cases/MiMA/MiMA_test_case.py
+++ b/exp/test_cases/MiMA/MiMA_test_case.py
@@ -4,7 +4,7 @@
from isca import IscaCodeBase, DiagTable, Experiment, Namelist, GFDL_BASE
-NCORES = 16
+NCORES = 1
# a CodeBase can be a directory on the computer,
# useful for iterative development
@@ -19,7 +19,7 @@
# is used to load the correct compilers. The env file is always loaded from
# $GFDL_BASE and not the checked out git repo.
-cb.compile() # compile the source code to working directory $GFDL_WORK/codebase
+cb.compile(debug=True) # compile the source code to working directory $GFDL_WORK/codebase
# create an Experiment object to handle the configuration of model parameters
# and output diagnostics
@@ -43,6 +43,11 @@
diag.add_field('dynamics', 'temp', time_avg=True)
diag.add_field('dynamics', 'vor', time_avg=True)
diag.add_field('dynamics', 'div', time_avg=True)
+diag.add_field('cloud_simple', 'cf_rad', time_avg=True)
+diag.add_field('cloud_simple', 'reff_rad', time_avg=True)
+diag.add_field('cloud_simple', 'frac_liq', time_avg=True)
+diag.add_field('cloud_simple', 'qcl_rad', time_avg=True)
+diag.add_field('rrtm_radiation', 'olr', time_avg=True)
exp.diag_table = diag
@@ -138,7 +143,7 @@
'damping_driver_nml': {
'do_rayleigh': True,
'trayfric': -0.5, # neg. value: time in *days*
- 'sponge_pbottom': 50.,
+ 'sponge_pbottom': 150.,
'do_conserve_energy': True,
},
@@ -175,7 +180,7 @@
'valid_range_t':[100.,800.],
'initial_sphum':[2.e-6],
'vert_coord_option':'uneven_sigma',
- 'surf_res':0.5,
+ 'surf_res':0.2,
'scale_heights' : 11.0,
'exponent':7.0,
'robert_coeff':0.03
@@ -185,6 +190,6 @@
})
#Lets do a run!
if __name__=="__main__":
- exp.run(1, use_restart=False, num_cores=NCORES)
- for i in range(2,25):
- exp.run(i, num_cores=NCORES)
+ exp.run(1, use_restart=False, num_cores=NCORES, overwrite_data=True, run_idb=True)
+ # for i in range(2,25):
+ # exp.run(i, num_cores=NCORES, overwrite_data=True)
diff --git a/exp/test_cases/MiMA/MiMA_test_case_no_cloud.py b/exp/test_cases/MiMA/MiMA_test_case_no_cloud.py
new file mode 100644
index 000000000..645a589ea
--- /dev/null
+++ b/exp/test_cases/MiMA/MiMA_test_case_no_cloud.py
@@ -0,0 +1,191 @@
+import os
+
+import numpy as np
+
+from isca import IscaCodeBase, DiagTable, Experiment, Namelist, GFDL_BASE
+
+NCORES = 16
+
+# a CodeBase can be a directory on the computer,
+# useful for iterative development
+cb = IscaCodeBase.from_directory(GFDL_BASE)
+
+# or it can point to a specific git repo and commit id.
+# This method should ensure future, independent, reproducibility of results.
+# cb = DryCodeBase.from_repo(repo='https://github.com/isca/isca', commit='isca1.1')
+
+# compilation depends on computer specific settings. The $GFDL_ENV
+# environment variable is used to determine which `$GFDL_BASE/src/extra/env` file
+# is used to load the correct compilers. The env file is always loaded from
+# $GFDL_BASE and not the checked out git repo.
+
+cb.compile() # compile the source code to working directory $GFDL_WORK/codebase
+
+# create an Experiment object to handle the configuration of model parameters
+# and output diagnostics
+exp = Experiment('mima_test_experiment_no_cloud', codebase=cb)
+
+exp.inputfiles = [os.path.join(GFDL_BASE,'input/rrtm_input_files/ozone_1990.nc')]
+
+#Tell model how to write diagnostics
+diag = DiagTable()
+diag.add_file('atmos_monthly', 30, 'days', time_units='days')
+
+#Tell model which diagnostics to write
+diag.add_field('dynamics', 'ps', time_avg=True)
+diag.add_field('dynamics', 'bk')
+diag.add_field('dynamics', 'pk')
+diag.add_field('atmosphere', 'precipitation', time_avg=True)
+diag.add_field('mixed_layer', 't_surf', time_avg=True)
+diag.add_field('dynamics', 'sphum', time_avg=True)
+diag.add_field('dynamics', 'ucomp', time_avg=True)
+diag.add_field('dynamics', 'vcomp', time_avg=True)
+diag.add_field('dynamics', 'temp', time_avg=True)
+diag.add_field('dynamics', 'vor', time_avg=True)
+diag.add_field('dynamics', 'div', time_avg=True)
+diag.add_field('rrtm_radiation', 'olr', time_avg=True)
+
+exp.diag_table = diag
+
+
+#Empty the run directory ready to run
+exp.clear_rundir()
+
+#Define values for the 'core' namelist
+exp.namelist = namelist = Namelist({
+ 'main_nml': {
+ 'days' : 30,
+ 'hours' : 0,
+ 'minutes': 0,
+ 'seconds': 0,
+ 'dt_atmos':600,
+ 'current_date' : [1,1,1,0,0,0],
+ 'calendar' : 'thirty_day'
+ },
+
+ 'idealized_moist_phys_nml': {
+ 'two_stream_gray': False,
+ 'do_rrtm_radiation': True, #Use RRTM radiation, not grey
+ 'convection_scheme': 'SIMPLE_BETTS_MILLER', #Use the simple Betts Miller convection scheme
+ 'do_damping': True,
+ 'turb':True,
+ 'mixed_layer_bc':True,
+ 'do_virtual' :False,
+ 'do_simple': True,
+ 'roughness_mom':3.21e-05,
+ 'roughness_heat':3.21e-05,
+ 'roughness_moist':3.21e-05,
+ 'do_cloud_simple': False,
+ },
+ 'cloud_simple_nml': {
+ 'simple_cca':0.0,
+ 'rhcsfc': 0.95,
+ 'rhc700': 0.7,
+ 'rhc200': 0.3,
+ 'rhmsfc': 0.95,
+ 'rhm700': 0.7,
+ 'rhm200': 0.3,
+ },
+
+ 'vert_turb_driver_nml': {
+ 'do_mellor_yamada': False, # default: True
+ 'do_diffusivity': True, # default: False
+ 'do_simple': True, # default: False
+ 'constant_gust': 0.0, # default: 1.0
+ 'use_tau': False
+ },
+
+ 'diffusivity_nml': {
+ 'do_entrain':False,
+ 'do_simple': True,
+ },
+
+ 'surface_flux_nml': {
+ 'use_virtual_temp': False,
+ 'do_simple': True,
+ 'old_dtaudv': True
+ },
+
+ 'atmosphere_nml': {
+ 'idealized_moist_model': True
+ },
+
+ #Use a large mixed-layer depth, and the Albedo of the CTRL case in Jucker & Gerber, 2017
+ 'mixed_layer_nml': {
+ 'depth': 100,
+ 'albedo_value': 0.205,
+ 'tconst' : 285.,
+ 'prescribe_initial_dist':True,
+ 'evaporation':True,
+ 'do_qflux': True
+ },
+
+ 'qe_moist_convection_nml': {
+ 'rhbm':0.7,
+ 'Tmin':160.,
+ 'Tmax':350.
+ },
+
+ 'lscale_cond_nml': {
+ 'do_simple':True,
+ 'do_evap':True
+ },
+
+ 'sat_vapor_pres_nml': {
+ 'do_simple':True,
+ 'construct_table_wrt_liq_and_ice':True
+ },
+
+ 'damping_driver_nml': {
+ 'do_rayleigh': True,
+ 'trayfric': -0.5, # neg. value: time in *days*
+ 'sponge_pbottom': 150.,
+ 'do_conserve_energy': True,
+ },
+
+ 'qflux_nml': {
+ 'qflux_amp': 30.0
+ },
+
+ 'rrtm_radiation_nml': {
+ 'solr_cnst': 1360, #s set solar constant to 1360, rather than default of 1368.22
+ 'dt_rad': 7200, #Use long RRTM timestep
+ 'do_read_ozone':True,
+ 'ozone_file':'ozone_1990'
+ },
+
+ # FMS Framework configuration
+ 'diag_manager_nml': {
+ 'mix_snapshot_average_fields': False # time avg fields are labelled with time in middle of window
+ },
+
+ 'fms_nml': {
+ 'domains_stack_size': 600000 # default: 0
+ },
+
+ 'fms_io_nml': {
+ 'threading_write': 'single', # default: multi
+ 'fileset_write': 'single', # default: multi
+ },
+
+ 'spectral_dynamics_nml': {
+ 'damping_order': 4,
+ 'water_correction_limit': 200.e2,
+ 'reference_sea_level_press':1.0e5,
+ 'num_levels':40,
+ 'valid_range_t':[100.,800.],
+ 'initial_sphum':[2.e-6],
+ 'vert_coord_option':'uneven_sigma',
+ 'surf_res':0.2,
+ 'scale_heights' : 11.0,
+ 'exponent':7.0,
+ 'robert_coeff':0.03
+ }
+
+
+})
+#Lets do a run!
+if __name__=="__main__":
+ exp.run(1, use_restart=False, num_cores=NCORES, overwrite_data=True)
+ for i in range(2,25):
+ exp.run(i, num_cores=NCORES, overwrite_data=True)
From de3a2503437d23e7f99b3490c6348df3792f3f8c Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Thu, 6 Sep 2018 16:27:53 +0100
Subject: [PATCH 008/304] Swapped to using mcica sw routine and added required
initialisation routine. Seems to run. Now swapping to lw mcica.
---
exp/test_cases/MiMA/MiMA_test_case.py | 9 +-
.../rrtm_radiation/rrtm_radiation.f90 | 98 +++++++++++++------
src/extra/model/isca/path_names | 2 +-
3 files changed, 74 insertions(+), 35 deletions(-)
diff --git a/exp/test_cases/MiMA/MiMA_test_case.py b/exp/test_cases/MiMA/MiMA_test_case.py
index 06ab56cf5..aef6b0ab6 100644
--- a/exp/test_cases/MiMA/MiMA_test_case.py
+++ b/exp/test_cases/MiMA/MiMA_test_case.py
@@ -4,7 +4,7 @@
from isca import IscaCodeBase, DiagTable, Experiment, Namelist, GFDL_BASE
-NCORES = 1
+NCORES = 16
# a CodeBase can be a directory on the computer,
# useful for iterative development
@@ -19,7 +19,7 @@
# is used to load the correct compilers. The env file is always loaded from
# $GFDL_BASE and not the checked out git repo.
-cb.compile(debug=True) # compile the source code to working directory $GFDL_WORK/codebase
+cb.compile()#debug=True) # compile the source code to working directory $GFDL_WORK/codebase
# create an Experiment object to handle the configuration of model parameters
# and output diagnostics
@@ -155,7 +155,8 @@
'solr_cnst': 1360, #s set solar constant to 1360, rather than default of 1368.22
'dt_rad': 7200, #Use long RRTM timestep
'do_read_ozone':True,
- 'ozone_file':'ozone_1990'
+ 'ozone_file':'ozone_1990',
+ 'icld': 1 #cloud overlap method
},
# FMS Framework configuration
@@ -190,6 +191,6 @@
})
#Lets do a run!
if __name__=="__main__":
- exp.run(1, use_restart=False, num_cores=NCORES, overwrite_data=True, run_idb=True)
+ exp.run(1, use_restart=False, num_cores=NCORES, overwrite_data=True)#, run_idb=True)
# for i in range(2,25):
# exp.run(i, num_cores=NCORES, overwrite_data=True)
diff --git a/src/atmos_param/rrtm_radiation/rrtm_radiation.f90 b/src/atmos_param/rrtm_radiation/rrtm_radiation.f90
index 7aeb76ef1..799ba2fa2 100644
--- a/src/atmos_param/rrtm_radiation/rrtm_radiation.f90
+++ b/src/atmos_param/rrtm_radiation/rrtm_radiation.f90
@@ -54,9 +54,10 @@ module rrtm_vars
! dimension (ncols_rrt x nlay_rrt)
real(kind=rb),allocatable,dimension(:,:) :: co2 ! CO2 [vmr]
! dimension (ncols_rrt x nlay_rrt)
- real(kind=rb),allocatable,dimension(:,:) :: zeros ! place holder for any species set
+ real(kind=rb),allocatable,dimension(:,:,:) :: zeros ! place holder for any species set
+ ! to zero
+ real(kind=rb),allocatable,dimension(:,:,:) :: ones ! place holder for any species set
! to zero
- real(kind=rb),allocatable,dimension(:,:) :: ones ! place holder for secondary species
! the following species are only set if use_secondary_gases=.true.
real(kind=rb),allocatable,dimension(:,:) :: ch4 ! CH4 [vmr]
! dimension (ncols_rrt x nlay_rrt)
@@ -102,7 +103,7 @@ module rrtm_vars
! some constants
real(kind=rb) :: daypersec=1./86400.,deg2rad !RG: daypersec=1./86400. left in when conversion to non-specific day length made as this only converts heatrates from RRTM from K/day to K/sec
! no clouds in the radiative scheme
- integer(kind=im) :: icld=0,idrv=0, &
+ integer(kind=im) :: idrv=0, &
inflglw=0,iceflglw=0,liqflglw=0, &
iaer=0
!---------------------------------------------------------------------------------------------------------------
@@ -179,6 +180,9 @@ module rrtm_vars
! day of the year = solday \in [0,days per year]
real(kind=rb) :: equinox_day=0.75 ! fraction of the year defining NH autumn equinox \in [0,1]
real(kind=rb) :: solr_cnst= 1368.22 ! solar constant [W/m2]
+
+ integer(kind=im) :: icld=0 ! Cloud overlap method
+
!-------------------------------------------------s--------------------------------------------------------------
!
!-------------------- diagnostics fields -------------------------------
@@ -201,14 +205,17 @@ module rrtm_vars
&lonstep, do_zm_tracers, do_zm_rad, &
&do_precip_albedo, precip_albedo_mode, precip_albedo, precip_lat,&
&do_read_co2, co2_file, co2_variable_name, use_dyofyr, solrad, &
- &solday, equinox_day,solr_cnst
+ &solday, equinox_day,solr_cnst, icld
end module rrtm_vars
!*****************************************************************************************
!*****************************************************************************************
module rrtm_radiation
- use parkind, only : im => kind_im, rb => kind_rb
- use constants_mod, only: pi, wtmozone, wtmh2o, gas_constant, rdgas
+ use parkind, only : im => kind_im, rb => kind_rb
+ use constants_mod, only: pi, wtmozone, wtmh2o, gas_constant, rdgas
+ use parrrtm, only: nbndlw
+ use parrrsw, only: nbndsw, ngptsw
+
implicit none
contains
@@ -221,8 +228,6 @@ subroutine rrtm_radiation_init(axes,Time,ncols,nlay,lonb,latb, Time_step)
! Modules
use rrtm_vars
use astronomy_mod, only: astronomy_init
- use parrrtm, only: nbndlw
- use parrrsw, only: nbndsw
use diag_manager_mod, only: register_diag_field, send_data
use interpolator_mod, only: interpolate_type, interpolator_init, &
&CONSTANT, ZERO,INTERP_WEIGHTED_P
@@ -396,8 +401,8 @@ subroutine rrtm_radiation_init(axes,Time,ncols,nlay,lonb,latb, Time_step)
if(.not. do_read_radiation .or. .not. do_read_sw_flux .and. .not. do_read_lw_flux)then
allocate(h2o(ncols_rrt,nlay_rrt),o3(ncols_rrt,nlay_rrt), &
co2(ncols_rrt,nlay_rrt))
- allocate(ones(ncols_rrt,nlay_rrt), &
- zeros(ncols_rrt,nlay_rrt))
+ allocate(ones(ngptsw,ncols_rrt,nlay_rrt), &
+ zeros(ngptsw,ncols_rrt,nlay_rrt))
allocate(emis(ncols_rrt,nbndlw))
allocate(taucld(nbndlw,ncols_rrt,nlay_rrt), &
tauaer(ncols_rrt,nlay_rrt,nbndlw))
@@ -535,7 +540,7 @@ subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half, &
use fms_mod, only: error_mesg, FATAL
use mpp_mod, only: mpp_pe,mpp_root_pe
use rrtmg_lw_rad, only: rrtmg_lw
- use rrtmg_sw_rad, only: rrtmg_sw
+ use rrtmg_sw_rad, only: rrtmg_sw, mcica_subcol_sw
use astronomy_mod, only: diurnal_solar
use rrtm_vars
use time_manager_mod,only: time_type,get_time,set_time, length_of_year, length_of_day
@@ -582,8 +587,13 @@ subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half, &
integer si,sj,sk,locmin(3)
real(kind=rb),dimension(size(q,1),size(q,2),size(q,3)) :: o3f
real(kind=rb),dimension(size(q,1),size(q,2),size(q,3)) :: co2f,co2f_temp
+
real(kind=rb),dimension(ncols_rrt,nlay_rrt) :: pfull,tfull,fracday&
, hr,hrc, swhr, swhrc, cldfr, reliq, reice
+
+
+ real(kind=rb),dimension(ngptsw,ncols_rrt,nlay_rrt) :: cldfr_pass
+
real(kind=rb),dimension(size(tdt,1),size(tdt,2),size(tdt,3)) :: tdt_rrtm
real(kind=rb),dimension(ncols_rrt,nlay_rrt+1) :: uflx, dflx, uflxc, dflxc&
,swuflx, swdflx, swuflxc, swdflxc
@@ -600,11 +610,16 @@ subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half, &
integer :: year_in_s
real :: r_seconds, r_days, r_total_seconds, frac_of_day, frac_of_year, gmt, time_since_ae, rrsun, dt_rad_radians, day_in_s, r_solday, r_dt_rad_avg
+ !mcica variables
+ integer :: permuteseed, irng
+ real(kind=rb),dimension(ncols_rrt,nlay_rrt) :: reicmcl, relqmcl
+
+ real(kind=rb),dimension(ngptsw, ncols_rrt,nlay_rrt) :: cldfmcl, ciwpmcl, clwpmcl, taucmcl, ssacmcl, asmcmcl, fsfcmcl
! debug
real :: tmp1, tmp2 !remove tmp1 and tmp2 after debugging
- integer :: indx2(2),indx(3),ii,ji,ki
+ integer :: indx2(2),indx(3),ii,ji,ki, pt1,pt2
logical :: used
!---------------------------------------------------------------------------------------------------------------
@@ -815,31 +830,54 @@ subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half, &
! where(cosz_rr < 1.e-2)cosz_rr=0.
if (do_cloud_simple) then
+ pt1 = 1
+ pt2 = ngptsw
inflglw = 2 !RRTM responsible for calculating optical properties of clouds
liqflglw = 1 !Sets liquid water radii to be used rather than being inactive (zero is inactive)
cldfr = reshape( cf_rad (1:si:lonstep,:,sk :1:-1),(/ si*sj/lonstep,sk /))
reliq = reshape(reff_rad (1:si:lonstep,:,sk :1:-1),(/ si*sj/lonstep,sk /)) !already in microns
- reice = 10*ones !Ice particle radii not used as iceflglw=0 meaning it is inactive. Setting to fill value of zeros
+ reice = 10*ones(pt1,:,:) !Ice particle radii not used as iceflglw=0 meaning it is inactive. Setting to fill value of zeros
else
- cldfr = zeros
- reliq = 10*ones ! not requires to be 10 microns but assumed a valid number
- reice = 10*ones ! needs to be 10 microns
+ pt1 = 1
+ pt2 = 1
+ cldfr = zeros(pt1,:,:)
+ reliq = 10*ones(pt1,:,:) ! not requires to be 10 microns but assumed a valid number
+ reice = 10*ones(pt1,:,:) ! needs to be 10 microns
+ cldfr_pass(pt1,:,:) = cldfr
endif
- tmp1 = maxval(reff_rad)
- tmp2 = maxval(cf_rad)
+
+
+ if (do_cloud_simple) then
+ !need to run monty carlo independent column approcimation (mcica)
+ permuteseed = 1
+ irng = 1 !use a random number gerator either 0 (Kissvec) or 1(Mersenne Twister)
+
+ call mcica_subcol_sw(0, ncols_rrt, nlay_rrt, icld, permuteseed, irng, pfull, &
+ cldfr, zeros(pt1,:,:), zeros(pt1,:,:), reice, reliq, tauaer, zro_sw, zro_sw, zro_sw , &
+ !outs
+ cldfmcl, ciwpmcl, clwpmcl, reicmcl, relqmcl, taucmcl, ssacmcl, asmcmcl, fsfcmcl)
+
+ permuteseed = 2
+ cldfr_pass = cldfmcl
+ reice = reicmcl
+ reliq = relqmcl
+ taucld = taucmcl
+ !other vars not needed
+ endif
+
if(include_secondary_gases)then
call rrtmg_sw &
(ncols_rrt, nlay_rrt , icld , iaer , &
pfull , phalf , tfull , thalf , tsrf , &
- h2o , o3 , co2 , ch4_val*ones , n2o_val*ones , o2_val*ones , &
+ h2o , o3 , co2 , ch4_val*ones(pt1,:,:) , n2o_val*ones(pt1,:,:) , o2_val*ones(pt1,:,:) , &
albedo_rr , albedo_rr, albedo_rr, albedo_rr, &
cosz_rr , solrad , dyofyr , solr_cnst, &
inflglw , iceflglw , liqflglw , &
! cloud parameters
- cldfr, &
+ cldfr_pass(pt1:pt2,:,:), &
taucld , sw_zro , sw_zro , sw_zro , &
- zeros , zeros , reice , reliq , &
+ zeros(pt1:pt2,:,:) , zeros(pt1:pt2,:,:) , reice , reliq , &
tauaer , zro_sw , zro_sw , zro_sw , &
! output
swuflx , swdflx , swhr , swuflxc , swdflxc, swhrc)
@@ -847,14 +885,14 @@ subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half, &
call rrtmg_sw &
(ncols_rrt, nlay_rrt , icld , iaer , &
pfull , phalf , tfull , thalf , tsrf , &
- h2o , o3 , co2 , zeros , zeros, zeros, &
+ h2o , o3 , co2 , zeros(pt1,:,:) , zeros(pt1,:,:), zeros(pt1,:,:), &
albedo_rr , albedo_rr, albedo_rr, albedo_rr, &
cosz_rr , solrad , dyofyr , solr_cnst, &
inflglw , iceflglw , liqflglw , &
! cloud parameters
- cldfr, &
+ cldfr_pass(pt1:pt2,:,:), &
taucld , sw_zro , sw_zro , sw_zro , &
- zeros , zeros , reice , reliq , &
+ zeros(pt1:pt2,:,:) , zeros(pt1:pt2,:,:) , reice , reliq , &
tauaer , zro_sw , zro_sw , zro_sw , &
! output
swuflx , swdflx , swhr , swuflxc , swdflxc, swhrc)
@@ -881,12 +919,12 @@ subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half, &
pfull , phalf , tfull , thalf, tsrf , &
h2o , o3 , co2 , &
! secondary gases
- ch4_val*ones , n2o_val*ones , o2_val*ones , &
- cfc11_val*ones , cfc12_val*ones , cfc22_val*ones , ccl4_val*ones , &
+ ch4_val*ones(pt1,:,:) , n2o_val*ones(pt1,:,:) , o2_val*ones(pt1,:,:) , &
+ cfc11_val*ones(pt1,:,:) , cfc12_val*ones(pt1,:,:) , cfc22_val*ones(pt1,:,:) , ccl4_val*ones(pt1,:,:) , &
! emissivity and cloud composition
emis , inflglw , iceflglw , liqflglw , &
! cloud parameters
- cldfr , taucld , zeros , zeros , reice, reliq, &
+ cldfr_pass(pt1,:,:) , taucld , zeros(pt1,:,:) , zeros(pt1,:,:) , reice, reliq, &
tauaer , &
! output
uflx , dflx , hr , uflxc , dflxc , hrc)
@@ -894,12 +932,12 @@ subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half, &
call rrtmg_lw &
(ncols_rrt, nlay_rrt, icld , idrv , &
pfull , phalf , tfull , thalf, tsrf , &
- h2o , o3 , co2 , zeros, zeros, zeros, &
- zeros , zeros , zeros , zeros, &
+ h2o , o3 , co2 , zeros(pt1,:,:), zeros(pt1,:,:), zeros(pt1,:,:), &
+ zeros(pt1,:,:) , zeros(pt1,:,:) , zeros(pt1,:,:) , zeros(pt1,:,:), &
! emissivity and cloud composition
emis , inflglw , iceflglw, liqflglw, &
! cloud parameters
- cldfr , taucld , zeros , zeros, reice, reliq, &
+ cldfr_pass(pt1,:,:) , taucld , zeros(pt1,:,:) , zeros(pt1,:,:), reice, reliq, &
tauaer , &
! output
uflx , dflx , hr , uflxc, dflxc , hrc)
diff --git a/src/extra/model/isca/path_names b/src/extra/model/isca/path_names
index eebdfd2b0..3ffc0f449 100644
--- a/src/extra/model/isca/path_names
+++ b/src/extra/model/isca/path_names
@@ -83,7 +83,7 @@ atmos_param/rrtm_radiation/rrtmg_sw/gcm_model/modules/rrsw_vsn.f90
atmos_param/rrtm_radiation/rrtmg_sw/gcm_model/modules/rrsw_wvn.f90
atmos_param/rrtm_radiation/rrtmg_sw/gcm_model/src/mcica_random_numbers.f90
atmos_param/rrtm_radiation/rrtmg_sw/gcm_model/src/mcica_subcol_gen_sw.f90
-atmos_param/rrtm_radiation/rrtmg_sw/gcm_model/src/rrtmg_sw_rad.nomcica.f90
+atmos_param/rrtm_radiation/rrtmg_sw/gcm_model/src/rrtmg_sw_rad.f90
atmos_param/rrtm_radiation/rrtmg_sw/gcm_model/src/rrtmg_sw_cldprop.f90
atmos_param/rrtm_radiation/rrtmg_sw/gcm_model/src/rrtmg_sw_cldprmc.f90
atmos_param/rrtm_radiation/rrtmg_sw/gcm_model/src/rrtmg_sw_init.f90
From fa048a260ae89876575bdadf9d594d66f55f1cbe Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Thu, 6 Sep 2018 17:03:52 +0100
Subject: [PATCH 009/304] Swapped to using mcica lw routine and added required
initialisation routine. Seems to run. Testing needed
---
exp/test_cases/MiMA/MiMA_test_case.py | 6 +-
.../rrtm_radiation/rrtm_radiation.f90 | 70 ++++++++++++-------
src/extra/model/isca/path_names | 2 +-
3 files changed, 49 insertions(+), 29 deletions(-)
diff --git a/exp/test_cases/MiMA/MiMA_test_case.py b/exp/test_cases/MiMA/MiMA_test_case.py
index aef6b0ab6..27dc00243 100644
--- a/exp/test_cases/MiMA/MiMA_test_case.py
+++ b/exp/test_cases/MiMA/MiMA_test_case.py
@@ -23,7 +23,7 @@
# create an Experiment object to handle the configuration of model parameters
# and output diagnostics
-exp = Experiment('mima_test_experiment', codebase=cb)
+exp = Experiment('mima_test_experiment_with_mcica', codebase=cb)
exp.inputfiles = [os.path.join(GFDL_BASE,'input/rrtm_input_files/ozone_1990.nc')]
@@ -192,5 +192,5 @@
#Lets do a run!
if __name__=="__main__":
exp.run(1, use_restart=False, num_cores=NCORES, overwrite_data=True)#, run_idb=True)
- # for i in range(2,25):
- # exp.run(i, num_cores=NCORES, overwrite_data=True)
+ for i in range(2,25):
+ exp.run(i, num_cores=NCORES, overwrite_data=True)
diff --git a/src/atmos_param/rrtm_radiation/rrtm_radiation.f90 b/src/atmos_param/rrtm_radiation/rrtm_radiation.f90
index 799ba2fa2..1113d0162 100644
--- a/src/atmos_param/rrtm_radiation/rrtm_radiation.f90
+++ b/src/atmos_param/rrtm_radiation/rrtm_radiation.f90
@@ -78,7 +78,7 @@ module rrtm_vars
! =1 for black body
! clouds stuff
! cloud & aerosol optical depths, cloud and aerosol specific parameters. Set to zero
- real(kind=rb),allocatable,dimension(:,:,:) :: taucld,tauaer, sw_zro, zro_sw
+ real(kind=rb),allocatable,dimension(:,:,:) :: taucld_lw, taucld_sw, tauaer_lw, tauaer_sw, sw_zro, zro_sw
! heating rates and fluxes, zenith angle when in-between radiation time steps
real(kind=rb),allocatable,dimension(:,:) :: sw_flux,lw_flux,zencos, olr, toa_sw! surface and TOA fluxes, cos(zenith angle)
! dimension (lon x lat)
@@ -213,7 +213,7 @@ end module rrtm_vars
module rrtm_radiation
use parkind, only : im => kind_im, rb => kind_rb
use constants_mod, only: pi, wtmozone, wtmh2o, gas_constant, rdgas
- use parrrtm, only: nbndlw
+ use parrrtm, only: nbndlw, ngptlw
use parrrsw, only: nbndsw, ngptsw
implicit none
@@ -404,8 +404,10 @@ subroutine rrtm_radiation_init(axes,Time,ncols,nlay,lonb,latb, Time_step)
allocate(ones(ngptsw,ncols_rrt,nlay_rrt), &
zeros(ngptsw,ncols_rrt,nlay_rrt))
allocate(emis(ncols_rrt,nbndlw))
- allocate(taucld(nbndlw,ncols_rrt,nlay_rrt), &
- tauaer(ncols_rrt,nlay_rrt,nbndlw))
+ allocate(taucld_lw(nbndlw,ncols_rrt,nlay_rrt), &
+ tauaer_lw(ncols_rrt,nlay_rrt,nbndlw))
+ allocate(taucld_sw(nbndsw,ncols_rrt,nlay_rrt), &
+ tauaer_sw(ncols_rrt,nlay_rrt,nbndsw))
allocate(sw_zro(nbndsw,ncols_rrt,nlay_rrt), &
zro_sw(ncols_rrt,nlay_rrt,nbndsw))
if(id_coszen > 0)allocate(zencos (size(lonb,1)-1,size(latb,2)-1))
@@ -420,8 +422,10 @@ subroutine rrtm_radiation_init(axes,Time,ncols,nlay,lonb,latb, Time_step)
emis = 1. !black body: 1.0
! absorption
- taucld = 0.
- tauaer = 0.
+ taucld_sw = 0.
+ tauaer_sw = 0.
+ taucld_lw = 0.
+ tauaer_lw = 0.
! clouds
sw_zro = 0.
zro_sw = 0.
@@ -539,7 +543,7 @@ subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half, &
! Modules
use fms_mod, only: error_mesg, FATAL
use mpp_mod, only: mpp_pe,mpp_root_pe
- use rrtmg_lw_rad, only: rrtmg_lw
+ use rrtmg_lw_rad, only: rrtmg_lw, mcica_subcol_lw
use rrtmg_sw_rad, only: rrtmg_sw, mcica_subcol_sw
use astronomy_mod, only: diurnal_solar
use rrtm_vars
@@ -592,7 +596,8 @@ subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half, &
, hr,hrc, swhr, swhrc, cldfr, reliq, reice
- real(kind=rb),dimension(ngptsw,ncols_rrt,nlay_rrt) :: cldfr_pass
+ real(kind=rb),dimension(ngptsw,ncols_rrt,nlay_rrt) :: cldfr_pass_sw
+ real(kind=rb),dimension(ngptlw,ncols_rrt,nlay_rrt) :: cldfr_pass_lw
real(kind=rb),dimension(size(tdt,1),size(tdt,2),size(tdt,3)) :: tdt_rrtm
real(kind=rb),dimension(ncols_rrt,nlay_rrt+1) :: uflx, dflx, uflxc, dflxc&
@@ -614,7 +619,9 @@ subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half, &
integer :: permuteseed, irng
real(kind=rb),dimension(ncols_rrt,nlay_rrt) :: reicmcl, relqmcl
- real(kind=rb),dimension(ngptsw, ncols_rrt,nlay_rrt) :: cldfmcl, ciwpmcl, clwpmcl, taucmcl, ssacmcl, asmcmcl, fsfcmcl
+ real(kind=rb),dimension(ngptsw, ncols_rrt,nlay_rrt) :: cldfmcl_sw, ciwpmcl_sw, clwpmcl_sw, taucmcl_sw, ssacmcl, asmcmcl, fsfcmcl
+
+ real(kind=rb),dimension(ngptlw, ncols_rrt,nlay_rrt) :: cldfmcl_lw, ciwpmcl_lw, clwpmcl_lw, taucmcl_lw
! debug
real :: tmp1, tmp2 !remove tmp1 and tmp2 after debugging
@@ -843,7 +850,7 @@ subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half, &
cldfr = zeros(pt1,:,:)
reliq = 10*ones(pt1,:,:) ! not requires to be 10 microns but assumed a valid number
reice = 10*ones(pt1,:,:) ! needs to be 10 microns
- cldfr_pass(pt1,:,:) = cldfr
+ cldfr_pass_sw(pt1,:,:) = cldfr
endif
@@ -853,15 +860,14 @@ subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half, &
irng = 1 !use a random number gerator either 0 (Kissvec) or 1(Mersenne Twister)
call mcica_subcol_sw(0, ncols_rrt, nlay_rrt, icld, permuteseed, irng, pfull, &
- cldfr, zeros(pt1,:,:), zeros(pt1,:,:), reice, reliq, tauaer, zro_sw, zro_sw, zro_sw , &
+ cldfr, zeros(pt1,:,:), zeros(pt1,:,:), reice, reliq, tauaer_sw, zro_sw, zro_sw, zro_sw , &
!outs
- cldfmcl, ciwpmcl, clwpmcl, reicmcl, relqmcl, taucmcl, ssacmcl, asmcmcl, fsfcmcl)
+ cldfmcl_sw, ciwpmcl_sw, clwpmcl_sw, reicmcl, relqmcl, taucmcl_sw, ssacmcl, asmcmcl, fsfcmcl)
- permuteseed = 2
- cldfr_pass = cldfmcl
+ cldfr_pass_sw = cldfmcl_sw
reice = reicmcl
reliq = relqmcl
- taucld = taucmcl
+ taucld_sw = taucmcl_sw
!other vars not needed
endif
@@ -875,10 +881,10 @@ subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half, &
cosz_rr , solrad , dyofyr , solr_cnst, &
inflglw , iceflglw , liqflglw , &
! cloud parameters
- cldfr_pass(pt1:pt2,:,:), &
- taucld , sw_zro , sw_zro , sw_zro , &
+ cldfr_pass_sw(pt1:pt2,:,:), &
+ taucld_sw , sw_zro , sw_zro , sw_zro , &
zeros(pt1:pt2,:,:) , zeros(pt1:pt2,:,:) , reice , reliq , &
- tauaer , zro_sw , zro_sw , zro_sw , &
+ tauaer_sw , zro_sw , zro_sw , zro_sw , &
! output
swuflx , swdflx , swhr , swuflxc , swdflxc, swhrc)
else
@@ -890,10 +896,10 @@ subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half, &
cosz_rr , solrad , dyofyr , solr_cnst, &
inflglw , iceflglw , liqflglw , &
! cloud parameters
- cldfr_pass(pt1:pt2,:,:), &
- taucld , sw_zro , sw_zro , sw_zro , &
+ cldfr_pass_sw(pt1:pt2,:,:), &
+ taucld_sw , sw_zro , sw_zro , sw_zro , &
zeros(pt1:pt2,:,:) , zeros(pt1:pt2,:,:) , reice , reliq , &
- tauaer , zro_sw , zro_sw , zro_sw , &
+ tauaer_sw , zro_sw , zro_sw , zro_sw , &
! output
swuflx , swdflx , swhr , swuflxc , swdflxc, swhrc)
endif
@@ -907,6 +913,20 @@ subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half, &
! swhr (:,i) = 0.
! endwhere
! enddo
+
+ if(do_cloud_simple) then
+
+ permuteseed = 2
+
+ call mcica_subcol_lw(0, ncols_rrt, nlay_rrt, icld, permuteseed, irng, pfull, &
+ cldfr, zeros(pt1,:,:), zeros(pt1,:,:), reice, reliq, tauaer_lw, &
+ cldfmcl_lw, ciwpmcl_lw, clwpmcl_lw, reicmcl, relqmcl, taucmcl_lw)
+ cldfr_pass_lw = cldfmcl_lw
+ reice = reicmcl
+ reliq = relqmcl
+ taucld_lw = taucmcl_lw
+ endif
+
swijk = reshape(swhr(:,sk:1:-1),(/ si/lonstep,sj,sk /))*daypersec
@@ -924,8 +944,8 @@ subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half, &
! emissivity and cloud composition
emis , inflglw , iceflglw , liqflglw , &
! cloud parameters
- cldfr_pass(pt1,:,:) , taucld , zeros(pt1,:,:) , zeros(pt1,:,:) , reice, reliq, &
- tauaer , &
+ cldfr_pass_lw(pt1:pt2,:,:) , taucld_lw , zeros(pt1:pt2,:,:) , zeros(pt1:pt2,:,:) , reice, reliq, &
+ tauaer_lw , &
! output
uflx , dflx , hr , uflxc , dflxc , hrc)
else
@@ -937,8 +957,8 @@ subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half, &
! emissivity and cloud composition
emis , inflglw , iceflglw, liqflglw, &
! cloud parameters
- cldfr_pass(pt1,:,:) , taucld , zeros(pt1,:,:) , zeros(pt1,:,:), reice, reliq, &
- tauaer , &
+ cldfr_pass_lw(pt1:pt2,:,:) , taucld_lw , zeros(pt1:pt2,:,:) , zeros(pt1:pt2,:,:), reice, reliq, &
+ tauaer_lw , &
! output
uflx , dflx , hr , uflxc, dflxc , hrc)
endif
diff --git a/src/extra/model/isca/path_names b/src/extra/model/isca/path_names
index 3ffc0f449..c147c0ba3 100644
--- a/src/extra/model/isca/path_names
+++ b/src/extra/model/isca/path_names
@@ -47,7 +47,7 @@ atmos_param/rrtm_radiation/rrtmg_lw/gcm_model/modules/rrlw_wvn.f90
atmos_param/rrtm_radiation/rrtm_radiation.f90
atmos_param/rrtm_radiation/rrtmg_lw/gcm_model/src/mcica_random_numbers.f90
atmos_param/rrtm_radiation/rrtmg_lw/gcm_model/src/rrtmg_lw_cldprop.f90
-atmos_param/rrtm_radiation/rrtmg_lw/gcm_model/src/rrtmg_lw_rad.nomcica.f90
+atmos_param/rrtm_radiation/rrtmg_lw/gcm_model/src/rrtmg_lw_rad.f90
atmos_param/rrtm_radiation/rrtmg_lw/gcm_model/src/rrtmg_lw_rtrn.f90
atmos_param/rrtm_radiation/rrtmg_lw/gcm_model/src/rrtmg_lw_setcoef.f90
atmos_param/rrtm_radiation/rrtmg_lw/gcm_model/src/mcica_subcol_gen_lw.f90
From 8de752fc2247fad1ff9220df6ed34e9d97189aef Mon Sep 17 00:00:00 2001
From: sit23
Date: Fri, 7 Sep 2018 11:39:35 +0100
Subject: [PATCH 010/304] New socrates set cld file downloaded from LFRic James
Manners branch
main/branches/dev/jamesmanners/um11.1_solar/src/interface_core/socrates_set_cld.F90
on 07-09-18.
---
.../socrates/interface/socrates_set_cld.F90 | 485 ++++++++++++++++++
1 file changed, 485 insertions(+)
create mode 100644 src/atmos_param/socrates/interface/socrates_set_cld.F90
diff --git a/src/atmos_param/socrates/interface/socrates_set_cld.F90 b/src/atmos_param/socrates/interface/socrates_set_cld.F90
new file mode 100644
index 000000000..25e47a340
--- /dev/null
+++ b/src/atmos_param/socrates/interface/socrates_set_cld.F90
@@ -0,0 +1,485 @@
+! *****************************COPYRIGHT*******************************
+! (C) Crown copyright Met Office. All rights reserved.
+! For further details please refer to the file COPYRIGHT.txt
+! which you should have received as part of this distribution.
+! *****************************COPYRIGHT*******************************
+!
+! Set the variables in the Socrates cloud type
+!
+!------------------------------------------------------------------------------
+module socrates_set_cld
+implicit none
+character(len=*), parameter, private :: ModuleName = 'SOCRATES_SET_CLD'
+contains
+
+subroutine set_cld(cld, control, dimen, spectrum, n_profile, n_layer, &
+ cloud_frac, conv_frac, &
+ liq_frac, ice_frac, liq_conv_frac, ice_conv_frac, &
+ liq_mmr, ice_mmr, liq_conv_mmr, ice_conv_mmr, &
+ liq_dim, ice_dim, liq_conv_dim, ice_conv_dim, &
+ dp_corr_strat, dp_corr_conv)
+
+use def_cld, only: StrCld, allocate_cld, allocate_cld_prsc
+use def_control, only: StrCtrl
+use def_dimen, only: StrDim
+use def_spectrum, only: StrSpecData
+use realtype_rd, only: RealK
+use rad_pcf, only: &
+ ip_cloud_homogen, ip_cloud_ice_water, ip_cloud_conv_strat, ip_cloud_csiw, &
+ ip_clcmp_st_water, ip_clcmp_st_ice, ip_clcmp_cnv_water, ip_clcmp_cnv_ice, &
+ ip_phase_water, ip_phase_ice, ip_cloud_type_homogen, &
+ ip_cloud_type_water, ip_cloud_type_ice, &
+ ip_cloud_type_strat, ip_cloud_type_conv, &
+ ip_cloud_type_sw, ip_cloud_type_si, ip_cloud_type_cw, ip_cloud_type_ci, &
+ ip_drop_unparametrized, ip_ice_unparametrized, i_normal, i_err_fatal
+use ereport_mod, only: ereport
+use errormessagelength_mod, only: errormessagelength
+
+implicit none
+
+
+! Cloud properties:
+type(StrCld), intent(out) :: cld
+
+! Control options:
+type(StrCtrl), intent(in) :: control
+
+! Dimensions:
+type(StrDim), intent(in) :: dimen
+
+! Spectral data:
+type(StrSpecData), intent(in) :: spectrum
+
+integer, intent(in) :: n_profile
+integer, intent(in) :: n_layer
+
+real(RealK), intent(in), optional :: &
+ cloud_frac(:,:), conv_frac(:,:), &
+ liq_frac(:,:), ice_frac(:,:), liq_conv_frac(:,:), ice_conv_frac(:,:), &
+ liq_mmr(:,:), ice_mmr(:,:), liq_conv_mmr(:,:), ice_conv_mmr(:,:), &
+ liq_dim(:,:), ice_dim(:,:), liq_conv_dim(:,:), ice_conv_dim(:,:)
+! Liquid and ice cloud fractions, gridbox mean mixing ratios, and
+! effective dimensions
+
+real(RealK), intent(in), optional :: dp_corr_strat, dp_corr_conv
+! Decorrelation pressure scales for cloud vertical overlap
+
+
+! Local variables
+integer :: i, j, k, l
+! Loop variables
+integer :: i_phase, i_param_type, n_cloud_parameter
+! Working variables
+integer :: i_cloud_type(dimen%nd_cloud_component)
+! Types of cloud to which each component contributes
+
+real(RealK) :: condensed_min_dim
+real(RealK) :: condensed_max_dim
+! Minimum and maximum dimensions of each condensed component
+
+real(RealK) :: eps = EPSILON(1.0)
+real(RealK) :: min_cloud_fraction = 0.0001
+
+integer :: ierr = i_normal
+character (len=*), parameter :: RoutineName = 'SET_CLD'
+character (len=errormessagelength) :: cmessage
+
+! Functions called
+integer, external :: set_n_cloud_parameter
+
+
+! Allocate structure for the core radiation code interface
+call allocate_cld(cld, dimen, spectrum)
+call allocate_cld_prsc(cld, dimen, spectrum)
+
+if (.not.control%l_cloud) then
+ return
+end if
+
+!------------------------------------------------------------------------------
+! Set properties of condensed components
+!------------------------------------------------------------------------------
+
+if (control%l_ice .and. control%l_drop) then
+ select case (control%i_cloud_representation)
+ case (ip_cloud_homogen, ip_cloud_ice_water)
+ cld%n_condensed = 2
+ cld%type_condensed(1) = ip_clcmp_st_water
+ cld%type_condensed(2) = ip_clcmp_st_ice
+ case (ip_cloud_conv_strat, ip_cloud_csiw)
+ cld%n_condensed = 4
+ cld%type_condensed(1) = ip_clcmp_st_water
+ cld%type_condensed(2) = ip_clcmp_st_ice
+ cld%type_condensed(3) = ip_clcmp_cnv_water
+ cld%type_condensed(4) = ip_clcmp_cnv_ice
+ end select
+else if (control%l_ice .and. .not.control%l_drop) then
+ select case (control%i_cloud_representation)
+ case (ip_cloud_homogen, ip_cloud_ice_water)
+ cld%n_condensed = 1
+ cld%type_condensed(1) = ip_clcmp_st_ice
+ case (ip_cloud_conv_strat, ip_cloud_csiw)
+ cld%n_condensed = 2
+ cld%type_condensed(1) = ip_clcmp_st_ice
+ cld%type_condensed(2) = ip_clcmp_cnv_ice
+ end select
+else if (.not.control%l_ice .and. control%l_drop) then
+ select case (control%i_cloud_representation)
+ case (ip_cloud_homogen, ip_cloud_ice_water)
+ cld%n_condensed = 1
+ cld%type_condensed(1) = ip_clcmp_st_water
+ case (ip_cloud_conv_strat, ip_cloud_csiw)
+ cld%n_condensed = 2
+ cld%type_condensed(1) = ip_clcmp_st_water
+ cld%type_condensed(2) = ip_clcmp_cnv_water
+ end select
+else
+ cmessage = 'Cloud on, but no condensed components included.'
+ ierr=i_err_fatal
+ CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+end if
+
+do i=1, cld%n_condensed
+ select case (cld%type_condensed(i))
+ case (ip_clcmp_st_water)
+ i_phase = ip_phase_water
+ i_param_type = control%i_st_water
+ case (ip_clcmp_st_ice)
+ i_phase = ip_phase_ice
+ i_param_type = control%i_st_ice
+ case (ip_clcmp_cnv_water)
+ i_phase = ip_phase_water
+ i_param_type = control%i_cnv_water
+ case (ip_clcmp_cnv_ice)
+ i_phase = ip_phase_ice
+ i_param_type = control%i_cnv_ice
+ end select
+
+ select case (i_phase)
+ case (ip_phase_water)
+ if (i_param_type <= 0) then
+ cld%i_condensed_param(i) = ip_drop_unparametrized
+ cmessage = 'Prescribed liquid cloud not yet implemented.'
+ ierr=i_err_fatal
+ CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ else if (i_param_type > spectrum%dim%nd_drop_type) then
+ cmessage = 'Liquid cloud type outside allowed range.'
+ ierr=i_err_fatal
+ CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ else if (spectrum%drop%l_drop_type(i_param_type)) then
+ ! Take parametrisation from spectral file
+ cld%i_condensed_param(i) = spectrum%drop%i_drop_parm(i_param_type)
+ cld%condensed_n_phf(i) = spectrum%drop%n_phf(i_param_type)
+ ! DEPENDS ON: set_n_cloud_parameter
+ n_cloud_parameter = set_n_cloud_parameter( cld%i_condensed_param(i), &
+ cld%type_condensed(i), cld%condensed_n_phf(i) )
+ do j=1, spectrum%basic%n_band
+ do k=1, n_cloud_parameter
+ cld%condensed_param_list(k, i, j) &
+ = spectrum%drop%parm_list(k, j, i_param_type)
+ end do
+ end do
+ ! Assign droplet mass mixing ratio and effective radius
+ condensed_min_dim = spectrum%drop%parm_min_dim(i_param_type)
+ condensed_max_dim = spectrum%drop%parm_max_dim(i_param_type)
+ select case (cld%type_condensed(i))
+ case (ip_clcmp_st_water)
+ if (present(liq_mmr).and.present(liq_dim)) then
+ do k = dimen%id_cloud_top, n_layer
+ do l = 1, n_profile
+ cld%condensed_mix_ratio(l, k, i) = liq_mmr(l, k)
+ cld%condensed_dim_char(l, k, i) = min( max( liq_dim(l, k), &
+ condensed_min_dim ), condensed_max_dim )
+ end do
+ end do
+ else
+ cmessage = 'Liquid MMR and effective radius not provided.'
+ ierr=i_err_fatal
+ CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ end if
+ case (ip_clcmp_cnv_water)
+ if (present(liq_conv_mmr).and.present(liq_conv_dim)) then
+ do k = dimen%id_cloud_top, n_layer
+ do l = 1, n_profile
+ cld%condensed_mix_ratio(l, k, i) = liq_conv_mmr(l, k)
+ cld%condensed_dim_char(l, k, i) = min( max( liq_conv_dim(l, k), &
+ condensed_min_dim ), condensed_max_dim )
+ end do
+ end do
+ else
+ cmessage = 'Convective liquid MMR and effective radius not provided.'
+ ierr=i_err_fatal
+ CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ end if
+ end select
+ else
+ cmessage = 'Liquid cloud type not in spectral file.'
+ ierr=i_err_fatal
+ CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ end if
+ case (ip_phase_ice)
+ if (i_param_type <= 0) then
+ cld%i_condensed_param(i) = ip_ice_unparametrized
+ cmessage = 'Prescribed ice cloud not yet implemented.'
+ ierr=i_err_fatal
+ CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ else if (i_param_type > spectrum%dim%nd_ice_type) then
+ cmessage = 'Ice cloud type outside allowed range.'
+ ierr=i_err_fatal
+ CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ else if (spectrum%ice%l_ice_type(i_param_type)) then
+ ! Take parametrisation from spectral file
+ cld%i_condensed_param(i) = spectrum%ice%i_ice_parm(i_param_type)
+ cld%condensed_n_phf(i) = spectrum%ice%n_phf(i_param_type)
+ n_cloud_parameter = set_n_cloud_parameter( cld%i_condensed_param(i), &
+ cld%type_condensed(i), cld%condensed_n_phf(i) )
+ do j=1, spectrum%basic%n_band
+ do k=1, n_cloud_parameter
+ cld%condensed_param_list(k, i, j) &
+ = spectrum%ice%parm_list(k, j, i_param_type)
+ end do
+ end do
+ ! Assign ice mass mixing ratio and effective dimension
+ condensed_min_dim = spectrum%ice%parm_min_dim(i_param_type)
+ condensed_max_dim = spectrum%ice%parm_max_dim(i_param_type)
+ select case (cld%type_condensed(i))
+ case (ip_clcmp_st_ice)
+ if (present(ice_mmr).and.present(ice_dim)) then
+ do k = dimen%id_cloud_top, n_layer
+ do l = 1, n_profile
+ cld%condensed_mix_ratio(l, k, i) = ice_mmr(l, k)
+ cld%condensed_dim_char(l, k, i) = min( max( ice_dim(l, k), &
+ condensed_min_dim ), condensed_max_dim )
+ end do
+ end do
+ else
+ cmessage = 'Ice MMR and effective radius not provided.'
+ ierr=i_err_fatal
+ CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ end if
+ case (ip_clcmp_cnv_ice)
+ if (present(ice_conv_mmr).and.present(ice_conv_dim)) then
+ do k = dimen%id_cloud_top, n_layer
+ do l = 1, n_profile
+ cld%condensed_mix_ratio(l, k, i) = ice_conv_mmr(l, k)
+ cld%condensed_dim_char(l, k, i) = min( max( ice_conv_dim(l, k), &
+ condensed_min_dim ), condensed_max_dim )
+ end do
+ end do
+ else
+ cmessage = 'Convective ice MMR and effective radius not provided.'
+ ierr=i_err_fatal
+ CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ end if
+ end select
+ else
+ cmessage = 'Ice cloud type not in spectral file.'
+ ierr=i_err_fatal
+ CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ end if
+ end select
+end do
+
+! Set the decorrelation scalings for cloud vertical overlap
+if (present(dp_corr_strat)) then
+ cld%dp_corr_strat = dp_corr_strat
+else
+ cld%dp_corr_strat = 0.0_RealK
+end if
+if (present(dp_corr_conv)) then
+ cld%dp_corr_conv = dp_corr_conv
+else
+ cld%dp_corr_conv = 0.0_RealK
+end if
+
+
+!------------------------------------------------------------------------------
+! Set cloud amounts and convert mixing ratios to in-cloud values
+!------------------------------------------------------------------------------
+
+! Set cloud fractions
+select case (control%i_cloud_representation)
+case (ip_cloud_homogen)
+ cld%n_cloud_type = 1
+ do i = 1, cld%n_condensed
+ i_cloud_type(i) = ip_cloud_type_homogen
+ end do
+ if (present(cloud_frac)) then
+ do k = dimen%id_cloud_top, n_layer
+ do l = 1, n_profile
+ cld%frac_cloud(l, k, ip_cloud_type_homogen) = cloud_frac(l, k)
+ end do
+ end do
+ else
+ cmessage = 'Cloud fraction not provided.'
+ ierr=i_err_fatal
+ CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ end if
+case (ip_cloud_ice_water)
+ cld%n_cloud_type = 2
+ do i = 1, cld%n_condensed
+ select case (cld%type_condensed(i))
+ case (ip_clcmp_st_water)
+ i_cloud_type(i) = ip_cloud_type_water
+ case (ip_clcmp_st_ice)
+ i_cloud_type(i) = ip_cloud_type_ice
+ end select
+ end do
+ if (present(liq_frac).and.present(ice_frac).and.present(cloud_frac)) then
+ do k = dimen%id_cloud_top, n_layer
+ do l = 1, n_profile
+ if (liq_frac(l, k) + ice_frac(l, k) > eps) then
+ ! Split mixed phase fraction between ice and liquid
+ cld%frac_cloud(l, k, ip_cloud_type_water) = &
+ cloud_frac(l, k)*liq_frac(l, k) / (liq_frac(l, k)+ice_frac(l, k))
+ cld%frac_cloud(l, k, ip_cloud_type_ice) = &
+ cloud_frac(l, k)*ice_frac(l, k) / (liq_frac(l, k)+ice_frac(l, k))
+ else
+ cld%frac_cloud(l, k, ip_cloud_type_water) = 0.0_RealK
+ cld%frac_cloud(l, k, ip_cloud_type_ice) = 0.0_RealK
+ end if
+ end do
+ end do
+ else if (present(liq_frac).and.present(ice_frac)) then
+ do k = dimen%id_cloud_top, n_layer
+ do l = 1, n_profile
+ cld%frac_cloud(l, k, ip_cloud_type_water) = liq_frac(l, k)
+ cld%frac_cloud(l, k, ip_cloud_type_ice) = ice_frac(l, k)
+ end do
+ end do
+ else
+ cmessage = 'Liquid and ice cloud fractions not provided.'
+ ierr=i_err_fatal
+ CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ end if
+case (ip_cloud_conv_strat)
+ cld%n_cloud_type = 2
+ do i = 1, cld%n_condensed
+ select case (cld%type_condensed(i))
+ case (ip_clcmp_st_water)
+ i_cloud_type(i) = ip_cloud_type_strat
+ case (ip_clcmp_st_ice)
+ i_cloud_type(i) = ip_cloud_type_strat
+ case (ip_clcmp_cnv_water)
+ i_cloud_type(i) = ip_cloud_type_conv
+ case (ip_clcmp_cnv_ice)
+ i_cloud_type(i) = ip_cloud_type_conv
+ end select
+ end do
+ if (present(cloud_frac).and.present(conv_frac)) then
+ do k = dimen%id_cloud_top, n_layer
+ do l = 1, n_profile
+ cld%frac_cloud(l, k, ip_cloud_type_strat) = cloud_frac(l, k)
+ cld%frac_cloud(l, k, ip_cloud_type_conv) = conv_frac(l, k)
+ end do
+ end do
+ else
+ cmessage = 'Cloud fraction and convective cloud fraction not provided.'
+ ierr=i_err_fatal
+ CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ end if
+case (ip_cloud_csiw)
+ cld%n_cloud_type = 4
+ do i = 1, cld%n_condensed
+ select case (cld%type_condensed(i))
+ case (ip_clcmp_st_water)
+ i_cloud_type(i) = ip_cloud_type_sw
+ case (ip_clcmp_st_ice)
+ i_cloud_type(i) = ip_cloud_type_si
+ case (ip_clcmp_cnv_water)
+ i_cloud_type(i) = ip_cloud_type_cw
+ case (ip_clcmp_cnv_ice)
+ i_cloud_type(i) = ip_cloud_type_ci
+ end select
+ end do
+ if (present(liq_frac).and.present(ice_frac).and.present(cloud_frac)) then
+ do k = dimen%id_cloud_top, n_layer
+ do l = 1, n_profile
+ if (liq_frac(l, k) + ice_frac(l, k) > eps) then
+ ! Split mixed phase fraction between ice and liquid
+ cld%frac_cloud(l, k, ip_cloud_type_sw) = &
+ cloud_frac(l, k)*liq_frac(l, k) / (liq_frac(l, k)+ice_frac(l, k))
+ cld%frac_cloud(l, k, ip_cloud_type_si) = &
+ cloud_frac(l, k)*ice_frac(l, k) / (liq_frac(l, k)+ice_frac(l, k))
+ else
+ cld%frac_cloud(l, k, ip_cloud_type_sw) = 0.0_RealK
+ cld%frac_cloud(l, k, ip_cloud_type_si) = 0.0_RealK
+ end if
+ end do
+ end do
+ else if (present(liq_frac).and.present(ice_frac)) then
+ do k = dimen%id_cloud_top, n_layer
+ do l = 1, n_profile
+ cld%frac_cloud(l, k, ip_cloud_type_sw) = liq_frac(l, k)
+ cld%frac_cloud(l, k, ip_cloud_type_si) = ice_frac(l, k)
+ end do
+ end do
+ else
+ cmessage = 'Liquid and ice cloud fractions not provided.'
+ ierr=i_err_fatal
+ CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ end if
+ if (present(liq_conv_frac).and.present(ice_conv_frac).and. &
+ present(conv_frac)) then
+ do k = dimen%id_cloud_top, n_layer
+ do l = 1, n_profile
+ if (liq_conv_frac(l, k) + ice_conv_frac(l, k) > eps) then
+ ! Split mixed phase fraction between ice and liquid
+ cld%frac_cloud(l, k, ip_cloud_type_cw) = conv_frac(l, k) &
+ *liq_conv_frac(l, k) / (liq_conv_frac(l, k)+ice_conv_frac(l, k))
+ cld%frac_cloud(l, k, ip_cloud_type_ci) = conv_frac(l, k) &
+ *ice_conv_frac(l, k) / (liq_conv_frac(l, k)+ice_conv_frac(l, k))
+ else
+ cld%frac_cloud(l, k, ip_cloud_type_cw) = 0.0_RealK
+ cld%frac_cloud(l, k, ip_cloud_type_ci) = 0.0_RealK
+ end if
+ end do
+ end do
+ else if (present(liq_conv_frac).and.present(ice_conv_frac)) then
+ do k = dimen%id_cloud_top, n_layer
+ do l = 1, n_profile
+ cld%frac_cloud(l, k, ip_cloud_type_cw) = liq_conv_frac(l, k)
+ cld%frac_cloud(l, k, ip_cloud_type_ci) = ice_conv_frac(l, k)
+ end do
+ end do
+ else
+ cmessage = 'Liquid and ice convective cloud fractions not provided.'
+ ierr=i_err_fatal
+ CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ end if
+end select
+
+! Convert mass mixing ratios to in-cloud values
+do i = 1, cld%n_condensed
+ do k = dimen%id_cloud_top, n_layer
+ do l = 1, n_profile
+ cld%condensed_mix_ratio(l, k, i) = cld%condensed_mix_ratio(l, k, i) &
+ / max(cld%frac_cloud(l, k, i_cloud_type(i)), eps)
+ end do
+ end do
+end do
+
+! Normalise the cloud fractions
+do k = dimen%id_cloud_top, n_layer
+ do l = 1, n_profile
+ cld%w_cloud(l, k) = sum(cld%frac_cloud(l, k, 1:cld%n_cloud_type))
+ if (cld%w_cloud(l, k) > min_cloud_fraction) then
+ do j=1, cld%n_cloud_type
+ cld%frac_cloud(l, k, j) = cld%frac_cloud(l, k, j) / cld%w_cloud(l, k)
+ end do
+ else
+ cld%w_cloud(l, k) = 0.0_RealK
+ cld%frac_cloud(l, k, 1:cld%n_cloud_type) = 0.0_RealK
+ end if
+ if (cld%w_cloud(l, k) > 1.0_RealK + min_cloud_fraction) then
+ cmessage = 'Cloud fraction greater than 1.'
+ ierr=i_err_fatal
+ CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ else if (cld%w_cloud(l, k) > 1.0_RealK) then
+ cld%w_cloud(l, k) = 1.0_RealK
+ end if
+ end do
+end do
+
+end subroutine set_cld
+end module socrates_set_cld
From 0b6221e9bb6cec6a35215f7ca6e3df7e0db73e28 Mon Sep 17 00:00:00 2001
From: sit23
Date: Fri, 7 Sep 2018 12:54:05 +0100
Subject: [PATCH 011/304] Changes to pass socrates clouds from simple cloud
scheme.
---
.../socrates/interface/read_control.F90 | 8 +-
.../socrates/interface/socrates_calc.F90 | 33 ++++--
.../interface/socrates_config_mod.f90 | 6 +-
.../socrates/interface/socrates_interface.F90 | 54 ++++++++--
.../socrates/interface/socrates_set_cld.F90 | 101 ++++++++++--------
.../driver/solo/idealized_moist_phys.F90 | 5 +-
src/extra/model/socrates/path_names | 2 +-
7 files changed, 147 insertions(+), 62 deletions(-)
diff --git a/src/atmos_param/socrates/interface/read_control.F90 b/src/atmos_param/socrates/interface/read_control.F90
index 5ed7fae81..92d5eeefb 100644
--- a/src/atmos_param/socrates/interface/read_control.F90
+++ b/src/atmos_param/socrates/interface/read_control.F90
@@ -15,7 +15,7 @@ SUBROUTINE read_control(control, spectrum)
USE rad_pcf
USE def_control, ONLY: StrCtrl, allocate_control
USE def_spectrum, ONLY: StrSpecData
-USE socrates_config_mod, ONLY: l_planet_grey_surface, inc_h2o, inc_co2, inc_co, inc_o3, inc_n2o, inc_ch4, inc_o2, inc_so2, inc_cfc11, inc_cfc12, inc_cfc113, inc_hcfc22, inc_hfc134a
+USE socrates_config_mod, ONLY: l_planet_grey_surface, inc_h2o, inc_co2, inc_co, inc_o3, inc_n2o, inc_ch4, inc_o2, inc_so2, inc_cfc11, inc_cfc12, inc_cfc113, inc_hcfc22, inc_hfc134a, account_for_clouds_in_socrates
IMPLICIT NONE
@@ -93,7 +93,11 @@ SUBROUTINE read_control(control, spectrum)
control%i_gas_overlap = ip_overlap_k_eqv_scl
! Properties of clouds
-control%i_cloud_representation = ip_cloud_off
+if (account_for_clouds_in_socrates) then
+ control%i_cloud_representation = ip_cloud_ice_water
+else
+ control%i_cloud_representation = ip_cloud_off
+end if
control%i_overlap = ip_max_rand
control%i_inhom = ip_homogeneous
diff --git a/src/atmos_param/socrates/interface/socrates_calc.F90 b/src/atmos_param/socrates/interface/socrates_calc.F90
index 6a07a8d3b..ab545635e 100644
--- a/src/atmos_param/socrates/interface/socrates_calc.F90
+++ b/src/atmos_param/socrates/interface/socrates_calc.F90
@@ -33,6 +33,7 @@ subroutine socrates_calc(Time_diag,control, spectrum,
t_rad_surf, cos_zenith_angle, solar_irrad, orog_corr, &
l_planet_grey_surface, planet_albedo, planet_emissivity, &
layer_heat_capacity, &
+ cld_frac, reff_rad, mmr_cl_rad, &
flux_direct, flux_down, flux_up, heating_rate, spectral_olr)
use rad_pcf
@@ -45,12 +46,12 @@ subroutine socrates_calc(Time_diag,control, spectrum,
use def_aer, only: StrAer, deallocate_aer, deallocate_aer_prsc
use def_out, only: StrOut, deallocate_out
-use set_control_mod, only: set_control
-use set_dimen_mod, only: set_dimen
-use set_atm_mod, only: set_atm
-use set_bound_mod, only: set_bound
-use set_cld_mod, only: set_cld
-use set_aer_mod, only: set_aer
+use set_control_mod, only: set_control
+use set_dimen_mod, only: set_dimen
+use set_atm_mod, only: set_atm
+use set_bound_mod, only: set_bound
+use socrates_set_cld, only: set_cld
+use set_aer_mod, only: set_aer
use soc_constants_mod, only: i_def, r_def
@@ -114,6 +115,15 @@ subroutine socrates_calc(Time_diag,control, spectrum,
real(r_def), intent(in) :: layer_heat_capacity(n_profile, n_layer)
! Heat capacity of layer
+real(r_def), intent(in) :: cld_frac(n_profile, n_layer)
+! Cloud fraction at layer centres
+
+real(r_def), intent(in) :: reff_rad(n_profile, n_layer)
+! Cloud liquid particle radius from simple cloud scheme
+
+real(r_def), intent(in) :: mmr_cl_rad(n_profile, n_layer)
+! Cloud liquid mmr at layer centres
+
real(r_def), intent(out) :: flux_direct(n_profile, 0:n_layer)
! Direct (unscattered) downwards flux (Wm-2)
real(r_def), intent(out) :: flux_down(n_profile, 0:n_layer)
@@ -151,6 +161,7 @@ subroutine socrates_calc(Time_diag,control, spectrum,
!DIAG Diagnostic
logical :: used
+real(r_def) :: zeros_cld(n_profile, n_layer)
call set_control(control)
@@ -165,7 +176,15 @@ subroutine socrates_calc(Time_diag,control, spectrum,
t_rad_surf, cos_zenith_angle, solar_irrad, orog_corr, &
l_planet_grey_surface, planet_albedo, planet_emissivity)
-call set_cld(control, dimen, spectrum, cld, n_profile)
+! call set_cld(control, dimen, spectrum, cld, n_profile)
+
+call set_cld(cld, control, dimen, spectrum, n_profile, n_layer, &
+ liq_frac = cld_frac, &
+ ice_frac = zeros_cld, &
+ liq_mmr = mmr_cl_rad, &
+ ice_mmr = zeros_cld, &
+ liq_dim = reff_rad, &
+ ice_dim = zeros_cld )
call set_aer(control, dimen, spectrum, aer, n_profile)
diff --git a/src/atmos_param/socrates/interface/socrates_config_mod.f90 b/src/atmos_param/socrates/interface/socrates_config_mod.f90
index 7829a2dc0..014227dbb 100644
--- a/src/atmos_param/socrates/interface/socrates_config_mod.f90
+++ b/src/atmos_param/socrates/interface/socrates_config_mod.f90
@@ -37,7 +37,9 @@ module socrates_config_mod
logical :: input_co2_mmr=.false. !Socrates wants input concentrations as mmr not vmr, so need to make sure input data supplied is converted if necessary
logical :: use_pressure_interp_for_half_levels = .False. !By default (.False.) does linear interpolation in height for half-level temperatures. True does linear interp using pressure.
-
+
+ logical :: account_for_clouds_in_socrates = .false. !Do we want to account for the radiative effects of clouds in socrates?
+
! Incoming radiation options for namelist
integer :: solday=0 ! if >0, do perpetual run corresponding to day of the year = solday \in [0,days per year]
@@ -122,6 +124,6 @@ module socrates_config_mod
hfc134a_mix_ratio, &
inc_h2o, inc_co2, inc_co, inc_o3, inc_n2o, inc_ch4, inc_o2, &
inc_so2, inc_cfc11, inc_cfc12, inc_cfc113, inc_hcfc22, inc_hfc134a, &
- use_pressure_interp_for_half_levels
+ use_pressure_interp_for_half_levels, account_for_clouds_in_socrates
end module socrates_config_mod
diff --git a/src/atmos_param/socrates/interface/socrates_interface.F90 b/src/atmos_param/socrates/interface/socrates_interface.F90
index df3fdb547..6a4f5eaa4 100644
--- a/src/atmos_param/socrates/interface/socrates_interface.F90
+++ b/src/atmos_param/socrates/interface/socrates_interface.F90
@@ -403,6 +403,7 @@ end subroutine socrates_init
! -----------------------------------------------------------------------------
subroutine socrates_interface(Time_diag, rlat, rlon, soc_lw_mode, &
fms_temp, fms_spec_hum, fms_ozone, fms_co2, fms_t_surf, fms_p_full, fms_p_half, fms_z_full, fms_z_half, fms_albedo, fms_coszen, fms_rrsun, n_profile, n_layer, &
+ fms_cld_frac, fms_reff_rad, fms_mmr_cl_rad, &
output_heating_rate, output_flux_down, output_flux_up, output_soc_spectral_olr, output_flux_direct, t_half_level_out )
use realtype_rd
@@ -441,7 +442,7 @@ subroutine socrates_interface(Time_diag, rlat, rlon, soc_lw_mode, &
real(r_def), intent(in) :: rlat(:,:)
real(r_def), intent(in) :: fms_z_full(:,:,:), fms_z_half(:,:,:)
real(r_def), intent(in) :: fms_rrsun
-
+ real(r_def), intent(in) :: fms_cld_frac(:,:,:), fms_reff_rad(:,:,:), fms_mmr_cl_rad(:,:,:)
! Output arrays
real(r_def), intent(out) :: output_heating_rate(:,:,:)
@@ -462,7 +463,7 @@ subroutine socrates_interface(Time_diag, rlat, rlon, soc_lw_mode, &
soc_heating_rate, input_o3_mixing_ratio, &
input_co2_mixing_ratio,z_full_reshaped
real, dimension(n_profile, 0:n_layer) :: input_p_level, input_t_level, soc_flux_direct, &
- soc_flux_down, soc_flux_up, z_half_reshaped
+ soc_flux_down, soc_flux_up, z_half_reshaped, input_cld_frac, input_reff_rad, input_mmr_cl_rad
real, dimension(n_profile) :: input_t_surf, input_cos_zenith_angle, input_solar_irrad, &
input_orog_corr, input_planet_albedo
@@ -502,7 +503,11 @@ subroutine socrates_interface(Time_diag, rlat, rlon, soc_lw_mode, &
input_t = reshape(fms_temp(:,:,:),(/si*sj,sk /))
input_p = reshape(fms_p_full(:,:,:),(/si*sj,sk /))
input_p_level = reshape(fms_p_half(:,:,:),(/si*sj,sk+1 /))
-
+
+ input_cld_frac = reshape(fms_cld_frac(:,:,:),(/si*sj,sk /))
+ input_reff_rad = reshape(fms_reff_rad(:,:,:),(/si*sj,sk /))
+ input_mmr_cl_rad = reshape(fms_mmr_cl_rad(:,:,:),(/si*sj,sk/))
+
if (account_for_effect_of_water == .true.) then
input_mixing_ratio = reshape(fms_spec_hum(:,:,:) / (1. - fms_spec_hum(:,:,:)),(/si*sj,sk /)) !Mass mixing ratio = q / (1-q)
else
@@ -623,6 +628,9 @@ subroutine socrates_interface(Time_diag, rlat, rlon, soc_lw_mode, &
input_planet_albedo(idx_chunk_start:idx_chunk_end), &
input_planet_emissivity, &
input_layer_heat_capacity(idx_chunk_start:idx_chunk_end,:), &
+ input_cld_frac(idx_chunk_start:idx_chunk_end,:), &
+ input_reff_rad(idx_chunk_start:idx_chunk_end,:), &
+ input_mmr_cl_rad(idx_chunk_start:idx_chunk_end,:), &
soc_flux_direct(idx_chunk_start:idx_chunk_end,:), &
soc_flux_down(idx_chunk_start:idx_chunk_end,:), &
soc_flux_up(idx_chunk_start:idx_chunk_end,:), &
@@ -649,6 +657,9 @@ subroutine socrates_interface(Time_diag, rlat, rlon, soc_lw_mode, &
input_planet_albedo(idx_chunk_start:idx_chunk_end), &
input_planet_emissivity, &
input_layer_heat_capacity(idx_chunk_start:idx_chunk_end,:), &
+ input_cld_frac(idx_chunk_start:idx_chunk_end,:), &
+ input_reff_rad(idx_chunk_start:idx_chunk_end,:), &
+ input_mmr_cl_rad(idx_chunk_start:idx_chunk_end,:), &
soc_flux_direct(idx_chunk_start:idx_chunk_end,:), &
soc_flux_down(idx_chunk_start:idx_chunk_end,:), &
soc_flux_up(idx_chunk_start:idx_chunk_end,:), &
@@ -674,7 +685,7 @@ subroutine socrates_interface(Time_diag, rlat, rlon, soc_lw_mode, &
end subroutine socrates_interface
subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf_in, p_full_in, p_half_in, z_full_in, z_half_in, albedo_in, &
- temp_tend, net_surf_sw_down, surf_lw_down, delta_t)
+ temp_tend, net_surf_sw_down, surf_lw_down, delta_t, do_cloud_simple, cf_rad, reff_rad, qcl_rad)
use astronomy_mod, only: diurnal_solar
use constants_mod, only: pi, wtmco2, wtmozone, rdgas, gas_constant
@@ -689,11 +700,13 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
real, intent(inout), dimension(:,:,:) :: temp_tend
real, intent(out), dimension(:,:) :: net_surf_sw_down, surf_lw_down
real, intent(in) :: delta_t
+ logical, intent(in) :: do_cloud_simple
+ real, intent(in), dimension(:,:,:) :: cf_rad, reff_rad, qcl_rad
integer(i_def) :: n_profile, n_layer
real(r_def), dimension(size(temp_in,1), size(temp_in,2)) :: t_surf_for_soc, rad_lat_soc, rad_lon_soc, albedo_soc
- real(r_def), dimension(size(temp_in,1), size(temp_in,2), size(temp_in,3)) :: tg_tmp_soc, q_soc, ozone_soc, co2_soc, p_full_soc, output_heating_rate_sw, output_heating_rate_lw, output_heating_rate_total, output_soc_flux_sw_down, output_soc_flux_sw_up, output_soc_flux_lw_down, output_soc_flux_lw_up, z_full_soc
+ real(r_def), dimension(size(temp_in,1), size(temp_in,2), size(temp_in,3)) :: tg_tmp_soc, q_soc, ozone_soc, co2_soc, p_full_soc, output_heating_rate_sw, output_heating_rate_lw, output_heating_rate_total, output_soc_flux_sw_down, output_soc_flux_sw_up, output_soc_flux_lw_down, output_soc_flux_lw_up, z_full_soc, cld_frac_soc, reff_rad_soc, mmr_cl_rad_soc, qcl_rad_soc
real(r_def), dimension(size(temp_in,1), size(temp_in,2), size(temp_in,3)+1) :: p_half_soc, t_half_out, z_half_soc
logical :: soc_lw_mode, used
@@ -899,6 +912,33 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
endif
+ if(do_cloud_simple.and.account_for_clouds_in_socrates) then
+ cld_frac_soc = REAL(cf_rad, kind(r_def))
+ reff_rad_soc = REAL(reff_rad, kind(r_def))
+
+ qcl_rad_soc = REAL(qcl_rad, kind(r_def))
+ mmr_cl_rad_soc = qcl_rad_soc / (1.0 - qcl_rad_soc)
+
+ elseif(do_cloud_simple.and..not.account_for_clouds_in_socrates) then
+
+ call error_mesg( 'run_socrates', &
+ 'do_cloud_simple is True but account_for_clouds_in_socrates is False. Radiative effects of clouds NOT accounted for', WARNING)
+
+ cld_frac_soc = 0.
+ reff_rad_soc = 0.
+ mmr_cl_rad_soc = 0.
+
+ elseif(.not.do_cloud_simple.and.account_for_clouds_in_socrates) then
+
+ call error_mesg( 'run_socrates', &
+ 'do_cloud_simple is False but account_for_clouds_in_socrates is True. Radiative effects of clouds NOT accounted for', WARNING)
+
+ cld_frac_soc = 0.
+ reff_rad_soc = 0.
+ mmr_cl_rad_soc = 0.
+
+ endif
+
n_profile = INT(size(temp_in,2)*size(temp_in,1), kind(i_def))
n_layer = INT(size(temp_in,3), kind(i_def))
t_surf_for_soc = REAL(t_surf_in(:,:), kind(r_def))
@@ -921,7 +961,7 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
CALL socrates_interface(Time, rad_lat_soc, rad_lon_soc, soc_lw_mode, &
tg_tmp_soc, q_soc, ozone_soc, co2_soc, t_surf_for_soc, p_full_soc, p_half_soc, z_full_soc, z_half_soc, albedo_soc, coszen, rrsun, n_profile, n_layer, &
- output_heating_rate_lw, output_soc_flux_lw_down, output_soc_flux_lw_up, output_soc_spectral_olr = outputted_soc_spectral_olr, t_half_level_out = t_half_out)
+ output_heating_rate_lw, output_soc_flux_lw_down, output_soc_flux_lw_up, cld_frac_soc, reff_rad_soc, mmr_cl_rad_soc, output_soc_spectral_olr = outputted_soc_spectral_olr, t_half_level_out = t_half_out)
tg_tmp_soc = tg_tmp_soc + output_heating_rate_lw*delta_t !Output heating rate in K/s, so is a temperature tendency
surf_lw_down(:,:) = REAL(output_soc_flux_lw_down(:,:, n_layer))
@@ -936,7 +976,7 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
soc_lw_mode = .FALSE.
CALL socrates_interface(Time, rad_lat_soc, rad_lon_soc, soc_lw_mode, &
tg_tmp_soc, q_soc, ozone_soc, co2_soc, t_surf_for_soc, p_full_soc, p_half_soc, z_full_soc, z_half_soc, albedo_soc, coszen, rrsun, n_profile, n_layer, &
- output_heating_rate_sw, output_soc_flux_sw_down, output_soc_flux_sw_up)
+ output_heating_rate_sw, output_soc_flux_sw_down, output_soc_flux_sw_up, cld_frac_soc, reff_rad_soc, mmr_cl_rad_soc)
tg_tmp_soc = tg_tmp_soc + output_heating_rate_sw*delta_t !Output heating rate in K/s, so is a temperature tendency
net_surf_sw_down(:,:) = REAL(output_soc_flux_sw_down(:,:, n_layer)-output_soc_flux_sw_up(:,:,n_layer) )
diff --git a/src/atmos_param/socrates/interface/socrates_set_cld.F90 b/src/atmos_param/socrates/interface/socrates_set_cld.F90
index 25e47a340..d98b215a6 100644
--- a/src/atmos_param/socrates/interface/socrates_set_cld.F90
+++ b/src/atmos_param/socrates/interface/socrates_set_cld.F90
@@ -23,7 +23,7 @@ subroutine set_cld(cld, control, dimen, spectrum, n_profile, n_layer, &
use def_control, only: StrCtrl
use def_dimen, only: StrDim
use def_spectrum, only: StrSpecData
-use realtype_rd, only: RealK
+use soc_constants_mod, only: i_def, r_def
use rad_pcf, only: &
ip_cloud_homogen, ip_cloud_ice_water, ip_cloud_conv_strat, ip_cloud_csiw, &
ip_clcmp_st_water, ip_clcmp_st_ice, ip_clcmp_cnv_water, ip_clcmp_cnv_ice, &
@@ -32,8 +32,8 @@ subroutine set_cld(cld, control, dimen, spectrum, n_profile, n_layer, &
ip_cloud_type_strat, ip_cloud_type_conv, &
ip_cloud_type_sw, ip_cloud_type_si, ip_cloud_type_cw, ip_cloud_type_ci, &
ip_drop_unparametrized, ip_ice_unparametrized, i_normal, i_err_fatal
-use ereport_mod, only: ereport
-use errormessagelength_mod, only: errormessagelength
+
+use fms_mod, only: error_mesg, FATAL
implicit none
@@ -50,10 +50,10 @@ subroutine set_cld(cld, control, dimen, spectrum, n_profile, n_layer, &
! Spectral data:
type(StrSpecData), intent(in) :: spectrum
-integer, intent(in) :: n_profile
-integer, intent(in) :: n_layer
+integer(i_def), intent(in) :: n_profile
+integer(i_def), intent(in) :: n_layer
-real(RealK), intent(in), optional :: &
+real(r_def), intent(in), optional :: &
cloud_frac(:,:), conv_frac(:,:), &
liq_frac(:,:), ice_frac(:,:), liq_conv_frac(:,:), ice_conv_frac(:,:), &
liq_mmr(:,:), ice_mmr(:,:), liq_conv_mmr(:,:), ice_conv_mmr(:,:), &
@@ -61,7 +61,7 @@ subroutine set_cld(cld, control, dimen, spectrum, n_profile, n_layer, &
! Liquid and ice cloud fractions, gridbox mean mixing ratios, and
! effective dimensions
-real(RealK), intent(in), optional :: dp_corr_strat, dp_corr_conv
+real(r_def), intent(in), optional :: dp_corr_strat, dp_corr_conv
! Decorrelation pressure scales for cloud vertical overlap
@@ -73,16 +73,16 @@ subroutine set_cld(cld, control, dimen, spectrum, n_profile, n_layer, &
integer :: i_cloud_type(dimen%nd_cloud_component)
! Types of cloud to which each component contributes
-real(RealK) :: condensed_min_dim
-real(RealK) :: condensed_max_dim
+real(r_def) :: condensed_min_dim
+real(r_def) :: condensed_max_dim
! Minimum and maximum dimensions of each condensed component
-real(RealK) :: eps = EPSILON(1.0)
-real(RealK) :: min_cloud_fraction = 0.0001
+real(r_def) :: eps = EPSILON(1.0)
+real(r_def) :: min_cloud_fraction = 0.0001
integer :: ierr = i_normal
character (len=*), parameter :: RoutineName = 'SET_CLD'
-character (len=errormessagelength) :: cmessage
+character (len=128) :: cmessage
! Functions called
integer, external :: set_n_cloud_parameter
@@ -136,7 +136,8 @@ subroutine set_cld(cld, control, dimen, spectrum, n_profile, n_layer, &
else
cmessage = 'Cloud on, but no condensed components included.'
ierr=i_err_fatal
- CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+! CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ call error_mesg(ModuleName,cmessage, FATAL)
end if
do i=1, cld%n_condensed
@@ -161,11 +162,13 @@ subroutine set_cld(cld, control, dimen, spectrum, n_profile, n_layer, &
cld%i_condensed_param(i) = ip_drop_unparametrized
cmessage = 'Prescribed liquid cloud not yet implemented.'
ierr=i_err_fatal
- CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ ! CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ call error_mesg(ModuleName,cmessage, FATAL)
else if (i_param_type > spectrum%dim%nd_drop_type) then
cmessage = 'Liquid cloud type outside allowed range.'
ierr=i_err_fatal
- CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ ! CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ call error_mesg(ModuleName,cmessage, FATAL)
else if (spectrum%drop%l_drop_type(i_param_type)) then
! Take parametrisation from spectral file
cld%i_condensed_param(i) = spectrum%drop%i_drop_parm(i_param_type)
@@ -195,7 +198,8 @@ subroutine set_cld(cld, control, dimen, spectrum, n_profile, n_layer, &
else
cmessage = 'Liquid MMR and effective radius not provided.'
ierr=i_err_fatal
- CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ ! CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ call error_mesg(ModuleName,cmessage, FATAL)
end if
case (ip_clcmp_cnv_water)
if (present(liq_conv_mmr).and.present(liq_conv_dim)) then
@@ -209,24 +213,28 @@ subroutine set_cld(cld, control, dimen, spectrum, n_profile, n_layer, &
else
cmessage = 'Convective liquid MMR and effective radius not provided.'
ierr=i_err_fatal
- CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ ! CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ call error_mesg(ModuleName,cmessage, FATAL)
end if
end select
else
cmessage = 'Liquid cloud type not in spectral file.'
ierr=i_err_fatal
- CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ ! CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ call error_mesg(ModuleName,cmessage, FATAL)
end if
case (ip_phase_ice)
if (i_param_type <= 0) then
cld%i_condensed_param(i) = ip_ice_unparametrized
cmessage = 'Prescribed ice cloud not yet implemented.'
ierr=i_err_fatal
- CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ ! CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ call error_mesg(ModuleName,cmessage, FATAL)
else if (i_param_type > spectrum%dim%nd_ice_type) then
cmessage = 'Ice cloud type outside allowed range.'
ierr=i_err_fatal
- CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ ! CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ call error_mesg(ModuleName,cmessage, FATAL)
else if (spectrum%ice%l_ice_type(i_param_type)) then
! Take parametrisation from spectral file
cld%i_condensed_param(i) = spectrum%ice%i_ice_parm(i_param_type)
@@ -255,7 +263,8 @@ subroutine set_cld(cld, control, dimen, spectrum, n_profile, n_layer, &
else
cmessage = 'Ice MMR and effective radius not provided.'
ierr=i_err_fatal
- CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ ! CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ call error_mesg(ModuleName,cmessage, FATAL)
end if
case (ip_clcmp_cnv_ice)
if (present(ice_conv_mmr).and.present(ice_conv_dim)) then
@@ -269,13 +278,15 @@ subroutine set_cld(cld, control, dimen, spectrum, n_profile, n_layer, &
else
cmessage = 'Convective ice MMR and effective radius not provided.'
ierr=i_err_fatal
- CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ ! CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ call error_mesg(ModuleName,cmessage, FATAL)
end if
end select
else
cmessage = 'Ice cloud type not in spectral file.'
ierr=i_err_fatal
- CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ ! CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ call error_mesg(ModuleName,cmessage, FATAL)
end if
end select
end do
@@ -284,12 +295,12 @@ subroutine set_cld(cld, control, dimen, spectrum, n_profile, n_layer, &
if (present(dp_corr_strat)) then
cld%dp_corr_strat = dp_corr_strat
else
- cld%dp_corr_strat = 0.0_RealK
+ cld%dp_corr_strat = 0.0_r_def
end if
if (present(dp_corr_conv)) then
cld%dp_corr_conv = dp_corr_conv
else
- cld%dp_corr_conv = 0.0_RealK
+ cld%dp_corr_conv = 0.0_r_def
end if
@@ -313,7 +324,8 @@ subroutine set_cld(cld, control, dimen, spectrum, n_profile, n_layer, &
else
cmessage = 'Cloud fraction not provided.'
ierr=i_err_fatal
- CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ ! CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ call error_mesg(ModuleName,cmessage, FATAL)
end if
case (ip_cloud_ice_water)
cld%n_cloud_type = 2
@@ -335,8 +347,8 @@ subroutine set_cld(cld, control, dimen, spectrum, n_profile, n_layer, &
cld%frac_cloud(l, k, ip_cloud_type_ice) = &
cloud_frac(l, k)*ice_frac(l, k) / (liq_frac(l, k)+ice_frac(l, k))
else
- cld%frac_cloud(l, k, ip_cloud_type_water) = 0.0_RealK
- cld%frac_cloud(l, k, ip_cloud_type_ice) = 0.0_RealK
+ cld%frac_cloud(l, k, ip_cloud_type_water) = 0.0_r_def
+ cld%frac_cloud(l, k, ip_cloud_type_ice) = 0.0_r_def
end if
end do
end do
@@ -350,7 +362,8 @@ subroutine set_cld(cld, control, dimen, spectrum, n_profile, n_layer, &
else
cmessage = 'Liquid and ice cloud fractions not provided.'
ierr=i_err_fatal
- CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ ! CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ call error_mesg(ModuleName,cmessage, FATAL)
end if
case (ip_cloud_conv_strat)
cld%n_cloud_type = 2
@@ -376,7 +389,8 @@ subroutine set_cld(cld, control, dimen, spectrum, n_profile, n_layer, &
else
cmessage = 'Cloud fraction and convective cloud fraction not provided.'
ierr=i_err_fatal
- CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ ! CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ call error_mesg(ModuleName,cmessage, FATAL)
end if
case (ip_cloud_csiw)
cld%n_cloud_type = 4
@@ -402,8 +416,8 @@ subroutine set_cld(cld, control, dimen, spectrum, n_profile, n_layer, &
cld%frac_cloud(l, k, ip_cloud_type_si) = &
cloud_frac(l, k)*ice_frac(l, k) / (liq_frac(l, k)+ice_frac(l, k))
else
- cld%frac_cloud(l, k, ip_cloud_type_sw) = 0.0_RealK
- cld%frac_cloud(l, k, ip_cloud_type_si) = 0.0_RealK
+ cld%frac_cloud(l, k, ip_cloud_type_sw) = 0.0_r_def
+ cld%frac_cloud(l, k, ip_cloud_type_si) = 0.0_r_def
end if
end do
end do
@@ -417,7 +431,8 @@ subroutine set_cld(cld, control, dimen, spectrum, n_profile, n_layer, &
else
cmessage = 'Liquid and ice cloud fractions not provided.'
ierr=i_err_fatal
- CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ ! CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ call error_mesg(ModuleName,cmessage, FATAL)
end if
if (present(liq_conv_frac).and.present(ice_conv_frac).and. &
present(conv_frac)) then
@@ -430,8 +445,8 @@ subroutine set_cld(cld, control, dimen, spectrum, n_profile, n_layer, &
cld%frac_cloud(l, k, ip_cloud_type_ci) = conv_frac(l, k) &
*ice_conv_frac(l, k) / (liq_conv_frac(l, k)+ice_conv_frac(l, k))
else
- cld%frac_cloud(l, k, ip_cloud_type_cw) = 0.0_RealK
- cld%frac_cloud(l, k, ip_cloud_type_ci) = 0.0_RealK
+ cld%frac_cloud(l, k, ip_cloud_type_cw) = 0.0_r_def
+ cld%frac_cloud(l, k, ip_cloud_type_ci) = 0.0_r_def
end if
end do
end do
@@ -445,7 +460,8 @@ subroutine set_cld(cld, control, dimen, spectrum, n_profile, n_layer, &
else
cmessage = 'Liquid and ice convective cloud fractions not provided.'
ierr=i_err_fatal
- CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ ! CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ call error_mesg(ModuleName,cmessage, FATAL)
end if
end select
@@ -468,15 +484,16 @@ subroutine set_cld(cld, control, dimen, spectrum, n_profile, n_layer, &
cld%frac_cloud(l, k, j) = cld%frac_cloud(l, k, j) / cld%w_cloud(l, k)
end do
else
- cld%w_cloud(l, k) = 0.0_RealK
- cld%frac_cloud(l, k, 1:cld%n_cloud_type) = 0.0_RealK
+ cld%w_cloud(l, k) = 0.0_r_def
+ cld%frac_cloud(l, k, 1:cld%n_cloud_type) = 0.0_r_def
end if
- if (cld%w_cloud(l, k) > 1.0_RealK + min_cloud_fraction) then
+ if (cld%w_cloud(l, k) > 1.0_r_def + min_cloud_fraction) then
cmessage = 'Cloud fraction greater than 1.'
ierr=i_err_fatal
- CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
- else if (cld%w_cloud(l, k) > 1.0_RealK) then
- cld%w_cloud(l, k) = 1.0_RealK
+ ! CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ call error_mesg(ModuleName,cmessage, FATAL)
+ else if (cld%w_cloud(l, k) > 1.0_r_def) then
+ cld%w_cloud(l, k) = 1.0_r_def
end if
end do
end do
diff --git a/src/atmos_spectral/driver/solo/idealized_moist_phys.F90 b/src/atmos_spectral/driver/solo/idealized_moist_phys.F90
index 6f63b36ac..ed49dcf23 100644
--- a/src/atmos_spectral/driver/solo/idealized_moist_phys.F90
+++ b/src/atmos_spectral/driver/solo/idealized_moist_phys.F90
@@ -938,6 +938,8 @@ subroutine idealized_moist_phys(Time, p_half, p_full, z_half, z_full, ug, vg, tg
endif
+! write(6,*) minval(cf_rad), maxval(cf_rad), minval(reff_rad), maxval(reff_rad), minval(qcl_rad), maxval(qcl_rad)
+
tmp1 = maxval(reff_rad)
tmp2 = maxval(cf_rad)
@@ -1053,7 +1055,8 @@ subroutine idealized_moist_phys(Time, p_half, p_full, z_half, z_full, ug, vg, tg
! Socrates interface
call run_socrates(Time, Time+Time_step, rad_lat, rad_lon, tg(:,:,:,previous), grid_tracers(:,:,:,previous,nsphum), t_surf(:,:), p_full(:,:,:,current), &
- p_half(:,:,:,current),z_full(:,:,:,current),z_half(:,:,:,current), albedo, dt_tg(:,:,:), net_surf_sw_down(:,:), surf_lw_down(:,:), delta_t)
+ p_half(:,:,:,current),z_full(:,:,:,current),z_half(:,:,:,current), albedo, dt_tg(:,:,:), net_surf_sw_down(:,:), surf_lw_down(:,:), delta_t, do_cloud_simple, cf_rad(:,:,:), reff_rad(:,:,:), &
+ qcl_rad(:,:,:) )
endif
#endif
diff --git a/src/extra/model/socrates/path_names b/src/extra/model/socrates/path_names
index 2f4dac9eb..7ec1ee810 100644
--- a/src/extra/model/socrates/path_names
+++ b/src/extra/model/socrates/path_names
@@ -583,7 +583,7 @@ atmos_param/socrates/src/trunk/src/general/calc_planck_tbl.f
atmos_param/socrates/src/trunk/src/general/read_word.f
atmos_param/socrates/interface/read_control.F90
atmos_param/socrates/interface/set_atm.F90
-atmos_param/socrates/interface/set_cld.F90
+atmos_param/socrates/interface/socrates_set_cld.F90
atmos_param/socrates/interface/set_dimen.F90
atmos_param/socrates/interface/socrates_config_mod.f90
atmos_param/socrates/interface/compress_spectrum.F90
From be650131e673e5e8232af3e3336f9f8587883e7a Mon Sep 17 00:00:00 2001
From: sit23
Date: Fri, 7 Sep 2018 13:02:38 +0100
Subject: [PATCH 012/304] Turned socrates clouds on for the first time, and hit
error where cloud fraction is above one. Check this with Penny.
---
.../socrates/interface/socrates_interface.F90 | 27 ++++++++++++-------
.../driver/solo/idealized_moist_phys.F90 | 2 +-
2 files changed, 19 insertions(+), 10 deletions(-)
diff --git a/src/atmos_param/socrates/interface/socrates_interface.F90 b/src/atmos_param/socrates/interface/socrates_interface.F90
index 6a4f5eaa4..37fd7a59f 100644
--- a/src/atmos_param/socrates/interface/socrates_interface.F90
+++ b/src/atmos_param/socrates/interface/socrates_interface.F90
@@ -77,7 +77,7 @@ MODULE socrates_interface_mod
CONTAINS
- SUBROUTINE socrates_init(is, ie, js, je, num_levels, axes, Time, lat, lonb, latb, delta_t_atmos)
+ SUBROUTINE socrates_init(is, ie, js, je, num_levels, axes, Time, lat, lonb, latb, delta_t_atmos, do_cloud_simple)
!! Initialises Socrates spectra, arrays, and constants
USE astronomy_mod, only: astronomy_init
@@ -91,6 +91,7 @@ SUBROUTINE socrates_init(is, ie, js, je, num_levels, axes, Time, lat, lonb, latb
INTEGER, INTENT(in) :: is, ie, js, je, num_levels
REAL, INTENT(in) , DIMENSION(:,:) :: lat
REAL, INTENT(in) , DIMENSION(:,:) :: lonb, latb
+ LOGICAL, INTENT(IN) :: do_cloud_simple
integer :: io, stdlog_unit
integer :: res, time_step_seconds
@@ -114,6 +115,18 @@ SUBROUTINE socrates_init(is, ie, js, je, num_levels, axes, Time, lat, lonb, latb
!Initialise astronomy
call astronomy_init
+ if(do_cloud_simple.and..not.account_for_clouds_in_socrates) then
+
+ call error_mesg( 'run_socrates', &
+ 'do_cloud_simple is True but account_for_clouds_in_socrates is False. Radiative effects of clouds NOT accounted for', WARNING)
+
+ elseif(.not.do_cloud_simple.and.account_for_clouds_in_socrates) then
+
+ call error_mesg( 'run_socrates', &
+ 'do_cloud_simple is False but account_for_clouds_in_socrates is True. Radiative effects of clouds NOT accounted for', WARNING)
+
+ endif
+
!Initialise variables related to radiation timestep
call get_time(delta_t_atmos,time_step_seconds)
@@ -921,18 +934,12 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
elseif(do_cloud_simple.and..not.account_for_clouds_in_socrates) then
- call error_mesg( 'run_socrates', &
- 'do_cloud_simple is True but account_for_clouds_in_socrates is False. Radiative effects of clouds NOT accounted for', WARNING)
-
cld_frac_soc = 0.
reff_rad_soc = 0.
mmr_cl_rad_soc = 0.
elseif(.not.do_cloud_simple.and.account_for_clouds_in_socrates) then
- call error_mesg( 'run_socrates', &
- 'do_cloud_simple is False but account_for_clouds_in_socrates is True. Radiative effects of clouds NOT accounted for', WARNING)
-
cld_frac_soc = 0.
reff_rad_soc = 0.
mmr_cl_rad_soc = 0.
@@ -961,7 +968,8 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
CALL socrates_interface(Time, rad_lat_soc, rad_lon_soc, soc_lw_mode, &
tg_tmp_soc, q_soc, ozone_soc, co2_soc, t_surf_for_soc, p_full_soc, p_half_soc, z_full_soc, z_half_soc, albedo_soc, coszen, rrsun, n_profile, n_layer, &
- output_heating_rate_lw, output_soc_flux_lw_down, output_soc_flux_lw_up, cld_frac_soc, reff_rad_soc, mmr_cl_rad_soc, output_soc_spectral_olr = outputted_soc_spectral_olr, t_half_level_out = t_half_out)
+ cld_frac_soc, reff_rad_soc, mmr_cl_rad_soc, &
+ output_heating_rate_lw, output_soc_flux_lw_down, output_soc_flux_lw_up, output_soc_spectral_olr = outputted_soc_spectral_olr, t_half_level_out = t_half_out)
tg_tmp_soc = tg_tmp_soc + output_heating_rate_lw*delta_t !Output heating rate in K/s, so is a temperature tendency
surf_lw_down(:,:) = REAL(output_soc_flux_lw_down(:,:, n_layer))
@@ -976,7 +984,8 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
soc_lw_mode = .FALSE.
CALL socrates_interface(Time, rad_lat_soc, rad_lon_soc, soc_lw_mode, &
tg_tmp_soc, q_soc, ozone_soc, co2_soc, t_surf_for_soc, p_full_soc, p_half_soc, z_full_soc, z_half_soc, albedo_soc, coszen, rrsun, n_profile, n_layer, &
- output_heating_rate_sw, output_soc_flux_sw_down, output_soc_flux_sw_up, cld_frac_soc, reff_rad_soc, mmr_cl_rad_soc)
+ cld_frac_soc, reff_rad_soc, mmr_cl_rad_soc, &
+ output_heating_rate_sw, output_soc_flux_sw_down, output_soc_flux_sw_up)
tg_tmp_soc = tg_tmp_soc + output_heating_rate_sw*delta_t !Output heating rate in K/s, so is a temperature tendency
net_surf_sw_down(:,:) = REAL(output_soc_flux_sw_down(:,:, n_layer)-output_soc_flux_sw_up(:,:,n_layer) )
diff --git a/src/atmos_spectral/driver/solo/idealized_moist_phys.F90 b/src/atmos_spectral/driver/solo/idealized_moist_phys.F90
index ed49dcf23..0262dcde4 100644
--- a/src/atmos_spectral/driver/solo/idealized_moist_phys.F90
+++ b/src/atmos_spectral/driver/solo/idealized_moist_phys.F90
@@ -718,7 +718,7 @@ subroutine idealized_moist_phys_init(Time, Time_step_in, nhum, rad_lon_2d, rad_l
endif
#else
if (do_socrates_radiation) then
- call socrates_init(is, ie, js, je, num_levels, axes, Time, rad_lat, rad_lonb_2d, rad_latb_2d, Time_step_in)
+ call socrates_init(is, ie, js, je, num_levels, axes, Time, rad_lat, rad_lonb_2d, rad_latb_2d, Time_step_in, do_cloud_simple)
endif
#endif
From 8bafc8c9d79073b2af23b58e54ee20b8d5eca16d Mon Sep 17 00:00:00 2001
From: sit23
Date: Fri, 7 Sep 2018 14:35:51 +0100
Subject: [PATCH 013/304] Initialised zeros array and getting seg-faults when
ice fraction is not 1.
---
src/atmos_param/socrates/interface/socrates_calc.F90 | 6 ++++--
src/atmos_param/socrates/interface/socrates_interface.F90 | 2 +-
src/atmos_param/socrates/interface/socrates_set_cld.F90 | 1 +
src/atmos_spectral/driver/solo/idealized_moist_phys.F90 | 6 +++++-
4 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/src/atmos_param/socrates/interface/socrates_calc.F90 b/src/atmos_param/socrates/interface/socrates_calc.F90
index ab545635e..b36e0ff7e 100644
--- a/src/atmos_param/socrates/interface/socrates_calc.F90
+++ b/src/atmos_param/socrates/interface/socrates_calc.F90
@@ -161,7 +161,7 @@ subroutine socrates_calc(Time_diag,control, spectrum,
!DIAG Diagnostic
logical :: used
-real(r_def) :: zeros_cld(n_profile, n_layer)
+real(r_def) :: zeros_cld(n_profile, n_layer), ten_microns_cld(n_profile, n_layer)
call set_control(control)
@@ -178,9 +178,11 @@ subroutine socrates_calc(Time_diag,control, spectrum,
! call set_cld(control, dimen, spectrum, cld, n_profile)
+ zeros_cld = 0.
+ ten_microns_cld = 1.
call set_cld(cld, control, dimen, spectrum, n_profile, n_layer, &
liq_frac = cld_frac, &
- ice_frac = zeros_cld, &
+ ice_frac = ten_microns_cld, &
liq_mmr = mmr_cl_rad, &
ice_mmr = zeros_cld, &
liq_dim = reff_rad, &
diff --git a/src/atmos_param/socrates/interface/socrates_interface.F90 b/src/atmos_param/socrates/interface/socrates_interface.F90
index 37fd7a59f..0e870017c 100644
--- a/src/atmos_param/socrates/interface/socrates_interface.F90
+++ b/src/atmos_param/socrates/interface/socrates_interface.F90
@@ -930,7 +930,7 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
reff_rad_soc = REAL(reff_rad, kind(r_def))
qcl_rad_soc = REAL(qcl_rad, kind(r_def))
- mmr_cl_rad_soc = qcl_rad_soc / (1.0 - qcl_rad_soc)
+ mmr_cl_rad_soc = qcl_rad_soc / (1.0 - qcl_rad_soc) !check if qcl is indeed specific humidity and not mmr
elseif(do_cloud_simple.and..not.account_for_clouds_in_socrates) then
diff --git a/src/atmos_param/socrates/interface/socrates_set_cld.F90 b/src/atmos_param/socrates/interface/socrates_set_cld.F90
index d98b215a6..99fd4a30e 100644
--- a/src/atmos_param/socrates/interface/socrates_set_cld.F90
+++ b/src/atmos_param/socrates/interface/socrates_set_cld.F90
@@ -482,6 +482,7 @@ subroutine set_cld(cld, control, dimen, spectrum, n_profile, n_layer, &
if (cld%w_cloud(l, k) > min_cloud_fraction) then
do j=1, cld%n_cloud_type
cld%frac_cloud(l, k, j) = cld%frac_cloud(l, k, j) / cld%w_cloud(l, k)
+ ! write(6,*) cld%frac_cloud(l, k, j) / cld%w_cloud(l, k), cld%frac_cloud(l, k, j) , cld%w_cloud(l, k), 'div?', cld%n_cloud_type
end do
else
cld%w_cloud(l, k) = 0.0_r_def
diff --git a/src/atmos_spectral/driver/solo/idealized_moist_phys.F90 b/src/atmos_spectral/driver/solo/idealized_moist_phys.F90
index 0262dcde4..fcddca274 100644
--- a/src/atmos_spectral/driver/solo/idealized_moist_phys.F90
+++ b/src/atmos_spectral/driver/solo/idealized_moist_phys.F90
@@ -1053,7 +1053,11 @@ subroutine idealized_moist_phys(Time, p_half, p_full, z_half, z_full, ug, vg, tg
#else
if (do_socrates_radiation) then
! Socrates interface
-
+
+ if(do_cloud_simple) then
+ reff_rad = 1.e-6 * reff_rad ! Simple cloud scheme outputs radii in microns. Socrates expects it in metres.
+ endif
+
call run_socrates(Time, Time+Time_step, rad_lat, rad_lon, tg(:,:,:,previous), grid_tracers(:,:,:,previous,nsphum), t_surf(:,:), p_full(:,:,:,current), &
p_half(:,:,:,current),z_full(:,:,:,current),z_half(:,:,:,current), albedo, dt_tg(:,:,:), net_surf_sw_down(:,:), surf_lw_down(:,:), delta_t, do_cloud_simple, cf_rad(:,:,:), reff_rad(:,:,:), &
qcl_rad(:,:,:) )
From e22449c8a3ee1203bfea2f087838df843e90ddf2 Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Wed, 12 Sep 2018 11:15:32 +0100
Subject: [PATCH 014/304] Update debugging flag to get socrities to compile
---
src/extra/python/isca/templates/mkmf.template.debug | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/extra/python/isca/templates/mkmf.template.debug b/src/extra/python/isca/templates/mkmf.template.debug
index 15afb1696..45d7e20a3 100644
--- a/src/extra/python/isca/templates/mkmf.template.debug
+++ b/src/extra/python/isca/templates/mkmf.template.debug
@@ -19,7 +19,7 @@ NETCDF_LIBS = `nc-config --libs`
# This suppresses the warning: `warning #6843: A dummy argument with an explicit INTENT(OUT) declaration is not given an explicit value.` of which
# there are a lot of instances in the GFDL codebase.
FFLAGS_DEBUG = -check -check noarg_temp_created -check nopointer -warn -warn noerrors -debug variable_locations -inline_debug_info -fpe0 -traceback -ftrapuv
-FFLAGS = $(CPPFLAGS) -fpp -stack_temps -safe-cray-ptr -ftz -i_dynamic -assume byterecl -g -i4 -r8 -diag-disable 6843 -fpic $(FFLAGS_DEBUG)
+FFLAGS = $(CPPFLAGS) -fpp -stack_temps -safe-cray-ptr -ftz -i_dynamic -assume byterecl -g -i4 -r8 -diag-disable 6843 -mcmodel large $(FFLAGS_DEBUG)
FC = $(F90)
LD = $(F90) $(NETCDF_LIBS)
#CC = mpicc
From 3bbb061c18cb2e39e2f99f0c1c2746343455190f Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Wed, 12 Sep 2018 11:16:31 +0100
Subject: [PATCH 015/304] Minor changes to soc test case for debugging.
---
.../socrates_test/socrates_aquaplanet.py | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/exp/test_cases/socrates_test/socrates_aquaplanet.py b/exp/test_cases/socrates_test/socrates_aquaplanet.py
index 7b926d6b7..806cf174d 100644
--- a/exp/test_cases/socrates_test/socrates_aquaplanet.py
+++ b/exp/test_cases/socrates_test/socrates_aquaplanet.py
@@ -5,7 +5,7 @@
from isca import SocratesCodeBase, DiagTable, Experiment, Namelist, GFDL_BASE
from isca.util import exp_progress
-NCORES = 16
+NCORES = 1
base_dir = os.path.dirname(os.path.realpath(__file__))
# a CodeBase can be a directory on the computer,
# useful for iterative development
@@ -78,6 +78,7 @@
'dt_rad':3600,
'store_intermediate_rad':True,
'chunk_size': 16,
+ 'account_for_clouds_in_socrates': True,
},
'idealized_moist_phys_nml': {
'do_damping': True,
@@ -98,10 +99,7 @@
'simple_cca':0.0,
'rhcsfc': 0.95,
'rhc700': 0.7,
- 'rhc200': 0.3,
- 'rhmsfc': 0.95,
- 'rhm700': 0.7,
- 'rhm200': 0.3,
+ 'rhc200': 0.3
},
'vert_turb_driver_nml': {
@@ -148,8 +146,9 @@
},
'sat_vapor_pres_nml': {
- 'do_simple':True
- },
+ 'do_simple':True,
+ 'construct_table_wrt_liq_and_ice':True
+ },
'damping_driver_nml': {
'do_rayleigh': True,
@@ -191,7 +190,7 @@
#Lets do a run!
if __name__=="__main__":
- cb.compile()
+ cb.compile(debug=True)
#Set up the experiment object, with the first argument being the experiment name.
#This will be the name of the folder that the data will appear in.
@@ -203,6 +202,6 @@
exp.namelist = namelist.copy()
- exp.run(1, use_restart=False, num_cores=NCORES)
+ exp.run(1, use_restart=False, num_cores=NCORES, run_idb=True, overwrite_data=True)
# for i in range(2,121):
# exp.run(i, num_cores=NCORES)
From 7bf423ab45ce57b11b66211414ffb49014295974 Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Wed, 12 Sep 2018 16:42:36 +0100
Subject: [PATCH 016/304] Remove debug and account for clouds flag
---
exp/test_cases/socrates_test/socrates_aquaplanet.py | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/exp/test_cases/socrates_test/socrates_aquaplanet.py b/exp/test_cases/socrates_test/socrates_aquaplanet.py
index d630867c1..f2092f0da 100644
--- a/exp/test_cases/socrates_test/socrates_aquaplanet.py
+++ b/exp/test_cases/socrates_test/socrates_aquaplanet.py
@@ -5,7 +5,7 @@
from isca import SocratesCodeBase, DiagTable, Experiment, Namelist, GFDL_BASE
from isca.util import exp_progress
-NCORES = 1
+NCORES = 16
base_dir = os.path.dirname(os.path.realpath(__file__))
# a CodeBase can be a directory on the computer,
# useful for iterative development
@@ -84,7 +84,6 @@
'dt_rad':3600,
'store_intermediate_rad':True,
'chunk_size': 16,
- 'account_for_clouds_in_socrates': True,
'use_pressure_interp_for_half_levels':False,
'tidally_locked':False
},
@@ -100,7 +99,7 @@
'two_stream_gray': False, #Use the grey radiation scheme
'do_socrates_radiation': True,
'convection_scheme': 'SIMPLE_BETTS_MILLER', #Use simple Betts miller convection
- 'do_cloud_simple': True,
+ 'do_cloud_simple': True
},
'cloud_simple_nml': {
@@ -198,8 +197,8 @@
#Lets do a run!
if __name__=="__main__":
- cb.compile(debug=True)
- exp.run(1, use_restart=False, num_cores=NCORES)#, run_idb=True, overwrite_data=True)
+ cb.compile(debug=False)
+ exp.run(1, use_restart=False, num_cores=NCORES, overwrite_data=True)#, run_idb=True)
# for i in range(2,121):
# exp.run(i, num_cores=NCORES)
From 84fcf829e10f258474352e1a0bd3da5707c45d6f Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Wed, 12 Sep 2018 16:43:53 +0100
Subject: [PATCH 017/304] Socrates is not working properly with idb. Break
points not behaving logically. Cant confirm the compile is working properly
---
src/extra/python/isca/templates/mkmf.template.debug | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/extra/python/isca/templates/mkmf.template.debug b/src/extra/python/isca/templates/mkmf.template.debug
index 45d7e20a3..15afb1696 100644
--- a/src/extra/python/isca/templates/mkmf.template.debug
+++ b/src/extra/python/isca/templates/mkmf.template.debug
@@ -19,7 +19,7 @@ NETCDF_LIBS = `nc-config --libs`
# This suppresses the warning: `warning #6843: A dummy argument with an explicit INTENT(OUT) declaration is not given an explicit value.` of which
# there are a lot of instances in the GFDL codebase.
FFLAGS_DEBUG = -check -check noarg_temp_created -check nopointer -warn -warn noerrors -debug variable_locations -inline_debug_info -fpe0 -traceback -ftrapuv
-FFLAGS = $(CPPFLAGS) -fpp -stack_temps -safe-cray-ptr -ftz -i_dynamic -assume byterecl -g -i4 -r8 -diag-disable 6843 -mcmodel large $(FFLAGS_DEBUG)
+FFLAGS = $(CPPFLAGS) -fpp -stack_temps -safe-cray-ptr -ftz -i_dynamic -assume byterecl -g -i4 -r8 -diag-disable 6843 -fpic $(FFLAGS_DEBUG)
FC = $(F90)
LD = $(F90) $(NETCDF_LIBS)
#CC = mpicc
From 4a41f3a611967696d737e22b6034e25afaab97d2 Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Wed, 12 Sep 2018 16:44:27 +0100
Subject: [PATCH 018/304] Removed additional unused files in order to get code
to compile for using simple clouds and soc
---
src/extra/model/socrates/path_names | 91 -----------------------------
1 file changed, 91 deletions(-)
diff --git a/src/extra/model/socrates/path_names b/src/extra/model/socrates/path_names
index 7ec1ee810..1a143cb31 100644
--- a/src/extra/model/socrates/path_names
+++ b/src/extra/model/socrates/path_names
@@ -329,89 +329,6 @@ atmos_param/socrates/src/trunk/src/radiance_core/monochromatic_radiance.F90
atmos_param/socrates/src/trunk/src/radiance_core/aggregate_cloud.F90
atmos_param/socrates/src/trunk/src/radiance_core/radiance_calc.F90
atmos_param/socrates/src/trunk/src/radiance_core/ir_source.F90
-atmos_param/socrates/src/trunk/src/scatter/conjugate_gradient_cloud_90.f90
-atmos_param/socrates/src/trunk/src/scatter/method_weight_pcf.f90
-atmos_param/socrates/src/trunk/src/scatter/select_weight_scatter_90.f90
-atmos_param/socrates/src/trunk/src/scatter/measure_particle_pcf.f90
-atmos_param/socrates/src/trunk/src/scatter/prec_integral_tcf.f90
-atmos_param/socrates/src/trunk/src/scatter/def_s_scat_prop.f90
-atmos_param/socrates/src/trunk/src/scatter/db_scatter_integral.f90
-atmos_param/socrates/src/trunk/src/scatter/weightings_90.f90
-atmos_param/socrates/src/trunk/src/scatter/def_db_ss_mono.f90
-atmos_param/socrates/src/trunk/src/scatter/cloud_fitting.f90
-atmos_param/socrates/src/trunk/src/scatter/shape_particle_pcf.f90
-atmos_param/socrates/src/trunk/src/scatter/number_particle_90.f90
-atmos_param/socrates/src/trunk/src/scatter/db_interp_ss_mono.f90
-atmos_param/socrates/src/trunk/src/scatter/db_read_single_wavelength.f90
-atmos_param/socrates/src/trunk/src/scatter/get_refract_index.f90
-atmos_param/socrates/src/trunk/src/scatter/read_scatter_block_90.f90
-atmos_param/socrates/src/trunk/src/scatter/proj_area_particle.f90
-atmos_param/socrates/src/trunk/src/scatter/line_search_cloud_90.f90
-atmos_param/socrates/src/trunk/src/scatter/volume_particle.f90
-atmos_param/socrates/src/trunk/src/scatter/distribution_pcf.f90
-atmos_param/socrates/src/trunk/src/scatter/size_integral_90.f90
-atmos_param/socrates/src/trunk/src/scatter/particle_size_90.f90
-atmos_param/socrates/src/trunk/src/scatter/max_size_acf.f90
-atmos_param/socrates/src/trunk/src/scatter/write_average_90.f90
-atmos_param/socrates/src/trunk/src/scatter/adt_mitchell96.f90
-atmos_param/socrates/src/trunk/src/scatter/get_db_wavelengths.f90
-atmos_param/socrates/src/trunk/src/scatter/decompose_phf_90.f90
-atmos_param/socrates/src/trunk/src/scatter/cloud_fit_parm_acf.f90
-atmos_param/socrates/src/trunk/src/scatter/cloud_fit_90.f90
-atmos_param/socrates/src/trunk/src/scatter/ice_db_read_geometry.f90
-atmos_param/socrates/src/trunk/src/scatter/def_sct_db.f90
-atmos_param/socrates/src/trunk/src/scatter/open_average_90.f90
-atmos_param/socrates/src/trunk/src/scatter/def_size_dist.f90
-atmos_param/socrates/src/trunk/src/scatter/parm_integ_acf.f90
-atmos_param/socrates/src/trunk/src/scatter/bna_factor_ccf.f90
-atmos_param/socrates/src/trunk/src/scatter/def_db_crystal_geometry.f90
-atmos_param/socrates/src/trunk/src/scatter/get_wavelengths.f90
-atmos_param/socrates/src/trunk/src/scatter/weightings_single_90.f90
-atmos_param/socrates/src/trunk/src/scatter/scatter_algorithm_pcf.f90
-atmos_param/socrates/src/trunk/src/scatter/db_type_ucf.f90
-atmos_param/socrates/src/trunk/src/scatter/scatter_integral_90.f90
-atmos_param/socrates/src/trunk/src/correlated_k/voigt_profile.f90
-atmos_param/socrates/src/trunk/src/correlated_k/adjust_path.f90
-atmos_param/socrates/src/trunk/src/correlated_k/func_scale_90.f90
-atmos_param/socrates/src/trunk/src/correlated_k/read_pt_line_90.f90
-atmos_param/socrates/src/trunk/src/correlated_k/set_condition_ck_90.f90
-atmos_param/socrates/src/trunk/src/correlated_k/caviar_continuum_v1_0.f90
-atmos_param/socrates/src/trunk/src/correlated_k/rad_weight_90.f90
-atmos_param/socrates/src/trunk/src/correlated_k/select_weight_ck_90.f90
-atmos_param/socrates/src/trunk/src/correlated_k/trans_k_dist.f90
-atmos_param/socrates/src/trunk/src/correlated_k/type_residual_pcf.f90
-atmos_param/socrates/src/trunk/src/correlated_k/map_shell.f90
-atmos_param/socrates/src/trunk/src/correlated_k/terminate_scale_90.f90
-atmos_param/socrates/src/trunk/src/correlated_k/ckd_continuum_v2_4.f90
-atmos_param/socrates/src/trunk/src/correlated_k/write_fit_90.f90
-atmos_param/socrates/src/trunk/src/correlated_k/ck_parm_acf.f90
-atmos_param/socrates/src/trunk/src/correlated_k/fit_parabola_90.f90
-atmos_param/socrates/src/trunk/src/correlated_k/func_scale_derivative_90.f90
-atmos_param/socrates/src/trunk/src/correlated_k/optimal_k.f90
-atmos_param/socrates/src/trunk/src/correlated_k/open_file_out_90.f90
-atmos_param/socrates/src/trunk/src/correlated_k/residual_gradient_90.f90
-atmos_param/socrates/src/trunk/src/correlated_k/scale_ck_fit_90.f90
-atmos_param/socrates/src/trunk/src/correlated_k/read_ref_pt_90.f90
-atmos_param/socrates/src/trunk/src/correlated_k/corr_k_single.f90
-atmos_param/socrates/src/trunk/src/correlated_k/planck_90.f90
-atmos_param/socrates/src/trunk/src/correlated_k/exponent_fit_90.f90
-atmos_param/socrates/src/trunk/src/correlated_k/conjugate_gradient_90.f90
-atmos_param/socrates/src/trunk/src/correlated_k/line_prof_corr_mod.f90
-atmos_param/socrates/src/trunk/src/correlated_k/set_extern_ckd_frn_data.f90
-atmos_param/socrates/src/trunk/src/correlated_k/set_g_point_90.f90
-atmos_param/socrates/src/trunk/src/correlated_k/bi_interp.f90
-atmos_param/socrates/src/trunk/src/correlated_k/residual_trans_90.f90
-atmos_param/socrates/src/trunk/src/correlated_k/set_extern_ckd_self_data.f90
-atmos_param/socrates/src/trunk/src/correlated_k/line_search_90.f90
-atmos_param/socrates/src/trunk/src/correlated_k/read_hitran.f90
-atmos_param/socrates/src/trunk/src/correlated_k/read_nc.f90
-atmos_param/socrates/src/trunk/src/correlated_k/ckd_extern_data.f90
-atmos_param/socrates/src/trunk/src/correlated_k/def_hitran_record.f90
-atmos_param/socrates/src/trunk/src/correlated_k/d_planck_90.f90
-atmos_param/socrates/src/trunk/src/correlated_k/scale_parameters_acf.f90
-atmos_param/socrates/src/trunk/src/correlated_k/offset_residual_trans_acf.f90
-atmos_param/socrates/src/trunk/src/correlated_k/hitran_cnst.f90
-atmos_param/socrates/src/trunk/src/correlated_k/ck_fit_pcf.f90
atmos_param/socrates/src/trunk/src/aux/qsat_wat.F90
atmos_param/socrates/src/trunk/src/aux/qsat_gill.F90
atmos_param/socrates/src/trunk/src/aux/write_cdf.f90
@@ -434,7 +351,6 @@ atmos_param/socrates/src/trunk/src/general/make_block_18.f90
atmos_param/socrates/src/trunk/src/general/remove_negative_gas_90.f90
atmos_param/socrates/src/trunk/src/general/make_block_17.f90
atmos_param/socrates/src/trunk/src/general/make_block_1.f90
-atmos_param/socrates/src/trunk/src/general/solar_intensity_90.f90
atmos_param/socrates/src/trunk/src/general/make_block_19.f90
atmos_param/socrates/src/trunk/src/general/make_block_0.f90
atmos_param/socrates/src/trunk/src/general/make_block_10.f90
@@ -484,8 +400,6 @@ atmos_param/socrates/src/trunk/src/radiation_control/set_moist_aerosol_propertie
atmos_param/socrates/src/trunk/src/radiation_control/mcica_mod.F90
atmos_param/socrates/src/trunk/src/radiation_control/cld_generator_mod.F90
atmos_param/socrates/src/trunk/src/radiation_control/open_cloud_gen.F90
-atmos_param/socrates/src/trunk/src/um/out_nml.f90
-atmos_param/socrates/src/trunk/src/um/def_um_nml.f90
atmos_param/socrates/src/trunk/src/modules_core/errormessagelength_mod.F90
atmos_param/socrates/src/trunk/src/modules_core/dimensions_spec_ucf.F90
atmos_param/socrates/src/trunk/src/modules_core/rad_ccf.F90
@@ -497,11 +411,6 @@ atmos_param/socrates/src/trunk/src/modules_core/vectlib_mod.F90
atmos_param/socrates/src/trunk/src/modules_core/ereport_mod.F90
atmos_param/socrates/src/trunk/src/modules_core/realtype_rd.f90
atmos_param/socrates/src/trunk/src/modules_core/filenamelength_mod.F90
-atmos_param/socrates/src/trunk/src/scatter/grow_particles.f
-atmos_param/socrates/src/trunk/src/scatter/mie_scatter.f
-atmos_param/socrates/src/trunk/src/scatter/adt_integral.f
-atmos_param/socrates/src/trunk/src/scatter/gamma_fnc.f
-atmos_param/socrates/src/trunk/src/scatter/refractive_index.f
atmos_param/socrates/src/trunk/src/aux/output_vert_cdl.f
atmos_param/socrates/src/trunk/src/aux/assign_input_opt_cdf.f
atmos_param/socrates/src/trunk/src/aux/assign_input_ss_cdl.f
From b01ecaedb9e42d760a1e390552899b5523754b68 Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Wed, 12 Sep 2018 16:44:51 +0100
Subject: [PATCH 019/304] Initialise variables and cleaning debug statements
---
.../driver/solo/idealized_moist_phys.F90 | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/atmos_spectral/driver/solo/idealized_moist_phys.F90 b/src/atmos_spectral/driver/solo/idealized_moist_phys.F90
index fcddca274..37061eb97 100644
--- a/src/atmos_spectral/driver/solo/idealized_moist_phys.F90
+++ b/src/atmos_spectral/driver/solo/idealized_moist_phys.F90
@@ -764,7 +764,6 @@ subroutine idealized_moist_phys(Time, p_half, p_full, z_half, z_full, ug, vg, tg
real, dimension(1,1,1):: tracer, tracertnd
integer :: nql, nqi, nqa ! tracer indices for stratiform clouds
-real :: tmp1, tmp2 !remove tmp1 and tmp2 after debugging
if(current == previous) then
delta_t = dt_real
@@ -925,6 +924,12 @@ subroutine idealized_moist_phys(Time, p_half, p_full, z_half, z_full, ug, vg, tg
! Call the simple cloud scheme in line with SPOOKIE-2 requirements
! Using start of time step variables
! using soecific humidity NOT mixing ratios
+
+ !Set to zero regarles of if clouds are used in radiation code
+ cf_rad = 0.
+ reff_rad = 0.
+ qcl_rad = 0.
+
if(do_cloud_simple) then
call cloud_simple(p_half(:,:,:,current), p_full(:,:,:,current), &
@@ -938,11 +943,6 @@ subroutine idealized_moist_phys(Time, p_half, p_full, z_half, z_full, ug, vg, tg
endif
-! write(6,*) minval(cf_rad), maxval(cf_rad), minval(reff_rad), maxval(reff_rad), minval(qcl_rad), maxval(qcl_rad)
-
-tmp1 = maxval(reff_rad)
-tmp2 = maxval(cf_rad)
-
! Begin the radiation calculation by computing downward fluxes.
! This part of the calculation does not depend on the surface temperature.
From 7b4289d4a1e42ce99b15dd39d7a74f19d37f6f2f Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Wed, 12 Sep 2018 16:45:15 +0100
Subject: [PATCH 020/304] Remove account for cloud flag from namelist
---
src/atmos_param/socrates/interface/read_control.F90 | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/src/atmos_param/socrates/interface/read_control.F90 b/src/atmos_param/socrates/interface/read_control.F90
index 92d5eeefb..755a10357 100644
--- a/src/atmos_param/socrates/interface/read_control.F90
+++ b/src/atmos_param/socrates/interface/read_control.F90
@@ -9,13 +9,15 @@ MODULE read_control_mod
! Subroutine to set input algorithmic options for the core radiation code
!------------------------------------------------------------------------------
-SUBROUTINE read_control(control, spectrum)
+SUBROUTINE read_control(control, spectrum, do_cloud_simple)
USE rad_pcf
USE def_control, ONLY: StrCtrl, allocate_control
USE def_spectrum, ONLY: StrSpecData
-USE socrates_config_mod, ONLY: l_planet_grey_surface, inc_h2o, inc_co2, inc_co, inc_o3, inc_n2o, inc_ch4, inc_o2, inc_so2, inc_cfc11, inc_cfc12, inc_cfc113, inc_hcfc22, inc_hfc134a, account_for_clouds_in_socrates
+USE socrates_config_mod, ONLY: l_planet_grey_surface, inc_h2o, inc_co2, inc_co, &
+ inc_o3, inc_n2o, inc_ch4, inc_o2, inc_so2, inc_cfc11, &
+ inc_cfc12, inc_cfc113, inc_hcfc22, inc_hfc134a
IMPLICIT NONE
@@ -26,6 +28,10 @@ SUBROUTINE read_control(control, spectrum)
! Spectral data:
TYPE (StrSpecData), INTENT(IN) :: spectrum
+LOGICAL, INTENT(IN), OPTIONAL :: do_cloud_simple
+
+
+
! Local variables.
INTEGER :: i
! Loop variable
@@ -93,7 +99,7 @@ SUBROUTINE read_control(control, spectrum)
control%i_gas_overlap = ip_overlap_k_eqv_scl
! Properties of clouds
-if (account_for_clouds_in_socrates) then
+if (do_cloud_simple) then
control%i_cloud_representation = ip_cloud_ice_water
else
control%i_cloud_representation = ip_cloud_off
From 178ee4feee7c9bdf339bbd3e32a67b714192ba5a Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Wed, 12 Sep 2018 16:45:47 +0100
Subject: [PATCH 021/304] Was using 1 micron as a work around for debugging.
Should be zero
---
src/atmos_param/socrates/interface/socrates_calc.F90 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/atmos_param/socrates/interface/socrates_calc.F90 b/src/atmos_param/socrates/interface/socrates_calc.F90
index b36e0ff7e..0fd98b578 100644
--- a/src/atmos_param/socrates/interface/socrates_calc.F90
+++ b/src/atmos_param/socrates/interface/socrates_calc.F90
@@ -182,7 +182,7 @@ subroutine socrates_calc(Time_diag,control, spectrum,
ten_microns_cld = 1.
call set_cld(cld, control, dimen, spectrum, n_profile, n_layer, &
liq_frac = cld_frac, &
- ice_frac = ten_microns_cld, &
+ ice_frac = zeros_cld, &
liq_mmr = mmr_cl_rad, &
ice_mmr = zeros_cld, &
liq_dim = reff_rad, &
From ca4c70ce33f67dd145c8c654f033343ebec367d2 Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Wed, 12 Sep 2018 16:47:19 +0100
Subject: [PATCH 022/304] File cleaning. Changes to fix seg fault which
originated due to flipped pressure levels. Removed account for clouds.
---
.../interface/socrates_config_mod.f90 | 4 +-
.../socrates/interface/socrates_interface.F90 | 95 ++++++++++---------
2 files changed, 50 insertions(+), 49 deletions(-)
diff --git a/src/atmos_param/socrates/interface/socrates_config_mod.f90 b/src/atmos_param/socrates/interface/socrates_config_mod.f90
index 014227dbb..fe348a155 100644
--- a/src/atmos_param/socrates/interface/socrates_config_mod.f90
+++ b/src/atmos_param/socrates/interface/socrates_config_mod.f90
@@ -38,8 +38,6 @@ module socrates_config_mod
logical :: use_pressure_interp_for_half_levels = .False. !By default (.False.) does linear interpolation in height for half-level temperatures. True does linear interp using pressure.
- logical :: account_for_clouds_in_socrates = .false. !Do we want to account for the radiative effects of clouds in socrates?
-
! Incoming radiation options for namelist
integer :: solday=0 ! if >0, do perpetual run corresponding to day of the year = solday \in [0,days per year]
@@ -124,6 +122,6 @@ module socrates_config_mod
hfc134a_mix_ratio, &
inc_h2o, inc_co2, inc_co, inc_o3, inc_n2o, inc_ch4, inc_o2, &
inc_so2, inc_cfc11, inc_cfc12, inc_cfc113, inc_hcfc22, inc_hfc134a, &
- use_pressure_interp_for_half_levels, account_for_clouds_in_socrates
+ use_pressure_interp_for_half_levels
end module socrates_config_mod
diff --git a/src/atmos_param/socrates/interface/socrates_interface.F90 b/src/atmos_param/socrates/interface/socrates_interface.F90
index 789d635ab..407d70646 100644
--- a/src/atmos_param/socrates/interface/socrates_interface.F90
+++ b/src/atmos_param/socrates/interface/socrates_interface.F90
@@ -115,18 +115,6 @@ SUBROUTINE socrates_init(is, ie, js, je, num_levels, axes, Time, lat, lonb, latb
!Initialise astronomy
call astronomy_init
- if(do_cloud_simple.and..not.account_for_clouds_in_socrates) then
-
- call error_mesg( 'run_socrates', &
- 'do_cloud_simple is True but account_for_clouds_in_socrates is False. Radiative effects of clouds NOT accounted for', WARNING)
-
- elseif(.not.do_cloud_simple.and.account_for_clouds_in_socrates) then
-
- call error_mesg( 'run_socrates', &
- 'do_cloud_simple is False but account_for_clouds_in_socrates is True. Radiative effects of clouds NOT accounted for', WARNING)
-
- endif
-
!Initialise variables related to radiation timestep
call get_time(delta_t_atmos,time_step_seconds)
@@ -202,10 +190,10 @@ SUBROUTINE socrates_init(is, ie, js, je, num_levels, axes, Time, lat, lonb, latb
CALL read_spectrum(control_sw_hires%spectral_file,spectrum_sw_hires)
! Set Socrates configuration
- CALL read_control(control_lw,spectrum_lw)
- CALL read_control(control_lw_hires,spectrum_lw_hires)
- CALL read_control(control_sw,spectrum_sw)
- CALL read_control(control_sw_hires,spectrum_sw_hires)
+ CALL read_control(control_lw,spectrum_lw, do_cloud_simple)
+ CALL read_control(control_lw_hires,spectrum_lw_hires, do_cloud_simple)
+ CALL read_control(control_sw,spectrum_sw, do_cloud_simple)
+ CALL read_control(control_sw_hires,spectrum_sw_hires, do_cloud_simple)
! Specify LW and SW setups
control_sw%isolir=1
@@ -415,9 +403,15 @@ end subroutine socrates_init
! Set up the call to the Socrates radiation scheme
! -----------------------------------------------------------------------------
subroutine socrates_interface(Time_diag, rlat, rlon, soc_lw_mode, &
- fms_temp, fms_spec_hum, fms_ozone, fms_co2, fms_t_surf, fms_p_full, fms_p_half, fms_z_full, fms_z_half, fms_albedo, fms_coszen, fms_rrsun, n_profile, n_layer, &
- fms_cld_frac, fms_reff_rad, fms_mmr_cl_rad, &
- output_heating_rate, output_flux_down, output_flux_up, output_soc_spectral_olr, output_flux_direct, t_half_level_out )
+ fms_temp, fms_spec_hum, fms_ozone, fms_co2, fms_t_surf, &
+ fms_p_full, fms_p_half, fms_z_full, fms_z_half, fms_albedo, &
+ fms_coszen, fms_rrsun, n_profile, n_layer, &
+ fms_cld_frac, fms_reff_rad, fms_mmr_cl_rad, &
+ output_heating_rate, output_flux_down, output_flux_up, &
+ do_cloud_simple, &
+ !optionals
+ output_soc_spectral_olr, output_flux_direct, &
+ t_half_level_out )
use realtype_rd
use read_control_mod
@@ -457,10 +451,14 @@ subroutine socrates_interface(Time_diag, rlat, rlon, soc_lw_mode, &
real(r_def), intent(in) :: fms_rrsun
real(r_def), intent(in) :: fms_cld_frac(:,:,:), fms_reff_rad(:,:,:), fms_mmr_cl_rad(:,:,:)
+ logical, intent(in) :: do_cloud_simple
+
! Output arrays
real(r_def), intent(out) :: output_heating_rate(:,:,:)
real(r_def), intent(out) :: output_flux_up(:,:,:)
real(r_def), intent(out) :: output_flux_down(:,:,:)
+
+
real(r_def), intent(out), optional :: output_flux_direct(:,:,:)
real(r_def), intent(out), optional :: output_soc_spectral_olr(:,:,:)
real(r_def), intent(out), optional :: t_half_level_out(size(fms_temp,1),size(fms_temp,2),size(fms_temp,3)+1)
@@ -471,13 +469,15 @@ subroutine socrates_interface(Time_diag, rlat, rlon, soc_lw_mode, &
REAL :: soc_spectral_olr(n_profile, size(outputted_soc_spectral_olr,3))
! Arrays to send to Socrates
- real, dimension(n_profile, n_layer) :: input_p, input_t, input_mixing_ratio, &
+ real(r_def), dimension(n_profile, n_layer) :: input_p, input_t, input_mixing_ratio, &
input_d_mass, input_density, input_layer_heat_capacity, &
soc_heating_rate, input_o3_mixing_ratio, &
- input_co2_mixing_ratio,z_full_reshaped
- real, dimension(n_profile, 0:n_layer) :: input_p_level, input_t_level, soc_flux_direct, &
- soc_flux_down, soc_flux_up, z_half_reshaped, input_cld_frac, input_reff_rad, input_mmr_cl_rad
- real, dimension(n_profile) :: input_t_surf, input_cos_zenith_angle, input_solar_irrad, &
+ input_co2_mixing_ratio,z_full_reshaped, input_cld_frac, input_reff_rad, input_mmr_cl_rad
+
+ real(r_def), dimension(n_profile, 0:n_layer) :: input_p_level, input_t_level, soc_flux_direct, &
+ soc_flux_down, soc_flux_up, z_half_reshaped
+
+ real(r_def), dimension(n_profile) :: input_t_surf, input_cos_zenith_angle, input_solar_irrad, &
input_orog_corr, input_planet_albedo
@@ -504,7 +504,7 @@ subroutine socrates_interface(Time_diag, rlat, rlon, soc_lw_mode, &
!----------------------------i
! Set array sizes
- input_n_cloud_layer = n_layer
+ input_n_cloud_layer = 1
input_n_aer_mode = n_layer
input_cld_subcol_gen = n_layer
input_cld_subcol_req = n_layer
@@ -586,7 +586,7 @@ subroutine socrates_interface(Time_diag, rlat, rlon, soc_lw_mode, &
! Test if LW or SW mode
if (soc_lw_mode == .TRUE.) then
control_lw%isolir = 2
- CALL read_control(control_lw, spectrum_lw)
+ CALL read_control(control_lw, spectrum_lw, do_cloud_simple)
if (socrates_hires_mode == .FALSE.) then
control_calc = control_lw
spectrum_calc = spectrum_lw
@@ -597,7 +597,7 @@ subroutine socrates_interface(Time_diag, rlat, rlon, soc_lw_mode, &
else
control_sw%isolir = 1
- CALL read_control(control_sw, spectrum_sw)
+ CALL read_control(control_sw, spectrum_sw, do_cloud_simple)
if(socrates_hires_mode == .FALSE.) then
control_calc = control_sw
spectrum_calc = spectrum_sw
@@ -610,7 +610,7 @@ subroutine socrates_interface(Time_diag, rlat, rlon, soc_lw_mode, &
! Do calculation
- CALL read_control(control_calc, spectrum_calc)
+ CALL read_control(control_calc, spectrum_calc, do_cloud_simple)
n_chunk_loop = (si*sj)/chunk_size
n_profile_chunk = n_profile / n_chunk_loop
@@ -926,21 +926,14 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
endif
- if(do_cloud_simple.and.account_for_clouds_in_socrates) then
+ if(do_cloud_simple) then
cld_frac_soc = REAL(cf_rad, kind(r_def))
reff_rad_soc = REAL(reff_rad, kind(r_def))
qcl_rad_soc = REAL(qcl_rad, kind(r_def))
mmr_cl_rad_soc = qcl_rad_soc / (1.0 - qcl_rad_soc) !check if qcl is indeed specific humidity and not mmr
- elseif(do_cloud_simple.and..not.account_for_clouds_in_socrates) then
-
- cld_frac_soc = 0.
- reff_rad_soc = 0.
- mmr_cl_rad_soc = 0.
-
- elseif(.not.do_cloud_simple.and.account_for_clouds_in_socrates) then
-
+ else
cld_frac_soc = 0.
reff_rad_soc = 0.
mmr_cl_rad_soc = 0.
@@ -950,7 +943,6 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
n_profile = INT(size(temp_in,2)*size(temp_in,1), kind(i_def))
n_layer = INT(size(temp_in,3), kind(i_def))
t_surf_for_soc = REAL(t_surf_in(:,:), kind(r_def))
-
! LW calculation
! Retrieve output_heating_rate, and downward surface SW and LW fluxes
soc_lw_mode = .TRUE.
@@ -967,10 +959,17 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
z_full_soc = REAL(z_full_in, kind(r_def))
z_half_soc = REAL(z_half_in, kind(r_def))
- CALL socrates_interface(Time, rad_lat_soc, rad_lon_soc, soc_lw_mode, &
- tg_tmp_soc, q_soc, ozone_soc, co2_soc, t_surf_for_soc, p_full_soc, p_half_soc, z_full_soc, z_half_soc, albedo_soc, coszen, rrsun, n_profile, n_layer, &
- cld_frac_soc, reff_rad_soc, mmr_cl_rad_soc, &
- output_heating_rate_lw, output_soc_flux_lw_down, output_soc_flux_lw_up, output_soc_spectral_olr = outputted_soc_spectral_olr, t_half_level_out = t_half_out)
+
+ CALL socrates_interface(Time, rad_lat_soc, rad_lon_soc, soc_lw_mode, &
+ tg_tmp_soc, q_soc, ozone_soc, co2_soc, t_surf_for_soc, p_full_soc, &
+ p_half_soc, z_full_soc, z_half_soc, albedo_soc, coszen, rrsun, &
+ n_profile, n_layer, cld_frac_soc, reff_rad_soc, mmr_cl_rad_soc, &
+ output_heating_rate_lw, output_soc_flux_lw_down, output_soc_flux_lw_up, &
+ do_cloud_simple, &
+ !optional outs
+ output_soc_spectral_olr = outputted_soc_spectral_olr, &
+ t_half_level_out = t_half_out)
+
tg_tmp_soc = tg_tmp_soc + output_heating_rate_lw*delta_t !Output heating rate in K/s, so is a temperature tendency
surf_lw_down(:,:) = REAL(output_soc_flux_lw_down(:,:, n_layer+1))
@@ -980,13 +979,17 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
temp_tend(:,:,:) = temp_tend(:,:,:) + real(output_heating_rate_lw)
+
! SW calculation
! Retrieve output_heating_rate, and downward surface SW and LW fluxes
soc_lw_mode = .FALSE.
- CALL socrates_interface(Time, rad_lat_soc, rad_lon_soc, soc_lw_mode, &
- tg_tmp_soc, q_soc, ozone_soc, co2_soc, t_surf_for_soc, p_full_soc, p_half_soc, z_full_soc, z_half_soc, albedo_soc, coszen, rrsun, n_profile, n_layer, &
- cld_frac_soc, reff_rad_soc, mmr_cl_rad_soc, &
- output_heating_rate_sw, output_soc_flux_sw_down, output_soc_flux_sw_up)
+ CALL socrates_interface(Time, rad_lat_soc, rad_lon_soc, soc_lw_mode, &
+ tg_tmp_soc, q_soc, ozone_soc, co2_soc, t_surf_for_soc, p_full_soc, &
+ p_half_soc, z_full_soc, z_half_soc, albedo_soc, coszen, rrsun, &
+ n_profile, n_layer, cld_frac_soc, reff_rad_soc, mmr_cl_rad_soc, &
+ output_heating_rate_sw, output_soc_flux_sw_down, output_soc_flux_sw_up, &
+ do_cloud_simple)
+
tg_tmp_soc = tg_tmp_soc + output_heating_rate_sw*delta_t !Output heating rate in K/s, so is a temperature tendency
net_surf_sw_down(:,:) = REAL(output_soc_flux_sw_down(:,:, n_layer+1)-output_soc_flux_sw_up(:,:,n_layer+1) )
From 98de89662173e868e3dad2e7a13bfc4aa6b5ea72 Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Wed, 12 Sep 2018 17:56:16 +0100
Subject: [PATCH 023/304] Added a with and without cloud test case for soc
---
.../socrates_test/socrates_aquaplanet.py | 19 +-
.../socrates_aquaplanet_with_cloud.py | 209 ++++++++++++++++++
2 files changed, 218 insertions(+), 10 deletions(-)
create mode 100644 exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
diff --git a/exp/test_cases/socrates_test/socrates_aquaplanet.py b/exp/test_cases/socrates_test/socrates_aquaplanet.py
index f2092f0da..91c6c27d3 100644
--- a/exp/test_cases/socrates_test/socrates_aquaplanet.py
+++ b/exp/test_cases/socrates_test/socrates_aquaplanet.py
@@ -23,7 +23,7 @@
# create an Experiment object to handle the configuration of model parameters
# and output diagnostics
-exp = Experiment('soc_test_aquaplanet', codebase=cb)
+exp = Experiment('soc_test_aquaplanet_without_clouds', codebase=cb)
exp.clear_rundir()
inputfiles = [os.path.join(GFDL_BASE,'input/rrtm_input_files/ozone_1990.nc')]
@@ -52,6 +52,11 @@
diag.add_field('socrates', 'soc_surf_flux_sw', time_avg=True)
diag.add_field('socrates', 'soc_olr', time_avg=True)
diag.add_field('socrates', 'soc_toa_sw', time_avg=True)
+diag.add_field('cloud_simple', 'cf_rad', time_avg=True)
+diag.add_field('cloud_simple', 'reff_rad', time_avg=True)
+diag.add_field('cloud_simple', 'frac_liq', time_avg=True)
+diag.add_field('cloud_simple', 'qcl_rad', time_avg=True)
+
# additional output options commented out
#diag.add_field('socrates', 'soc_flux_lw', time_avg=True)
#diag.add_field('socrates', 'soc_flux_sw', time_avg=True)
@@ -99,15 +104,9 @@
'two_stream_gray': False, #Use the grey radiation scheme
'do_socrates_radiation': True,
'convection_scheme': 'SIMPLE_BETTS_MILLER', #Use simple Betts miller convection
- 'do_cloud_simple': True
+ 'do_cloud_simple': False
},
- 'cloud_simple_nml': {
- 'simple_cca':0.0,
- 'rhcsfc': 0.95,
- 'rhc700': 0.7,
- 'rhc200': 0.3
- },
'vert_turb_driver_nml': {
'do_mellor_yamada': False, # default: True
@@ -200,5 +199,5 @@
cb.compile(debug=False)
exp.run(1, use_restart=False, num_cores=NCORES, overwrite_data=True)#, run_idb=True)
-# for i in range(2,121):
-# exp.run(i, num_cores=NCORES)
+ for i in range(2,121):
+ exp.run(i, num_cores=NCORES)
diff --git a/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
new file mode 100644
index 000000000..fa0d348fe
--- /dev/null
+++ b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
@@ -0,0 +1,209 @@
+import os
+
+import numpy as np
+
+from isca import SocratesCodeBase, DiagTable, Experiment, Namelist, GFDL_BASE
+from isca.util import exp_progress
+
+NCORES = 16
+base_dir = os.path.dirname(os.path.realpath(__file__))
+# a CodeBase can be a directory on the computer,
+# useful for iterative development
+cb = SocratesCodeBase.from_directory(GFDL_BASE)
+
+# or it can point to a specific git repo and commit id.
+# This method should ensure future, independent, reproducibility of results.
+# cb = DryCodeBase.from_repo(repo='https://github.com/isca/isca', commit='isca1.1')
+
+# compilation depends on computer specific settings. The $GFDL_ENV
+# environment variable is used to determine which `$GFDL_BASE/src/extra/env` file
+# is used to load the correct compilers. The env file is always loaded from
+# $GFDL_BASE and not the checked out git repo.
+
+# create an Experiment object to handle the configuration of model parameters
+# and output diagnostics
+
+exp = Experiment('soc_test_aquaplanet_with_clouds', codebase=cb)
+exp.clear_rundir()
+
+inputfiles = [os.path.join(GFDL_BASE,'input/rrtm_input_files/ozone_1990.nc')]
+
+#Tell model how to write diagnostics
+diag = DiagTable()
+diag.add_file('atmos_monthly', 30, 'days', time_units='days')
+
+#Tell model which diagnostics to write
+diag.add_field('dynamics', 'ps', time_avg=True)
+diag.add_field('dynamics', 'bk')
+diag.add_field('dynamics', 'pk')
+diag.add_field('atmosphere', 'precipitation', time_avg=True)
+diag.add_field('mixed_layer', 't_surf', time_avg=True)
+diag.add_field('dynamics', 'sphum', time_avg=True)
+diag.add_field('dynamics', 'ucomp', time_avg=True)
+diag.add_field('dynamics', 'vcomp', time_avg=True)
+diag.add_field('dynamics', 'temp', time_avg=True)
+diag.add_field('dynamics', 'vor', time_avg=True)
+diag.add_field('dynamics', 'div', time_avg=True)
+
+diag.add_field('socrates', 'soc_tdt_lw', time_avg=True)
+diag.add_field('socrates', 'soc_tdt_sw', time_avg=True)
+diag.add_field('socrates', 'soc_tdt_rad', time_avg=True)
+diag.add_field('socrates', 'soc_surf_flux_lw', time_avg=True)
+diag.add_field('socrates', 'soc_surf_flux_sw', time_avg=True)
+diag.add_field('socrates', 'soc_olr', time_avg=True)
+diag.add_field('socrates', 'soc_toa_sw', time_avg=True)
+diag.add_field('cloud_simple', 'cf_rad', time_avg=True)
+diag.add_field('cloud_simple', 'reff_rad', time_avg=True)
+diag.add_field('cloud_simple', 'frac_liq', time_avg=True)
+diag.add_field('cloud_simple', 'qcl_rad', time_avg=True)
+
+# additional output options commented out
+#diag.add_field('socrates', 'soc_flux_lw', time_avg=True)
+#diag.add_field('socrates', 'soc_flux_sw', time_avg=True)
+#diag.add_field('socrates', 'soc_co2', time_avg=True)
+#diag.add_field('socrates', 'soc_ozone', time_avg=True)
+#diag.add_field('socrates', 'soc_coszen', time_avg=True)
+#diag.add_field('socrates', 'soc_spectral_olr', time_avg=True)
+
+exp.diag_table = diag
+exp.inputfiles = inputfiles
+
+#Define values for the 'core' namelist
+exp.namelist = namelist = Namelist({
+ 'main_nml':{
+ 'days' : 30,
+ 'hours' : 0,
+ 'minutes': 0,
+ 'seconds': 0,
+ 'dt_atmos':600,
+ 'current_date' : [1,1,1,0,0,0],
+ 'calendar' : 'thirty_day'
+ },
+ 'socrates_rad_nml': {
+ 'stellar_constant':1370.,
+ 'lw_spectral_filename':os.path.join(GFDL_BASE,'src/atmos_param/socrates/src/trunk/data/spectra/ga7/sp_lw_ga7'),
+ 'sw_spectral_filename':os.path.join(GFDL_BASE,'src/atmos_param/socrates/src/trunk/data/spectra/ga7/sp_sw_ga7'),
+ 'do_read_ozone': True,
+ 'ozone_file_name':'ozone_1990',
+ 'ozone_field_name':'ozone_1990',
+ 'dt_rad':3600,
+ 'store_intermediate_rad':True,
+ 'chunk_size': 16,
+ 'use_pressure_interp_for_half_levels':False,
+ 'tidally_locked':False
+ },
+ 'idealized_moist_phys_nml': {
+ 'do_damping': True,
+ 'turb':True,
+ 'mixed_layer_bc':True,
+ 'do_virtual' :False,
+ 'do_simple': True,
+ 'roughness_mom':3.21e-05,
+ 'roughness_heat':3.21e-05,
+ 'roughness_moist':3.21e-05,
+ 'two_stream_gray': False, #Use the grey radiation scheme
+ 'do_socrates_radiation': True,
+ 'convection_scheme': 'SIMPLE_BETTS_MILLER', #Use simple Betts miller convection
+ 'do_cloud_simple': True
+ },
+
+ 'cloud_simple_nml': {
+ 'simple_cca':0.0,
+ 'rhcsfc': 0.95,
+ 'rhc700': 0.7,
+ 'rhc200': 0.3
+ },
+
+ 'vert_turb_driver_nml': {
+ 'do_mellor_yamada': False, # default: True
+ 'do_diffusivity': True, # default: False
+ 'do_simple': True, # default: False
+ 'constant_gust': 0.0, # default: 1.0
+ 'use_tau': False
+ },
+
+ 'diffusivity_nml': {
+ 'do_entrain':False,
+ 'do_simple': True,
+ },
+
+ 'surface_flux_nml': {
+ 'use_virtual_temp': False,
+ 'do_simple': True,
+ 'old_dtaudv': True
+ },
+
+ 'atmosphere_nml': {
+ 'idealized_moist_model': True
+ },
+
+ #Use a large mixed-layer depth, and the Albedo of the CTRL case in Jucker & Gerber, 2017
+ 'mixed_layer_nml': {
+ 'tconst' : 285.,
+ 'prescribe_initial_dist':True,
+ 'evaporation':True,
+ 'depth': 2.5, #Depth of mixed layer used
+ 'albedo_value': 0.38, #Albedo value used
+ },
+
+ 'qe_moist_convection_nml': {
+ 'rhbm':0.7,
+ 'Tmin':160.,
+ 'Tmax':350.
+ },
+
+ 'lscale_cond_nml': {
+ 'do_simple':True,
+ 'do_evap':True
+ },
+
+ 'sat_vapor_pres_nml': {
+ 'do_simple':True,
+ 'construct_table_wrt_liq_and_ice':True
+ },
+
+ 'damping_driver_nml': {
+ 'do_rayleigh': True,
+ 'trayfric': -0.5, # neg. value: time in *days*
+ 'sponge_pbottom': 150., #Setting the lower pressure boundary for the model sponge layer in Pa.
+ 'do_conserve_energy': True,
+ },
+
+ # FMS Framework configuration
+ 'diag_manager_nml': {
+ 'mix_snapshot_average_fields': False # time avg fields are labelled with time in middle of window
+ },
+
+ 'fms_nml': {
+ 'domains_stack_size': 600000 # default: 0
+ },
+
+ 'fms_io_nml': {
+ 'threading_write': 'single', # default: multi
+ 'fileset_write': 'single', # default: multi
+ },
+
+ 'spectral_dynamics_nml': {
+ 'damping_order': 4,
+ 'water_correction_limit': 200.e2,
+ 'reference_sea_level_press':1.0e5,
+ 'num_levels':40, #How many model pressure levels to use
+ 'valid_range_t':[100.,800.],
+ 'initial_sphum':[2.e-6],
+ 'vert_coord_option':'uneven_sigma',
+ 'surf_res':0.2, #Parameter that sets the vertical distribution of sigma levels
+ 'scale_heights' : 11.0,
+ 'exponent':7.0,
+ 'robert_coeff':0.03
+ },
+
+})
+
+#Lets do a run!
+if __name__=="__main__":
+
+ cb.compile(debug=False)
+ exp.run(1, use_restart=False, num_cores=NCORES, overwrite_data=True)#, run_idb=True)
+
+ for i in range(2,121):
+ exp.run(i, num_cores=NCORES)
From 272ffac37fac99d76e57ddb2575f34c50c342523 Mon Sep 17 00:00:00 2001
From: sit23
Date: Thu, 6 Dec 2018 09:44:09 +0000
Subject: [PATCH 024/304] Small changes at James Manners suggestion. Changes
results A LOT, so this needs to be checked closely.
---
exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py | 2 +-
src/atmos_param/socrates/interface/set_dimen.F90 | 3 ++-
src/atmos_param/socrates/interface/socrates_interface.F90 | 2 +-
3 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
index fa0d348fe..647ec0751 100644
--- a/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
+++ b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
@@ -23,7 +23,7 @@
# create an Experiment object to handle the configuration of model parameters
# and output diagnostics
-exp = Experiment('soc_test_aquaplanet_with_clouds', codebase=cb)
+exp = Experiment('soc_test_aquaplanet_with_clouds_post_jm_suggestions', codebase=cb)
exp.clear_rundir()
inputfiles = [os.path.join(GFDL_BASE,'input/rrtm_input_files/ozone_1990.nc')]
diff --git a/src/atmos_param/socrates/interface/set_dimen.F90 b/src/atmos_param/socrates/interface/set_dimen.F90
index 4f62eb3f9..6cf8eeac8 100644
--- a/src/atmos_param/socrates/interface/set_dimen.F90
+++ b/src/atmos_param/socrates/interface/set_dimen.F90
@@ -63,7 +63,8 @@ SUBROUTINE set_dimen(control, dimen, spectrum, n_profile, n_layer, &
dimen%id_cloud_top = dimen%nd_layer + 1 - n_cloud_layer
IF (control%l_cloud) THEN
- dimen%nd_layer_clr = dimen%id_cloud_top - 1
+ dimen%nd_layer_clr = MAX(dimen%id_cloud_top - 1, dimen%nd_layer)
+ ! MAX(dimen%id_cloud_top - 1, 1)
ELSE
dimen%nd_layer_clr = dimen%nd_layer
END IF
diff --git a/src/atmos_param/socrates/interface/socrates_interface.F90 b/src/atmos_param/socrates/interface/socrates_interface.F90
index 407d70646..0bb0d91f8 100644
--- a/src/atmos_param/socrates/interface/socrates_interface.F90
+++ b/src/atmos_param/socrates/interface/socrates_interface.F90
@@ -504,7 +504,7 @@ subroutine socrates_interface(Time_diag, rlat, rlon, soc_lw_mode, &
!----------------------------i
! Set array sizes
- input_n_cloud_layer = 1
+ input_n_cloud_layer = n_layer
input_n_aer_mode = n_layer
input_cld_subcol_gen = n_layer
input_cld_subcol_req = n_layer
From 68c24b42677bdaecbbaf6255b4902d7cb13f1db1 Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Thu, 6 Dec 2018 11:22:17 +0000
Subject: [PATCH 025/304] Update suite to have more diagnostics
---
.../socrates_test/socrates_aquaplanet_with_cloud.py | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
index 647ec0751..2803f3100 100644
--- a/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
+++ b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
@@ -56,6 +56,9 @@
diag.add_field('cloud_simple', 'reff_rad', time_avg=True)
diag.add_field('cloud_simple', 'frac_liq', time_avg=True)
diag.add_field('cloud_simple', 'qcl_rad', time_avg=True)
+diag.add_field('cloud_simple', 'simple_rhcrit', time_avg=True)
+diag.add_field('cloud_simple', 'rh_in_cf', time_avg=True)
+
# additional output options commented out
#diag.add_field('socrates', 'soc_flux_lw', time_avg=True)
@@ -90,7 +93,8 @@
'store_intermediate_rad':True,
'chunk_size': 16,
'use_pressure_interp_for_half_levels':False,
- 'tidally_locked':False
+ 'tidally_locked':False,
+ 'sol_day':90
},
'idealized_moist_phys_nml': {
'do_damping': True,
From 96b74ec15a43ce19b1b79cb67196e35453bd3dad Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Thu, 6 Dec 2018 11:23:24 +0000
Subject: [PATCH 026/304] Changes to simple clouds for more fields to be
outputted
---
src/atmos_param/cloud_simple/cloud_simple.F90 | 91 ++++++++++++-------
1 file changed, 56 insertions(+), 35 deletions(-)
diff --git a/src/atmos_param/cloud_simple/cloud_simple.F90 b/src/atmos_param/cloud_simple/cloud_simple.F90
index c35708ad3..ffcae1385 100644
--- a/src/atmos_param/cloud_simple/cloud_simple.F90
+++ b/src/atmos_param/cloud_simple/cloud_simple.F90
@@ -28,7 +28,9 @@ module cloud_simple_mod
rhmsfc, rhm700, rhm200
real :: zerodegc = 273.15
- integer :: id_cf_rad, id_reff_rad, id_frac_liq, id_qcl_rad
+ integer :: id_cf, id_reff_rad, id_frac_liq, id_qcl_rad, id_rh_in_cf, id_simple_rhcrit
+
+
character(len=14), parameter :: mod_name_cld = "cloud_simple"
contains
@@ -57,8 +59,8 @@ subroutine cloud_simple_init (axes, Time)
write(stdlog_unit, cloud_simple_nml)
!register diagnostics
- id_cf_rad = &
- register_diag_field ( mod_name_cld, 'cf_rad', axes(1:3), Time, &
+ id_cf = &
+ register_diag_field ( mod_name_cld, 'cf', axes(1:3), Time, &
'Cloud fraction for the simple cloud scheme', 'unitless: values 0-1')
id_frac_liq = &
@@ -76,30 +78,45 @@ subroutine cloud_simple_init (axes, Time)
'Specific humidity of cloud liquid', &
'kg/kg')
+
+ id_rh_in_cf = &
+ register_diag_field ( mod_name_cld, 'rh_in_cf', axes(1:3), Time, &
+ 'RH as a percent', &
+ '%')
+
+ id_simple_rhcrit = &
+ register_diag_field ( mod_name_cld, 'simple_rhcrit', axes(1:3), Time, &
+ 'RH as a percent', &
+ '%')
+
+
+
+
+
do_init = .false. !initialisation completed
end subroutine cloud_simple_init
!-----------------------------------------------
- subroutine cloud_simple (p_half, p_full, Time, &
- temp, q_hum, &
+ subroutine cloud_simple(p_half, p_full, Time, &
+ temp, q_hum, &
! outs
- cf_rad, reff_rad, qcl_rad )
+ cf, reff_rad, qcl_rad )
real , intent(in), dimension(:,:,:) :: temp, q_hum, p_full, p_half
type(time_type) , intent(in) :: Time
- real , intent(out), dimension(:,:,:) :: cf_rad, reff_rad, qcl_rad
+ real , intent(out), dimension(:,:,:) :: cf, reff_rad, qcl_rad
+
+ real, dimension(size(temp,1), size(temp, 2), size(temp, 3)) :: qs, frac_liq, rh_in_cf, simple_rhcrit
- real, dimension(size(temp,1), size(temp, 2), size(temp, 3)) :: qs, frac_liq
- real :: simple_rhcrit
integer :: i, j, k, k_surf
logical :: es_over_liq_and_ice
- real :: tmp1, tmp2 !remove tmp1 and tmp2 after debugging
+ real :: tmp1, tmp2 !remove tmp1 and tmp2 after debugging
!check initiation has been done - ie read in parameters
if (do_init) call error_mesg ('cloud_simple', &
@@ -117,20 +134,15 @@ subroutine cloud_simple (p_half, p_full, Time, &
!caluclate the frac_liq
call calc_liq_frac(temp(i,j,k), frac_liq(i,j,k))
call calc_reff(frac_liq(i,j,k), reff_rad(i,j,k))
- call calc_rhcrit(p_full(i,j,k), p_full(i,j,k_surf), simple_rhcrit)
- call calc_cf_rad(q_hum(i,j,k), qs(i,j,k), simple_rhcrit, cf_rad(i,j,k))
- call calc_qcl_rad(p_full(i,j,k), cf_rad(i,j,k), qcl_rad(i,j,k) )
+ call calc_rhcrit(p_full(i,j,k), p_full(i,j,k_surf), simple_rhcrit(i,j,k))
+ call calc_cf(q_hum(i,j,k), qs(i,j,k), simple_rhcrit(i,j,k), cf(i,j,k),rh_in_cf(i,j,k))
+ call calc_qcl_rad(p_full(i,j,k), cf(i,j,k), qcl_rad(i,j,k) )
end do
end do
end do
!save some diagnotics
- call output_cloud_diags(cf_rad, reff_rad, frac_liq, qcl_rad, Time )
-
-tmp2 = maxval(cf_rad)
-tmp1 = maxval(reff_rad)
-tmp2 = maxval(cf_rad)
-
+ call output_cloud_diags(cf, reff_rad, frac_liq, qcl_rad, rh_in_cf, simple_rhcrit, Time )
end subroutine cloud_simple
@@ -184,17 +196,18 @@ subroutine calc_rhcrit(p_full, p_surf, simple_rhcrit) !need to check p_full -
end subroutine calc_rhcrit
- subroutine calc_cf_rad (q_hum, qsat, simple_rhcrit, cf_rad)
+ subroutine calc_cf (q_hum, qsat, simple_rhcrit, cf, rh)
! Calculate LS (stratiform) cloud fraction
! as a simple linear function of RH
real, intent(in) :: q_hum, qsat, simple_rhcrit
- real, intent(out) :: cf_rad
+ real, intent(out) :: cf, rh
- real :: rh, cca
+ real :: cca
rh = q_hum/qsat
- cf_rad = MAX( 0.0, MIN( 1.0, ( rh - simple_rhcrit ) / ( 1.0 - simple_rhcrit ) ))
+ cf = MAX( 0.0, MIN( 1.0, ( rh - simple_rhcrit ) / ( 1.0 - simple_rhcrit ) ))
+
! include simple convective cloud fraction where present
@@ -202,17 +215,16 @@ subroutine calc_cf_rad (q_hum, qsat, simple_rhcrit, cf_rad)
! left in for fture use
if (cca > 0.0) then
- cf_rad = MAX( simple_cca, cf_rad )
+ cf = MAX( simple_cca, cf )
end if
+
-
-
- end subroutine calc_cf_rad
+ end subroutine calc_cf
- subroutine calc_qcl_rad(p_full, cf_rad, qcl_rad)
- ! calculate simple water content
+ subroutine calc_qcl_rad(p_full, cf, qcl_rad)
+ ! calculate water content
- real , intent(in) :: p_full, cf_rad
+ real , intent(in) :: p_full, cf
real , intent(out) :: qcl_rad
real :: in_cloud_qcl
@@ -222,22 +234,22 @@ subroutine calc_qcl_rad(p_full, cf_rad, qcl_rad)
in_cloud_qcl = MAX ( 0.0, in_cloud_qcl/1000.0 ) ! convert to kg/kg
- qcl_rad = cf_rad * in_cloud_qcl
+ qcl_rad = cf * in_cloud_qcl
end subroutine calc_qcl_rad
- subroutine output_cloud_diags(cf_rad, reff_rad, frac_liq, qcl_rad, Time)
+ subroutine output_cloud_diags(cf, reff_rad, frac_liq, qcl_rad, rh_in_cf, simple_rhcrit, Time)
- real, intent(in), dimension(:,:,:) :: cf_rad, reff_rad, frac_liq, qcl_rad
+ real, intent(in), dimension(:,:,:) :: cf, reff_rad, frac_liq, qcl_rad, rh_in_cf, simple_rhcrit
type(time_type) , intent(in) :: Time
real :: used
- if ( id_cf_rad > 0 ) then
- used = send_data ( id_cf_rad, cf_rad, Time)
+ if ( id_cf > 0 ) then
+ used = send_data ( id_cf, cf, Time)
endif
if ( id_reff_rad > 0 ) then
@@ -252,6 +264,15 @@ subroutine output_cloud_diags(cf_rad, reff_rad, frac_liq, qcl_rad, Time)
used = send_data ( id_qcl_rad, qcl_rad, Time)
endif
+ if ( id_rh_in_cf > 0 ) then
+ used = send_data ( id_rh_in_cf, rh_in_cf*100., Time)
+ endif
+
+ if ( id_simple_rhcrit > 0 ) then
+ used = send_data ( id_simple_rhcrit, simple_rhcrit*100.0, Time)
+ endif
+
+
end subroutine output_cloud_diags
From 874029c6667d99aed869d568f5b3aae476bd2322 Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Thu, 6 Dec 2018 11:24:16 +0000
Subject: [PATCH 027/304] Change to cloud layer will have no science impact but
easier to understand logic
---
src/atmos_param/socrates/interface/set_dimen.F90 | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/atmos_param/socrates/interface/set_dimen.F90 b/src/atmos_param/socrates/interface/set_dimen.F90
index 6cf8eeac8..01d9aca75 100644
--- a/src/atmos_param/socrates/interface/set_dimen.F90
+++ b/src/atmos_param/socrates/interface/set_dimen.F90
@@ -61,10 +61,12 @@ SUBROUTINE set_dimen(control, dimen, spectrum, n_profile, n_layer, &
dimen%nd_subcol_gen = cld_subcol_gen
dimen%nd_subcol_req = cld_subcol_req
-dimen%id_cloud_top = dimen%nd_layer + 1 - n_cloud_layer
+dimen%id_cloud_top = dimen%nd_layer + 1 - n_cloud_layer !ie TOA
IF (control%l_cloud) THEN
- dimen%nd_layer_clr = MAX(dimen%id_cloud_top - 1, dimen%nd_layer)
- ! MAX(dimen%id_cloud_top - 1, 1)
+ ! this gives the allocate the full column for radiation
+ ! rather than the layers over which cloud is present
+ dimen%nd_layer_clr = dimen%nd_layer
+
ELSE
dimen%nd_layer_clr = dimen%nd_layer
END IF
From 6394b914f5a48034edcc6f1e140560ffd7158b2d Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Thu, 6 Dec 2018 12:04:20 +0000
Subject: [PATCH 028/304] qsat is causing very large RH values. Debugging
---
exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py | 2 +-
src/atmos_param/cloud_simple/cloud_simple.F90 | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
index 2803f3100..10afc714b 100644
--- a/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
+++ b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
@@ -52,7 +52,7 @@
diag.add_field('socrates', 'soc_surf_flux_sw', time_avg=True)
diag.add_field('socrates', 'soc_olr', time_avg=True)
diag.add_field('socrates', 'soc_toa_sw', time_avg=True)
-diag.add_field('cloud_simple', 'cf_rad', time_avg=True)
+diag.add_field('cloud_simple', 'cf', time_avg=True)
diag.add_field('cloud_simple', 'reff_rad', time_avg=True)
diag.add_field('cloud_simple', 'frac_liq', time_avg=True)
diag.add_field('cloud_simple', 'qcl_rad', time_avg=True)
diff --git a/src/atmos_param/cloud_simple/cloud_simple.F90 b/src/atmos_param/cloud_simple/cloud_simple.F90
index ffcae1385..e1e57b04b 100644
--- a/src/atmos_param/cloud_simple/cloud_simple.F90
+++ b/src/atmos_param/cloud_simple/cloud_simple.F90
@@ -123,7 +123,7 @@ subroutine cloud_simple(p_half, p_full, Time, &
'cloud_simple_init has not been called.', FATAL)
! Get the saturated specific humidity TOTAL (ie ice and vap) ***double check maths!
- call compute_qs(temp, p_full, qs, es_over_liq_and_ice=.true.) !qs=qsat in um
+ call compute_qs(temp, p_full, qs) !qs=qsat in um
k_surf = size(temp, 3)
From 9af0ae6635c7678a0ddef0412de86995dcce83d1 Mon Sep 17 00:00:00 2001
From: sit23
Date: Thu, 6 Dec 2018 12:09:20 +0000
Subject: [PATCH 029/304] Updated experiment.
---
.../socrates_test/socrates_aquaplanet_with_cloud.py | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
index 2803f3100..8b6a36f79 100644
--- a/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
+++ b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
@@ -37,6 +37,7 @@
diag.add_field('dynamics', 'bk')
diag.add_field('dynamics', 'pk')
diag.add_field('atmosphere', 'precipitation', time_avg=True)
+diag.add_field('atmosphere', 'rh', time_avg=True)
diag.add_field('mixed_layer', 't_surf', time_avg=True)
diag.add_field('dynamics', 'sphum', time_avg=True)
diag.add_field('dynamics', 'ucomp', time_avg=True)
@@ -52,7 +53,7 @@
diag.add_field('socrates', 'soc_surf_flux_sw', time_avg=True)
diag.add_field('socrates', 'soc_olr', time_avg=True)
diag.add_field('socrates', 'soc_toa_sw', time_avg=True)
-diag.add_field('cloud_simple', 'cf_rad', time_avg=True)
+diag.add_field('cloud_simple', 'cf', time_avg=True)
diag.add_field('cloud_simple', 'reff_rad', time_avg=True)
diag.add_field('cloud_simple', 'frac_liq', time_avg=True)
diag.add_field('cloud_simple', 'qcl_rad', time_avg=True)
@@ -94,7 +95,7 @@
'chunk_size': 16,
'use_pressure_interp_for_half_levels':False,
'tidally_locked':False,
- 'sol_day':90
+ 'solday':90
},
'idealized_moist_phys_nml': {
'do_damping': True,
@@ -207,7 +208,7 @@
if __name__=="__main__":
cb.compile(debug=False)
- exp.run(1, use_restart=False, num_cores=NCORES, overwrite_data=True)#, run_idb=True)
+ exp.run(1, use_restart=False, num_cores=NCORES, overwrite_data=False)#, run_idb=True)
- for i in range(2,121):
+ for i in range(2,125):
exp.run(i, num_cores=NCORES)
From 51443eac96ad1e7e31d29d8d991566af5feb0edf Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Thu, 6 Dec 2018 15:35:26 +0000
Subject: [PATCH 030/304] Adding comments. No science changes
---
src/atmos_param/cloud_simple/cloud_simple.F90 | 27 +++++++------------
1 file changed, 10 insertions(+), 17 deletions(-)
diff --git a/src/atmos_param/cloud_simple/cloud_simple.F90 b/src/atmos_param/cloud_simple/cloud_simple.F90
index e1e57b04b..b27ba5788 100644
--- a/src/atmos_param/cloud_simple/cloud_simple.F90
+++ b/src/atmos_param/cloud_simple/cloud_simple.F90
@@ -116,14 +116,12 @@ subroutine cloud_simple(p_half, p_full, Time, &
logical :: es_over_liq_and_ice
- real :: tmp1, tmp2 !remove tmp1 and tmp2 after debugging
-
!check initiation has been done - ie read in parameters
if (do_init) call error_mesg ('cloud_simple', &
'cloud_simple_init has not been called.', FATAL)
! Get the saturated specific humidity TOTAL (ie ice and vap) ***double check maths!
- call compute_qs(temp, p_full, qs) !qs=qsat in um
+ call compute_qs(temp, p_full, qs)
k_surf = size(temp, 3)
@@ -131,7 +129,9 @@ subroutine cloud_simple(p_half, p_full, Time, &
do j=1, size(temp, 2)
do k=1, size(temp, 3)
- !caluclate the frac_liq
+ ! caluclate the liquid fraction, effective radius, critical RH for
+ ! the simple cloud scheme and cloud fraction.
+ ! rh_in_cf is an output diagnostic only for debugging
call calc_liq_frac(temp(i,j,k), frac_liq(i,j,k))
call calc_reff(frac_liq(i,j,k), reff_rad(i,j,k))
call calc_rhcrit(p_full(i,j,k), p_full(i,j,k_surf), simple_rhcrit(i,j,k))
@@ -166,6 +166,7 @@ subroutine calc_liq_frac(temp, frac_liq)
end subroutine calc_liq_frac
subroutine calc_reff(frac_liq, reff_rad)
+ ! the effective cloud radius is bounded between 10 and 20 microns
real, intent(in) :: frac_liq
real, intent(out) :: reff_rad
@@ -175,7 +176,7 @@ subroutine calc_reff(frac_liq, reff_rad)
end subroutine calc_reff
subroutine calc_rhcrit(p_full, p_surf, simple_rhcrit) !need to check p_full - > p_layer_centres
-
+ !get the RH needed as a threshold for the cloud fraction calc.
real, intent(in) :: p_full, p_surf
real, intent(out) :: simple_rhcrit
@@ -209,10 +210,9 @@ subroutine calc_cf (q_hum, qsat, simple_rhcrit, cf, rh)
cf = MAX( 0.0, MIN( 1.0, ( rh - simple_rhcrit ) / ( 1.0 - simple_rhcrit ) ))
- ! include simple convective cloud fraction where present
-
+ ! include simple convective cloud fraction where present (not currenly used)
cca = 0.0 ! no convective cloud fraction is calculated
- ! left in for fture use
+ ! left in for future use
if (cca > 0.0) then
cf = MAX( simple_cca, cf )
@@ -222,7 +222,7 @@ subroutine calc_cf (q_hum, qsat, simple_rhcrit, cf, rh)
end subroutine calc_cf
subroutine calc_qcl_rad(p_full, cf, qcl_rad)
- ! calculate water content
+ ! calculate cloud water content
real , intent(in) :: p_full, cf
real , intent(out) :: qcl_rad
@@ -238,8 +238,6 @@ subroutine calc_qcl_rad(p_full, cf, qcl_rad)
end subroutine calc_qcl_rad
-
-
subroutine output_cloud_diags(cf, reff_rad, frac_liq, qcl_rad, rh_in_cf, simple_rhcrit, Time)
real, intent(in), dimension(:,:,:) :: cf, reff_rad, frac_liq, qcl_rad, rh_in_cf, simple_rhcrit
@@ -272,16 +270,11 @@ subroutine output_cloud_diags(cf, reff_rad, frac_liq, qcl_rad, rh_in_cf, simple_
used = send_data ( id_simple_rhcrit, simple_rhcrit*100.0, Time)
endif
-
-
end subroutine output_cloud_diags
- !-----------------------------------------------
-
-
subroutine cloud_simple_end ()
- ! do we deallocate anything?
+ ! If alloocated are added in init then deallocate them here.
end subroutine cloud_simple_end
From a4c0d02924e19ba792e1c75873b3d62e191bada0 Mon Sep 17 00:00:00 2001
From: sit23
Date: Thu, 6 Dec 2018 15:48:09 +0000
Subject: [PATCH 031/304] Made some changes to socrates cloud test experiment.
---
.../socrates_test/socrates_aquaplanet_with_cloud.py | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
index 8b6a36f79..f4500f04e 100644
--- a/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
+++ b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
@@ -62,8 +62,8 @@
# additional output options commented out
-#diag.add_field('socrates', 'soc_flux_lw', time_avg=True)
-#diag.add_field('socrates', 'soc_flux_sw', time_avg=True)
+diag.add_field('socrates', 'soc_flux_lw', time_avg=True)
+diag.add_field('socrates', 'soc_flux_sw', time_avg=True)
#diag.add_field('socrates', 'soc_co2', time_avg=True)
#diag.add_field('socrates', 'soc_ozone', time_avg=True)
#diag.add_field('socrates', 'soc_coszen', time_avg=True)
@@ -148,7 +148,7 @@
'prescribe_initial_dist':True,
'evaporation':True,
'depth': 2.5, #Depth of mixed layer used
- 'albedo_value': 0.38, #Albedo value used
+ 'albedo_value': 0.2, #Albedo value used
},
'qe_moist_convection_nml': {
@@ -210,5 +210,5 @@
cb.compile(debug=False)
exp.run(1, use_restart=False, num_cores=NCORES, overwrite_data=False)#, run_idb=True)
- for i in range(2,125):
+ for i in range(2,171):
exp.run(i, num_cores=NCORES)
From 42ec5ebd9fd145d6a80c86a5a6eef90b98f76f91 Mon Sep 17 00:00:00 2001
From: sit23
Date: Fri, 14 Dec 2018 10:25:34 +0000
Subject: [PATCH 032/304] New test case with land and specified ssts.
---
...es_aquaplanet_with_cloud_amip_with_topo.py | 234 ++++++++++++++++++
.../scripts/run_plevel.py | 14 +-
2 files changed, 242 insertions(+), 6 deletions(-)
create mode 100644 exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud_amip_with_topo.py
diff --git a/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud_amip_with_topo.py b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud_amip_with_topo.py
new file mode 100644
index 000000000..0c88efd1d
--- /dev/null
+++ b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud_amip_with_topo.py
@@ -0,0 +1,234 @@
+import os
+
+import numpy as np
+
+from isca import SocratesCodeBase, DiagTable, Experiment, Namelist, GFDL_BASE
+from isca.util import exp_progress
+
+NCORES = 16
+base_dir = os.path.dirname(os.path.realpath(__file__))
+# a CodeBase can be a directory on the computer,
+# useful for iterative development
+cb = SocratesCodeBase.from_directory(GFDL_BASE)
+
+# or it can point to a specific git repo and commit id.
+# This method should ensure future, independent, reproducibility of results.
+# cb = DryCodeBase.from_repo(repo='https://github.com/isca/isca', commit='isca1.1')
+
+# compilation depends on computer specific settings. The $GFDL_ENV
+# environment variable is used to determine which `$GFDL_BASE/src/extra/env` file
+# is used to load the correct compilers. The env file is always loaded from
+# $GFDL_BASE and not the checked out git repo.
+
+# create an Experiment object to handle the configuration of model parameters
+# and output diagnostics
+
+exp = Experiment('soc_test_aquaplanet_with_clouds_post_jm_suggestions_amip_ssts_land_low_albedo_with_land', codebase=cb)
+exp.clear_rundir()
+
+inputfiles = [os.path.join(GFDL_BASE,'input/rrtm_input_files/ozone_1990.nc'),
+ os.path.join(base_dir,'input/sst_clim_amip.nc'), os.path.join(GFDL_BASE,'input/land_masks/era_land_t42.nc')]
+
+#Tell model how to write diagnostics
+diag = DiagTable()
+diag.add_file('atmos_monthly', 30, 'days', time_units='days')
+
+#Tell model which diagnostics to write
+diag.add_field('dynamics', 'ps', time_avg=True)
+diag.add_field('dynamics', 'bk')
+diag.add_field('dynamics', 'pk')
+diag.add_field('dynamics', 'zsurf', time_avg=True)
+diag.add_field('atmosphere', 'precipitation', time_avg=True)
+diag.add_field('atmosphere', 'rh', time_avg=True)
+diag.add_field('mixed_layer', 't_surf', time_avg=True)
+diag.add_field('dynamics', 'sphum', time_avg=True)
+diag.add_field('dynamics', 'ucomp', time_avg=True)
+diag.add_field('dynamics', 'vcomp', time_avg=True)
+diag.add_field('dynamics', 'temp', time_avg=True)
+diag.add_field('dynamics', 'vor', time_avg=True)
+diag.add_field('dynamics', 'div', time_avg=True)
+
+diag.add_field('socrates', 'soc_tdt_lw', time_avg=True)
+diag.add_field('socrates', 'soc_tdt_sw', time_avg=True)
+diag.add_field('socrates', 'soc_tdt_rad', time_avg=True)
+diag.add_field('socrates', 'soc_surf_flux_lw', time_avg=True)
+diag.add_field('socrates', 'soc_surf_flux_sw', time_avg=True)
+diag.add_field('socrates', 'soc_olr', time_avg=True)
+diag.add_field('socrates', 'soc_toa_sw', time_avg=True)
+diag.add_field('cloud_simple', 'cf', time_avg=True)
+diag.add_field('cloud_simple', 'reff_rad', time_avg=True)
+diag.add_field('cloud_simple', 'frac_liq', time_avg=True)
+diag.add_field('cloud_simple', 'qcl_rad', time_avg=True)
+diag.add_field('cloud_simple', 'simple_rhcrit', time_avg=True)
+diag.add_field('cloud_simple', 'rh_in_cf', time_avg=True)
+diag.add_field('mixed_layer', 'albedo', time_avg=True)
+
+
+# additional output options commented out
+diag.add_field('socrates', 'soc_flux_lw', time_avg=True)
+diag.add_field('socrates', 'soc_flux_sw', time_avg=True)
+#diag.add_field('socrates', 'soc_co2', time_avg=True)
+#diag.add_field('socrates', 'soc_ozone', time_avg=True)
+#diag.add_field('socrates', 'soc_coszen', time_avg=True)
+#diag.add_field('socrates', 'soc_spectral_olr', time_avg=True)
+
+exp.diag_table = diag
+exp.inputfiles = inputfiles
+
+#Define values for the 'core' namelist
+exp.namelist = namelist = Namelist({
+ 'main_nml':{
+ 'days' : 30,
+ 'hours' : 0,
+ 'minutes': 0,
+ 'seconds': 0,
+ 'dt_atmos':600,
+ 'current_date' : [1,1,1,0,0,0],
+ 'calendar' : 'thirty_day'
+ },
+ 'socrates_rad_nml': {
+ 'stellar_constant':1370.,
+ 'lw_spectral_filename':os.path.join(GFDL_BASE,'src/atmos_param/socrates/src/trunk/data/spectra/ga7/sp_lw_ga7'),
+ 'sw_spectral_filename':os.path.join(GFDL_BASE,'src/atmos_param/socrates/src/trunk/data/spectra/ga7/sp_sw_ga7'),
+ 'do_read_ozone': True,
+ 'ozone_file_name':'ozone_1990',
+ 'ozone_field_name':'ozone_1990',
+ 'dt_rad':3600,
+ 'store_intermediate_rad':True,
+ 'chunk_size': 16,
+ 'use_pressure_interp_for_half_levels':False,
+ 'tidally_locked':False,
+ },
+ 'idealized_moist_phys_nml': {
+ 'do_damping': True,
+ 'turb':True,
+ 'mixed_layer_bc':True,
+ 'do_virtual' :False,
+ 'do_simple': True,
+ 'roughness_mom':3.21e-05,
+ 'roughness_heat':3.21e-05,
+ 'roughness_moist':3.21e-05,
+ 'two_stream_gray': False, #Use the grey radiation scheme
+ 'do_socrates_radiation': True,
+ 'convection_scheme': 'SIMPLE_BETTS_MILLER', #Use simple Betts miller convection
+ 'do_cloud_simple': True,
+ 'land_option' : 'input',
+ 'land_file_name' : 'INPUT/era_land_t42.nc',
+ 'land_roughness_prefactor' :10.0,
+ },
+
+ 'cloud_simple_nml': {
+ 'simple_cca':0.0,
+ 'rhcsfc': 0.95,
+ 'rhc700': 0.7,
+ 'rhc200': 0.3
+ },
+
+ 'vert_turb_driver_nml': {
+ 'do_mellor_yamada': False, # default: True
+ 'do_diffusivity': True, # default: False
+ 'do_simple': True, # default: False
+ 'constant_gust': 0.0, # default: 1.0
+ 'use_tau': False
+ },
+
+ 'diffusivity_nml': {
+ 'do_entrain':False,
+ 'do_simple': True,
+ },
+
+ 'surface_flux_nml': {
+ 'use_virtual_temp': False,
+ 'do_simple': True,
+ 'old_dtaudv': True
+ },
+
+ 'atmosphere_nml': {
+ 'idealized_moist_model': True
+ },
+
+ #Use a large mixed-layer depth, and the Albedo of the CTRL case in Jucker & Gerber, 2017
+ 'mixed_layer_nml': {
+ 'tconst' : 285.,
+ 'prescribe_initial_dist':True,
+ 'evaporation':True,
+ 'depth': 20.0, #Depth of mixed layer used
+ 'albedo_value': 0.2, #Albedo value used
+ 'land_option': 'input', #Tell mixed layer to get land mask from input file
+ 'land_h_capacity_prefactor': 0.1, #What factor to multiply mixed-layer depth by over land.
+ 'albedo_value': 0.1, #Ocean albedo value
+ 'land_albedo_prefactor': 1.3, #What factor to multiply ocean albedo by over land
+ 'do_qflux' : False, #Don't use the prescribed analytical formula for q-fluxes
+ 'do_read_sst' : True, #Read in sst values from input file
+ 'do_sc_sst' : True, #Do specified ssts (need both to be true)
+ 'sst_file' : 'sst_clim_amip', #Set name of sst input file
+ 'specify_sst_over_ocean_only' : True, #Make sure sst only specified in regions of ocean.
+ },
+
+ 'qe_moist_convection_nml': {
+ 'rhbm':0.7,
+ 'Tmin':160.,
+ 'Tmax':350.
+ },
+
+ 'lscale_cond_nml': {
+ 'do_simple':True,
+ 'do_evap':True
+ },
+
+ 'sat_vapor_pres_nml': {
+ 'do_simple':True,
+ 'construct_table_wrt_liq_and_ice':True
+ },
+
+ 'damping_driver_nml': {
+ 'do_rayleigh': True,
+ 'trayfric': -0.5, # neg. value: time in *days*
+ 'sponge_pbottom': 150., #Setting the lower pressure boundary for the model sponge layer in Pa.
+ 'do_conserve_energy': True,
+ },
+
+ # FMS Framework configuration
+ 'diag_manager_nml': {
+ 'mix_snapshot_average_fields': False # time avg fields are labelled with time in middle of window
+ },
+
+ 'fms_nml': {
+ 'domains_stack_size': 600000 # default: 0
+ },
+
+ 'fms_io_nml': {
+ 'threading_write': 'single', # default: multi
+ 'fileset_write': 'single', # default: multi
+ },
+
+ 'spectral_dynamics_nml': {
+ 'damping_order': 4,
+ 'water_correction_limit': 200.e2,
+ 'reference_sea_level_press':1.0e5,
+ 'num_levels':40, #How many model pressure levels to use
+ 'valid_range_t':[100.,800.],
+ 'initial_sphum':[2.e-6],
+ 'vert_coord_option':'uneven_sigma',
+ 'surf_res':0.2, #Parameter that sets the vertical distribution of sigma levels
+ 'scale_heights' : 11.0,
+ 'exponent':7.0,
+ 'robert_coeff':0.03,
+ 'ocean_topog_smoothing': 0.8
+ },
+
+ 'spectral_init_cond_nml':{
+ 'topog_file_name': 'era_land_t42.nc',
+ 'topography_option': 'input'
+ },
+
+})
+
+#Lets do a run!
+if __name__=="__main__":
+
+ cb.compile(debug=False)
+ exp.run(1, use_restart=False, num_cores=NCORES, overwrite_data=False)#, run_idb=True)
+
+ for i in range(2,241):
+ exp.run(i, num_cores=NCORES)
diff --git a/postprocessing/plevel_interpolation/scripts/run_plevel.py b/postprocessing/plevel_interpolation/scripts/run_plevel.py
index 294ecb53a..5a04db3c1 100644
--- a/postprocessing/plevel_interpolation/scripts/run_plevel.py
+++ b/postprocessing/plevel_interpolation/scripts/run_plevel.py
@@ -7,11 +7,11 @@
import subprocess
start_time=time.time()
-base_dir='/scratch/sit204/Data_2013/'
-exp_name_list = ['no_ice_flux_lhe_exps_q_flux_hadgem_anoms_3']
+base_dir='/scratch/sit204/data_isca/'
+exp_name_list = ['soc_test_aquaplanet_with_clouds_post_jm_suggestions_amip_ssts_land_low_albedo']
avg_or_daily_list=['monthly']
-start_file=287
-end_file=288
+start_file=96
+end_file=120
nfiles=(end_file-start_file)+1
do_extra_averaging=False #If true, then 6hourly data is averaged into daily data using cdo
@@ -66,10 +66,12 @@
number_prefix=''
- if n+start_file < 100:
+ if n+start_file < 1000:
number_prefix='0'
- if n+start_file < 10:
+ if n+start_file < 100:
number_prefix='00'
+ if n+start_file < 10:
+ number_prefix='000'
nc_file_in = base_dir+'/'+exp_name+'/run'+number_prefix+str(n+start_file)+'/atmos_'+avg_or_daily+'.nc'
nc_file_out = out_dir+'/'+exp_name+'/run'+number_prefix+str(n+start_file)+'/atmos_'+avg_or_daily+file_suffix+'.nc'
From f8bdfa7a07cdfeaed6687bf8b162e42ac8b85fc0 Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Thu, 28 Mar 2019 09:27:12 +0000
Subject: [PATCH 033/304] Adding diagnostics for clear sky in order to do CRE
calculation.
---
.../socrates_aquaplanet_with_cloud.py | 31 +-
.../socrates/interface/socrates_calc.F90 | 22 +-
.../socrates/interface/socrates_interface.F90 | 281 ++++++++++++++++--
3 files changed, 286 insertions(+), 48 deletions(-)
diff --git a/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
index f4500f04e..f3c189127 100644
--- a/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
+++ b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
@@ -5,7 +5,7 @@
from isca import SocratesCodeBase, DiagTable, Experiment, Namelist, GFDL_BASE
from isca.util import exp_progress
-NCORES = 16
+NCORES = 8
base_dir = os.path.dirname(os.path.realpath(__file__))
# a CodeBase can be a directory on the computer,
# useful for iterative development
@@ -46,13 +46,30 @@
diag.add_field('dynamics', 'vor', time_avg=True)
diag.add_field('dynamics', 'div', time_avg=True)
-diag.add_field('socrates', 'soc_tdt_lw', time_avg=True)
+#temperature tendency - units are K/s
+diag.add_field('socrates', 'soc_tdt_lw', time_avg=True) # net flux lw 3d (up - down)
diag.add_field('socrates', 'soc_tdt_sw', time_avg=True)
-diag.add_field('socrates', 'soc_tdt_rad', time_avg=True)
+diag.add_field('socrates', 'soc_tdt_rad', time_avg=True) #sum of the sw and lw heating rates
+
+#net (up) and down surface fluxes
diag.add_field('socrates', 'soc_surf_flux_lw', time_avg=True)
diag.add_field('socrates', 'soc_surf_flux_sw', time_avg=True)
+diag.add_field('socrates', 'soc_surf_flux_lw_down', time_avg=True)
+diag.add_field('socrates', 'soc_surf_flux_sw_down', time_avg=True)
+#net (up) TOA and downard fluxes
diag.add_field('socrates', 'soc_olr', time_avg=True)
-diag.add_field('socrates', 'soc_toa_sw', time_avg=True)
+diag.add_field('socrates', 'soc_toa_sw', time_avg=True)
+diag.add_field('socrates', 'soc_toa_sw_down', time_avg=True)
+
+#clear sky fluxes
+diag.add_field('socrates', 'soc_surf_flux_lw_clear', time_avg=True)
+diag.add_field('socrates', 'soc_surf_flux_sw_clear', time_avg=True)
+diag.add_field('socrates', 'soc_surf_flux_lw_down_clear', time_avg=True)
+diag.add_field('socrates', 'soc_surf_flux_sw_down_clear', time_avg=True)
+diag.add_field('socrates', 'soc_olr_clear', time_avg=True)
+diag.add_field('socrates', 'soc_toa_sw_clear', time_avg=True)
+diag.add_field('socrates', 'soc_toa_sw_down_clear', time_avg=True)
+
diag.add_field('cloud_simple', 'cf', time_avg=True)
diag.add_field('cloud_simple', 'reff_rad', time_avg=True)
diag.add_field('cloud_simple', 'frac_liq', time_avg=True)
@@ -208,7 +225,7 @@
if __name__=="__main__":
cb.compile(debug=False)
- exp.run(1, use_restart=False, num_cores=NCORES, overwrite_data=False)#, run_idb=True)
+ exp.run(1, use_restart=False, num_cores=NCORES, overwrite_data=True)#, run_idb=True)
- for i in range(2,171):
- exp.run(i, num_cores=NCORES)
+# for i in range(2,171):
+# exp.run(i, num_cores=NCORES)
diff --git a/src/atmos_param/socrates/interface/socrates_calc.F90 b/src/atmos_param/socrates/interface/socrates_calc.F90
index 0fd98b578..f50910a25 100644
--- a/src/atmos_param/socrates/interface/socrates_calc.F90
+++ b/src/atmos_param/socrates/interface/socrates_calc.F90
@@ -17,7 +17,7 @@ module socrates_calc_mod
contains
-! ==================================================================================
+! ==============================================================================
@@ -25,7 +25,7 @@ module socrates_calc_mod
! Set up the call to the Socrates radiation scheme
! -----------------------------------------------------------------------------
!DIAG Added Time
-subroutine socrates_calc(Time_diag,control, spectrum, &
+subroutine socrates_calc(Time_diag,control, spectrum, &
n_profile, n_layer, n_cloud_layer, n_aer_mode, &
cld_subcol_gen, cld_subcol_req, &
p_layer, t_layer, t_layer_boundaries, d_mass, density, &
@@ -34,7 +34,9 @@ subroutine socrates_calc(Time_diag,control, spectrum,
l_planet_grey_surface, planet_albedo, planet_emissivity, &
layer_heat_capacity, &
cld_frac, reff_rad, mmr_cl_rad, &
- flux_direct, flux_down, flux_up, heating_rate, spectral_olr)
+ flux_direct, flux_down, flux_up, &
+ flux_down_clear, flux_up_clear, &
+ heating_rate, spectral_olr)
use rad_pcf
use def_control, only: StrCtrl
@@ -126,9 +128,11 @@ subroutine socrates_calc(Time_diag,control, spectrum,
real(r_def), intent(out) :: flux_direct(n_profile, 0:n_layer)
! Direct (unscattered) downwards flux (Wm-2)
-real(r_def), intent(out) :: flux_down(n_profile, 0:n_layer)
+real(r_def), intent(out) :: flux_down(n_profile, 0:n_layer), &
+ flux_down_clear(n_profile, 0:n_layer)
! Downwards flux (Wm-2)
-real(r_def), intent(out) :: flux_up(n_profile, 0:n_layer)
+real(r_def), intent(out) :: flux_up(n_profile, 0:n_layer), &
+ flux_up_clear(n_profile, 0:n_layer)
! Upwards flux (Wm-2)
real(r_def), intent(out) :: heating_rate(n_profile, n_layer)
! Heating rate (Ks-1)
@@ -205,9 +209,11 @@ subroutine socrates_calc(Time_diag,control, spectrum,
do l=1, n_profile
do i=0, n_layer
- flux_direct(l, i) = radout%flux_direct(l, i, 1)
- flux_down(l, i) = radout%flux_down(l, i, 1)
- flux_up(l, i) = radout%flux_up(l, i, 1)
+ flux_direct(l, i) = radout%flux_direct(l, i, 1)
+ flux_down(l, i) = radout%flux_down(l, i, 1)
+ flux_down_clear(l, i) = radout%flux_down_clear(l, i, 1)
+ flux_up(l, i) = radout%flux_up(l, i, 1)
+ flux_up_clear(l, i) = radout%flux_up_clear(l, i, 1)
end do
if (present(spectral_olr)) then
spectral_olr(l,:) = radout%flux_up_clear_band(l,0,:)
diff --git a/src/atmos_param/socrates/interface/socrates_interface.F90 b/src/atmos_param/socrates/interface/socrates_interface.F90
index 0bb0d91f8..3e525f866 100644
--- a/src/atmos_param/socrates/interface/socrates_interface.F90
+++ b/src/atmos_param/socrates/interface/socrates_interface.F90
@@ -55,8 +55,13 @@ MODULE socrates_interface_mod
! INTEGER :: id_soc_surf_spectrum_sw !not implemented yet
INTEGER :: id_soc_tdt_sw, id_soc_tdt_lw, id_soc_tdt_rad
INTEGER :: id_soc_surf_flux_lw, id_soc_surf_flux_sw
+ INTEGER :: id_soc_surf_flux_lw_clear, id_soc_surf_flux_sw_clear
+ INTEGER :: id_soc_surf_flux_lw_down, id_soc_surf_flux_sw_down
+ INTEGER :: id_soc_surf_flux_lw_down_clear, id_soc_surf_flux_sw_down_clear
INTEGER :: id_soc_flux_lw, id_soc_flux_sw
- INTEGER :: id_soc_olr, id_soc_toa_sw
+ INTEGER :: id_soc_olr, id_soc_toa_sw, id_soc_olr_clear, id_soc_toa_sw_clear
+ INTEGER :: id_soc_toa_sw_down, id_soc_toa_sw_down_clear
+
INTEGER :: id_soc_ozone, id_soc_co2, id_soc_coszen
INTEGER :: n_soc_bands_lw, n_soc_bands_sw
INTEGER :: n_soc_bands_lw_hires, n_soc_bands_sw_hires
@@ -70,8 +75,12 @@ MODULE socrates_interface_mod
REAL(r_def), allocatable, dimension(:,:,:) :: tdt_soc_sw_store, tdt_soc_lw_store
REAL(r_def), allocatable, dimension(:,:,:) :: thd_sw_flux_net_store, thd_lw_flux_net_store
REAL(r_def), allocatable, dimension(:,:,:) :: thd_co2_store, thd_ozone_store
- REAL(r_def), allocatable, dimension(:,:) :: net_surf_sw_down_store, surf_lw_down_store, surf_lw_net_store, &
- toa_sw_store, olr_store, coszen_store
+ REAL(r_def), allocatable, dimension(:,:) :: net_surf_sw_down_store, surf_sw_down_store, surf_lw_down_store, surf_lw_net_store, &
+ toa_sw_store, olr_store, coszen_store, &
+ toa_sw_down_store
+ REAL(r_def), allocatable, dimension(:,:) :: net_surf_sw_down_clear_store, surf_sw_down_clear_store, &
+ surf_lw_down_clear_store, surf_lw_net_clear_store, &
+ toa_sw_clear_store, olr_clear_store, toa_sw_down_clear_store
REAL(r_def), allocatable, dimension(:,:,:) :: outputted_soc_spectral_olr, spectral_olr_store
REAL(r_def), allocatable, dimension(:) :: soc_bins_lw, soc_bins_sw
@@ -251,21 +260,71 @@ SUBROUTINE socrates_init(is, ie, js, je, num_levels, axes, Time, lat, lonb, latb
'socrates Net LW surface flux (up)', &
'watts/m2', missing_value=missing_value )
+ id_soc_surf_flux_lw_clear = &
+ register_diag_field ( soc_mod_name, 'soc_surf_flux_lw_clear', axes(1:2), Time, &
+ 'socrates Net LW surface flux (up) clear sky', &
+ 'watts/m2', missing_value=missing_value )
+
+ id_soc_surf_flux_lw_down = &
+ register_diag_field ( soc_mod_name, 'soc_surf_flux_lw_down', axes(1:2), Time, &
+ 'socrates LW surface flux down', &
+ 'watts/m2', missing_value=missing_value )
+
+ id_soc_surf_flux_lw_down_clear = &
+ register_diag_field ( soc_mod_name, 'soc_surf_flux_lw_down_clear', axes(1:2), Time, &
+ 'socrates LW surface flux down clear sky', &
+ 'watts/m2', missing_value=missing_value )
+
id_soc_surf_flux_sw = &
register_diag_field ( soc_mod_name, 'soc_surf_flux_sw', axes(1:2), Time, &
'socrates Net SW surface flux (down)', &
'watts/m2', missing_value=missing_value )
+ id_soc_surf_flux_sw_clear = &
+ register_diag_field ( soc_mod_name, 'soc_surf_flux_sw_clear', axes(1:2), Time, &
+ 'socrates Net SW surface flux (down) clear sky', &
+ 'watts/m2', missing_value=missing_value )
+
+ id_soc_surf_flux_sw_down = &
+ register_diag_field ( soc_mod_name, 'soc_surf_flux_sw_down', axes(1:2), Time, &
+ 'socrates SW surface flux down', &
+ 'watts/m2', missing_value=missing_value )
+
+ id_soc_surf_flux_sw_down_clear = &
+ register_diag_field ( soc_mod_name, 'soc_surf_flux_sw_down_clear', axes(1:2), Time, &
+ 'socrates SW surface flux down clear sky', &
+ 'watts/m2', missing_value=missing_value )
+
id_soc_olr = &
register_diag_field ( soc_mod_name, 'soc_olr', axes(1:2), Time, &
'socrates TOA LW flux (up)', &
'watts/m2', missing_value=missing_value )
+ id_soc_olr_clear = &
+ register_diag_field ( soc_mod_name, 'soc_olr_clear', axes(1:2), Time, &
+ 'socrates TOA LW flux (up) clear-sky', &
+ 'watts/m2', missing_value=missing_value )
+
id_soc_toa_sw = &
register_diag_field ( soc_mod_name, 'soc_toa_sw', axes(1:2), Time, &
'socrates Net TOA SW flux (down)', &
'watts/m2', missing_value=missing_value )
+ id_soc_toa_sw_clear = &
+ register_diag_field ( soc_mod_name, 'soc_toa_sw_clear', axes(1:2), Time, &
+ 'socrates Net TOA SW flux (down) clear', &
+ 'watts/m2', missing_value=missing_value )
+
+ id_soc_toa_sw_down = &
+ register_diag_field ( soc_mod_name, 'soc_toa_sw_down', axes(1:2), Time, &
+ 'socrates TOA SW flux down', &
+ 'watts/m2', missing_value=missing_value )
+
+ id_soc_toa_sw_down_clear = &
+ register_diag_field ( soc_mod_name, 'soc_toa_sw_down_clear', axes(1:2), Time, &
+ 'socrates TOA SW flux down clear sky', &
+ 'watts/m2', missing_value=missing_value )
+
id_soc_flux_lw = &
register_diag_field ( soc_mod_name, 'soc_flux_lw', (/axes(1),axes(2),axes(4)/), Time, &
'socrates Net LW flux (up)', &
@@ -328,10 +387,6 @@ SUBROUTINE socrates_init(is, ie, js, je, num_levels, axes, Time, lat, lonb, latb
allocate(surf_lw_down_store(size(lonb,1)-1, size(latb,2)-1))
! only required for output
- if (id_soc_surf_flux_lw > 0) then
- allocate(surf_lw_net_store(size(lonb,1)-1, size(latb,2)-1))
- endif
-
if (id_soc_flux_lw > 0) then
allocate(thd_lw_flux_net_store(size(lonb,1)-1, size(latb,2)-1, num_levels+1))
endif
@@ -340,13 +395,46 @@ SUBROUTINE socrates_init(is, ie, js, je, num_levels, axes, Time, lat, lonb, latb
allocate(thd_sw_flux_net_store(size(lonb,1)-1, size(latb,2)-1, num_levels+1))
endif
+ if (id_soc_surf_flux_sw_clear > 0) then
+ allocate(net_surf_sw_down_clear_store(size(lonb,1)-1, size(latb,2)-1))
+ endif
+ if (id_soc_surf_flux_lw_down_clear > 0) then
+ allocate(surf_lw_down_clear_store(size(lonb,1)-1, size(latb,2)-1))
+ endif
+
+ !surface
+ if (id_soc_surf_flux_lw > 0) then
+ allocate(surf_lw_net_store(size(lonb,1)-1, size(latb,2)-1))
+ endif
+ if (id_soc_surf_flux_lw_clear > 0) then
+ allocate(surf_lw_net_clear_store(size(lonb,1)-1, size(latb,2)-1))
+ endif
+ if (id_soc_surf_flux_sw_down > 0) then
+ allocate(surf_sw_down_store(size(lonb,1)-1, size(latb,2)-1))
+ endif
+ if (id_soc_surf_flux_sw_down_clear > 0) then
+ allocate(surf_sw_down_clear_store(size(lonb,1)-1, size(latb,2)-1))
+ endif
if (id_soc_olr > 0) then
allocate(olr_store(size(lonb,1)-1, size(latb,2)-1))
endif
+ if (id_soc_olr_clear > 0) then
+ allocate(olr_clear_store(size(lonb,1)-1, size(latb,2)-1))
+ endif
if (id_soc_toa_sw > 0) then
allocate(toa_sw_store(size(lonb,1)-1, size(latb,2)-1))
endif
+ if (id_soc_toa_sw_clear > 0) then
+ allocate(toa_sw_clear_store(size(lonb,1)-1, size(latb,2)-1))
+ endif
+ if (id_soc_toa_sw_down > 0) then
+ allocate(toa_sw_down_store(size(lonb,1)-1, size(latb,2)-1))
+ endif
+ if (id_soc_toa_sw_down_clear > 0) then
+ allocate(toa_sw_down_clear_store(size(lonb,1)-1, size(latb,2)-1))
+ endif
+
if (id_soc_coszen > 0) then
allocate(coszen_store(size(lonb,1)-1, size(latb,2)-1))
@@ -408,6 +496,7 @@ subroutine socrates_interface(Time_diag, rlat, rlon, soc_lw_mode, &
fms_coszen, fms_rrsun, n_profile, n_layer, &
fms_cld_frac, fms_reff_rad, fms_mmr_cl_rad, &
output_heating_rate, output_flux_down, output_flux_up, &
+ output_flux_down_clear, output_flux_up_clear, &
do_cloud_simple, &
!optionals
output_soc_spectral_olr, output_flux_direct, &
@@ -455,8 +544,8 @@ subroutine socrates_interface(Time_diag, rlat, rlon, soc_lw_mode, &
! Output arrays
real(r_def), intent(out) :: output_heating_rate(:,:,:)
- real(r_def), intent(out) :: output_flux_up(:,:,:)
- real(r_def), intent(out) :: output_flux_down(:,:,:)
+ real(r_def), intent(out) :: output_flux_up(:,:,:), output_flux_up_clear(:,:,:)
+ real(r_def), intent(out) :: output_flux_down(:,:,:), output_flux_down_clear(:,:,:)
real(r_def), intent(out), optional :: output_flux_direct(:,:,:)
@@ -475,7 +564,8 @@ subroutine socrates_interface(Time_diag, rlat, rlon, soc_lw_mode, &
input_co2_mixing_ratio,z_full_reshaped, input_cld_frac, input_reff_rad, input_mmr_cl_rad
real(r_def), dimension(n_profile, 0:n_layer) :: input_p_level, input_t_level, soc_flux_direct, &
- soc_flux_down, soc_flux_up, z_half_reshaped
+ soc_flux_down, soc_flux_up, z_half_reshaped, &
+ soc_flux_down_clear, soc_flux_up_clear
real(r_def), dimension(n_profile) :: input_t_surf, input_cos_zenith_angle, input_solar_irrad, &
input_orog_corr, input_planet_albedo
@@ -643,11 +733,13 @@ subroutine socrates_interface(Time_diag, rlat, rlon, soc_lw_mode, &
input_layer_heat_capacity(idx_chunk_start:idx_chunk_end,:), &
input_cld_frac(idx_chunk_start:idx_chunk_end,:), &
input_reff_rad(idx_chunk_start:idx_chunk_end,:), &
- input_mmr_cl_rad(idx_chunk_start:idx_chunk_end,:), &
+ input_mmr_cl_rad(idx_chunk_start:idx_chunk_end,:), &
soc_flux_direct(idx_chunk_start:idx_chunk_end,:), &
- soc_flux_down(idx_chunk_start:idx_chunk_end,:), &
- soc_flux_up(idx_chunk_start:idx_chunk_end,:), &
- soc_heating_rate(idx_chunk_start:idx_chunk_end,:), &
+ soc_flux_down(idx_chunk_start:idx_chunk_end,:), &
+ soc_flux_up(idx_chunk_start:idx_chunk_end,:), &
+ soc_flux_down_clear(idx_chunk_start:idx_chunk_end,:), &
+ soc_flux_up_clear(idx_chunk_start:idx_chunk_end,:), &
+ soc_heating_rate(idx_chunk_start:idx_chunk_end,:), &
soc_spectral_olr(idx_chunk_start:idx_chunk_end,:))
else
@@ -672,10 +764,12 @@ subroutine socrates_interface(Time_diag, rlat, rlon, soc_lw_mode, &
input_layer_heat_capacity(idx_chunk_start:idx_chunk_end,:), &
input_cld_frac(idx_chunk_start:idx_chunk_end,:), &
input_reff_rad(idx_chunk_start:idx_chunk_end,:), &
- input_mmr_cl_rad(idx_chunk_start:idx_chunk_end,:), &
+ input_mmr_cl_rad(idx_chunk_start:idx_chunk_end,:), &
soc_flux_direct(idx_chunk_start:idx_chunk_end,:), &
- soc_flux_down(idx_chunk_start:idx_chunk_end,:), &
- soc_flux_up(idx_chunk_start:idx_chunk_end,:), &
+ soc_flux_down(idx_chunk_start:idx_chunk_end,:), &
+ soc_flux_up(idx_chunk_start:idx_chunk_end,:), &
+ soc_flux_down_clear(idx_chunk_start:idx_chunk_end,:), &
+ soc_flux_up_clear(idx_chunk_start:idx_chunk_end,:), &
soc_heating_rate(idx_chunk_start:idx_chunk_end,:))
endif
@@ -685,6 +779,9 @@ subroutine socrates_interface(Time_diag, rlat, rlon, soc_lw_mode, &
output_flux_up(:,:,:) = reshape(soc_flux_up(:,:),(/si,sj,sk+1 /))
output_flux_down(:,:,:) = reshape(soc_flux_down(:,:),(/si,sj,sk+1 /))
+ output_flux_up_clear(:,:,:) = reshape(soc_flux_up_clear(:,:),(/si,sj,sk+1 /))
+ output_flux_down_clear(:,:,:) = reshape(soc_flux_down_clear(:,:),(/si,sj,sk+1 /))
+
if(present(output_flux_direct)) then
output_flux_direct(:,:,:) = reshape(soc_flux_direct(:,:),(/si,sj,sk+1 /))
endif
@@ -711,7 +808,7 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
real, intent(in), dimension(:,:,:) :: temp_in, p_full_in, q_in, z_full_in
real, intent(in), dimension(:,:,:) :: p_half_in, z_half_in
real, intent(inout), dimension(:,:,:) :: temp_tend
- real, intent(out), dimension(:,:) :: net_surf_sw_down, surf_lw_down
+ real, intent(out), dimension(:,:) :: net_surf_sw_down, surf_lw_down
real, intent(in) :: delta_t
logical, intent(in) :: do_cloud_simple
real, intent(in), dimension(:,:,:) :: cf_rad, reff_rad, qcl_rad
@@ -720,12 +817,19 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
real(r_def), dimension(size(temp_in,1), size(temp_in,2)) :: t_surf_for_soc, rad_lat_soc, rad_lon_soc, albedo_soc
real(r_def), dimension(size(temp_in,1), size(temp_in,2), size(temp_in,3)) :: tg_tmp_soc, q_soc, ozone_soc, co2_soc, p_full_soc, output_heating_rate_sw, output_heating_rate_lw, output_heating_rate_total, z_full_soc, cld_frac_soc, reff_rad_soc, mmr_cl_rad_soc, qcl_rad_soc
- real(r_def), dimension(size(temp_in,1), size(temp_in,2), size(temp_in,3)+1) :: p_half_soc, t_half_out, z_half_soc,output_soc_flux_sw_down, output_soc_flux_sw_up, output_soc_flux_lw_down, output_soc_flux_lw_up
+ real(r_def), dimension(size(temp_in,1), size(temp_in,2), size(temp_in,3)+1) :: p_half_soc, t_half_out, &
+ z_half_soc,output_soc_flux_sw_down, output_soc_flux_sw_up, output_soc_flux_lw_down, output_soc_flux_lw_up, &
+ output_soc_flux_lw_down_clear, output_soc_flux_lw_up_clear, output_soc_flux_sw_down_clear, output_soc_flux_sw_up_clear
logical :: soc_lw_mode, used
integer :: seconds, days, year_in_s
real :: r_seconds, r_days, r_total_seconds, frac_of_day, frac_of_year, gmt, time_since_ae, rrsun, dt_rad_radians, day_in_s, r_solday, r_dt_rad_avg
- real, dimension(size(temp_in,1), size(temp_in,2)) :: coszen, fracsun, surf_lw_net, olr, toa_sw
+ real, dimension(size(temp_in,1), size(temp_in,2)) :: coszen, fracsun, surf_lw_net, olr, toa_sw, toa_sw_down, surf_sw_down
+
+ real, dimension(size(temp_in,1), size(temp_in,2)) :: olr_clear, toa_sw_clear, toa_sw_down_clear
+ real, dimension(size(temp_in,1), size(temp_in,2)) :: surf_lw_down_clear, surf_lw_net_clear, &
+ surf_sw_down_clear, net_surf_sw_down_clear
+
real, dimension(size(temp_in,1), size(temp_in,2), size(temp_in,3)) :: ozone_in, co2_in
real, dimension(size(temp_in,1), size(temp_in,2), size(temp_in,3)+1) :: thd_sw_flux_net, thd_lw_flux_net
type(time_type) :: Time_loc
@@ -749,25 +853,59 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
surf_lw_down = real(surf_lw_down_store)
!only required for output
+ if (id_soc_surf_flux_sw_clear > 0) then
+ net_surf_sw_down_clear = net_surf_sw_down_clear_store
+ endif
+
+ if (id_soc_surf_flux_lw_down_clear > 0) then
+ surf_lw_down_clear = surf_lw_down_clear_store
+ endif
+
if (id_soc_surf_flux_lw > 0) then
surf_lw_net = real(surf_lw_net_store)
endif
-
+
+ if (id_soc_surf_flux_lw_clear > 0) then
+ surf_lw_net_clear = surf_lw_net_clear_store
+ endif
+
if (id_soc_flux_lw > 0) then
thd_lw_flux_net = thd_lw_flux_net_store
endif
-
if (id_soc_flux_sw > 0) then
thd_sw_flux_net = thd_sw_flux_net_store
endif
+ if (id_soc_surf_flux_sw_down > 0) then
+ surf_sw_down = surf_sw_down_store
+ endif
+
+ if (id_soc_surf_flux_sw_down_clear > 0) then
+ surf_sw_down_clear = surf_sw_down_clear_store
+ endif
+
if (id_soc_olr > 0) then
olr = olr_store
endif
+ if (id_soc_olr_clear > 0) then
+ olr_clear = olr_clear_store
+ endif
+
if (id_soc_toa_sw > 0) then
toa_sw = toa_sw_store
endif
+ if (id_soc_toa_sw_clear > 0) then
+ toa_sw_clear = toa_sw_clear_store
+ endif
+
+ if (id_soc_toa_sw_down > 0) then
+ toa_sw_down = toa_sw_down_store
+ endif
+
+ if (id_soc_toa_sw_down_clear > 0) then
+ toa_sw_down_clear = toa_sw_down_clear_store
+ endif
if (id_soc_coszen > 0) then
coszen = coszen_store
@@ -790,10 +928,14 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
thd_sw_flux_net = 0.
thd_lw_flux_net = 0.
net_surf_sw_down = 0.
+ surf_sw_down = 0.
surf_lw_down = 0.
surf_lw_net = 0.
toa_sw = 0.
+ toa_sw_down = 0.
olr = 0.
+ olr_clear = 0.
+
coszen = 0.
ozone_in = 0.
co2_in = 0.
@@ -804,7 +946,7 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
output_heating_rate_total = output_heating_rate_sw +output_heating_rate_lw
! Send diagnostics
- if(id_soc_tdt_lw > 0) then
+ if(id_soc_tdt_lw > 0) then !heating rate in (Ks-1)
used = send_data ( id_soc_tdt_lw, output_heating_rate_lw, Time_diag)
endif
if(id_soc_tdt_sw > 0) then
@@ -816,15 +958,45 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
if(id_soc_surf_flux_lw > 0) then
used = send_data ( id_soc_surf_flux_lw, surf_lw_net, Time_diag)
endif
+ if(id_soc_surf_flux_lw_clear > 0) then
+ used = send_data ( id_soc_surf_flux_lw_clear, surf_lw_net_clear, Time_diag)
+ endif
+ if(id_soc_surf_flux_lw_down > 0) then
+ used = send_data ( id_soc_surf_flux_lw_down, surf_lw_down, Time_diag)
+ endif
+ if(id_soc_surf_flux_lw_down_clear > 0) then
+ used = send_data ( id_soc_surf_flux_lw_down_clear, surf_lw_down_clear, Time_diag)
+ endif
if(id_soc_surf_flux_sw > 0) then
used = send_data ( id_soc_surf_flux_sw, net_surf_sw_down, Time_diag)
endif
+ if(id_soc_surf_flux_sw_clear > 0) then
+ used = send_data ( id_soc_surf_flux_sw_clear, net_surf_sw_down_clear, Time_diag)
+ endif
+ if(id_soc_surf_flux_sw_down > 0) then
+ used = send_data ( id_soc_surf_flux_sw_down, surf_sw_down, Time_diag)
+ endif
+ if(id_soc_surf_flux_sw_down_clear > 0) then
+ used = send_data ( id_soc_surf_flux_sw_down_clear, surf_sw_down_clear, Time_diag)
+ endif
if(id_soc_olr > 0) then
used = send_data ( id_soc_olr, olr, Time_diag)
endif
+ if(id_soc_olr_clear > 0) then
+ used = send_data ( id_soc_olr_clear, olr_clear, Time_diag)
+ endif
if(id_soc_toa_sw > 0) then
used = send_data ( id_soc_toa_sw, toa_sw, Time_diag)
endif
+ if(id_soc_toa_sw_clear > 0) then
+ used = send_data ( id_soc_toa_sw_clear, toa_sw_clear, Time_diag)
+ endif
+ if(id_soc_toa_sw_down > 0) then
+ used = send_data ( id_soc_toa_sw_down, toa_sw_down, Time_diag)
+ endif
+ if(id_soc_toa_sw_down_clear > 0) then
+ used = send_data ( id_soc_toa_sw_down_clear, toa_sw_down_clear, Time_diag)
+ endif
if(id_soc_flux_lw > 0) then
used = send_data ( id_soc_flux_lw, thd_lw_flux_net, Time_diag)
endif
@@ -965,6 +1137,7 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
p_half_soc, z_full_soc, z_half_soc, albedo_soc, coszen, rrsun, &
n_profile, n_layer, cld_frac_soc, reff_rad_soc, mmr_cl_rad_soc, &
output_heating_rate_lw, output_soc_flux_lw_down, output_soc_flux_lw_up, &
+ output_soc_flux_lw_down_clear, output_soc_flux_lw_up_clear, &
do_cloud_simple, &
!optional outs
output_soc_spectral_olr = outputted_soc_spectral_olr, &
@@ -973,9 +1146,16 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
tg_tmp_soc = tg_tmp_soc + output_heating_rate_lw*delta_t !Output heating rate in K/s, so is a temperature tendency
surf_lw_down(:,:) = REAL(output_soc_flux_lw_down(:,:, n_layer+1))
- surf_lw_net(:,:) = REAL(output_soc_flux_lw_up(:,:,n_layer+1) - output_soc_flux_lw_down(:,:, n_layer+1))
- olr(:,:) = REAL(output_soc_flux_lw_up(:,:,1))
- thd_lw_flux_net = REAL(output_soc_flux_lw_up - output_soc_flux_lw_down)
+ surf_lw_down_clear(:,:) = REAL(output_soc_flux_lw_down_clear(:,:, n_layer+1))
+
+ surf_lw_net(:,:) = REAL(output_soc_flux_lw_up(:,:,n_layer+1) - &
+ output_soc_flux_lw_down(:,:, n_layer+1))
+ surf_lw_net_clear(:,:) = REAL(output_soc_flux_lw_up_clear(:,:,n_layer+1) - &
+ output_soc_flux_lw_down_clear(:,:, n_layer+1))
+ olr(:,:) = REAL(output_soc_flux_lw_up(:,:,1))
+ olr_clear(:,:) = REAL(output_soc_flux_lw_up_clear(:,:,1))
+
+ thd_lw_flux_net = REAL(output_soc_flux_lw_up - output_soc_flux_lw_down)
temp_tend(:,:,:) = temp_tend(:,:,:) + real(output_heating_rate_lw)
@@ -988,14 +1168,28 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
p_half_soc, z_full_soc, z_half_soc, albedo_soc, coszen, rrsun, &
n_profile, n_layer, cld_frac_soc, reff_rad_soc, mmr_cl_rad_soc, &
output_heating_rate_sw, output_soc_flux_sw_down, output_soc_flux_sw_up, &
+ output_soc_flux_sw_down_clear, output_soc_flux_sw_up_clear, &
do_cloud_simple)
tg_tmp_soc = tg_tmp_soc + output_heating_rate_sw*delta_t !Output heating rate in K/s, so is a temperature tendency
- net_surf_sw_down(:,:) = REAL(output_soc_flux_sw_down(:,:, n_layer+1)-output_soc_flux_sw_up(:,:,n_layer+1) )
- toa_sw(:,:) = REAL(output_soc_flux_sw_down(:,:,1)-output_soc_flux_sw_up(:,:,1))
- thd_sw_flux_net = REAL(output_soc_flux_sw_up - output_soc_flux_sw_down)
+ net_surf_sw_down(:,:) = REAL(output_soc_flux_sw_down(:,:, n_layer+1) - &
+ output_soc_flux_sw_up(:,:,n_layer+1) )
+ net_surf_sw_down_clear(:,:) = REAL(output_soc_flux_sw_down_clear(:,:, n_layer+1) - &
+ output_soc_flux_sw_up_clear(:,:,n_layer+1) )
+
+ toa_sw(:,:) = REAL(output_soc_flux_sw_down(:,:,1) - &
+ output_soc_flux_sw_up(:,:,1))
+ toa_sw_clear(:,:) = REAL(output_soc_flux_sw_down_clear(:,:,1) - &
+ output_soc_flux_sw_up_clear(:,:,1))
+
+ thd_sw_flux_net = REAL(output_soc_flux_sw_up - output_soc_flux_sw_down) !net sw all levels
+
+ toa_sw_down(:,:) = REAL(output_soc_flux_sw_down(:,:,1))
+ toa_sw_down_clear(:,:) = REAL(output_soc_flux_sw_down_clear(:,:,1))
+ surf_sw_down(:,:) = REAL(output_soc_flux_sw_down(:,:, n_layer+1))
+ surf_sw_down_clear(:,:) = REAL(output_soc_flux_sw_down_clear(:,:, n_layer+1))
temp_tend(:,:,:) = temp_tend(:,:,:) + real(output_heating_rate_sw)
@@ -1009,10 +1203,6 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
surf_lw_down_store = real(surf_lw_down, kind(r_def))
! required for output
- if (id_soc_surf_flux_lw > 0) then
- surf_lw_net_store = real(surf_lw_net, kind(r_def))
- endif
-
if (id_soc_flux_lw > 0) then
thd_lw_flux_net_store = thd_lw_flux_net
endif
@@ -1021,10 +1211,26 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
thd_sw_flux_net_store = thd_sw_flux_net
endif
+ if (id_soc_surf_flux_lw > 0) then
+ surf_lw_net_store = real(surf_lw_net, kind(r_def))
+ endif
+
+ if (id_soc_surf_flux_sw_down > 0) then
+ surf_sw_down_store = surf_sw_down
+ endif
+
+ if (id_soc_toa_sw_down > 0) then
+ toa_sw_down_store = toa_sw_down
+ endif
+
if (id_soc_olr > 0) then
olr_store = olr
endif
+ if (id_soc_olr_clear > 0) then
+ olr_clear_store = olr_clear
+ endif
+
if (id_soc_toa_sw > 0) then
toa_sw_store = toa_sw
endif
@@ -1060,12 +1266,21 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
if(id_soc_surf_flux_lw > 0) then
used = send_data ( id_soc_surf_flux_lw, surf_lw_net, Time_diag)
endif
+ if(id_soc_surf_flux_lw_down > 0) then
+ used = send_data ( id_soc_surf_flux_lw_down, surf_lw_down, Time_diag)
+ endif
if(id_soc_surf_flux_sw > 0) then
used = send_data ( id_soc_surf_flux_sw, net_surf_sw_down, Time_diag)
endif
+ if(id_soc_surf_flux_sw_down > 0) then
+ used = send_data ( id_soc_surf_flux_sw_down, surf_sw_down, Time_diag)
+ endif
if(id_soc_olr > 0) then
used = send_data ( id_soc_olr, olr, Time_diag)
endif
+ if(id_soc_olr_clear > 0) then
+ used = send_data ( id_soc_olr_clear, olr_clear, Time_diag)
+ endif
if(id_soc_toa_sw > 0) then
used = send_data ( id_soc_toa_sw, toa_sw, Time_diag)
endif
From 22af14ec777af990e890bebd6ee4ab0dd43b9ebc Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Thu, 28 Mar 2019 13:40:55 +0000
Subject: [PATCH 034/304] Implement protocol 2 for spookie-2 and debugging
clear sky diagnostics
---
.../socrates_aquaplanet_with_cloud.py | 10 +-
src/atmos_param/cloud_simple/cloud_simple.F90 | 168 +++++++++++++-----
.../socrates/interface/socrates_calc.F90 | 16 +-
.../socrates/interface/socrates_interface.F90 | 71 +++++++-
.../driver/solo/idealized_moist_phys.F90 | 8 +-
5 files changed, 203 insertions(+), 70 deletions(-)
diff --git a/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
index f3c189127..3e8e3813d 100644
--- a/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
+++ b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
@@ -5,7 +5,7 @@
from isca import SocratesCodeBase, DiagTable, Experiment, Namelist, GFDL_BASE
from isca.util import exp_progress
-NCORES = 8
+NCORES = 16
base_dir = os.path.dirname(os.path.realpath(__file__))
# a CodeBase can be a directory on the computer,
# useful for iterative development
@@ -74,13 +74,13 @@
diag.add_field('cloud_simple', 'reff_rad', time_avg=True)
diag.add_field('cloud_simple', 'frac_liq', time_avg=True)
diag.add_field('cloud_simple', 'qcl_rad', time_avg=True)
-diag.add_field('cloud_simple', 'simple_rhcrit', time_avg=True)
+#diag.add_field('cloud_simple', 'simple_rhcrit', time_avg=True)
+diag.add_field('cloud_simple', 'rh_min', time_avg=True)
diag.add_field('cloud_simple', 'rh_in_cf', time_avg=True)
-
# additional output options commented out
-diag.add_field('socrates', 'soc_flux_lw', time_avg=True)
-diag.add_field('socrates', 'soc_flux_sw', time_avg=True)
+#diag.add_field('socrates', 'soc_flux_lw', time_avg=True)
+#diag.add_field('socrates', 'soc_flux_sw', time_avg=True)
#diag.add_field('socrates', 'soc_co2', time_avg=True)
#diag.add_field('socrates', 'soc_ozone', time_avg=True)
#diag.add_field('socrates', 'soc_coszen', time_avg=True)
diff --git a/src/atmos_param/cloud_simple/cloud_simple.F90 b/src/atmos_param/cloud_simple/cloud_simple.F90
index b27ba5788..b51cc84fe 100644
--- a/src/atmos_param/cloud_simple/cloud_simple.F90
+++ b/src/atmos_param/cloud_simple/cloud_simple.F90
@@ -17,19 +17,39 @@ module cloud_simple_mod
logical :: do_init = .true. ! Check if init needs to be run
real :: simple_cca = 0.0
- real :: rhcsfc = 0.95
- real :: rhc700 = 0.7
- real :: rhc200 = 0.3
+
+ ! Critical RH (fraction) values - spookie protocol 1 only
+ real :: rhc_sfc = 0.95
+ real :: rhc_base = 0.7
+ real :: rhc_top = 0.3
+ !
real :: rhmsfc = 0.95
real :: rhm700 = 0.7
real :: rhm200 = 0.3
- namelist /cloud_simple_nml/ simple_cca, rhcsfc, rhc700, rhc200, &
- rhmsfc, rhm700, rhm200
+ ! Critical RH (fraction) values - spookie protocol 2 only
+ real :: rh_min_top = 0.9
+ real :: rh_min_sfc = 1.0
+ real :: rh_min_base = 0.8
+ real :: rh_max_top = 1.0
+ real :: rh_max_sfc = 1.0
+ real :: rh_max_base = 1.0
+
+ ! Pressure (Pa.) at cloud bottom and top (very approx)
+ real :: p_base = 70000.
+ real :: p_top = 20000.
+
+ integer :: spookie_protocol = 2
+
+ namelist /cloud_simple_nml/ simple_cca, rhc_sfc, rhc_base, rhc_top, &
+ rhmsfc, rhm700, rhm200, &
+ rh_min_top, rh_min_sfc, rh_min_base, &
+ rh_max_top, rh_max_sfc, rh_max_base
+
real :: zerodegc = 273.15
- integer :: id_cf, id_reff_rad, id_frac_liq, id_qcl_rad, id_rh_in_cf, id_simple_rhcrit
-
+ integer :: id_cf, id_reff_rad, id_frac_liq, id_qcl_rad, id_rh_in_cf, &
+ id_simple_rhcrit, id_rh_min
character(len=14), parameter :: mod_name_cld = "cloud_simple"
@@ -86,11 +106,13 @@ subroutine cloud_simple_init (axes, Time)
id_simple_rhcrit = &
register_diag_field ( mod_name_cld, 'simple_rhcrit', axes(1:3), Time, &
- 'RH as a percent', &
+ 'RH as a percent for spookie protocol 1', &
'%')
-
-
+ id_rh_min = &
+ register_diag_field ( mod_name_cld, 'rh_min', axes(1:3), Time, &
+ 'RH as a percent for spookie protocol 2', &
+ '%')
do_init = .false. !initialisation completed
@@ -102,14 +124,14 @@ end subroutine cloud_simple_init
subroutine cloud_simple(p_half, p_full, Time, &
temp, q_hum, &
! outs
- cf, reff_rad, qcl_rad )
+ cf, cca, reff_rad, qcl_rad)
real , intent(in), dimension(:,:,:) :: temp, q_hum, p_full, p_half
type(time_type) , intent(in) :: Time
- real , intent(out), dimension(:,:,:) :: cf, reff_rad, qcl_rad
+ real , intent(out), dimension(:,:,:) :: cf, reff_rad, qcl_rad, cca
- real, dimension(size(temp,1), size(temp, 2), size(temp, 3)) :: qs, frac_liq, rh_in_cf, simple_rhcrit
+ real, dimension(size(temp,1), size(temp, 2), size(temp, 3)) :: qs, frac_liq, rh_in_cf, simple_rhcrit, rh_min, rh_max
integer :: i, j, k, k_surf
@@ -133,16 +155,26 @@ subroutine cloud_simple(p_half, p_full, Time, &
! the simple cloud scheme and cloud fraction.
! rh_in_cf is an output diagnostic only for debugging
call calc_liq_frac(temp(i,j,k), frac_liq(i,j,k))
+
call calc_reff(frac_liq(i,j,k), reff_rad(i,j,k))
- call calc_rhcrit(p_full(i,j,k), p_full(i,j,k_surf), simple_rhcrit(i,j,k))
- call calc_cf(q_hum(i,j,k), qs(i,j,k), simple_rhcrit(i,j,k), cf(i,j,k),rh_in_cf(i,j,k))
- call calc_qcl_rad(p_full(i,j,k), cf(i,j,k), qcl_rad(i,j,k) )
+
+ if (spookie_protocol .eq. 1) then
+ call calc_rhcrit(p_full(i,j,k), p_full(i,j,k_surf), simple_rhcrit(i,j,k))
+ else
+ call calc_rh_min_max(p_full(i,j,k), p_full(i,j,k_surf),rh_min(i,j,k), rh_max(i,j,k))
+ endif
+
+ call calc_cf(q_hum(i,j,k), qs(i,j,k), cf(i,j,k), cca(i,j,k), rh_in_cf(i,j,k), &
+ simple_rhcrit = simple_rhcrit(i,j,k), &
+ rh_min = rh_min(i,j,k), rh_max = rh_max(i,j,k) )
+
+ call calc_qcl_rad(p_full(i,j,k), cf(i,j,k), temp(i,j,k), qcl_rad(i,j,k) )
end do
end do
end do
!save some diagnotics
- call output_cloud_diags(cf, reff_rad, frac_liq, qcl_rad, rh_in_cf, simple_rhcrit, Time )
+ call output_cloud_diags(cf, reff_rad, frac_liq, qcl_rad, rh_in_cf, simple_rhcrit, rh_min, Time )
end subroutine cloud_simple
@@ -176,71 +208,111 @@ subroutine calc_reff(frac_liq, reff_rad)
end subroutine calc_reff
subroutine calc_rhcrit(p_full, p_surf, simple_rhcrit) !need to check p_full - > p_layer_centres
- !get the RH needed as a threshold for the cloud fraction calc.
+ ! get the RH needed as a threshold for the cloud fraction calc.
+ ! This is only requires for spookie_protocol=1
real, intent(in) :: p_full, p_surf
real, intent(out) :: simple_rhcrit
! Calculate RHcrit as function of pressure
- if (p_full > 70000.0 ) then
+ if (p_full > p_base ) then
- simple_rhcrit = rhcsfc - ( rhcsfc - rhc700 ) * &
- ( p_surf - p_full ) / ( p_surf - 70000.0 )
+ simple_rhcrit = rhc_sfc - ( rhc_sfc - rhc_base ) * &
+ ( p_surf - p_full ) / ( p_surf - p_base )
- else if ( p_full > 20000.0 ) then
+ else if ( p_full > p_top ) then
- simple_rhcrit = rhc700 - ( rhc700 - rhc200 ) * &
- ( 70000.0 - p_full) / 50000.0
+ simple_rhcrit = rhc_base - ( rhc_base - rhc_top ) * &
+ (p_base - p_full) / (p_base - p_top)
else
- simple_rhcrit = rhc200
+ simple_rhcrit = rhc_top
endif
end subroutine calc_rhcrit
- subroutine calc_cf (q_hum, qsat, simple_rhcrit, cf, rh)
+ subroutine calc_rh_min_max(p_full, p_surf, rh_min, rh_max)
+
+ real, intent(in) :: p_full, p_surf
+ real, intent(out) :: rh_min, rh_max
+
+
+ if (p_full > p_base ) then !surface up to base
+
+ rh_min = rh_min_sfc - ( rh_min_sfc - rh_min_base ) * ( p_surf - p_full ) / ( p_surf - p_base )
+ rh_max = rh_max_sfc - ( rh_max_sfc - rh_max_base ) * ( p_surf - p_full ) / ( p_surf - p_base )
+
+ else if ( p_full > p_top ) then ! base up to top
+
+ rh_min = rh_min_base - ( rh_min_base - rh_min_top ) * (p_base - p_full) / (p_base - p_top)
+ rh_max = rh_max_base - ( rh_max_base - rh_max_top ) * (p_base - p_full) / (p_base - p_top)
+
+ else ! above top
+
+ rh_min = rh_min_top
+ rh_max = rh_max_top
+
+ endif
+
+
+ end subroutine calc_rh_min_max
+
+ subroutine calc_cf(q_hum, qsat, cf, cca, rh, simple_rhcrit, rh_min, rh_max)
! Calculate LS (stratiform) cloud fraction
! as a simple linear function of RH
- real, intent(in) :: q_hum, qsat, simple_rhcrit
- real, intent(out) :: cf, rh
-
- real :: cca
+ real, intent(in) :: q_hum, qsat
+ real, intent(in), optional :: simple_rhcrit, rh_min, rh_max
+
+ real, intent(out) :: cf, rh, cca
rh = q_hum/qsat
- cf = MAX( 0.0, MIN( 1.0, ( rh - simple_rhcrit ) / ( 1.0 - simple_rhcrit ) ))
+ if (spookie_protocol .eq. 1) then
+ cf = (rh - simple_rhcrit ) / ( 1.0 - simple_rhcrit )
+ cf = MAX( 0.0, MIN( 1.0, cf))
+
+ else
+ cf = (rh - rh_min ) / ( rh_max - rh_min )
+ cf = MAX( 0.0, MIN( 1.0, cf))
+ end if
! include simple convective cloud fraction where present (not currenly used)
cca = 0.0 ! no convective cloud fraction is calculated
- ! left in for future use
+ ! left in for future use
if (cca > 0.0) then
- cf = MAX( simple_cca, cf )
+ cf = MAX( simple_cca, cf )
end if
-
+
end subroutine calc_cf
- subroutine calc_qcl_rad(p_full, cf, qcl_rad)
+ subroutine calc_qcl_rad(p_full, cf, temp, qcl_rad)
! calculate cloud water content
- real , intent(in) :: p_full, cf
- real , intent(out) :: qcl_rad
+ real , intent(in) :: p_full, cf, temp
+ real , intent(out) :: qcl_rad
real :: in_cloud_qcl
-
- in_cloud_qcl = 3.0e-4 + &
- (1.0-3.0e-4)*(p_full-20000.0)/80000.0
-
- in_cloud_qcl = MAX ( 0.0, in_cloud_qcl/1000.0 ) ! convert to kg/kg
-
- qcl_rad = cf * in_cloud_qcl
+
+ IF (spookie_protocol .eq. 1) THEN
+ ! pressure dependent in_cloud_qcl
+ in_cloud_qcl = 3.0e-4 + (1.0-3.0e-4)*(p_full-p_top)/80000.0
+ in_cloud_qcl = MAX ( 0.0, in_cloud_qcl/1000.0 ) ! convert to kg/kg
+ qcl_rad = cf * in_cloud_qcl
+ ELSE
+ ! temperatue dependent in_cloud_qcl
+ in_cloud_qcl = MIN(0.2, 0.2 * ( temp - 220. ) / ( 280. -220. ))
+ in_cloud_qcl = MAX (3.0e-4, in_cloud_qcl/1000.0 ) ! convert to kg/kg
+ qcl_rad = cf * in_cloud_qcl
+ ENDIF
end subroutine calc_qcl_rad
- subroutine output_cloud_diags(cf, reff_rad, frac_liq, qcl_rad, rh_in_cf, simple_rhcrit, Time)
+ subroutine output_cloud_diags(cf, reff_rad, frac_liq, qcl_rad, rh_in_cf, simple_rhcrit, rh_min, Time)
- real, intent(in), dimension(:,:,:) :: cf, reff_rad, frac_liq, qcl_rad, rh_in_cf, simple_rhcrit
+ real, intent(in), dimension(:,:,:) :: cf, reff_rad, frac_liq, qcl_rad, rh_in_cf
+ real, intent(in), dimension(:,:,:), optional :: simple_rhcrit, rh_min
type(time_type) , intent(in) :: Time
@@ -270,6 +342,10 @@ subroutine output_cloud_diags(cf, reff_rad, frac_liq, qcl_rad, rh_in_cf, simple_
used = send_data ( id_simple_rhcrit, simple_rhcrit*100.0, Time)
endif
+ if ( id_rh_min > 0 ) then
+ used = send_data ( id_rh_min, rh_min*100.0, Time)
+ endif
+
end subroutine output_cloud_diags
subroutine cloud_simple_end ()
diff --git a/src/atmos_param/socrates/interface/socrates_calc.F90 b/src/atmos_param/socrates/interface/socrates_calc.F90
index f50910a25..5474d0d5f 100644
--- a/src/atmos_param/socrates/interface/socrates_calc.F90
+++ b/src/atmos_param/socrates/interface/socrates_calc.F90
@@ -33,7 +33,7 @@ subroutine socrates_calc(Time_diag,control, spectrum, &
t_rad_surf, cos_zenith_angle, solar_irrad, orog_corr, &
l_planet_grey_surface, planet_albedo, planet_emissivity, &
layer_heat_capacity, &
- cld_frac, reff_rad, mmr_cl_rad, &
+ cld_frac, cld_conv_frac, reff_rad, mmr_cl_rad, &
flux_direct, flux_down, flux_up, &
flux_down_clear, flux_up_clear, &
heating_rate, spectral_olr)
@@ -118,7 +118,10 @@ subroutine socrates_calc(Time_diag,control, spectrum, &
! Heat capacity of layer
real(r_def), intent(in) :: cld_frac(n_profile, n_layer)
-! Cloud fraction at layer centres
+! Cloud fraction at layer centres for stratocumulus cloud
+
+real(r_def), intent(in) :: cld_conv_frac(n_profile, n_layer)
+! Cloud fraction at layer centres for convective cloud
real(r_def), intent(in) :: reff_rad(n_profile, n_layer)
! Cloud liquid particle radius from simple cloud scheme
@@ -185,11 +188,12 @@ subroutine socrates_calc(Time_diag,control, spectrum, &
zeros_cld = 0.
ten_microns_cld = 1.
call set_cld(cld, control, dimen, spectrum, n_profile, n_layer, &
+ conv_frac = cld_conv_frac,&
liq_frac = cld_frac, &
- ice_frac = zeros_cld, &
- liq_mmr = mmr_cl_rad, &
- ice_mmr = zeros_cld, &
- liq_dim = reff_rad, &
+ ice_frac = zeros_cld, &
+ liq_mmr = mmr_cl_rad, &
+ ice_mmr = zeros_cld, &
+ liq_dim = reff_rad, &
ice_dim = zeros_cld )
call set_aer(control, dimen, spectrum, aer, n_profile)
diff --git a/src/atmos_param/socrates/interface/socrates_interface.F90 b/src/atmos_param/socrates/interface/socrates_interface.F90
index 3e525f866..d20d207a1 100644
--- a/src/atmos_param/socrates/interface/socrates_interface.F90
+++ b/src/atmos_param/socrates/interface/socrates_interface.F90
@@ -494,7 +494,7 @@ subroutine socrates_interface(Time_diag, rlat, rlon, soc_lw_mode, &
fms_temp, fms_spec_hum, fms_ozone, fms_co2, fms_t_surf, &
fms_p_full, fms_p_half, fms_z_full, fms_z_half, fms_albedo, &
fms_coszen, fms_rrsun, n_profile, n_layer, &
- fms_cld_frac, fms_reff_rad, fms_mmr_cl_rad, &
+ fms_cld_frac, fms_cld_conv_frac, fms_reff_rad, fms_mmr_cl_rad,&
output_heating_rate, output_flux_down, output_flux_up, &
output_flux_down_clear, output_flux_up_clear, &
do_cloud_simple, &
@@ -539,6 +539,7 @@ subroutine socrates_interface(Time_diag, rlat, rlon, soc_lw_mode, &
real(r_def), intent(in) :: fms_z_full(:,:,:), fms_z_half(:,:,:)
real(r_def), intent(in) :: fms_rrsun
real(r_def), intent(in) :: fms_cld_frac(:,:,:), fms_reff_rad(:,:,:), fms_mmr_cl_rad(:,:,:)
+ real(r_def), intent(in) :: fms_cld_conv_frac(:,:,:)
logical, intent(in) :: do_cloud_simple
@@ -561,7 +562,8 @@ subroutine socrates_interface(Time_diag, rlat, rlon, soc_lw_mode, &
real(r_def), dimension(n_profile, n_layer) :: input_p, input_t, input_mixing_ratio, &
input_d_mass, input_density, input_layer_heat_capacity, &
soc_heating_rate, input_o3_mixing_ratio, &
- input_co2_mixing_ratio,z_full_reshaped, input_cld_frac, input_reff_rad, input_mmr_cl_rad
+ input_co2_mixing_ratio,z_full_reshaped, input_cld_frac, input_reff_rad, input_mmr_cl_rad, &
+ input_cld_conv_frac
real(r_def), dimension(n_profile, 0:n_layer) :: input_p_level, input_t_level, soc_flux_direct, &
soc_flux_down, soc_flux_up, z_half_reshaped, &
@@ -608,6 +610,8 @@ subroutine socrates_interface(Time_diag, rlat, rlon, soc_lw_mode, &
input_p_level = reshape(fms_p_half(:,:,:),(/si*sj,sk+1 /))
input_cld_frac = reshape(fms_cld_frac(:,:,:),(/si*sj,sk /))
+ input_cld_conv_frac = reshape(fms_cld_conv_frac(:,:,:),(/si*sj,sk /))
+
input_reff_rad = reshape(fms_reff_rad(:,:,:),(/si*sj,sk /))
input_mmr_cl_rad = reshape(fms_mmr_cl_rad(:,:,:),(/si*sj,sk/))
@@ -732,6 +736,7 @@ subroutine socrates_interface(Time_diag, rlat, rlon, soc_lw_mode, &
input_planet_emissivity, &
input_layer_heat_capacity(idx_chunk_start:idx_chunk_end,:), &
input_cld_frac(idx_chunk_start:idx_chunk_end,:), &
+ input_cld_conv_frac(idx_chunk_start:idx_chunk_end,:), &
input_reff_rad(idx_chunk_start:idx_chunk_end,:), &
input_mmr_cl_rad(idx_chunk_start:idx_chunk_end,:), &
soc_flux_direct(idx_chunk_start:idx_chunk_end,:), &
@@ -763,6 +768,7 @@ subroutine socrates_interface(Time_diag, rlat, rlon, soc_lw_mode, &
input_planet_emissivity, &
input_layer_heat_capacity(idx_chunk_start:idx_chunk_end,:), &
input_cld_frac(idx_chunk_start:idx_chunk_end,:), &
+ input_cld_conv_frac(idx_chunk_start:idx_chunk_end,:), &
input_reff_rad(idx_chunk_start:idx_chunk_end,:), &
input_mmr_cl_rad(idx_chunk_start:idx_chunk_end,:), &
soc_flux_direct(idx_chunk_start:idx_chunk_end,:), &
@@ -795,7 +801,7 @@ subroutine socrates_interface(Time_diag, rlat, rlon, soc_lw_mode, &
end subroutine socrates_interface
subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf_in, p_full_in, p_half_in, z_full_in, z_half_in, albedo_in, &
- temp_tend, net_surf_sw_down, surf_lw_down, delta_t, do_cloud_simple, cf_rad, reff_rad, qcl_rad)
+ temp_tend, net_surf_sw_down, surf_lw_down, delta_t, do_cloud_simple, cf_rad, cca_rad, reff_rad, qcl_rad)
use astronomy_mod, only: diurnal_solar
use constants_mod, only: pi, wtmco2, wtmozone, rdgas, gas_constant
@@ -811,12 +817,12 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
real, intent(out), dimension(:,:) :: net_surf_sw_down, surf_lw_down
real, intent(in) :: delta_t
logical, intent(in) :: do_cloud_simple
- real, intent(in), dimension(:,:,:) :: cf_rad, reff_rad, qcl_rad
+ real, intent(in), dimension(:,:,:) :: cf_rad, cca_rad, reff_rad, qcl_rad
integer(i_def) :: n_profile, n_layer
real(r_def), dimension(size(temp_in,1), size(temp_in,2)) :: t_surf_for_soc, rad_lat_soc, rad_lon_soc, albedo_soc
- real(r_def), dimension(size(temp_in,1), size(temp_in,2), size(temp_in,3)) :: tg_tmp_soc, q_soc, ozone_soc, co2_soc, p_full_soc, output_heating_rate_sw, output_heating_rate_lw, output_heating_rate_total, z_full_soc, cld_frac_soc, reff_rad_soc, mmr_cl_rad_soc, qcl_rad_soc
+ real(r_def), dimension(size(temp_in,1), size(temp_in,2), size(temp_in,3)) :: tg_tmp_soc, q_soc, ozone_soc, co2_soc, p_full_soc, output_heating_rate_sw, output_heating_rate_lw, output_heating_rate_total, z_full_soc, cld_frac_soc, reff_rad_soc, mmr_cl_rad_soc, qcl_rad_soc, cld_conv_frac_soc
real(r_def), dimension(size(temp_in,1), size(temp_in,2), size(temp_in,3)+1) :: p_half_soc, t_half_out, &
z_half_soc,output_soc_flux_sw_down, output_soc_flux_sw_up, output_soc_flux_lw_down, output_soc_flux_lw_up, &
output_soc_flux_lw_down_clear, output_soc_flux_lw_up_clear, output_soc_flux_sw_down_clear, output_soc_flux_sw_up_clear
@@ -923,19 +929,36 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
outputted_soc_spectral_olr = spectral_olr_store
endif
else
+ !all sky heating rates.
output_heating_rate_sw = 0.
output_heating_rate_lw = 0.
+
+ !all sky and clear sky fluxes.
thd_sw_flux_net = 0.
thd_lw_flux_net = 0.
+
net_surf_sw_down = 0.
+ net_surf_sw_down_clear = 0.
+
surf_sw_down = 0.
+ surf_sw_down_clear = 0.
+
surf_lw_down = 0.
+ surf_lw_down_clear = 0.
+
surf_lw_net = 0.
+ surf_lw_net_clear = 0.
+
toa_sw = 0.
+ toa_sw_clear = 0.
+
toa_sw_down = 0.
+ toa_sw_down_clear = 0.
+
olr = 0.
olr_clear = 0.
+ !Others
coszen = 0.
ozone_in = 0.
co2_in = 0.
@@ -1100,6 +1123,8 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
if(do_cloud_simple) then
cld_frac_soc = REAL(cf_rad, kind(r_def))
+ cld_conv_frac_soc = REAL(cca_rad, kind(r_def))
+
reff_rad_soc = REAL(reff_rad, kind(r_def))
qcl_rad_soc = REAL(qcl_rad, kind(r_def))
@@ -1107,6 +1132,8 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
else
cld_frac_soc = 0.
+ cld_conv_frac_soc = 0.
+
reff_rad_soc = 0.
mmr_cl_rad_soc = 0.
@@ -1135,7 +1162,7 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
CALL socrates_interface(Time, rad_lat_soc, rad_lon_soc, soc_lw_mode, &
tg_tmp_soc, q_soc, ozone_soc, co2_soc, t_surf_for_soc, p_full_soc, &
p_half_soc, z_full_soc, z_half_soc, albedo_soc, coszen, rrsun, &
- n_profile, n_layer, cld_frac_soc, reff_rad_soc, mmr_cl_rad_soc, &
+ n_profile, n_layer, cld_frac_soc, cld_conv_frac_soc, reff_rad_soc, mmr_cl_rad_soc,&
output_heating_rate_lw, output_soc_flux_lw_down, output_soc_flux_lw_up, &
output_soc_flux_lw_down_clear, output_soc_flux_lw_up_clear, &
do_cloud_simple, &
@@ -1145,7 +1172,7 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
tg_tmp_soc = tg_tmp_soc + output_heating_rate_lw*delta_t !Output heating rate in K/s, so is a temperature tendency
- surf_lw_down(:,:) = REAL(output_soc_flux_lw_down(:,:, n_layer+1))
+ surf_lw_down(:,:) = REAL(output_soc_flux_lw_down(:,:, n_layer+1))
surf_lw_down_clear(:,:) = REAL(output_soc_flux_lw_down_clear(:,:, n_layer+1))
surf_lw_net(:,:) = REAL(output_soc_flux_lw_up(:,:,n_layer+1) - &
@@ -1166,7 +1193,7 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
CALL socrates_interface(Time, rad_lat_soc, rad_lon_soc, soc_lw_mode, &
tg_tmp_soc, q_soc, ozone_soc, co2_soc, t_surf_for_soc, p_full_soc, &
p_half_soc, z_full_soc, z_half_soc, albedo_soc, coszen, rrsun, &
- n_profile, n_layer, cld_frac_soc, reff_rad_soc, mmr_cl_rad_soc, &
+ n_profile, n_layer, cld_frac_soc, cld_conv_frac_soc, reff_rad_soc, mmr_cl_rad_soc, &
output_heating_rate_sw, output_soc_flux_sw_down, output_soc_flux_sw_up, &
output_soc_flux_sw_down_clear, output_soc_flux_sw_up_clear, &
do_cloud_simple)
@@ -1313,7 +1340,33 @@ subroutine run_socrates_end
if(do_read_ozone) call interpolator_end(o3_interp)
if(do_read_co2) call interpolator_end(co2_interp)
-
+
+ DEALLOCATE(soc_bins_lw)
+ DEALLOCATE(soc_bins_sw)
+ DEALLOCATE(outputted_soc_spectral_olr)
+ DEALLOCATE(tdt_soc_sw_store)
+ DEALLOCATE(tdt_soc_lw_store)
+ DEALLOCATE(net_surf_sw_down_store)
+ DEALLOCATE(surf_lw_down_store)
+
+ if (id_soc_flux_lw > 0) DEALLOCATE(thd_lw_flux_net_store)
+ if (id_soc_flux_sw > 0) DEALLOCATE(thd_sw_flux_net_store)
+ if (id_soc_surf_flux_sw_clear > 0) DEALLOCATE(net_surf_sw_down_clear_store)
+ if (id_soc_surf_flux_lw_down_clear > 0) DEALLOCATE(surf_lw_down_clear_store)
+ if (id_soc_surf_flux_lw > 0) DEALLOCATE(surf_lw_net_store)
+ if (id_soc_surf_flux_lw_clear > 0) DEALLOCATE(surf_lw_net_clear_store)
+ if (id_soc_surf_flux_sw_down > 0) DEALLOCATE(surf_sw_down_store)
+ if (id_soc_surf_flux_sw_down_clear > 0) DEALLOCATE(surf_sw_down_clear_store)
+ if (id_soc_olr > 0) DEALLOCATE(olr_store)
+ if (id_soc_olr_clear > 0) DEALLOCATE(olr_clear_store)
+ if (id_soc_toa_sw > 0) DEALLOCATE(toa_sw_store)
+ if (id_soc_toa_sw_clear > 0) DEALLOCATE(toa_sw_clear_store)
+ if (id_soc_toa_sw_down > 0) DEALLOCATE(toa_sw_down_store)
+ if (id_soc_toa_sw_down_clear > 0) DEALLOCATE(toa_sw_down_clear_store)
+ if (id_soc_coszen > 0) DEALLOCATE(coszen_store)
+ if (id_soc_ozone > 0) DEALLOCATE(thd_ozone_store)
+ if (id_soc_co2 > 0 ) DEALLOCATE(thd_co2_store)
+ if (id_soc_spectral_olr > 0) DEALLOCATE(spectral_olr_store)
end subroutine run_socrates_end
diff --git a/src/atmos_spectral/driver/solo/idealized_moist_phys.F90 b/src/atmos_spectral/driver/solo/idealized_moist_phys.F90
index 37061eb97..316b33460 100644
--- a/src/atmos_spectral/driver/solo/idealized_moist_phys.F90
+++ b/src/atmos_spectral/driver/solo/idealized_moist_phys.F90
@@ -756,7 +756,7 @@ subroutine idealized_moist_phys(Time, p_half, p_full, z_half, z_full, ug, vg, tg
real, dimension(size(ug,1), size(ug,2), size(ug,3)) :: tg_tmp, qg_tmp, RH,tg_interp, mc, dt_ug_conv, dt_vg_conv
! Simple cloud scheme variabilies to pass to radiation
-real, dimension(size(ug,1), size(ug,2), size(ug,3)) :: cf_rad, reff_rad, qcl_rad
+real, dimension(size(ug,1), size(ug,2), size(ug,3)) :: cf_rad, reff_rad, qcl_rad, cca_rad
real, intent(in) , dimension(:,:,:), optional :: mask
integer, intent(in) , dimension(:,:), optional :: kbot
@@ -937,8 +937,8 @@ subroutine idealized_moist_phys(Time, p_half, p_full, z_half, z_full, ug, vg, tg
tg(:,:,:,previous), &
grid_tracers(:,:,:,previous,nsphum), &
! outs -
- cf_rad(:,:,:), reff_rad(:,:,:), &
- qcl_rad(:,:,:) &
+ cf_rad(:,:,:), cca_rad(:,:,:), &
+ reff_rad(:,:,:), qcl_rad(:,:,:) &
)
endif
@@ -1059,7 +1059,7 @@ subroutine idealized_moist_phys(Time, p_half, p_full, z_half, z_full, ug, vg, tg
endif
call run_socrates(Time, Time+Time_step, rad_lat, rad_lon, tg(:,:,:,previous), grid_tracers(:,:,:,previous,nsphum), t_surf(:,:), p_full(:,:,:,current), &
- p_half(:,:,:,current),z_full(:,:,:,current),z_half(:,:,:,current), albedo, dt_tg(:,:,:), net_surf_sw_down(:,:), surf_lw_down(:,:), delta_t, do_cloud_simple, cf_rad(:,:,:), reff_rad(:,:,:), &
+ p_half(:,:,:,current),z_full(:,:,:,current),z_half(:,:,:,current), albedo, dt_tg(:,:,:), net_surf_sw_down(:,:), surf_lw_down(:,:), delta_t, do_cloud_simple, cf_rad(:,:,:), cca_rad(:,:,:), reff_rad(:,:,:), &
qcl_rad(:,:,:) )
endif
From 6acfc2197f02228291c663097276d4aaab7bcae2 Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Thu, 28 Mar 2019 14:27:50 +0000
Subject: [PATCH 035/304] Remove real conversions in soc_interface
---
.../socrates_aquaplanet_with_cloud.py | 15 ++++-----------
src/atmos_param/cloud_simple/cloud_simple.F90 | 3 +++
.../socrates/interface/socrates_interface.F90 | 4 ++--
.../socrates/interface/socrates_set_cld.F90 | 2 +-
4 files changed, 10 insertions(+), 14 deletions(-)
diff --git a/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
index 3e8e3813d..bc967d954 100644
--- a/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
+++ b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
@@ -129,21 +129,14 @@
'do_cloud_simple': True
},
- 'cloud_simple_nml': {
- 'simple_cca':0.0,
- 'rhcsfc': 0.95,
- 'rhc700': 0.7,
- 'rhc200': 0.3
- },
-
'vert_turb_driver_nml': {
'do_mellor_yamada': False, # default: True
'do_diffusivity': True, # default: False
'do_simple': True, # default: False
'constant_gust': 0.0, # default: 1.0
- 'use_tau': False
+ 'use_tau': False,
},
-
+
'diffusivity_nml': {
'do_entrain':False,
'do_simple': True,
@@ -227,5 +220,5 @@
cb.compile(debug=False)
exp.run(1, use_restart=False, num_cores=NCORES, overwrite_data=True)#, run_idb=True)
-# for i in range(2,171):
-# exp.run(i, num_cores=NCORES)
+ for i in range(2,121):
+ exp.run(i, num_cores=NCORES)
diff --git a/src/atmos_param/cloud_simple/cloud_simple.F90 b/src/atmos_param/cloud_simple/cloud_simple.F90
index b51cc84fe..184923dc7 100644
--- a/src/atmos_param/cloud_simple/cloud_simple.F90
+++ b/src/atmos_param/cloud_simple/cloud_simple.F90
@@ -280,6 +280,9 @@ subroutine calc_cf(q_hum, qsat, cf, cca, rh, simple_rhcrit, rh_min, rh_max)
cca = 0.0 ! no convective cloud fraction is calculated
! left in for future use
+ !cca can not be used in simple clouds as in read_control
+ ! control%i_cloud_representation = ip_cloud_ice_water
+
if (cca > 0.0) then
cf = MAX( simple_cca, cf )
end if
diff --git a/src/atmos_param/socrates/interface/socrates_interface.F90 b/src/atmos_param/socrates/interface/socrates_interface.F90
index d20d207a1..c26544050 100644
--- a/src/atmos_param/socrates/interface/socrates_interface.F90
+++ b/src/atmos_param/socrates/interface/socrates_interface.F90
@@ -868,7 +868,7 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
endif
if (id_soc_surf_flux_lw > 0) then
- surf_lw_net = real(surf_lw_net_store)
+ surf_lw_net = surf_lw_net_store
endif
if (id_soc_surf_flux_lw_clear > 0) then
@@ -1239,7 +1239,7 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
endif
if (id_soc_surf_flux_lw > 0) then
- surf_lw_net_store = real(surf_lw_net, kind(r_def))
+ surf_lw_net_store = surf_lw_net
endif
if (id_soc_surf_flux_sw_down > 0) then
diff --git a/src/atmos_param/socrates/interface/socrates_set_cld.F90 b/src/atmos_param/socrates/interface/socrates_set_cld.F90
index 99fd4a30e..3af8423b8 100644
--- a/src/atmos_param/socrates/interface/socrates_set_cld.F90
+++ b/src/atmos_param/socrates/interface/socrates_set_cld.F90
@@ -348,7 +348,7 @@ subroutine set_cld(cld, control, dimen, spectrum, n_profile, n_layer, &
cloud_frac(l, k)*ice_frac(l, k) / (liq_frac(l, k)+ice_frac(l, k))
else
cld%frac_cloud(l, k, ip_cloud_type_water) = 0.0_r_def
- cld%frac_cloud(l, k, ip_cloud_type_ice) = 0.0_r_def
+ cld%frac_cloud(l, k, ip_cloud_type_ice) = 0.0_r_def
end if
end do
end do
From f9a5e93a404415cfed24e4a7db2a2895cb20520b Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Wed, 10 Apr 2019 10:44:23 +0100
Subject: [PATCH 036/304] Adding extra diagnostics to test case
---
.../socrates_test/socrates_aquaplanet_with_cloud.py | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
index bc967d954..389e0b898 100644
--- a/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
+++ b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
@@ -39,6 +39,8 @@
diag.add_field('atmosphere', 'precipitation', time_avg=True)
diag.add_field('atmosphere', 'rh', time_avg=True)
diag.add_field('mixed_layer', 't_surf', time_avg=True)
+diag.add_field('mixed_layer', 'flux_t', time_avg=True) #LH
+diag.add_field('mixed_layer', 'flux_lhe', time_avg=True) #SH
diag.add_field('dynamics', 'sphum', time_avg=True)
diag.add_field('dynamics', 'ucomp', time_avg=True)
diag.add_field('dynamics', 'vcomp', time_avg=True)
@@ -218,7 +220,9 @@
if __name__=="__main__":
cb.compile(debug=False)
- exp.run(1, use_restart=False, num_cores=NCORES, overwrite_data=True)#, run_idb=True)
+ overwrite=False
+
+ exp.run(1, use_restart=False, num_cores=NCORES, overwrite_data=overwrite)#, run_idb=True)
for i in range(2,121):
- exp.run(i, num_cores=NCORES)
+ exp.run(i, num_cores=NCORES, overwrite_data=overwrite)
From 4d2517d99d3c46cad93915ffd20b06a38a508f60 Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Tue, 7 Apr 2020 13:52:29 +0100
Subject: [PATCH 037/304] Update to ignore for itcx_mip file
---
.gitignore | 1 +
1 file changed, 1 insertion(+)
diff --git a/.gitignore b/.gitignore
index 4333c2fac..6393fe876 100644
--- a/.gitignore
+++ b/.gitignore
@@ -29,3 +29,4 @@ mima_pz.txt
src/atmos_param/socrates/src/trunk*
test/.cache
test/results.xml
+exp/itcz_mip_exp/itcz_mip_q_flux.nc
From 328cf6ab483aa31cad6e8d4060c29f8282471065 Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Wed, 5 Sep 2018 16:18:11 +0100
Subject: [PATCH 038/304] Add file to paths and namelist variables in test
scripts
---
exp/test_cases/MiMA/MiMA_test_case.py | 12 +++++++++++-
exp/test_cases/socrates_test/socrates_aquaplanet.py | 11 +++++++++++
src/extra/model/isca/path_names | 1 +
src/extra/model/socrates/path_names | 1 +
4 files changed, 24 insertions(+), 1 deletion(-)
diff --git a/exp/test_cases/MiMA/MiMA_test_case.py b/exp/test_cases/MiMA/MiMA_test_case.py
index 270596744..f21ba6404 100644
--- a/exp/test_cases/MiMA/MiMA_test_case.py
+++ b/exp/test_cases/MiMA/MiMA_test_case.py
@@ -73,7 +73,17 @@
'do_simple': True,
'roughness_mom':3.21e-05,
'roughness_heat':3.21e-05,
- 'roughness_moist':3.21e-05,
+ 'roughness_moist':3.21e-05,
+ 'do_cloud_simple': True,
+ },
+ 'cloud_simple_nml': {
+ 'simple_cca':0.0,
+ 'rhcsfc': 0.95,
+ 'rhc700': 0.7,
+ 'rhc200': 0.3,
+ 'rhmsfc': 0.95,
+ 'rhm700': 0.7,
+ 'rhm200': 0.3,
},
'vert_turb_driver_nml': {
diff --git a/exp/test_cases/socrates_test/socrates_aquaplanet.py b/exp/test_cases/socrates_test/socrates_aquaplanet.py
index 2a4bc775f..41b77bc33 100644
--- a/exp/test_cases/socrates_test/socrates_aquaplanet.py
+++ b/exp/test_cases/socrates_test/socrates_aquaplanet.py
@@ -108,6 +108,17 @@
'two_stream_gray': False, #Use the grey radiation scheme
'do_socrates_radiation': True,
'convection_scheme': 'SIMPLE_BETTS_MILLER', #Use simple Betts miller convection
+ 'do_cloud_simple': True,
+ },
+
+ 'cloud_simple_nml': {
+ 'simple_cca':0.0,
+ 'rhcsfc': 0.95,
+ 'rhc700': 0.7,
+ 'rhc200': 0.3,
+ 'rhmsfc': 0.95,
+ 'rhm700': 0.7,
+ 'rhm200': 0.3,
},
'vert_turb_driver_nml': {
diff --git a/src/extra/model/isca/path_names b/src/extra/model/isca/path_names
index ee73b2499..eebdfd2b0 100644
--- a/src/extra/model/isca/path_names
+++ b/src/extra/model/isca/path_names
@@ -11,6 +11,7 @@ atmos_param/sea_esf_rad/null/rad_utilities.F90
atmos_param/shallow_conv/shallow_conv.F90
atmos_param/stable_bl_turb/stable_bl_turb.F90
atmos_param/strat_cloud/null/strat_cloud.F90
+atmos_param/cloud_simple/cloud_simple.F90
atmos_param/two_stream_gray_rad/two_stream_gray_rad.F90
atmos_param/qflux/qflux.f90
atmos_param/monin_obukhov/monin_obukhov_interfaces.h
diff --git a/src/extra/model/socrates/path_names b/src/extra/model/socrates/path_names
index 6cb698ede..2f4dac9eb 100644
--- a/src/extra/model/socrates/path_names
+++ b/src/extra/model/socrates/path_names
@@ -11,6 +11,7 @@ atmos_param/sea_esf_rad/null/rad_utilities.F90
atmos_param/shallow_conv/shallow_conv.F90
atmos_param/stable_bl_turb/stable_bl_turb.F90
atmos_param/strat_cloud/null/strat_cloud.F90
+atmos_param/cloud_simple/cloud_simple.F90
atmos_param/two_stream_gray_rad/two_stream_gray_rad.F90
atmos_param/qflux/qflux.f90
atmos_param/monin_obukhov/monin_obukhov_interfaces.h
From f4e8861db5ea11910667740b24837d1065ef6ce0 Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Wed, 5 Sep 2018 16:18:53 +0100
Subject: [PATCH 039/304] Additions to RRTM and ideal mosist phys to use the
simple cloud scheme
---
.../rrtm_radiation/rrtm_radiation.f90 | 51 ++++++++++++++-----
.../driver/solo/idealized_moist_phys.F90 | 28 +++++++++-
2 files changed, 64 insertions(+), 15 deletions(-)
diff --git a/src/atmos_param/rrtm_radiation/rrtm_radiation.f90 b/src/atmos_param/rrtm_radiation/rrtm_radiation.f90
index 3f498b402..3f7e6ec74 100644
--- a/src/atmos_param/rrtm_radiation/rrtm_radiation.f90
+++ b/src/atmos_param/rrtm_radiation/rrtm_radiation.f90
@@ -531,7 +531,10 @@ subroutine interp_temp(z_full,z_half,t, Time)
end subroutine interp_temp
!*****************************************************************************************
!*****************************************************************************************
- subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half,albedo,q,t,t_surf_rad,tdt,coszen,flux_sw,flux_lw)
+ subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half, &
+ albedo,q,t,t_surf_rad,tdt, &
+ coszen,flux_sw,flux_lw,cfa_rad,reff_rad, &
+ do_cloud_simple)
!
! Driver for RRTMG radiation scheme.
! Prepares all inputs, calls SW and LW radiation schemes,
@@ -577,6 +580,11 @@ subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half,albedo,q,t,t_surf_rad,tdt,
real(kind=rb),dimension(:,:),intent(out),optional :: flux_sw,flux_lw ! surface fluxes [W/m2]
! dimension (lat x lon)
! need to have both or none!
+ real(kind=rb), dimension(:,:,:), intent(in) :: cfa_rad,reff_rad !cloud properties
+
+ logical, intent(in) :: do_cloud_simple
+
+
!---------------------------------------------------------------------------------------------------------------
! Local variables
integer k,j,i,ij,j1,i1,ij1,kend,dyofyr,seconds,days
@@ -584,7 +592,7 @@ subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half,albedo,q,t,t_surf_rad,tdt,
real(kind=rb),dimension(size(q,1),size(q,2),size(q,3)) :: o3f
real(kind=rb),dimension(size(q,1),size(q,2),size(q,3)) :: co2f,co2f_temp
real(kind=rb),dimension(ncols_rrt,nlay_rrt) :: pfull,tfull,fracday&
- , hr,hrc, swhr, swhrc
+ , hr,hrc, swhr, swhrc, cldfr, reliq, reice
real(kind=rb),dimension(size(tdt,1),size(tdt,2),size(tdt,3)) :: tdt_rrtm
real(kind=rb),dimension(ncols_rrt,nlay_rrt+1) :: uflx, dflx, uflxc, dflxc&
,swuflx, swdflx, swuflxc, swdflxc
@@ -599,11 +607,10 @@ subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half,albedo,q,t,t_surf_rad,tdt,
real(kind=rb),dimension(size(q,1),size(q,2)) :: fracsun
real(kind=rb),dimension(size(q,1),size(q,2)) :: p2 !mp586 addition for annual mean insolation
- integer :: year_in_s
+ integer :: year_in_s
real :: r_seconds, r_days, r_total_seconds, frac_of_day, frac_of_year, gmt, time_since_ae, rrsun, dt_rad_radians, day_in_s, r_solday, r_dt_rad_avg
-
! debug
integer :: indx2(2),indx(3),ii,ji,ki
logical :: used
@@ -828,6 +835,20 @@ subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half,albedo,q,t,t_surf_rad,tdt,
! anything lower than 0.01 (about 15min) is set to zero
! where(cosz_rr < 1.e-2)cosz_rr=0.
+ if (do_cloud_simple) then
+ inflglw = 2 !RRTM responsible for calculating optical properties of clouds
+ liqflglw = 1 !Sets liquid water radii to be used rather than being inactive (zero is inactive)
+ cldfr = reshape( cfa_rad (1:si:lonstep,:,sk :1:-1),(/ si*sj/lonstep,sk /))
+ reliq = reshape(reff_rad (1:si:lonstep,:,sk :1:-1),(/ si*sj/lonstep,sk /))
+ reice = zeros !Ice particle radii not used as iceflglw=0 meaning it is inactive. Setting to fill value of zeros
+ else
+ cldfr = zeros
+ reliq = 10*ones
+ reice = 10*ones
+ endif
+
+
+
if(include_secondary_gases)then
call rrtmg_sw &
(ncols_rrt, nlay_rrt , icld , iaer , &
@@ -835,13 +856,14 @@ subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half,albedo,q,t,t_surf_rad,tdt,
h2o , o3 , co2 , ch4_val*ones , n2o_val*ones , o2_val*ones , &
albedo_rr , albedo_rr, albedo_rr, albedo_rr, &
cosz_rr , solrad , dyofyr , solr_cnst, &
- inflglw , iceflglw , liqflglw , &
+ inflglw , iceflglw , liqflglw , &
! cloud parameters
- zeros , taucld , sw_zro , sw_zro , sw_zro , &
- zeros , zeros , 10*ones , 10*ones , &
- tauaer , zro_sw , zro_sw , zro_sw , &
+ cldfr, &
+ taucld , sw_zro , sw_zro , sw_zro , &
+ zeros , zeros , reice , reliq , &
+ tauaer , zro_sw , zro_sw , zro_sw , &
! output
- swuflx , swdflx , swhr , swuflxc , swdflxc, swhrc)
+ swuflx , swdflx , swhr , swuflxc , swdflxc, swhrc)
else
call rrtmg_sw &
(ncols_rrt, nlay_rrt , icld , iaer , &
@@ -849,10 +871,11 @@ subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half,albedo,q,t,t_surf_rad,tdt,
h2o , o3 , co2 , zeros , zeros, zeros, &
albedo_rr , albedo_rr, albedo_rr, albedo_rr, &
cosz_rr , solrad , dyofyr , solr_cnst, &
- inflglw , iceflglw , liqflglw , &
+ inflglw , iceflglw , liqflglw , &
! cloud parameters
- zeros , taucld , sw_zro , sw_zro , sw_zro , &
- zeros , zeros , 10*ones , 10*ones , &
+ cldfr, &
+ taucld , sw_zro , sw_zro , sw_zro , &
+ zeros , zeros , reice , reliq , &
tauaer , zro_sw , zro_sw , zro_sw , &
! output
swuflx , swdflx , swhr , swuflxc , swdflxc, swhrc)
@@ -884,7 +907,7 @@ subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half,albedo,q,t,t_surf_rad,tdt,
! emissivity and cloud composition
emis , inflglw , iceflglw , liqflglw , &
! cloud parameters
- zeros , taucld , zeros , zeros , 10*ones, 10*ones, &
+ cldfr , taucld , zeros , zeros , reice, reliq, &
tauaer , &
! output
uflx , dflx , hr , uflxc , dflxc , hrc)
@@ -897,7 +920,7 @@ subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half,albedo,q,t,t_surf_rad,tdt,
! emissivity and cloud composition
emis , inflglw , iceflglw, liqflglw, &
! cloud parameters
- zeros , taucld , zeros , zeros, 10*ones, 10*ones, &
+ cldfr , taucld , zeros , zeros, reice, reliq, &
tauaer , &
! output
uflx , dflx , hr , uflxc, dflxc , hrc)
diff --git a/src/atmos_spectral/driver/solo/idealized_moist_phys.F90 b/src/atmos_spectral/driver/solo/idealized_moist_phys.F90
index 1d7a89eb2..986bc1313 100644
--- a/src/atmos_spectral/driver/solo/idealized_moist_phys.F90
+++ b/src/atmos_spectral/driver/solo/idealized_moist_phys.F90
@@ -18,6 +18,8 @@ module idealized_moist_phys_mod
use two_stream_gray_rad_mod, only: two_stream_gray_rad_init, two_stream_gray_rad_down, two_stream_gray_rad_up, two_stream_gray_rad_end
+use cloud_simple_mod, only: cloud_simple_init, cloud_simple_end, cloud_simple
+
use mixed_layer_mod, only: mixed_layer_init, mixed_layer, mixed_layer_end, albedo_calc
use lscale_cond_mod, only: lscale_cond_init, lscale_cond, lscale_cond_end
@@ -107,6 +109,9 @@ module idealized_moist_phys_mod
logical :: do_bm = .false.
logical :: do_ras = .false.
+! Cloud options
+logical :: do_cloud_simple = .false.
+
!s Radiation options
logical :: two_stream_gray = .true.
logical :: do_rrtm_radiation = .false.
@@ -142,6 +147,7 @@ module idealized_moist_phys_mod
! end RG Add bucket
namelist / idealized_moist_phys_nml / turb, lwet_convection, do_bm, do_ras, roughness_heat, &
+ do_cloud_simple, &
two_stream_gray, do_rrtm_radiation, do_damping,&
mixed_layer_bc, do_simple, &
roughness_moist, roughness_mom, do_virtual, &
@@ -790,6 +796,9 @@ subroutine idealized_moist_phys(Time, p_half, p_full, z_half, z_full, ug, vg, tg
real :: delta_t
real, dimension(size(ug,1), size(ug,2), size(ug,3)) :: tg_tmp, qg_tmp, RH,tg_interp, mc, dt_ug_conv, dt_vg_conv
+! Simple cloud scheme variabilies to pass to radiation
+real, dimension(size(ug,1), size(ug,2), size(ug,3)) :: cfa_rad, reff_rad
+
real, intent(in) , dimension(:,:,:), optional :: mask
integer, intent(in) , dimension(:,:), optional :: kbot
@@ -952,6 +961,20 @@ subroutine idealized_moist_phys(Time, p_half, p_full, z_half, z_full, ug, vg, tg
endif
+! Call the simple cloud scheme in line with SPOOKIE-2 requirements
+! Using start of time step variables
+! using soecific humidity NOT mixing ratios
+if(do_cloud_simple) then
+ call cloud_simple(p_half(:,:,:,current), p_full(:,:,:,current), &
+ Time, &
+ tg(:,:,:,previous), &
+ grid_tracers(:,:,:,previous,nsphum), &
+ ! outs -
+ cfa_rad(:,:,:), reff_rad(:,:,:) &
+ )
+
+endif
+
! Begin the radiation calculation by computing downward fluxes.
! This part of the calculation does not depend on the surface temperature.
@@ -1076,7 +1099,10 @@ subroutine idealized_moist_phys(Time, p_half, p_full, z_half, z_full, ug, vg, tg
!need t at half grid
tg_interp=tg(:,:,:,previous)
call interp_temp(z_full(:,:,:,current),z_half(:,:,:,current),tg_interp, Time)
- call run_rrtmg(is,js,Time,rad_lat(:,:),rad_lon(:,:),p_full(:,:,:,current),p_half(:,:,:,current),albedo,grid_tracers(:,:,:,previous,nsphum),tg_interp,t_surf(:,:),dt_tg(:,:,:),coszen,net_surf_sw_down(:,:),surf_lw_down(:,:))
+ call run_rrtmg(is,js,Time,rad_lat(:,:),rad_lon(:,:),p_full(:,:,:,current),p_half(:,:,:,current), &
+ albedo,grid_tracers(:,:,:,previous,nsphum),tg_interp,t_surf(:,:),dt_tg(:,:,:), &
+ coszen,net_surf_sw_down(:,:),surf_lw_down(:,:), cfa_rad(:,:,:), reff_rad(:,:,:), &
+ do_cloud_simple )
endif
#endif
From 65c482d8670fb207c99b7c3c57a3d3a084b45cd0 Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Wed, 5 Sep 2018 16:19:54 +0100
Subject: [PATCH 040/304] Fist drafted simple cloud scheme - need to check
hooks to rrtm and work out approach for socrities
---
src/atmos_param/cloud_simple/cloud_simple.F90 | 203 ++++++++++++++++++
1 file changed, 203 insertions(+)
create mode 100644 src/atmos_param/cloud_simple/cloud_simple.F90
diff --git a/src/atmos_param/cloud_simple/cloud_simple.F90 b/src/atmos_param/cloud_simple/cloud_simple.F90
new file mode 100644
index 000000000..c9c09de75
--- /dev/null
+++ b/src/atmos_param/cloud_simple/cloud_simple.F90
@@ -0,0 +1,203 @@
+module cloud_simple_mod
+
+#ifdef INTERNAL_FILE_NML
+ use mpp_mod, only: input_nml_file
+#else
+ use fms_mod, only: open_namelist_file, close_file
+#endif
+
+ use fms_mod, only: stdlog, FATAL, WARNING, error_mesg
+ use time_manager_mod, only: time_type
+
+ implicit none
+
+ logical :: do_init = .true. ! Do I still need to do init?
+
+ real :: simple_cca = 0.0
+ real :: rhcsfc = 0.95
+ real :: rhc700 = 0.7
+ real :: rhc200 = 0.3
+ real :: rhmsfc = 0.95
+ real :: rhm700 = 0.7
+ real :: rhm200 = 0.3
+
+ namelist /cloud_simple_nml/ simple_cca, rhcsfc, rhc700, rhc200, &
+ rhmsfc, rhm700, rhm200
+ real :: zerodegc = 273.15
+
+
+ contains
+
+ !-----------------------------------------------
+
+
+ subroutine cloud_simple_init ()
+
+ integer :: io ,stdlog_unit
+
+#ifdef INTERNAL_FILE_NML
+ read (input_nml_file, nml=cloud_simple_nml, iostat=io)
+#else
+ if ( file_exist('input.nml') ) then
+ nml_unit = open_namelist_file()
+ read (nml_unit, cloud_simple_nml, iostat=io)
+ call close_file(nml_unit)
+ endif
+#endif
+ stdlog_unit = stdlog()
+ write(stdlog_unit, cloud_simple_nml)
+
+ do_init = .false. !initialisation completed
+
+ end subroutine cloud_simple_init
+
+ !-----------------------------------------------
+
+ subroutine cloud_simple (p_half, p_full, Time, &
+ temp, q_hum, &
+ ! outs
+ cfa_rad, reff_rad )
+
+ real , intent(in), dimension(:,:,:) :: temp, q_hum, p_full, p_half
+ type(time_type) , intent(in) :: Time
+
+ real , intent(out), dimension(:,:,:) :: cfa_rad, reff_rad
+
+ real, dimension(size(temp,1), size(temp, 2), size(temp, 3)) :: qs, qcl_rad
+ real :: frac_liq, cf_rad, simple_rhcrit
+
+ integer :: i, j, k, k_surf
+
+ logical :: es_over_liq_and_ice=.true.
+
+ !check initiation has been done - ie read in parameters
+ if (do_init) call error_mesg ('cloud_simple', &
+ 'cloud_simple_init has not been called.', FATAL)
+
+ ! Get the saturated specific humidity TOTAL (ie ice and vap) ***double check maths!
+ call compute_qs(temp, p_full, qs, es_over_liq_and_ice) !qs=qsat in um
+
+ k_surf = size(temp, 3)
+
+ do i=1, size(temp, 1)
+ do j=1, size(temp, 2)
+ do k=1, size(temp, 3)
+
+ !caluclate the frac_liq
+ call calc_liq_frac(temp(i,j,k), frac_liq)
+ call calc_reff(frac_liq, reff_rad(i,j,k))
+ call calc_rhcrit(p_full(i,j,k), p_full(i,j,k_surf), simple_rhcrit)
+ call calc_cf_rad(q_hum(i,j,k), qs(i,j,k), simple_rhcrit, cf_rad)
+ call calc_qcl_rad(p_full(i,j,k), cf_rad, qcl_rad(i,j,k) )
+ end do
+ end do
+ end do
+
+ !WHAT ARE THE UNITS
+ !add diagnostics
+
+ end subroutine cloud_simple
+
+ subroutine calc_liq_frac(temp, frac_liq)
+ ! All liquid if above zero and all ice below -40C
+ ! linearly interpolate between T=0 and -40C
+
+ real, intent(in) :: temp
+ real, intent(out) :: frac_liq
+
+
+ if (temp > zerodegc) then
+ frac_liq = 1.0
+ else if (temp < zerodegc-40.0) then
+ frac_liq = 0.0
+ else
+ frac_liq = 1.0 - (zerodegc-temp) / 40.0
+ end if
+
+
+ end subroutine calc_liq_frac
+
+ subroutine calc_reff(frac_liq, reff_rad)
+
+ real, intent(in) :: frac_liq
+ real, intent(out) :: reff_rad
+
+ reff_rad = 1.0e-6 * ( 10.0 * frac_liq + 20.0 * (1.0 - frac_liq) )
+
+ end subroutine calc_reff
+
+ subroutine calc_rhcrit(p_full, p_surf, simple_rhcrit) !need to check p_full - > p_layer_centres
+
+ real, intent(in) :: p_full, p_surf
+ real, intent(out) :: simple_rhcrit
+
+ ! Calculate RHcrit as function of pressure
+ if (p_full > 70000.0 ) then
+
+ simple_rhcrit = rhcsfc - ( rhcsfc - rhc700 ) * &
+ ( p_surf - p_full ) / ( p_surf - 70000.0 )
+
+ else if ( p_full > 20000.0 ) then
+
+ simple_rhcrit = rhc700 - ( rhc700 - rhc200 ) * &
+ ( 70000.0 - p_full) / 50000.0
+
+ else
+ simple_rhcrit = rhc200
+ endif
+
+ end subroutine calc_rhcrit
+
+ subroutine calc_cf_rad (q_hum, qsat, simple_rhcrit, cf_rad)
+ ! Calculate LS (stratiform) cloud fraction
+ ! as a simple linear function of RH
+
+ real, intent(in) :: q_hum, qsat, simple_rhcrit
+ real, intent(out) :: cf_rad
+
+ real :: rh, cca
+
+ rh = q_hum/qsat
+ cf_rad = MAX( 0.0, MIN( 1.0, ( rh - simple_rhcrit ) / ( 1.0 - simple_rhcrit ) ))
+
+ ! include simple convective cloud fraction where present
+
+ cca = 0.0 ! no convective cloud fraction is calculated
+ ! left in for fture use
+
+ if (cca > 0.0) then
+ cf_rad = MAX( simple_cca, cf_rad )
+ end if
+
+ end subroutine calc_cf_rad
+
+ subroutine calc_qcl_rad(p_full, cf_rad, qcl_rad)
+ ! calculate simple water content
+
+ real , intent(in) :: p_full, cf_rad
+ real , intent(out) :: qcl_rad
+
+ real :: in_cloud_qcl
+
+ in_cloud_qcl = 3.0e-4 + &
+ (1.0-3.0e-4)*(p_full-20000.0)/80000.0
+
+ in_cloud_qcl = MAX ( 0.0, in_cloud_qcl/1000.0 ) ! convert to kg/kg
+
+ qcl_rad = cf_rad * in_cloud_qcl
+
+ end subroutine calc_qcl_rad
+
+
+ !-----------------------------------------------
+
+
+ subroutine cloud_simple_end ()
+
+ ! do we deallocate anything?
+
+ end subroutine cloud_simple_end
+
+ !-----------------------------------------------
+
+end module cloud_simple_mod
From 901631ab993eb97431052d504050477bed5bbdda Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Wed, 5 Sep 2018 17:30:24 +0100
Subject: [PATCH 041/304] Changes so code will now compile
---
src/atmos_param/cloud_simple/cloud_simple.F90 | 9 +++++----
src/atmos_spectral/driver/solo/idealized_moist_phys.F90 | 5 +++++
2 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/src/atmos_param/cloud_simple/cloud_simple.F90 b/src/atmos_param/cloud_simple/cloud_simple.F90
index c9c09de75..a04d92b5b 100644
--- a/src/atmos_param/cloud_simple/cloud_simple.F90
+++ b/src/atmos_param/cloud_simple/cloud_simple.F90
@@ -6,8 +6,9 @@ module cloud_simple_mod
use fms_mod, only: open_namelist_file, close_file
#endif
- use fms_mod, only: stdlog, FATAL, WARNING, error_mesg
- use time_manager_mod, only: time_type
+ use fms_mod, only: stdlog, FATAL, WARNING, error_mesg
+ use time_manager_mod, only: time_type
+ use sat_vapor_pres_mod, only: compute_qs
implicit none
@@ -68,14 +69,14 @@ subroutine cloud_simple (p_half, p_full, Time, &
integer :: i, j, k, k_surf
- logical :: es_over_liq_and_ice=.true.
+ logical :: es_over_liq_and_ice
!check initiation has been done - ie read in parameters
if (do_init) call error_mesg ('cloud_simple', &
'cloud_simple_init has not been called.', FATAL)
! Get the saturated specific humidity TOTAL (ie ice and vap) ***double check maths!
- call compute_qs(temp, p_full, qs, es_over_liq_and_ice) !qs=qsat in um
+ call compute_qs(temp, p_full, qs, es_over_liq_and_ice=.true.) !qs=qsat in um
k_surf = size(temp, 3)
diff --git a/src/atmos_spectral/driver/solo/idealized_moist_phys.F90 b/src/atmos_spectral/driver/solo/idealized_moist_phys.F90
index 986bc1313..ca7783407 100644
--- a/src/atmos_spectral/driver/solo/idealized_moist_phys.F90
+++ b/src/atmos_spectral/driver/solo/idealized_moist_phys.F90
@@ -347,6 +347,10 @@ subroutine idealized_moist_phys_init(Time, Time_step_in, nhum, rad_lon_2d, rad_l
d622 = rdgas/rvgas
d378 = 1.-d622
+if(do_cloud_simple) then
+ call cloud_simple_init()
+end if
+
!s need to make sure that gray radiation and rrtm radiation are not both called.
if(two_stream_gray .and. do_rrtm_radiation) &
call error_mesg('physics_driver_init','do_grey_radiation and do_rrtm_radiation cannot both be .true.',FATAL)
@@ -965,6 +969,7 @@ subroutine idealized_moist_phys(Time, p_half, p_full, z_half, z_full, ug, vg, tg
! Using start of time step variables
! using soecific humidity NOT mixing ratios
if(do_cloud_simple) then
+
call cloud_simple(p_half(:,:,:,current), p_full(:,:,:,current), &
Time, &
tg(:,:,:,previous), &
From c650be26d3092384939f2c2ed120e2ad1c2caef8 Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Wed, 5 Sep 2018 17:31:07 +0100
Subject: [PATCH 042/304] Now building sat specific humidity tables and shorter
run on more cores
---
exp/test_cases/MiMA/MiMA_test_case.py | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/exp/test_cases/MiMA/MiMA_test_case.py b/exp/test_cases/MiMA/MiMA_test_case.py
index f21ba6404..61472cc25 100644
--- a/exp/test_cases/MiMA/MiMA_test_case.py
+++ b/exp/test_cases/MiMA/MiMA_test_case.py
@@ -4,7 +4,7 @@
from isca import IscaCodeBase, DiagTable, Experiment, Namelist, GFDL_BASE
-NCORES = 4
+NCORES = 16
# a CodeBase can be a directory on the computer,
# useful for iterative development
@@ -131,7 +131,8 @@
},
'sat_vapor_pres_nml': {
- 'do_simple':True
+ 'do_simple':True,
+ 'construct_table_wrt_liq_and_ice':True
},
'damping_driver_nml': {
@@ -185,5 +186,5 @@
#Lets do a run!
if __name__=="__main__":
exp.run(1, use_restart=False, num_cores=NCORES)
- for i in range(2,121):
+ for i in range(2,25):
exp.run(i, num_cores=NCORES)
From ba8525828359bec3dd851362e9130d7cd15e30c1 Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Thu, 6 Sep 2018 12:24:50 +0100
Subject: [PATCH 043/304] exp/test_cases/MiMA/MiMA_test_case.py
---
src/atmos_param/cloud_simple/cloud_simple.F90 | 91 ++++++++++++++++---
.../rrtm_radiation/rrtm_radiation.f90 | 20 ++--
.../driver/solo/idealized_moist_phys.F90 | 15 ++-
3 files changed, 99 insertions(+), 27 deletions(-)
diff --git a/src/atmos_param/cloud_simple/cloud_simple.F90 b/src/atmos_param/cloud_simple/cloud_simple.F90
index a04d92b5b..c35708ad3 100644
--- a/src/atmos_param/cloud_simple/cloud_simple.F90
+++ b/src/atmos_param/cloud_simple/cloud_simple.F90
@@ -10,9 +10,11 @@ module cloud_simple_mod
use time_manager_mod, only: time_type
use sat_vapor_pres_mod, only: compute_qs
+ use diag_manager_mod, only: register_diag_field, send_data
+
implicit none
- logical :: do_init = .true. ! Do I still need to do init?
+ logical :: do_init = .true. ! Check if init needs to be run
real :: simple_cca = 0.0
real :: rhcsfc = 0.95
@@ -26,16 +28,22 @@ module cloud_simple_mod
rhmsfc, rhm700, rhm200
real :: zerodegc = 273.15
+ integer :: id_cf_rad, id_reff_rad, id_frac_liq, id_qcl_rad
+ character(len=14), parameter :: mod_name_cld = "cloud_simple"
contains
!-----------------------------------------------
- subroutine cloud_simple_init ()
+ subroutine cloud_simple_init (axes, Time)
+
+ type(time_type), intent(in) :: Time
+ integer, intent(in), dimension(4) :: axes
integer :: io ,stdlog_unit
+
#ifdef INTERNAL_FILE_NML
read (input_nml_file, nml=cloud_simple_nml, iostat=io)
#else
@@ -48,6 +56,26 @@ subroutine cloud_simple_init ()
stdlog_unit = stdlog()
write(stdlog_unit, cloud_simple_nml)
+ !register diagnostics
+ id_cf_rad = &
+ register_diag_field ( mod_name_cld, 'cf_rad', axes(1:3), Time, &
+ 'Cloud fraction for the simple cloud scheme', 'unitless: values 0-1')
+
+ id_frac_liq = &
+ register_diag_field ( mod_name_cld, 'frac_liq', axes(1:3), Time, &
+ 'Liquid cloud fraction (liquid, mixed-ice phase, ice)', &
+ 'unitless: values 0-1')
+
+ id_reff_rad = &
+ register_diag_field ( mod_name_cld, 'reff_rad', axes(1:3), Time, &
+ 'Effective cloud particle radius', &
+ 'microns')
+
+ id_qcl_rad = &
+ register_diag_field ( mod_name_cld, 'qcl_rad', axes(1:3), Time, &
+ 'Specific humidity of cloud liquid', &
+ 'kg/kg')
+
do_init = .false. !initialisation completed
end subroutine cloud_simple_init
@@ -57,20 +85,22 @@ end subroutine cloud_simple_init
subroutine cloud_simple (p_half, p_full, Time, &
temp, q_hum, &
! outs
- cfa_rad, reff_rad )
+ cf_rad, reff_rad, qcl_rad )
real , intent(in), dimension(:,:,:) :: temp, q_hum, p_full, p_half
type(time_type) , intent(in) :: Time
- real , intent(out), dimension(:,:,:) :: cfa_rad, reff_rad
+ real , intent(out), dimension(:,:,:) :: cf_rad, reff_rad, qcl_rad
- real, dimension(size(temp,1), size(temp, 2), size(temp, 3)) :: qs, qcl_rad
- real :: frac_liq, cf_rad, simple_rhcrit
+ real, dimension(size(temp,1), size(temp, 2), size(temp, 3)) :: qs, frac_liq
+ real :: simple_rhcrit
integer :: i, j, k, k_surf
logical :: es_over_liq_and_ice
+ real :: tmp1, tmp2 !remove tmp1 and tmp2 after debugging
+
!check initiation has been done - ie read in parameters
if (do_init) call error_mesg ('cloud_simple', &
'cloud_simple_init has not been called.', FATAL)
@@ -85,17 +115,22 @@ subroutine cloud_simple (p_half, p_full, Time, &
do k=1, size(temp, 3)
!caluclate the frac_liq
- call calc_liq_frac(temp(i,j,k), frac_liq)
- call calc_reff(frac_liq, reff_rad(i,j,k))
+ call calc_liq_frac(temp(i,j,k), frac_liq(i,j,k))
+ call calc_reff(frac_liq(i,j,k), reff_rad(i,j,k))
call calc_rhcrit(p_full(i,j,k), p_full(i,j,k_surf), simple_rhcrit)
- call calc_cf_rad(q_hum(i,j,k), qs(i,j,k), simple_rhcrit, cf_rad)
- call calc_qcl_rad(p_full(i,j,k), cf_rad, qcl_rad(i,j,k) )
+ call calc_cf_rad(q_hum(i,j,k), qs(i,j,k), simple_rhcrit, cf_rad(i,j,k))
+ call calc_qcl_rad(p_full(i,j,k), cf_rad(i,j,k), qcl_rad(i,j,k) )
end do
end do
end do
- !WHAT ARE THE UNITS
- !add diagnostics
+ !save some diagnotics
+ call output_cloud_diags(cf_rad, reff_rad, frac_liq, qcl_rad, Time )
+
+tmp2 = maxval(cf_rad)
+tmp1 = maxval(reff_rad)
+tmp2 = maxval(cf_rad)
+
end subroutine cloud_simple
@@ -123,7 +158,7 @@ subroutine calc_reff(frac_liq, reff_rad)
real, intent(in) :: frac_liq
real, intent(out) :: reff_rad
- reff_rad = 1.0e-6 * ( 10.0 * frac_liq + 20.0 * (1.0 - frac_liq) )
+ reff_rad = 10.0 * frac_liq + 20.0 * (1.0 - frac_liq) !units in microns
end subroutine calc_reff
@@ -170,6 +205,8 @@ subroutine calc_cf_rad (q_hum, qsat, simple_rhcrit, cf_rad)
cf_rad = MAX( simple_cca, cf_rad )
end if
+
+
end subroutine calc_cf_rad
subroutine calc_qcl_rad(p_full, cf_rad, qcl_rad)
@@ -190,6 +227,34 @@ subroutine calc_qcl_rad(p_full, cf_rad, qcl_rad)
end subroutine calc_qcl_rad
+
+ subroutine output_cloud_diags(cf_rad, reff_rad, frac_liq, qcl_rad, Time)
+
+ real, intent(in), dimension(:,:,:) :: cf_rad, reff_rad, frac_liq, qcl_rad
+
+ type(time_type) , intent(in) :: Time
+
+ real :: used
+
+ if ( id_cf_rad > 0 ) then
+ used = send_data ( id_cf_rad, cf_rad, Time)
+ endif
+
+ if ( id_reff_rad > 0 ) then
+ used = send_data ( id_reff_rad, reff_rad, Time)
+ endif
+
+ if ( id_frac_liq > 0 ) then
+ used = send_data ( id_frac_liq, frac_liq, Time)
+ endif
+
+ if ( id_qcl_rad > 0 ) then
+ used = send_data ( id_qcl_rad, qcl_rad, Time)
+ endif
+
+
+ end subroutine output_cloud_diags
+
!-----------------------------------------------
diff --git a/src/atmos_param/rrtm_radiation/rrtm_radiation.f90 b/src/atmos_param/rrtm_radiation/rrtm_radiation.f90
index 3f7e6ec74..dc9e9ab3a 100644
--- a/src/atmos_param/rrtm_radiation/rrtm_radiation.f90
+++ b/src/atmos_param/rrtm_radiation/rrtm_radiation.f90
@@ -533,7 +533,7 @@ end subroutine interp_temp
!*****************************************************************************************
subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half, &
albedo,q,t,t_surf_rad,tdt, &
- coszen,flux_sw,flux_lw,cfa_rad,reff_rad, &
+ coszen,flux_sw,flux_lw,cf_rad,reff_rad, &
do_cloud_simple)
!
! Driver for RRTMG radiation scheme.
@@ -580,7 +580,7 @@ subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half, &
real(kind=rb),dimension(:,:),intent(out),optional :: flux_sw,flux_lw ! surface fluxes [W/m2]
! dimension (lat x lon)
! need to have both or none!
- real(kind=rb), dimension(:,:,:), intent(in) :: cfa_rad,reff_rad !cloud properties
+ real(kind=rb), dimension(:,:,:), intent(in) :: cf_rad,reff_rad !cloud properties
logical, intent(in) :: do_cloud_simple
@@ -612,6 +612,8 @@ subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half, &
! debug
+ real :: tmp1, tmp2 !remove tmp1 and tmp2 after debugging
+
integer :: indx2(2),indx(3),ii,ji,ki
logical :: used
!---------------------------------------------------------------------------------------------------------------
@@ -838,16 +840,16 @@ subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half, &
if (do_cloud_simple) then
inflglw = 2 !RRTM responsible for calculating optical properties of clouds
liqflglw = 1 !Sets liquid water radii to be used rather than being inactive (zero is inactive)
- cldfr = reshape( cfa_rad (1:si:lonstep,:,sk :1:-1),(/ si*sj/lonstep,sk /))
- reliq = reshape(reff_rad (1:si:lonstep,:,sk :1:-1),(/ si*sj/lonstep,sk /))
- reice = zeros !Ice particle radii not used as iceflglw=0 meaning it is inactive. Setting to fill value of zeros
+ cldfr = reshape( cf_rad (1:si:lonstep,:,sk :1:-1),(/ si*sj/lonstep,sk /))
+ reliq = reshape(reff_rad (1:si:lonstep,:,sk :1:-1),(/ si*sj/lonstep,sk /)) !already in microns
+ reice = 10*ones !Ice particle radii not used as iceflglw=0 meaning it is inactive. Setting to fill value of zeros
else
cldfr = zeros
- reliq = 10*ones
- reice = 10*ones
+ reliq = 10*ones ! not requires to be 10 microns but assumed a valid number
+ reice = 10*ones ! needs to be 10 microns
endif
-
-
+ tmp1 = maxval(reff_rad)
+ tmp2 = maxval(cf_rad)
if(include_secondary_gases)then
call rrtmg_sw &
diff --git a/src/atmos_spectral/driver/solo/idealized_moist_phys.F90 b/src/atmos_spectral/driver/solo/idealized_moist_phys.F90
index ca7783407..07d9191f8 100644
--- a/src/atmos_spectral/driver/solo/idealized_moist_phys.F90
+++ b/src/atmos_spectral/driver/solo/idealized_moist_phys.F90
@@ -348,7 +348,7 @@ subroutine idealized_moist_phys_init(Time, Time_step_in, nhum, rad_lon_2d, rad_l
d378 = 1.-d622
if(do_cloud_simple) then
- call cloud_simple_init()
+ call cloud_simple_init(get_axis_id(), Time)
end if
!s need to make sure that gray radiation and rrtm radiation are not both called.
@@ -801,7 +801,7 @@ subroutine idealized_moist_phys(Time, p_half, p_full, z_half, z_full, ug, vg, tg
real, dimension(size(ug,1), size(ug,2), size(ug,3)) :: tg_tmp, qg_tmp, RH,tg_interp, mc, dt_ug_conv, dt_vg_conv
! Simple cloud scheme variabilies to pass to radiation
-real, dimension(size(ug,1), size(ug,2), size(ug,3)) :: cfa_rad, reff_rad
+real, dimension(size(ug,1), size(ug,2), size(ug,3)) :: cf_rad, reff_rad, qcl_rad
real, intent(in) , dimension(:,:,:), optional :: mask
integer, intent(in) , dimension(:,:), optional :: kbot
@@ -809,6 +809,8 @@ subroutine idealized_moist_phys(Time, p_half, p_full, z_half, z_full, ug, vg, tg
real, dimension(1,1,1):: tracer, tracertnd
integer :: nql, nqi, nqa ! tracer indices for stratiform clouds
+real :: tmp1, tmp2 !remove tmp1 and tmp2 after debugging
+
if(current == previous) then
delta_t = dt_real
else
@@ -975,11 +977,14 @@ subroutine idealized_moist_phys(Time, p_half, p_full, z_half, z_full, ug, vg, tg
tg(:,:,:,previous), &
grid_tracers(:,:,:,previous,nsphum), &
! outs -
- cfa_rad(:,:,:), reff_rad(:,:,:) &
+ cf_rad(:,:,:), reff_rad(:,:,:), &
+ qcl_rad(:,:,:) &
)
-
+
endif
+tmp1 = maxval(reff_rad)
+tmp2 = maxval(cf_rad)
! Begin the radiation calculation by computing downward fluxes.
! This part of the calculation does not depend on the surface temperature.
@@ -1106,7 +1111,7 @@ subroutine idealized_moist_phys(Time, p_half, p_full, z_half, z_full, ug, vg, tg
call interp_temp(z_full(:,:,:,current),z_half(:,:,:,current),tg_interp, Time)
call run_rrtmg(is,js,Time,rad_lat(:,:),rad_lon(:,:),p_full(:,:,:,current),p_half(:,:,:,current), &
albedo,grid_tracers(:,:,:,previous,nsphum),tg_interp,t_surf(:,:),dt_tg(:,:,:), &
- coszen,net_surf_sw_down(:,:),surf_lw_down(:,:), cfa_rad(:,:,:), reff_rad(:,:,:), &
+ coszen,net_surf_sw_down(:,:),surf_lw_down(:,:), cf_rad(:,:,:), reff_rad(:,:,:), &
do_cloud_simple )
endif
#endif
From 090508b686ecd9312940f76fbc230d2ce35e4ded Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Thu, 6 Sep 2018 12:25:51 +0100
Subject: [PATCH 044/304] Previous commit did not have all files: attempting to
debug why cloud fraction is not passed out of the simple cloud scheme
---
exp/test_cases/MiMA/MiMA_test_case.py | 19 +-
.../MiMA/MiMA_test_case_no_cloud.py | 191 ++++++++++++++++++
2 files changed, 203 insertions(+), 7 deletions(-)
create mode 100644 exp/test_cases/MiMA/MiMA_test_case_no_cloud.py
diff --git a/exp/test_cases/MiMA/MiMA_test_case.py b/exp/test_cases/MiMA/MiMA_test_case.py
index 61472cc25..06ab56cf5 100644
--- a/exp/test_cases/MiMA/MiMA_test_case.py
+++ b/exp/test_cases/MiMA/MiMA_test_case.py
@@ -4,7 +4,7 @@
from isca import IscaCodeBase, DiagTable, Experiment, Namelist, GFDL_BASE
-NCORES = 16
+NCORES = 1
# a CodeBase can be a directory on the computer,
# useful for iterative development
@@ -19,7 +19,7 @@
# is used to load the correct compilers. The env file is always loaded from
# $GFDL_BASE and not the checked out git repo.
-cb.compile() # compile the source code to working directory $GFDL_WORK/codebase
+cb.compile(debug=True) # compile the source code to working directory $GFDL_WORK/codebase
# create an Experiment object to handle the configuration of model parameters
# and output diagnostics
@@ -43,6 +43,11 @@
diag.add_field('dynamics', 'temp', time_avg=True)
diag.add_field('dynamics', 'vor', time_avg=True)
diag.add_field('dynamics', 'div', time_avg=True)
+diag.add_field('cloud_simple', 'cf_rad', time_avg=True)
+diag.add_field('cloud_simple', 'reff_rad', time_avg=True)
+diag.add_field('cloud_simple', 'frac_liq', time_avg=True)
+diag.add_field('cloud_simple', 'qcl_rad', time_avg=True)
+diag.add_field('rrtm_radiation', 'olr', time_avg=True)
exp.diag_table = diag
@@ -138,7 +143,7 @@
'damping_driver_nml': {
'do_rayleigh': True,
'trayfric': -0.5, # neg. value: time in *days*
- 'sponge_pbottom': 50.,
+ 'sponge_pbottom': 150.,
'do_conserve_energy': True,
},
@@ -175,7 +180,7 @@
'valid_range_t':[100.,800.],
'initial_sphum':[2.e-6],
'vert_coord_option':'uneven_sigma',
- 'surf_res':0.5,
+ 'surf_res':0.2,
'scale_heights' : 11.0,
'exponent':7.0,
'robert_coeff':0.03
@@ -185,6 +190,6 @@
})
#Lets do a run!
if __name__=="__main__":
- exp.run(1, use_restart=False, num_cores=NCORES)
- for i in range(2,25):
- exp.run(i, num_cores=NCORES)
+ exp.run(1, use_restart=False, num_cores=NCORES, overwrite_data=True, run_idb=True)
+ # for i in range(2,25):
+ # exp.run(i, num_cores=NCORES, overwrite_data=True)
diff --git a/exp/test_cases/MiMA/MiMA_test_case_no_cloud.py b/exp/test_cases/MiMA/MiMA_test_case_no_cloud.py
new file mode 100644
index 000000000..645a589ea
--- /dev/null
+++ b/exp/test_cases/MiMA/MiMA_test_case_no_cloud.py
@@ -0,0 +1,191 @@
+import os
+
+import numpy as np
+
+from isca import IscaCodeBase, DiagTable, Experiment, Namelist, GFDL_BASE
+
+NCORES = 16
+
+# a CodeBase can be a directory on the computer,
+# useful for iterative development
+cb = IscaCodeBase.from_directory(GFDL_BASE)
+
+# or it can point to a specific git repo and commit id.
+# This method should ensure future, independent, reproducibility of results.
+# cb = DryCodeBase.from_repo(repo='https://github.com/isca/isca', commit='isca1.1')
+
+# compilation depends on computer specific settings. The $GFDL_ENV
+# environment variable is used to determine which `$GFDL_BASE/src/extra/env` file
+# is used to load the correct compilers. The env file is always loaded from
+# $GFDL_BASE and not the checked out git repo.
+
+cb.compile() # compile the source code to working directory $GFDL_WORK/codebase
+
+# create an Experiment object to handle the configuration of model parameters
+# and output diagnostics
+exp = Experiment('mima_test_experiment_no_cloud', codebase=cb)
+
+exp.inputfiles = [os.path.join(GFDL_BASE,'input/rrtm_input_files/ozone_1990.nc')]
+
+#Tell model how to write diagnostics
+diag = DiagTable()
+diag.add_file('atmos_monthly', 30, 'days', time_units='days')
+
+#Tell model which diagnostics to write
+diag.add_field('dynamics', 'ps', time_avg=True)
+diag.add_field('dynamics', 'bk')
+diag.add_field('dynamics', 'pk')
+diag.add_field('atmosphere', 'precipitation', time_avg=True)
+diag.add_field('mixed_layer', 't_surf', time_avg=True)
+diag.add_field('dynamics', 'sphum', time_avg=True)
+diag.add_field('dynamics', 'ucomp', time_avg=True)
+diag.add_field('dynamics', 'vcomp', time_avg=True)
+diag.add_field('dynamics', 'temp', time_avg=True)
+diag.add_field('dynamics', 'vor', time_avg=True)
+diag.add_field('dynamics', 'div', time_avg=True)
+diag.add_field('rrtm_radiation', 'olr', time_avg=True)
+
+exp.diag_table = diag
+
+
+#Empty the run directory ready to run
+exp.clear_rundir()
+
+#Define values for the 'core' namelist
+exp.namelist = namelist = Namelist({
+ 'main_nml': {
+ 'days' : 30,
+ 'hours' : 0,
+ 'minutes': 0,
+ 'seconds': 0,
+ 'dt_atmos':600,
+ 'current_date' : [1,1,1,0,0,0],
+ 'calendar' : 'thirty_day'
+ },
+
+ 'idealized_moist_phys_nml': {
+ 'two_stream_gray': False,
+ 'do_rrtm_radiation': True, #Use RRTM radiation, not grey
+ 'convection_scheme': 'SIMPLE_BETTS_MILLER', #Use the simple Betts Miller convection scheme
+ 'do_damping': True,
+ 'turb':True,
+ 'mixed_layer_bc':True,
+ 'do_virtual' :False,
+ 'do_simple': True,
+ 'roughness_mom':3.21e-05,
+ 'roughness_heat':3.21e-05,
+ 'roughness_moist':3.21e-05,
+ 'do_cloud_simple': False,
+ },
+ 'cloud_simple_nml': {
+ 'simple_cca':0.0,
+ 'rhcsfc': 0.95,
+ 'rhc700': 0.7,
+ 'rhc200': 0.3,
+ 'rhmsfc': 0.95,
+ 'rhm700': 0.7,
+ 'rhm200': 0.3,
+ },
+
+ 'vert_turb_driver_nml': {
+ 'do_mellor_yamada': False, # default: True
+ 'do_diffusivity': True, # default: False
+ 'do_simple': True, # default: False
+ 'constant_gust': 0.0, # default: 1.0
+ 'use_tau': False
+ },
+
+ 'diffusivity_nml': {
+ 'do_entrain':False,
+ 'do_simple': True,
+ },
+
+ 'surface_flux_nml': {
+ 'use_virtual_temp': False,
+ 'do_simple': True,
+ 'old_dtaudv': True
+ },
+
+ 'atmosphere_nml': {
+ 'idealized_moist_model': True
+ },
+
+ #Use a large mixed-layer depth, and the Albedo of the CTRL case in Jucker & Gerber, 2017
+ 'mixed_layer_nml': {
+ 'depth': 100,
+ 'albedo_value': 0.205,
+ 'tconst' : 285.,
+ 'prescribe_initial_dist':True,
+ 'evaporation':True,
+ 'do_qflux': True
+ },
+
+ 'qe_moist_convection_nml': {
+ 'rhbm':0.7,
+ 'Tmin':160.,
+ 'Tmax':350.
+ },
+
+ 'lscale_cond_nml': {
+ 'do_simple':True,
+ 'do_evap':True
+ },
+
+ 'sat_vapor_pres_nml': {
+ 'do_simple':True,
+ 'construct_table_wrt_liq_and_ice':True
+ },
+
+ 'damping_driver_nml': {
+ 'do_rayleigh': True,
+ 'trayfric': -0.5, # neg. value: time in *days*
+ 'sponge_pbottom': 150.,
+ 'do_conserve_energy': True,
+ },
+
+ 'qflux_nml': {
+ 'qflux_amp': 30.0
+ },
+
+ 'rrtm_radiation_nml': {
+ 'solr_cnst': 1360, #s set solar constant to 1360, rather than default of 1368.22
+ 'dt_rad': 7200, #Use long RRTM timestep
+ 'do_read_ozone':True,
+ 'ozone_file':'ozone_1990'
+ },
+
+ # FMS Framework configuration
+ 'diag_manager_nml': {
+ 'mix_snapshot_average_fields': False # time avg fields are labelled with time in middle of window
+ },
+
+ 'fms_nml': {
+ 'domains_stack_size': 600000 # default: 0
+ },
+
+ 'fms_io_nml': {
+ 'threading_write': 'single', # default: multi
+ 'fileset_write': 'single', # default: multi
+ },
+
+ 'spectral_dynamics_nml': {
+ 'damping_order': 4,
+ 'water_correction_limit': 200.e2,
+ 'reference_sea_level_press':1.0e5,
+ 'num_levels':40,
+ 'valid_range_t':[100.,800.],
+ 'initial_sphum':[2.e-6],
+ 'vert_coord_option':'uneven_sigma',
+ 'surf_res':0.2,
+ 'scale_heights' : 11.0,
+ 'exponent':7.0,
+ 'robert_coeff':0.03
+ }
+
+
+})
+#Lets do a run!
+if __name__=="__main__":
+ exp.run(1, use_restart=False, num_cores=NCORES, overwrite_data=True)
+ for i in range(2,25):
+ exp.run(i, num_cores=NCORES, overwrite_data=True)
From 914e6eb7eef1172a2ade294d6ad72761dd9938c5 Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Thu, 6 Sep 2018 16:27:53 +0100
Subject: [PATCH 045/304] Swapped to using mcica sw routine and added required
initialisation routine. Seems to run. Now swapping to lw mcica.
---
exp/test_cases/MiMA/MiMA_test_case.py | 9 +-
.../rrtm_radiation/rrtm_radiation.f90 | 98 +++++++++++++------
src/extra/model/isca/path_names | 2 +-
3 files changed, 74 insertions(+), 35 deletions(-)
diff --git a/exp/test_cases/MiMA/MiMA_test_case.py b/exp/test_cases/MiMA/MiMA_test_case.py
index 06ab56cf5..aef6b0ab6 100644
--- a/exp/test_cases/MiMA/MiMA_test_case.py
+++ b/exp/test_cases/MiMA/MiMA_test_case.py
@@ -4,7 +4,7 @@
from isca import IscaCodeBase, DiagTable, Experiment, Namelist, GFDL_BASE
-NCORES = 1
+NCORES = 16
# a CodeBase can be a directory on the computer,
# useful for iterative development
@@ -19,7 +19,7 @@
# is used to load the correct compilers. The env file is always loaded from
# $GFDL_BASE and not the checked out git repo.
-cb.compile(debug=True) # compile the source code to working directory $GFDL_WORK/codebase
+cb.compile()#debug=True) # compile the source code to working directory $GFDL_WORK/codebase
# create an Experiment object to handle the configuration of model parameters
# and output diagnostics
@@ -155,7 +155,8 @@
'solr_cnst': 1360, #s set solar constant to 1360, rather than default of 1368.22
'dt_rad': 7200, #Use long RRTM timestep
'do_read_ozone':True,
- 'ozone_file':'ozone_1990'
+ 'ozone_file':'ozone_1990',
+ 'icld': 1 #cloud overlap method
},
# FMS Framework configuration
@@ -190,6 +191,6 @@
})
#Lets do a run!
if __name__=="__main__":
- exp.run(1, use_restart=False, num_cores=NCORES, overwrite_data=True, run_idb=True)
+ exp.run(1, use_restart=False, num_cores=NCORES, overwrite_data=True)#, run_idb=True)
# for i in range(2,25):
# exp.run(i, num_cores=NCORES, overwrite_data=True)
diff --git a/src/atmos_param/rrtm_radiation/rrtm_radiation.f90 b/src/atmos_param/rrtm_radiation/rrtm_radiation.f90
index dc9e9ab3a..351efeff8 100644
--- a/src/atmos_param/rrtm_radiation/rrtm_radiation.f90
+++ b/src/atmos_param/rrtm_radiation/rrtm_radiation.f90
@@ -54,9 +54,10 @@ module rrtm_vars
! dimension (ncols_rrt x nlay_rrt)
real(kind=rb),allocatable,dimension(:,:) :: co2 ! CO2 [vmr]
! dimension (ncols_rrt x nlay_rrt)
- real(kind=rb),allocatable,dimension(:,:) :: zeros ! place holder for any species set
+ real(kind=rb),allocatable,dimension(:,:,:) :: zeros ! place holder for any species set
+ ! to zero
+ real(kind=rb),allocatable,dimension(:,:,:) :: ones ! place holder for any species set
! to zero
- real(kind=rb),allocatable,dimension(:,:) :: ones ! place holder for secondary species
! the following species are only set if use_secondary_gases=.true.
real(kind=rb),allocatable,dimension(:,:) :: ch4 ! CH4 [vmr]
! dimension (ncols_rrt x nlay_rrt)
@@ -102,7 +103,7 @@ module rrtm_vars
! some constants
real(kind=rb) :: daypersec=1./86400.,deg2rad !RG: daypersec=1./86400. left in when conversion to non-specific day length made as this only converts heatrates from RRTM from K/day to K/sec
! no clouds in the radiative scheme
- integer(kind=im) :: icld=0,idrv=0, &
+ integer(kind=im) :: idrv=0, &
inflglw=0,iceflglw=0,liqflglw=0, &
iaer=0
!---------------------------------------------------------------------------------------------------------------
@@ -188,6 +189,9 @@ module rrtm_vars
! day of the year = solday \in [0,days per year]
real(kind=rb) :: equinox_day=0.75 ! fraction of the year defining NH autumn equinox \in [0,1]
real(kind=rb) :: solr_cnst= 1368.22 ! solar constant [W/m2]
+
+ integer(kind=im) :: icld=0 ! Cloud overlap method
+
!-------------------------------------------------s--------------------------------------------------------------
!
!-------------------- diagnostics fields -------------------------------
@@ -210,14 +214,17 @@ module rrtm_vars
&lonstep, do_zm_tracers, do_zm_rad, &
&do_precip_albedo, precip_albedo_mode, precip_albedo, precip_lat,&
&do_read_co2, co2_file, co2_variable_name, use_dyofyr, solrad, &
- &solday, equinox_day,solr_cnst
+ &solday, equinox_day,solr_cnst, icld
end module rrtm_vars
!*****************************************************************************************
!*****************************************************************************************
module rrtm_radiation
- use parkind, only : im => kind_im, rb => kind_rb
- use constants_mod, only: pi, wtmozone, wtmh2o, gas_constant, rdgas
+ use parkind, only : im => kind_im, rb => kind_rb
+ use constants_mod, only: pi, wtmozone, wtmh2o, gas_constant, rdgas
+ use parrrtm, only: nbndlw
+ use parrrsw, only: nbndsw, ngptsw
+
implicit none
contains
@@ -230,8 +237,6 @@ subroutine rrtm_radiation_init(axes,Time,ncols,nlay,lonb,latb, Time_step)
! Modules
use rrtm_vars
use astronomy_mod, only: astronomy_init
- use parrrtm, only: nbndlw
- use parrrsw, only: nbndsw
use diag_manager_mod, only: register_diag_field, send_data
use interpolator_mod, only: interpolate_type, interpolator_init, &
&CONSTANT, ZERO,INTERP_WEIGHTED_P
@@ -405,8 +410,8 @@ subroutine rrtm_radiation_init(axes,Time,ncols,nlay,lonb,latb, Time_step)
if(.not. do_read_radiation .or. .not. do_read_sw_flux .and. .not. do_read_lw_flux)then
allocate(h2o(ncols_rrt,nlay_rrt),o3(ncols_rrt,nlay_rrt), &
co2(ncols_rrt,nlay_rrt))
- allocate(ones(ncols_rrt,nlay_rrt), &
- zeros(ncols_rrt,nlay_rrt))
+ allocate(ones(ngptsw,ncols_rrt,nlay_rrt), &
+ zeros(ngptsw,ncols_rrt,nlay_rrt))
allocate(emis(ncols_rrt,nbndlw))
allocate(taucld(nbndlw,ncols_rrt,nlay_rrt), &
tauaer(ncols_rrt,nlay_rrt,nbndlw))
@@ -544,7 +549,7 @@ subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half, &
use fms_mod, only: error_mesg, FATAL
use mpp_mod, only: mpp_pe,mpp_root_pe
use rrtmg_lw_rad, only: rrtmg_lw
- use rrtmg_sw_rad, only: rrtmg_sw
+ use rrtmg_sw_rad, only: rrtmg_sw, mcica_subcol_sw
use astronomy_mod, only: diurnal_solar
use rrtm_vars
use time_manager_mod,only: time_type,get_time,set_time, length_of_year, length_of_day
@@ -591,8 +596,13 @@ subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half, &
integer si,sj,sk,locmin(3)
real(kind=rb),dimension(size(q,1),size(q,2),size(q,3)) :: o3f
real(kind=rb),dimension(size(q,1),size(q,2),size(q,3)) :: co2f,co2f_temp
+
real(kind=rb),dimension(ncols_rrt,nlay_rrt) :: pfull,tfull,fracday&
, hr,hrc, swhr, swhrc, cldfr, reliq, reice
+
+
+ real(kind=rb),dimension(ngptsw,ncols_rrt,nlay_rrt) :: cldfr_pass
+
real(kind=rb),dimension(size(tdt,1),size(tdt,2),size(tdt,3)) :: tdt_rrtm
real(kind=rb),dimension(ncols_rrt,nlay_rrt+1) :: uflx, dflx, uflxc, dflxc&
,swuflx, swdflx, swuflxc, swdflxc
@@ -610,11 +620,16 @@ subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half, &
integer :: year_in_s
real :: r_seconds, r_days, r_total_seconds, frac_of_day, frac_of_year, gmt, time_since_ae, rrsun, dt_rad_radians, day_in_s, r_solday, r_dt_rad_avg
+ !mcica variables
+ integer :: permuteseed, irng
+ real(kind=rb),dimension(ncols_rrt,nlay_rrt) :: reicmcl, relqmcl
+
+ real(kind=rb),dimension(ngptsw, ncols_rrt,nlay_rrt) :: cldfmcl, ciwpmcl, clwpmcl, taucmcl, ssacmcl, asmcmcl, fsfcmcl
! debug
real :: tmp1, tmp2 !remove tmp1 and tmp2 after debugging
- integer :: indx2(2),indx(3),ii,ji,ki
+ integer :: indx2(2),indx(3),ii,ji,ki, pt1,pt2
logical :: used
!---------------------------------------------------------------------------------------------------------------
@@ -838,31 +853,54 @@ subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half, &
! where(cosz_rr < 1.e-2)cosz_rr=0.
if (do_cloud_simple) then
+ pt1 = 1
+ pt2 = ngptsw
inflglw = 2 !RRTM responsible for calculating optical properties of clouds
liqflglw = 1 !Sets liquid water radii to be used rather than being inactive (zero is inactive)
cldfr = reshape( cf_rad (1:si:lonstep,:,sk :1:-1),(/ si*sj/lonstep,sk /))
reliq = reshape(reff_rad (1:si:lonstep,:,sk :1:-1),(/ si*sj/lonstep,sk /)) !already in microns
- reice = 10*ones !Ice particle radii not used as iceflglw=0 meaning it is inactive. Setting to fill value of zeros
+ reice = 10*ones(pt1,:,:) !Ice particle radii not used as iceflglw=0 meaning it is inactive. Setting to fill value of zeros
else
- cldfr = zeros
- reliq = 10*ones ! not requires to be 10 microns but assumed a valid number
- reice = 10*ones ! needs to be 10 microns
+ pt1 = 1
+ pt2 = 1
+ cldfr = zeros(pt1,:,:)
+ reliq = 10*ones(pt1,:,:) ! not requires to be 10 microns but assumed a valid number
+ reice = 10*ones(pt1,:,:) ! needs to be 10 microns
+ cldfr_pass(pt1,:,:) = cldfr
endif
- tmp1 = maxval(reff_rad)
- tmp2 = maxval(cf_rad)
+
+
+ if (do_cloud_simple) then
+ !need to run monty carlo independent column approcimation (mcica)
+ permuteseed = 1
+ irng = 1 !use a random number gerator either 0 (Kissvec) or 1(Mersenne Twister)
+
+ call mcica_subcol_sw(0, ncols_rrt, nlay_rrt, icld, permuteseed, irng, pfull, &
+ cldfr, zeros(pt1,:,:), zeros(pt1,:,:), reice, reliq, tauaer, zro_sw, zro_sw, zro_sw , &
+ !outs
+ cldfmcl, ciwpmcl, clwpmcl, reicmcl, relqmcl, taucmcl, ssacmcl, asmcmcl, fsfcmcl)
+
+ permuteseed = 2
+ cldfr_pass = cldfmcl
+ reice = reicmcl
+ reliq = relqmcl
+ taucld = taucmcl
+ !other vars not needed
+ endif
+
if(include_secondary_gases)then
call rrtmg_sw &
(ncols_rrt, nlay_rrt , icld , iaer , &
pfull , phalf , tfull , thalf , tsrf , &
- h2o , o3 , co2 , ch4_val*ones , n2o_val*ones , o2_val*ones , &
+ h2o , o3 , co2 , ch4_val*ones(pt1,:,:) , n2o_val*ones(pt1,:,:) , o2_val*ones(pt1,:,:) , &
albedo_rr , albedo_rr, albedo_rr, albedo_rr, &
cosz_rr , solrad , dyofyr , solr_cnst, &
inflglw , iceflglw , liqflglw , &
! cloud parameters
- cldfr, &
+ cldfr_pass(pt1:pt2,:,:), &
taucld , sw_zro , sw_zro , sw_zro , &
- zeros , zeros , reice , reliq , &
+ zeros(pt1:pt2,:,:) , zeros(pt1:pt2,:,:) , reice , reliq , &
tauaer , zro_sw , zro_sw , zro_sw , &
! output
swuflx , swdflx , swhr , swuflxc , swdflxc, swhrc)
@@ -870,14 +908,14 @@ subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half, &
call rrtmg_sw &
(ncols_rrt, nlay_rrt , icld , iaer , &
pfull , phalf , tfull , thalf , tsrf , &
- h2o , o3 , co2 , zeros , zeros, zeros, &
+ h2o , o3 , co2 , zeros(pt1,:,:) , zeros(pt1,:,:), zeros(pt1,:,:), &
albedo_rr , albedo_rr, albedo_rr, albedo_rr, &
cosz_rr , solrad , dyofyr , solr_cnst, &
inflglw , iceflglw , liqflglw , &
! cloud parameters
- cldfr, &
+ cldfr_pass(pt1:pt2,:,:), &
taucld , sw_zro , sw_zro , sw_zro , &
- zeros , zeros , reice , reliq , &
+ zeros(pt1:pt2,:,:) , zeros(pt1:pt2,:,:) , reice , reliq , &
tauaer , zro_sw , zro_sw , zro_sw , &
! output
swuflx , swdflx , swhr , swuflxc , swdflxc, swhrc)
@@ -904,12 +942,12 @@ subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half, &
pfull , phalf , tfull , thalf, tsrf , &
h2o , o3 , co2 , &
! secondary gases
- ch4_val*ones , n2o_val*ones , o2_val*ones , &
- cfc11_val*ones , cfc12_val*ones , cfc22_val*ones , ccl4_val*ones , &
+ ch4_val*ones(pt1,:,:) , n2o_val*ones(pt1,:,:) , o2_val*ones(pt1,:,:) , &
+ cfc11_val*ones(pt1,:,:) , cfc12_val*ones(pt1,:,:) , cfc22_val*ones(pt1,:,:) , ccl4_val*ones(pt1,:,:) , &
! emissivity and cloud composition
emis , inflglw , iceflglw , liqflglw , &
! cloud parameters
- cldfr , taucld , zeros , zeros , reice, reliq, &
+ cldfr_pass(pt1,:,:) , taucld , zeros(pt1,:,:) , zeros(pt1,:,:) , reice, reliq, &
tauaer , &
! output
uflx , dflx , hr , uflxc , dflxc , hrc)
@@ -917,12 +955,12 @@ subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half, &
call rrtmg_lw &
(ncols_rrt, nlay_rrt, icld , idrv , &
pfull , phalf , tfull , thalf, tsrf , &
- h2o , o3 , co2 , zeros, zeros, zeros, &
- zeros , zeros , zeros , zeros, &
+ h2o , o3 , co2 , zeros(pt1,:,:), zeros(pt1,:,:), zeros(pt1,:,:), &
+ zeros(pt1,:,:) , zeros(pt1,:,:) , zeros(pt1,:,:) , zeros(pt1,:,:), &
! emissivity and cloud composition
emis , inflglw , iceflglw, liqflglw, &
! cloud parameters
- cldfr , taucld , zeros , zeros, reice, reliq, &
+ cldfr_pass(pt1,:,:) , taucld , zeros(pt1,:,:) , zeros(pt1,:,:), reice, reliq, &
tauaer , &
! output
uflx , dflx , hr , uflxc, dflxc , hrc)
diff --git a/src/extra/model/isca/path_names b/src/extra/model/isca/path_names
index eebdfd2b0..3ffc0f449 100644
--- a/src/extra/model/isca/path_names
+++ b/src/extra/model/isca/path_names
@@ -83,7 +83,7 @@ atmos_param/rrtm_radiation/rrtmg_sw/gcm_model/modules/rrsw_vsn.f90
atmos_param/rrtm_radiation/rrtmg_sw/gcm_model/modules/rrsw_wvn.f90
atmos_param/rrtm_radiation/rrtmg_sw/gcm_model/src/mcica_random_numbers.f90
atmos_param/rrtm_radiation/rrtmg_sw/gcm_model/src/mcica_subcol_gen_sw.f90
-atmos_param/rrtm_radiation/rrtmg_sw/gcm_model/src/rrtmg_sw_rad.nomcica.f90
+atmos_param/rrtm_radiation/rrtmg_sw/gcm_model/src/rrtmg_sw_rad.f90
atmos_param/rrtm_radiation/rrtmg_sw/gcm_model/src/rrtmg_sw_cldprop.f90
atmos_param/rrtm_radiation/rrtmg_sw/gcm_model/src/rrtmg_sw_cldprmc.f90
atmos_param/rrtm_radiation/rrtmg_sw/gcm_model/src/rrtmg_sw_init.f90
From e940801da785aafc38bdb8acb84dc243b5512060 Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Thu, 6 Sep 2018 17:03:52 +0100
Subject: [PATCH 046/304] Swapped to using mcica lw routine and added required
initialisation routine. Seems to run. Testing needed
---
exp/test_cases/MiMA/MiMA_test_case.py | 6 +-
.../rrtm_radiation/rrtm_radiation.f90 | 70 ++++++++++++-------
src/extra/model/isca/path_names | 2 +-
3 files changed, 49 insertions(+), 29 deletions(-)
diff --git a/exp/test_cases/MiMA/MiMA_test_case.py b/exp/test_cases/MiMA/MiMA_test_case.py
index aef6b0ab6..27dc00243 100644
--- a/exp/test_cases/MiMA/MiMA_test_case.py
+++ b/exp/test_cases/MiMA/MiMA_test_case.py
@@ -23,7 +23,7 @@
# create an Experiment object to handle the configuration of model parameters
# and output diagnostics
-exp = Experiment('mima_test_experiment', codebase=cb)
+exp = Experiment('mima_test_experiment_with_mcica', codebase=cb)
exp.inputfiles = [os.path.join(GFDL_BASE,'input/rrtm_input_files/ozone_1990.nc')]
@@ -192,5 +192,5 @@
#Lets do a run!
if __name__=="__main__":
exp.run(1, use_restart=False, num_cores=NCORES, overwrite_data=True)#, run_idb=True)
- # for i in range(2,25):
- # exp.run(i, num_cores=NCORES, overwrite_data=True)
+ for i in range(2,25):
+ exp.run(i, num_cores=NCORES, overwrite_data=True)
diff --git a/src/atmos_param/rrtm_radiation/rrtm_radiation.f90 b/src/atmos_param/rrtm_radiation/rrtm_radiation.f90
index 351efeff8..7ac0047f4 100644
--- a/src/atmos_param/rrtm_radiation/rrtm_radiation.f90
+++ b/src/atmos_param/rrtm_radiation/rrtm_radiation.f90
@@ -78,7 +78,7 @@ module rrtm_vars
! =1 for black body
! clouds stuff
! cloud & aerosol optical depths, cloud and aerosol specific parameters. Set to zero
- real(kind=rb),allocatable,dimension(:,:,:) :: taucld,tauaer, sw_zro, zro_sw
+ real(kind=rb),allocatable,dimension(:,:,:) :: taucld_lw, taucld_sw, tauaer_lw, tauaer_sw, sw_zro, zro_sw
! heating rates and fluxes, zenith angle when in-between radiation time steps
real(kind=rb),allocatable,dimension(:,:) :: sw_flux,lw_flux,zencos, olr, toa_sw! surface and TOA fluxes, cos(zenith angle)
! dimension (lon x lat)
@@ -222,7 +222,7 @@ end module rrtm_vars
module rrtm_radiation
use parkind, only : im => kind_im, rb => kind_rb
use constants_mod, only: pi, wtmozone, wtmh2o, gas_constant, rdgas
- use parrrtm, only: nbndlw
+ use parrrtm, only: nbndlw, ngptlw
use parrrsw, only: nbndsw, ngptsw
implicit none
@@ -413,8 +413,10 @@ subroutine rrtm_radiation_init(axes,Time,ncols,nlay,lonb,latb, Time_step)
allocate(ones(ngptsw,ncols_rrt,nlay_rrt), &
zeros(ngptsw,ncols_rrt,nlay_rrt))
allocate(emis(ncols_rrt,nbndlw))
- allocate(taucld(nbndlw,ncols_rrt,nlay_rrt), &
- tauaer(ncols_rrt,nlay_rrt,nbndlw))
+ allocate(taucld_lw(nbndlw,ncols_rrt,nlay_rrt), &
+ tauaer_lw(ncols_rrt,nlay_rrt,nbndlw))
+ allocate(taucld_sw(nbndsw,ncols_rrt,nlay_rrt), &
+ tauaer_sw(ncols_rrt,nlay_rrt,nbndsw))
allocate(sw_zro(nbndsw,ncols_rrt,nlay_rrt), &
zro_sw(ncols_rrt,nlay_rrt,nbndsw))
if(id_coszen > 0)allocate(zencos (size(lonb,1)-1,size(latb,2)-1))
@@ -429,8 +431,10 @@ subroutine rrtm_radiation_init(axes,Time,ncols,nlay,lonb,latb, Time_step)
emis = 1. !black body: 1.0
! absorption
- taucld = 0.
- tauaer = 0.
+ taucld_sw = 0.
+ tauaer_sw = 0.
+ taucld_lw = 0.
+ tauaer_lw = 0.
! clouds
sw_zro = 0.
zro_sw = 0.
@@ -548,7 +552,7 @@ subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half, &
! Modules
use fms_mod, only: error_mesg, FATAL
use mpp_mod, only: mpp_pe,mpp_root_pe
- use rrtmg_lw_rad, only: rrtmg_lw
+ use rrtmg_lw_rad, only: rrtmg_lw, mcica_subcol_lw
use rrtmg_sw_rad, only: rrtmg_sw, mcica_subcol_sw
use astronomy_mod, only: diurnal_solar
use rrtm_vars
@@ -601,7 +605,8 @@ subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half, &
, hr,hrc, swhr, swhrc, cldfr, reliq, reice
- real(kind=rb),dimension(ngptsw,ncols_rrt,nlay_rrt) :: cldfr_pass
+ real(kind=rb),dimension(ngptsw,ncols_rrt,nlay_rrt) :: cldfr_pass_sw
+ real(kind=rb),dimension(ngptlw,ncols_rrt,nlay_rrt) :: cldfr_pass_lw
real(kind=rb),dimension(size(tdt,1),size(tdt,2),size(tdt,3)) :: tdt_rrtm
real(kind=rb),dimension(ncols_rrt,nlay_rrt+1) :: uflx, dflx, uflxc, dflxc&
@@ -624,7 +629,9 @@ subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half, &
integer :: permuteseed, irng
real(kind=rb),dimension(ncols_rrt,nlay_rrt) :: reicmcl, relqmcl
- real(kind=rb),dimension(ngptsw, ncols_rrt,nlay_rrt) :: cldfmcl, ciwpmcl, clwpmcl, taucmcl, ssacmcl, asmcmcl, fsfcmcl
+ real(kind=rb),dimension(ngptsw, ncols_rrt,nlay_rrt) :: cldfmcl_sw, ciwpmcl_sw, clwpmcl_sw, taucmcl_sw, ssacmcl, asmcmcl, fsfcmcl
+
+ real(kind=rb),dimension(ngptlw, ncols_rrt,nlay_rrt) :: cldfmcl_lw, ciwpmcl_lw, clwpmcl_lw, taucmcl_lw
! debug
real :: tmp1, tmp2 !remove tmp1 and tmp2 after debugging
@@ -866,7 +873,7 @@ subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half, &
cldfr = zeros(pt1,:,:)
reliq = 10*ones(pt1,:,:) ! not requires to be 10 microns but assumed a valid number
reice = 10*ones(pt1,:,:) ! needs to be 10 microns
- cldfr_pass(pt1,:,:) = cldfr
+ cldfr_pass_sw(pt1,:,:) = cldfr
endif
@@ -876,15 +883,14 @@ subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half, &
irng = 1 !use a random number gerator either 0 (Kissvec) or 1(Mersenne Twister)
call mcica_subcol_sw(0, ncols_rrt, nlay_rrt, icld, permuteseed, irng, pfull, &
- cldfr, zeros(pt1,:,:), zeros(pt1,:,:), reice, reliq, tauaer, zro_sw, zro_sw, zro_sw , &
+ cldfr, zeros(pt1,:,:), zeros(pt1,:,:), reice, reliq, tauaer_sw, zro_sw, zro_sw, zro_sw , &
!outs
- cldfmcl, ciwpmcl, clwpmcl, reicmcl, relqmcl, taucmcl, ssacmcl, asmcmcl, fsfcmcl)
+ cldfmcl_sw, ciwpmcl_sw, clwpmcl_sw, reicmcl, relqmcl, taucmcl_sw, ssacmcl, asmcmcl, fsfcmcl)
- permuteseed = 2
- cldfr_pass = cldfmcl
+ cldfr_pass_sw = cldfmcl_sw
reice = reicmcl
reliq = relqmcl
- taucld = taucmcl
+ taucld_sw = taucmcl_sw
!other vars not needed
endif
@@ -898,10 +904,10 @@ subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half, &
cosz_rr , solrad , dyofyr , solr_cnst, &
inflglw , iceflglw , liqflglw , &
! cloud parameters
- cldfr_pass(pt1:pt2,:,:), &
- taucld , sw_zro , sw_zro , sw_zro , &
+ cldfr_pass_sw(pt1:pt2,:,:), &
+ taucld_sw , sw_zro , sw_zro , sw_zro , &
zeros(pt1:pt2,:,:) , zeros(pt1:pt2,:,:) , reice , reliq , &
- tauaer , zro_sw , zro_sw , zro_sw , &
+ tauaer_sw , zro_sw , zro_sw , zro_sw , &
! output
swuflx , swdflx , swhr , swuflxc , swdflxc, swhrc)
else
@@ -913,10 +919,10 @@ subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half, &
cosz_rr , solrad , dyofyr , solr_cnst, &
inflglw , iceflglw , liqflglw , &
! cloud parameters
- cldfr_pass(pt1:pt2,:,:), &
- taucld , sw_zro , sw_zro , sw_zro , &
+ cldfr_pass_sw(pt1:pt2,:,:), &
+ taucld_sw , sw_zro , sw_zro , sw_zro , &
zeros(pt1:pt2,:,:) , zeros(pt1:pt2,:,:) , reice , reliq , &
- tauaer , zro_sw , zro_sw , zro_sw , &
+ tauaer_sw , zro_sw , zro_sw , zro_sw , &
! output
swuflx , swdflx , swhr , swuflxc , swdflxc, swhrc)
endif
@@ -930,6 +936,20 @@ subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half, &
! swhr (:,i) = 0.
! endwhere
! enddo
+
+ if(do_cloud_simple) then
+
+ permuteseed = 2
+
+ call mcica_subcol_lw(0, ncols_rrt, nlay_rrt, icld, permuteseed, irng, pfull, &
+ cldfr, zeros(pt1,:,:), zeros(pt1,:,:), reice, reliq, tauaer_lw, &
+ cldfmcl_lw, ciwpmcl_lw, clwpmcl_lw, reicmcl, relqmcl, taucmcl_lw)
+ cldfr_pass_lw = cldfmcl_lw
+ reice = reicmcl
+ reliq = relqmcl
+ taucld_lw = taucmcl_lw
+ endif
+
swijk = reshape(swhr(:,sk:1:-1),(/ si/lonstep,sj,sk /))*daypersec
@@ -947,8 +967,8 @@ subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half, &
! emissivity and cloud composition
emis , inflglw , iceflglw , liqflglw , &
! cloud parameters
- cldfr_pass(pt1,:,:) , taucld , zeros(pt1,:,:) , zeros(pt1,:,:) , reice, reliq, &
- tauaer , &
+ cldfr_pass_lw(pt1:pt2,:,:) , taucld_lw , zeros(pt1:pt2,:,:) , zeros(pt1:pt2,:,:) , reice, reliq, &
+ tauaer_lw , &
! output
uflx , dflx , hr , uflxc , dflxc , hrc)
else
@@ -960,8 +980,8 @@ subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half, &
! emissivity and cloud composition
emis , inflglw , iceflglw, liqflglw, &
! cloud parameters
- cldfr_pass(pt1,:,:) , taucld , zeros(pt1,:,:) , zeros(pt1,:,:), reice, reliq, &
- tauaer , &
+ cldfr_pass_lw(pt1:pt2,:,:) , taucld_lw , zeros(pt1:pt2,:,:) , zeros(pt1:pt2,:,:), reice, reliq, &
+ tauaer_lw , &
! output
uflx , dflx , hr , uflxc, dflxc , hrc)
endif
diff --git a/src/extra/model/isca/path_names b/src/extra/model/isca/path_names
index 3ffc0f449..c147c0ba3 100644
--- a/src/extra/model/isca/path_names
+++ b/src/extra/model/isca/path_names
@@ -47,7 +47,7 @@ atmos_param/rrtm_radiation/rrtmg_lw/gcm_model/modules/rrlw_wvn.f90
atmos_param/rrtm_radiation/rrtm_radiation.f90
atmos_param/rrtm_radiation/rrtmg_lw/gcm_model/src/mcica_random_numbers.f90
atmos_param/rrtm_radiation/rrtmg_lw/gcm_model/src/rrtmg_lw_cldprop.f90
-atmos_param/rrtm_radiation/rrtmg_lw/gcm_model/src/rrtmg_lw_rad.nomcica.f90
+atmos_param/rrtm_radiation/rrtmg_lw/gcm_model/src/rrtmg_lw_rad.f90
atmos_param/rrtm_radiation/rrtmg_lw/gcm_model/src/rrtmg_lw_rtrn.f90
atmos_param/rrtm_radiation/rrtmg_lw/gcm_model/src/rrtmg_lw_setcoef.f90
atmos_param/rrtm_radiation/rrtmg_lw/gcm_model/src/mcica_subcol_gen_lw.f90
From 0d8c61dcb71b92f7a7736c40fc1928ec6f55ec1f Mon Sep 17 00:00:00 2001
From: sit23
Date: Fri, 7 Sep 2018 11:39:35 +0100
Subject: [PATCH 047/304] New socrates set cld file downloaded from LFRic James
Manners branch
main/branches/dev/jamesmanners/um11.1_solar/src/interface_core/socrates_set_cld.F90
on 07-09-18.
---
.../socrates/interface/socrates_set_cld.F90 | 485 ++++++++++++++++++
1 file changed, 485 insertions(+)
create mode 100644 src/atmos_param/socrates/interface/socrates_set_cld.F90
diff --git a/src/atmos_param/socrates/interface/socrates_set_cld.F90 b/src/atmos_param/socrates/interface/socrates_set_cld.F90
new file mode 100644
index 000000000..25e47a340
--- /dev/null
+++ b/src/atmos_param/socrates/interface/socrates_set_cld.F90
@@ -0,0 +1,485 @@
+! *****************************COPYRIGHT*******************************
+! (C) Crown copyright Met Office. All rights reserved.
+! For further details please refer to the file COPYRIGHT.txt
+! which you should have received as part of this distribution.
+! *****************************COPYRIGHT*******************************
+!
+! Set the variables in the Socrates cloud type
+!
+!------------------------------------------------------------------------------
+module socrates_set_cld
+implicit none
+character(len=*), parameter, private :: ModuleName = 'SOCRATES_SET_CLD'
+contains
+
+subroutine set_cld(cld, control, dimen, spectrum, n_profile, n_layer, &
+ cloud_frac, conv_frac, &
+ liq_frac, ice_frac, liq_conv_frac, ice_conv_frac, &
+ liq_mmr, ice_mmr, liq_conv_mmr, ice_conv_mmr, &
+ liq_dim, ice_dim, liq_conv_dim, ice_conv_dim, &
+ dp_corr_strat, dp_corr_conv)
+
+use def_cld, only: StrCld, allocate_cld, allocate_cld_prsc
+use def_control, only: StrCtrl
+use def_dimen, only: StrDim
+use def_spectrum, only: StrSpecData
+use realtype_rd, only: RealK
+use rad_pcf, only: &
+ ip_cloud_homogen, ip_cloud_ice_water, ip_cloud_conv_strat, ip_cloud_csiw, &
+ ip_clcmp_st_water, ip_clcmp_st_ice, ip_clcmp_cnv_water, ip_clcmp_cnv_ice, &
+ ip_phase_water, ip_phase_ice, ip_cloud_type_homogen, &
+ ip_cloud_type_water, ip_cloud_type_ice, &
+ ip_cloud_type_strat, ip_cloud_type_conv, &
+ ip_cloud_type_sw, ip_cloud_type_si, ip_cloud_type_cw, ip_cloud_type_ci, &
+ ip_drop_unparametrized, ip_ice_unparametrized, i_normal, i_err_fatal
+use ereport_mod, only: ereport
+use errormessagelength_mod, only: errormessagelength
+
+implicit none
+
+
+! Cloud properties:
+type(StrCld), intent(out) :: cld
+
+! Control options:
+type(StrCtrl), intent(in) :: control
+
+! Dimensions:
+type(StrDim), intent(in) :: dimen
+
+! Spectral data:
+type(StrSpecData), intent(in) :: spectrum
+
+integer, intent(in) :: n_profile
+integer, intent(in) :: n_layer
+
+real(RealK), intent(in), optional :: &
+ cloud_frac(:,:), conv_frac(:,:), &
+ liq_frac(:,:), ice_frac(:,:), liq_conv_frac(:,:), ice_conv_frac(:,:), &
+ liq_mmr(:,:), ice_mmr(:,:), liq_conv_mmr(:,:), ice_conv_mmr(:,:), &
+ liq_dim(:,:), ice_dim(:,:), liq_conv_dim(:,:), ice_conv_dim(:,:)
+! Liquid and ice cloud fractions, gridbox mean mixing ratios, and
+! effective dimensions
+
+real(RealK), intent(in), optional :: dp_corr_strat, dp_corr_conv
+! Decorrelation pressure scales for cloud vertical overlap
+
+
+! Local variables
+integer :: i, j, k, l
+! Loop variables
+integer :: i_phase, i_param_type, n_cloud_parameter
+! Working variables
+integer :: i_cloud_type(dimen%nd_cloud_component)
+! Types of cloud to which each component contributes
+
+real(RealK) :: condensed_min_dim
+real(RealK) :: condensed_max_dim
+! Minimum and maximum dimensions of each condensed component
+
+real(RealK) :: eps = EPSILON(1.0)
+real(RealK) :: min_cloud_fraction = 0.0001
+
+integer :: ierr = i_normal
+character (len=*), parameter :: RoutineName = 'SET_CLD'
+character (len=errormessagelength) :: cmessage
+
+! Functions called
+integer, external :: set_n_cloud_parameter
+
+
+! Allocate structure for the core radiation code interface
+call allocate_cld(cld, dimen, spectrum)
+call allocate_cld_prsc(cld, dimen, spectrum)
+
+if (.not.control%l_cloud) then
+ return
+end if
+
+!------------------------------------------------------------------------------
+! Set properties of condensed components
+!------------------------------------------------------------------------------
+
+if (control%l_ice .and. control%l_drop) then
+ select case (control%i_cloud_representation)
+ case (ip_cloud_homogen, ip_cloud_ice_water)
+ cld%n_condensed = 2
+ cld%type_condensed(1) = ip_clcmp_st_water
+ cld%type_condensed(2) = ip_clcmp_st_ice
+ case (ip_cloud_conv_strat, ip_cloud_csiw)
+ cld%n_condensed = 4
+ cld%type_condensed(1) = ip_clcmp_st_water
+ cld%type_condensed(2) = ip_clcmp_st_ice
+ cld%type_condensed(3) = ip_clcmp_cnv_water
+ cld%type_condensed(4) = ip_clcmp_cnv_ice
+ end select
+else if (control%l_ice .and. .not.control%l_drop) then
+ select case (control%i_cloud_representation)
+ case (ip_cloud_homogen, ip_cloud_ice_water)
+ cld%n_condensed = 1
+ cld%type_condensed(1) = ip_clcmp_st_ice
+ case (ip_cloud_conv_strat, ip_cloud_csiw)
+ cld%n_condensed = 2
+ cld%type_condensed(1) = ip_clcmp_st_ice
+ cld%type_condensed(2) = ip_clcmp_cnv_ice
+ end select
+else if (.not.control%l_ice .and. control%l_drop) then
+ select case (control%i_cloud_representation)
+ case (ip_cloud_homogen, ip_cloud_ice_water)
+ cld%n_condensed = 1
+ cld%type_condensed(1) = ip_clcmp_st_water
+ case (ip_cloud_conv_strat, ip_cloud_csiw)
+ cld%n_condensed = 2
+ cld%type_condensed(1) = ip_clcmp_st_water
+ cld%type_condensed(2) = ip_clcmp_cnv_water
+ end select
+else
+ cmessage = 'Cloud on, but no condensed components included.'
+ ierr=i_err_fatal
+ CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+end if
+
+do i=1, cld%n_condensed
+ select case (cld%type_condensed(i))
+ case (ip_clcmp_st_water)
+ i_phase = ip_phase_water
+ i_param_type = control%i_st_water
+ case (ip_clcmp_st_ice)
+ i_phase = ip_phase_ice
+ i_param_type = control%i_st_ice
+ case (ip_clcmp_cnv_water)
+ i_phase = ip_phase_water
+ i_param_type = control%i_cnv_water
+ case (ip_clcmp_cnv_ice)
+ i_phase = ip_phase_ice
+ i_param_type = control%i_cnv_ice
+ end select
+
+ select case (i_phase)
+ case (ip_phase_water)
+ if (i_param_type <= 0) then
+ cld%i_condensed_param(i) = ip_drop_unparametrized
+ cmessage = 'Prescribed liquid cloud not yet implemented.'
+ ierr=i_err_fatal
+ CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ else if (i_param_type > spectrum%dim%nd_drop_type) then
+ cmessage = 'Liquid cloud type outside allowed range.'
+ ierr=i_err_fatal
+ CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ else if (spectrum%drop%l_drop_type(i_param_type)) then
+ ! Take parametrisation from spectral file
+ cld%i_condensed_param(i) = spectrum%drop%i_drop_parm(i_param_type)
+ cld%condensed_n_phf(i) = spectrum%drop%n_phf(i_param_type)
+ ! DEPENDS ON: set_n_cloud_parameter
+ n_cloud_parameter = set_n_cloud_parameter( cld%i_condensed_param(i), &
+ cld%type_condensed(i), cld%condensed_n_phf(i) )
+ do j=1, spectrum%basic%n_band
+ do k=1, n_cloud_parameter
+ cld%condensed_param_list(k, i, j) &
+ = spectrum%drop%parm_list(k, j, i_param_type)
+ end do
+ end do
+ ! Assign droplet mass mixing ratio and effective radius
+ condensed_min_dim = spectrum%drop%parm_min_dim(i_param_type)
+ condensed_max_dim = spectrum%drop%parm_max_dim(i_param_type)
+ select case (cld%type_condensed(i))
+ case (ip_clcmp_st_water)
+ if (present(liq_mmr).and.present(liq_dim)) then
+ do k = dimen%id_cloud_top, n_layer
+ do l = 1, n_profile
+ cld%condensed_mix_ratio(l, k, i) = liq_mmr(l, k)
+ cld%condensed_dim_char(l, k, i) = min( max( liq_dim(l, k), &
+ condensed_min_dim ), condensed_max_dim )
+ end do
+ end do
+ else
+ cmessage = 'Liquid MMR and effective radius not provided.'
+ ierr=i_err_fatal
+ CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ end if
+ case (ip_clcmp_cnv_water)
+ if (present(liq_conv_mmr).and.present(liq_conv_dim)) then
+ do k = dimen%id_cloud_top, n_layer
+ do l = 1, n_profile
+ cld%condensed_mix_ratio(l, k, i) = liq_conv_mmr(l, k)
+ cld%condensed_dim_char(l, k, i) = min( max( liq_conv_dim(l, k), &
+ condensed_min_dim ), condensed_max_dim )
+ end do
+ end do
+ else
+ cmessage = 'Convective liquid MMR and effective radius not provided.'
+ ierr=i_err_fatal
+ CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ end if
+ end select
+ else
+ cmessage = 'Liquid cloud type not in spectral file.'
+ ierr=i_err_fatal
+ CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ end if
+ case (ip_phase_ice)
+ if (i_param_type <= 0) then
+ cld%i_condensed_param(i) = ip_ice_unparametrized
+ cmessage = 'Prescribed ice cloud not yet implemented.'
+ ierr=i_err_fatal
+ CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ else if (i_param_type > spectrum%dim%nd_ice_type) then
+ cmessage = 'Ice cloud type outside allowed range.'
+ ierr=i_err_fatal
+ CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ else if (spectrum%ice%l_ice_type(i_param_type)) then
+ ! Take parametrisation from spectral file
+ cld%i_condensed_param(i) = spectrum%ice%i_ice_parm(i_param_type)
+ cld%condensed_n_phf(i) = spectrum%ice%n_phf(i_param_type)
+ n_cloud_parameter = set_n_cloud_parameter( cld%i_condensed_param(i), &
+ cld%type_condensed(i), cld%condensed_n_phf(i) )
+ do j=1, spectrum%basic%n_band
+ do k=1, n_cloud_parameter
+ cld%condensed_param_list(k, i, j) &
+ = spectrum%ice%parm_list(k, j, i_param_type)
+ end do
+ end do
+ ! Assign ice mass mixing ratio and effective dimension
+ condensed_min_dim = spectrum%ice%parm_min_dim(i_param_type)
+ condensed_max_dim = spectrum%ice%parm_max_dim(i_param_type)
+ select case (cld%type_condensed(i))
+ case (ip_clcmp_st_ice)
+ if (present(ice_mmr).and.present(ice_dim)) then
+ do k = dimen%id_cloud_top, n_layer
+ do l = 1, n_profile
+ cld%condensed_mix_ratio(l, k, i) = ice_mmr(l, k)
+ cld%condensed_dim_char(l, k, i) = min( max( ice_dim(l, k), &
+ condensed_min_dim ), condensed_max_dim )
+ end do
+ end do
+ else
+ cmessage = 'Ice MMR and effective radius not provided.'
+ ierr=i_err_fatal
+ CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ end if
+ case (ip_clcmp_cnv_ice)
+ if (present(ice_conv_mmr).and.present(ice_conv_dim)) then
+ do k = dimen%id_cloud_top, n_layer
+ do l = 1, n_profile
+ cld%condensed_mix_ratio(l, k, i) = ice_conv_mmr(l, k)
+ cld%condensed_dim_char(l, k, i) = min( max( ice_conv_dim(l, k), &
+ condensed_min_dim ), condensed_max_dim )
+ end do
+ end do
+ else
+ cmessage = 'Convective ice MMR and effective radius not provided.'
+ ierr=i_err_fatal
+ CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ end if
+ end select
+ else
+ cmessage = 'Ice cloud type not in spectral file.'
+ ierr=i_err_fatal
+ CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ end if
+ end select
+end do
+
+! Set the decorrelation scalings for cloud vertical overlap
+if (present(dp_corr_strat)) then
+ cld%dp_corr_strat = dp_corr_strat
+else
+ cld%dp_corr_strat = 0.0_RealK
+end if
+if (present(dp_corr_conv)) then
+ cld%dp_corr_conv = dp_corr_conv
+else
+ cld%dp_corr_conv = 0.0_RealK
+end if
+
+
+!------------------------------------------------------------------------------
+! Set cloud amounts and convert mixing ratios to in-cloud values
+!------------------------------------------------------------------------------
+
+! Set cloud fractions
+select case (control%i_cloud_representation)
+case (ip_cloud_homogen)
+ cld%n_cloud_type = 1
+ do i = 1, cld%n_condensed
+ i_cloud_type(i) = ip_cloud_type_homogen
+ end do
+ if (present(cloud_frac)) then
+ do k = dimen%id_cloud_top, n_layer
+ do l = 1, n_profile
+ cld%frac_cloud(l, k, ip_cloud_type_homogen) = cloud_frac(l, k)
+ end do
+ end do
+ else
+ cmessage = 'Cloud fraction not provided.'
+ ierr=i_err_fatal
+ CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ end if
+case (ip_cloud_ice_water)
+ cld%n_cloud_type = 2
+ do i = 1, cld%n_condensed
+ select case (cld%type_condensed(i))
+ case (ip_clcmp_st_water)
+ i_cloud_type(i) = ip_cloud_type_water
+ case (ip_clcmp_st_ice)
+ i_cloud_type(i) = ip_cloud_type_ice
+ end select
+ end do
+ if (present(liq_frac).and.present(ice_frac).and.present(cloud_frac)) then
+ do k = dimen%id_cloud_top, n_layer
+ do l = 1, n_profile
+ if (liq_frac(l, k) + ice_frac(l, k) > eps) then
+ ! Split mixed phase fraction between ice and liquid
+ cld%frac_cloud(l, k, ip_cloud_type_water) = &
+ cloud_frac(l, k)*liq_frac(l, k) / (liq_frac(l, k)+ice_frac(l, k))
+ cld%frac_cloud(l, k, ip_cloud_type_ice) = &
+ cloud_frac(l, k)*ice_frac(l, k) / (liq_frac(l, k)+ice_frac(l, k))
+ else
+ cld%frac_cloud(l, k, ip_cloud_type_water) = 0.0_RealK
+ cld%frac_cloud(l, k, ip_cloud_type_ice) = 0.0_RealK
+ end if
+ end do
+ end do
+ else if (present(liq_frac).and.present(ice_frac)) then
+ do k = dimen%id_cloud_top, n_layer
+ do l = 1, n_profile
+ cld%frac_cloud(l, k, ip_cloud_type_water) = liq_frac(l, k)
+ cld%frac_cloud(l, k, ip_cloud_type_ice) = ice_frac(l, k)
+ end do
+ end do
+ else
+ cmessage = 'Liquid and ice cloud fractions not provided.'
+ ierr=i_err_fatal
+ CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ end if
+case (ip_cloud_conv_strat)
+ cld%n_cloud_type = 2
+ do i = 1, cld%n_condensed
+ select case (cld%type_condensed(i))
+ case (ip_clcmp_st_water)
+ i_cloud_type(i) = ip_cloud_type_strat
+ case (ip_clcmp_st_ice)
+ i_cloud_type(i) = ip_cloud_type_strat
+ case (ip_clcmp_cnv_water)
+ i_cloud_type(i) = ip_cloud_type_conv
+ case (ip_clcmp_cnv_ice)
+ i_cloud_type(i) = ip_cloud_type_conv
+ end select
+ end do
+ if (present(cloud_frac).and.present(conv_frac)) then
+ do k = dimen%id_cloud_top, n_layer
+ do l = 1, n_profile
+ cld%frac_cloud(l, k, ip_cloud_type_strat) = cloud_frac(l, k)
+ cld%frac_cloud(l, k, ip_cloud_type_conv) = conv_frac(l, k)
+ end do
+ end do
+ else
+ cmessage = 'Cloud fraction and convective cloud fraction not provided.'
+ ierr=i_err_fatal
+ CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ end if
+case (ip_cloud_csiw)
+ cld%n_cloud_type = 4
+ do i = 1, cld%n_condensed
+ select case (cld%type_condensed(i))
+ case (ip_clcmp_st_water)
+ i_cloud_type(i) = ip_cloud_type_sw
+ case (ip_clcmp_st_ice)
+ i_cloud_type(i) = ip_cloud_type_si
+ case (ip_clcmp_cnv_water)
+ i_cloud_type(i) = ip_cloud_type_cw
+ case (ip_clcmp_cnv_ice)
+ i_cloud_type(i) = ip_cloud_type_ci
+ end select
+ end do
+ if (present(liq_frac).and.present(ice_frac).and.present(cloud_frac)) then
+ do k = dimen%id_cloud_top, n_layer
+ do l = 1, n_profile
+ if (liq_frac(l, k) + ice_frac(l, k) > eps) then
+ ! Split mixed phase fraction between ice and liquid
+ cld%frac_cloud(l, k, ip_cloud_type_sw) = &
+ cloud_frac(l, k)*liq_frac(l, k) / (liq_frac(l, k)+ice_frac(l, k))
+ cld%frac_cloud(l, k, ip_cloud_type_si) = &
+ cloud_frac(l, k)*ice_frac(l, k) / (liq_frac(l, k)+ice_frac(l, k))
+ else
+ cld%frac_cloud(l, k, ip_cloud_type_sw) = 0.0_RealK
+ cld%frac_cloud(l, k, ip_cloud_type_si) = 0.0_RealK
+ end if
+ end do
+ end do
+ else if (present(liq_frac).and.present(ice_frac)) then
+ do k = dimen%id_cloud_top, n_layer
+ do l = 1, n_profile
+ cld%frac_cloud(l, k, ip_cloud_type_sw) = liq_frac(l, k)
+ cld%frac_cloud(l, k, ip_cloud_type_si) = ice_frac(l, k)
+ end do
+ end do
+ else
+ cmessage = 'Liquid and ice cloud fractions not provided.'
+ ierr=i_err_fatal
+ CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ end if
+ if (present(liq_conv_frac).and.present(ice_conv_frac).and. &
+ present(conv_frac)) then
+ do k = dimen%id_cloud_top, n_layer
+ do l = 1, n_profile
+ if (liq_conv_frac(l, k) + ice_conv_frac(l, k) > eps) then
+ ! Split mixed phase fraction between ice and liquid
+ cld%frac_cloud(l, k, ip_cloud_type_cw) = conv_frac(l, k) &
+ *liq_conv_frac(l, k) / (liq_conv_frac(l, k)+ice_conv_frac(l, k))
+ cld%frac_cloud(l, k, ip_cloud_type_ci) = conv_frac(l, k) &
+ *ice_conv_frac(l, k) / (liq_conv_frac(l, k)+ice_conv_frac(l, k))
+ else
+ cld%frac_cloud(l, k, ip_cloud_type_cw) = 0.0_RealK
+ cld%frac_cloud(l, k, ip_cloud_type_ci) = 0.0_RealK
+ end if
+ end do
+ end do
+ else if (present(liq_conv_frac).and.present(ice_conv_frac)) then
+ do k = dimen%id_cloud_top, n_layer
+ do l = 1, n_profile
+ cld%frac_cloud(l, k, ip_cloud_type_cw) = liq_conv_frac(l, k)
+ cld%frac_cloud(l, k, ip_cloud_type_ci) = ice_conv_frac(l, k)
+ end do
+ end do
+ else
+ cmessage = 'Liquid and ice convective cloud fractions not provided.'
+ ierr=i_err_fatal
+ CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ end if
+end select
+
+! Convert mass mixing ratios to in-cloud values
+do i = 1, cld%n_condensed
+ do k = dimen%id_cloud_top, n_layer
+ do l = 1, n_profile
+ cld%condensed_mix_ratio(l, k, i) = cld%condensed_mix_ratio(l, k, i) &
+ / max(cld%frac_cloud(l, k, i_cloud_type(i)), eps)
+ end do
+ end do
+end do
+
+! Normalise the cloud fractions
+do k = dimen%id_cloud_top, n_layer
+ do l = 1, n_profile
+ cld%w_cloud(l, k) = sum(cld%frac_cloud(l, k, 1:cld%n_cloud_type))
+ if (cld%w_cloud(l, k) > min_cloud_fraction) then
+ do j=1, cld%n_cloud_type
+ cld%frac_cloud(l, k, j) = cld%frac_cloud(l, k, j) / cld%w_cloud(l, k)
+ end do
+ else
+ cld%w_cloud(l, k) = 0.0_RealK
+ cld%frac_cloud(l, k, 1:cld%n_cloud_type) = 0.0_RealK
+ end if
+ if (cld%w_cloud(l, k) > 1.0_RealK + min_cloud_fraction) then
+ cmessage = 'Cloud fraction greater than 1.'
+ ierr=i_err_fatal
+ CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ else if (cld%w_cloud(l, k) > 1.0_RealK) then
+ cld%w_cloud(l, k) = 1.0_RealK
+ end if
+ end do
+end do
+
+end subroutine set_cld
+end module socrates_set_cld
From fd53a721bbbfb602ab598c9701ba56b22add2f9b Mon Sep 17 00:00:00 2001
From: sit23
Date: Fri, 7 Sep 2018 12:54:05 +0100
Subject: [PATCH 048/304] Changes to pass socrates clouds from simple cloud
scheme.
---
.../socrates/interface/read_control.F90 | 8 +-
.../socrates/interface/socrates_calc.F90 | 33 ++++--
.../interface/socrates_config_mod.f90 | 7 +-
.../socrates/interface/socrates_interface.F90 | 54 ++++++++--
.../socrates/interface/socrates_set_cld.F90 | 101 ++++++++++--------
.../driver/solo/idealized_moist_phys.F90 | 5 +-
src/extra/model/socrates/path_names | 2 +-
7 files changed, 148 insertions(+), 62 deletions(-)
diff --git a/src/atmos_param/socrates/interface/read_control.F90 b/src/atmos_param/socrates/interface/read_control.F90
index 5ed7fae81..92d5eeefb 100644
--- a/src/atmos_param/socrates/interface/read_control.F90
+++ b/src/atmos_param/socrates/interface/read_control.F90
@@ -15,7 +15,7 @@ SUBROUTINE read_control(control, spectrum)
USE rad_pcf
USE def_control, ONLY: StrCtrl, allocate_control
USE def_spectrum, ONLY: StrSpecData
-USE socrates_config_mod, ONLY: l_planet_grey_surface, inc_h2o, inc_co2, inc_co, inc_o3, inc_n2o, inc_ch4, inc_o2, inc_so2, inc_cfc11, inc_cfc12, inc_cfc113, inc_hcfc22, inc_hfc134a
+USE socrates_config_mod, ONLY: l_planet_grey_surface, inc_h2o, inc_co2, inc_co, inc_o3, inc_n2o, inc_ch4, inc_o2, inc_so2, inc_cfc11, inc_cfc12, inc_cfc113, inc_hcfc22, inc_hfc134a, account_for_clouds_in_socrates
IMPLICIT NONE
@@ -93,7 +93,11 @@ SUBROUTINE read_control(control, spectrum)
control%i_gas_overlap = ip_overlap_k_eqv_scl
! Properties of clouds
-control%i_cloud_representation = ip_cloud_off
+if (account_for_clouds_in_socrates) then
+ control%i_cloud_representation = ip_cloud_ice_water
+else
+ control%i_cloud_representation = ip_cloud_off
+end if
control%i_overlap = ip_max_rand
control%i_inhom = ip_homogeneous
diff --git a/src/atmos_param/socrates/interface/socrates_calc.F90 b/src/atmos_param/socrates/interface/socrates_calc.F90
index 6a07a8d3b..ab545635e 100644
--- a/src/atmos_param/socrates/interface/socrates_calc.F90
+++ b/src/atmos_param/socrates/interface/socrates_calc.F90
@@ -33,6 +33,7 @@ subroutine socrates_calc(Time_diag,control, spectrum,
t_rad_surf, cos_zenith_angle, solar_irrad, orog_corr, &
l_planet_grey_surface, planet_albedo, planet_emissivity, &
layer_heat_capacity, &
+ cld_frac, reff_rad, mmr_cl_rad, &
flux_direct, flux_down, flux_up, heating_rate, spectral_olr)
use rad_pcf
@@ -45,12 +46,12 @@ subroutine socrates_calc(Time_diag,control, spectrum,
use def_aer, only: StrAer, deallocate_aer, deallocate_aer_prsc
use def_out, only: StrOut, deallocate_out
-use set_control_mod, only: set_control
-use set_dimen_mod, only: set_dimen
-use set_atm_mod, only: set_atm
-use set_bound_mod, only: set_bound
-use set_cld_mod, only: set_cld
-use set_aer_mod, only: set_aer
+use set_control_mod, only: set_control
+use set_dimen_mod, only: set_dimen
+use set_atm_mod, only: set_atm
+use set_bound_mod, only: set_bound
+use socrates_set_cld, only: set_cld
+use set_aer_mod, only: set_aer
use soc_constants_mod, only: i_def, r_def
@@ -114,6 +115,15 @@ subroutine socrates_calc(Time_diag,control, spectrum,
real(r_def), intent(in) :: layer_heat_capacity(n_profile, n_layer)
! Heat capacity of layer
+real(r_def), intent(in) :: cld_frac(n_profile, n_layer)
+! Cloud fraction at layer centres
+
+real(r_def), intent(in) :: reff_rad(n_profile, n_layer)
+! Cloud liquid particle radius from simple cloud scheme
+
+real(r_def), intent(in) :: mmr_cl_rad(n_profile, n_layer)
+! Cloud liquid mmr at layer centres
+
real(r_def), intent(out) :: flux_direct(n_profile, 0:n_layer)
! Direct (unscattered) downwards flux (Wm-2)
real(r_def), intent(out) :: flux_down(n_profile, 0:n_layer)
@@ -151,6 +161,7 @@ subroutine socrates_calc(Time_diag,control, spectrum,
!DIAG Diagnostic
logical :: used
+real(r_def) :: zeros_cld(n_profile, n_layer)
call set_control(control)
@@ -165,7 +176,15 @@ subroutine socrates_calc(Time_diag,control, spectrum,
t_rad_surf, cos_zenith_angle, solar_irrad, orog_corr, &
l_planet_grey_surface, planet_albedo, planet_emissivity)
-call set_cld(control, dimen, spectrum, cld, n_profile)
+! call set_cld(control, dimen, spectrum, cld, n_profile)
+
+call set_cld(cld, control, dimen, spectrum, n_profile, n_layer, &
+ liq_frac = cld_frac, &
+ ice_frac = zeros_cld, &
+ liq_mmr = mmr_cl_rad, &
+ ice_mmr = zeros_cld, &
+ liq_dim = reff_rad, &
+ ice_dim = zeros_cld )
call set_aer(control, dimen, spectrum, aer, n_profile)
diff --git a/src/atmos_param/socrates/interface/socrates_config_mod.f90 b/src/atmos_param/socrates/interface/socrates_config_mod.f90
index 2689b940c..249e4035b 100644
--- a/src/atmos_param/socrates/interface/socrates_config_mod.f90
+++ b/src/atmos_param/socrates/interface/socrates_config_mod.f90
@@ -41,7 +41,9 @@ module socrates_config_mod
logical :: input_co2_mmr=.false. !Socrates wants input concentrations as mmr not vmr, so need to make sure input data supplied is converted if necessary
logical :: use_pressure_interp_for_half_levels = .False. !By default (.False.) does linear interpolation in height for half-level temperatures. True does linear interp using pressure.
-
+
+ logical :: account_for_clouds_in_socrates = .false. !Do we want to account for the radiative effects of clouds in socrates?
+
! Incoming radiation options for namelist
integer :: solday=0 ! if >0, do perpetual run corresponding to day of the year = solday \in [0,days per year]
@@ -127,6 +129,7 @@ module socrates_config_mod
inc_h2o, inc_co2, inc_co, inc_o3, inc_n2o, inc_ch4, inc_o2, &
inc_so2, inc_cfc11, inc_cfc12, inc_cfc113, inc_hcfc22, inc_hfc134a, &
use_pressure_interp_for_half_levels, &
- frierson_solar_rad, del_sol, del_sw
+ frierson_solar_rad, del_sol, del_sw, &
+ account_for_clouds_in_socrates
end module socrates_config_mod
diff --git a/src/atmos_param/socrates/interface/socrates_interface.F90 b/src/atmos_param/socrates/interface/socrates_interface.F90
index 1a03b44f0..452e88b10 100644
--- a/src/atmos_param/socrates/interface/socrates_interface.F90
+++ b/src/atmos_param/socrates/interface/socrates_interface.F90
@@ -432,6 +432,7 @@ end subroutine socrates_init
! -----------------------------------------------------------------------------
subroutine socrates_interface(Time_diag, rlat, rlon, soc_lw_mode, &
fms_temp, fms_spec_hum, fms_ozone, fms_co2, fms_t_surf, fms_p_full, fms_p_half, fms_z_full, fms_z_half, fms_albedo, fms_coszen, fms_rrsun, n_profile, n_layer, &
+ fms_cld_frac, fms_reff_rad, fms_mmr_cl_rad, &
output_heating_rate, output_flux_down, output_flux_up, output_soc_spectral_olr, output_flux_direct, t_half_level_out )
use realtype_rd
@@ -470,7 +471,7 @@ subroutine socrates_interface(Time_diag, rlat, rlon, soc_lw_mode, &
real(r_def), intent(in) :: rlat(:,:)
real(r_def), intent(in) :: fms_z_full(:,:,:), fms_z_half(:,:,:)
real(r_def), intent(in) :: fms_rrsun
-
+ real(r_def), intent(in) :: fms_cld_frac(:,:,:), fms_reff_rad(:,:,:), fms_mmr_cl_rad(:,:,:)
! Output arrays
real(r_def), intent(out) :: output_heating_rate(:,:,:)
@@ -491,7 +492,7 @@ subroutine socrates_interface(Time_diag, rlat, rlon, soc_lw_mode, &
soc_heating_rate, input_o3_mixing_ratio, &
input_co2_mixing_ratio,z_full_reshaped
real, dimension(n_profile, 0:n_layer) :: input_p_level, input_t_level, soc_flux_direct, &
- soc_flux_down, soc_flux_up, z_half_reshaped
+ soc_flux_down, soc_flux_up, z_half_reshaped, input_cld_frac, input_reff_rad, input_mmr_cl_rad
real, dimension(n_profile) :: input_t_surf, input_cos_zenith_angle, input_solar_irrad, &
input_orog_corr, input_planet_albedo
@@ -531,7 +532,11 @@ subroutine socrates_interface(Time_diag, rlat, rlon, soc_lw_mode, &
input_t = reshape(fms_temp(:,:,:),(/si*sj,sk /))
input_p = reshape(fms_p_full(:,:,:),(/si*sj,sk /))
input_p_level = reshape(fms_p_half(:,:,:),(/si*sj,sk+1 /))
-
+
+ input_cld_frac = reshape(fms_cld_frac(:,:,:),(/si*sj,sk /))
+ input_reff_rad = reshape(fms_reff_rad(:,:,:),(/si*sj,sk /))
+ input_mmr_cl_rad = reshape(fms_mmr_cl_rad(:,:,:),(/si*sj,sk/))
+
if (account_for_effect_of_water == .true.) then
input_mixing_ratio = reshape(fms_spec_hum(:,:,:) / (1. - fms_spec_hum(:,:,:)),(/si*sj,sk /)) !Mass mixing ratio = q / (1-q)
else
@@ -652,6 +657,9 @@ subroutine socrates_interface(Time_diag, rlat, rlon, soc_lw_mode, &
input_planet_albedo(idx_chunk_start:idx_chunk_end), &
input_planet_emissivity, &
input_layer_heat_capacity(idx_chunk_start:idx_chunk_end,:), &
+ input_cld_frac(idx_chunk_start:idx_chunk_end,:), &
+ input_reff_rad(idx_chunk_start:idx_chunk_end,:), &
+ input_mmr_cl_rad(idx_chunk_start:idx_chunk_end,:), &
soc_flux_direct(idx_chunk_start:idx_chunk_end,:), &
soc_flux_down(idx_chunk_start:idx_chunk_end,:), &
soc_flux_up(idx_chunk_start:idx_chunk_end,:), &
@@ -678,6 +686,9 @@ subroutine socrates_interface(Time_diag, rlat, rlon, soc_lw_mode, &
input_planet_albedo(idx_chunk_start:idx_chunk_end), &
input_planet_emissivity, &
input_layer_heat_capacity(idx_chunk_start:idx_chunk_end,:), &
+ input_cld_frac(idx_chunk_start:idx_chunk_end,:), &
+ input_reff_rad(idx_chunk_start:idx_chunk_end,:), &
+ input_mmr_cl_rad(idx_chunk_start:idx_chunk_end,:), &
soc_flux_direct(idx_chunk_start:idx_chunk_end,:), &
soc_flux_down(idx_chunk_start:idx_chunk_end,:), &
soc_flux_up(idx_chunk_start:idx_chunk_end,:), &
@@ -703,7 +714,7 @@ subroutine socrates_interface(Time_diag, rlat, rlon, soc_lw_mode, &
end subroutine socrates_interface
subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf_in, p_full_in, p_half_in, z_full_in, z_half_in, albedo_in, &
- temp_tend, net_surf_sw_down, surf_lw_down, delta_t)
+ temp_tend, net_surf_sw_down, surf_lw_down, delta_t, do_cloud_simple, cf_rad, reff_rad, qcl_rad)
use astronomy_mod, only: diurnal_solar
use constants_mod, only: pi, wtmco2, wtmozone, rdgas, gas_constant
@@ -718,11 +729,13 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
real, intent(inout), dimension(:,:,:) :: temp_tend
real, intent(out), dimension(:,:) :: net_surf_sw_down, surf_lw_down
real, intent(in) :: delta_t
+ logical, intent(in) :: do_cloud_simple
+ real, intent(in), dimension(:,:,:) :: cf_rad, reff_rad, qcl_rad
integer(i_def) :: n_profile, n_layer
real(r_def), dimension(size(temp_in,1), size(temp_in,2)) :: t_surf_for_soc, rad_lat_soc, rad_lon_soc, albedo_soc
- real(r_def), dimension(size(temp_in,1), size(temp_in,2), size(temp_in,3)) :: tg_tmp_soc, q_soc, ozone_soc, co2_soc, p_full_soc, output_heating_rate_sw, output_heating_rate_lw, output_heating_rate_total, z_full_soc
+ real(r_def), dimension(size(temp_in,1), size(temp_in,2), size(temp_in,3)) :: tg_tmp_soc, q_soc, ozone_soc, co2_soc, p_full_soc, output_heating_rate_sw, output_heating_rate_lw, output_heating_rate_total, z_full_soc, cld_frac_soc, reff_rad_soc, mmr_cl_rad_soc, qcl_rad_soc
real(r_def), dimension(size(temp_in,1), size(temp_in,2), size(temp_in,3)+1) :: p_half_soc, t_half_out, z_half_soc,output_soc_flux_sw_down, output_soc_flux_sw_up, output_soc_flux_lw_down, output_soc_flux_lw_up
logical :: soc_lw_mode, used
@@ -953,6 +966,33 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
endif
+ if(do_cloud_simple.and.account_for_clouds_in_socrates) then
+ cld_frac_soc = REAL(cf_rad, kind(r_def))
+ reff_rad_soc = REAL(reff_rad, kind(r_def))
+
+ qcl_rad_soc = REAL(qcl_rad, kind(r_def))
+ mmr_cl_rad_soc = qcl_rad_soc / (1.0 - qcl_rad_soc)
+
+ elseif(do_cloud_simple.and..not.account_for_clouds_in_socrates) then
+
+ call error_mesg( 'run_socrates', &
+ 'do_cloud_simple is True but account_for_clouds_in_socrates is False. Radiative effects of clouds NOT accounted for', WARNING)
+
+ cld_frac_soc = 0.
+ reff_rad_soc = 0.
+ mmr_cl_rad_soc = 0.
+
+ elseif(.not.do_cloud_simple.and.account_for_clouds_in_socrates) then
+
+ call error_mesg( 'run_socrates', &
+ 'do_cloud_simple is False but account_for_clouds_in_socrates is True. Radiative effects of clouds NOT accounted for', WARNING)
+
+ cld_frac_soc = 0.
+ reff_rad_soc = 0.
+ mmr_cl_rad_soc = 0.
+
+ endif
+
n_profile = INT(size(temp_in,2)*size(temp_in,1), kind(i_def))
n_layer = INT(size(temp_in,3), kind(i_def))
t_surf_for_soc = REAL(t_surf_in(:,:), kind(r_def))
@@ -975,7 +1015,7 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
CALL socrates_interface(Time, rad_lat_soc, rad_lon_soc, soc_lw_mode, &
tg_tmp_soc, q_soc, ozone_soc, co2_soc, t_surf_for_soc, p_full_soc, p_half_soc, z_full_soc, z_half_soc, albedo_soc, coszen, rrsun, n_profile, n_layer, &
- output_heating_rate_lw, output_soc_flux_lw_down, output_soc_flux_lw_up, output_soc_spectral_olr = outputted_soc_spectral_olr, t_half_level_out = t_half_out)
+ output_heating_rate_lw, output_soc_flux_lw_down, output_soc_flux_lw_up, cld_frac_soc, reff_rad_soc, mmr_cl_rad_soc, output_soc_spectral_olr = outputted_soc_spectral_olr, t_half_level_out = t_half_out)
tg_tmp_soc = tg_tmp_soc + output_heating_rate_lw*delta_t !Output heating rate in K/s, so is a temperature tendency
surf_lw_down(:,:) = REAL(output_soc_flux_lw_down(:,:, n_layer+1))
@@ -990,7 +1030,7 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
soc_lw_mode = .FALSE.
CALL socrates_interface(Time, rad_lat_soc, rad_lon_soc, soc_lw_mode, &
tg_tmp_soc, q_soc, ozone_soc, co2_soc, t_surf_for_soc, p_full_soc, p_half_soc, z_full_soc, z_half_soc, albedo_soc, coszen, rrsun, n_profile, n_layer, &
- output_heating_rate_sw, output_soc_flux_sw_down, output_soc_flux_sw_up)
+ output_heating_rate_sw, output_soc_flux_sw_down, output_soc_flux_sw_up, cld_frac_soc, reff_rad_soc, mmr_cl_rad_soc)
tg_tmp_soc = tg_tmp_soc + output_heating_rate_sw*delta_t !Output heating rate in K/s, so is a temperature tendency
net_surf_sw_down(:,:) = REAL(output_soc_flux_sw_down(:,:, n_layer+1)-output_soc_flux_sw_up(:,:,n_layer+1) )
diff --git a/src/atmos_param/socrates/interface/socrates_set_cld.F90 b/src/atmos_param/socrates/interface/socrates_set_cld.F90
index 25e47a340..d98b215a6 100644
--- a/src/atmos_param/socrates/interface/socrates_set_cld.F90
+++ b/src/atmos_param/socrates/interface/socrates_set_cld.F90
@@ -23,7 +23,7 @@ subroutine set_cld(cld, control, dimen, spectrum, n_profile, n_layer, &
use def_control, only: StrCtrl
use def_dimen, only: StrDim
use def_spectrum, only: StrSpecData
-use realtype_rd, only: RealK
+use soc_constants_mod, only: i_def, r_def
use rad_pcf, only: &
ip_cloud_homogen, ip_cloud_ice_water, ip_cloud_conv_strat, ip_cloud_csiw, &
ip_clcmp_st_water, ip_clcmp_st_ice, ip_clcmp_cnv_water, ip_clcmp_cnv_ice, &
@@ -32,8 +32,8 @@ subroutine set_cld(cld, control, dimen, spectrum, n_profile, n_layer, &
ip_cloud_type_strat, ip_cloud_type_conv, &
ip_cloud_type_sw, ip_cloud_type_si, ip_cloud_type_cw, ip_cloud_type_ci, &
ip_drop_unparametrized, ip_ice_unparametrized, i_normal, i_err_fatal
-use ereport_mod, only: ereport
-use errormessagelength_mod, only: errormessagelength
+
+use fms_mod, only: error_mesg, FATAL
implicit none
@@ -50,10 +50,10 @@ subroutine set_cld(cld, control, dimen, spectrum, n_profile, n_layer, &
! Spectral data:
type(StrSpecData), intent(in) :: spectrum
-integer, intent(in) :: n_profile
-integer, intent(in) :: n_layer
+integer(i_def), intent(in) :: n_profile
+integer(i_def), intent(in) :: n_layer
-real(RealK), intent(in), optional :: &
+real(r_def), intent(in), optional :: &
cloud_frac(:,:), conv_frac(:,:), &
liq_frac(:,:), ice_frac(:,:), liq_conv_frac(:,:), ice_conv_frac(:,:), &
liq_mmr(:,:), ice_mmr(:,:), liq_conv_mmr(:,:), ice_conv_mmr(:,:), &
@@ -61,7 +61,7 @@ subroutine set_cld(cld, control, dimen, spectrum, n_profile, n_layer, &
! Liquid and ice cloud fractions, gridbox mean mixing ratios, and
! effective dimensions
-real(RealK), intent(in), optional :: dp_corr_strat, dp_corr_conv
+real(r_def), intent(in), optional :: dp_corr_strat, dp_corr_conv
! Decorrelation pressure scales for cloud vertical overlap
@@ -73,16 +73,16 @@ subroutine set_cld(cld, control, dimen, spectrum, n_profile, n_layer, &
integer :: i_cloud_type(dimen%nd_cloud_component)
! Types of cloud to which each component contributes
-real(RealK) :: condensed_min_dim
-real(RealK) :: condensed_max_dim
+real(r_def) :: condensed_min_dim
+real(r_def) :: condensed_max_dim
! Minimum and maximum dimensions of each condensed component
-real(RealK) :: eps = EPSILON(1.0)
-real(RealK) :: min_cloud_fraction = 0.0001
+real(r_def) :: eps = EPSILON(1.0)
+real(r_def) :: min_cloud_fraction = 0.0001
integer :: ierr = i_normal
character (len=*), parameter :: RoutineName = 'SET_CLD'
-character (len=errormessagelength) :: cmessage
+character (len=128) :: cmessage
! Functions called
integer, external :: set_n_cloud_parameter
@@ -136,7 +136,8 @@ subroutine set_cld(cld, control, dimen, spectrum, n_profile, n_layer, &
else
cmessage = 'Cloud on, but no condensed components included.'
ierr=i_err_fatal
- CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+! CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ call error_mesg(ModuleName,cmessage, FATAL)
end if
do i=1, cld%n_condensed
@@ -161,11 +162,13 @@ subroutine set_cld(cld, control, dimen, spectrum, n_profile, n_layer, &
cld%i_condensed_param(i) = ip_drop_unparametrized
cmessage = 'Prescribed liquid cloud not yet implemented.'
ierr=i_err_fatal
- CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ ! CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ call error_mesg(ModuleName,cmessage, FATAL)
else if (i_param_type > spectrum%dim%nd_drop_type) then
cmessage = 'Liquid cloud type outside allowed range.'
ierr=i_err_fatal
- CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ ! CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ call error_mesg(ModuleName,cmessage, FATAL)
else if (spectrum%drop%l_drop_type(i_param_type)) then
! Take parametrisation from spectral file
cld%i_condensed_param(i) = spectrum%drop%i_drop_parm(i_param_type)
@@ -195,7 +198,8 @@ subroutine set_cld(cld, control, dimen, spectrum, n_profile, n_layer, &
else
cmessage = 'Liquid MMR and effective radius not provided.'
ierr=i_err_fatal
- CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ ! CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ call error_mesg(ModuleName,cmessage, FATAL)
end if
case (ip_clcmp_cnv_water)
if (present(liq_conv_mmr).and.present(liq_conv_dim)) then
@@ -209,24 +213,28 @@ subroutine set_cld(cld, control, dimen, spectrum, n_profile, n_layer, &
else
cmessage = 'Convective liquid MMR and effective radius not provided.'
ierr=i_err_fatal
- CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ ! CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ call error_mesg(ModuleName,cmessage, FATAL)
end if
end select
else
cmessage = 'Liquid cloud type not in spectral file.'
ierr=i_err_fatal
- CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ ! CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ call error_mesg(ModuleName,cmessage, FATAL)
end if
case (ip_phase_ice)
if (i_param_type <= 0) then
cld%i_condensed_param(i) = ip_ice_unparametrized
cmessage = 'Prescribed ice cloud not yet implemented.'
ierr=i_err_fatal
- CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ ! CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ call error_mesg(ModuleName,cmessage, FATAL)
else if (i_param_type > spectrum%dim%nd_ice_type) then
cmessage = 'Ice cloud type outside allowed range.'
ierr=i_err_fatal
- CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ ! CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ call error_mesg(ModuleName,cmessage, FATAL)
else if (spectrum%ice%l_ice_type(i_param_type)) then
! Take parametrisation from spectral file
cld%i_condensed_param(i) = spectrum%ice%i_ice_parm(i_param_type)
@@ -255,7 +263,8 @@ subroutine set_cld(cld, control, dimen, spectrum, n_profile, n_layer, &
else
cmessage = 'Ice MMR and effective radius not provided.'
ierr=i_err_fatal
- CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ ! CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ call error_mesg(ModuleName,cmessage, FATAL)
end if
case (ip_clcmp_cnv_ice)
if (present(ice_conv_mmr).and.present(ice_conv_dim)) then
@@ -269,13 +278,15 @@ subroutine set_cld(cld, control, dimen, spectrum, n_profile, n_layer, &
else
cmessage = 'Convective ice MMR and effective radius not provided.'
ierr=i_err_fatal
- CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ ! CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ call error_mesg(ModuleName,cmessage, FATAL)
end if
end select
else
cmessage = 'Ice cloud type not in spectral file.'
ierr=i_err_fatal
- CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ ! CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ call error_mesg(ModuleName,cmessage, FATAL)
end if
end select
end do
@@ -284,12 +295,12 @@ subroutine set_cld(cld, control, dimen, spectrum, n_profile, n_layer, &
if (present(dp_corr_strat)) then
cld%dp_corr_strat = dp_corr_strat
else
- cld%dp_corr_strat = 0.0_RealK
+ cld%dp_corr_strat = 0.0_r_def
end if
if (present(dp_corr_conv)) then
cld%dp_corr_conv = dp_corr_conv
else
- cld%dp_corr_conv = 0.0_RealK
+ cld%dp_corr_conv = 0.0_r_def
end if
@@ -313,7 +324,8 @@ subroutine set_cld(cld, control, dimen, spectrum, n_profile, n_layer, &
else
cmessage = 'Cloud fraction not provided.'
ierr=i_err_fatal
- CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ ! CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ call error_mesg(ModuleName,cmessage, FATAL)
end if
case (ip_cloud_ice_water)
cld%n_cloud_type = 2
@@ -335,8 +347,8 @@ subroutine set_cld(cld, control, dimen, spectrum, n_profile, n_layer, &
cld%frac_cloud(l, k, ip_cloud_type_ice) = &
cloud_frac(l, k)*ice_frac(l, k) / (liq_frac(l, k)+ice_frac(l, k))
else
- cld%frac_cloud(l, k, ip_cloud_type_water) = 0.0_RealK
- cld%frac_cloud(l, k, ip_cloud_type_ice) = 0.0_RealK
+ cld%frac_cloud(l, k, ip_cloud_type_water) = 0.0_r_def
+ cld%frac_cloud(l, k, ip_cloud_type_ice) = 0.0_r_def
end if
end do
end do
@@ -350,7 +362,8 @@ subroutine set_cld(cld, control, dimen, spectrum, n_profile, n_layer, &
else
cmessage = 'Liquid and ice cloud fractions not provided.'
ierr=i_err_fatal
- CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ ! CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ call error_mesg(ModuleName,cmessage, FATAL)
end if
case (ip_cloud_conv_strat)
cld%n_cloud_type = 2
@@ -376,7 +389,8 @@ subroutine set_cld(cld, control, dimen, spectrum, n_profile, n_layer, &
else
cmessage = 'Cloud fraction and convective cloud fraction not provided.'
ierr=i_err_fatal
- CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ ! CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ call error_mesg(ModuleName,cmessage, FATAL)
end if
case (ip_cloud_csiw)
cld%n_cloud_type = 4
@@ -402,8 +416,8 @@ subroutine set_cld(cld, control, dimen, spectrum, n_profile, n_layer, &
cld%frac_cloud(l, k, ip_cloud_type_si) = &
cloud_frac(l, k)*ice_frac(l, k) / (liq_frac(l, k)+ice_frac(l, k))
else
- cld%frac_cloud(l, k, ip_cloud_type_sw) = 0.0_RealK
- cld%frac_cloud(l, k, ip_cloud_type_si) = 0.0_RealK
+ cld%frac_cloud(l, k, ip_cloud_type_sw) = 0.0_r_def
+ cld%frac_cloud(l, k, ip_cloud_type_si) = 0.0_r_def
end if
end do
end do
@@ -417,7 +431,8 @@ subroutine set_cld(cld, control, dimen, spectrum, n_profile, n_layer, &
else
cmessage = 'Liquid and ice cloud fractions not provided.'
ierr=i_err_fatal
- CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ ! CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ call error_mesg(ModuleName,cmessage, FATAL)
end if
if (present(liq_conv_frac).and.present(ice_conv_frac).and. &
present(conv_frac)) then
@@ -430,8 +445,8 @@ subroutine set_cld(cld, control, dimen, spectrum, n_profile, n_layer, &
cld%frac_cloud(l, k, ip_cloud_type_ci) = conv_frac(l, k) &
*ice_conv_frac(l, k) / (liq_conv_frac(l, k)+ice_conv_frac(l, k))
else
- cld%frac_cloud(l, k, ip_cloud_type_cw) = 0.0_RealK
- cld%frac_cloud(l, k, ip_cloud_type_ci) = 0.0_RealK
+ cld%frac_cloud(l, k, ip_cloud_type_cw) = 0.0_r_def
+ cld%frac_cloud(l, k, ip_cloud_type_ci) = 0.0_r_def
end if
end do
end do
@@ -445,7 +460,8 @@ subroutine set_cld(cld, control, dimen, spectrum, n_profile, n_layer, &
else
cmessage = 'Liquid and ice convective cloud fractions not provided.'
ierr=i_err_fatal
- CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ ! CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ call error_mesg(ModuleName,cmessage, FATAL)
end if
end select
@@ -468,15 +484,16 @@ subroutine set_cld(cld, control, dimen, spectrum, n_profile, n_layer, &
cld%frac_cloud(l, k, j) = cld%frac_cloud(l, k, j) / cld%w_cloud(l, k)
end do
else
- cld%w_cloud(l, k) = 0.0_RealK
- cld%frac_cloud(l, k, 1:cld%n_cloud_type) = 0.0_RealK
+ cld%w_cloud(l, k) = 0.0_r_def
+ cld%frac_cloud(l, k, 1:cld%n_cloud_type) = 0.0_r_def
end if
- if (cld%w_cloud(l, k) > 1.0_RealK + min_cloud_fraction) then
+ if (cld%w_cloud(l, k) > 1.0_r_def + min_cloud_fraction) then
cmessage = 'Cloud fraction greater than 1.'
ierr=i_err_fatal
- CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
- else if (cld%w_cloud(l, k) > 1.0_RealK) then
- cld%w_cloud(l, k) = 1.0_RealK
+ ! CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ call error_mesg(ModuleName,cmessage, FATAL)
+ else if (cld%w_cloud(l, k) > 1.0_r_def) then
+ cld%w_cloud(l, k) = 1.0_r_def
end if
end do
end do
diff --git a/src/atmos_spectral/driver/solo/idealized_moist_phys.F90 b/src/atmos_spectral/driver/solo/idealized_moist_phys.F90
index 07d9191f8..9447ef20d 100644
--- a/src/atmos_spectral/driver/solo/idealized_moist_phys.F90
+++ b/src/atmos_spectral/driver/solo/idealized_moist_phys.F90
@@ -983,6 +983,8 @@ subroutine idealized_moist_phys(Time, p_half, p_full, z_half, z_full, ug, vg, tg
endif
+! write(6,*) minval(cf_rad), maxval(cf_rad), minval(reff_rad), maxval(reff_rad), minval(qcl_rad), maxval(qcl_rad)
+
tmp1 = maxval(reff_rad)
tmp2 = maxval(cf_rad)
@@ -1125,7 +1127,8 @@ subroutine idealized_moist_phys(Time, p_half, p_full, z_half, z_full, ug, vg, tg
! Socrates interface
call run_socrates(Time, Time+Time_step, rad_lat, rad_lon, tg(:,:,:,previous), grid_tracers(:,:,:,previous,nsphum), t_surf(:,:), p_full(:,:,:,current), &
- p_half(:,:,:,current),z_full(:,:,:,current),z_half(:,:,:,current), albedo, dt_tg(:,:,:), net_surf_sw_down(:,:), surf_lw_down(:,:), delta_t)
+ p_half(:,:,:,current),z_full(:,:,:,current),z_half(:,:,:,current), albedo, dt_tg(:,:,:), net_surf_sw_down(:,:), surf_lw_down(:,:), delta_t, do_cloud_simple, cf_rad(:,:,:), reff_rad(:,:,:), &
+ qcl_rad(:,:,:) )
endif
#endif
diff --git a/src/extra/model/socrates/path_names b/src/extra/model/socrates/path_names
index 2f4dac9eb..7ec1ee810 100644
--- a/src/extra/model/socrates/path_names
+++ b/src/extra/model/socrates/path_names
@@ -583,7 +583,7 @@ atmos_param/socrates/src/trunk/src/general/calc_planck_tbl.f
atmos_param/socrates/src/trunk/src/general/read_word.f
atmos_param/socrates/interface/read_control.F90
atmos_param/socrates/interface/set_atm.F90
-atmos_param/socrates/interface/set_cld.F90
+atmos_param/socrates/interface/socrates_set_cld.F90
atmos_param/socrates/interface/set_dimen.F90
atmos_param/socrates/interface/socrates_config_mod.f90
atmos_param/socrates/interface/compress_spectrum.F90
From 174123e5fd7bc933dedd51514f096190408c0dbc Mon Sep 17 00:00:00 2001
From: sit23
Date: Fri, 7 Sep 2018 13:02:38 +0100
Subject: [PATCH 049/304] Turned socrates clouds on for the first time, and hit
error where cloud fraction is above one. Check this with Penny.
---
.../socrates/interface/socrates_interface.F90 | 27 ++++++++++++-------
.../driver/solo/idealized_moist_phys.F90 | 2 +-
2 files changed, 19 insertions(+), 10 deletions(-)
diff --git a/src/atmos_param/socrates/interface/socrates_interface.F90 b/src/atmos_param/socrates/interface/socrates_interface.F90
index 452e88b10..7f9890cdc 100644
--- a/src/atmos_param/socrates/interface/socrates_interface.F90
+++ b/src/atmos_param/socrates/interface/socrates_interface.F90
@@ -80,7 +80,7 @@ MODULE socrates_interface_mod
CONTAINS
- SUBROUTINE socrates_init(is, ie, js, je, num_levels, axes, Time, lat, lonb, latb, delta_t_atmos)
+ SUBROUTINE socrates_init(is, ie, js, je, num_levels, axes, Time, lat, lonb, latb, delta_t_atmos, do_cloud_simple)
!! Initialises Socrates spectra, arrays, and constants
USE astronomy_mod, only: astronomy_init
@@ -94,6 +94,7 @@ SUBROUTINE socrates_init(is, ie, js, je, num_levels, axes, Time, lat, lonb, latb
INTEGER, INTENT(in) :: is, ie, js, je, num_levels
REAL, INTENT(in) , DIMENSION(:,:) :: lat
REAL, INTENT(in) , DIMENSION(:,:) :: lonb, latb
+ LOGICAL, INTENT(IN) :: do_cloud_simple
integer :: io, stdlog_unit
integer :: res, time_step_seconds
@@ -117,6 +118,18 @@ SUBROUTINE socrates_init(is, ie, js, je, num_levels, axes, Time, lat, lonb, latb
!Initialise astronomy
call astronomy_init
+ if(do_cloud_simple.and..not.account_for_clouds_in_socrates) then
+
+ call error_mesg( 'run_socrates', &
+ 'do_cloud_simple is True but account_for_clouds_in_socrates is False. Radiative effects of clouds NOT accounted for', WARNING)
+
+ elseif(.not.do_cloud_simple.and.account_for_clouds_in_socrates) then
+
+ call error_mesg( 'run_socrates', &
+ 'do_cloud_simple is False but account_for_clouds_in_socrates is True. Radiative effects of clouds NOT accounted for', WARNING)
+
+ endif
+
!Initialise variables related to radiation timestep
call get_time(delta_t_atmos,time_step_seconds)
@@ -975,18 +988,12 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
elseif(do_cloud_simple.and..not.account_for_clouds_in_socrates) then
- call error_mesg( 'run_socrates', &
- 'do_cloud_simple is True but account_for_clouds_in_socrates is False. Radiative effects of clouds NOT accounted for', WARNING)
-
cld_frac_soc = 0.
reff_rad_soc = 0.
mmr_cl_rad_soc = 0.
elseif(.not.do_cloud_simple.and.account_for_clouds_in_socrates) then
- call error_mesg( 'run_socrates', &
- 'do_cloud_simple is False but account_for_clouds_in_socrates is True. Radiative effects of clouds NOT accounted for', WARNING)
-
cld_frac_soc = 0.
reff_rad_soc = 0.
mmr_cl_rad_soc = 0.
@@ -1015,7 +1022,8 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
CALL socrates_interface(Time, rad_lat_soc, rad_lon_soc, soc_lw_mode, &
tg_tmp_soc, q_soc, ozone_soc, co2_soc, t_surf_for_soc, p_full_soc, p_half_soc, z_full_soc, z_half_soc, albedo_soc, coszen, rrsun, n_profile, n_layer, &
- output_heating_rate_lw, output_soc_flux_lw_down, output_soc_flux_lw_up, cld_frac_soc, reff_rad_soc, mmr_cl_rad_soc, output_soc_spectral_olr = outputted_soc_spectral_olr, t_half_level_out = t_half_out)
+ cld_frac_soc, reff_rad_soc, mmr_cl_rad_soc, &
+ output_heating_rate_lw, output_soc_flux_lw_down, output_soc_flux_lw_up, output_soc_spectral_olr = outputted_soc_spectral_olr, t_half_level_out = t_half_out)
tg_tmp_soc = tg_tmp_soc + output_heating_rate_lw*delta_t !Output heating rate in K/s, so is a temperature tendency
surf_lw_down(:,:) = REAL(output_soc_flux_lw_down(:,:, n_layer+1))
@@ -1030,7 +1038,8 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
soc_lw_mode = .FALSE.
CALL socrates_interface(Time, rad_lat_soc, rad_lon_soc, soc_lw_mode, &
tg_tmp_soc, q_soc, ozone_soc, co2_soc, t_surf_for_soc, p_full_soc, p_half_soc, z_full_soc, z_half_soc, albedo_soc, coszen, rrsun, n_profile, n_layer, &
- output_heating_rate_sw, output_soc_flux_sw_down, output_soc_flux_sw_up, cld_frac_soc, reff_rad_soc, mmr_cl_rad_soc)
+ cld_frac_soc, reff_rad_soc, mmr_cl_rad_soc, &
+ output_heating_rate_sw, output_soc_flux_sw_down, output_soc_flux_sw_up)
tg_tmp_soc = tg_tmp_soc + output_heating_rate_sw*delta_t !Output heating rate in K/s, so is a temperature tendency
net_surf_sw_down(:,:) = REAL(output_soc_flux_sw_down(:,:, n_layer+1)-output_soc_flux_sw_up(:,:,n_layer+1) )
diff --git a/src/atmos_spectral/driver/solo/idealized_moist_phys.F90 b/src/atmos_spectral/driver/solo/idealized_moist_phys.F90
index 9447ef20d..43bfcebe0 100644
--- a/src/atmos_spectral/driver/solo/idealized_moist_phys.F90
+++ b/src/atmos_spectral/driver/solo/idealized_moist_phys.F90
@@ -763,7 +763,7 @@ subroutine idealized_moist_phys_init(Time, Time_step_in, nhum, rad_lon_2d, rad_l
endif
#else
if (do_socrates_radiation) then
- call socrates_init(is, ie, js, je, num_levels, axes, Time, rad_lat, rad_lonb_2d, rad_latb_2d, Time_step_in)
+ call socrates_init(is, ie, js, je, num_levels, axes, Time, rad_lat, rad_lonb_2d, rad_latb_2d, Time_step_in, do_cloud_simple)
endif
#endif
From 9fc8194b1b7e8f9c009db0bec8facd48ec038e94 Mon Sep 17 00:00:00 2001
From: sit23
Date: Fri, 7 Sep 2018 14:35:51 +0100
Subject: [PATCH 050/304] Initialised zeros array and getting seg-faults when
ice fraction is not 1.
---
src/atmos_param/socrates/interface/socrates_calc.F90 | 6 ++++--
src/atmos_param/socrates/interface/socrates_interface.F90 | 2 +-
src/atmos_param/socrates/interface/socrates_set_cld.F90 | 1 +
src/atmos_spectral/driver/solo/idealized_moist_phys.F90 | 6 +++++-
4 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/src/atmos_param/socrates/interface/socrates_calc.F90 b/src/atmos_param/socrates/interface/socrates_calc.F90
index ab545635e..b36e0ff7e 100644
--- a/src/atmos_param/socrates/interface/socrates_calc.F90
+++ b/src/atmos_param/socrates/interface/socrates_calc.F90
@@ -161,7 +161,7 @@ subroutine socrates_calc(Time_diag,control, spectrum,
!DIAG Diagnostic
logical :: used
-real(r_def) :: zeros_cld(n_profile, n_layer)
+real(r_def) :: zeros_cld(n_profile, n_layer), ten_microns_cld(n_profile, n_layer)
call set_control(control)
@@ -178,9 +178,11 @@ subroutine socrates_calc(Time_diag,control, spectrum,
! call set_cld(control, dimen, spectrum, cld, n_profile)
+ zeros_cld = 0.
+ ten_microns_cld = 1.
call set_cld(cld, control, dimen, spectrum, n_profile, n_layer, &
liq_frac = cld_frac, &
- ice_frac = zeros_cld, &
+ ice_frac = ten_microns_cld, &
liq_mmr = mmr_cl_rad, &
ice_mmr = zeros_cld, &
liq_dim = reff_rad, &
diff --git a/src/atmos_param/socrates/interface/socrates_interface.F90 b/src/atmos_param/socrates/interface/socrates_interface.F90
index 7f9890cdc..e8e8431cb 100644
--- a/src/atmos_param/socrates/interface/socrates_interface.F90
+++ b/src/atmos_param/socrates/interface/socrates_interface.F90
@@ -984,7 +984,7 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
reff_rad_soc = REAL(reff_rad, kind(r_def))
qcl_rad_soc = REAL(qcl_rad, kind(r_def))
- mmr_cl_rad_soc = qcl_rad_soc / (1.0 - qcl_rad_soc)
+ mmr_cl_rad_soc = qcl_rad_soc / (1.0 - qcl_rad_soc) !check if qcl is indeed specific humidity and not mmr
elseif(do_cloud_simple.and..not.account_for_clouds_in_socrates) then
diff --git a/src/atmos_param/socrates/interface/socrates_set_cld.F90 b/src/atmos_param/socrates/interface/socrates_set_cld.F90
index d98b215a6..99fd4a30e 100644
--- a/src/atmos_param/socrates/interface/socrates_set_cld.F90
+++ b/src/atmos_param/socrates/interface/socrates_set_cld.F90
@@ -482,6 +482,7 @@ subroutine set_cld(cld, control, dimen, spectrum, n_profile, n_layer, &
if (cld%w_cloud(l, k) > min_cloud_fraction) then
do j=1, cld%n_cloud_type
cld%frac_cloud(l, k, j) = cld%frac_cloud(l, k, j) / cld%w_cloud(l, k)
+ ! write(6,*) cld%frac_cloud(l, k, j) / cld%w_cloud(l, k), cld%frac_cloud(l, k, j) , cld%w_cloud(l, k), 'div?', cld%n_cloud_type
end do
else
cld%w_cloud(l, k) = 0.0_r_def
diff --git a/src/atmos_spectral/driver/solo/idealized_moist_phys.F90 b/src/atmos_spectral/driver/solo/idealized_moist_phys.F90
index 43bfcebe0..1bdae6cdd 100644
--- a/src/atmos_spectral/driver/solo/idealized_moist_phys.F90
+++ b/src/atmos_spectral/driver/solo/idealized_moist_phys.F90
@@ -1125,7 +1125,11 @@ subroutine idealized_moist_phys(Time, p_half, p_full, z_half, z_full, ug, vg, tg
#else
if (do_socrates_radiation) then
! Socrates interface
-
+
+ if(do_cloud_simple) then
+ reff_rad = 1.e-6 * reff_rad ! Simple cloud scheme outputs radii in microns. Socrates expects it in metres.
+ endif
+
call run_socrates(Time, Time+Time_step, rad_lat, rad_lon, tg(:,:,:,previous), grid_tracers(:,:,:,previous,nsphum), t_surf(:,:), p_full(:,:,:,current), &
p_half(:,:,:,current),z_full(:,:,:,current),z_half(:,:,:,current), albedo, dt_tg(:,:,:), net_surf_sw_down(:,:), surf_lw_down(:,:), delta_t, do_cloud_simple, cf_rad(:,:,:), reff_rad(:,:,:), &
qcl_rad(:,:,:) )
From 936a20d55f8cf798210a21eabde1d143bd43fe3d Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Wed, 12 Sep 2018 11:15:32 +0100
Subject: [PATCH 051/304] Update debugging flag to get socrities to compile
---
src/extra/python/isca/templates/mkmf.template.debug | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/extra/python/isca/templates/mkmf.template.debug b/src/extra/python/isca/templates/mkmf.template.debug
index 15afb1696..45d7e20a3 100644
--- a/src/extra/python/isca/templates/mkmf.template.debug
+++ b/src/extra/python/isca/templates/mkmf.template.debug
@@ -19,7 +19,7 @@ NETCDF_LIBS = `nc-config --libs`
# This suppresses the warning: `warning #6843: A dummy argument with an explicit INTENT(OUT) declaration is not given an explicit value.` of which
# there are a lot of instances in the GFDL codebase.
FFLAGS_DEBUG = -check -check noarg_temp_created -check nopointer -warn -warn noerrors -debug variable_locations -inline_debug_info -fpe0 -traceback -ftrapuv
-FFLAGS = $(CPPFLAGS) -fpp -stack_temps -safe-cray-ptr -ftz -i_dynamic -assume byterecl -g -i4 -r8 -diag-disable 6843 -fpic $(FFLAGS_DEBUG)
+FFLAGS = $(CPPFLAGS) -fpp -stack_temps -safe-cray-ptr -ftz -i_dynamic -assume byterecl -g -i4 -r8 -diag-disable 6843 -mcmodel large $(FFLAGS_DEBUG)
FC = $(F90)
LD = $(F90) $(NETCDF_LIBS)
#CC = mpicc
From 9cb7896ccdce68bb80bcc33fae56813142aae6bf Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Wed, 12 Sep 2018 11:16:31 +0100
Subject: [PATCH 052/304] Minor changes to soc test case for debugging.
---
.../socrates_test/socrates_aquaplanet.py | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/exp/test_cases/socrates_test/socrates_aquaplanet.py b/exp/test_cases/socrates_test/socrates_aquaplanet.py
index 41b77bc33..39022addb 100644
--- a/exp/test_cases/socrates_test/socrates_aquaplanet.py
+++ b/exp/test_cases/socrates_test/socrates_aquaplanet.py
@@ -5,7 +5,7 @@
from isca import SocratesCodeBase, DiagTable, Experiment, Namelist, GFDL_BASE
from isca.util import exp_progress
-NCORES = 16
+NCORES = 1
base_dir = os.path.dirname(os.path.realpath(__file__))
# a CodeBase can be a directory on the computer,
# useful for iterative development
@@ -95,6 +95,7 @@
'use_pressure_interp_for_half_levels':False,
'tidally_locked':False,
#'solday': 90
+ 'account_for_clouds_in_socrates': True,
},
'idealized_moist_phys_nml': {
'do_damping': True,
@@ -115,10 +116,7 @@
'simple_cca':0.0,
'rhcsfc': 0.95,
'rhc700': 0.7,
- 'rhc200': 0.3,
- 'rhmsfc': 0.95,
- 'rhm700': 0.7,
- 'rhm200': 0.3,
+ 'rhc200': 0.3
},
'vert_turb_driver_nml': {
@@ -165,8 +163,9 @@
},
'sat_vapor_pres_nml': {
- 'do_simple':True
- },
+ 'do_simple':True,
+ 'construct_table_wrt_liq_and_ice':True
+ },
'damping_driver_nml': {
'do_rayleigh': True,
@@ -208,9 +207,9 @@
#Lets do a run!
if __name__=="__main__":
- cb.compile()
+ cb.compile(debug=True)
#Set up the experiment object, with the first argument being the experiment name.
#This will be the name of the folder that the data will appear in.
exp.run(1, use_restart=False, num_cores=NCORES, overwrite_data=False)
for i in range(2,121):
- exp.run(i, num_cores=NCORES)
+ exp.run(i, num_cores=NCORES)
\ No newline at end of file
From 46ef7a82ee990ab258710340574b9c6a8d1074dd Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Wed, 12 Sep 2018 16:42:36 +0100
Subject: [PATCH 053/304] Remove debug and account for clouds flag
---
exp/test_cases/socrates_test/socrates_aquaplanet.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/exp/test_cases/socrates_test/socrates_aquaplanet.py b/exp/test_cases/socrates_test/socrates_aquaplanet.py
index 39022addb..f99f664b8 100644
--- a/exp/test_cases/socrates_test/socrates_aquaplanet.py
+++ b/exp/test_cases/socrates_test/socrates_aquaplanet.py
@@ -5,7 +5,7 @@
from isca import SocratesCodeBase, DiagTable, Experiment, Namelist, GFDL_BASE
from isca.util import exp_progress
-NCORES = 1
+NCORES = 16
base_dir = os.path.dirname(os.path.realpath(__file__))
# a CodeBase can be a directory on the computer,
# useful for iterative development
@@ -109,7 +109,7 @@
'two_stream_gray': False, #Use the grey radiation scheme
'do_socrates_radiation': True,
'convection_scheme': 'SIMPLE_BETTS_MILLER', #Use simple Betts miller convection
- 'do_cloud_simple': True,
+ 'do_cloud_simple': True
},
'cloud_simple_nml': {
From feb0cd8cbb3c7341e373e3423bf64abf1272936d Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Wed, 12 Sep 2018 16:43:53 +0100
Subject: [PATCH 054/304] Socrates is not working properly with idb. Break
points not behaving logically. Cant confirm the compile is working properly
---
src/extra/python/isca/templates/mkmf.template.debug | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/extra/python/isca/templates/mkmf.template.debug b/src/extra/python/isca/templates/mkmf.template.debug
index 45d7e20a3..15afb1696 100644
--- a/src/extra/python/isca/templates/mkmf.template.debug
+++ b/src/extra/python/isca/templates/mkmf.template.debug
@@ -19,7 +19,7 @@ NETCDF_LIBS = `nc-config --libs`
# This suppresses the warning: `warning #6843: A dummy argument with an explicit INTENT(OUT) declaration is not given an explicit value.` of which
# there are a lot of instances in the GFDL codebase.
FFLAGS_DEBUG = -check -check noarg_temp_created -check nopointer -warn -warn noerrors -debug variable_locations -inline_debug_info -fpe0 -traceback -ftrapuv
-FFLAGS = $(CPPFLAGS) -fpp -stack_temps -safe-cray-ptr -ftz -i_dynamic -assume byterecl -g -i4 -r8 -diag-disable 6843 -mcmodel large $(FFLAGS_DEBUG)
+FFLAGS = $(CPPFLAGS) -fpp -stack_temps -safe-cray-ptr -ftz -i_dynamic -assume byterecl -g -i4 -r8 -diag-disable 6843 -fpic $(FFLAGS_DEBUG)
FC = $(F90)
LD = $(F90) $(NETCDF_LIBS)
#CC = mpicc
From e06702d9d994d4cf5458d98695fc8c5906386900 Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Wed, 12 Sep 2018 16:44:27 +0100
Subject: [PATCH 055/304] Removed additional unused files in order to get code
to compile for using simple clouds and soc
---
src/extra/model/socrates/path_names | 91 -----------------------------
1 file changed, 91 deletions(-)
diff --git a/src/extra/model/socrates/path_names b/src/extra/model/socrates/path_names
index 7ec1ee810..1a143cb31 100644
--- a/src/extra/model/socrates/path_names
+++ b/src/extra/model/socrates/path_names
@@ -329,89 +329,6 @@ atmos_param/socrates/src/trunk/src/radiance_core/monochromatic_radiance.F90
atmos_param/socrates/src/trunk/src/radiance_core/aggregate_cloud.F90
atmos_param/socrates/src/trunk/src/radiance_core/radiance_calc.F90
atmos_param/socrates/src/trunk/src/radiance_core/ir_source.F90
-atmos_param/socrates/src/trunk/src/scatter/conjugate_gradient_cloud_90.f90
-atmos_param/socrates/src/trunk/src/scatter/method_weight_pcf.f90
-atmos_param/socrates/src/trunk/src/scatter/select_weight_scatter_90.f90
-atmos_param/socrates/src/trunk/src/scatter/measure_particle_pcf.f90
-atmos_param/socrates/src/trunk/src/scatter/prec_integral_tcf.f90
-atmos_param/socrates/src/trunk/src/scatter/def_s_scat_prop.f90
-atmos_param/socrates/src/trunk/src/scatter/db_scatter_integral.f90
-atmos_param/socrates/src/trunk/src/scatter/weightings_90.f90
-atmos_param/socrates/src/trunk/src/scatter/def_db_ss_mono.f90
-atmos_param/socrates/src/trunk/src/scatter/cloud_fitting.f90
-atmos_param/socrates/src/trunk/src/scatter/shape_particle_pcf.f90
-atmos_param/socrates/src/trunk/src/scatter/number_particle_90.f90
-atmos_param/socrates/src/trunk/src/scatter/db_interp_ss_mono.f90
-atmos_param/socrates/src/trunk/src/scatter/db_read_single_wavelength.f90
-atmos_param/socrates/src/trunk/src/scatter/get_refract_index.f90
-atmos_param/socrates/src/trunk/src/scatter/read_scatter_block_90.f90
-atmos_param/socrates/src/trunk/src/scatter/proj_area_particle.f90
-atmos_param/socrates/src/trunk/src/scatter/line_search_cloud_90.f90
-atmos_param/socrates/src/trunk/src/scatter/volume_particle.f90
-atmos_param/socrates/src/trunk/src/scatter/distribution_pcf.f90
-atmos_param/socrates/src/trunk/src/scatter/size_integral_90.f90
-atmos_param/socrates/src/trunk/src/scatter/particle_size_90.f90
-atmos_param/socrates/src/trunk/src/scatter/max_size_acf.f90
-atmos_param/socrates/src/trunk/src/scatter/write_average_90.f90
-atmos_param/socrates/src/trunk/src/scatter/adt_mitchell96.f90
-atmos_param/socrates/src/trunk/src/scatter/get_db_wavelengths.f90
-atmos_param/socrates/src/trunk/src/scatter/decompose_phf_90.f90
-atmos_param/socrates/src/trunk/src/scatter/cloud_fit_parm_acf.f90
-atmos_param/socrates/src/trunk/src/scatter/cloud_fit_90.f90
-atmos_param/socrates/src/trunk/src/scatter/ice_db_read_geometry.f90
-atmos_param/socrates/src/trunk/src/scatter/def_sct_db.f90
-atmos_param/socrates/src/trunk/src/scatter/open_average_90.f90
-atmos_param/socrates/src/trunk/src/scatter/def_size_dist.f90
-atmos_param/socrates/src/trunk/src/scatter/parm_integ_acf.f90
-atmos_param/socrates/src/trunk/src/scatter/bna_factor_ccf.f90
-atmos_param/socrates/src/trunk/src/scatter/def_db_crystal_geometry.f90
-atmos_param/socrates/src/trunk/src/scatter/get_wavelengths.f90
-atmos_param/socrates/src/trunk/src/scatter/weightings_single_90.f90
-atmos_param/socrates/src/trunk/src/scatter/scatter_algorithm_pcf.f90
-atmos_param/socrates/src/trunk/src/scatter/db_type_ucf.f90
-atmos_param/socrates/src/trunk/src/scatter/scatter_integral_90.f90
-atmos_param/socrates/src/trunk/src/correlated_k/voigt_profile.f90
-atmos_param/socrates/src/trunk/src/correlated_k/adjust_path.f90
-atmos_param/socrates/src/trunk/src/correlated_k/func_scale_90.f90
-atmos_param/socrates/src/trunk/src/correlated_k/read_pt_line_90.f90
-atmos_param/socrates/src/trunk/src/correlated_k/set_condition_ck_90.f90
-atmos_param/socrates/src/trunk/src/correlated_k/caviar_continuum_v1_0.f90
-atmos_param/socrates/src/trunk/src/correlated_k/rad_weight_90.f90
-atmos_param/socrates/src/trunk/src/correlated_k/select_weight_ck_90.f90
-atmos_param/socrates/src/trunk/src/correlated_k/trans_k_dist.f90
-atmos_param/socrates/src/trunk/src/correlated_k/type_residual_pcf.f90
-atmos_param/socrates/src/trunk/src/correlated_k/map_shell.f90
-atmos_param/socrates/src/trunk/src/correlated_k/terminate_scale_90.f90
-atmos_param/socrates/src/trunk/src/correlated_k/ckd_continuum_v2_4.f90
-atmos_param/socrates/src/trunk/src/correlated_k/write_fit_90.f90
-atmos_param/socrates/src/trunk/src/correlated_k/ck_parm_acf.f90
-atmos_param/socrates/src/trunk/src/correlated_k/fit_parabola_90.f90
-atmos_param/socrates/src/trunk/src/correlated_k/func_scale_derivative_90.f90
-atmos_param/socrates/src/trunk/src/correlated_k/optimal_k.f90
-atmos_param/socrates/src/trunk/src/correlated_k/open_file_out_90.f90
-atmos_param/socrates/src/trunk/src/correlated_k/residual_gradient_90.f90
-atmos_param/socrates/src/trunk/src/correlated_k/scale_ck_fit_90.f90
-atmos_param/socrates/src/trunk/src/correlated_k/read_ref_pt_90.f90
-atmos_param/socrates/src/trunk/src/correlated_k/corr_k_single.f90
-atmos_param/socrates/src/trunk/src/correlated_k/planck_90.f90
-atmos_param/socrates/src/trunk/src/correlated_k/exponent_fit_90.f90
-atmos_param/socrates/src/trunk/src/correlated_k/conjugate_gradient_90.f90
-atmos_param/socrates/src/trunk/src/correlated_k/line_prof_corr_mod.f90
-atmos_param/socrates/src/trunk/src/correlated_k/set_extern_ckd_frn_data.f90
-atmos_param/socrates/src/trunk/src/correlated_k/set_g_point_90.f90
-atmos_param/socrates/src/trunk/src/correlated_k/bi_interp.f90
-atmos_param/socrates/src/trunk/src/correlated_k/residual_trans_90.f90
-atmos_param/socrates/src/trunk/src/correlated_k/set_extern_ckd_self_data.f90
-atmos_param/socrates/src/trunk/src/correlated_k/line_search_90.f90
-atmos_param/socrates/src/trunk/src/correlated_k/read_hitran.f90
-atmos_param/socrates/src/trunk/src/correlated_k/read_nc.f90
-atmos_param/socrates/src/trunk/src/correlated_k/ckd_extern_data.f90
-atmos_param/socrates/src/trunk/src/correlated_k/def_hitran_record.f90
-atmos_param/socrates/src/trunk/src/correlated_k/d_planck_90.f90
-atmos_param/socrates/src/trunk/src/correlated_k/scale_parameters_acf.f90
-atmos_param/socrates/src/trunk/src/correlated_k/offset_residual_trans_acf.f90
-atmos_param/socrates/src/trunk/src/correlated_k/hitran_cnst.f90
-atmos_param/socrates/src/trunk/src/correlated_k/ck_fit_pcf.f90
atmos_param/socrates/src/trunk/src/aux/qsat_wat.F90
atmos_param/socrates/src/trunk/src/aux/qsat_gill.F90
atmos_param/socrates/src/trunk/src/aux/write_cdf.f90
@@ -434,7 +351,6 @@ atmos_param/socrates/src/trunk/src/general/make_block_18.f90
atmos_param/socrates/src/trunk/src/general/remove_negative_gas_90.f90
atmos_param/socrates/src/trunk/src/general/make_block_17.f90
atmos_param/socrates/src/trunk/src/general/make_block_1.f90
-atmos_param/socrates/src/trunk/src/general/solar_intensity_90.f90
atmos_param/socrates/src/trunk/src/general/make_block_19.f90
atmos_param/socrates/src/trunk/src/general/make_block_0.f90
atmos_param/socrates/src/trunk/src/general/make_block_10.f90
@@ -484,8 +400,6 @@ atmos_param/socrates/src/trunk/src/radiation_control/set_moist_aerosol_propertie
atmos_param/socrates/src/trunk/src/radiation_control/mcica_mod.F90
atmos_param/socrates/src/trunk/src/radiation_control/cld_generator_mod.F90
atmos_param/socrates/src/trunk/src/radiation_control/open_cloud_gen.F90
-atmos_param/socrates/src/trunk/src/um/out_nml.f90
-atmos_param/socrates/src/trunk/src/um/def_um_nml.f90
atmos_param/socrates/src/trunk/src/modules_core/errormessagelength_mod.F90
atmos_param/socrates/src/trunk/src/modules_core/dimensions_spec_ucf.F90
atmos_param/socrates/src/trunk/src/modules_core/rad_ccf.F90
@@ -497,11 +411,6 @@ atmos_param/socrates/src/trunk/src/modules_core/vectlib_mod.F90
atmos_param/socrates/src/trunk/src/modules_core/ereport_mod.F90
atmos_param/socrates/src/trunk/src/modules_core/realtype_rd.f90
atmos_param/socrates/src/trunk/src/modules_core/filenamelength_mod.F90
-atmos_param/socrates/src/trunk/src/scatter/grow_particles.f
-atmos_param/socrates/src/trunk/src/scatter/mie_scatter.f
-atmos_param/socrates/src/trunk/src/scatter/adt_integral.f
-atmos_param/socrates/src/trunk/src/scatter/gamma_fnc.f
-atmos_param/socrates/src/trunk/src/scatter/refractive_index.f
atmos_param/socrates/src/trunk/src/aux/output_vert_cdl.f
atmos_param/socrates/src/trunk/src/aux/assign_input_opt_cdf.f
atmos_param/socrates/src/trunk/src/aux/assign_input_ss_cdl.f
From a002601d3894339ef7607eee09fd64143fa043f3 Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Wed, 12 Sep 2018 16:44:51 +0100
Subject: [PATCH 056/304] Initialise variables and cleaning debug statements
---
.../driver/solo/idealized_moist_phys.F90 | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/atmos_spectral/driver/solo/idealized_moist_phys.F90 b/src/atmos_spectral/driver/solo/idealized_moist_phys.F90
index 1bdae6cdd..b9815c0d8 100644
--- a/src/atmos_spectral/driver/solo/idealized_moist_phys.F90
+++ b/src/atmos_spectral/driver/solo/idealized_moist_phys.F90
@@ -809,7 +809,6 @@ subroutine idealized_moist_phys(Time, p_half, p_full, z_half, z_full, ug, vg, tg
real, dimension(1,1,1):: tracer, tracertnd
integer :: nql, nqi, nqa ! tracer indices for stratiform clouds
-real :: tmp1, tmp2 !remove tmp1 and tmp2 after debugging
if(current == previous) then
delta_t = dt_real
@@ -970,6 +969,12 @@ subroutine idealized_moist_phys(Time, p_half, p_full, z_half, z_full, ug, vg, tg
! Call the simple cloud scheme in line with SPOOKIE-2 requirements
! Using start of time step variables
! using soecific humidity NOT mixing ratios
+
+ !Set to zero regarles of if clouds are used in radiation code
+ cf_rad = 0.
+ reff_rad = 0.
+ qcl_rad = 0.
+
if(do_cloud_simple) then
call cloud_simple(p_half(:,:,:,current), p_full(:,:,:,current), &
@@ -983,11 +988,6 @@ subroutine idealized_moist_phys(Time, p_half, p_full, z_half, z_full, ug, vg, tg
endif
-! write(6,*) minval(cf_rad), maxval(cf_rad), minval(reff_rad), maxval(reff_rad), minval(qcl_rad), maxval(qcl_rad)
-
-tmp1 = maxval(reff_rad)
-tmp2 = maxval(cf_rad)
-
! Begin the radiation calculation by computing downward fluxes.
! This part of the calculation does not depend on the surface temperature.
From 9ec6c51ae547dbf57097a2f399a1984fa0789e65 Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Wed, 12 Sep 2018 16:45:15 +0100
Subject: [PATCH 057/304] Remove account for cloud flag from namelist
---
src/atmos_param/socrates/interface/read_control.F90 | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/src/atmos_param/socrates/interface/read_control.F90 b/src/atmos_param/socrates/interface/read_control.F90
index 92d5eeefb..755a10357 100644
--- a/src/atmos_param/socrates/interface/read_control.F90
+++ b/src/atmos_param/socrates/interface/read_control.F90
@@ -9,13 +9,15 @@ MODULE read_control_mod
! Subroutine to set input algorithmic options for the core radiation code
!------------------------------------------------------------------------------
-SUBROUTINE read_control(control, spectrum)
+SUBROUTINE read_control(control, spectrum, do_cloud_simple)
USE rad_pcf
USE def_control, ONLY: StrCtrl, allocate_control
USE def_spectrum, ONLY: StrSpecData
-USE socrates_config_mod, ONLY: l_planet_grey_surface, inc_h2o, inc_co2, inc_co, inc_o3, inc_n2o, inc_ch4, inc_o2, inc_so2, inc_cfc11, inc_cfc12, inc_cfc113, inc_hcfc22, inc_hfc134a, account_for_clouds_in_socrates
+USE socrates_config_mod, ONLY: l_planet_grey_surface, inc_h2o, inc_co2, inc_co, &
+ inc_o3, inc_n2o, inc_ch4, inc_o2, inc_so2, inc_cfc11, &
+ inc_cfc12, inc_cfc113, inc_hcfc22, inc_hfc134a
IMPLICIT NONE
@@ -26,6 +28,10 @@ SUBROUTINE read_control(control, spectrum)
! Spectral data:
TYPE (StrSpecData), INTENT(IN) :: spectrum
+LOGICAL, INTENT(IN), OPTIONAL :: do_cloud_simple
+
+
+
! Local variables.
INTEGER :: i
! Loop variable
@@ -93,7 +99,7 @@ SUBROUTINE read_control(control, spectrum)
control%i_gas_overlap = ip_overlap_k_eqv_scl
! Properties of clouds
-if (account_for_clouds_in_socrates) then
+if (do_cloud_simple) then
control%i_cloud_representation = ip_cloud_ice_water
else
control%i_cloud_representation = ip_cloud_off
From 1aab14467e4e330ce8b201723e0adb4c6305ec6f Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Wed, 12 Sep 2018 16:45:47 +0100
Subject: [PATCH 058/304] Was using 1 micron as a work around for debugging.
Should be zero
---
src/atmos_param/socrates/interface/socrates_calc.F90 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/atmos_param/socrates/interface/socrates_calc.F90 b/src/atmos_param/socrates/interface/socrates_calc.F90
index b36e0ff7e..0fd98b578 100644
--- a/src/atmos_param/socrates/interface/socrates_calc.F90
+++ b/src/atmos_param/socrates/interface/socrates_calc.F90
@@ -182,7 +182,7 @@ subroutine socrates_calc(Time_diag,control, spectrum,
ten_microns_cld = 1.
call set_cld(cld, control, dimen, spectrum, n_profile, n_layer, &
liq_frac = cld_frac, &
- ice_frac = ten_microns_cld, &
+ ice_frac = zeros_cld, &
liq_mmr = mmr_cl_rad, &
ice_mmr = zeros_cld, &
liq_dim = reff_rad, &
From 5912e474af6aea15c6dd0879897866a5089c42ce Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Wed, 12 Sep 2018 16:47:19 +0100
Subject: [PATCH 059/304] File cleaning. Changes to fix seg fault which
originated due to flipped pressure levels. Removed account for clouds.
---
.../interface/socrates_config_mod.f90 | 3 -
.../socrates/interface/socrates_interface.F90 | 95 ++++++++++---------
2 files changed, 49 insertions(+), 49 deletions(-)
diff --git a/src/atmos_param/socrates/interface/socrates_config_mod.f90 b/src/atmos_param/socrates/interface/socrates_config_mod.f90
index 249e4035b..085fa5f80 100644
--- a/src/atmos_param/socrates/interface/socrates_config_mod.f90
+++ b/src/atmos_param/socrates/interface/socrates_config_mod.f90
@@ -42,8 +42,6 @@ module socrates_config_mod
logical :: use_pressure_interp_for_half_levels = .False. !By default (.False.) does linear interpolation in height for half-level temperatures. True does linear interp using pressure.
- logical :: account_for_clouds_in_socrates = .false. !Do we want to account for the radiative effects of clouds in socrates?
-
! Incoming radiation options for namelist
integer :: solday=0 ! if >0, do perpetual run corresponding to day of the year = solday \in [0,days per year]
@@ -131,5 +129,4 @@ module socrates_config_mod
use_pressure_interp_for_half_levels, &
frierson_solar_rad, del_sol, del_sw, &
account_for_clouds_in_socrates
-
end module socrates_config_mod
diff --git a/src/atmos_param/socrates/interface/socrates_interface.F90 b/src/atmos_param/socrates/interface/socrates_interface.F90
index e8e8431cb..5c3893567 100644
--- a/src/atmos_param/socrates/interface/socrates_interface.F90
+++ b/src/atmos_param/socrates/interface/socrates_interface.F90
@@ -118,18 +118,6 @@ SUBROUTINE socrates_init(is, ie, js, je, num_levels, axes, Time, lat, lonb, latb
!Initialise astronomy
call astronomy_init
- if(do_cloud_simple.and..not.account_for_clouds_in_socrates) then
-
- call error_mesg( 'run_socrates', &
- 'do_cloud_simple is True but account_for_clouds_in_socrates is False. Radiative effects of clouds NOT accounted for', WARNING)
-
- elseif(.not.do_cloud_simple.and.account_for_clouds_in_socrates) then
-
- call error_mesg( 'run_socrates', &
- 'do_cloud_simple is False but account_for_clouds_in_socrates is True. Radiative effects of clouds NOT accounted for', WARNING)
-
- endif
-
!Initialise variables related to radiation timestep
call get_time(delta_t_atmos,time_step_seconds)
@@ -210,10 +198,10 @@ SUBROUTINE socrates_init(is, ie, js, je, num_levels, axes, Time, lat, lonb, latb
CALL read_spectrum(control_sw_hires%spectral_file,spectrum_sw_hires)
! Set Socrates configuration
- CALL read_control(control_lw,spectrum_lw)
- CALL read_control(control_lw_hires,spectrum_lw_hires)
- CALL read_control(control_sw,spectrum_sw)
- CALL read_control(control_sw_hires,spectrum_sw_hires)
+ CALL read_control(control_lw,spectrum_lw, do_cloud_simple)
+ CALL read_control(control_lw_hires,spectrum_lw_hires, do_cloud_simple)
+ CALL read_control(control_sw,spectrum_sw, do_cloud_simple)
+ CALL read_control(control_sw_hires,spectrum_sw_hires, do_cloud_simple)
! Specify LW and SW setups
control_sw%isolir=1
@@ -444,9 +432,15 @@ end subroutine socrates_init
! Set up the call to the Socrates radiation scheme
! -----------------------------------------------------------------------------
subroutine socrates_interface(Time_diag, rlat, rlon, soc_lw_mode, &
- fms_temp, fms_spec_hum, fms_ozone, fms_co2, fms_t_surf, fms_p_full, fms_p_half, fms_z_full, fms_z_half, fms_albedo, fms_coszen, fms_rrsun, n_profile, n_layer, &
- fms_cld_frac, fms_reff_rad, fms_mmr_cl_rad, &
- output_heating_rate, output_flux_down, output_flux_up, output_soc_spectral_olr, output_flux_direct, t_half_level_out )
+ fms_temp, fms_spec_hum, fms_ozone, fms_co2, fms_t_surf, &
+ fms_p_full, fms_p_half, fms_z_full, fms_z_half, fms_albedo, &
+ fms_coszen, fms_rrsun, n_profile, n_layer, &
+ fms_cld_frac, fms_reff_rad, fms_mmr_cl_rad, &
+ output_heating_rate, output_flux_down, output_flux_up, &
+ do_cloud_simple, &
+ !optionals
+ output_soc_spectral_olr, output_flux_direct, &
+ t_half_level_out )
use realtype_rd
use read_control_mod
@@ -486,10 +480,14 @@ subroutine socrates_interface(Time_diag, rlat, rlon, soc_lw_mode, &
real(r_def), intent(in) :: fms_rrsun
real(r_def), intent(in) :: fms_cld_frac(:,:,:), fms_reff_rad(:,:,:), fms_mmr_cl_rad(:,:,:)
+ logical, intent(in) :: do_cloud_simple
+
! Output arrays
real(r_def), intent(out) :: output_heating_rate(:,:,:)
real(r_def), intent(out) :: output_flux_up(:,:,:)
real(r_def), intent(out) :: output_flux_down(:,:,:)
+
+
real(r_def), intent(out), optional :: output_flux_direct(:,:,:)
real(r_def), intent(out), optional :: output_soc_spectral_olr(:,:,:)
real(r_def), intent(out), optional :: t_half_level_out(size(fms_temp,1),size(fms_temp,2),size(fms_temp,3)+1)
@@ -500,13 +498,15 @@ subroutine socrates_interface(Time_diag, rlat, rlon, soc_lw_mode, &
REAL :: soc_spectral_olr(n_profile, size(outputted_soc_spectral_olr,3))
! Arrays to send to Socrates
- real, dimension(n_profile, n_layer) :: input_p, input_t, input_mixing_ratio, &
+ real(r_def), dimension(n_profile, n_layer) :: input_p, input_t, input_mixing_ratio, &
input_d_mass, input_density, input_layer_heat_capacity, &
soc_heating_rate, input_o3_mixing_ratio, &
- input_co2_mixing_ratio,z_full_reshaped
- real, dimension(n_profile, 0:n_layer) :: input_p_level, input_t_level, soc_flux_direct, &
- soc_flux_down, soc_flux_up, z_half_reshaped, input_cld_frac, input_reff_rad, input_mmr_cl_rad
- real, dimension(n_profile) :: input_t_surf, input_cos_zenith_angle, input_solar_irrad, &
+ input_co2_mixing_ratio,z_full_reshaped, input_cld_frac, input_reff_rad, input_mmr_cl_rad
+
+ real(r_def), dimension(n_profile, 0:n_layer) :: input_p_level, input_t_level, soc_flux_direct, &
+ soc_flux_down, soc_flux_up, z_half_reshaped
+
+ real(r_def), dimension(n_profile) :: input_t_surf, input_cos_zenith_angle, input_solar_irrad, &
input_orog_corr, input_planet_albedo
@@ -533,7 +533,7 @@ subroutine socrates_interface(Time_diag, rlat, rlon, soc_lw_mode, &
!----------------------------i
! Set array sizes
- input_n_cloud_layer = n_layer
+ input_n_cloud_layer = 1
input_n_aer_mode = n_layer
input_cld_subcol_gen = n_layer
input_cld_subcol_req = n_layer
@@ -615,7 +615,7 @@ subroutine socrates_interface(Time_diag, rlat, rlon, soc_lw_mode, &
! Test if LW or SW mode
if (soc_lw_mode == .TRUE.) then
control_lw%isolir = 2
- CALL read_control(control_lw, spectrum_lw)
+ CALL read_control(control_lw, spectrum_lw, do_cloud_simple)
if (socrates_hires_mode == .FALSE.) then
control_calc = control_lw
spectrum_calc = spectrum_lw
@@ -626,7 +626,7 @@ subroutine socrates_interface(Time_diag, rlat, rlon, soc_lw_mode, &
else
control_sw%isolir = 1
- CALL read_control(control_sw, spectrum_sw)
+ CALL read_control(control_sw, spectrum_sw, do_cloud_simple)
if(socrates_hires_mode == .FALSE.) then
control_calc = control_sw
spectrum_calc = spectrum_sw
@@ -639,7 +639,7 @@ subroutine socrates_interface(Time_diag, rlat, rlon, soc_lw_mode, &
! Do calculation
- CALL read_control(control_calc, spectrum_calc)
+ CALL read_control(control_calc, spectrum_calc, do_cloud_simple)
n_chunk_loop = (si*sj)/chunk_size
n_profile_chunk = n_profile / n_chunk_loop
@@ -979,21 +979,14 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
endif
- if(do_cloud_simple.and.account_for_clouds_in_socrates) then
+ if(do_cloud_simple) then
cld_frac_soc = REAL(cf_rad, kind(r_def))
reff_rad_soc = REAL(reff_rad, kind(r_def))
qcl_rad_soc = REAL(qcl_rad, kind(r_def))
mmr_cl_rad_soc = qcl_rad_soc / (1.0 - qcl_rad_soc) !check if qcl is indeed specific humidity and not mmr
- elseif(do_cloud_simple.and..not.account_for_clouds_in_socrates) then
-
- cld_frac_soc = 0.
- reff_rad_soc = 0.
- mmr_cl_rad_soc = 0.
-
- elseif(.not.do_cloud_simple.and.account_for_clouds_in_socrates) then
-
+ else
cld_frac_soc = 0.
reff_rad_soc = 0.
mmr_cl_rad_soc = 0.
@@ -1003,7 +996,6 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
n_profile = INT(size(temp_in,2)*size(temp_in,1), kind(i_def))
n_layer = INT(size(temp_in,3), kind(i_def))
t_surf_for_soc = REAL(t_surf_in(:,:), kind(r_def))
-
! LW calculation
! Retrieve output_heating_rate, and downward surface SW and LW fluxes
soc_lw_mode = .TRUE.
@@ -1020,10 +1012,17 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
z_full_soc = REAL(z_full_in, kind(r_def))
z_half_soc = REAL(z_half_in, kind(r_def))
- CALL socrates_interface(Time, rad_lat_soc, rad_lon_soc, soc_lw_mode, &
- tg_tmp_soc, q_soc, ozone_soc, co2_soc, t_surf_for_soc, p_full_soc, p_half_soc, z_full_soc, z_half_soc, albedo_soc, coszen, rrsun, n_profile, n_layer, &
- cld_frac_soc, reff_rad_soc, mmr_cl_rad_soc, &
- output_heating_rate_lw, output_soc_flux_lw_down, output_soc_flux_lw_up, output_soc_spectral_olr = outputted_soc_spectral_olr, t_half_level_out = t_half_out)
+
+ CALL socrates_interface(Time, rad_lat_soc, rad_lon_soc, soc_lw_mode, &
+ tg_tmp_soc, q_soc, ozone_soc, co2_soc, t_surf_for_soc, p_full_soc, &
+ p_half_soc, z_full_soc, z_half_soc, albedo_soc, coszen, rrsun, &
+ n_profile, n_layer, cld_frac_soc, reff_rad_soc, mmr_cl_rad_soc, &
+ output_heating_rate_lw, output_soc_flux_lw_down, output_soc_flux_lw_up, &
+ do_cloud_simple, &
+ !optional outs
+ output_soc_spectral_olr = outputted_soc_spectral_olr, &
+ t_half_level_out = t_half_out)
+
tg_tmp_soc = tg_tmp_soc + output_heating_rate_lw*delta_t !Output heating rate in K/s, so is a temperature tendency
surf_lw_down(:,:) = REAL(output_soc_flux_lw_down(:,:, n_layer+1))
@@ -1033,13 +1032,17 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
temp_tend(:,:,:) = temp_tend(:,:,:) + real(output_heating_rate_lw)
+
! SW calculation
! Retrieve output_heating_rate, and downward surface SW and LW fluxes
soc_lw_mode = .FALSE.
- CALL socrates_interface(Time, rad_lat_soc, rad_lon_soc, soc_lw_mode, &
- tg_tmp_soc, q_soc, ozone_soc, co2_soc, t_surf_for_soc, p_full_soc, p_half_soc, z_full_soc, z_half_soc, albedo_soc, coszen, rrsun, n_profile, n_layer, &
- cld_frac_soc, reff_rad_soc, mmr_cl_rad_soc, &
- output_heating_rate_sw, output_soc_flux_sw_down, output_soc_flux_sw_up)
+ CALL socrates_interface(Time, rad_lat_soc, rad_lon_soc, soc_lw_mode, &
+ tg_tmp_soc, q_soc, ozone_soc, co2_soc, t_surf_for_soc, p_full_soc, &
+ p_half_soc, z_full_soc, z_half_soc, albedo_soc, coszen, rrsun, &
+ n_profile, n_layer, cld_frac_soc, reff_rad_soc, mmr_cl_rad_soc, &
+ output_heating_rate_sw, output_soc_flux_sw_down, output_soc_flux_sw_up, &
+ do_cloud_simple)
+
tg_tmp_soc = tg_tmp_soc + output_heating_rate_sw*delta_t !Output heating rate in K/s, so is a temperature tendency
net_surf_sw_down(:,:) = REAL(output_soc_flux_sw_down(:,:, n_layer+1)-output_soc_flux_sw_up(:,:,n_layer+1) )
From 04ae998bdf44c7e3bacd878d7e52c809a54cf0c2 Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Wed, 12 Sep 2018 17:56:16 +0100
Subject: [PATCH 060/304] Added a with and without cloud test case for soc
---
.../socrates_test/socrates_aquaplanet.py | 15 +-
.../socrates_aquaplanet_with_cloud.py | 209 ++++++++++++++++++
2 files changed, 216 insertions(+), 8 deletions(-)
create mode 100644 exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
diff --git a/exp/test_cases/socrates_test/socrates_aquaplanet.py b/exp/test_cases/socrates_test/socrates_aquaplanet.py
index f99f664b8..c3a79572b 100644
--- a/exp/test_cases/socrates_test/socrates_aquaplanet.py
+++ b/exp/test_cases/socrates_test/socrates_aquaplanet.py
@@ -23,7 +23,7 @@
# create an Experiment object to handle the configuration of model parameters
# and output diagnostics
-exp = Experiment('soc_test_aquaplanet', codebase=cb)
+exp = Experiment('soc_test_aquaplanet_without_clouds', codebase=cb)
exp.clear_rundir()
inputfiles = [os.path.join(GFDL_BASE,'input/rrtm_input_files/ozone_1990.nc')]
@@ -60,6 +60,11 @@
diag.add_field('socrates', 'soc_toa_sw', time_avg=True)
diag.add_field('socrates', 'soc_toa_sw_down', time_avg=True)
+diag.add_field('cloud_simple', 'cf_rad', time_avg=True)
+diag.add_field('cloud_simple', 'reff_rad', time_avg=True)
+diag.add_field('cloud_simple', 'frac_liq', time_avg=True)
+diag.add_field('cloud_simple', 'qcl_rad', time_avg=True)
+
# additional output options commented out
#diag.add_field('socrates', 'soc_flux_lw', time_avg=True)
#diag.add_field('socrates', 'soc_flux_sw', time_avg=True)
@@ -109,15 +114,9 @@
'two_stream_gray': False, #Use the grey radiation scheme
'do_socrates_radiation': True,
'convection_scheme': 'SIMPLE_BETTS_MILLER', #Use simple Betts miller convection
- 'do_cloud_simple': True
+ 'do_cloud_simple': False
},
- 'cloud_simple_nml': {
- 'simple_cca':0.0,
- 'rhcsfc': 0.95,
- 'rhc700': 0.7,
- 'rhc200': 0.3
- },
'vert_turb_driver_nml': {
'do_mellor_yamada': False, # default: True
diff --git a/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
new file mode 100644
index 000000000..fa0d348fe
--- /dev/null
+++ b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
@@ -0,0 +1,209 @@
+import os
+
+import numpy as np
+
+from isca import SocratesCodeBase, DiagTable, Experiment, Namelist, GFDL_BASE
+from isca.util import exp_progress
+
+NCORES = 16
+base_dir = os.path.dirname(os.path.realpath(__file__))
+# a CodeBase can be a directory on the computer,
+# useful for iterative development
+cb = SocratesCodeBase.from_directory(GFDL_BASE)
+
+# or it can point to a specific git repo and commit id.
+# This method should ensure future, independent, reproducibility of results.
+# cb = DryCodeBase.from_repo(repo='https://github.com/isca/isca', commit='isca1.1')
+
+# compilation depends on computer specific settings. The $GFDL_ENV
+# environment variable is used to determine which `$GFDL_BASE/src/extra/env` file
+# is used to load the correct compilers. The env file is always loaded from
+# $GFDL_BASE and not the checked out git repo.
+
+# create an Experiment object to handle the configuration of model parameters
+# and output diagnostics
+
+exp = Experiment('soc_test_aquaplanet_with_clouds', codebase=cb)
+exp.clear_rundir()
+
+inputfiles = [os.path.join(GFDL_BASE,'input/rrtm_input_files/ozone_1990.nc')]
+
+#Tell model how to write diagnostics
+diag = DiagTable()
+diag.add_file('atmos_monthly', 30, 'days', time_units='days')
+
+#Tell model which diagnostics to write
+diag.add_field('dynamics', 'ps', time_avg=True)
+diag.add_field('dynamics', 'bk')
+diag.add_field('dynamics', 'pk')
+diag.add_field('atmosphere', 'precipitation', time_avg=True)
+diag.add_field('mixed_layer', 't_surf', time_avg=True)
+diag.add_field('dynamics', 'sphum', time_avg=True)
+diag.add_field('dynamics', 'ucomp', time_avg=True)
+diag.add_field('dynamics', 'vcomp', time_avg=True)
+diag.add_field('dynamics', 'temp', time_avg=True)
+diag.add_field('dynamics', 'vor', time_avg=True)
+diag.add_field('dynamics', 'div', time_avg=True)
+
+diag.add_field('socrates', 'soc_tdt_lw', time_avg=True)
+diag.add_field('socrates', 'soc_tdt_sw', time_avg=True)
+diag.add_field('socrates', 'soc_tdt_rad', time_avg=True)
+diag.add_field('socrates', 'soc_surf_flux_lw', time_avg=True)
+diag.add_field('socrates', 'soc_surf_flux_sw', time_avg=True)
+diag.add_field('socrates', 'soc_olr', time_avg=True)
+diag.add_field('socrates', 'soc_toa_sw', time_avg=True)
+diag.add_field('cloud_simple', 'cf_rad', time_avg=True)
+diag.add_field('cloud_simple', 'reff_rad', time_avg=True)
+diag.add_field('cloud_simple', 'frac_liq', time_avg=True)
+diag.add_field('cloud_simple', 'qcl_rad', time_avg=True)
+
+# additional output options commented out
+#diag.add_field('socrates', 'soc_flux_lw', time_avg=True)
+#diag.add_field('socrates', 'soc_flux_sw', time_avg=True)
+#diag.add_field('socrates', 'soc_co2', time_avg=True)
+#diag.add_field('socrates', 'soc_ozone', time_avg=True)
+#diag.add_field('socrates', 'soc_coszen', time_avg=True)
+#diag.add_field('socrates', 'soc_spectral_olr', time_avg=True)
+
+exp.diag_table = diag
+exp.inputfiles = inputfiles
+
+#Define values for the 'core' namelist
+exp.namelist = namelist = Namelist({
+ 'main_nml':{
+ 'days' : 30,
+ 'hours' : 0,
+ 'minutes': 0,
+ 'seconds': 0,
+ 'dt_atmos':600,
+ 'current_date' : [1,1,1,0,0,0],
+ 'calendar' : 'thirty_day'
+ },
+ 'socrates_rad_nml': {
+ 'stellar_constant':1370.,
+ 'lw_spectral_filename':os.path.join(GFDL_BASE,'src/atmos_param/socrates/src/trunk/data/spectra/ga7/sp_lw_ga7'),
+ 'sw_spectral_filename':os.path.join(GFDL_BASE,'src/atmos_param/socrates/src/trunk/data/spectra/ga7/sp_sw_ga7'),
+ 'do_read_ozone': True,
+ 'ozone_file_name':'ozone_1990',
+ 'ozone_field_name':'ozone_1990',
+ 'dt_rad':3600,
+ 'store_intermediate_rad':True,
+ 'chunk_size': 16,
+ 'use_pressure_interp_for_half_levels':False,
+ 'tidally_locked':False
+ },
+ 'idealized_moist_phys_nml': {
+ 'do_damping': True,
+ 'turb':True,
+ 'mixed_layer_bc':True,
+ 'do_virtual' :False,
+ 'do_simple': True,
+ 'roughness_mom':3.21e-05,
+ 'roughness_heat':3.21e-05,
+ 'roughness_moist':3.21e-05,
+ 'two_stream_gray': False, #Use the grey radiation scheme
+ 'do_socrates_radiation': True,
+ 'convection_scheme': 'SIMPLE_BETTS_MILLER', #Use simple Betts miller convection
+ 'do_cloud_simple': True
+ },
+
+ 'cloud_simple_nml': {
+ 'simple_cca':0.0,
+ 'rhcsfc': 0.95,
+ 'rhc700': 0.7,
+ 'rhc200': 0.3
+ },
+
+ 'vert_turb_driver_nml': {
+ 'do_mellor_yamada': False, # default: True
+ 'do_diffusivity': True, # default: False
+ 'do_simple': True, # default: False
+ 'constant_gust': 0.0, # default: 1.0
+ 'use_tau': False
+ },
+
+ 'diffusivity_nml': {
+ 'do_entrain':False,
+ 'do_simple': True,
+ },
+
+ 'surface_flux_nml': {
+ 'use_virtual_temp': False,
+ 'do_simple': True,
+ 'old_dtaudv': True
+ },
+
+ 'atmosphere_nml': {
+ 'idealized_moist_model': True
+ },
+
+ #Use a large mixed-layer depth, and the Albedo of the CTRL case in Jucker & Gerber, 2017
+ 'mixed_layer_nml': {
+ 'tconst' : 285.,
+ 'prescribe_initial_dist':True,
+ 'evaporation':True,
+ 'depth': 2.5, #Depth of mixed layer used
+ 'albedo_value': 0.38, #Albedo value used
+ },
+
+ 'qe_moist_convection_nml': {
+ 'rhbm':0.7,
+ 'Tmin':160.,
+ 'Tmax':350.
+ },
+
+ 'lscale_cond_nml': {
+ 'do_simple':True,
+ 'do_evap':True
+ },
+
+ 'sat_vapor_pres_nml': {
+ 'do_simple':True,
+ 'construct_table_wrt_liq_and_ice':True
+ },
+
+ 'damping_driver_nml': {
+ 'do_rayleigh': True,
+ 'trayfric': -0.5, # neg. value: time in *days*
+ 'sponge_pbottom': 150., #Setting the lower pressure boundary for the model sponge layer in Pa.
+ 'do_conserve_energy': True,
+ },
+
+ # FMS Framework configuration
+ 'diag_manager_nml': {
+ 'mix_snapshot_average_fields': False # time avg fields are labelled with time in middle of window
+ },
+
+ 'fms_nml': {
+ 'domains_stack_size': 600000 # default: 0
+ },
+
+ 'fms_io_nml': {
+ 'threading_write': 'single', # default: multi
+ 'fileset_write': 'single', # default: multi
+ },
+
+ 'spectral_dynamics_nml': {
+ 'damping_order': 4,
+ 'water_correction_limit': 200.e2,
+ 'reference_sea_level_press':1.0e5,
+ 'num_levels':40, #How many model pressure levels to use
+ 'valid_range_t':[100.,800.],
+ 'initial_sphum':[2.e-6],
+ 'vert_coord_option':'uneven_sigma',
+ 'surf_res':0.2, #Parameter that sets the vertical distribution of sigma levels
+ 'scale_heights' : 11.0,
+ 'exponent':7.0,
+ 'robert_coeff':0.03
+ },
+
+})
+
+#Lets do a run!
+if __name__=="__main__":
+
+ cb.compile(debug=False)
+ exp.run(1, use_restart=False, num_cores=NCORES, overwrite_data=True)#, run_idb=True)
+
+ for i in range(2,121):
+ exp.run(i, num_cores=NCORES)
From 699e348d4916e5d259ebddc66a02be1268a38710 Mon Sep 17 00:00:00 2001
From: sit23
Date: Thu, 6 Dec 2018 09:44:09 +0000
Subject: [PATCH 061/304] Small changes at James Manners suggestion. Changes
results A LOT, so this needs to be checked closely.
---
exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py | 2 +-
src/atmos_param/socrates/interface/set_dimen.F90 | 3 ++-
src/atmos_param/socrates/interface/socrates_interface.F90 | 2 +-
3 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
index fa0d348fe..647ec0751 100644
--- a/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
+++ b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
@@ -23,7 +23,7 @@
# create an Experiment object to handle the configuration of model parameters
# and output diagnostics
-exp = Experiment('soc_test_aquaplanet_with_clouds', codebase=cb)
+exp = Experiment('soc_test_aquaplanet_with_clouds_post_jm_suggestions', codebase=cb)
exp.clear_rundir()
inputfiles = [os.path.join(GFDL_BASE,'input/rrtm_input_files/ozone_1990.nc')]
diff --git a/src/atmos_param/socrates/interface/set_dimen.F90 b/src/atmos_param/socrates/interface/set_dimen.F90
index 4f62eb3f9..6cf8eeac8 100644
--- a/src/atmos_param/socrates/interface/set_dimen.F90
+++ b/src/atmos_param/socrates/interface/set_dimen.F90
@@ -63,7 +63,8 @@ SUBROUTINE set_dimen(control, dimen, spectrum, n_profile, n_layer, &
dimen%id_cloud_top = dimen%nd_layer + 1 - n_cloud_layer
IF (control%l_cloud) THEN
- dimen%nd_layer_clr = dimen%id_cloud_top - 1
+ dimen%nd_layer_clr = MAX(dimen%id_cloud_top - 1, dimen%nd_layer)
+ ! MAX(dimen%id_cloud_top - 1, 1)
ELSE
dimen%nd_layer_clr = dimen%nd_layer
END IF
diff --git a/src/atmos_param/socrates/interface/socrates_interface.F90 b/src/atmos_param/socrates/interface/socrates_interface.F90
index 5c3893567..5a29bbd50 100644
--- a/src/atmos_param/socrates/interface/socrates_interface.F90
+++ b/src/atmos_param/socrates/interface/socrates_interface.F90
@@ -533,7 +533,7 @@ subroutine socrates_interface(Time_diag, rlat, rlon, soc_lw_mode, &
!----------------------------i
! Set array sizes
- input_n_cloud_layer = 1
+ input_n_cloud_layer = n_layer
input_n_aer_mode = n_layer
input_cld_subcol_gen = n_layer
input_cld_subcol_req = n_layer
From 8d8a56330189c6d6d72c5c740814c742758fa6be Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Thu, 6 Dec 2018 11:22:17 +0000
Subject: [PATCH 062/304] Update suite to have more diagnostics
---
.../socrates_test/socrates_aquaplanet_with_cloud.py | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
index 647ec0751..2803f3100 100644
--- a/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
+++ b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
@@ -56,6 +56,9 @@
diag.add_field('cloud_simple', 'reff_rad', time_avg=True)
diag.add_field('cloud_simple', 'frac_liq', time_avg=True)
diag.add_field('cloud_simple', 'qcl_rad', time_avg=True)
+diag.add_field('cloud_simple', 'simple_rhcrit', time_avg=True)
+diag.add_field('cloud_simple', 'rh_in_cf', time_avg=True)
+
# additional output options commented out
#diag.add_field('socrates', 'soc_flux_lw', time_avg=True)
@@ -90,7 +93,8 @@
'store_intermediate_rad':True,
'chunk_size': 16,
'use_pressure_interp_for_half_levels':False,
- 'tidally_locked':False
+ 'tidally_locked':False,
+ 'sol_day':90
},
'idealized_moist_phys_nml': {
'do_damping': True,
From 10fcd54a2ebb290d201e9334367f49b4f562a72a Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Thu, 6 Dec 2018 11:23:24 +0000
Subject: [PATCH 063/304] Changes to simple clouds for more fields to be
outputted
---
src/atmos_param/cloud_simple/cloud_simple.F90 | 91 ++++++++++++-------
1 file changed, 56 insertions(+), 35 deletions(-)
diff --git a/src/atmos_param/cloud_simple/cloud_simple.F90 b/src/atmos_param/cloud_simple/cloud_simple.F90
index c35708ad3..ffcae1385 100644
--- a/src/atmos_param/cloud_simple/cloud_simple.F90
+++ b/src/atmos_param/cloud_simple/cloud_simple.F90
@@ -28,7 +28,9 @@ module cloud_simple_mod
rhmsfc, rhm700, rhm200
real :: zerodegc = 273.15
- integer :: id_cf_rad, id_reff_rad, id_frac_liq, id_qcl_rad
+ integer :: id_cf, id_reff_rad, id_frac_liq, id_qcl_rad, id_rh_in_cf, id_simple_rhcrit
+
+
character(len=14), parameter :: mod_name_cld = "cloud_simple"
contains
@@ -57,8 +59,8 @@ subroutine cloud_simple_init (axes, Time)
write(stdlog_unit, cloud_simple_nml)
!register diagnostics
- id_cf_rad = &
- register_diag_field ( mod_name_cld, 'cf_rad', axes(1:3), Time, &
+ id_cf = &
+ register_diag_field ( mod_name_cld, 'cf', axes(1:3), Time, &
'Cloud fraction for the simple cloud scheme', 'unitless: values 0-1')
id_frac_liq = &
@@ -76,30 +78,45 @@ subroutine cloud_simple_init (axes, Time)
'Specific humidity of cloud liquid', &
'kg/kg')
+
+ id_rh_in_cf = &
+ register_diag_field ( mod_name_cld, 'rh_in_cf', axes(1:3), Time, &
+ 'RH as a percent', &
+ '%')
+
+ id_simple_rhcrit = &
+ register_diag_field ( mod_name_cld, 'simple_rhcrit', axes(1:3), Time, &
+ 'RH as a percent', &
+ '%')
+
+
+
+
+
do_init = .false. !initialisation completed
end subroutine cloud_simple_init
!-----------------------------------------------
- subroutine cloud_simple (p_half, p_full, Time, &
- temp, q_hum, &
+ subroutine cloud_simple(p_half, p_full, Time, &
+ temp, q_hum, &
! outs
- cf_rad, reff_rad, qcl_rad )
+ cf, reff_rad, qcl_rad )
real , intent(in), dimension(:,:,:) :: temp, q_hum, p_full, p_half
type(time_type) , intent(in) :: Time
- real , intent(out), dimension(:,:,:) :: cf_rad, reff_rad, qcl_rad
+ real , intent(out), dimension(:,:,:) :: cf, reff_rad, qcl_rad
+
+ real, dimension(size(temp,1), size(temp, 2), size(temp, 3)) :: qs, frac_liq, rh_in_cf, simple_rhcrit
- real, dimension(size(temp,1), size(temp, 2), size(temp, 3)) :: qs, frac_liq
- real :: simple_rhcrit
integer :: i, j, k, k_surf
logical :: es_over_liq_and_ice
- real :: tmp1, tmp2 !remove tmp1 and tmp2 after debugging
+ real :: tmp1, tmp2 !remove tmp1 and tmp2 after debugging
!check initiation has been done - ie read in parameters
if (do_init) call error_mesg ('cloud_simple', &
@@ -117,20 +134,15 @@ subroutine cloud_simple (p_half, p_full, Time, &
!caluclate the frac_liq
call calc_liq_frac(temp(i,j,k), frac_liq(i,j,k))
call calc_reff(frac_liq(i,j,k), reff_rad(i,j,k))
- call calc_rhcrit(p_full(i,j,k), p_full(i,j,k_surf), simple_rhcrit)
- call calc_cf_rad(q_hum(i,j,k), qs(i,j,k), simple_rhcrit, cf_rad(i,j,k))
- call calc_qcl_rad(p_full(i,j,k), cf_rad(i,j,k), qcl_rad(i,j,k) )
+ call calc_rhcrit(p_full(i,j,k), p_full(i,j,k_surf), simple_rhcrit(i,j,k))
+ call calc_cf(q_hum(i,j,k), qs(i,j,k), simple_rhcrit(i,j,k), cf(i,j,k),rh_in_cf(i,j,k))
+ call calc_qcl_rad(p_full(i,j,k), cf(i,j,k), qcl_rad(i,j,k) )
end do
end do
end do
!save some diagnotics
- call output_cloud_diags(cf_rad, reff_rad, frac_liq, qcl_rad, Time )
-
-tmp2 = maxval(cf_rad)
-tmp1 = maxval(reff_rad)
-tmp2 = maxval(cf_rad)
-
+ call output_cloud_diags(cf, reff_rad, frac_liq, qcl_rad, rh_in_cf, simple_rhcrit, Time )
end subroutine cloud_simple
@@ -184,17 +196,18 @@ subroutine calc_rhcrit(p_full, p_surf, simple_rhcrit) !need to check p_full -
end subroutine calc_rhcrit
- subroutine calc_cf_rad (q_hum, qsat, simple_rhcrit, cf_rad)
+ subroutine calc_cf (q_hum, qsat, simple_rhcrit, cf, rh)
! Calculate LS (stratiform) cloud fraction
! as a simple linear function of RH
real, intent(in) :: q_hum, qsat, simple_rhcrit
- real, intent(out) :: cf_rad
+ real, intent(out) :: cf, rh
- real :: rh, cca
+ real :: cca
rh = q_hum/qsat
- cf_rad = MAX( 0.0, MIN( 1.0, ( rh - simple_rhcrit ) / ( 1.0 - simple_rhcrit ) ))
+ cf = MAX( 0.0, MIN( 1.0, ( rh - simple_rhcrit ) / ( 1.0 - simple_rhcrit ) ))
+
! include simple convective cloud fraction where present
@@ -202,17 +215,16 @@ subroutine calc_cf_rad (q_hum, qsat, simple_rhcrit, cf_rad)
! left in for fture use
if (cca > 0.0) then
- cf_rad = MAX( simple_cca, cf_rad )
+ cf = MAX( simple_cca, cf )
end if
+
-
-
- end subroutine calc_cf_rad
+ end subroutine calc_cf
- subroutine calc_qcl_rad(p_full, cf_rad, qcl_rad)
- ! calculate simple water content
+ subroutine calc_qcl_rad(p_full, cf, qcl_rad)
+ ! calculate water content
- real , intent(in) :: p_full, cf_rad
+ real , intent(in) :: p_full, cf
real , intent(out) :: qcl_rad
real :: in_cloud_qcl
@@ -222,22 +234,22 @@ subroutine calc_qcl_rad(p_full, cf_rad, qcl_rad)
in_cloud_qcl = MAX ( 0.0, in_cloud_qcl/1000.0 ) ! convert to kg/kg
- qcl_rad = cf_rad * in_cloud_qcl
+ qcl_rad = cf * in_cloud_qcl
end subroutine calc_qcl_rad
- subroutine output_cloud_diags(cf_rad, reff_rad, frac_liq, qcl_rad, Time)
+ subroutine output_cloud_diags(cf, reff_rad, frac_liq, qcl_rad, rh_in_cf, simple_rhcrit, Time)
- real, intent(in), dimension(:,:,:) :: cf_rad, reff_rad, frac_liq, qcl_rad
+ real, intent(in), dimension(:,:,:) :: cf, reff_rad, frac_liq, qcl_rad, rh_in_cf, simple_rhcrit
type(time_type) , intent(in) :: Time
real :: used
- if ( id_cf_rad > 0 ) then
- used = send_data ( id_cf_rad, cf_rad, Time)
+ if ( id_cf > 0 ) then
+ used = send_data ( id_cf, cf, Time)
endif
if ( id_reff_rad > 0 ) then
@@ -252,6 +264,15 @@ subroutine output_cloud_diags(cf_rad, reff_rad, frac_liq, qcl_rad, Time)
used = send_data ( id_qcl_rad, qcl_rad, Time)
endif
+ if ( id_rh_in_cf > 0 ) then
+ used = send_data ( id_rh_in_cf, rh_in_cf*100., Time)
+ endif
+
+ if ( id_simple_rhcrit > 0 ) then
+ used = send_data ( id_simple_rhcrit, simple_rhcrit*100.0, Time)
+ endif
+
+
end subroutine output_cloud_diags
From 4af75a9781c24b97a8eea72c2adeba820dfba580 Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Thu, 6 Dec 2018 11:24:16 +0000
Subject: [PATCH 064/304] Change to cloud layer will have no science impact but
easier to understand logic
---
src/atmos_param/socrates/interface/set_dimen.F90 | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/atmos_param/socrates/interface/set_dimen.F90 b/src/atmos_param/socrates/interface/set_dimen.F90
index 6cf8eeac8..01d9aca75 100644
--- a/src/atmos_param/socrates/interface/set_dimen.F90
+++ b/src/atmos_param/socrates/interface/set_dimen.F90
@@ -61,10 +61,12 @@ SUBROUTINE set_dimen(control, dimen, spectrum, n_profile, n_layer, &
dimen%nd_subcol_gen = cld_subcol_gen
dimen%nd_subcol_req = cld_subcol_req
-dimen%id_cloud_top = dimen%nd_layer + 1 - n_cloud_layer
+dimen%id_cloud_top = dimen%nd_layer + 1 - n_cloud_layer !ie TOA
IF (control%l_cloud) THEN
- dimen%nd_layer_clr = MAX(dimen%id_cloud_top - 1, dimen%nd_layer)
- ! MAX(dimen%id_cloud_top - 1, 1)
+ ! this gives the allocate the full column for radiation
+ ! rather than the layers over which cloud is present
+ dimen%nd_layer_clr = dimen%nd_layer
+
ELSE
dimen%nd_layer_clr = dimen%nd_layer
END IF
From 51fb7b91bbd6e4d7543727645b3b9c1e6b11807a Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Thu, 6 Dec 2018 12:04:20 +0000
Subject: [PATCH 065/304] qsat is causing very large RH values. Debugging
---
exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py | 2 +-
src/atmos_param/cloud_simple/cloud_simple.F90 | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
index 2803f3100..10afc714b 100644
--- a/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
+++ b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
@@ -52,7 +52,7 @@
diag.add_field('socrates', 'soc_surf_flux_sw', time_avg=True)
diag.add_field('socrates', 'soc_olr', time_avg=True)
diag.add_field('socrates', 'soc_toa_sw', time_avg=True)
-diag.add_field('cloud_simple', 'cf_rad', time_avg=True)
+diag.add_field('cloud_simple', 'cf', time_avg=True)
diag.add_field('cloud_simple', 'reff_rad', time_avg=True)
diag.add_field('cloud_simple', 'frac_liq', time_avg=True)
diag.add_field('cloud_simple', 'qcl_rad', time_avg=True)
diff --git a/src/atmos_param/cloud_simple/cloud_simple.F90 b/src/atmos_param/cloud_simple/cloud_simple.F90
index ffcae1385..e1e57b04b 100644
--- a/src/atmos_param/cloud_simple/cloud_simple.F90
+++ b/src/atmos_param/cloud_simple/cloud_simple.F90
@@ -123,7 +123,7 @@ subroutine cloud_simple(p_half, p_full, Time, &
'cloud_simple_init has not been called.', FATAL)
! Get the saturated specific humidity TOTAL (ie ice and vap) ***double check maths!
- call compute_qs(temp, p_full, qs, es_over_liq_and_ice=.true.) !qs=qsat in um
+ call compute_qs(temp, p_full, qs) !qs=qsat in um
k_surf = size(temp, 3)
From 27fc0615bee70410722b08d27a9803245755d8d5 Mon Sep 17 00:00:00 2001
From: sit23
Date: Thu, 6 Dec 2018 12:09:20 +0000
Subject: [PATCH 066/304] Updated experiment.
---
.../socrates_test/socrates_aquaplanet_with_cloud.py | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
index 10afc714b..8b6a36f79 100644
--- a/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
+++ b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
@@ -37,6 +37,7 @@
diag.add_field('dynamics', 'bk')
diag.add_field('dynamics', 'pk')
diag.add_field('atmosphere', 'precipitation', time_avg=True)
+diag.add_field('atmosphere', 'rh', time_avg=True)
diag.add_field('mixed_layer', 't_surf', time_avg=True)
diag.add_field('dynamics', 'sphum', time_avg=True)
diag.add_field('dynamics', 'ucomp', time_avg=True)
@@ -94,7 +95,7 @@
'chunk_size': 16,
'use_pressure_interp_for_half_levels':False,
'tidally_locked':False,
- 'sol_day':90
+ 'solday':90
},
'idealized_moist_phys_nml': {
'do_damping': True,
@@ -207,7 +208,7 @@
if __name__=="__main__":
cb.compile(debug=False)
- exp.run(1, use_restart=False, num_cores=NCORES, overwrite_data=True)#, run_idb=True)
+ exp.run(1, use_restart=False, num_cores=NCORES, overwrite_data=False)#, run_idb=True)
- for i in range(2,121):
+ for i in range(2,125):
exp.run(i, num_cores=NCORES)
From 17454646dd74fa08bceb30948d8c7c131ab8ce44 Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Thu, 6 Dec 2018 15:35:26 +0000
Subject: [PATCH 067/304] Adding comments. No science changes
---
src/atmos_param/cloud_simple/cloud_simple.F90 | 27 +++++++------------
1 file changed, 10 insertions(+), 17 deletions(-)
diff --git a/src/atmos_param/cloud_simple/cloud_simple.F90 b/src/atmos_param/cloud_simple/cloud_simple.F90
index e1e57b04b..b27ba5788 100644
--- a/src/atmos_param/cloud_simple/cloud_simple.F90
+++ b/src/atmos_param/cloud_simple/cloud_simple.F90
@@ -116,14 +116,12 @@ subroutine cloud_simple(p_half, p_full, Time, &
logical :: es_over_liq_and_ice
- real :: tmp1, tmp2 !remove tmp1 and tmp2 after debugging
-
!check initiation has been done - ie read in parameters
if (do_init) call error_mesg ('cloud_simple', &
'cloud_simple_init has not been called.', FATAL)
! Get the saturated specific humidity TOTAL (ie ice and vap) ***double check maths!
- call compute_qs(temp, p_full, qs) !qs=qsat in um
+ call compute_qs(temp, p_full, qs)
k_surf = size(temp, 3)
@@ -131,7 +129,9 @@ subroutine cloud_simple(p_half, p_full, Time, &
do j=1, size(temp, 2)
do k=1, size(temp, 3)
- !caluclate the frac_liq
+ ! caluclate the liquid fraction, effective radius, critical RH for
+ ! the simple cloud scheme and cloud fraction.
+ ! rh_in_cf is an output diagnostic only for debugging
call calc_liq_frac(temp(i,j,k), frac_liq(i,j,k))
call calc_reff(frac_liq(i,j,k), reff_rad(i,j,k))
call calc_rhcrit(p_full(i,j,k), p_full(i,j,k_surf), simple_rhcrit(i,j,k))
@@ -166,6 +166,7 @@ subroutine calc_liq_frac(temp, frac_liq)
end subroutine calc_liq_frac
subroutine calc_reff(frac_liq, reff_rad)
+ ! the effective cloud radius is bounded between 10 and 20 microns
real, intent(in) :: frac_liq
real, intent(out) :: reff_rad
@@ -175,7 +176,7 @@ subroutine calc_reff(frac_liq, reff_rad)
end subroutine calc_reff
subroutine calc_rhcrit(p_full, p_surf, simple_rhcrit) !need to check p_full - > p_layer_centres
-
+ !get the RH needed as a threshold for the cloud fraction calc.
real, intent(in) :: p_full, p_surf
real, intent(out) :: simple_rhcrit
@@ -209,10 +210,9 @@ subroutine calc_cf (q_hum, qsat, simple_rhcrit, cf, rh)
cf = MAX( 0.0, MIN( 1.0, ( rh - simple_rhcrit ) / ( 1.0 - simple_rhcrit ) ))
- ! include simple convective cloud fraction where present
-
+ ! include simple convective cloud fraction where present (not currenly used)
cca = 0.0 ! no convective cloud fraction is calculated
- ! left in for fture use
+ ! left in for future use
if (cca > 0.0) then
cf = MAX( simple_cca, cf )
@@ -222,7 +222,7 @@ subroutine calc_cf (q_hum, qsat, simple_rhcrit, cf, rh)
end subroutine calc_cf
subroutine calc_qcl_rad(p_full, cf, qcl_rad)
- ! calculate water content
+ ! calculate cloud water content
real , intent(in) :: p_full, cf
real , intent(out) :: qcl_rad
@@ -238,8 +238,6 @@ subroutine calc_qcl_rad(p_full, cf, qcl_rad)
end subroutine calc_qcl_rad
-
-
subroutine output_cloud_diags(cf, reff_rad, frac_liq, qcl_rad, rh_in_cf, simple_rhcrit, Time)
real, intent(in), dimension(:,:,:) :: cf, reff_rad, frac_liq, qcl_rad, rh_in_cf, simple_rhcrit
@@ -272,16 +270,11 @@ subroutine output_cloud_diags(cf, reff_rad, frac_liq, qcl_rad, rh_in_cf, simple_
used = send_data ( id_simple_rhcrit, simple_rhcrit*100.0, Time)
endif
-
-
end subroutine output_cloud_diags
- !-----------------------------------------------
-
-
subroutine cloud_simple_end ()
- ! do we deallocate anything?
+ ! If alloocated are added in init then deallocate them here.
end subroutine cloud_simple_end
From 437a333fca3e613059a98b4305ed716ba9835656 Mon Sep 17 00:00:00 2001
From: sit23
Date: Thu, 6 Dec 2018 15:48:09 +0000
Subject: [PATCH 068/304] Made some changes to socrates cloud test experiment.
---
.../socrates_test/socrates_aquaplanet_with_cloud.py | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
index 8b6a36f79..f4500f04e 100644
--- a/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
+++ b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
@@ -62,8 +62,8 @@
# additional output options commented out
-#diag.add_field('socrates', 'soc_flux_lw', time_avg=True)
-#diag.add_field('socrates', 'soc_flux_sw', time_avg=True)
+diag.add_field('socrates', 'soc_flux_lw', time_avg=True)
+diag.add_field('socrates', 'soc_flux_sw', time_avg=True)
#diag.add_field('socrates', 'soc_co2', time_avg=True)
#diag.add_field('socrates', 'soc_ozone', time_avg=True)
#diag.add_field('socrates', 'soc_coszen', time_avg=True)
@@ -148,7 +148,7 @@
'prescribe_initial_dist':True,
'evaporation':True,
'depth': 2.5, #Depth of mixed layer used
- 'albedo_value': 0.38, #Albedo value used
+ 'albedo_value': 0.2, #Albedo value used
},
'qe_moist_convection_nml': {
@@ -210,5 +210,5 @@
cb.compile(debug=False)
exp.run(1, use_restart=False, num_cores=NCORES, overwrite_data=False)#, run_idb=True)
- for i in range(2,125):
+ for i in range(2,171):
exp.run(i, num_cores=NCORES)
From e02eb308d28226d1cfc52ab327c60e4a8cc18c37 Mon Sep 17 00:00:00 2001
From: sit23
Date: Fri, 14 Dec 2018 10:25:34 +0000
Subject: [PATCH 069/304] New test case with land and specified ssts.
---
...es_aquaplanet_with_cloud_amip_with_topo.py | 234 ++++++++++++++++++
.../scripts/run_plevel.py | 14 +-
2 files changed, 242 insertions(+), 6 deletions(-)
create mode 100644 exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud_amip_with_topo.py
diff --git a/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud_amip_with_topo.py b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud_amip_with_topo.py
new file mode 100644
index 000000000..0c88efd1d
--- /dev/null
+++ b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud_amip_with_topo.py
@@ -0,0 +1,234 @@
+import os
+
+import numpy as np
+
+from isca import SocratesCodeBase, DiagTable, Experiment, Namelist, GFDL_BASE
+from isca.util import exp_progress
+
+NCORES = 16
+base_dir = os.path.dirname(os.path.realpath(__file__))
+# a CodeBase can be a directory on the computer,
+# useful for iterative development
+cb = SocratesCodeBase.from_directory(GFDL_BASE)
+
+# or it can point to a specific git repo and commit id.
+# This method should ensure future, independent, reproducibility of results.
+# cb = DryCodeBase.from_repo(repo='https://github.com/isca/isca', commit='isca1.1')
+
+# compilation depends on computer specific settings. The $GFDL_ENV
+# environment variable is used to determine which `$GFDL_BASE/src/extra/env` file
+# is used to load the correct compilers. The env file is always loaded from
+# $GFDL_BASE and not the checked out git repo.
+
+# create an Experiment object to handle the configuration of model parameters
+# and output diagnostics
+
+exp = Experiment('soc_test_aquaplanet_with_clouds_post_jm_suggestions_amip_ssts_land_low_albedo_with_land', codebase=cb)
+exp.clear_rundir()
+
+inputfiles = [os.path.join(GFDL_BASE,'input/rrtm_input_files/ozone_1990.nc'),
+ os.path.join(base_dir,'input/sst_clim_amip.nc'), os.path.join(GFDL_BASE,'input/land_masks/era_land_t42.nc')]
+
+#Tell model how to write diagnostics
+diag = DiagTable()
+diag.add_file('atmos_monthly', 30, 'days', time_units='days')
+
+#Tell model which diagnostics to write
+diag.add_field('dynamics', 'ps', time_avg=True)
+diag.add_field('dynamics', 'bk')
+diag.add_field('dynamics', 'pk')
+diag.add_field('dynamics', 'zsurf', time_avg=True)
+diag.add_field('atmosphere', 'precipitation', time_avg=True)
+diag.add_field('atmosphere', 'rh', time_avg=True)
+diag.add_field('mixed_layer', 't_surf', time_avg=True)
+diag.add_field('dynamics', 'sphum', time_avg=True)
+diag.add_field('dynamics', 'ucomp', time_avg=True)
+diag.add_field('dynamics', 'vcomp', time_avg=True)
+diag.add_field('dynamics', 'temp', time_avg=True)
+diag.add_field('dynamics', 'vor', time_avg=True)
+diag.add_field('dynamics', 'div', time_avg=True)
+
+diag.add_field('socrates', 'soc_tdt_lw', time_avg=True)
+diag.add_field('socrates', 'soc_tdt_sw', time_avg=True)
+diag.add_field('socrates', 'soc_tdt_rad', time_avg=True)
+diag.add_field('socrates', 'soc_surf_flux_lw', time_avg=True)
+diag.add_field('socrates', 'soc_surf_flux_sw', time_avg=True)
+diag.add_field('socrates', 'soc_olr', time_avg=True)
+diag.add_field('socrates', 'soc_toa_sw', time_avg=True)
+diag.add_field('cloud_simple', 'cf', time_avg=True)
+diag.add_field('cloud_simple', 'reff_rad', time_avg=True)
+diag.add_field('cloud_simple', 'frac_liq', time_avg=True)
+diag.add_field('cloud_simple', 'qcl_rad', time_avg=True)
+diag.add_field('cloud_simple', 'simple_rhcrit', time_avg=True)
+diag.add_field('cloud_simple', 'rh_in_cf', time_avg=True)
+diag.add_field('mixed_layer', 'albedo', time_avg=True)
+
+
+# additional output options commented out
+diag.add_field('socrates', 'soc_flux_lw', time_avg=True)
+diag.add_field('socrates', 'soc_flux_sw', time_avg=True)
+#diag.add_field('socrates', 'soc_co2', time_avg=True)
+#diag.add_field('socrates', 'soc_ozone', time_avg=True)
+#diag.add_field('socrates', 'soc_coszen', time_avg=True)
+#diag.add_field('socrates', 'soc_spectral_olr', time_avg=True)
+
+exp.diag_table = diag
+exp.inputfiles = inputfiles
+
+#Define values for the 'core' namelist
+exp.namelist = namelist = Namelist({
+ 'main_nml':{
+ 'days' : 30,
+ 'hours' : 0,
+ 'minutes': 0,
+ 'seconds': 0,
+ 'dt_atmos':600,
+ 'current_date' : [1,1,1,0,0,0],
+ 'calendar' : 'thirty_day'
+ },
+ 'socrates_rad_nml': {
+ 'stellar_constant':1370.,
+ 'lw_spectral_filename':os.path.join(GFDL_BASE,'src/atmos_param/socrates/src/trunk/data/spectra/ga7/sp_lw_ga7'),
+ 'sw_spectral_filename':os.path.join(GFDL_BASE,'src/atmos_param/socrates/src/trunk/data/spectra/ga7/sp_sw_ga7'),
+ 'do_read_ozone': True,
+ 'ozone_file_name':'ozone_1990',
+ 'ozone_field_name':'ozone_1990',
+ 'dt_rad':3600,
+ 'store_intermediate_rad':True,
+ 'chunk_size': 16,
+ 'use_pressure_interp_for_half_levels':False,
+ 'tidally_locked':False,
+ },
+ 'idealized_moist_phys_nml': {
+ 'do_damping': True,
+ 'turb':True,
+ 'mixed_layer_bc':True,
+ 'do_virtual' :False,
+ 'do_simple': True,
+ 'roughness_mom':3.21e-05,
+ 'roughness_heat':3.21e-05,
+ 'roughness_moist':3.21e-05,
+ 'two_stream_gray': False, #Use the grey radiation scheme
+ 'do_socrates_radiation': True,
+ 'convection_scheme': 'SIMPLE_BETTS_MILLER', #Use simple Betts miller convection
+ 'do_cloud_simple': True,
+ 'land_option' : 'input',
+ 'land_file_name' : 'INPUT/era_land_t42.nc',
+ 'land_roughness_prefactor' :10.0,
+ },
+
+ 'cloud_simple_nml': {
+ 'simple_cca':0.0,
+ 'rhcsfc': 0.95,
+ 'rhc700': 0.7,
+ 'rhc200': 0.3
+ },
+
+ 'vert_turb_driver_nml': {
+ 'do_mellor_yamada': False, # default: True
+ 'do_diffusivity': True, # default: False
+ 'do_simple': True, # default: False
+ 'constant_gust': 0.0, # default: 1.0
+ 'use_tau': False
+ },
+
+ 'diffusivity_nml': {
+ 'do_entrain':False,
+ 'do_simple': True,
+ },
+
+ 'surface_flux_nml': {
+ 'use_virtual_temp': False,
+ 'do_simple': True,
+ 'old_dtaudv': True
+ },
+
+ 'atmosphere_nml': {
+ 'idealized_moist_model': True
+ },
+
+ #Use a large mixed-layer depth, and the Albedo of the CTRL case in Jucker & Gerber, 2017
+ 'mixed_layer_nml': {
+ 'tconst' : 285.,
+ 'prescribe_initial_dist':True,
+ 'evaporation':True,
+ 'depth': 20.0, #Depth of mixed layer used
+ 'albedo_value': 0.2, #Albedo value used
+ 'land_option': 'input', #Tell mixed layer to get land mask from input file
+ 'land_h_capacity_prefactor': 0.1, #What factor to multiply mixed-layer depth by over land.
+ 'albedo_value': 0.1, #Ocean albedo value
+ 'land_albedo_prefactor': 1.3, #What factor to multiply ocean albedo by over land
+ 'do_qflux' : False, #Don't use the prescribed analytical formula for q-fluxes
+ 'do_read_sst' : True, #Read in sst values from input file
+ 'do_sc_sst' : True, #Do specified ssts (need both to be true)
+ 'sst_file' : 'sst_clim_amip', #Set name of sst input file
+ 'specify_sst_over_ocean_only' : True, #Make sure sst only specified in regions of ocean.
+ },
+
+ 'qe_moist_convection_nml': {
+ 'rhbm':0.7,
+ 'Tmin':160.,
+ 'Tmax':350.
+ },
+
+ 'lscale_cond_nml': {
+ 'do_simple':True,
+ 'do_evap':True
+ },
+
+ 'sat_vapor_pres_nml': {
+ 'do_simple':True,
+ 'construct_table_wrt_liq_and_ice':True
+ },
+
+ 'damping_driver_nml': {
+ 'do_rayleigh': True,
+ 'trayfric': -0.5, # neg. value: time in *days*
+ 'sponge_pbottom': 150., #Setting the lower pressure boundary for the model sponge layer in Pa.
+ 'do_conserve_energy': True,
+ },
+
+ # FMS Framework configuration
+ 'diag_manager_nml': {
+ 'mix_snapshot_average_fields': False # time avg fields are labelled with time in middle of window
+ },
+
+ 'fms_nml': {
+ 'domains_stack_size': 600000 # default: 0
+ },
+
+ 'fms_io_nml': {
+ 'threading_write': 'single', # default: multi
+ 'fileset_write': 'single', # default: multi
+ },
+
+ 'spectral_dynamics_nml': {
+ 'damping_order': 4,
+ 'water_correction_limit': 200.e2,
+ 'reference_sea_level_press':1.0e5,
+ 'num_levels':40, #How many model pressure levels to use
+ 'valid_range_t':[100.,800.],
+ 'initial_sphum':[2.e-6],
+ 'vert_coord_option':'uneven_sigma',
+ 'surf_res':0.2, #Parameter that sets the vertical distribution of sigma levels
+ 'scale_heights' : 11.0,
+ 'exponent':7.0,
+ 'robert_coeff':0.03,
+ 'ocean_topog_smoothing': 0.8
+ },
+
+ 'spectral_init_cond_nml':{
+ 'topog_file_name': 'era_land_t42.nc',
+ 'topography_option': 'input'
+ },
+
+})
+
+#Lets do a run!
+if __name__=="__main__":
+
+ cb.compile(debug=False)
+ exp.run(1, use_restart=False, num_cores=NCORES, overwrite_data=False)#, run_idb=True)
+
+ for i in range(2,241):
+ exp.run(i, num_cores=NCORES)
diff --git a/postprocessing/plevel_interpolation/scripts/run_plevel.py b/postprocessing/plevel_interpolation/scripts/run_plevel.py
index 294ecb53a..5a04db3c1 100644
--- a/postprocessing/plevel_interpolation/scripts/run_plevel.py
+++ b/postprocessing/plevel_interpolation/scripts/run_plevel.py
@@ -7,11 +7,11 @@
import subprocess
start_time=time.time()
-base_dir='/scratch/sit204/Data_2013/'
-exp_name_list = ['no_ice_flux_lhe_exps_q_flux_hadgem_anoms_3']
+base_dir='/scratch/sit204/data_isca/'
+exp_name_list = ['soc_test_aquaplanet_with_clouds_post_jm_suggestions_amip_ssts_land_low_albedo']
avg_or_daily_list=['monthly']
-start_file=287
-end_file=288
+start_file=96
+end_file=120
nfiles=(end_file-start_file)+1
do_extra_averaging=False #If true, then 6hourly data is averaged into daily data using cdo
@@ -66,10 +66,12 @@
number_prefix=''
- if n+start_file < 100:
+ if n+start_file < 1000:
number_prefix='0'
- if n+start_file < 10:
+ if n+start_file < 100:
number_prefix='00'
+ if n+start_file < 10:
+ number_prefix='000'
nc_file_in = base_dir+'/'+exp_name+'/run'+number_prefix+str(n+start_file)+'/atmos_'+avg_or_daily+'.nc'
nc_file_out = out_dir+'/'+exp_name+'/run'+number_prefix+str(n+start_file)+'/atmos_'+avg_or_daily+file_suffix+'.nc'
From 38910fdb7927697edf3df971c815a5b71e4412c1 Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Thu, 28 Mar 2019 09:27:12 +0000
Subject: [PATCH 070/304] Adding diagnostics for clear sky in order to do CRE
calculation.
---
.../socrates_aquaplanet_with_cloud.py | 31 ++-
.../socrates/interface/socrates_calc.F90 | 22 +-
.../socrates/interface/socrates_interface.F90 | 242 +++++++++++++++---
3 files changed, 248 insertions(+), 47 deletions(-)
diff --git a/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
index f4500f04e..f3c189127 100644
--- a/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
+++ b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
@@ -5,7 +5,7 @@
from isca import SocratesCodeBase, DiagTable, Experiment, Namelist, GFDL_BASE
from isca.util import exp_progress
-NCORES = 16
+NCORES = 8
base_dir = os.path.dirname(os.path.realpath(__file__))
# a CodeBase can be a directory on the computer,
# useful for iterative development
@@ -46,13 +46,30 @@
diag.add_field('dynamics', 'vor', time_avg=True)
diag.add_field('dynamics', 'div', time_avg=True)
-diag.add_field('socrates', 'soc_tdt_lw', time_avg=True)
+#temperature tendency - units are K/s
+diag.add_field('socrates', 'soc_tdt_lw', time_avg=True) # net flux lw 3d (up - down)
diag.add_field('socrates', 'soc_tdt_sw', time_avg=True)
-diag.add_field('socrates', 'soc_tdt_rad', time_avg=True)
+diag.add_field('socrates', 'soc_tdt_rad', time_avg=True) #sum of the sw and lw heating rates
+
+#net (up) and down surface fluxes
diag.add_field('socrates', 'soc_surf_flux_lw', time_avg=True)
diag.add_field('socrates', 'soc_surf_flux_sw', time_avg=True)
+diag.add_field('socrates', 'soc_surf_flux_lw_down', time_avg=True)
+diag.add_field('socrates', 'soc_surf_flux_sw_down', time_avg=True)
+#net (up) TOA and downard fluxes
diag.add_field('socrates', 'soc_olr', time_avg=True)
-diag.add_field('socrates', 'soc_toa_sw', time_avg=True)
+diag.add_field('socrates', 'soc_toa_sw', time_avg=True)
+diag.add_field('socrates', 'soc_toa_sw_down', time_avg=True)
+
+#clear sky fluxes
+diag.add_field('socrates', 'soc_surf_flux_lw_clear', time_avg=True)
+diag.add_field('socrates', 'soc_surf_flux_sw_clear', time_avg=True)
+diag.add_field('socrates', 'soc_surf_flux_lw_down_clear', time_avg=True)
+diag.add_field('socrates', 'soc_surf_flux_sw_down_clear', time_avg=True)
+diag.add_field('socrates', 'soc_olr_clear', time_avg=True)
+diag.add_field('socrates', 'soc_toa_sw_clear', time_avg=True)
+diag.add_field('socrates', 'soc_toa_sw_down_clear', time_avg=True)
+
diag.add_field('cloud_simple', 'cf', time_avg=True)
diag.add_field('cloud_simple', 'reff_rad', time_avg=True)
diag.add_field('cloud_simple', 'frac_liq', time_avg=True)
@@ -208,7 +225,7 @@
if __name__=="__main__":
cb.compile(debug=False)
- exp.run(1, use_restart=False, num_cores=NCORES, overwrite_data=False)#, run_idb=True)
+ exp.run(1, use_restart=False, num_cores=NCORES, overwrite_data=True)#, run_idb=True)
- for i in range(2,171):
- exp.run(i, num_cores=NCORES)
+# for i in range(2,171):
+# exp.run(i, num_cores=NCORES)
diff --git a/src/atmos_param/socrates/interface/socrates_calc.F90 b/src/atmos_param/socrates/interface/socrates_calc.F90
index 0fd98b578..f50910a25 100644
--- a/src/atmos_param/socrates/interface/socrates_calc.F90
+++ b/src/atmos_param/socrates/interface/socrates_calc.F90
@@ -17,7 +17,7 @@ module socrates_calc_mod
contains
-! ==================================================================================
+! ==============================================================================
@@ -25,7 +25,7 @@ module socrates_calc_mod
! Set up the call to the Socrates radiation scheme
! -----------------------------------------------------------------------------
!DIAG Added Time
-subroutine socrates_calc(Time_diag,control, spectrum, &
+subroutine socrates_calc(Time_diag,control, spectrum, &
n_profile, n_layer, n_cloud_layer, n_aer_mode, &
cld_subcol_gen, cld_subcol_req, &
p_layer, t_layer, t_layer_boundaries, d_mass, density, &
@@ -34,7 +34,9 @@ subroutine socrates_calc(Time_diag,control, spectrum,
l_planet_grey_surface, planet_albedo, planet_emissivity, &
layer_heat_capacity, &
cld_frac, reff_rad, mmr_cl_rad, &
- flux_direct, flux_down, flux_up, heating_rate, spectral_olr)
+ flux_direct, flux_down, flux_up, &
+ flux_down_clear, flux_up_clear, &
+ heating_rate, spectral_olr)
use rad_pcf
use def_control, only: StrCtrl
@@ -126,9 +128,11 @@ subroutine socrates_calc(Time_diag,control, spectrum,
real(r_def), intent(out) :: flux_direct(n_profile, 0:n_layer)
! Direct (unscattered) downwards flux (Wm-2)
-real(r_def), intent(out) :: flux_down(n_profile, 0:n_layer)
+real(r_def), intent(out) :: flux_down(n_profile, 0:n_layer), &
+ flux_down_clear(n_profile, 0:n_layer)
! Downwards flux (Wm-2)
-real(r_def), intent(out) :: flux_up(n_profile, 0:n_layer)
+real(r_def), intent(out) :: flux_up(n_profile, 0:n_layer), &
+ flux_up_clear(n_profile, 0:n_layer)
! Upwards flux (Wm-2)
real(r_def), intent(out) :: heating_rate(n_profile, n_layer)
! Heating rate (Ks-1)
@@ -205,9 +209,11 @@ subroutine socrates_calc(Time_diag,control, spectrum,
do l=1, n_profile
do i=0, n_layer
- flux_direct(l, i) = radout%flux_direct(l, i, 1)
- flux_down(l, i) = radout%flux_down(l, i, 1)
- flux_up(l, i) = radout%flux_up(l, i, 1)
+ flux_direct(l, i) = radout%flux_direct(l, i, 1)
+ flux_down(l, i) = radout%flux_down(l, i, 1)
+ flux_down_clear(l, i) = radout%flux_down_clear(l, i, 1)
+ flux_up(l, i) = radout%flux_up(l, i, 1)
+ flux_up_clear(l, i) = radout%flux_up_clear(l, i, 1)
end do
if (present(spectral_olr)) then
spectral_olr(l,:) = radout%flux_up_clear_band(l,0,:)
diff --git a/src/atmos_param/socrates/interface/socrates_interface.F90 b/src/atmos_param/socrates/interface/socrates_interface.F90
index 5a29bbd50..aa658aadd 100644
--- a/src/atmos_param/socrates/interface/socrates_interface.F90
+++ b/src/atmos_param/socrates/interface/socrates_interface.F90
@@ -56,9 +56,18 @@ MODULE socrates_interface_mod
INTEGER :: id_soc_tdt_sw, id_soc_tdt_lw, id_soc_tdt_rad
INTEGER :: id_soc_surf_flux_lw, id_soc_surf_flux_sw
INTEGER :: id_soc_surf_flux_lw_down, id_soc_surf_flux_sw_down
+
+ INTEGER :: id_soc_surf_flux_lw_clear, id_soc_surf_flux_sw_clear
+ INTEGER :: id_soc_surf_flux_lw_down_clear, id_soc_surf_flux_sw_down_clear
+
INTEGER :: id_soc_flux_lw, id_soc_flux_sw
+
INTEGER :: id_soc_olr, id_soc_toa_sw
+ INTEGER :: id_soc_olr_clear, id_soc_toa_sw_clear
+
INTEGER :: id_soc_toa_sw_down
+ INTEGER :: id_soc_toa_sw_down_clear
+
INTEGER :: id_soc_ozone, id_soc_co2, id_soc_coszen
INTEGER :: n_soc_bands_lw, n_soc_bands_sw
INTEGER :: n_soc_bands_lw_hires, n_soc_bands_sw_hires
@@ -72,9 +81,12 @@ MODULE socrates_interface_mod
REAL(r_def), allocatable, dimension(:,:,:) :: tdt_soc_sw_store, tdt_soc_lw_store
REAL(r_def), allocatable, dimension(:,:,:) :: thd_sw_flux_net_store, thd_lw_flux_net_store
REAL(r_def), allocatable, dimension(:,:,:) :: thd_co2_store, thd_ozone_store
- REAL(r_def), allocatable, dimension(:,:) :: net_surf_sw_down_store, surf_lw_down_store, surf_lw_net_store, &
+ REAL(r_def), allocatable, dimension(:,:) :: net_surf_sw_down_store, surf_lw_down_store, surf_lw_net_store, surf_lw_net_store, &
surf_sw_down_store, toa_sw_down_store, &
toa_sw_store, olr_store, coszen_store
+ REAL(r_def), allocatable, dimension(:,:) :: net_surf_sw_down_clear_store, surf_sw_down_clear_store, &
+ surf_lw_down_clear_store, surf_lw_net_clear_store, &
+ toa_sw_clear_store, olr_clear_store, toa_sw_down_clear_store
REAL(r_def), allocatable, dimension(:,:,:) :: outputted_soc_spectral_olr, spectral_olr_store
REAL(r_def), allocatable, dimension(:) :: soc_bins_lw, soc_bins_sw
@@ -264,31 +276,66 @@ SUBROUTINE socrates_init(is, ie, js, je, num_levels, axes, Time, lat, lonb, latb
'socrates LW surface flux down', &
'watts/m2', missing_value=missing_value )
+ id_soc_surf_flux_lw_clear = &
+ register_diag_field ( soc_mod_name, 'soc_surf_flux_lw_clear', axes(1:2), Time, &
+ 'socrates Net LW surface flux (up) clear sky', &
+ 'watts/m2', missing_value=missing_value )
+
+ id_soc_surf_flux_lw_down_clear = &
+ register_diag_field ( soc_mod_name, 'soc_surf_flux_lw_down_clear', axes(1:2), Time, &
+ 'socrates LW surface flux down clear sky', &
+ 'watts/m2', missing_value=missing_value )
+
id_soc_surf_flux_sw = &
register_diag_field ( soc_mod_name, 'soc_surf_flux_sw', axes(1:2), Time, &
'socrates Net SW surface flux (down)', &
'watts/m2', missing_value=missing_value )
+ id_soc_surf_flux_sw_clear = &
+ register_diag_field ( soc_mod_name, 'soc_surf_flux_sw_clear', axes(1:2), Time, &
+ 'socrates Net SW surface flux (down) clear sky', &
+ 'watts/m2', missing_value=missing_value )
+
id_soc_surf_flux_sw_down = &
register_diag_field ( soc_mod_name, 'soc_surf_flux_sw_down', axes(1:2), Time, &
'socrates SW surface flux down', &
'watts/m2', missing_value=missing_value )
+ id_soc_surf_flux_sw_down_clear = &
+ register_diag_field ( soc_mod_name, 'soc_surf_flux_sw_down_clear', axes(1:2), Time, &
+ 'socrates SW surface flux down clear sky', &
+ 'watts/m2', missing_value=missing_value )
+
id_soc_olr = &
register_diag_field ( soc_mod_name, 'soc_olr', axes(1:2), Time, &
'socrates TOA LW flux (up)', &
'watts/m2', missing_value=missing_value )
+ id_soc_olr_clear = &
+ register_diag_field ( soc_mod_name, 'soc_olr_clear', axes(1:2), Time, &
+ 'socrates TOA LW flux (up) clear-sky', &
+ 'watts/m2', missing_value=missing_value )
+
id_soc_toa_sw = &
register_diag_field ( soc_mod_name, 'soc_toa_sw', axes(1:2), Time, &
'socrates Net TOA SW flux (down)', &
'watts/m2', missing_value=missing_value )
+ id_soc_toa_sw_clear = &
+ register_diag_field ( soc_mod_name, 'soc_toa_sw_clear', axes(1:2), Time, &
+ 'socrates Net TOA SW flux (down) clear', &
+ 'watts/m2', missing_value=missing_value )
+
id_soc_toa_sw_down = &
register_diag_field ( soc_mod_name, 'soc_toa_sw_down', axes(1:2), Time, &
'socrates TOA SW flux down', &
'watts/m2', missing_value=missing_value )
+ id_soc_toa_sw_down_clear = &
+ register_diag_field ( soc_mod_name, 'soc_toa_sw_down_clear', axes(1:2), Time, &
+ 'socrates TOA SW flux down clear sky', &
+ 'watts/m2', missing_value=missing_value )
+
id_soc_flux_lw = &
register_diag_field ( soc_mod_name, 'soc_flux_lw', (/axes(1),axes(2),axes(4)/), Time, &
'socrates Net LW flux (up)', &
@@ -351,10 +398,6 @@ SUBROUTINE socrates_init(is, ie, js, je, num_levels, axes, Time, lat, lonb, latb
allocate(surf_lw_down_store(size(lonb,1)-1, size(latb,2)-1))
! only required for output
- if (id_soc_surf_flux_lw > 0) then
- allocate(surf_lw_net_store(size(lonb,1)-1, size(latb,2)-1))
- endif
-
if (id_soc_flux_lw > 0) then
allocate(thd_lw_flux_net_store(size(lonb,1)-1, size(latb,2)-1, num_levels+1))
endif
@@ -363,20 +406,47 @@ SUBROUTINE socrates_init(is, ie, js, je, num_levels, axes, Time, lat, lonb, latb
allocate(thd_sw_flux_net_store(size(lonb,1)-1, size(latb,2)-1, num_levels+1))
endif
+ if (id_soc_surf_flux_sw_clear > 0) then
+ allocate(net_surf_sw_down_clear_store(size(lonb,1)-1, size(latb,2)-1))
+ endif
+ if (id_soc_surf_flux_lw_down_clear > 0) then
+ allocate(surf_lw_down_clear_store(size(lonb,1)-1, size(latb,2)-1))
+ endif
+
+ !surface
+ if (id_soc_surf_flux_lw > 0) then
+ allocate(surf_lw_net_store(size(lonb,1)-1, size(latb,2)-1))
+ endif
+ if (id_soc_surf_flux_lw_clear > 0) then
+ allocate(surf_lw_net_clear_store(size(lonb,1)-1, size(latb,2)-1))
+ endif
if (id_soc_surf_flux_sw_down > 0) then
allocate(surf_sw_down_store(size(lonb,1)-1, size(latb,2)-1))
endif
+ if (id_soc_surf_flux_sw_down_clear > 0) then
+ allocate(surf_sw_down_clear_store(size(lonb,1)-1, size(latb,2)-1))
+ endif
if (id_soc_olr > 0) then
allocate(olr_store(size(lonb,1)-1, size(latb,2)-1))
endif
+ if (id_soc_olr_clear > 0) then
+ allocate(olr_clear_store(size(lonb,1)-1, size(latb,2)-1))
+ endif
if (id_soc_toa_sw > 0) then
allocate(toa_sw_store(size(lonb,1)-1, size(latb,2)-1))
endif
+ if (id_soc_toa_sw_clear > 0) then
+ allocate(toa_sw_clear_store(size(lonb,1)-1, size(latb,2)-1))
+ endif
if (id_soc_toa_sw_down > 0) then
allocate(toa_sw_down_store(size(lonb,1)-1, size(latb,2)-1))
endif
+ if (id_soc_toa_sw_down_clear > 0) then
+ allocate(toa_sw_down_clear_store(size(lonb,1)-1, size(latb,2)-1))
+ endif
+
if (id_soc_coszen > 0) then
allocate(coszen_store(size(lonb,1)-1, size(latb,2)-1))
endif
@@ -437,6 +507,7 @@ subroutine socrates_interface(Time_diag, rlat, rlon, soc_lw_mode, &
fms_coszen, fms_rrsun, n_profile, n_layer, &
fms_cld_frac, fms_reff_rad, fms_mmr_cl_rad, &
output_heating_rate, output_flux_down, output_flux_up, &
+ output_flux_down_clear, output_flux_up_clear, &
do_cloud_simple, &
!optionals
output_soc_spectral_olr, output_flux_direct, &
@@ -484,8 +555,8 @@ subroutine socrates_interface(Time_diag, rlat, rlon, soc_lw_mode, &
! Output arrays
real(r_def), intent(out) :: output_heating_rate(:,:,:)
- real(r_def), intent(out) :: output_flux_up(:,:,:)
- real(r_def), intent(out) :: output_flux_down(:,:,:)
+ real(r_def), intent(out) :: output_flux_up(:,:,:), output_flux_up_clear(:,:,:)
+ real(r_def), intent(out) :: output_flux_down(:,:,:), output_flux_down_clear(:,:,:)
real(r_def), intent(out), optional :: output_flux_direct(:,:,:)
@@ -504,7 +575,8 @@ subroutine socrates_interface(Time_diag, rlat, rlon, soc_lw_mode, &
input_co2_mixing_ratio,z_full_reshaped, input_cld_frac, input_reff_rad, input_mmr_cl_rad
real(r_def), dimension(n_profile, 0:n_layer) :: input_p_level, input_t_level, soc_flux_direct, &
- soc_flux_down, soc_flux_up, z_half_reshaped
+ soc_flux_down, soc_flux_up, z_half_reshaped, &
+ soc_flux_down_clear, soc_flux_up_clear
real(r_def), dimension(n_profile) :: input_t_surf, input_cos_zenith_angle, input_solar_irrad, &
input_orog_corr, input_planet_albedo
@@ -672,11 +744,13 @@ subroutine socrates_interface(Time_diag, rlat, rlon, soc_lw_mode, &
input_layer_heat_capacity(idx_chunk_start:idx_chunk_end,:), &
input_cld_frac(idx_chunk_start:idx_chunk_end,:), &
input_reff_rad(idx_chunk_start:idx_chunk_end,:), &
- input_mmr_cl_rad(idx_chunk_start:idx_chunk_end,:), &
+ input_mmr_cl_rad(idx_chunk_start:idx_chunk_end,:), &
soc_flux_direct(idx_chunk_start:idx_chunk_end,:), &
- soc_flux_down(idx_chunk_start:idx_chunk_end,:), &
- soc_flux_up(idx_chunk_start:idx_chunk_end,:), &
- soc_heating_rate(idx_chunk_start:idx_chunk_end,:), &
+ soc_flux_down(idx_chunk_start:idx_chunk_end,:), &
+ soc_flux_up(idx_chunk_start:idx_chunk_end,:), &
+ soc_flux_down_clear(idx_chunk_start:idx_chunk_end,:), &
+ soc_flux_up_clear(idx_chunk_start:idx_chunk_end,:), &
+ soc_heating_rate(idx_chunk_start:idx_chunk_end,:), &
soc_spectral_olr(idx_chunk_start:idx_chunk_end,:))
else
@@ -701,10 +775,12 @@ subroutine socrates_interface(Time_diag, rlat, rlon, soc_lw_mode, &
input_layer_heat_capacity(idx_chunk_start:idx_chunk_end,:), &
input_cld_frac(idx_chunk_start:idx_chunk_end,:), &
input_reff_rad(idx_chunk_start:idx_chunk_end,:), &
- input_mmr_cl_rad(idx_chunk_start:idx_chunk_end,:), &
+ input_mmr_cl_rad(idx_chunk_start:idx_chunk_end,:), &
soc_flux_direct(idx_chunk_start:idx_chunk_end,:), &
- soc_flux_down(idx_chunk_start:idx_chunk_end,:), &
- soc_flux_up(idx_chunk_start:idx_chunk_end,:), &
+ soc_flux_down(idx_chunk_start:idx_chunk_end,:), &
+ soc_flux_up(idx_chunk_start:idx_chunk_end,:), &
+ soc_flux_down_clear(idx_chunk_start:idx_chunk_end,:), &
+ soc_flux_up_clear(idx_chunk_start:idx_chunk_end,:), &
soc_heating_rate(idx_chunk_start:idx_chunk_end,:))
endif
@@ -714,6 +790,9 @@ subroutine socrates_interface(Time_diag, rlat, rlon, soc_lw_mode, &
output_flux_up(:,:,:) = reshape(soc_flux_up(:,:),(/si,sj,sk+1 /))
output_flux_down(:,:,:) = reshape(soc_flux_down(:,:),(/si,sj,sk+1 /))
+ output_flux_up_clear(:,:,:) = reshape(soc_flux_up_clear(:,:),(/si,sj,sk+1 /))
+ output_flux_down_clear(:,:,:) = reshape(soc_flux_down_clear(:,:),(/si,sj,sk+1 /))
+
if(present(output_flux_direct)) then
output_flux_direct(:,:,:) = reshape(soc_flux_direct(:,:),(/si,sj,sk+1 /))
endif
@@ -740,7 +819,7 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
real, intent(in), dimension(:,:,:) :: temp_in, p_full_in, q_in, z_full_in
real, intent(in), dimension(:,:,:) :: p_half_in, z_half_in
real, intent(inout), dimension(:,:,:) :: temp_tend
- real, intent(out), dimension(:,:) :: net_surf_sw_down, surf_lw_down
+ real, intent(out), dimension(:,:) :: net_surf_sw_down, surf_lw_down
real, intent(in) :: delta_t
logical, intent(in) :: do_cloud_simple
real, intent(in), dimension(:,:,:) :: cf_rad, reff_rad, qcl_rad
@@ -749,12 +828,19 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
real(r_def), dimension(size(temp_in,1), size(temp_in,2)) :: t_surf_for_soc, rad_lat_soc, rad_lon_soc, albedo_soc
real(r_def), dimension(size(temp_in,1), size(temp_in,2), size(temp_in,3)) :: tg_tmp_soc, q_soc, ozone_soc, co2_soc, p_full_soc, output_heating_rate_sw, output_heating_rate_lw, output_heating_rate_total, z_full_soc, cld_frac_soc, reff_rad_soc, mmr_cl_rad_soc, qcl_rad_soc
- real(r_def), dimension(size(temp_in,1), size(temp_in,2), size(temp_in,3)+1) :: p_half_soc, t_half_out, z_half_soc,output_soc_flux_sw_down, output_soc_flux_sw_up, output_soc_flux_lw_down, output_soc_flux_lw_up
+ real(r_def), dimension(size(temp_in,1), size(temp_in,2), size(temp_in,3)+1) :: p_half_soc, t_half_out, &
+ z_half_soc,output_soc_flux_sw_down, output_soc_flux_sw_up, output_soc_flux_lw_down, output_soc_flux_lw_up, &
+ output_soc_flux_lw_down_clear, output_soc_flux_lw_up_clear, output_soc_flux_sw_down_clear, output_soc_flux_sw_up_clear
logical :: soc_lw_mode, used
integer :: seconds, days, year_in_s
real :: r_seconds, r_days, r_total_seconds, frac_of_day, frac_of_year, gmt, time_since_ae, rrsun, dt_rad_radians, day_in_s, r_solday, r_dt_rad_avg
real, dimension(size(temp_in,1), size(temp_in,2)) :: coszen, fracsun, surf_lw_net, olr, toa_sw, p2, toa_sw_down, surf_sw_down
+
+ real, dimension(size(temp_in,1), size(temp_in,2)) :: olr_clear, toa_sw_clear, toa_sw_down_clear
+ real, dimension(size(temp_in,1), size(temp_in,2)) :: surf_lw_down_clear, surf_lw_net_clear, &
+ surf_sw_down_clear, net_surf_sw_down_clear
+
real, dimension(size(temp_in,1), size(temp_in,2), size(temp_in,3)) :: ozone_in, co2_in
real, dimension(size(temp_in,1), size(temp_in,2), size(temp_in,3)+1) :: thd_sw_flux_net, thd_lw_flux_net
type(time_type) :: Time_loc
@@ -778,14 +864,25 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
surf_lw_down = real(surf_lw_down_store)
!only required for output
+ if (id_soc_surf_flux_sw_clear > 0) then
+ net_surf_sw_down_clear = net_surf_sw_down_clear_store
+ endif
+
+ if (id_soc_surf_flux_lw_down_clear > 0) then
+ surf_lw_down_clear = surf_lw_down_clear_store
+ endif
+
if (id_soc_surf_flux_lw > 0) then
surf_lw_net = real(surf_lw_net_store)
endif
-
+
+ if (id_soc_surf_flux_lw_clear > 0) then
+ surf_lw_net_clear = surf_lw_net_clear_store
+ endif
+
if (id_soc_flux_lw > 0) then
thd_lw_flux_net = thd_lw_flux_net_store
endif
-
if (id_soc_flux_sw > 0) then
thd_sw_flux_net = thd_sw_flux_net_store
endif
@@ -793,14 +890,32 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
if (id_soc_surf_flux_sw_down > 0) then
surf_sw_down = surf_sw_down_store
endif
+ if (id_soc_surf_flux_sw_down_clear > 0) then
+ surf_sw_down_clear = surf_sw_down_clear_store
+ endif
if (id_soc_olr > 0) then
olr = olr_store
endif
+ if (id_soc_olr_clear > 0) then
+ olr_clear = olr_clear_store
+ endif
+
if (id_soc_toa_sw > 0) then
toa_sw = toa_sw_store
endif
+ if (id_soc_toa_sw_clear > 0) then
+ toa_sw_clear = toa_sw_clear_store
+ endif
+
+ if (id_soc_toa_sw_down > 0) then
+ toa_sw_down = toa_sw_down_store
+ endif
+
+ if (id_soc_toa_sw_down_clear > 0) then
+ toa_sw_down_clear = toa_sw_down_clear_store
+ endif
if (id_soc_toa_sw_down > 0) then
toa_sw_down = toa_sw_down_store
@@ -827,10 +942,14 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
thd_sw_flux_net = 0.
thd_lw_flux_net = 0.
net_surf_sw_down = 0.
+ surf_sw_down = 0.
surf_lw_down = 0.
surf_lw_net = 0.
toa_sw = 0.
+ toa_sw_down = 0.
olr = 0.
+ olr_clear = 0.
+
coszen = 0.
ozone_in = 0.
co2_in = 0.
@@ -841,7 +960,7 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
output_heating_rate_total = output_heating_rate_sw +output_heating_rate_lw
! Send diagnostics
- if(id_soc_tdt_lw > 0) then
+ if(id_soc_tdt_lw > 0) then !heating rate in (Ks-1)
used = send_data ( id_soc_tdt_lw, output_heating_rate_lw, Time_diag)
endif
if(id_soc_tdt_sw > 0) then
@@ -853,24 +972,45 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
if(id_soc_surf_flux_lw > 0) then
used = send_data ( id_soc_surf_flux_lw, surf_lw_net, Time_diag)
endif
+ if(id_soc_surf_flux_lw_clear > 0) then
+ used = send_data ( id_soc_surf_flux_lw_clear, surf_lw_net_clear, Time_diag)
+ endif
if(id_soc_surf_flux_lw_down > 0) then
used = send_data ( id_soc_surf_flux_lw_down, surf_lw_down, Time_diag)
endif
+ if(id_soc_surf_flux_lw_down_clear > 0) then
+ used = send_data ( id_soc_surf_flux_lw_down_clear, surf_lw_down_clear, Time_diag)
+ endif
if(id_soc_surf_flux_sw > 0) then
used = send_data ( id_soc_surf_flux_sw, net_surf_sw_down, Time_diag)
endif
+ if(id_soc_surf_flux_sw_clear > 0) then
+ used = send_data ( id_soc_surf_flux_sw_clear, net_surf_sw_down_clear, Time_diag)
+ endif
if(id_soc_surf_flux_sw_down > 0) then
used = send_data ( id_soc_surf_flux_sw_down, surf_sw_down, Time_diag)
endif
+ if(id_soc_surf_flux_sw_down_clear > 0) then
+ used = send_data ( id_soc_surf_flux_sw_down_clear, surf_sw_down_clear, Time_diag)
+ endif
if(id_soc_olr > 0) then
used = send_data ( id_soc_olr, olr, Time_diag)
endif
+ if(id_soc_olr_clear > 0) then
+ used = send_data ( id_soc_olr_clear, olr_clear, Time_diag)
+ endif
if(id_soc_toa_sw > 0) then
used = send_data ( id_soc_toa_sw, toa_sw, Time_diag)
endif
+ if(id_soc_toa_sw_clear > 0) then
+ used = send_data ( id_soc_toa_sw_clear, toa_sw_clear, Time_diag)
+ endif
if(id_soc_toa_sw_down > 0) then
used = send_data ( id_soc_toa_sw_down, toa_sw_down, Time_diag)
endif
+ if(id_soc_toa_sw_down_clear > 0) then
+ used = send_data ( id_soc_toa_sw_down_clear, toa_sw_down_clear, Time_diag)
+ endif
if(id_soc_flux_lw > 0) then
used = send_data ( id_soc_flux_lw, thd_lw_flux_net, Time_diag)
endif
@@ -1018,6 +1158,7 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
p_half_soc, z_full_soc, z_half_soc, albedo_soc, coszen, rrsun, &
n_profile, n_layer, cld_frac_soc, reff_rad_soc, mmr_cl_rad_soc, &
output_heating_rate_lw, output_soc_flux_lw_down, output_soc_flux_lw_up, &
+ output_soc_flux_lw_down_clear, output_soc_flux_lw_up_clear, &
do_cloud_simple, &
!optional outs
output_soc_spectral_olr = outputted_soc_spectral_olr, &
@@ -1026,9 +1167,16 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
tg_tmp_soc = tg_tmp_soc + output_heating_rate_lw*delta_t !Output heating rate in K/s, so is a temperature tendency
surf_lw_down(:,:) = REAL(output_soc_flux_lw_down(:,:, n_layer+1))
- surf_lw_net(:,:) = REAL(output_soc_flux_lw_up(:,:,n_layer+1) - output_soc_flux_lw_down(:,:, n_layer+1))
- olr(:,:) = REAL(output_soc_flux_lw_up(:,:,1))
- thd_lw_flux_net = REAL(output_soc_flux_lw_up - output_soc_flux_lw_down)
+ surf_lw_down_clear(:,:) = REAL(output_soc_flux_lw_down_clear(:,:, n_layer+1))
+
+ surf_lw_net(:,:) = REAL(output_soc_flux_lw_up(:,:,n_layer+1) - &
+ output_soc_flux_lw_down(:,:, n_layer+1))
+ surf_lw_net_clear(:,:) = REAL(output_soc_flux_lw_up_clear(:,:,n_layer+1) - &
+ output_soc_flux_lw_down_clear(:,:, n_layer+1))
+ olr(:,:) = REAL(output_soc_flux_lw_up(:,:,1))
+ olr_clear(:,:) = REAL(output_soc_flux_lw_up_clear(:,:,1))
+
+ thd_lw_flux_net = REAL(output_soc_flux_lw_up - output_soc_flux_lw_down)
temp_tend(:,:,:) = temp_tend(:,:,:) + real(output_heating_rate_lw)
@@ -1041,16 +1189,28 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
p_half_soc, z_full_soc, z_half_soc, albedo_soc, coszen, rrsun, &
n_profile, n_layer, cld_frac_soc, reff_rad_soc, mmr_cl_rad_soc, &
output_heating_rate_sw, output_soc_flux_sw_down, output_soc_flux_sw_up, &
+ output_soc_flux_sw_down_clear, output_soc_flux_sw_up_clear, &
do_cloud_simple)
tg_tmp_soc = tg_tmp_soc + output_heating_rate_sw*delta_t !Output heating rate in K/s, so is a temperature tendency
- net_surf_sw_down(:,:) = REAL(output_soc_flux_sw_down(:,:, n_layer+1)-output_soc_flux_sw_up(:,:,n_layer+1) )
- surf_sw_down(:,:) = REAL(output_soc_flux_sw_down(:,:, n_layer+1))
- toa_sw(:,:) = REAL(output_soc_flux_sw_down(:,:,1)-output_soc_flux_sw_up(:,:,1))
- toa_sw_down(:,:) = REAL(output_soc_flux_sw_down(:,:,1))
- thd_sw_flux_net = REAL(output_soc_flux_sw_up - output_soc_flux_sw_down)
+ net_surf_sw_down(:,:) = REAL(output_soc_flux_sw_down(:,:, n_layer+1) - &
+ output_soc_flux_sw_up(:,:,n_layer+1) )
+ net_surf_sw_down_clear(:,:) = REAL(output_soc_flux_sw_down_clear(:,:, n_layer+1) - &
+ output_soc_flux_sw_up_clear(:,:,n_layer+1) )
+
+ toa_sw(:,:) = REAL(output_soc_flux_sw_down(:,:,1) - &
+ output_soc_flux_sw_up(:,:,1))
+ toa_sw_clear(:,:) = REAL(output_soc_flux_sw_down_clear(:,:,1) - &
+ output_soc_flux_sw_up_clear(:,:,1))
+
+ thd_sw_flux_net = REAL(output_soc_flux_sw_up - output_soc_flux_sw_down) !net sw all levels
+
+ toa_sw_down(:,:) = REAL(output_soc_flux_sw_down(:,:,1))
+ toa_sw_down_clear(:,:) = REAL(output_soc_flux_sw_down_clear(:,:,1))
+ surf_sw_down(:,:) = REAL(output_soc_flux_sw_down(:,:, n_layer+1))
+ surf_sw_down_clear(:,:) = REAL(output_soc_flux_sw_down_clear(:,:, n_layer+1))
temp_tend(:,:,:) = temp_tend(:,:,:) + real(output_heating_rate_sw)
@@ -1064,10 +1224,6 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
surf_lw_down_store = real(surf_lw_down, kind(r_def))
! required for output
- if (id_soc_surf_flux_lw > 0) then
- surf_lw_net_store = real(surf_lw_net, kind(r_def))
- endif
-
if (id_soc_flux_lw > 0) then
thd_lw_flux_net_store = thd_lw_flux_net
endif
@@ -1084,10 +1240,26 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
toa_sw_down_store = toa_sw_down
endif
+ if (id_soc_surf_flux_lw > 0) then
+ surf_lw_net_store = real(surf_lw_net, kind(r_def))
+ endif
+
+ if (id_soc_surf_flux_sw_down > 0) then
+ surf_sw_down_store = surf_sw_down
+ endif
+
+ if (id_soc_toa_sw_down > 0) then
+ toa_sw_down_store = toa_sw_down
+ endif
+
if (id_soc_olr > 0) then
olr_store = olr
endif
+ if (id_soc_olr_clear > 0) then
+ olr_clear_store = olr_clear
+ endif
+
if (id_soc_toa_sw > 0) then
toa_sw_store = toa_sw
endif
@@ -1123,6 +1295,9 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
if(id_soc_surf_flux_lw > 0) then
used = send_data ( id_soc_surf_flux_lw, surf_lw_net, Time_diag)
endif
+ if(id_soc_surf_flux_lw_down > 0) then
+ used = send_data ( id_soc_surf_flux_lw_down, surf_lw_down, Time_diag)
+ endif
if(id_soc_surf_flux_sw > 0) then
used = send_data ( id_soc_surf_flux_sw, net_surf_sw_down, Time_diag)
endif
@@ -1132,6 +1307,9 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
if(id_soc_olr > 0) then
used = send_data ( id_soc_olr, olr, Time_diag)
endif
+ if(id_soc_olr_clear > 0) then
+ used = send_data ( id_soc_olr_clear, olr_clear, Time_diag)
+ endif
if(id_soc_toa_sw > 0) then
used = send_data ( id_soc_toa_sw, toa_sw, Time_diag)
endif
From 1dc1b41e9745b88e43e57b8e54cb8430e2ab68c1 Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Thu, 28 Mar 2019 13:40:55 +0000
Subject: [PATCH 071/304] Implement protocol 2 for spookie-2 and debugging
clear sky diagnostics
---
.../socrates_aquaplanet_with_cloud.py | 10 +-
src/atmos_param/cloud_simple/cloud_simple.F90 | 168 +++++++++++++-----
.../socrates/interface/socrates_calc.F90 | 16 +-
.../socrates/interface/socrates_interface.F90 | 71 +++++++-
.../driver/solo/idealized_moist_phys.F90 | 8 +-
5 files changed, 203 insertions(+), 70 deletions(-)
diff --git a/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
index f3c189127..3e8e3813d 100644
--- a/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
+++ b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
@@ -5,7 +5,7 @@
from isca import SocratesCodeBase, DiagTable, Experiment, Namelist, GFDL_BASE
from isca.util import exp_progress
-NCORES = 8
+NCORES = 16
base_dir = os.path.dirname(os.path.realpath(__file__))
# a CodeBase can be a directory on the computer,
# useful for iterative development
@@ -74,13 +74,13 @@
diag.add_field('cloud_simple', 'reff_rad', time_avg=True)
diag.add_field('cloud_simple', 'frac_liq', time_avg=True)
diag.add_field('cloud_simple', 'qcl_rad', time_avg=True)
-diag.add_field('cloud_simple', 'simple_rhcrit', time_avg=True)
+#diag.add_field('cloud_simple', 'simple_rhcrit', time_avg=True)
+diag.add_field('cloud_simple', 'rh_min', time_avg=True)
diag.add_field('cloud_simple', 'rh_in_cf', time_avg=True)
-
# additional output options commented out
-diag.add_field('socrates', 'soc_flux_lw', time_avg=True)
-diag.add_field('socrates', 'soc_flux_sw', time_avg=True)
+#diag.add_field('socrates', 'soc_flux_lw', time_avg=True)
+#diag.add_field('socrates', 'soc_flux_sw', time_avg=True)
#diag.add_field('socrates', 'soc_co2', time_avg=True)
#diag.add_field('socrates', 'soc_ozone', time_avg=True)
#diag.add_field('socrates', 'soc_coszen', time_avg=True)
diff --git a/src/atmos_param/cloud_simple/cloud_simple.F90 b/src/atmos_param/cloud_simple/cloud_simple.F90
index b27ba5788..b51cc84fe 100644
--- a/src/atmos_param/cloud_simple/cloud_simple.F90
+++ b/src/atmos_param/cloud_simple/cloud_simple.F90
@@ -17,19 +17,39 @@ module cloud_simple_mod
logical :: do_init = .true. ! Check if init needs to be run
real :: simple_cca = 0.0
- real :: rhcsfc = 0.95
- real :: rhc700 = 0.7
- real :: rhc200 = 0.3
+
+ ! Critical RH (fraction) values - spookie protocol 1 only
+ real :: rhc_sfc = 0.95
+ real :: rhc_base = 0.7
+ real :: rhc_top = 0.3
+ !
real :: rhmsfc = 0.95
real :: rhm700 = 0.7
real :: rhm200 = 0.3
- namelist /cloud_simple_nml/ simple_cca, rhcsfc, rhc700, rhc200, &
- rhmsfc, rhm700, rhm200
+ ! Critical RH (fraction) values - spookie protocol 2 only
+ real :: rh_min_top = 0.9
+ real :: rh_min_sfc = 1.0
+ real :: rh_min_base = 0.8
+ real :: rh_max_top = 1.0
+ real :: rh_max_sfc = 1.0
+ real :: rh_max_base = 1.0
+
+ ! Pressure (Pa.) at cloud bottom and top (very approx)
+ real :: p_base = 70000.
+ real :: p_top = 20000.
+
+ integer :: spookie_protocol = 2
+
+ namelist /cloud_simple_nml/ simple_cca, rhc_sfc, rhc_base, rhc_top, &
+ rhmsfc, rhm700, rhm200, &
+ rh_min_top, rh_min_sfc, rh_min_base, &
+ rh_max_top, rh_max_sfc, rh_max_base
+
real :: zerodegc = 273.15
- integer :: id_cf, id_reff_rad, id_frac_liq, id_qcl_rad, id_rh_in_cf, id_simple_rhcrit
-
+ integer :: id_cf, id_reff_rad, id_frac_liq, id_qcl_rad, id_rh_in_cf, &
+ id_simple_rhcrit, id_rh_min
character(len=14), parameter :: mod_name_cld = "cloud_simple"
@@ -86,11 +106,13 @@ subroutine cloud_simple_init (axes, Time)
id_simple_rhcrit = &
register_diag_field ( mod_name_cld, 'simple_rhcrit', axes(1:3), Time, &
- 'RH as a percent', &
+ 'RH as a percent for spookie protocol 1', &
'%')
-
-
+ id_rh_min = &
+ register_diag_field ( mod_name_cld, 'rh_min', axes(1:3), Time, &
+ 'RH as a percent for spookie protocol 2', &
+ '%')
do_init = .false. !initialisation completed
@@ -102,14 +124,14 @@ end subroutine cloud_simple_init
subroutine cloud_simple(p_half, p_full, Time, &
temp, q_hum, &
! outs
- cf, reff_rad, qcl_rad )
+ cf, cca, reff_rad, qcl_rad)
real , intent(in), dimension(:,:,:) :: temp, q_hum, p_full, p_half
type(time_type) , intent(in) :: Time
- real , intent(out), dimension(:,:,:) :: cf, reff_rad, qcl_rad
+ real , intent(out), dimension(:,:,:) :: cf, reff_rad, qcl_rad, cca
- real, dimension(size(temp,1), size(temp, 2), size(temp, 3)) :: qs, frac_liq, rh_in_cf, simple_rhcrit
+ real, dimension(size(temp,1), size(temp, 2), size(temp, 3)) :: qs, frac_liq, rh_in_cf, simple_rhcrit, rh_min, rh_max
integer :: i, j, k, k_surf
@@ -133,16 +155,26 @@ subroutine cloud_simple(p_half, p_full, Time, &
! the simple cloud scheme and cloud fraction.
! rh_in_cf is an output diagnostic only for debugging
call calc_liq_frac(temp(i,j,k), frac_liq(i,j,k))
+
call calc_reff(frac_liq(i,j,k), reff_rad(i,j,k))
- call calc_rhcrit(p_full(i,j,k), p_full(i,j,k_surf), simple_rhcrit(i,j,k))
- call calc_cf(q_hum(i,j,k), qs(i,j,k), simple_rhcrit(i,j,k), cf(i,j,k),rh_in_cf(i,j,k))
- call calc_qcl_rad(p_full(i,j,k), cf(i,j,k), qcl_rad(i,j,k) )
+
+ if (spookie_protocol .eq. 1) then
+ call calc_rhcrit(p_full(i,j,k), p_full(i,j,k_surf), simple_rhcrit(i,j,k))
+ else
+ call calc_rh_min_max(p_full(i,j,k), p_full(i,j,k_surf),rh_min(i,j,k), rh_max(i,j,k))
+ endif
+
+ call calc_cf(q_hum(i,j,k), qs(i,j,k), cf(i,j,k), cca(i,j,k), rh_in_cf(i,j,k), &
+ simple_rhcrit = simple_rhcrit(i,j,k), &
+ rh_min = rh_min(i,j,k), rh_max = rh_max(i,j,k) )
+
+ call calc_qcl_rad(p_full(i,j,k), cf(i,j,k), temp(i,j,k), qcl_rad(i,j,k) )
end do
end do
end do
!save some diagnotics
- call output_cloud_diags(cf, reff_rad, frac_liq, qcl_rad, rh_in_cf, simple_rhcrit, Time )
+ call output_cloud_diags(cf, reff_rad, frac_liq, qcl_rad, rh_in_cf, simple_rhcrit, rh_min, Time )
end subroutine cloud_simple
@@ -176,71 +208,111 @@ subroutine calc_reff(frac_liq, reff_rad)
end subroutine calc_reff
subroutine calc_rhcrit(p_full, p_surf, simple_rhcrit) !need to check p_full - > p_layer_centres
- !get the RH needed as a threshold for the cloud fraction calc.
+ ! get the RH needed as a threshold for the cloud fraction calc.
+ ! This is only requires for spookie_protocol=1
real, intent(in) :: p_full, p_surf
real, intent(out) :: simple_rhcrit
! Calculate RHcrit as function of pressure
- if (p_full > 70000.0 ) then
+ if (p_full > p_base ) then
- simple_rhcrit = rhcsfc - ( rhcsfc - rhc700 ) * &
- ( p_surf - p_full ) / ( p_surf - 70000.0 )
+ simple_rhcrit = rhc_sfc - ( rhc_sfc - rhc_base ) * &
+ ( p_surf - p_full ) / ( p_surf - p_base )
- else if ( p_full > 20000.0 ) then
+ else if ( p_full > p_top ) then
- simple_rhcrit = rhc700 - ( rhc700 - rhc200 ) * &
- ( 70000.0 - p_full) / 50000.0
+ simple_rhcrit = rhc_base - ( rhc_base - rhc_top ) * &
+ (p_base - p_full) / (p_base - p_top)
else
- simple_rhcrit = rhc200
+ simple_rhcrit = rhc_top
endif
end subroutine calc_rhcrit
- subroutine calc_cf (q_hum, qsat, simple_rhcrit, cf, rh)
+ subroutine calc_rh_min_max(p_full, p_surf, rh_min, rh_max)
+
+ real, intent(in) :: p_full, p_surf
+ real, intent(out) :: rh_min, rh_max
+
+
+ if (p_full > p_base ) then !surface up to base
+
+ rh_min = rh_min_sfc - ( rh_min_sfc - rh_min_base ) * ( p_surf - p_full ) / ( p_surf - p_base )
+ rh_max = rh_max_sfc - ( rh_max_sfc - rh_max_base ) * ( p_surf - p_full ) / ( p_surf - p_base )
+
+ else if ( p_full > p_top ) then ! base up to top
+
+ rh_min = rh_min_base - ( rh_min_base - rh_min_top ) * (p_base - p_full) / (p_base - p_top)
+ rh_max = rh_max_base - ( rh_max_base - rh_max_top ) * (p_base - p_full) / (p_base - p_top)
+
+ else ! above top
+
+ rh_min = rh_min_top
+ rh_max = rh_max_top
+
+ endif
+
+
+ end subroutine calc_rh_min_max
+
+ subroutine calc_cf(q_hum, qsat, cf, cca, rh, simple_rhcrit, rh_min, rh_max)
! Calculate LS (stratiform) cloud fraction
! as a simple linear function of RH
- real, intent(in) :: q_hum, qsat, simple_rhcrit
- real, intent(out) :: cf, rh
-
- real :: cca
+ real, intent(in) :: q_hum, qsat
+ real, intent(in), optional :: simple_rhcrit, rh_min, rh_max
+
+ real, intent(out) :: cf, rh, cca
rh = q_hum/qsat
- cf = MAX( 0.0, MIN( 1.0, ( rh - simple_rhcrit ) / ( 1.0 - simple_rhcrit ) ))
+ if (spookie_protocol .eq. 1) then
+ cf = (rh - simple_rhcrit ) / ( 1.0 - simple_rhcrit )
+ cf = MAX( 0.0, MIN( 1.0, cf))
+
+ else
+ cf = (rh - rh_min ) / ( rh_max - rh_min )
+ cf = MAX( 0.0, MIN( 1.0, cf))
+ end if
! include simple convective cloud fraction where present (not currenly used)
cca = 0.0 ! no convective cloud fraction is calculated
- ! left in for future use
+ ! left in for future use
if (cca > 0.0) then
- cf = MAX( simple_cca, cf )
+ cf = MAX( simple_cca, cf )
end if
-
+
end subroutine calc_cf
- subroutine calc_qcl_rad(p_full, cf, qcl_rad)
+ subroutine calc_qcl_rad(p_full, cf, temp, qcl_rad)
! calculate cloud water content
- real , intent(in) :: p_full, cf
- real , intent(out) :: qcl_rad
+ real , intent(in) :: p_full, cf, temp
+ real , intent(out) :: qcl_rad
real :: in_cloud_qcl
-
- in_cloud_qcl = 3.0e-4 + &
- (1.0-3.0e-4)*(p_full-20000.0)/80000.0
-
- in_cloud_qcl = MAX ( 0.0, in_cloud_qcl/1000.0 ) ! convert to kg/kg
-
- qcl_rad = cf * in_cloud_qcl
+
+ IF (spookie_protocol .eq. 1) THEN
+ ! pressure dependent in_cloud_qcl
+ in_cloud_qcl = 3.0e-4 + (1.0-3.0e-4)*(p_full-p_top)/80000.0
+ in_cloud_qcl = MAX ( 0.0, in_cloud_qcl/1000.0 ) ! convert to kg/kg
+ qcl_rad = cf * in_cloud_qcl
+ ELSE
+ ! temperatue dependent in_cloud_qcl
+ in_cloud_qcl = MIN(0.2, 0.2 * ( temp - 220. ) / ( 280. -220. ))
+ in_cloud_qcl = MAX (3.0e-4, in_cloud_qcl/1000.0 ) ! convert to kg/kg
+ qcl_rad = cf * in_cloud_qcl
+ ENDIF
end subroutine calc_qcl_rad
- subroutine output_cloud_diags(cf, reff_rad, frac_liq, qcl_rad, rh_in_cf, simple_rhcrit, Time)
+ subroutine output_cloud_diags(cf, reff_rad, frac_liq, qcl_rad, rh_in_cf, simple_rhcrit, rh_min, Time)
- real, intent(in), dimension(:,:,:) :: cf, reff_rad, frac_liq, qcl_rad, rh_in_cf, simple_rhcrit
+ real, intent(in), dimension(:,:,:) :: cf, reff_rad, frac_liq, qcl_rad, rh_in_cf
+ real, intent(in), dimension(:,:,:), optional :: simple_rhcrit, rh_min
type(time_type) , intent(in) :: Time
@@ -270,6 +342,10 @@ subroutine output_cloud_diags(cf, reff_rad, frac_liq, qcl_rad, rh_in_cf, simple_
used = send_data ( id_simple_rhcrit, simple_rhcrit*100.0, Time)
endif
+ if ( id_rh_min > 0 ) then
+ used = send_data ( id_rh_min, rh_min*100.0, Time)
+ endif
+
end subroutine output_cloud_diags
subroutine cloud_simple_end ()
diff --git a/src/atmos_param/socrates/interface/socrates_calc.F90 b/src/atmos_param/socrates/interface/socrates_calc.F90
index f50910a25..5474d0d5f 100644
--- a/src/atmos_param/socrates/interface/socrates_calc.F90
+++ b/src/atmos_param/socrates/interface/socrates_calc.F90
@@ -33,7 +33,7 @@ subroutine socrates_calc(Time_diag,control, spectrum, &
t_rad_surf, cos_zenith_angle, solar_irrad, orog_corr, &
l_planet_grey_surface, planet_albedo, planet_emissivity, &
layer_heat_capacity, &
- cld_frac, reff_rad, mmr_cl_rad, &
+ cld_frac, cld_conv_frac, reff_rad, mmr_cl_rad, &
flux_direct, flux_down, flux_up, &
flux_down_clear, flux_up_clear, &
heating_rate, spectral_olr)
@@ -118,7 +118,10 @@ subroutine socrates_calc(Time_diag,control, spectrum, &
! Heat capacity of layer
real(r_def), intent(in) :: cld_frac(n_profile, n_layer)
-! Cloud fraction at layer centres
+! Cloud fraction at layer centres for stratocumulus cloud
+
+real(r_def), intent(in) :: cld_conv_frac(n_profile, n_layer)
+! Cloud fraction at layer centres for convective cloud
real(r_def), intent(in) :: reff_rad(n_profile, n_layer)
! Cloud liquid particle radius from simple cloud scheme
@@ -185,11 +188,12 @@ subroutine socrates_calc(Time_diag,control, spectrum, &
zeros_cld = 0.
ten_microns_cld = 1.
call set_cld(cld, control, dimen, spectrum, n_profile, n_layer, &
+ conv_frac = cld_conv_frac,&
liq_frac = cld_frac, &
- ice_frac = zeros_cld, &
- liq_mmr = mmr_cl_rad, &
- ice_mmr = zeros_cld, &
- liq_dim = reff_rad, &
+ ice_frac = zeros_cld, &
+ liq_mmr = mmr_cl_rad, &
+ ice_mmr = zeros_cld, &
+ liq_dim = reff_rad, &
ice_dim = zeros_cld )
call set_aer(control, dimen, spectrum, aer, n_profile)
diff --git a/src/atmos_param/socrates/interface/socrates_interface.F90 b/src/atmos_param/socrates/interface/socrates_interface.F90
index aa658aadd..912ba2813 100644
--- a/src/atmos_param/socrates/interface/socrates_interface.F90
+++ b/src/atmos_param/socrates/interface/socrates_interface.F90
@@ -505,7 +505,7 @@ subroutine socrates_interface(Time_diag, rlat, rlon, soc_lw_mode, &
fms_temp, fms_spec_hum, fms_ozone, fms_co2, fms_t_surf, &
fms_p_full, fms_p_half, fms_z_full, fms_z_half, fms_albedo, &
fms_coszen, fms_rrsun, n_profile, n_layer, &
- fms_cld_frac, fms_reff_rad, fms_mmr_cl_rad, &
+ fms_cld_frac, fms_cld_conv_frac, fms_reff_rad, fms_mmr_cl_rad,&
output_heating_rate, output_flux_down, output_flux_up, &
output_flux_down_clear, output_flux_up_clear, &
do_cloud_simple, &
@@ -550,6 +550,7 @@ subroutine socrates_interface(Time_diag, rlat, rlon, soc_lw_mode, &
real(r_def), intent(in) :: fms_z_full(:,:,:), fms_z_half(:,:,:)
real(r_def), intent(in) :: fms_rrsun
real(r_def), intent(in) :: fms_cld_frac(:,:,:), fms_reff_rad(:,:,:), fms_mmr_cl_rad(:,:,:)
+ real(r_def), intent(in) :: fms_cld_conv_frac(:,:,:)
logical, intent(in) :: do_cloud_simple
@@ -572,7 +573,8 @@ subroutine socrates_interface(Time_diag, rlat, rlon, soc_lw_mode, &
real(r_def), dimension(n_profile, n_layer) :: input_p, input_t, input_mixing_ratio, &
input_d_mass, input_density, input_layer_heat_capacity, &
soc_heating_rate, input_o3_mixing_ratio, &
- input_co2_mixing_ratio,z_full_reshaped, input_cld_frac, input_reff_rad, input_mmr_cl_rad
+ input_co2_mixing_ratio,z_full_reshaped, input_cld_frac, input_reff_rad, input_mmr_cl_rad, &
+ input_cld_conv_frac
real(r_def), dimension(n_profile, 0:n_layer) :: input_p_level, input_t_level, soc_flux_direct, &
soc_flux_down, soc_flux_up, z_half_reshaped, &
@@ -619,6 +621,8 @@ subroutine socrates_interface(Time_diag, rlat, rlon, soc_lw_mode, &
input_p_level = reshape(fms_p_half(:,:,:),(/si*sj,sk+1 /))
input_cld_frac = reshape(fms_cld_frac(:,:,:),(/si*sj,sk /))
+ input_cld_conv_frac = reshape(fms_cld_conv_frac(:,:,:),(/si*sj,sk /))
+
input_reff_rad = reshape(fms_reff_rad(:,:,:),(/si*sj,sk /))
input_mmr_cl_rad = reshape(fms_mmr_cl_rad(:,:,:),(/si*sj,sk/))
@@ -743,6 +747,7 @@ subroutine socrates_interface(Time_diag, rlat, rlon, soc_lw_mode, &
input_planet_emissivity, &
input_layer_heat_capacity(idx_chunk_start:idx_chunk_end,:), &
input_cld_frac(idx_chunk_start:idx_chunk_end,:), &
+ input_cld_conv_frac(idx_chunk_start:idx_chunk_end,:), &
input_reff_rad(idx_chunk_start:idx_chunk_end,:), &
input_mmr_cl_rad(idx_chunk_start:idx_chunk_end,:), &
soc_flux_direct(idx_chunk_start:idx_chunk_end,:), &
@@ -774,6 +779,7 @@ subroutine socrates_interface(Time_diag, rlat, rlon, soc_lw_mode, &
input_planet_emissivity, &
input_layer_heat_capacity(idx_chunk_start:idx_chunk_end,:), &
input_cld_frac(idx_chunk_start:idx_chunk_end,:), &
+ input_cld_conv_frac(idx_chunk_start:idx_chunk_end,:), &
input_reff_rad(idx_chunk_start:idx_chunk_end,:), &
input_mmr_cl_rad(idx_chunk_start:idx_chunk_end,:), &
soc_flux_direct(idx_chunk_start:idx_chunk_end,:), &
@@ -806,7 +812,7 @@ subroutine socrates_interface(Time_diag, rlat, rlon, soc_lw_mode, &
end subroutine socrates_interface
subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf_in, p_full_in, p_half_in, z_full_in, z_half_in, albedo_in, &
- temp_tend, net_surf_sw_down, surf_lw_down, delta_t, do_cloud_simple, cf_rad, reff_rad, qcl_rad)
+ temp_tend, net_surf_sw_down, surf_lw_down, delta_t, do_cloud_simple, cf_rad, cca_rad, reff_rad, qcl_rad)
use astronomy_mod, only: diurnal_solar
use constants_mod, only: pi, wtmco2, wtmozone, rdgas, gas_constant
@@ -822,12 +828,12 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
real, intent(out), dimension(:,:) :: net_surf_sw_down, surf_lw_down
real, intent(in) :: delta_t
logical, intent(in) :: do_cloud_simple
- real, intent(in), dimension(:,:,:) :: cf_rad, reff_rad, qcl_rad
+ real, intent(in), dimension(:,:,:) :: cf_rad, cca_rad, reff_rad, qcl_rad
integer(i_def) :: n_profile, n_layer
real(r_def), dimension(size(temp_in,1), size(temp_in,2)) :: t_surf_for_soc, rad_lat_soc, rad_lon_soc, albedo_soc
- real(r_def), dimension(size(temp_in,1), size(temp_in,2), size(temp_in,3)) :: tg_tmp_soc, q_soc, ozone_soc, co2_soc, p_full_soc, output_heating_rate_sw, output_heating_rate_lw, output_heating_rate_total, z_full_soc, cld_frac_soc, reff_rad_soc, mmr_cl_rad_soc, qcl_rad_soc
+ real(r_def), dimension(size(temp_in,1), size(temp_in,2), size(temp_in,3)) :: tg_tmp_soc, q_soc, ozone_soc, co2_soc, p_full_soc, output_heating_rate_sw, output_heating_rate_lw, output_heating_rate_total, z_full_soc, cld_frac_soc, reff_rad_soc, mmr_cl_rad_soc, qcl_rad_soc, cld_conv_frac_soc
real(r_def), dimension(size(temp_in,1), size(temp_in,2), size(temp_in,3)+1) :: p_half_soc, t_half_out, &
z_half_soc,output_soc_flux_sw_down, output_soc_flux_sw_up, output_soc_flux_lw_down, output_soc_flux_lw_up, &
output_soc_flux_lw_down_clear, output_soc_flux_lw_up_clear, output_soc_flux_sw_down_clear, output_soc_flux_sw_up_clear
@@ -937,19 +943,36 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
outputted_soc_spectral_olr = spectral_olr_store
endif
else
+ !all sky heating rates.
output_heating_rate_sw = 0.
output_heating_rate_lw = 0.
+
+ !all sky and clear sky fluxes.
thd_sw_flux_net = 0.
thd_lw_flux_net = 0.
+
net_surf_sw_down = 0.
+ net_surf_sw_down_clear = 0.
+
surf_sw_down = 0.
+ surf_sw_down_clear = 0.
+
surf_lw_down = 0.
+ surf_lw_down_clear = 0.
+
surf_lw_net = 0.
+ surf_lw_net_clear = 0.
+
toa_sw = 0.
+ toa_sw_clear = 0.
+
toa_sw_down = 0.
+ toa_sw_down_clear = 0.
+
olr = 0.
olr_clear = 0.
+ !Others
coszen = 0.
ozone_in = 0.
co2_in = 0.
@@ -1121,6 +1144,8 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
if(do_cloud_simple) then
cld_frac_soc = REAL(cf_rad, kind(r_def))
+ cld_conv_frac_soc = REAL(cca_rad, kind(r_def))
+
reff_rad_soc = REAL(reff_rad, kind(r_def))
qcl_rad_soc = REAL(qcl_rad, kind(r_def))
@@ -1128,6 +1153,8 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
else
cld_frac_soc = 0.
+ cld_conv_frac_soc = 0.
+
reff_rad_soc = 0.
mmr_cl_rad_soc = 0.
@@ -1156,7 +1183,7 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
CALL socrates_interface(Time, rad_lat_soc, rad_lon_soc, soc_lw_mode, &
tg_tmp_soc, q_soc, ozone_soc, co2_soc, t_surf_for_soc, p_full_soc, &
p_half_soc, z_full_soc, z_half_soc, albedo_soc, coszen, rrsun, &
- n_profile, n_layer, cld_frac_soc, reff_rad_soc, mmr_cl_rad_soc, &
+ n_profile, n_layer, cld_frac_soc, cld_conv_frac_soc, reff_rad_soc, mmr_cl_rad_soc,&
output_heating_rate_lw, output_soc_flux_lw_down, output_soc_flux_lw_up, &
output_soc_flux_lw_down_clear, output_soc_flux_lw_up_clear, &
do_cloud_simple, &
@@ -1166,7 +1193,7 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
tg_tmp_soc = tg_tmp_soc + output_heating_rate_lw*delta_t !Output heating rate in K/s, so is a temperature tendency
- surf_lw_down(:,:) = REAL(output_soc_flux_lw_down(:,:, n_layer+1))
+ surf_lw_down(:,:) = REAL(output_soc_flux_lw_down(:,:, n_layer+1))
surf_lw_down_clear(:,:) = REAL(output_soc_flux_lw_down_clear(:,:, n_layer+1))
surf_lw_net(:,:) = REAL(output_soc_flux_lw_up(:,:,n_layer+1) - &
@@ -1187,7 +1214,7 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
CALL socrates_interface(Time, rad_lat_soc, rad_lon_soc, soc_lw_mode, &
tg_tmp_soc, q_soc, ozone_soc, co2_soc, t_surf_for_soc, p_full_soc, &
p_half_soc, z_full_soc, z_half_soc, albedo_soc, coszen, rrsun, &
- n_profile, n_layer, cld_frac_soc, reff_rad_soc, mmr_cl_rad_soc, &
+ n_profile, n_layer, cld_frac_soc, cld_conv_frac_soc, reff_rad_soc, mmr_cl_rad_soc, &
output_heating_rate_sw, output_soc_flux_sw_down, output_soc_flux_sw_up, &
output_soc_flux_sw_down_clear, output_soc_flux_sw_up_clear, &
do_cloud_simple)
@@ -1348,7 +1375,33 @@ subroutine run_socrates_end
if(do_read_ozone) call interpolator_end(o3_interp)
if(do_read_co2) call interpolator_end(co2_interp)
-
+
+ DEALLOCATE(soc_bins_lw)
+ DEALLOCATE(soc_bins_sw)
+ DEALLOCATE(outputted_soc_spectral_olr)
+ DEALLOCATE(tdt_soc_sw_store)
+ DEALLOCATE(tdt_soc_lw_store)
+ DEALLOCATE(net_surf_sw_down_store)
+ DEALLOCATE(surf_lw_down_store)
+
+ if (id_soc_flux_lw > 0) DEALLOCATE(thd_lw_flux_net_store)
+ if (id_soc_flux_sw > 0) DEALLOCATE(thd_sw_flux_net_store)
+ if (id_soc_surf_flux_sw_clear > 0) DEALLOCATE(net_surf_sw_down_clear_store)
+ if (id_soc_surf_flux_lw_down_clear > 0) DEALLOCATE(surf_lw_down_clear_store)
+ if (id_soc_surf_flux_lw > 0) DEALLOCATE(surf_lw_net_store)
+ if (id_soc_surf_flux_lw_clear > 0) DEALLOCATE(surf_lw_net_clear_store)
+ if (id_soc_surf_flux_sw_down > 0) DEALLOCATE(surf_sw_down_store)
+ if (id_soc_surf_flux_sw_down_clear > 0) DEALLOCATE(surf_sw_down_clear_store)
+ if (id_soc_olr > 0) DEALLOCATE(olr_store)
+ if (id_soc_olr_clear > 0) DEALLOCATE(olr_clear_store)
+ if (id_soc_toa_sw > 0) DEALLOCATE(toa_sw_store)
+ if (id_soc_toa_sw_clear > 0) DEALLOCATE(toa_sw_clear_store)
+ if (id_soc_toa_sw_down > 0) DEALLOCATE(toa_sw_down_store)
+ if (id_soc_toa_sw_down_clear > 0) DEALLOCATE(toa_sw_down_clear_store)
+ if (id_soc_coszen > 0) DEALLOCATE(coszen_store)
+ if (id_soc_ozone > 0) DEALLOCATE(thd_ozone_store)
+ if (id_soc_co2 > 0 ) DEALLOCATE(thd_co2_store)
+ if (id_soc_spectral_olr > 0) DEALLOCATE(spectral_olr_store)
end subroutine run_socrates_end
diff --git a/src/atmos_spectral/driver/solo/idealized_moist_phys.F90 b/src/atmos_spectral/driver/solo/idealized_moist_phys.F90
index b9815c0d8..cc25b1856 100644
--- a/src/atmos_spectral/driver/solo/idealized_moist_phys.F90
+++ b/src/atmos_spectral/driver/solo/idealized_moist_phys.F90
@@ -801,7 +801,7 @@ subroutine idealized_moist_phys(Time, p_half, p_full, z_half, z_full, ug, vg, tg
real, dimension(size(ug,1), size(ug,2), size(ug,3)) :: tg_tmp, qg_tmp, RH,tg_interp, mc, dt_ug_conv, dt_vg_conv
! Simple cloud scheme variabilies to pass to radiation
-real, dimension(size(ug,1), size(ug,2), size(ug,3)) :: cf_rad, reff_rad, qcl_rad
+real, dimension(size(ug,1), size(ug,2), size(ug,3)) :: cf_rad, reff_rad, qcl_rad, cca_rad
real, intent(in) , dimension(:,:,:), optional :: mask
integer, intent(in) , dimension(:,:), optional :: kbot
@@ -982,8 +982,8 @@ subroutine idealized_moist_phys(Time, p_half, p_full, z_half, z_full, ug, vg, tg
tg(:,:,:,previous), &
grid_tracers(:,:,:,previous,nsphum), &
! outs -
- cf_rad(:,:,:), reff_rad(:,:,:), &
- qcl_rad(:,:,:) &
+ cf_rad(:,:,:), cca_rad(:,:,:), &
+ reff_rad(:,:,:), qcl_rad(:,:,:) &
)
endif
@@ -1131,7 +1131,7 @@ subroutine idealized_moist_phys(Time, p_half, p_full, z_half, z_full, ug, vg, tg
endif
call run_socrates(Time, Time+Time_step, rad_lat, rad_lon, tg(:,:,:,previous), grid_tracers(:,:,:,previous,nsphum), t_surf(:,:), p_full(:,:,:,current), &
- p_half(:,:,:,current),z_full(:,:,:,current),z_half(:,:,:,current), albedo, dt_tg(:,:,:), net_surf_sw_down(:,:), surf_lw_down(:,:), delta_t, do_cloud_simple, cf_rad(:,:,:), reff_rad(:,:,:), &
+ p_half(:,:,:,current),z_full(:,:,:,current),z_half(:,:,:,current), albedo, dt_tg(:,:,:), net_surf_sw_down(:,:), surf_lw_down(:,:), delta_t, do_cloud_simple, cf_rad(:,:,:), cca_rad(:,:,:), reff_rad(:,:,:), &
qcl_rad(:,:,:) )
endif
From 4d7a903d059d7f3e70c867cc76f9b03ba0466cc7 Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Thu, 28 Mar 2019 14:27:50 +0000
Subject: [PATCH 072/304] Remove real conversions in soc_interface
---
.../socrates_aquaplanet_with_cloud.py | 15 ++++-----------
src/atmos_param/cloud_simple/cloud_simple.F90 | 3 +++
.../socrates/interface/socrates_interface.F90 | 4 ++--
.../socrates/interface/socrates_set_cld.F90 | 2 +-
4 files changed, 10 insertions(+), 14 deletions(-)
diff --git a/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
index 3e8e3813d..bc967d954 100644
--- a/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
+++ b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
@@ -129,21 +129,14 @@
'do_cloud_simple': True
},
- 'cloud_simple_nml': {
- 'simple_cca':0.0,
- 'rhcsfc': 0.95,
- 'rhc700': 0.7,
- 'rhc200': 0.3
- },
-
'vert_turb_driver_nml': {
'do_mellor_yamada': False, # default: True
'do_diffusivity': True, # default: False
'do_simple': True, # default: False
'constant_gust': 0.0, # default: 1.0
- 'use_tau': False
+ 'use_tau': False,
},
-
+
'diffusivity_nml': {
'do_entrain':False,
'do_simple': True,
@@ -227,5 +220,5 @@
cb.compile(debug=False)
exp.run(1, use_restart=False, num_cores=NCORES, overwrite_data=True)#, run_idb=True)
-# for i in range(2,171):
-# exp.run(i, num_cores=NCORES)
+ for i in range(2,121):
+ exp.run(i, num_cores=NCORES)
diff --git a/src/atmos_param/cloud_simple/cloud_simple.F90 b/src/atmos_param/cloud_simple/cloud_simple.F90
index b51cc84fe..184923dc7 100644
--- a/src/atmos_param/cloud_simple/cloud_simple.F90
+++ b/src/atmos_param/cloud_simple/cloud_simple.F90
@@ -280,6 +280,9 @@ subroutine calc_cf(q_hum, qsat, cf, cca, rh, simple_rhcrit, rh_min, rh_max)
cca = 0.0 ! no convective cloud fraction is calculated
! left in for future use
+ !cca can not be used in simple clouds as in read_control
+ ! control%i_cloud_representation = ip_cloud_ice_water
+
if (cca > 0.0) then
cf = MAX( simple_cca, cf )
end if
diff --git a/src/atmos_param/socrates/interface/socrates_interface.F90 b/src/atmos_param/socrates/interface/socrates_interface.F90
index 912ba2813..38a72da7f 100644
--- a/src/atmos_param/socrates/interface/socrates_interface.F90
+++ b/src/atmos_param/socrates/interface/socrates_interface.F90
@@ -879,7 +879,7 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
endif
if (id_soc_surf_flux_lw > 0) then
- surf_lw_net = real(surf_lw_net_store)
+ surf_lw_net = surf_lw_net_store
endif
if (id_soc_surf_flux_lw_clear > 0) then
@@ -1268,7 +1268,7 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
endif
if (id_soc_surf_flux_lw > 0) then
- surf_lw_net_store = real(surf_lw_net, kind(r_def))
+ surf_lw_net_store = surf_lw_net
endif
if (id_soc_surf_flux_sw_down > 0) then
diff --git a/src/atmos_param/socrates/interface/socrates_set_cld.F90 b/src/atmos_param/socrates/interface/socrates_set_cld.F90
index 99fd4a30e..3af8423b8 100644
--- a/src/atmos_param/socrates/interface/socrates_set_cld.F90
+++ b/src/atmos_param/socrates/interface/socrates_set_cld.F90
@@ -348,7 +348,7 @@ subroutine set_cld(cld, control, dimen, spectrum, n_profile, n_layer, &
cloud_frac(l, k)*ice_frac(l, k) / (liq_frac(l, k)+ice_frac(l, k))
else
cld%frac_cloud(l, k, ip_cloud_type_water) = 0.0_r_def
- cld%frac_cloud(l, k, ip_cloud_type_ice) = 0.0_r_def
+ cld%frac_cloud(l, k, ip_cloud_type_ice) = 0.0_r_def
end if
end do
end do
From 48d9e795d7dff0befc300aec3b5c9921eb6891b0 Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Wed, 10 Apr 2019 10:44:23 +0100
Subject: [PATCH 073/304] Adding extra diagnostics to test case
---
.../socrates_test/socrates_aquaplanet_with_cloud.py | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
index bc967d954..389e0b898 100644
--- a/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
+++ b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
@@ -39,6 +39,8 @@
diag.add_field('atmosphere', 'precipitation', time_avg=True)
diag.add_field('atmosphere', 'rh', time_avg=True)
diag.add_field('mixed_layer', 't_surf', time_avg=True)
+diag.add_field('mixed_layer', 'flux_t', time_avg=True) #LH
+diag.add_field('mixed_layer', 'flux_lhe', time_avg=True) #SH
diag.add_field('dynamics', 'sphum', time_avg=True)
diag.add_field('dynamics', 'ucomp', time_avg=True)
diag.add_field('dynamics', 'vcomp', time_avg=True)
@@ -218,7 +220,9 @@
if __name__=="__main__":
cb.compile(debug=False)
- exp.run(1, use_restart=False, num_cores=NCORES, overwrite_data=True)#, run_idb=True)
+ overwrite=False
+
+ exp.run(1, use_restart=False, num_cores=NCORES, overwrite_data=overwrite)#, run_idb=True)
for i in range(2,121):
- exp.run(i, num_cores=NCORES)
+ exp.run(i, num_cores=NCORES, overwrite_data=overwrite)
From 896c2f59d93a2b960db392b2b2e3f8f94fade8f2 Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Tue, 7 Apr 2020 13:52:29 +0100
Subject: [PATCH 074/304] Update to ignore for itcx_mip file
---
.gitignore | 1 +
1 file changed, 1 insertion(+)
diff --git a/.gitignore b/.gitignore
index 4333c2fac..6393fe876 100644
--- a/.gitignore
+++ b/.gitignore
@@ -29,3 +29,4 @@ mima_pz.txt
src/atmos_param/socrates/src/trunk*
test/.cache
test/results.xml
+exp/itcz_mip_exp/itcz_mip_q_flux.nc
From 73fb271a8d963773c30182ef0e11f23c8f249e5e Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Tue, 14 Apr 2020 10:43:15 +0100
Subject: [PATCH 075/304] Correct errors made during rebase. Code runs but
needs to be checked for changes in the cloud scheme to make sure all changes
survived the rebase.
---
exp/test_cases/socrates_test/socrates_aquaplanet.py | 3 +--
.../socrates_test/socrates_aquaplanet_with_cloud.py | 6 +++---
src/atmos_param/socrates/interface/socrates_config_mod.f90 | 3 +--
src/atmos_param/socrates/interface/socrates_interface.F90 | 2 +-
4 files changed, 6 insertions(+), 8 deletions(-)
diff --git a/exp/test_cases/socrates_test/socrates_aquaplanet.py b/exp/test_cases/socrates_test/socrates_aquaplanet.py
index c3a79572b..6d0698d6d 100644
--- a/exp/test_cases/socrates_test/socrates_aquaplanet.py
+++ b/exp/test_cases/socrates_test/socrates_aquaplanet.py
@@ -100,7 +100,6 @@
'use_pressure_interp_for_half_levels':False,
'tidally_locked':False,
#'solday': 90
- 'account_for_clouds_in_socrates': True,
},
'idealized_moist_phys_nml': {
'do_damping': True,
@@ -211,4 +210,4 @@
#This will be the name of the folder that the data will appear in.
exp.run(1, use_restart=False, num_cores=NCORES, overwrite_data=False)
for i in range(2,121):
- exp.run(i, num_cores=NCORES)
\ No newline at end of file
+ exp.run(i, num_cores=NCORES)
diff --git a/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
index 389e0b898..792a8d771 100644
--- a/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
+++ b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
@@ -220,9 +220,9 @@
if __name__=="__main__":
cb.compile(debug=False)
- overwrite=False
+ overwrite=True
exp.run(1, use_restart=False, num_cores=NCORES, overwrite_data=overwrite)#, run_idb=True)
- for i in range(2,121):
- exp.run(i, num_cores=NCORES, overwrite_data=overwrite)
+ #for i in range(2,121):
+ # exp.run(i, num_cores=NCORES, overwrite_data=overwrite)
diff --git a/src/atmos_param/socrates/interface/socrates_config_mod.f90 b/src/atmos_param/socrates/interface/socrates_config_mod.f90
index 085fa5f80..a0d102d5f 100644
--- a/src/atmos_param/socrates/interface/socrates_config_mod.f90
+++ b/src/atmos_param/socrates/interface/socrates_config_mod.f90
@@ -127,6 +127,5 @@ module socrates_config_mod
inc_h2o, inc_co2, inc_co, inc_o3, inc_n2o, inc_ch4, inc_o2, &
inc_so2, inc_cfc11, inc_cfc12, inc_cfc113, inc_hcfc22, inc_hfc134a, &
use_pressure_interp_for_half_levels, &
- frierson_solar_rad, del_sol, del_sw, &
- account_for_clouds_in_socrates
+ frierson_solar_rad, del_sol, del_sw
end module socrates_config_mod
diff --git a/src/atmos_param/socrates/interface/socrates_interface.F90 b/src/atmos_param/socrates/interface/socrates_interface.F90
index 38a72da7f..587703d18 100644
--- a/src/atmos_param/socrates/interface/socrates_interface.F90
+++ b/src/atmos_param/socrates/interface/socrates_interface.F90
@@ -81,7 +81,7 @@ MODULE socrates_interface_mod
REAL(r_def), allocatable, dimension(:,:,:) :: tdt_soc_sw_store, tdt_soc_lw_store
REAL(r_def), allocatable, dimension(:,:,:) :: thd_sw_flux_net_store, thd_lw_flux_net_store
REAL(r_def), allocatable, dimension(:,:,:) :: thd_co2_store, thd_ozone_store
- REAL(r_def), allocatable, dimension(:,:) :: net_surf_sw_down_store, surf_lw_down_store, surf_lw_net_store, surf_lw_net_store, &
+ REAL(r_def), allocatable, dimension(:,:) :: net_surf_sw_down_store, surf_lw_down_store, surf_lw_net_store, &
surf_sw_down_store, toa_sw_down_store, &
toa_sw_store, olr_store, coszen_store
REAL(r_def), allocatable, dimension(:,:) :: net_surf_sw_down_clear_store, surf_sw_down_clear_store, &
From 72b3502a7367cab9f44939b43fc22392c0511dcb Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Tue, 14 Apr 2020 10:58:30 +0100
Subject: [PATCH 076/304] Resolving push/pull conflicts
---
.../socrates_test/socrates_aquaplanet.py | 4 --
.../socrates_aquaplanet_with_cloud.py | 10 ----
.../socrates/interface/socrates_interface.F90 | 51 +------------------
3 files changed, 1 insertion(+), 64 deletions(-)
diff --git a/exp/test_cases/socrates_test/socrates_aquaplanet.py b/exp/test_cases/socrates_test/socrates_aquaplanet.py
index b78739a0f..dc1d8cf57 100644
--- a/exp/test_cases/socrates_test/socrates_aquaplanet.py
+++ b/exp/test_cases/socrates_test/socrates_aquaplanet.py
@@ -57,13 +57,9 @@
diag.add_field('socrates', 'soc_surf_flux_sw_down', time_avg=True)
#net (up) TOA and downard fluxes
diag.add_field('socrates', 'soc_olr', time_avg=True)
-<<<<<<< HEAD
diag.add_field('socrates', 'soc_toa_sw', time_avg=True)
diag.add_field('socrates', 'soc_toa_sw_down', time_avg=True)
-=======
-diag.add_field('socrates', 'soc_toa_sw', time_avg=True)
->>>>>>> 4d2517d99d3c46cad93915ffd20b06a38a508f60
diag.add_field('cloud_simple', 'cf_rad', time_avg=True)
diag.add_field('cloud_simple', 'reff_rad', time_avg=True)
diag.add_field('cloud_simple', 'frac_liq', time_avg=True)
diff --git a/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
index 40caf7a84..d95703e47 100644
--- a/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
+++ b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
@@ -220,18 +220,8 @@
if __name__=="__main__":
cb.compile(debug=False)
-<<<<<<< HEAD
overwrite=True
-
exp.run(1, use_restart=False, num_cores=NCORES, overwrite_data=overwrite)#, run_idb=True)
-
#for i in range(2,121):
# exp.run(i, num_cores=NCORES, overwrite_data=overwrite)
-=======
- overwrite=False
-
- exp.run(1, use_restart=False, num_cores=NCORES, overwrite_data=overwrite)#, run_idb=True)
- for i in range(2,121):
- exp.run(i, num_cores=NCORES, overwrite_data=overwrite)
->>>>>>> 4d2517d99d3c46cad93915ffd20b06a38a508f60
diff --git a/src/atmos_param/socrates/interface/socrates_interface.F90 b/src/atmos_param/socrates/interface/socrates_interface.F90
index 32e494ff6..88bde690f 100644
--- a/src/atmos_param/socrates/interface/socrates_interface.F90
+++ b/src/atmos_param/socrates/interface/socrates_interface.F90
@@ -55,7 +55,7 @@ MODULE socrates_interface_mod
! INTEGER :: id_soc_surf_spectrum_sw !not implemented yet
INTEGER :: id_soc_tdt_sw, id_soc_tdt_lw, id_soc_tdt_rad
INTEGER :: id_soc_surf_flux_lw, id_soc_surf_flux_sw
-<<<<<<< HEAD
+
INTEGER :: id_soc_surf_flux_lw_down, id_soc_surf_flux_sw_down
INTEGER :: id_soc_surf_flux_lw_clear, id_soc_surf_flux_sw_clear
@@ -68,14 +68,6 @@ MODULE socrates_interface_mod
INTEGER :: id_soc_toa_sw_down
INTEGER :: id_soc_toa_sw_down_clear
-=======
- INTEGER :: id_soc_surf_flux_lw_clear, id_soc_surf_flux_sw_clear
- INTEGER :: id_soc_surf_flux_lw_down, id_soc_surf_flux_sw_down
- INTEGER :: id_soc_surf_flux_lw_down_clear, id_soc_surf_flux_sw_down_clear
- INTEGER :: id_soc_flux_lw, id_soc_flux_sw
- INTEGER :: id_soc_olr, id_soc_toa_sw, id_soc_olr_clear, id_soc_toa_sw_clear
- INTEGER :: id_soc_toa_sw_down, id_soc_toa_sw_down_clear
->>>>>>> 4d2517d99d3c46cad93915ffd20b06a38a508f60
INTEGER :: id_soc_ozone, id_soc_co2, id_soc_coszen
INTEGER :: n_soc_bands_lw, n_soc_bands_sw
@@ -280,27 +272,16 @@ SUBROUTINE socrates_init(is, ie, js, je, num_levels, axes, Time, lat, lonb, latb
'socrates Net LW surface flux (up)', &
'watts/m2', missing_value=missing_value )
-<<<<<<< HEAD
- id_soc_surf_flux_lw_down = &
- register_diag_field ( soc_mod_name, 'soc_surf_flux_lw_down', axes(1:2), Time, &
- 'socrates LW surface flux down', &
- 'watts/m2', missing_value=missing_value )
-
-=======
->>>>>>> 4d2517d99d3c46cad93915ffd20b06a38a508f60
id_soc_surf_flux_lw_clear = &
register_diag_field ( soc_mod_name, 'soc_surf_flux_lw_clear', axes(1:2), Time, &
'socrates Net LW surface flux (up) clear sky', &
'watts/m2', missing_value=missing_value )
-<<<<<<< HEAD
-=======
id_soc_surf_flux_lw_down = &
register_diag_field ( soc_mod_name, 'soc_surf_flux_lw_down', axes(1:2), Time, &
'socrates LW surface flux down', &
'watts/m2', missing_value=missing_value )
->>>>>>> 4d2517d99d3c46cad93915ffd20b06a38a508f60
id_soc_surf_flux_lw_down_clear = &
register_diag_field ( soc_mod_name, 'soc_surf_flux_lw_down_clear', axes(1:2), Time, &
'socrates LW surface flux down clear sky', &
@@ -446,10 +427,6 @@ SUBROUTINE socrates_init(is, ie, js, je, num_levels, axes, Time, lat, lonb, latb
if (id_soc_surf_flux_sw_down_clear > 0) then
allocate(surf_sw_down_clear_store(size(lonb,1)-1, size(latb,2)-1))
endif
-<<<<<<< HEAD
-
-=======
->>>>>>> 4d2517d99d3c46cad93915ffd20b06a38a508f60
if (id_soc_olr > 0) then
allocate(olr_store(size(lonb,1)-1, size(latb,2)-1))
endif
@@ -469,11 +446,6 @@ SUBROUTINE socrates_init(is, ie, js, je, num_levels, axes, Time, lat, lonb, latb
if (id_soc_toa_sw_down_clear > 0) then
allocate(toa_sw_down_clear_store(size(lonb,1)-1, size(latb,2)-1))
endif
-<<<<<<< HEAD
-=======
-
->>>>>>> 4d2517d99d3c46cad93915ffd20b06a38a508f60
-
if (id_soc_coszen > 0) then
allocate(coszen_store(size(lonb,1)-1, size(latb,2)-1))
endif
@@ -868,11 +840,7 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
logical :: soc_lw_mode, used
integer :: seconds, days, year_in_s
real :: r_seconds, r_days, r_total_seconds, frac_of_day, frac_of_year, gmt, time_since_ae, rrsun, dt_rad_radians, day_in_s, r_solday, r_dt_rad_avg
-<<<<<<< HEAD
real, dimension(size(temp_in,1), size(temp_in,2)) :: coszen, fracsun, surf_lw_net, olr, toa_sw, p2, toa_sw_down, surf_sw_down
-=======
- real, dimension(size(temp_in,1), size(temp_in,2)) :: coszen, fracsun, surf_lw_net, olr, toa_sw, toa_sw_down, surf_sw_down
->>>>>>> 4d2517d99d3c46cad93915ffd20b06a38a508f60
real, dimension(size(temp_in,1), size(temp_in,2)) :: olr_clear, toa_sw_clear, toa_sw_down_clear
real, dimension(size(temp_in,1), size(temp_in,2)) :: surf_lw_down_clear, surf_lw_net_clear, &
@@ -927,10 +895,6 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
if (id_soc_surf_flux_sw_down > 0) then
surf_sw_down = surf_sw_down_store
endif
-<<<<<<< HEAD
-=======
-
->>>>>>> 4d2517d99d3c46cad93915ffd20b06a38a508f60
if (id_soc_surf_flux_sw_down_clear > 0) then
surf_sw_down_clear = surf_sw_down_clear_store
endif
@@ -957,13 +921,6 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
if (id_soc_toa_sw_down_clear > 0) then
toa_sw_down_clear = toa_sw_down_clear_store
endif
-<<<<<<< HEAD
-
- if (id_soc_toa_sw_down > 0) then
- toa_sw_down = toa_sw_down_store
- endif
-=======
->>>>>>> 4d2517d99d3c46cad93915ffd20b06a38a508f60
if (id_soc_coszen > 0) then
coszen = coszen_store
@@ -1268,15 +1225,9 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
output_soc_flux_sw_up(:,:,1))
toa_sw_clear(:,:) = REAL(output_soc_flux_sw_down_clear(:,:,1) - &
output_soc_flux_sw_up_clear(:,:,1))
-<<<<<<< HEAD
-
- thd_sw_flux_net = REAL(output_soc_flux_sw_up - output_soc_flux_sw_down) !net sw all levels
-
-=======
thd_sw_flux_net = REAL(output_soc_flux_sw_up - output_soc_flux_sw_down) !net sw all levels
->>>>>>> 4d2517d99d3c46cad93915ffd20b06a38a508f60
toa_sw_down(:,:) = REAL(output_soc_flux_sw_down(:,:,1))
toa_sw_down_clear(:,:) = REAL(output_soc_flux_sw_down_clear(:,:,1))
From 2b4312613e495ba90dc76a24fcc55883d80a1b64 Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Wed, 5 Sep 2018 16:18:11 +0100
Subject: [PATCH 077/304] Add file to paths and namelist variables in test
scripts
---
exp/test_cases/MiMA/MiMA_test_case.py | 12 +++++++++++-
exp/test_cases/socrates_test/socrates_aquaplanet.py | 11 +++++++++++
src/extra/model/isca/path_names | 1 +
src/extra/model/socrates/path_names | 1 +
4 files changed, 24 insertions(+), 1 deletion(-)
diff --git a/exp/test_cases/MiMA/MiMA_test_case.py b/exp/test_cases/MiMA/MiMA_test_case.py
index 270596744..f21ba6404 100644
--- a/exp/test_cases/MiMA/MiMA_test_case.py
+++ b/exp/test_cases/MiMA/MiMA_test_case.py
@@ -73,7 +73,17 @@
'do_simple': True,
'roughness_mom':3.21e-05,
'roughness_heat':3.21e-05,
- 'roughness_moist':3.21e-05,
+ 'roughness_moist':3.21e-05,
+ 'do_cloud_simple': True,
+ },
+ 'cloud_simple_nml': {
+ 'simple_cca':0.0,
+ 'rhcsfc': 0.95,
+ 'rhc700': 0.7,
+ 'rhc200': 0.3,
+ 'rhmsfc': 0.95,
+ 'rhm700': 0.7,
+ 'rhm200': 0.3,
},
'vert_turb_driver_nml': {
diff --git a/exp/test_cases/socrates_test/socrates_aquaplanet.py b/exp/test_cases/socrates_test/socrates_aquaplanet.py
index 2a4bc775f..41b77bc33 100644
--- a/exp/test_cases/socrates_test/socrates_aquaplanet.py
+++ b/exp/test_cases/socrates_test/socrates_aquaplanet.py
@@ -108,6 +108,17 @@
'two_stream_gray': False, #Use the grey radiation scheme
'do_socrates_radiation': True,
'convection_scheme': 'SIMPLE_BETTS_MILLER', #Use simple Betts miller convection
+ 'do_cloud_simple': True,
+ },
+
+ 'cloud_simple_nml': {
+ 'simple_cca':0.0,
+ 'rhcsfc': 0.95,
+ 'rhc700': 0.7,
+ 'rhc200': 0.3,
+ 'rhmsfc': 0.95,
+ 'rhm700': 0.7,
+ 'rhm200': 0.3,
},
'vert_turb_driver_nml': {
diff --git a/src/extra/model/isca/path_names b/src/extra/model/isca/path_names
index ee73b2499..eebdfd2b0 100644
--- a/src/extra/model/isca/path_names
+++ b/src/extra/model/isca/path_names
@@ -11,6 +11,7 @@ atmos_param/sea_esf_rad/null/rad_utilities.F90
atmos_param/shallow_conv/shallow_conv.F90
atmos_param/stable_bl_turb/stable_bl_turb.F90
atmos_param/strat_cloud/null/strat_cloud.F90
+atmos_param/cloud_simple/cloud_simple.F90
atmos_param/two_stream_gray_rad/two_stream_gray_rad.F90
atmos_param/qflux/qflux.f90
atmos_param/monin_obukhov/monin_obukhov_interfaces.h
diff --git a/src/extra/model/socrates/path_names b/src/extra/model/socrates/path_names
index 6cb698ede..2f4dac9eb 100644
--- a/src/extra/model/socrates/path_names
+++ b/src/extra/model/socrates/path_names
@@ -11,6 +11,7 @@ atmos_param/sea_esf_rad/null/rad_utilities.F90
atmos_param/shallow_conv/shallow_conv.F90
atmos_param/stable_bl_turb/stable_bl_turb.F90
atmos_param/strat_cloud/null/strat_cloud.F90
+atmos_param/cloud_simple/cloud_simple.F90
atmos_param/two_stream_gray_rad/two_stream_gray_rad.F90
atmos_param/qflux/qflux.f90
atmos_param/monin_obukhov/monin_obukhov_interfaces.h
From 507a08a4b87771413fcfe3bb0136f89dab129302 Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Wed, 5 Sep 2018 16:18:53 +0100
Subject: [PATCH 078/304] Additions to RRTM and ideal mosist phys to use the
simple cloud scheme
---
.../rrtm_radiation/rrtm_radiation.f90 | 51 ++++++++++++++-----
.../driver/solo/idealized_moist_phys.F90 | 28 +++++++++-
2 files changed, 64 insertions(+), 15 deletions(-)
diff --git a/src/atmos_param/rrtm_radiation/rrtm_radiation.f90 b/src/atmos_param/rrtm_radiation/rrtm_radiation.f90
index 808d5239d..921f9034c 100644
--- a/src/atmos_param/rrtm_radiation/rrtm_radiation.f90
+++ b/src/atmos_param/rrtm_radiation/rrtm_radiation.f90
@@ -531,7 +531,10 @@ subroutine interp_temp(z_full,z_half,t, Time)
end subroutine interp_temp
!*****************************************************************************************
!*****************************************************************************************
- subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half,albedo,q,t,t_surf_rad,tdt,coszen,flux_sw,flux_lw)
+ subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half, &
+ albedo,q,t,t_surf_rad,tdt, &
+ coszen,flux_sw,flux_lw,cfa_rad,reff_rad, &
+ do_cloud_simple)
!
! Driver for RRTMG radiation scheme.
! Prepares all inputs, calls SW and LW radiation schemes,
@@ -577,6 +580,11 @@ subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half,albedo,q,t,t_surf_rad,tdt,
real(kind=rb),dimension(:,:),intent(out),optional :: flux_sw,flux_lw ! surface fluxes [W/m2]
! dimension (lat x lon)
! need to have both or none!
+ real(kind=rb), dimension(:,:,:), intent(in) :: cfa_rad,reff_rad !cloud properties
+
+ logical, intent(in) :: do_cloud_simple
+
+
!---------------------------------------------------------------------------------------------------------------
! Local variables
integer k,j,i,ij,j1,i1,ij1,kend,dyofyr,seconds,days
@@ -584,7 +592,7 @@ subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half,albedo,q,t,t_surf_rad,tdt,
real(kind=rb),dimension(size(q,1),size(q,2),size(q,3)) :: o3f
real(kind=rb),dimension(size(q,1),size(q,2),size(q,3)) :: co2f,co2f_temp
real(kind=rb),dimension(ncols_rrt,nlay_rrt) :: pfull,tfull,fracday&
- , hr,hrc, swhr, swhrc
+ , hr,hrc, swhr, swhrc, cldfr, reliq, reice
real(kind=rb),dimension(size(tdt,1),size(tdt,2),size(tdt,3)) :: tdt_rrtm
real(kind=rb),dimension(ncols_rrt,nlay_rrt+1) :: uflx, dflx, uflxc, dflxc&
,swuflx, swdflx, swuflxc, swdflxc
@@ -599,11 +607,10 @@ subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half,albedo,q,t,t_surf_rad,tdt,
real(kind=rb),dimension(size(q,1),size(q,2)) :: fracsun
real(kind=rb),dimension(size(q,1),size(q,2)) :: p2 !mp586 addition for annual mean insolation
- integer :: year_in_s
+ integer :: year_in_s
real :: r_seconds, r_days, r_total_seconds, frac_of_day, frac_of_year, gmt, time_since_ae, rrsun, dt_rad_radians, day_in_s, r_solday, r_dt_rad_avg
-
! debug
integer :: indx2(2),indx(3),ii,ji,ki
logical :: used
@@ -828,6 +835,20 @@ subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half,albedo,q,t,t_surf_rad,tdt,
! anything lower than 0.01 (about 15min) is set to zero
! where(cosz_rr < 1.e-2)cosz_rr=0.
+ if (do_cloud_simple) then
+ inflglw = 2 !RRTM responsible for calculating optical properties of clouds
+ liqflglw = 1 !Sets liquid water radii to be used rather than being inactive (zero is inactive)
+ cldfr = reshape( cfa_rad (1:si:lonstep,:,sk :1:-1),(/ si*sj/lonstep,sk /))
+ reliq = reshape(reff_rad (1:si:lonstep,:,sk :1:-1),(/ si*sj/lonstep,sk /))
+ reice = zeros !Ice particle radii not used as iceflglw=0 meaning it is inactive. Setting to fill value of zeros
+ else
+ cldfr = zeros
+ reliq = 10*ones
+ reice = 10*ones
+ endif
+
+
+
if(include_secondary_gases)then
call rrtmg_sw &
(ncols_rrt, nlay_rrt , icld , iaer , &
@@ -835,13 +856,14 @@ subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half,albedo,q,t,t_surf_rad,tdt,
h2o , o3 , co2 , ch4_val*ones , n2o_val*ones , o2_val*ones , &
albedo_rr , albedo_rr, albedo_rr, albedo_rr, &
cosz_rr , solrad , dyofyr , solr_cnst, &
- inflglw , iceflglw , liqflglw , &
+ inflglw , iceflglw , liqflglw , &
! cloud parameters
- zeros , taucld , sw_zro , sw_zro , sw_zro , &
- zeros , zeros , 10*ones , 10*ones , &
- tauaer , zro_sw , zro_sw , zro_sw , &
+ cldfr, &
+ taucld , sw_zro , sw_zro , sw_zro , &
+ zeros , zeros , reice , reliq , &
+ tauaer , zro_sw , zro_sw , zro_sw , &
! output
- swuflx , swdflx , swhr , swuflxc , swdflxc, swhrc)
+ swuflx , swdflx , swhr , swuflxc , swdflxc, swhrc)
else
call rrtmg_sw &
(ncols_rrt, nlay_rrt , icld , iaer , &
@@ -849,10 +871,11 @@ subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half,albedo,q,t,t_surf_rad,tdt,
h2o , o3 , co2 , zeros , zeros, zeros, &
albedo_rr , albedo_rr, albedo_rr, albedo_rr, &
cosz_rr , solrad , dyofyr , solr_cnst, &
- inflglw , iceflglw , liqflglw , &
+ inflglw , iceflglw , liqflglw , &
! cloud parameters
- zeros , taucld , sw_zro , sw_zro , sw_zro , &
- zeros , zeros , 10*ones , 10*ones , &
+ cldfr, &
+ taucld , sw_zro , sw_zro , sw_zro , &
+ zeros , zeros , reice , reliq , &
tauaer , zro_sw , zro_sw , zro_sw , &
! output
swuflx , swdflx , swhr , swuflxc , swdflxc, swhrc)
@@ -884,7 +907,7 @@ subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half,albedo,q,t,t_surf_rad,tdt,
! emissivity and cloud composition
emis , inflglw , iceflglw , liqflglw , &
! cloud parameters
- zeros , taucld , zeros , zeros , 10*ones, 10*ones, &
+ cldfr , taucld , zeros , zeros , reice, reliq, &
tauaer , &
! output
uflx , dflx , hr , uflxc , dflxc , hrc)
@@ -897,7 +920,7 @@ subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half,albedo,q,t,t_surf_rad,tdt,
! emissivity and cloud composition
emis , inflglw , iceflglw, liqflglw, &
! cloud parameters
- zeros , taucld , zeros , zeros, 10*ones, 10*ones, &
+ cldfr , taucld , zeros , zeros, reice, reliq, &
tauaer , &
! output
uflx , dflx , hr , uflxc, dflxc , hrc)
diff --git a/src/atmos_spectral/driver/solo/idealized_moist_phys.F90 b/src/atmos_spectral/driver/solo/idealized_moist_phys.F90
index 8115c08a2..3f315dbe0 100644
--- a/src/atmos_spectral/driver/solo/idealized_moist_phys.F90
+++ b/src/atmos_spectral/driver/solo/idealized_moist_phys.F90
@@ -18,6 +18,8 @@ module idealized_moist_phys_mod
use two_stream_gray_rad_mod, only: two_stream_gray_rad_init, two_stream_gray_rad_down, two_stream_gray_rad_up, two_stream_gray_rad_end
+use cloud_simple_mod, only: cloud_simple_init, cloud_simple_end, cloud_simple
+
use mixed_layer_mod, only: mixed_layer_init, mixed_layer, mixed_layer_end, albedo_calc
use lscale_cond_mod, only: lscale_cond_init, lscale_cond, lscale_cond_end
@@ -107,6 +109,9 @@ module idealized_moist_phys_mod
logical :: do_bm = .false.
logical :: do_ras = .false.
+! Cloud options
+logical :: do_cloud_simple = .false.
+
!s Radiation options
logical :: two_stream_gray = .true.
logical :: do_rrtm_radiation = .false.
@@ -142,6 +147,7 @@ module idealized_moist_phys_mod
! end RG Add bucket
namelist / idealized_moist_phys_nml / turb, lwet_convection, do_bm, do_ras, roughness_heat, &
+ do_cloud_simple, &
two_stream_gray, do_rrtm_radiation, do_damping,&
mixed_layer_bc, do_simple, &
roughness_moist, roughness_mom, do_virtual, &
@@ -790,6 +796,9 @@ subroutine idealized_moist_phys(Time, p_half, p_full, z_half, z_full, ug, vg, tg
real :: delta_t
real, dimension(size(ug,1), size(ug,2), size(ug,3)) :: tg_tmp, qg_tmp, RH,tg_interp, mc, dt_ug_conv, dt_vg_conv
+! Simple cloud scheme variabilies to pass to radiation
+real, dimension(size(ug,1), size(ug,2), size(ug,3)) :: cfa_rad, reff_rad
+
real, intent(in) , dimension(:,:,:), optional :: mask
integer, intent(in) , dimension(:,:), optional :: kbot
@@ -952,6 +961,20 @@ subroutine idealized_moist_phys(Time, p_half, p_full, z_half, z_full, ug, vg, tg
endif
+! Call the simple cloud scheme in line with SPOOKIE-2 requirements
+! Using start of time step variables
+! using soecific humidity NOT mixing ratios
+if(do_cloud_simple) then
+ call cloud_simple(p_half(:,:,:,current), p_full(:,:,:,current), &
+ Time, &
+ tg(:,:,:,previous), &
+ grid_tracers(:,:,:,previous,nsphum), &
+ ! outs -
+ cfa_rad(:,:,:), reff_rad(:,:,:) &
+ )
+
+endif
+
! Begin the radiation calculation by computing downward fluxes.
! This part of the calculation does not depend on the surface temperature.
@@ -1076,7 +1099,10 @@ subroutine idealized_moist_phys(Time, p_half, p_full, z_half, z_full, ug, vg, tg
!need t at half grid
tg_interp=tg(:,:,:,previous)
call interp_temp(z_full(:,:,:,current),z_half(:,:,:,current),tg_interp, Time)
- call run_rrtmg(is,js,Time,rad_lat(:,:),rad_lon(:,:),p_full(:,:,:,current),p_half(:,:,:,current),albedo,grid_tracers(:,:,:,previous,nsphum),tg_interp,t_surf(:,:),dt_tg(:,:,:),coszen,net_surf_sw_down(:,:),surf_lw_down(:,:))
+ call run_rrtmg(is,js,Time,rad_lat(:,:),rad_lon(:,:),p_full(:,:,:,current),p_half(:,:,:,current), &
+ albedo,grid_tracers(:,:,:,previous,nsphum),tg_interp,t_surf(:,:),dt_tg(:,:,:), &
+ coszen,net_surf_sw_down(:,:),surf_lw_down(:,:), cfa_rad(:,:,:), reff_rad(:,:,:), &
+ do_cloud_simple )
endif
#endif
From 4f105a2baab23b94461eb8b3dce639d8fdb33123 Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Wed, 5 Sep 2018 16:19:54 +0100
Subject: [PATCH 079/304] Fist drafted simple cloud scheme - need to check
hooks to rrtm and work out approach for socrities
---
src/atmos_param/cloud_simple/cloud_simple.F90 | 203 ++++++++++++++++++
1 file changed, 203 insertions(+)
create mode 100644 src/atmos_param/cloud_simple/cloud_simple.F90
diff --git a/src/atmos_param/cloud_simple/cloud_simple.F90 b/src/atmos_param/cloud_simple/cloud_simple.F90
new file mode 100644
index 000000000..c9c09de75
--- /dev/null
+++ b/src/atmos_param/cloud_simple/cloud_simple.F90
@@ -0,0 +1,203 @@
+module cloud_simple_mod
+
+#ifdef INTERNAL_FILE_NML
+ use mpp_mod, only: input_nml_file
+#else
+ use fms_mod, only: open_namelist_file, close_file
+#endif
+
+ use fms_mod, only: stdlog, FATAL, WARNING, error_mesg
+ use time_manager_mod, only: time_type
+
+ implicit none
+
+ logical :: do_init = .true. ! Do I still need to do init?
+
+ real :: simple_cca = 0.0
+ real :: rhcsfc = 0.95
+ real :: rhc700 = 0.7
+ real :: rhc200 = 0.3
+ real :: rhmsfc = 0.95
+ real :: rhm700 = 0.7
+ real :: rhm200 = 0.3
+
+ namelist /cloud_simple_nml/ simple_cca, rhcsfc, rhc700, rhc200, &
+ rhmsfc, rhm700, rhm200
+ real :: zerodegc = 273.15
+
+
+ contains
+
+ !-----------------------------------------------
+
+
+ subroutine cloud_simple_init ()
+
+ integer :: io ,stdlog_unit
+
+#ifdef INTERNAL_FILE_NML
+ read (input_nml_file, nml=cloud_simple_nml, iostat=io)
+#else
+ if ( file_exist('input.nml') ) then
+ nml_unit = open_namelist_file()
+ read (nml_unit, cloud_simple_nml, iostat=io)
+ call close_file(nml_unit)
+ endif
+#endif
+ stdlog_unit = stdlog()
+ write(stdlog_unit, cloud_simple_nml)
+
+ do_init = .false. !initialisation completed
+
+ end subroutine cloud_simple_init
+
+ !-----------------------------------------------
+
+ subroutine cloud_simple (p_half, p_full, Time, &
+ temp, q_hum, &
+ ! outs
+ cfa_rad, reff_rad )
+
+ real , intent(in), dimension(:,:,:) :: temp, q_hum, p_full, p_half
+ type(time_type) , intent(in) :: Time
+
+ real , intent(out), dimension(:,:,:) :: cfa_rad, reff_rad
+
+ real, dimension(size(temp,1), size(temp, 2), size(temp, 3)) :: qs, qcl_rad
+ real :: frac_liq, cf_rad, simple_rhcrit
+
+ integer :: i, j, k, k_surf
+
+ logical :: es_over_liq_and_ice=.true.
+
+ !check initiation has been done - ie read in parameters
+ if (do_init) call error_mesg ('cloud_simple', &
+ 'cloud_simple_init has not been called.', FATAL)
+
+ ! Get the saturated specific humidity TOTAL (ie ice and vap) ***double check maths!
+ call compute_qs(temp, p_full, qs, es_over_liq_and_ice) !qs=qsat in um
+
+ k_surf = size(temp, 3)
+
+ do i=1, size(temp, 1)
+ do j=1, size(temp, 2)
+ do k=1, size(temp, 3)
+
+ !caluclate the frac_liq
+ call calc_liq_frac(temp(i,j,k), frac_liq)
+ call calc_reff(frac_liq, reff_rad(i,j,k))
+ call calc_rhcrit(p_full(i,j,k), p_full(i,j,k_surf), simple_rhcrit)
+ call calc_cf_rad(q_hum(i,j,k), qs(i,j,k), simple_rhcrit, cf_rad)
+ call calc_qcl_rad(p_full(i,j,k), cf_rad, qcl_rad(i,j,k) )
+ end do
+ end do
+ end do
+
+ !WHAT ARE THE UNITS
+ !add diagnostics
+
+ end subroutine cloud_simple
+
+ subroutine calc_liq_frac(temp, frac_liq)
+ ! All liquid if above zero and all ice below -40C
+ ! linearly interpolate between T=0 and -40C
+
+ real, intent(in) :: temp
+ real, intent(out) :: frac_liq
+
+
+ if (temp > zerodegc) then
+ frac_liq = 1.0
+ else if (temp < zerodegc-40.0) then
+ frac_liq = 0.0
+ else
+ frac_liq = 1.0 - (zerodegc-temp) / 40.0
+ end if
+
+
+ end subroutine calc_liq_frac
+
+ subroutine calc_reff(frac_liq, reff_rad)
+
+ real, intent(in) :: frac_liq
+ real, intent(out) :: reff_rad
+
+ reff_rad = 1.0e-6 * ( 10.0 * frac_liq + 20.0 * (1.0 - frac_liq) )
+
+ end subroutine calc_reff
+
+ subroutine calc_rhcrit(p_full, p_surf, simple_rhcrit) !need to check p_full - > p_layer_centres
+
+ real, intent(in) :: p_full, p_surf
+ real, intent(out) :: simple_rhcrit
+
+ ! Calculate RHcrit as function of pressure
+ if (p_full > 70000.0 ) then
+
+ simple_rhcrit = rhcsfc - ( rhcsfc - rhc700 ) * &
+ ( p_surf - p_full ) / ( p_surf - 70000.0 )
+
+ else if ( p_full > 20000.0 ) then
+
+ simple_rhcrit = rhc700 - ( rhc700 - rhc200 ) * &
+ ( 70000.0 - p_full) / 50000.0
+
+ else
+ simple_rhcrit = rhc200
+ endif
+
+ end subroutine calc_rhcrit
+
+ subroutine calc_cf_rad (q_hum, qsat, simple_rhcrit, cf_rad)
+ ! Calculate LS (stratiform) cloud fraction
+ ! as a simple linear function of RH
+
+ real, intent(in) :: q_hum, qsat, simple_rhcrit
+ real, intent(out) :: cf_rad
+
+ real :: rh, cca
+
+ rh = q_hum/qsat
+ cf_rad = MAX( 0.0, MIN( 1.0, ( rh - simple_rhcrit ) / ( 1.0 - simple_rhcrit ) ))
+
+ ! include simple convective cloud fraction where present
+
+ cca = 0.0 ! no convective cloud fraction is calculated
+ ! left in for fture use
+
+ if (cca > 0.0) then
+ cf_rad = MAX( simple_cca, cf_rad )
+ end if
+
+ end subroutine calc_cf_rad
+
+ subroutine calc_qcl_rad(p_full, cf_rad, qcl_rad)
+ ! calculate simple water content
+
+ real , intent(in) :: p_full, cf_rad
+ real , intent(out) :: qcl_rad
+
+ real :: in_cloud_qcl
+
+ in_cloud_qcl = 3.0e-4 + &
+ (1.0-3.0e-4)*(p_full-20000.0)/80000.0
+
+ in_cloud_qcl = MAX ( 0.0, in_cloud_qcl/1000.0 ) ! convert to kg/kg
+
+ qcl_rad = cf_rad * in_cloud_qcl
+
+ end subroutine calc_qcl_rad
+
+
+ !-----------------------------------------------
+
+
+ subroutine cloud_simple_end ()
+
+ ! do we deallocate anything?
+
+ end subroutine cloud_simple_end
+
+ !-----------------------------------------------
+
+end module cloud_simple_mod
From 6e6d69af44c6cb2835a990d20e8ee13789a897e4 Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Wed, 5 Sep 2018 17:30:24 +0100
Subject: [PATCH 080/304] Changes so code will now compile
---
src/atmos_param/cloud_simple/cloud_simple.F90 | 9 +++++----
src/atmos_spectral/driver/solo/idealized_moist_phys.F90 | 5 +++++
2 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/src/atmos_param/cloud_simple/cloud_simple.F90 b/src/atmos_param/cloud_simple/cloud_simple.F90
index c9c09de75..a04d92b5b 100644
--- a/src/atmos_param/cloud_simple/cloud_simple.F90
+++ b/src/atmos_param/cloud_simple/cloud_simple.F90
@@ -6,8 +6,9 @@ module cloud_simple_mod
use fms_mod, only: open_namelist_file, close_file
#endif
- use fms_mod, only: stdlog, FATAL, WARNING, error_mesg
- use time_manager_mod, only: time_type
+ use fms_mod, only: stdlog, FATAL, WARNING, error_mesg
+ use time_manager_mod, only: time_type
+ use sat_vapor_pres_mod, only: compute_qs
implicit none
@@ -68,14 +69,14 @@ subroutine cloud_simple (p_half, p_full, Time, &
integer :: i, j, k, k_surf
- logical :: es_over_liq_and_ice=.true.
+ logical :: es_over_liq_and_ice
!check initiation has been done - ie read in parameters
if (do_init) call error_mesg ('cloud_simple', &
'cloud_simple_init has not been called.', FATAL)
! Get the saturated specific humidity TOTAL (ie ice and vap) ***double check maths!
- call compute_qs(temp, p_full, qs, es_over_liq_and_ice) !qs=qsat in um
+ call compute_qs(temp, p_full, qs, es_over_liq_and_ice=.true.) !qs=qsat in um
k_surf = size(temp, 3)
diff --git a/src/atmos_spectral/driver/solo/idealized_moist_phys.F90 b/src/atmos_spectral/driver/solo/idealized_moist_phys.F90
index 3f315dbe0..494be9353 100644
--- a/src/atmos_spectral/driver/solo/idealized_moist_phys.F90
+++ b/src/atmos_spectral/driver/solo/idealized_moist_phys.F90
@@ -347,6 +347,10 @@ subroutine idealized_moist_phys_init(Time, Time_step_in, nhum, rad_lon_2d, rad_l
d622 = rdgas/rvgas
d378 = 1.-d622
+if(do_cloud_simple) then
+ call cloud_simple_init()
+end if
+
!s need to make sure that gray radiation and rrtm radiation are not both called.
if(two_stream_gray .and. do_rrtm_radiation) &
call error_mesg('physics_driver_init','do_grey_radiation and do_rrtm_radiation cannot both be .true.',FATAL)
@@ -965,6 +969,7 @@ subroutine idealized_moist_phys(Time, p_half, p_full, z_half, z_full, ug, vg, tg
! Using start of time step variables
! using soecific humidity NOT mixing ratios
if(do_cloud_simple) then
+
call cloud_simple(p_half(:,:,:,current), p_full(:,:,:,current), &
Time, &
tg(:,:,:,previous), &
From b01e18466f474818a247323861b702d6e1241694 Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Wed, 5 Sep 2018 17:31:07 +0100
Subject: [PATCH 081/304] Now building sat specific humidity tables and shorter
run on more cores
---
exp/test_cases/MiMA/MiMA_test_case.py | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/exp/test_cases/MiMA/MiMA_test_case.py b/exp/test_cases/MiMA/MiMA_test_case.py
index f21ba6404..61472cc25 100644
--- a/exp/test_cases/MiMA/MiMA_test_case.py
+++ b/exp/test_cases/MiMA/MiMA_test_case.py
@@ -4,7 +4,7 @@
from isca import IscaCodeBase, DiagTable, Experiment, Namelist, GFDL_BASE
-NCORES = 4
+NCORES = 16
# a CodeBase can be a directory on the computer,
# useful for iterative development
@@ -131,7 +131,8 @@
},
'sat_vapor_pres_nml': {
- 'do_simple':True
+ 'do_simple':True,
+ 'construct_table_wrt_liq_and_ice':True
},
'damping_driver_nml': {
@@ -185,5 +186,5 @@
#Lets do a run!
if __name__=="__main__":
exp.run(1, use_restart=False, num_cores=NCORES)
- for i in range(2,121):
+ for i in range(2,25):
exp.run(i, num_cores=NCORES)
From 9616b1c9bcacc4b545121dcc956b28bc930884e2 Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Thu, 6 Sep 2018 12:24:50 +0100
Subject: [PATCH 082/304] exp/test_cases/MiMA/MiMA_test_case.py
---
src/atmos_param/cloud_simple/cloud_simple.F90 | 91 ++++++++++++++++---
.../rrtm_radiation/rrtm_radiation.f90 | 20 ++--
.../driver/solo/idealized_moist_phys.F90 | 15 ++-
3 files changed, 99 insertions(+), 27 deletions(-)
diff --git a/src/atmos_param/cloud_simple/cloud_simple.F90 b/src/atmos_param/cloud_simple/cloud_simple.F90
index a04d92b5b..c35708ad3 100644
--- a/src/atmos_param/cloud_simple/cloud_simple.F90
+++ b/src/atmos_param/cloud_simple/cloud_simple.F90
@@ -10,9 +10,11 @@ module cloud_simple_mod
use time_manager_mod, only: time_type
use sat_vapor_pres_mod, only: compute_qs
+ use diag_manager_mod, only: register_diag_field, send_data
+
implicit none
- logical :: do_init = .true. ! Do I still need to do init?
+ logical :: do_init = .true. ! Check if init needs to be run
real :: simple_cca = 0.0
real :: rhcsfc = 0.95
@@ -26,16 +28,22 @@ module cloud_simple_mod
rhmsfc, rhm700, rhm200
real :: zerodegc = 273.15
+ integer :: id_cf_rad, id_reff_rad, id_frac_liq, id_qcl_rad
+ character(len=14), parameter :: mod_name_cld = "cloud_simple"
contains
!-----------------------------------------------
- subroutine cloud_simple_init ()
+ subroutine cloud_simple_init (axes, Time)
+
+ type(time_type), intent(in) :: Time
+ integer, intent(in), dimension(4) :: axes
integer :: io ,stdlog_unit
+
#ifdef INTERNAL_FILE_NML
read (input_nml_file, nml=cloud_simple_nml, iostat=io)
#else
@@ -48,6 +56,26 @@ subroutine cloud_simple_init ()
stdlog_unit = stdlog()
write(stdlog_unit, cloud_simple_nml)
+ !register diagnostics
+ id_cf_rad = &
+ register_diag_field ( mod_name_cld, 'cf_rad', axes(1:3), Time, &
+ 'Cloud fraction for the simple cloud scheme', 'unitless: values 0-1')
+
+ id_frac_liq = &
+ register_diag_field ( mod_name_cld, 'frac_liq', axes(1:3), Time, &
+ 'Liquid cloud fraction (liquid, mixed-ice phase, ice)', &
+ 'unitless: values 0-1')
+
+ id_reff_rad = &
+ register_diag_field ( mod_name_cld, 'reff_rad', axes(1:3), Time, &
+ 'Effective cloud particle radius', &
+ 'microns')
+
+ id_qcl_rad = &
+ register_diag_field ( mod_name_cld, 'qcl_rad', axes(1:3), Time, &
+ 'Specific humidity of cloud liquid', &
+ 'kg/kg')
+
do_init = .false. !initialisation completed
end subroutine cloud_simple_init
@@ -57,20 +85,22 @@ end subroutine cloud_simple_init
subroutine cloud_simple (p_half, p_full, Time, &
temp, q_hum, &
! outs
- cfa_rad, reff_rad )
+ cf_rad, reff_rad, qcl_rad )
real , intent(in), dimension(:,:,:) :: temp, q_hum, p_full, p_half
type(time_type) , intent(in) :: Time
- real , intent(out), dimension(:,:,:) :: cfa_rad, reff_rad
+ real , intent(out), dimension(:,:,:) :: cf_rad, reff_rad, qcl_rad
- real, dimension(size(temp,1), size(temp, 2), size(temp, 3)) :: qs, qcl_rad
- real :: frac_liq, cf_rad, simple_rhcrit
+ real, dimension(size(temp,1), size(temp, 2), size(temp, 3)) :: qs, frac_liq
+ real :: simple_rhcrit
integer :: i, j, k, k_surf
logical :: es_over_liq_and_ice
+ real :: tmp1, tmp2 !remove tmp1 and tmp2 after debugging
+
!check initiation has been done - ie read in parameters
if (do_init) call error_mesg ('cloud_simple', &
'cloud_simple_init has not been called.', FATAL)
@@ -85,17 +115,22 @@ subroutine cloud_simple (p_half, p_full, Time, &
do k=1, size(temp, 3)
!caluclate the frac_liq
- call calc_liq_frac(temp(i,j,k), frac_liq)
- call calc_reff(frac_liq, reff_rad(i,j,k))
+ call calc_liq_frac(temp(i,j,k), frac_liq(i,j,k))
+ call calc_reff(frac_liq(i,j,k), reff_rad(i,j,k))
call calc_rhcrit(p_full(i,j,k), p_full(i,j,k_surf), simple_rhcrit)
- call calc_cf_rad(q_hum(i,j,k), qs(i,j,k), simple_rhcrit, cf_rad)
- call calc_qcl_rad(p_full(i,j,k), cf_rad, qcl_rad(i,j,k) )
+ call calc_cf_rad(q_hum(i,j,k), qs(i,j,k), simple_rhcrit, cf_rad(i,j,k))
+ call calc_qcl_rad(p_full(i,j,k), cf_rad(i,j,k), qcl_rad(i,j,k) )
end do
end do
end do
- !WHAT ARE THE UNITS
- !add diagnostics
+ !save some diagnotics
+ call output_cloud_diags(cf_rad, reff_rad, frac_liq, qcl_rad, Time )
+
+tmp2 = maxval(cf_rad)
+tmp1 = maxval(reff_rad)
+tmp2 = maxval(cf_rad)
+
end subroutine cloud_simple
@@ -123,7 +158,7 @@ subroutine calc_reff(frac_liq, reff_rad)
real, intent(in) :: frac_liq
real, intent(out) :: reff_rad
- reff_rad = 1.0e-6 * ( 10.0 * frac_liq + 20.0 * (1.0 - frac_liq) )
+ reff_rad = 10.0 * frac_liq + 20.0 * (1.0 - frac_liq) !units in microns
end subroutine calc_reff
@@ -170,6 +205,8 @@ subroutine calc_cf_rad (q_hum, qsat, simple_rhcrit, cf_rad)
cf_rad = MAX( simple_cca, cf_rad )
end if
+
+
end subroutine calc_cf_rad
subroutine calc_qcl_rad(p_full, cf_rad, qcl_rad)
@@ -190,6 +227,34 @@ subroutine calc_qcl_rad(p_full, cf_rad, qcl_rad)
end subroutine calc_qcl_rad
+
+ subroutine output_cloud_diags(cf_rad, reff_rad, frac_liq, qcl_rad, Time)
+
+ real, intent(in), dimension(:,:,:) :: cf_rad, reff_rad, frac_liq, qcl_rad
+
+ type(time_type) , intent(in) :: Time
+
+ real :: used
+
+ if ( id_cf_rad > 0 ) then
+ used = send_data ( id_cf_rad, cf_rad, Time)
+ endif
+
+ if ( id_reff_rad > 0 ) then
+ used = send_data ( id_reff_rad, reff_rad, Time)
+ endif
+
+ if ( id_frac_liq > 0 ) then
+ used = send_data ( id_frac_liq, frac_liq, Time)
+ endif
+
+ if ( id_qcl_rad > 0 ) then
+ used = send_data ( id_qcl_rad, qcl_rad, Time)
+ endif
+
+
+ end subroutine output_cloud_diags
+
!-----------------------------------------------
diff --git a/src/atmos_param/rrtm_radiation/rrtm_radiation.f90 b/src/atmos_param/rrtm_radiation/rrtm_radiation.f90
index 921f9034c..d7a8c786b 100644
--- a/src/atmos_param/rrtm_radiation/rrtm_radiation.f90
+++ b/src/atmos_param/rrtm_radiation/rrtm_radiation.f90
@@ -533,7 +533,7 @@ end subroutine interp_temp
!*****************************************************************************************
subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half, &
albedo,q,t,t_surf_rad,tdt, &
- coszen,flux_sw,flux_lw,cfa_rad,reff_rad, &
+ coszen,flux_sw,flux_lw,cf_rad,reff_rad, &
do_cloud_simple)
!
! Driver for RRTMG radiation scheme.
@@ -580,7 +580,7 @@ subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half, &
real(kind=rb),dimension(:,:),intent(out),optional :: flux_sw,flux_lw ! surface fluxes [W/m2]
! dimension (lat x lon)
! need to have both or none!
- real(kind=rb), dimension(:,:,:), intent(in) :: cfa_rad,reff_rad !cloud properties
+ real(kind=rb), dimension(:,:,:), intent(in) :: cf_rad,reff_rad !cloud properties
logical, intent(in) :: do_cloud_simple
@@ -612,6 +612,8 @@ subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half, &
! debug
+ real :: tmp1, tmp2 !remove tmp1 and tmp2 after debugging
+
integer :: indx2(2),indx(3),ii,ji,ki
logical :: used
!---------------------------------------------------------------------------------------------------------------
@@ -838,16 +840,16 @@ subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half, &
if (do_cloud_simple) then
inflglw = 2 !RRTM responsible for calculating optical properties of clouds
liqflglw = 1 !Sets liquid water radii to be used rather than being inactive (zero is inactive)
- cldfr = reshape( cfa_rad (1:si:lonstep,:,sk :1:-1),(/ si*sj/lonstep,sk /))
- reliq = reshape(reff_rad (1:si:lonstep,:,sk :1:-1),(/ si*sj/lonstep,sk /))
- reice = zeros !Ice particle radii not used as iceflglw=0 meaning it is inactive. Setting to fill value of zeros
+ cldfr = reshape( cf_rad (1:si:lonstep,:,sk :1:-1),(/ si*sj/lonstep,sk /))
+ reliq = reshape(reff_rad (1:si:lonstep,:,sk :1:-1),(/ si*sj/lonstep,sk /)) !already in microns
+ reice = 10*ones !Ice particle radii not used as iceflglw=0 meaning it is inactive. Setting to fill value of zeros
else
cldfr = zeros
- reliq = 10*ones
- reice = 10*ones
+ reliq = 10*ones ! not requires to be 10 microns but assumed a valid number
+ reice = 10*ones ! needs to be 10 microns
endif
-
-
+ tmp1 = maxval(reff_rad)
+ tmp2 = maxval(cf_rad)
if(include_secondary_gases)then
call rrtmg_sw &
diff --git a/src/atmos_spectral/driver/solo/idealized_moist_phys.F90 b/src/atmos_spectral/driver/solo/idealized_moist_phys.F90
index 494be9353..3326065c0 100644
--- a/src/atmos_spectral/driver/solo/idealized_moist_phys.F90
+++ b/src/atmos_spectral/driver/solo/idealized_moist_phys.F90
@@ -348,7 +348,7 @@ subroutine idealized_moist_phys_init(Time, Time_step_in, nhum, rad_lon_2d, rad_l
d378 = 1.-d622
if(do_cloud_simple) then
- call cloud_simple_init()
+ call cloud_simple_init(get_axis_id(), Time)
end if
!s need to make sure that gray radiation and rrtm radiation are not both called.
@@ -801,7 +801,7 @@ subroutine idealized_moist_phys(Time, p_half, p_full, z_half, z_full, ug, vg, tg
real, dimension(size(ug,1), size(ug,2), size(ug,3)) :: tg_tmp, qg_tmp, RH,tg_interp, mc, dt_ug_conv, dt_vg_conv
! Simple cloud scheme variabilies to pass to radiation
-real, dimension(size(ug,1), size(ug,2), size(ug,3)) :: cfa_rad, reff_rad
+real, dimension(size(ug,1), size(ug,2), size(ug,3)) :: cf_rad, reff_rad, qcl_rad
real, intent(in) , dimension(:,:,:), optional :: mask
integer, intent(in) , dimension(:,:), optional :: kbot
@@ -809,6 +809,8 @@ subroutine idealized_moist_phys(Time, p_half, p_full, z_half, z_full, ug, vg, tg
real, dimension(1,1,1):: tracer, tracertnd
integer :: nql, nqi, nqa ! tracer indices for stratiform clouds
+real :: tmp1, tmp2 !remove tmp1 and tmp2 after debugging
+
if(current == previous) then
delta_t = dt_real
else
@@ -975,11 +977,14 @@ subroutine idealized_moist_phys(Time, p_half, p_full, z_half, z_full, ug, vg, tg
tg(:,:,:,previous), &
grid_tracers(:,:,:,previous,nsphum), &
! outs -
- cfa_rad(:,:,:), reff_rad(:,:,:) &
+ cf_rad(:,:,:), reff_rad(:,:,:), &
+ qcl_rad(:,:,:) &
)
-
+
endif
+tmp1 = maxval(reff_rad)
+tmp2 = maxval(cf_rad)
! Begin the radiation calculation by computing downward fluxes.
! This part of the calculation does not depend on the surface temperature.
@@ -1106,7 +1111,7 @@ subroutine idealized_moist_phys(Time, p_half, p_full, z_half, z_full, ug, vg, tg
call interp_temp(z_full(:,:,:,current),z_half(:,:,:,current),tg_interp, Time)
call run_rrtmg(is,js,Time,rad_lat(:,:),rad_lon(:,:),p_full(:,:,:,current),p_half(:,:,:,current), &
albedo,grid_tracers(:,:,:,previous,nsphum),tg_interp,t_surf(:,:),dt_tg(:,:,:), &
- coszen,net_surf_sw_down(:,:),surf_lw_down(:,:), cfa_rad(:,:,:), reff_rad(:,:,:), &
+ coszen,net_surf_sw_down(:,:),surf_lw_down(:,:), cf_rad(:,:,:), reff_rad(:,:,:), &
do_cloud_simple )
endif
#endif
From 5116850c5c61e1b5320059d5774dfd3529fb4858 Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Thu, 6 Sep 2018 12:25:51 +0100
Subject: [PATCH 083/304] Previous commit did not have all files: attempting to
debug why cloud fraction is not passed out of the simple cloud scheme
---
exp/test_cases/MiMA/MiMA_test_case.py | 19 +-
.../MiMA/MiMA_test_case_no_cloud.py | 191 ++++++++++++++++++
2 files changed, 203 insertions(+), 7 deletions(-)
create mode 100644 exp/test_cases/MiMA/MiMA_test_case_no_cloud.py
diff --git a/exp/test_cases/MiMA/MiMA_test_case.py b/exp/test_cases/MiMA/MiMA_test_case.py
index 61472cc25..06ab56cf5 100644
--- a/exp/test_cases/MiMA/MiMA_test_case.py
+++ b/exp/test_cases/MiMA/MiMA_test_case.py
@@ -4,7 +4,7 @@
from isca import IscaCodeBase, DiagTable, Experiment, Namelist, GFDL_BASE
-NCORES = 16
+NCORES = 1
# a CodeBase can be a directory on the computer,
# useful for iterative development
@@ -19,7 +19,7 @@
# is used to load the correct compilers. The env file is always loaded from
# $GFDL_BASE and not the checked out git repo.
-cb.compile() # compile the source code to working directory $GFDL_WORK/codebase
+cb.compile(debug=True) # compile the source code to working directory $GFDL_WORK/codebase
# create an Experiment object to handle the configuration of model parameters
# and output diagnostics
@@ -43,6 +43,11 @@
diag.add_field('dynamics', 'temp', time_avg=True)
diag.add_field('dynamics', 'vor', time_avg=True)
diag.add_field('dynamics', 'div', time_avg=True)
+diag.add_field('cloud_simple', 'cf_rad', time_avg=True)
+diag.add_field('cloud_simple', 'reff_rad', time_avg=True)
+diag.add_field('cloud_simple', 'frac_liq', time_avg=True)
+diag.add_field('cloud_simple', 'qcl_rad', time_avg=True)
+diag.add_field('rrtm_radiation', 'olr', time_avg=True)
exp.diag_table = diag
@@ -138,7 +143,7 @@
'damping_driver_nml': {
'do_rayleigh': True,
'trayfric': -0.5, # neg. value: time in *days*
- 'sponge_pbottom': 50.,
+ 'sponge_pbottom': 150.,
'do_conserve_energy': True,
},
@@ -175,7 +180,7 @@
'valid_range_t':[100.,800.],
'initial_sphum':[2.e-6],
'vert_coord_option':'uneven_sigma',
- 'surf_res':0.5,
+ 'surf_res':0.2,
'scale_heights' : 11.0,
'exponent':7.0,
'robert_coeff':0.03
@@ -185,6 +190,6 @@
})
#Lets do a run!
if __name__=="__main__":
- exp.run(1, use_restart=False, num_cores=NCORES)
- for i in range(2,25):
- exp.run(i, num_cores=NCORES)
+ exp.run(1, use_restart=False, num_cores=NCORES, overwrite_data=True, run_idb=True)
+ # for i in range(2,25):
+ # exp.run(i, num_cores=NCORES, overwrite_data=True)
diff --git a/exp/test_cases/MiMA/MiMA_test_case_no_cloud.py b/exp/test_cases/MiMA/MiMA_test_case_no_cloud.py
new file mode 100644
index 000000000..645a589ea
--- /dev/null
+++ b/exp/test_cases/MiMA/MiMA_test_case_no_cloud.py
@@ -0,0 +1,191 @@
+import os
+
+import numpy as np
+
+from isca import IscaCodeBase, DiagTable, Experiment, Namelist, GFDL_BASE
+
+NCORES = 16
+
+# a CodeBase can be a directory on the computer,
+# useful for iterative development
+cb = IscaCodeBase.from_directory(GFDL_BASE)
+
+# or it can point to a specific git repo and commit id.
+# This method should ensure future, independent, reproducibility of results.
+# cb = DryCodeBase.from_repo(repo='https://github.com/isca/isca', commit='isca1.1')
+
+# compilation depends on computer specific settings. The $GFDL_ENV
+# environment variable is used to determine which `$GFDL_BASE/src/extra/env` file
+# is used to load the correct compilers. The env file is always loaded from
+# $GFDL_BASE and not the checked out git repo.
+
+cb.compile() # compile the source code to working directory $GFDL_WORK/codebase
+
+# create an Experiment object to handle the configuration of model parameters
+# and output diagnostics
+exp = Experiment('mima_test_experiment_no_cloud', codebase=cb)
+
+exp.inputfiles = [os.path.join(GFDL_BASE,'input/rrtm_input_files/ozone_1990.nc')]
+
+#Tell model how to write diagnostics
+diag = DiagTable()
+diag.add_file('atmos_monthly', 30, 'days', time_units='days')
+
+#Tell model which diagnostics to write
+diag.add_field('dynamics', 'ps', time_avg=True)
+diag.add_field('dynamics', 'bk')
+diag.add_field('dynamics', 'pk')
+diag.add_field('atmosphere', 'precipitation', time_avg=True)
+diag.add_field('mixed_layer', 't_surf', time_avg=True)
+diag.add_field('dynamics', 'sphum', time_avg=True)
+diag.add_field('dynamics', 'ucomp', time_avg=True)
+diag.add_field('dynamics', 'vcomp', time_avg=True)
+diag.add_field('dynamics', 'temp', time_avg=True)
+diag.add_field('dynamics', 'vor', time_avg=True)
+diag.add_field('dynamics', 'div', time_avg=True)
+diag.add_field('rrtm_radiation', 'olr', time_avg=True)
+
+exp.diag_table = diag
+
+
+#Empty the run directory ready to run
+exp.clear_rundir()
+
+#Define values for the 'core' namelist
+exp.namelist = namelist = Namelist({
+ 'main_nml': {
+ 'days' : 30,
+ 'hours' : 0,
+ 'minutes': 0,
+ 'seconds': 0,
+ 'dt_atmos':600,
+ 'current_date' : [1,1,1,0,0,0],
+ 'calendar' : 'thirty_day'
+ },
+
+ 'idealized_moist_phys_nml': {
+ 'two_stream_gray': False,
+ 'do_rrtm_radiation': True, #Use RRTM radiation, not grey
+ 'convection_scheme': 'SIMPLE_BETTS_MILLER', #Use the simple Betts Miller convection scheme
+ 'do_damping': True,
+ 'turb':True,
+ 'mixed_layer_bc':True,
+ 'do_virtual' :False,
+ 'do_simple': True,
+ 'roughness_mom':3.21e-05,
+ 'roughness_heat':3.21e-05,
+ 'roughness_moist':3.21e-05,
+ 'do_cloud_simple': False,
+ },
+ 'cloud_simple_nml': {
+ 'simple_cca':0.0,
+ 'rhcsfc': 0.95,
+ 'rhc700': 0.7,
+ 'rhc200': 0.3,
+ 'rhmsfc': 0.95,
+ 'rhm700': 0.7,
+ 'rhm200': 0.3,
+ },
+
+ 'vert_turb_driver_nml': {
+ 'do_mellor_yamada': False, # default: True
+ 'do_diffusivity': True, # default: False
+ 'do_simple': True, # default: False
+ 'constant_gust': 0.0, # default: 1.0
+ 'use_tau': False
+ },
+
+ 'diffusivity_nml': {
+ 'do_entrain':False,
+ 'do_simple': True,
+ },
+
+ 'surface_flux_nml': {
+ 'use_virtual_temp': False,
+ 'do_simple': True,
+ 'old_dtaudv': True
+ },
+
+ 'atmosphere_nml': {
+ 'idealized_moist_model': True
+ },
+
+ #Use a large mixed-layer depth, and the Albedo of the CTRL case in Jucker & Gerber, 2017
+ 'mixed_layer_nml': {
+ 'depth': 100,
+ 'albedo_value': 0.205,
+ 'tconst' : 285.,
+ 'prescribe_initial_dist':True,
+ 'evaporation':True,
+ 'do_qflux': True
+ },
+
+ 'qe_moist_convection_nml': {
+ 'rhbm':0.7,
+ 'Tmin':160.,
+ 'Tmax':350.
+ },
+
+ 'lscale_cond_nml': {
+ 'do_simple':True,
+ 'do_evap':True
+ },
+
+ 'sat_vapor_pres_nml': {
+ 'do_simple':True,
+ 'construct_table_wrt_liq_and_ice':True
+ },
+
+ 'damping_driver_nml': {
+ 'do_rayleigh': True,
+ 'trayfric': -0.5, # neg. value: time in *days*
+ 'sponge_pbottom': 150.,
+ 'do_conserve_energy': True,
+ },
+
+ 'qflux_nml': {
+ 'qflux_amp': 30.0
+ },
+
+ 'rrtm_radiation_nml': {
+ 'solr_cnst': 1360, #s set solar constant to 1360, rather than default of 1368.22
+ 'dt_rad': 7200, #Use long RRTM timestep
+ 'do_read_ozone':True,
+ 'ozone_file':'ozone_1990'
+ },
+
+ # FMS Framework configuration
+ 'diag_manager_nml': {
+ 'mix_snapshot_average_fields': False # time avg fields are labelled with time in middle of window
+ },
+
+ 'fms_nml': {
+ 'domains_stack_size': 600000 # default: 0
+ },
+
+ 'fms_io_nml': {
+ 'threading_write': 'single', # default: multi
+ 'fileset_write': 'single', # default: multi
+ },
+
+ 'spectral_dynamics_nml': {
+ 'damping_order': 4,
+ 'water_correction_limit': 200.e2,
+ 'reference_sea_level_press':1.0e5,
+ 'num_levels':40,
+ 'valid_range_t':[100.,800.],
+ 'initial_sphum':[2.e-6],
+ 'vert_coord_option':'uneven_sigma',
+ 'surf_res':0.2,
+ 'scale_heights' : 11.0,
+ 'exponent':7.0,
+ 'robert_coeff':0.03
+ }
+
+
+})
+#Lets do a run!
+if __name__=="__main__":
+ exp.run(1, use_restart=False, num_cores=NCORES, overwrite_data=True)
+ for i in range(2,25):
+ exp.run(i, num_cores=NCORES, overwrite_data=True)
From 9caea82852139524be2f0bddccd24ca672f7ba99 Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Thu, 6 Sep 2018 16:27:53 +0100
Subject: [PATCH 084/304] Swapped to using mcica sw routine and added required
initialisation routine. Seems to run. Now swapping to lw mcica.
---
exp/test_cases/MiMA/MiMA_test_case.py | 9 +-
.../rrtm_radiation/rrtm_radiation.f90 | 98 +++++++++++++------
src/extra/model/isca/path_names | 2 +-
3 files changed, 74 insertions(+), 35 deletions(-)
diff --git a/exp/test_cases/MiMA/MiMA_test_case.py b/exp/test_cases/MiMA/MiMA_test_case.py
index 06ab56cf5..aef6b0ab6 100644
--- a/exp/test_cases/MiMA/MiMA_test_case.py
+++ b/exp/test_cases/MiMA/MiMA_test_case.py
@@ -4,7 +4,7 @@
from isca import IscaCodeBase, DiagTable, Experiment, Namelist, GFDL_BASE
-NCORES = 1
+NCORES = 16
# a CodeBase can be a directory on the computer,
# useful for iterative development
@@ -19,7 +19,7 @@
# is used to load the correct compilers. The env file is always loaded from
# $GFDL_BASE and not the checked out git repo.
-cb.compile(debug=True) # compile the source code to working directory $GFDL_WORK/codebase
+cb.compile()#debug=True) # compile the source code to working directory $GFDL_WORK/codebase
# create an Experiment object to handle the configuration of model parameters
# and output diagnostics
@@ -155,7 +155,8 @@
'solr_cnst': 1360, #s set solar constant to 1360, rather than default of 1368.22
'dt_rad': 7200, #Use long RRTM timestep
'do_read_ozone':True,
- 'ozone_file':'ozone_1990'
+ 'ozone_file':'ozone_1990',
+ 'icld': 1 #cloud overlap method
},
# FMS Framework configuration
@@ -190,6 +191,6 @@
})
#Lets do a run!
if __name__=="__main__":
- exp.run(1, use_restart=False, num_cores=NCORES, overwrite_data=True, run_idb=True)
+ exp.run(1, use_restart=False, num_cores=NCORES, overwrite_data=True)#, run_idb=True)
# for i in range(2,25):
# exp.run(i, num_cores=NCORES, overwrite_data=True)
diff --git a/src/atmos_param/rrtm_radiation/rrtm_radiation.f90 b/src/atmos_param/rrtm_radiation/rrtm_radiation.f90
index d7a8c786b..195206d91 100644
--- a/src/atmos_param/rrtm_radiation/rrtm_radiation.f90
+++ b/src/atmos_param/rrtm_radiation/rrtm_radiation.f90
@@ -54,9 +54,10 @@ module rrtm_vars
! dimension (ncols_rrt x nlay_rrt)
real(kind=rb),allocatable,dimension(:,:) :: co2 ! CO2 [vmr]
! dimension (ncols_rrt x nlay_rrt)
- real(kind=rb),allocatable,dimension(:,:) :: zeros ! place holder for any species set
+ real(kind=rb),allocatable,dimension(:,:,:) :: zeros ! place holder for any species set
+ ! to zero
+ real(kind=rb),allocatable,dimension(:,:,:) :: ones ! place holder for any species set
! to zero
- real(kind=rb),allocatable,dimension(:,:) :: ones ! place holder for secondary species
! the following species are only set if use_secondary_gases=.true.
real(kind=rb),allocatable,dimension(:,:) :: ch4 ! CH4 [vmr]
! dimension (ncols_rrt x nlay_rrt)
@@ -102,7 +103,7 @@ module rrtm_vars
! some constants
real(kind=rb) :: daypersec=1./86400.,deg2rad !RG: daypersec=1./86400. left in when conversion to non-specific day length made as this only converts heatrates from RRTM from K/day to K/sec
! no clouds in the radiative scheme
- integer(kind=im) :: icld=0,idrv=0, &
+ integer(kind=im) :: idrv=0, &
inflglw=0,iceflglw=0,liqflglw=0, &
iaer=0
!---------------------------------------------------------------------------------------------------------------
@@ -188,6 +189,9 @@ module rrtm_vars
! day of the year = solday \in [0,days per year]
real(kind=rb) :: equinox_day=0.75 ! fraction of the year defining NH autumn equinox \in [0,1]
real(kind=rb) :: solr_cnst= 1368.22 ! solar constant [W/m2]
+
+ integer(kind=im) :: icld=0 ! Cloud overlap method
+
!-------------------------------------------------s--------------------------------------------------------------
!
!-------------------- diagnostics fields -------------------------------
@@ -210,14 +214,17 @@ module rrtm_vars
&lonstep, do_zm_tracers, do_zm_rad, &
&do_precip_albedo, precip_albedo_mode, precip_albedo, precip_lat,&
&do_read_co2, co2_file, co2_variable_name, use_dyofyr, solrad, &
- &solday, equinox_day,solr_cnst
+ &solday, equinox_day,solr_cnst, icld
end module rrtm_vars
!*****************************************************************************************
!*****************************************************************************************
module rrtm_radiation
- use parkind, only : im => kind_im, rb => kind_rb
- use constants_mod, only: pi, wtmozone, wtmh2o, gas_constant, rdgas
+ use parkind, only : im => kind_im, rb => kind_rb
+ use constants_mod, only: pi, wtmozone, wtmh2o, gas_constant, rdgas
+ use parrrtm, only: nbndlw
+ use parrrsw, only: nbndsw, ngptsw
+
implicit none
contains
@@ -230,8 +237,6 @@ subroutine rrtm_radiation_init(axes,Time,ncols,nlay,lonb,latb, Time_step)
! Modules
use rrtm_vars
use astronomy_mod, only: astronomy_init
- use parrrtm, only: nbndlw
- use parrrsw, only: nbndsw
use diag_manager_mod, only: register_diag_field, send_data
use interpolator_mod, only: interpolate_type, interpolator_init, &
&CONSTANT, ZERO,INTERP_WEIGHTED_P
@@ -405,8 +410,8 @@ subroutine rrtm_radiation_init(axes,Time,ncols,nlay,lonb,latb, Time_step)
if(.not. do_read_radiation .or. .not. do_read_sw_flux .and. .not. do_read_lw_flux)then
allocate(h2o(ncols_rrt,nlay_rrt),o3(ncols_rrt,nlay_rrt), &
co2(ncols_rrt,nlay_rrt))
- allocate(ones(ncols_rrt,nlay_rrt), &
- zeros(ncols_rrt,nlay_rrt))
+ allocate(ones(ngptsw,ncols_rrt,nlay_rrt), &
+ zeros(ngptsw,ncols_rrt,nlay_rrt))
allocate(emis(ncols_rrt,nbndlw))
allocate(taucld(nbndlw,ncols_rrt,nlay_rrt), &
tauaer(ncols_rrt,nlay_rrt,nbndlw))
@@ -544,7 +549,7 @@ subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half, &
use fms_mod, only: error_mesg, FATAL
use mpp_mod, only: mpp_pe,mpp_root_pe
use rrtmg_lw_rad, only: rrtmg_lw
- use rrtmg_sw_rad, only: rrtmg_sw
+ use rrtmg_sw_rad, only: rrtmg_sw, mcica_subcol_sw
use astronomy_mod, only: diurnal_solar
use rrtm_vars
use time_manager_mod,only: time_type,get_time,set_time, length_of_year, length_of_day
@@ -591,8 +596,13 @@ subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half, &
integer si,sj,sk,locmin(3)
real(kind=rb),dimension(size(q,1),size(q,2),size(q,3)) :: o3f
real(kind=rb),dimension(size(q,1),size(q,2),size(q,3)) :: co2f,co2f_temp
+
real(kind=rb),dimension(ncols_rrt,nlay_rrt) :: pfull,tfull,fracday&
, hr,hrc, swhr, swhrc, cldfr, reliq, reice
+
+
+ real(kind=rb),dimension(ngptsw,ncols_rrt,nlay_rrt) :: cldfr_pass
+
real(kind=rb),dimension(size(tdt,1),size(tdt,2),size(tdt,3)) :: tdt_rrtm
real(kind=rb),dimension(ncols_rrt,nlay_rrt+1) :: uflx, dflx, uflxc, dflxc&
,swuflx, swdflx, swuflxc, swdflxc
@@ -610,11 +620,16 @@ subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half, &
integer :: year_in_s
real :: r_seconds, r_days, r_total_seconds, frac_of_day, frac_of_year, gmt, time_since_ae, rrsun, dt_rad_radians, day_in_s, r_solday, r_dt_rad_avg
+ !mcica variables
+ integer :: permuteseed, irng
+ real(kind=rb),dimension(ncols_rrt,nlay_rrt) :: reicmcl, relqmcl
+
+ real(kind=rb),dimension(ngptsw, ncols_rrt,nlay_rrt) :: cldfmcl, ciwpmcl, clwpmcl, taucmcl, ssacmcl, asmcmcl, fsfcmcl
! debug
real :: tmp1, tmp2 !remove tmp1 and tmp2 after debugging
- integer :: indx2(2),indx(3),ii,ji,ki
+ integer :: indx2(2),indx(3),ii,ji,ki, pt1,pt2
logical :: used
!---------------------------------------------------------------------------------------------------------------
@@ -838,31 +853,54 @@ subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half, &
! where(cosz_rr < 1.e-2)cosz_rr=0.
if (do_cloud_simple) then
+ pt1 = 1
+ pt2 = ngptsw
inflglw = 2 !RRTM responsible for calculating optical properties of clouds
liqflglw = 1 !Sets liquid water radii to be used rather than being inactive (zero is inactive)
cldfr = reshape( cf_rad (1:si:lonstep,:,sk :1:-1),(/ si*sj/lonstep,sk /))
reliq = reshape(reff_rad (1:si:lonstep,:,sk :1:-1),(/ si*sj/lonstep,sk /)) !already in microns
- reice = 10*ones !Ice particle radii not used as iceflglw=0 meaning it is inactive. Setting to fill value of zeros
+ reice = 10*ones(pt1,:,:) !Ice particle radii not used as iceflglw=0 meaning it is inactive. Setting to fill value of zeros
else
- cldfr = zeros
- reliq = 10*ones ! not requires to be 10 microns but assumed a valid number
- reice = 10*ones ! needs to be 10 microns
+ pt1 = 1
+ pt2 = 1
+ cldfr = zeros(pt1,:,:)
+ reliq = 10*ones(pt1,:,:) ! not requires to be 10 microns but assumed a valid number
+ reice = 10*ones(pt1,:,:) ! needs to be 10 microns
+ cldfr_pass(pt1,:,:) = cldfr
endif
- tmp1 = maxval(reff_rad)
- tmp2 = maxval(cf_rad)
+
+
+ if (do_cloud_simple) then
+ !need to run monty carlo independent column approcimation (mcica)
+ permuteseed = 1
+ irng = 1 !use a random number gerator either 0 (Kissvec) or 1(Mersenne Twister)
+
+ call mcica_subcol_sw(0, ncols_rrt, nlay_rrt, icld, permuteseed, irng, pfull, &
+ cldfr, zeros(pt1,:,:), zeros(pt1,:,:), reice, reliq, tauaer, zro_sw, zro_sw, zro_sw , &
+ !outs
+ cldfmcl, ciwpmcl, clwpmcl, reicmcl, relqmcl, taucmcl, ssacmcl, asmcmcl, fsfcmcl)
+
+ permuteseed = 2
+ cldfr_pass = cldfmcl
+ reice = reicmcl
+ reliq = relqmcl
+ taucld = taucmcl
+ !other vars not needed
+ endif
+
if(include_secondary_gases)then
call rrtmg_sw &
(ncols_rrt, nlay_rrt , icld , iaer , &
pfull , phalf , tfull , thalf , tsrf , &
- h2o , o3 , co2 , ch4_val*ones , n2o_val*ones , o2_val*ones , &
+ h2o , o3 , co2 , ch4_val*ones(pt1,:,:) , n2o_val*ones(pt1,:,:) , o2_val*ones(pt1,:,:) , &
albedo_rr , albedo_rr, albedo_rr, albedo_rr, &
cosz_rr , solrad , dyofyr , solr_cnst, &
inflglw , iceflglw , liqflglw , &
! cloud parameters
- cldfr, &
+ cldfr_pass(pt1:pt2,:,:), &
taucld , sw_zro , sw_zro , sw_zro , &
- zeros , zeros , reice , reliq , &
+ zeros(pt1:pt2,:,:) , zeros(pt1:pt2,:,:) , reice , reliq , &
tauaer , zro_sw , zro_sw , zro_sw , &
! output
swuflx , swdflx , swhr , swuflxc , swdflxc, swhrc)
@@ -870,14 +908,14 @@ subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half, &
call rrtmg_sw &
(ncols_rrt, nlay_rrt , icld , iaer , &
pfull , phalf , tfull , thalf , tsrf , &
- h2o , o3 , co2 , zeros , zeros, zeros, &
+ h2o , o3 , co2 , zeros(pt1,:,:) , zeros(pt1,:,:), zeros(pt1,:,:), &
albedo_rr , albedo_rr, albedo_rr, albedo_rr, &
cosz_rr , solrad , dyofyr , solr_cnst, &
inflglw , iceflglw , liqflglw , &
! cloud parameters
- cldfr, &
+ cldfr_pass(pt1:pt2,:,:), &
taucld , sw_zro , sw_zro , sw_zro , &
- zeros , zeros , reice , reliq , &
+ zeros(pt1:pt2,:,:) , zeros(pt1:pt2,:,:) , reice , reliq , &
tauaer , zro_sw , zro_sw , zro_sw , &
! output
swuflx , swdflx , swhr , swuflxc , swdflxc, swhrc)
@@ -904,12 +942,12 @@ subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half, &
pfull , phalf , tfull , thalf, tsrf , &
h2o , o3 , co2 , &
! secondary gases
- ch4_val*ones , n2o_val*ones , o2_val*ones , &
- cfc11_val*ones , cfc12_val*ones , cfc22_val*ones , ccl4_val*ones , &
+ ch4_val*ones(pt1,:,:) , n2o_val*ones(pt1,:,:) , o2_val*ones(pt1,:,:) , &
+ cfc11_val*ones(pt1,:,:) , cfc12_val*ones(pt1,:,:) , cfc22_val*ones(pt1,:,:) , ccl4_val*ones(pt1,:,:) , &
! emissivity and cloud composition
emis , inflglw , iceflglw , liqflglw , &
! cloud parameters
- cldfr , taucld , zeros , zeros , reice, reliq, &
+ cldfr_pass(pt1,:,:) , taucld , zeros(pt1,:,:) , zeros(pt1,:,:) , reice, reliq, &
tauaer , &
! output
uflx , dflx , hr , uflxc , dflxc , hrc)
@@ -917,12 +955,12 @@ subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half, &
call rrtmg_lw &
(ncols_rrt, nlay_rrt, icld , idrv , &
pfull , phalf , tfull , thalf, tsrf , &
- h2o , o3 , co2 , zeros, zeros, zeros, &
- zeros , zeros , zeros , zeros, &
+ h2o , o3 , co2 , zeros(pt1,:,:), zeros(pt1,:,:), zeros(pt1,:,:), &
+ zeros(pt1,:,:) , zeros(pt1,:,:) , zeros(pt1,:,:) , zeros(pt1,:,:), &
! emissivity and cloud composition
emis , inflglw , iceflglw, liqflglw, &
! cloud parameters
- cldfr , taucld , zeros , zeros, reice, reliq, &
+ cldfr_pass(pt1,:,:) , taucld , zeros(pt1,:,:) , zeros(pt1,:,:), reice, reliq, &
tauaer , &
! output
uflx , dflx , hr , uflxc, dflxc , hrc)
diff --git a/src/extra/model/isca/path_names b/src/extra/model/isca/path_names
index eebdfd2b0..3ffc0f449 100644
--- a/src/extra/model/isca/path_names
+++ b/src/extra/model/isca/path_names
@@ -83,7 +83,7 @@ atmos_param/rrtm_radiation/rrtmg_sw/gcm_model/modules/rrsw_vsn.f90
atmos_param/rrtm_radiation/rrtmg_sw/gcm_model/modules/rrsw_wvn.f90
atmos_param/rrtm_radiation/rrtmg_sw/gcm_model/src/mcica_random_numbers.f90
atmos_param/rrtm_radiation/rrtmg_sw/gcm_model/src/mcica_subcol_gen_sw.f90
-atmos_param/rrtm_radiation/rrtmg_sw/gcm_model/src/rrtmg_sw_rad.nomcica.f90
+atmos_param/rrtm_radiation/rrtmg_sw/gcm_model/src/rrtmg_sw_rad.f90
atmos_param/rrtm_radiation/rrtmg_sw/gcm_model/src/rrtmg_sw_cldprop.f90
atmos_param/rrtm_radiation/rrtmg_sw/gcm_model/src/rrtmg_sw_cldprmc.f90
atmos_param/rrtm_radiation/rrtmg_sw/gcm_model/src/rrtmg_sw_init.f90
From 21e53c23e7a9a18e232c4c9fcf58c566e593e9d8 Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Thu, 6 Sep 2018 17:03:52 +0100
Subject: [PATCH 085/304] Swapped to using mcica lw routine and added required
initialisation routine. Seems to run. Testing needed
---
exp/test_cases/MiMA/MiMA_test_case.py | 6 +-
.../rrtm_radiation/rrtm_radiation.f90 | 70 ++++++++++++-------
src/extra/model/isca/path_names | 2 +-
3 files changed, 49 insertions(+), 29 deletions(-)
diff --git a/exp/test_cases/MiMA/MiMA_test_case.py b/exp/test_cases/MiMA/MiMA_test_case.py
index aef6b0ab6..27dc00243 100644
--- a/exp/test_cases/MiMA/MiMA_test_case.py
+++ b/exp/test_cases/MiMA/MiMA_test_case.py
@@ -23,7 +23,7 @@
# create an Experiment object to handle the configuration of model parameters
# and output diagnostics
-exp = Experiment('mima_test_experiment', codebase=cb)
+exp = Experiment('mima_test_experiment_with_mcica', codebase=cb)
exp.inputfiles = [os.path.join(GFDL_BASE,'input/rrtm_input_files/ozone_1990.nc')]
@@ -192,5 +192,5 @@
#Lets do a run!
if __name__=="__main__":
exp.run(1, use_restart=False, num_cores=NCORES, overwrite_data=True)#, run_idb=True)
- # for i in range(2,25):
- # exp.run(i, num_cores=NCORES, overwrite_data=True)
+ for i in range(2,25):
+ exp.run(i, num_cores=NCORES, overwrite_data=True)
diff --git a/src/atmos_param/rrtm_radiation/rrtm_radiation.f90 b/src/atmos_param/rrtm_radiation/rrtm_radiation.f90
index 195206d91..44865ab20 100644
--- a/src/atmos_param/rrtm_radiation/rrtm_radiation.f90
+++ b/src/atmos_param/rrtm_radiation/rrtm_radiation.f90
@@ -78,7 +78,7 @@ module rrtm_vars
! =1 for black body
! clouds stuff
! cloud & aerosol optical depths, cloud and aerosol specific parameters. Set to zero
- real(kind=rb),allocatable,dimension(:,:,:) :: taucld,tauaer, sw_zro, zro_sw
+ real(kind=rb),allocatable,dimension(:,:,:) :: taucld_lw, taucld_sw, tauaer_lw, tauaer_sw, sw_zro, zro_sw
! heating rates and fluxes, zenith angle when in-between radiation time steps
real(kind=rb),allocatable,dimension(:,:) :: sw_flux,lw_flux,zencos, olr, toa_sw! surface and TOA fluxes, cos(zenith angle)
! dimension (lon x lat)
@@ -222,7 +222,7 @@ end module rrtm_vars
module rrtm_radiation
use parkind, only : im => kind_im, rb => kind_rb
use constants_mod, only: pi, wtmozone, wtmh2o, gas_constant, rdgas
- use parrrtm, only: nbndlw
+ use parrrtm, only: nbndlw, ngptlw
use parrrsw, only: nbndsw, ngptsw
implicit none
@@ -413,8 +413,10 @@ subroutine rrtm_radiation_init(axes,Time,ncols,nlay,lonb,latb, Time_step)
allocate(ones(ngptsw,ncols_rrt,nlay_rrt), &
zeros(ngptsw,ncols_rrt,nlay_rrt))
allocate(emis(ncols_rrt,nbndlw))
- allocate(taucld(nbndlw,ncols_rrt,nlay_rrt), &
- tauaer(ncols_rrt,nlay_rrt,nbndlw))
+ allocate(taucld_lw(nbndlw,ncols_rrt,nlay_rrt), &
+ tauaer_lw(ncols_rrt,nlay_rrt,nbndlw))
+ allocate(taucld_sw(nbndsw,ncols_rrt,nlay_rrt), &
+ tauaer_sw(ncols_rrt,nlay_rrt,nbndsw))
allocate(sw_zro(nbndsw,ncols_rrt,nlay_rrt), &
zro_sw(ncols_rrt,nlay_rrt,nbndsw))
if(id_coszen > 0)allocate(zencos (size(lonb,1)-1,size(latb,2)-1))
@@ -429,8 +431,10 @@ subroutine rrtm_radiation_init(axes,Time,ncols,nlay,lonb,latb, Time_step)
emis = 1. !black body: 1.0
! absorption
- taucld = 0.
- tauaer = 0.
+ taucld_sw = 0.
+ tauaer_sw = 0.
+ taucld_lw = 0.
+ tauaer_lw = 0.
! clouds
sw_zro = 0.
zro_sw = 0.
@@ -548,7 +552,7 @@ subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half, &
! Modules
use fms_mod, only: error_mesg, FATAL
use mpp_mod, only: mpp_pe,mpp_root_pe
- use rrtmg_lw_rad, only: rrtmg_lw
+ use rrtmg_lw_rad, only: rrtmg_lw, mcica_subcol_lw
use rrtmg_sw_rad, only: rrtmg_sw, mcica_subcol_sw
use astronomy_mod, only: diurnal_solar
use rrtm_vars
@@ -601,7 +605,8 @@ subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half, &
, hr,hrc, swhr, swhrc, cldfr, reliq, reice
- real(kind=rb),dimension(ngptsw,ncols_rrt,nlay_rrt) :: cldfr_pass
+ real(kind=rb),dimension(ngptsw,ncols_rrt,nlay_rrt) :: cldfr_pass_sw
+ real(kind=rb),dimension(ngptlw,ncols_rrt,nlay_rrt) :: cldfr_pass_lw
real(kind=rb),dimension(size(tdt,1),size(tdt,2),size(tdt,3)) :: tdt_rrtm
real(kind=rb),dimension(ncols_rrt,nlay_rrt+1) :: uflx, dflx, uflxc, dflxc&
@@ -624,7 +629,9 @@ subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half, &
integer :: permuteseed, irng
real(kind=rb),dimension(ncols_rrt,nlay_rrt) :: reicmcl, relqmcl
- real(kind=rb),dimension(ngptsw, ncols_rrt,nlay_rrt) :: cldfmcl, ciwpmcl, clwpmcl, taucmcl, ssacmcl, asmcmcl, fsfcmcl
+ real(kind=rb),dimension(ngptsw, ncols_rrt,nlay_rrt) :: cldfmcl_sw, ciwpmcl_sw, clwpmcl_sw, taucmcl_sw, ssacmcl, asmcmcl, fsfcmcl
+
+ real(kind=rb),dimension(ngptlw, ncols_rrt,nlay_rrt) :: cldfmcl_lw, ciwpmcl_lw, clwpmcl_lw, taucmcl_lw
! debug
real :: tmp1, tmp2 !remove tmp1 and tmp2 after debugging
@@ -866,7 +873,7 @@ subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half, &
cldfr = zeros(pt1,:,:)
reliq = 10*ones(pt1,:,:) ! not requires to be 10 microns but assumed a valid number
reice = 10*ones(pt1,:,:) ! needs to be 10 microns
- cldfr_pass(pt1,:,:) = cldfr
+ cldfr_pass_sw(pt1,:,:) = cldfr
endif
@@ -876,15 +883,14 @@ subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half, &
irng = 1 !use a random number gerator either 0 (Kissvec) or 1(Mersenne Twister)
call mcica_subcol_sw(0, ncols_rrt, nlay_rrt, icld, permuteseed, irng, pfull, &
- cldfr, zeros(pt1,:,:), zeros(pt1,:,:), reice, reliq, tauaer, zro_sw, zro_sw, zro_sw , &
+ cldfr, zeros(pt1,:,:), zeros(pt1,:,:), reice, reliq, tauaer_sw, zro_sw, zro_sw, zro_sw , &
!outs
- cldfmcl, ciwpmcl, clwpmcl, reicmcl, relqmcl, taucmcl, ssacmcl, asmcmcl, fsfcmcl)
+ cldfmcl_sw, ciwpmcl_sw, clwpmcl_sw, reicmcl, relqmcl, taucmcl_sw, ssacmcl, asmcmcl, fsfcmcl)
- permuteseed = 2
- cldfr_pass = cldfmcl
+ cldfr_pass_sw = cldfmcl_sw
reice = reicmcl
reliq = relqmcl
- taucld = taucmcl
+ taucld_sw = taucmcl_sw
!other vars not needed
endif
@@ -898,10 +904,10 @@ subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half, &
cosz_rr , solrad , dyofyr , solr_cnst, &
inflglw , iceflglw , liqflglw , &
! cloud parameters
- cldfr_pass(pt1:pt2,:,:), &
- taucld , sw_zro , sw_zro , sw_zro , &
+ cldfr_pass_sw(pt1:pt2,:,:), &
+ taucld_sw , sw_zro , sw_zro , sw_zro , &
zeros(pt1:pt2,:,:) , zeros(pt1:pt2,:,:) , reice , reliq , &
- tauaer , zro_sw , zro_sw , zro_sw , &
+ tauaer_sw , zro_sw , zro_sw , zro_sw , &
! output
swuflx , swdflx , swhr , swuflxc , swdflxc, swhrc)
else
@@ -913,10 +919,10 @@ subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half, &
cosz_rr , solrad , dyofyr , solr_cnst, &
inflglw , iceflglw , liqflglw , &
! cloud parameters
- cldfr_pass(pt1:pt2,:,:), &
- taucld , sw_zro , sw_zro , sw_zro , &
+ cldfr_pass_sw(pt1:pt2,:,:), &
+ taucld_sw , sw_zro , sw_zro , sw_zro , &
zeros(pt1:pt2,:,:) , zeros(pt1:pt2,:,:) , reice , reliq , &
- tauaer , zro_sw , zro_sw , zro_sw , &
+ tauaer_sw , zro_sw , zro_sw , zro_sw , &
! output
swuflx , swdflx , swhr , swuflxc , swdflxc, swhrc)
endif
@@ -930,6 +936,20 @@ subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half, &
! swhr (:,i) = 0.
! endwhere
! enddo
+
+ if(do_cloud_simple) then
+
+ permuteseed = 2
+
+ call mcica_subcol_lw(0, ncols_rrt, nlay_rrt, icld, permuteseed, irng, pfull, &
+ cldfr, zeros(pt1,:,:), zeros(pt1,:,:), reice, reliq, tauaer_lw, &
+ cldfmcl_lw, ciwpmcl_lw, clwpmcl_lw, reicmcl, relqmcl, taucmcl_lw)
+ cldfr_pass_lw = cldfmcl_lw
+ reice = reicmcl
+ reliq = relqmcl
+ taucld_lw = taucmcl_lw
+ endif
+
swijk = reshape(swhr(:,sk:1:-1),(/ si/lonstep,sj,sk /))*daypersec
@@ -947,8 +967,8 @@ subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half, &
! emissivity and cloud composition
emis , inflglw , iceflglw , liqflglw , &
! cloud parameters
- cldfr_pass(pt1,:,:) , taucld , zeros(pt1,:,:) , zeros(pt1,:,:) , reice, reliq, &
- tauaer , &
+ cldfr_pass_lw(pt1:pt2,:,:) , taucld_lw , zeros(pt1:pt2,:,:) , zeros(pt1:pt2,:,:) , reice, reliq, &
+ tauaer_lw , &
! output
uflx , dflx , hr , uflxc , dflxc , hrc)
else
@@ -960,8 +980,8 @@ subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half, &
! emissivity and cloud composition
emis , inflglw , iceflglw, liqflglw, &
! cloud parameters
- cldfr_pass(pt1,:,:) , taucld , zeros(pt1,:,:) , zeros(pt1,:,:), reice, reliq, &
- tauaer , &
+ cldfr_pass_lw(pt1:pt2,:,:) , taucld_lw , zeros(pt1:pt2,:,:) , zeros(pt1:pt2,:,:), reice, reliq, &
+ tauaer_lw , &
! output
uflx , dflx , hr , uflxc, dflxc , hrc)
endif
diff --git a/src/extra/model/isca/path_names b/src/extra/model/isca/path_names
index 3ffc0f449..c147c0ba3 100644
--- a/src/extra/model/isca/path_names
+++ b/src/extra/model/isca/path_names
@@ -47,7 +47,7 @@ atmos_param/rrtm_radiation/rrtmg_lw/gcm_model/modules/rrlw_wvn.f90
atmos_param/rrtm_radiation/rrtm_radiation.f90
atmos_param/rrtm_radiation/rrtmg_lw/gcm_model/src/mcica_random_numbers.f90
atmos_param/rrtm_radiation/rrtmg_lw/gcm_model/src/rrtmg_lw_cldprop.f90
-atmos_param/rrtm_radiation/rrtmg_lw/gcm_model/src/rrtmg_lw_rad.nomcica.f90
+atmos_param/rrtm_radiation/rrtmg_lw/gcm_model/src/rrtmg_lw_rad.f90
atmos_param/rrtm_radiation/rrtmg_lw/gcm_model/src/rrtmg_lw_rtrn.f90
atmos_param/rrtm_radiation/rrtmg_lw/gcm_model/src/rrtmg_lw_setcoef.f90
atmos_param/rrtm_radiation/rrtmg_lw/gcm_model/src/mcica_subcol_gen_lw.f90
From 815b4d1db0dafe096e5beca7a8178af4919e473d Mon Sep 17 00:00:00 2001
From: sit23
Date: Fri, 7 Sep 2018 11:39:35 +0100
Subject: [PATCH 086/304] New socrates set cld file downloaded from LFRic James
Manners branch
main/branches/dev/jamesmanners/um11.1_solar/src/interface_core/socrates_set_cld.F90
on 07-09-18.
---
.../socrates/interface/socrates_set_cld.F90 | 485 ++++++++++++++++++
1 file changed, 485 insertions(+)
create mode 100644 src/atmos_param/socrates/interface/socrates_set_cld.F90
diff --git a/src/atmos_param/socrates/interface/socrates_set_cld.F90 b/src/atmos_param/socrates/interface/socrates_set_cld.F90
new file mode 100644
index 000000000..25e47a340
--- /dev/null
+++ b/src/atmos_param/socrates/interface/socrates_set_cld.F90
@@ -0,0 +1,485 @@
+! *****************************COPYRIGHT*******************************
+! (C) Crown copyright Met Office. All rights reserved.
+! For further details please refer to the file COPYRIGHT.txt
+! which you should have received as part of this distribution.
+! *****************************COPYRIGHT*******************************
+!
+! Set the variables in the Socrates cloud type
+!
+!------------------------------------------------------------------------------
+module socrates_set_cld
+implicit none
+character(len=*), parameter, private :: ModuleName = 'SOCRATES_SET_CLD'
+contains
+
+subroutine set_cld(cld, control, dimen, spectrum, n_profile, n_layer, &
+ cloud_frac, conv_frac, &
+ liq_frac, ice_frac, liq_conv_frac, ice_conv_frac, &
+ liq_mmr, ice_mmr, liq_conv_mmr, ice_conv_mmr, &
+ liq_dim, ice_dim, liq_conv_dim, ice_conv_dim, &
+ dp_corr_strat, dp_corr_conv)
+
+use def_cld, only: StrCld, allocate_cld, allocate_cld_prsc
+use def_control, only: StrCtrl
+use def_dimen, only: StrDim
+use def_spectrum, only: StrSpecData
+use realtype_rd, only: RealK
+use rad_pcf, only: &
+ ip_cloud_homogen, ip_cloud_ice_water, ip_cloud_conv_strat, ip_cloud_csiw, &
+ ip_clcmp_st_water, ip_clcmp_st_ice, ip_clcmp_cnv_water, ip_clcmp_cnv_ice, &
+ ip_phase_water, ip_phase_ice, ip_cloud_type_homogen, &
+ ip_cloud_type_water, ip_cloud_type_ice, &
+ ip_cloud_type_strat, ip_cloud_type_conv, &
+ ip_cloud_type_sw, ip_cloud_type_si, ip_cloud_type_cw, ip_cloud_type_ci, &
+ ip_drop_unparametrized, ip_ice_unparametrized, i_normal, i_err_fatal
+use ereport_mod, only: ereport
+use errormessagelength_mod, only: errormessagelength
+
+implicit none
+
+
+! Cloud properties:
+type(StrCld), intent(out) :: cld
+
+! Control options:
+type(StrCtrl), intent(in) :: control
+
+! Dimensions:
+type(StrDim), intent(in) :: dimen
+
+! Spectral data:
+type(StrSpecData), intent(in) :: spectrum
+
+integer, intent(in) :: n_profile
+integer, intent(in) :: n_layer
+
+real(RealK), intent(in), optional :: &
+ cloud_frac(:,:), conv_frac(:,:), &
+ liq_frac(:,:), ice_frac(:,:), liq_conv_frac(:,:), ice_conv_frac(:,:), &
+ liq_mmr(:,:), ice_mmr(:,:), liq_conv_mmr(:,:), ice_conv_mmr(:,:), &
+ liq_dim(:,:), ice_dim(:,:), liq_conv_dim(:,:), ice_conv_dim(:,:)
+! Liquid and ice cloud fractions, gridbox mean mixing ratios, and
+! effective dimensions
+
+real(RealK), intent(in), optional :: dp_corr_strat, dp_corr_conv
+! Decorrelation pressure scales for cloud vertical overlap
+
+
+! Local variables
+integer :: i, j, k, l
+! Loop variables
+integer :: i_phase, i_param_type, n_cloud_parameter
+! Working variables
+integer :: i_cloud_type(dimen%nd_cloud_component)
+! Types of cloud to which each component contributes
+
+real(RealK) :: condensed_min_dim
+real(RealK) :: condensed_max_dim
+! Minimum and maximum dimensions of each condensed component
+
+real(RealK) :: eps = EPSILON(1.0)
+real(RealK) :: min_cloud_fraction = 0.0001
+
+integer :: ierr = i_normal
+character (len=*), parameter :: RoutineName = 'SET_CLD'
+character (len=errormessagelength) :: cmessage
+
+! Functions called
+integer, external :: set_n_cloud_parameter
+
+
+! Allocate structure for the core radiation code interface
+call allocate_cld(cld, dimen, spectrum)
+call allocate_cld_prsc(cld, dimen, spectrum)
+
+if (.not.control%l_cloud) then
+ return
+end if
+
+!------------------------------------------------------------------------------
+! Set properties of condensed components
+!------------------------------------------------------------------------------
+
+if (control%l_ice .and. control%l_drop) then
+ select case (control%i_cloud_representation)
+ case (ip_cloud_homogen, ip_cloud_ice_water)
+ cld%n_condensed = 2
+ cld%type_condensed(1) = ip_clcmp_st_water
+ cld%type_condensed(2) = ip_clcmp_st_ice
+ case (ip_cloud_conv_strat, ip_cloud_csiw)
+ cld%n_condensed = 4
+ cld%type_condensed(1) = ip_clcmp_st_water
+ cld%type_condensed(2) = ip_clcmp_st_ice
+ cld%type_condensed(3) = ip_clcmp_cnv_water
+ cld%type_condensed(4) = ip_clcmp_cnv_ice
+ end select
+else if (control%l_ice .and. .not.control%l_drop) then
+ select case (control%i_cloud_representation)
+ case (ip_cloud_homogen, ip_cloud_ice_water)
+ cld%n_condensed = 1
+ cld%type_condensed(1) = ip_clcmp_st_ice
+ case (ip_cloud_conv_strat, ip_cloud_csiw)
+ cld%n_condensed = 2
+ cld%type_condensed(1) = ip_clcmp_st_ice
+ cld%type_condensed(2) = ip_clcmp_cnv_ice
+ end select
+else if (.not.control%l_ice .and. control%l_drop) then
+ select case (control%i_cloud_representation)
+ case (ip_cloud_homogen, ip_cloud_ice_water)
+ cld%n_condensed = 1
+ cld%type_condensed(1) = ip_clcmp_st_water
+ case (ip_cloud_conv_strat, ip_cloud_csiw)
+ cld%n_condensed = 2
+ cld%type_condensed(1) = ip_clcmp_st_water
+ cld%type_condensed(2) = ip_clcmp_cnv_water
+ end select
+else
+ cmessage = 'Cloud on, but no condensed components included.'
+ ierr=i_err_fatal
+ CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+end if
+
+do i=1, cld%n_condensed
+ select case (cld%type_condensed(i))
+ case (ip_clcmp_st_water)
+ i_phase = ip_phase_water
+ i_param_type = control%i_st_water
+ case (ip_clcmp_st_ice)
+ i_phase = ip_phase_ice
+ i_param_type = control%i_st_ice
+ case (ip_clcmp_cnv_water)
+ i_phase = ip_phase_water
+ i_param_type = control%i_cnv_water
+ case (ip_clcmp_cnv_ice)
+ i_phase = ip_phase_ice
+ i_param_type = control%i_cnv_ice
+ end select
+
+ select case (i_phase)
+ case (ip_phase_water)
+ if (i_param_type <= 0) then
+ cld%i_condensed_param(i) = ip_drop_unparametrized
+ cmessage = 'Prescribed liquid cloud not yet implemented.'
+ ierr=i_err_fatal
+ CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ else if (i_param_type > spectrum%dim%nd_drop_type) then
+ cmessage = 'Liquid cloud type outside allowed range.'
+ ierr=i_err_fatal
+ CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ else if (spectrum%drop%l_drop_type(i_param_type)) then
+ ! Take parametrisation from spectral file
+ cld%i_condensed_param(i) = spectrum%drop%i_drop_parm(i_param_type)
+ cld%condensed_n_phf(i) = spectrum%drop%n_phf(i_param_type)
+ ! DEPENDS ON: set_n_cloud_parameter
+ n_cloud_parameter = set_n_cloud_parameter( cld%i_condensed_param(i), &
+ cld%type_condensed(i), cld%condensed_n_phf(i) )
+ do j=1, spectrum%basic%n_band
+ do k=1, n_cloud_parameter
+ cld%condensed_param_list(k, i, j) &
+ = spectrum%drop%parm_list(k, j, i_param_type)
+ end do
+ end do
+ ! Assign droplet mass mixing ratio and effective radius
+ condensed_min_dim = spectrum%drop%parm_min_dim(i_param_type)
+ condensed_max_dim = spectrum%drop%parm_max_dim(i_param_type)
+ select case (cld%type_condensed(i))
+ case (ip_clcmp_st_water)
+ if (present(liq_mmr).and.present(liq_dim)) then
+ do k = dimen%id_cloud_top, n_layer
+ do l = 1, n_profile
+ cld%condensed_mix_ratio(l, k, i) = liq_mmr(l, k)
+ cld%condensed_dim_char(l, k, i) = min( max( liq_dim(l, k), &
+ condensed_min_dim ), condensed_max_dim )
+ end do
+ end do
+ else
+ cmessage = 'Liquid MMR and effective radius not provided.'
+ ierr=i_err_fatal
+ CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ end if
+ case (ip_clcmp_cnv_water)
+ if (present(liq_conv_mmr).and.present(liq_conv_dim)) then
+ do k = dimen%id_cloud_top, n_layer
+ do l = 1, n_profile
+ cld%condensed_mix_ratio(l, k, i) = liq_conv_mmr(l, k)
+ cld%condensed_dim_char(l, k, i) = min( max( liq_conv_dim(l, k), &
+ condensed_min_dim ), condensed_max_dim )
+ end do
+ end do
+ else
+ cmessage = 'Convective liquid MMR and effective radius not provided.'
+ ierr=i_err_fatal
+ CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ end if
+ end select
+ else
+ cmessage = 'Liquid cloud type not in spectral file.'
+ ierr=i_err_fatal
+ CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ end if
+ case (ip_phase_ice)
+ if (i_param_type <= 0) then
+ cld%i_condensed_param(i) = ip_ice_unparametrized
+ cmessage = 'Prescribed ice cloud not yet implemented.'
+ ierr=i_err_fatal
+ CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ else if (i_param_type > spectrum%dim%nd_ice_type) then
+ cmessage = 'Ice cloud type outside allowed range.'
+ ierr=i_err_fatal
+ CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ else if (spectrum%ice%l_ice_type(i_param_type)) then
+ ! Take parametrisation from spectral file
+ cld%i_condensed_param(i) = spectrum%ice%i_ice_parm(i_param_type)
+ cld%condensed_n_phf(i) = spectrum%ice%n_phf(i_param_type)
+ n_cloud_parameter = set_n_cloud_parameter( cld%i_condensed_param(i), &
+ cld%type_condensed(i), cld%condensed_n_phf(i) )
+ do j=1, spectrum%basic%n_band
+ do k=1, n_cloud_parameter
+ cld%condensed_param_list(k, i, j) &
+ = spectrum%ice%parm_list(k, j, i_param_type)
+ end do
+ end do
+ ! Assign ice mass mixing ratio and effective dimension
+ condensed_min_dim = spectrum%ice%parm_min_dim(i_param_type)
+ condensed_max_dim = spectrum%ice%parm_max_dim(i_param_type)
+ select case (cld%type_condensed(i))
+ case (ip_clcmp_st_ice)
+ if (present(ice_mmr).and.present(ice_dim)) then
+ do k = dimen%id_cloud_top, n_layer
+ do l = 1, n_profile
+ cld%condensed_mix_ratio(l, k, i) = ice_mmr(l, k)
+ cld%condensed_dim_char(l, k, i) = min( max( ice_dim(l, k), &
+ condensed_min_dim ), condensed_max_dim )
+ end do
+ end do
+ else
+ cmessage = 'Ice MMR and effective radius not provided.'
+ ierr=i_err_fatal
+ CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ end if
+ case (ip_clcmp_cnv_ice)
+ if (present(ice_conv_mmr).and.present(ice_conv_dim)) then
+ do k = dimen%id_cloud_top, n_layer
+ do l = 1, n_profile
+ cld%condensed_mix_ratio(l, k, i) = ice_conv_mmr(l, k)
+ cld%condensed_dim_char(l, k, i) = min( max( ice_conv_dim(l, k), &
+ condensed_min_dim ), condensed_max_dim )
+ end do
+ end do
+ else
+ cmessage = 'Convective ice MMR and effective radius not provided.'
+ ierr=i_err_fatal
+ CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ end if
+ end select
+ else
+ cmessage = 'Ice cloud type not in spectral file.'
+ ierr=i_err_fatal
+ CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ end if
+ end select
+end do
+
+! Set the decorrelation scalings for cloud vertical overlap
+if (present(dp_corr_strat)) then
+ cld%dp_corr_strat = dp_corr_strat
+else
+ cld%dp_corr_strat = 0.0_RealK
+end if
+if (present(dp_corr_conv)) then
+ cld%dp_corr_conv = dp_corr_conv
+else
+ cld%dp_corr_conv = 0.0_RealK
+end if
+
+
+!------------------------------------------------------------------------------
+! Set cloud amounts and convert mixing ratios to in-cloud values
+!------------------------------------------------------------------------------
+
+! Set cloud fractions
+select case (control%i_cloud_representation)
+case (ip_cloud_homogen)
+ cld%n_cloud_type = 1
+ do i = 1, cld%n_condensed
+ i_cloud_type(i) = ip_cloud_type_homogen
+ end do
+ if (present(cloud_frac)) then
+ do k = dimen%id_cloud_top, n_layer
+ do l = 1, n_profile
+ cld%frac_cloud(l, k, ip_cloud_type_homogen) = cloud_frac(l, k)
+ end do
+ end do
+ else
+ cmessage = 'Cloud fraction not provided.'
+ ierr=i_err_fatal
+ CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ end if
+case (ip_cloud_ice_water)
+ cld%n_cloud_type = 2
+ do i = 1, cld%n_condensed
+ select case (cld%type_condensed(i))
+ case (ip_clcmp_st_water)
+ i_cloud_type(i) = ip_cloud_type_water
+ case (ip_clcmp_st_ice)
+ i_cloud_type(i) = ip_cloud_type_ice
+ end select
+ end do
+ if (present(liq_frac).and.present(ice_frac).and.present(cloud_frac)) then
+ do k = dimen%id_cloud_top, n_layer
+ do l = 1, n_profile
+ if (liq_frac(l, k) + ice_frac(l, k) > eps) then
+ ! Split mixed phase fraction between ice and liquid
+ cld%frac_cloud(l, k, ip_cloud_type_water) = &
+ cloud_frac(l, k)*liq_frac(l, k) / (liq_frac(l, k)+ice_frac(l, k))
+ cld%frac_cloud(l, k, ip_cloud_type_ice) = &
+ cloud_frac(l, k)*ice_frac(l, k) / (liq_frac(l, k)+ice_frac(l, k))
+ else
+ cld%frac_cloud(l, k, ip_cloud_type_water) = 0.0_RealK
+ cld%frac_cloud(l, k, ip_cloud_type_ice) = 0.0_RealK
+ end if
+ end do
+ end do
+ else if (present(liq_frac).and.present(ice_frac)) then
+ do k = dimen%id_cloud_top, n_layer
+ do l = 1, n_profile
+ cld%frac_cloud(l, k, ip_cloud_type_water) = liq_frac(l, k)
+ cld%frac_cloud(l, k, ip_cloud_type_ice) = ice_frac(l, k)
+ end do
+ end do
+ else
+ cmessage = 'Liquid and ice cloud fractions not provided.'
+ ierr=i_err_fatal
+ CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ end if
+case (ip_cloud_conv_strat)
+ cld%n_cloud_type = 2
+ do i = 1, cld%n_condensed
+ select case (cld%type_condensed(i))
+ case (ip_clcmp_st_water)
+ i_cloud_type(i) = ip_cloud_type_strat
+ case (ip_clcmp_st_ice)
+ i_cloud_type(i) = ip_cloud_type_strat
+ case (ip_clcmp_cnv_water)
+ i_cloud_type(i) = ip_cloud_type_conv
+ case (ip_clcmp_cnv_ice)
+ i_cloud_type(i) = ip_cloud_type_conv
+ end select
+ end do
+ if (present(cloud_frac).and.present(conv_frac)) then
+ do k = dimen%id_cloud_top, n_layer
+ do l = 1, n_profile
+ cld%frac_cloud(l, k, ip_cloud_type_strat) = cloud_frac(l, k)
+ cld%frac_cloud(l, k, ip_cloud_type_conv) = conv_frac(l, k)
+ end do
+ end do
+ else
+ cmessage = 'Cloud fraction and convective cloud fraction not provided.'
+ ierr=i_err_fatal
+ CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ end if
+case (ip_cloud_csiw)
+ cld%n_cloud_type = 4
+ do i = 1, cld%n_condensed
+ select case (cld%type_condensed(i))
+ case (ip_clcmp_st_water)
+ i_cloud_type(i) = ip_cloud_type_sw
+ case (ip_clcmp_st_ice)
+ i_cloud_type(i) = ip_cloud_type_si
+ case (ip_clcmp_cnv_water)
+ i_cloud_type(i) = ip_cloud_type_cw
+ case (ip_clcmp_cnv_ice)
+ i_cloud_type(i) = ip_cloud_type_ci
+ end select
+ end do
+ if (present(liq_frac).and.present(ice_frac).and.present(cloud_frac)) then
+ do k = dimen%id_cloud_top, n_layer
+ do l = 1, n_profile
+ if (liq_frac(l, k) + ice_frac(l, k) > eps) then
+ ! Split mixed phase fraction between ice and liquid
+ cld%frac_cloud(l, k, ip_cloud_type_sw) = &
+ cloud_frac(l, k)*liq_frac(l, k) / (liq_frac(l, k)+ice_frac(l, k))
+ cld%frac_cloud(l, k, ip_cloud_type_si) = &
+ cloud_frac(l, k)*ice_frac(l, k) / (liq_frac(l, k)+ice_frac(l, k))
+ else
+ cld%frac_cloud(l, k, ip_cloud_type_sw) = 0.0_RealK
+ cld%frac_cloud(l, k, ip_cloud_type_si) = 0.0_RealK
+ end if
+ end do
+ end do
+ else if (present(liq_frac).and.present(ice_frac)) then
+ do k = dimen%id_cloud_top, n_layer
+ do l = 1, n_profile
+ cld%frac_cloud(l, k, ip_cloud_type_sw) = liq_frac(l, k)
+ cld%frac_cloud(l, k, ip_cloud_type_si) = ice_frac(l, k)
+ end do
+ end do
+ else
+ cmessage = 'Liquid and ice cloud fractions not provided.'
+ ierr=i_err_fatal
+ CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ end if
+ if (present(liq_conv_frac).and.present(ice_conv_frac).and. &
+ present(conv_frac)) then
+ do k = dimen%id_cloud_top, n_layer
+ do l = 1, n_profile
+ if (liq_conv_frac(l, k) + ice_conv_frac(l, k) > eps) then
+ ! Split mixed phase fraction between ice and liquid
+ cld%frac_cloud(l, k, ip_cloud_type_cw) = conv_frac(l, k) &
+ *liq_conv_frac(l, k) / (liq_conv_frac(l, k)+ice_conv_frac(l, k))
+ cld%frac_cloud(l, k, ip_cloud_type_ci) = conv_frac(l, k) &
+ *ice_conv_frac(l, k) / (liq_conv_frac(l, k)+ice_conv_frac(l, k))
+ else
+ cld%frac_cloud(l, k, ip_cloud_type_cw) = 0.0_RealK
+ cld%frac_cloud(l, k, ip_cloud_type_ci) = 0.0_RealK
+ end if
+ end do
+ end do
+ else if (present(liq_conv_frac).and.present(ice_conv_frac)) then
+ do k = dimen%id_cloud_top, n_layer
+ do l = 1, n_profile
+ cld%frac_cloud(l, k, ip_cloud_type_cw) = liq_conv_frac(l, k)
+ cld%frac_cloud(l, k, ip_cloud_type_ci) = ice_conv_frac(l, k)
+ end do
+ end do
+ else
+ cmessage = 'Liquid and ice convective cloud fractions not provided.'
+ ierr=i_err_fatal
+ CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ end if
+end select
+
+! Convert mass mixing ratios to in-cloud values
+do i = 1, cld%n_condensed
+ do k = dimen%id_cloud_top, n_layer
+ do l = 1, n_profile
+ cld%condensed_mix_ratio(l, k, i) = cld%condensed_mix_ratio(l, k, i) &
+ / max(cld%frac_cloud(l, k, i_cloud_type(i)), eps)
+ end do
+ end do
+end do
+
+! Normalise the cloud fractions
+do k = dimen%id_cloud_top, n_layer
+ do l = 1, n_profile
+ cld%w_cloud(l, k) = sum(cld%frac_cloud(l, k, 1:cld%n_cloud_type))
+ if (cld%w_cloud(l, k) > min_cloud_fraction) then
+ do j=1, cld%n_cloud_type
+ cld%frac_cloud(l, k, j) = cld%frac_cloud(l, k, j) / cld%w_cloud(l, k)
+ end do
+ else
+ cld%w_cloud(l, k) = 0.0_RealK
+ cld%frac_cloud(l, k, 1:cld%n_cloud_type) = 0.0_RealK
+ end if
+ if (cld%w_cloud(l, k) > 1.0_RealK + min_cloud_fraction) then
+ cmessage = 'Cloud fraction greater than 1.'
+ ierr=i_err_fatal
+ CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ else if (cld%w_cloud(l, k) > 1.0_RealK) then
+ cld%w_cloud(l, k) = 1.0_RealK
+ end if
+ end do
+end do
+
+end subroutine set_cld
+end module socrates_set_cld
From 3fa5ede95ad45a6947bb9c1c4ce4d014fa91f54e Mon Sep 17 00:00:00 2001
From: sit23
Date: Fri, 7 Sep 2018 12:54:05 +0100
Subject: [PATCH 087/304] Changes to pass socrates clouds from simple cloud
scheme.
---
.../socrates/interface/read_control.F90 | 8 +-
.../socrates/interface/socrates_calc.F90 | 33 ++++--
.../interface/socrates_config_mod.f90 | 9 +-
.../socrates/interface/socrates_interface.F90 | 55 ++++++++--
.../socrates/interface/socrates_set_cld.F90 | 101 ++++++++++--------
.../driver/solo/idealized_moist_phys.F90 | 5 +-
src/extra/model/socrates/path_names | 2 +-
7 files changed, 150 insertions(+), 63 deletions(-)
diff --git a/src/atmos_param/socrates/interface/read_control.F90 b/src/atmos_param/socrates/interface/read_control.F90
index 5ed7fae81..92d5eeefb 100644
--- a/src/atmos_param/socrates/interface/read_control.F90
+++ b/src/atmos_param/socrates/interface/read_control.F90
@@ -15,7 +15,7 @@ SUBROUTINE read_control(control, spectrum)
USE rad_pcf
USE def_control, ONLY: StrCtrl, allocate_control
USE def_spectrum, ONLY: StrSpecData
-USE socrates_config_mod, ONLY: l_planet_grey_surface, inc_h2o, inc_co2, inc_co, inc_o3, inc_n2o, inc_ch4, inc_o2, inc_so2, inc_cfc11, inc_cfc12, inc_cfc113, inc_hcfc22, inc_hfc134a
+USE socrates_config_mod, ONLY: l_planet_grey_surface, inc_h2o, inc_co2, inc_co, inc_o3, inc_n2o, inc_ch4, inc_o2, inc_so2, inc_cfc11, inc_cfc12, inc_cfc113, inc_hcfc22, inc_hfc134a, account_for_clouds_in_socrates
IMPLICIT NONE
@@ -93,7 +93,11 @@ SUBROUTINE read_control(control, spectrum)
control%i_gas_overlap = ip_overlap_k_eqv_scl
! Properties of clouds
-control%i_cloud_representation = ip_cloud_off
+if (account_for_clouds_in_socrates) then
+ control%i_cloud_representation = ip_cloud_ice_water
+else
+ control%i_cloud_representation = ip_cloud_off
+end if
control%i_overlap = ip_max_rand
control%i_inhom = ip_homogeneous
diff --git a/src/atmos_param/socrates/interface/socrates_calc.F90 b/src/atmos_param/socrates/interface/socrates_calc.F90
index 6a07a8d3b..ab545635e 100644
--- a/src/atmos_param/socrates/interface/socrates_calc.F90
+++ b/src/atmos_param/socrates/interface/socrates_calc.F90
@@ -33,6 +33,7 @@ subroutine socrates_calc(Time_diag,control, spectrum,
t_rad_surf, cos_zenith_angle, solar_irrad, orog_corr, &
l_planet_grey_surface, planet_albedo, planet_emissivity, &
layer_heat_capacity, &
+ cld_frac, reff_rad, mmr_cl_rad, &
flux_direct, flux_down, flux_up, heating_rate, spectral_olr)
use rad_pcf
@@ -45,12 +46,12 @@ subroutine socrates_calc(Time_diag,control, spectrum,
use def_aer, only: StrAer, deallocate_aer, deallocate_aer_prsc
use def_out, only: StrOut, deallocate_out
-use set_control_mod, only: set_control
-use set_dimen_mod, only: set_dimen
-use set_atm_mod, only: set_atm
-use set_bound_mod, only: set_bound
-use set_cld_mod, only: set_cld
-use set_aer_mod, only: set_aer
+use set_control_mod, only: set_control
+use set_dimen_mod, only: set_dimen
+use set_atm_mod, only: set_atm
+use set_bound_mod, only: set_bound
+use socrates_set_cld, only: set_cld
+use set_aer_mod, only: set_aer
use soc_constants_mod, only: i_def, r_def
@@ -114,6 +115,15 @@ subroutine socrates_calc(Time_diag,control, spectrum,
real(r_def), intent(in) :: layer_heat_capacity(n_profile, n_layer)
! Heat capacity of layer
+real(r_def), intent(in) :: cld_frac(n_profile, n_layer)
+! Cloud fraction at layer centres
+
+real(r_def), intent(in) :: reff_rad(n_profile, n_layer)
+! Cloud liquid particle radius from simple cloud scheme
+
+real(r_def), intent(in) :: mmr_cl_rad(n_profile, n_layer)
+! Cloud liquid mmr at layer centres
+
real(r_def), intent(out) :: flux_direct(n_profile, 0:n_layer)
! Direct (unscattered) downwards flux (Wm-2)
real(r_def), intent(out) :: flux_down(n_profile, 0:n_layer)
@@ -151,6 +161,7 @@ subroutine socrates_calc(Time_diag,control, spectrum,
!DIAG Diagnostic
logical :: used
+real(r_def) :: zeros_cld(n_profile, n_layer)
call set_control(control)
@@ -165,7 +176,15 @@ subroutine socrates_calc(Time_diag,control, spectrum,
t_rad_surf, cos_zenith_angle, solar_irrad, orog_corr, &
l_planet_grey_surface, planet_albedo, planet_emissivity)
-call set_cld(control, dimen, spectrum, cld, n_profile)
+! call set_cld(control, dimen, spectrum, cld, n_profile)
+
+call set_cld(cld, control, dimen, spectrum, n_profile, n_layer, &
+ liq_frac = cld_frac, &
+ ice_frac = zeros_cld, &
+ liq_mmr = mmr_cl_rad, &
+ ice_mmr = zeros_cld, &
+ liq_dim = reff_rad, &
+ ice_dim = zeros_cld )
call set_aer(control, dimen, spectrum, aer, n_profile)
diff --git a/src/atmos_param/socrates/interface/socrates_config_mod.f90 b/src/atmos_param/socrates/interface/socrates_config_mod.f90
index 2689b940c..c97018716 100644
--- a/src/atmos_param/socrates/interface/socrates_config_mod.f90
+++ b/src/atmos_param/socrates/interface/socrates_config_mod.f90
@@ -41,7 +41,9 @@ module socrates_config_mod
logical :: input_co2_mmr=.false. !Socrates wants input concentrations as mmr not vmr, so need to make sure input data supplied is converted if necessary
logical :: use_pressure_interp_for_half_levels = .False. !By default (.False.) does linear interpolation in height for half-level temperatures. True does linear interp using pressure.
-
+
+ logical :: account_for_clouds_in_socrates = .false. !Do we want to account for the radiative effects of clouds in socrates?
+
! Incoming radiation options for namelist
integer :: solday=0 ! if >0, do perpetual run corresponding to day of the year = solday \in [0,days per year]
@@ -126,7 +128,8 @@ module socrates_config_mod
hfc134a_mix_ratio, &
inc_h2o, inc_co2, inc_co, inc_o3, inc_n2o, inc_ch4, inc_o2, &
inc_so2, inc_cfc11, inc_cfc12, inc_cfc113, inc_hcfc22, inc_hfc134a, &
- use_pressure_interp_for_half_levels, &
- frierson_solar_rad, del_sol, del_sw
+ use_pressure_interp_for_half_levels, &
+ frierson_solar_rad, del_sol, del_sw, &
+ account_for_clouds_in_socrates
end module socrates_config_mod
diff --git a/src/atmos_param/socrates/interface/socrates_interface.F90 b/src/atmos_param/socrates/interface/socrates_interface.F90
index 1a03b44f0..a99b7a31e 100644
--- a/src/atmos_param/socrates/interface/socrates_interface.F90
+++ b/src/atmos_param/socrates/interface/socrates_interface.F90
@@ -432,6 +432,7 @@ end subroutine socrates_init
! -----------------------------------------------------------------------------
subroutine socrates_interface(Time_diag, rlat, rlon, soc_lw_mode, &
fms_temp, fms_spec_hum, fms_ozone, fms_co2, fms_t_surf, fms_p_full, fms_p_half, fms_z_full, fms_z_half, fms_albedo, fms_coszen, fms_rrsun, n_profile, n_layer, &
+ fms_cld_frac, fms_reff_rad, fms_mmr_cl_rad, &
output_heating_rate, output_flux_down, output_flux_up, output_soc_spectral_olr, output_flux_direct, t_half_level_out )
use realtype_rd
@@ -470,7 +471,7 @@ subroutine socrates_interface(Time_diag, rlat, rlon, soc_lw_mode, &
real(r_def), intent(in) :: rlat(:,:)
real(r_def), intent(in) :: fms_z_full(:,:,:), fms_z_half(:,:,:)
real(r_def), intent(in) :: fms_rrsun
-
+ real(r_def), intent(in) :: fms_cld_frac(:,:,:), fms_reff_rad(:,:,:), fms_mmr_cl_rad(:,:,:)
! Output arrays
real(r_def), intent(out) :: output_heating_rate(:,:,:)
@@ -491,7 +492,7 @@ subroutine socrates_interface(Time_diag, rlat, rlon, soc_lw_mode, &
soc_heating_rate, input_o3_mixing_ratio, &
input_co2_mixing_ratio,z_full_reshaped
real, dimension(n_profile, 0:n_layer) :: input_p_level, input_t_level, soc_flux_direct, &
- soc_flux_down, soc_flux_up, z_half_reshaped
+ soc_flux_down, soc_flux_up, z_half_reshaped, input_cld_frac, input_reff_rad, input_mmr_cl_rad
real, dimension(n_profile) :: input_t_surf, input_cos_zenith_angle, input_solar_irrad, &
input_orog_corr, input_planet_albedo
@@ -531,7 +532,11 @@ subroutine socrates_interface(Time_diag, rlat, rlon, soc_lw_mode, &
input_t = reshape(fms_temp(:,:,:),(/si*sj,sk /))
input_p = reshape(fms_p_full(:,:,:),(/si*sj,sk /))
input_p_level = reshape(fms_p_half(:,:,:),(/si*sj,sk+1 /))
-
+
+ input_cld_frac = reshape(fms_cld_frac(:,:,:),(/si*sj,sk /))
+ input_reff_rad = reshape(fms_reff_rad(:,:,:),(/si*sj,sk /))
+ input_mmr_cl_rad = reshape(fms_mmr_cl_rad(:,:,:),(/si*sj,sk/))
+
if (account_for_effect_of_water == .true.) then
input_mixing_ratio = reshape(fms_spec_hum(:,:,:) / (1. - fms_spec_hum(:,:,:)),(/si*sj,sk /)) !Mass mixing ratio = q / (1-q)
else
@@ -652,6 +657,9 @@ subroutine socrates_interface(Time_diag, rlat, rlon, soc_lw_mode, &
input_planet_albedo(idx_chunk_start:idx_chunk_end), &
input_planet_emissivity, &
input_layer_heat_capacity(idx_chunk_start:idx_chunk_end,:), &
+ input_cld_frac(idx_chunk_start:idx_chunk_end,:), &
+ input_reff_rad(idx_chunk_start:idx_chunk_end,:), &
+ input_mmr_cl_rad(idx_chunk_start:idx_chunk_end,:), &
soc_flux_direct(idx_chunk_start:idx_chunk_end,:), &
soc_flux_down(idx_chunk_start:idx_chunk_end,:), &
soc_flux_up(idx_chunk_start:idx_chunk_end,:), &
@@ -678,6 +686,9 @@ subroutine socrates_interface(Time_diag, rlat, rlon, soc_lw_mode, &
input_planet_albedo(idx_chunk_start:idx_chunk_end), &
input_planet_emissivity, &
input_layer_heat_capacity(idx_chunk_start:idx_chunk_end,:), &
+ input_cld_frac(idx_chunk_start:idx_chunk_end,:), &
+ input_reff_rad(idx_chunk_start:idx_chunk_end,:), &
+ input_mmr_cl_rad(idx_chunk_start:idx_chunk_end,:), &
soc_flux_direct(idx_chunk_start:idx_chunk_end,:), &
soc_flux_down(idx_chunk_start:idx_chunk_end,:), &
soc_flux_up(idx_chunk_start:idx_chunk_end,:), &
@@ -703,7 +714,7 @@ subroutine socrates_interface(Time_diag, rlat, rlon, soc_lw_mode, &
end subroutine socrates_interface
subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf_in, p_full_in, p_half_in, z_full_in, z_half_in, albedo_in, &
- temp_tend, net_surf_sw_down, surf_lw_down, delta_t)
+ temp_tend, net_surf_sw_down, surf_lw_down, delta_t, do_cloud_simple, cf_rad, reff_rad, qcl_rad)
use astronomy_mod, only: diurnal_solar
use constants_mod, only: pi, wtmco2, wtmozone, rdgas, gas_constant
@@ -718,12 +729,15 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
real, intent(inout), dimension(:,:,:) :: temp_tend
real, intent(out), dimension(:,:) :: net_surf_sw_down, surf_lw_down
real, intent(in) :: delta_t
+ logical, intent(in) :: do_cloud_simple
+ real, intent(in), dimension(:,:,:) :: cf_rad, reff_rad, qcl_rad
integer(i_def) :: n_profile, n_layer
real(r_def), dimension(size(temp_in,1), size(temp_in,2)) :: t_surf_for_soc, rad_lat_soc, rad_lon_soc, albedo_soc
real(r_def), dimension(size(temp_in,1), size(temp_in,2), size(temp_in,3)) :: tg_tmp_soc, q_soc, ozone_soc, co2_soc, p_full_soc, output_heating_rate_sw, output_heating_rate_lw, output_heating_rate_total, z_full_soc
- real(r_def), dimension(size(temp_in,1), size(temp_in,2), size(temp_in,3)+1) :: p_half_soc, t_half_out, z_half_soc,output_soc_flux_sw_down, output_soc_flux_sw_up, output_soc_flux_lw_down, output_soc_flux_lw_up
+ real(r_def), dimension(size(temp_in,1), size(temp_in,2), size(temp_in,3)) :: output_soc_flux_sw_down, output_soc_flux_sw_up, output_soc_flux_lw_down, output_soc_flux_lw_up, cld_frac_soc, reff_rad_soc, mmr_cl_rad_soc, qcl_rad_soc
+ real(r_def), dimension(size(temp_in,1), size(temp_in,2), size(temp_in,3)+1) :: p_half_soc, t_half_out, z_half_soc
logical :: soc_lw_mode, used
integer :: seconds, days, year_in_s
@@ -953,6 +967,33 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
endif
+ if(do_cloud_simple.and.account_for_clouds_in_socrates) then
+ cld_frac_soc = REAL(cf_rad, kind(r_def))
+ reff_rad_soc = REAL(reff_rad, kind(r_def))
+
+ qcl_rad_soc = REAL(qcl_rad, kind(r_def))
+ mmr_cl_rad_soc = qcl_rad_soc / (1.0 - qcl_rad_soc)
+
+ elseif(do_cloud_simple.and..not.account_for_clouds_in_socrates) then
+
+ call error_mesg( 'run_socrates', &
+ 'do_cloud_simple is True but account_for_clouds_in_socrates is False. Radiative effects of clouds NOT accounted for', WARNING)
+
+ cld_frac_soc = 0.
+ reff_rad_soc = 0.
+ mmr_cl_rad_soc = 0.
+
+ elseif(.not.do_cloud_simple.and.account_for_clouds_in_socrates) then
+
+ call error_mesg( 'run_socrates', &
+ 'do_cloud_simple is False but account_for_clouds_in_socrates is True. Radiative effects of clouds NOT accounted for', WARNING)
+
+ cld_frac_soc = 0.
+ reff_rad_soc = 0.
+ mmr_cl_rad_soc = 0.
+
+ endif
+
n_profile = INT(size(temp_in,2)*size(temp_in,1), kind(i_def))
n_layer = INT(size(temp_in,3), kind(i_def))
t_surf_for_soc = REAL(t_surf_in(:,:), kind(r_def))
@@ -975,7 +1016,7 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
CALL socrates_interface(Time, rad_lat_soc, rad_lon_soc, soc_lw_mode, &
tg_tmp_soc, q_soc, ozone_soc, co2_soc, t_surf_for_soc, p_full_soc, p_half_soc, z_full_soc, z_half_soc, albedo_soc, coszen, rrsun, n_profile, n_layer, &
- output_heating_rate_lw, output_soc_flux_lw_down, output_soc_flux_lw_up, output_soc_spectral_olr = outputted_soc_spectral_olr, t_half_level_out = t_half_out)
+ output_heating_rate_lw, output_soc_flux_lw_down, output_soc_flux_lw_up, cld_frac_soc, reff_rad_soc, mmr_cl_rad_soc, output_soc_spectral_olr = outputted_soc_spectral_olr, t_half_level_out = t_half_out)
tg_tmp_soc = tg_tmp_soc + output_heating_rate_lw*delta_t !Output heating rate in K/s, so is a temperature tendency
surf_lw_down(:,:) = REAL(output_soc_flux_lw_down(:,:, n_layer+1))
@@ -990,7 +1031,7 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
soc_lw_mode = .FALSE.
CALL socrates_interface(Time, rad_lat_soc, rad_lon_soc, soc_lw_mode, &
tg_tmp_soc, q_soc, ozone_soc, co2_soc, t_surf_for_soc, p_full_soc, p_half_soc, z_full_soc, z_half_soc, albedo_soc, coszen, rrsun, n_profile, n_layer, &
- output_heating_rate_sw, output_soc_flux_sw_down, output_soc_flux_sw_up)
+ output_heating_rate_sw, output_soc_flux_sw_down, output_soc_flux_sw_up, cld_frac_soc, reff_rad_soc, mmr_cl_rad_soc)
tg_tmp_soc = tg_tmp_soc + output_heating_rate_sw*delta_t !Output heating rate in K/s, so is a temperature tendency
net_surf_sw_down(:,:) = REAL(output_soc_flux_sw_down(:,:, n_layer+1)-output_soc_flux_sw_up(:,:,n_layer+1) )
diff --git a/src/atmos_param/socrates/interface/socrates_set_cld.F90 b/src/atmos_param/socrates/interface/socrates_set_cld.F90
index 25e47a340..d98b215a6 100644
--- a/src/atmos_param/socrates/interface/socrates_set_cld.F90
+++ b/src/atmos_param/socrates/interface/socrates_set_cld.F90
@@ -23,7 +23,7 @@ subroutine set_cld(cld, control, dimen, spectrum, n_profile, n_layer, &
use def_control, only: StrCtrl
use def_dimen, only: StrDim
use def_spectrum, only: StrSpecData
-use realtype_rd, only: RealK
+use soc_constants_mod, only: i_def, r_def
use rad_pcf, only: &
ip_cloud_homogen, ip_cloud_ice_water, ip_cloud_conv_strat, ip_cloud_csiw, &
ip_clcmp_st_water, ip_clcmp_st_ice, ip_clcmp_cnv_water, ip_clcmp_cnv_ice, &
@@ -32,8 +32,8 @@ subroutine set_cld(cld, control, dimen, spectrum, n_profile, n_layer, &
ip_cloud_type_strat, ip_cloud_type_conv, &
ip_cloud_type_sw, ip_cloud_type_si, ip_cloud_type_cw, ip_cloud_type_ci, &
ip_drop_unparametrized, ip_ice_unparametrized, i_normal, i_err_fatal
-use ereport_mod, only: ereport
-use errormessagelength_mod, only: errormessagelength
+
+use fms_mod, only: error_mesg, FATAL
implicit none
@@ -50,10 +50,10 @@ subroutine set_cld(cld, control, dimen, spectrum, n_profile, n_layer, &
! Spectral data:
type(StrSpecData), intent(in) :: spectrum
-integer, intent(in) :: n_profile
-integer, intent(in) :: n_layer
+integer(i_def), intent(in) :: n_profile
+integer(i_def), intent(in) :: n_layer
-real(RealK), intent(in), optional :: &
+real(r_def), intent(in), optional :: &
cloud_frac(:,:), conv_frac(:,:), &
liq_frac(:,:), ice_frac(:,:), liq_conv_frac(:,:), ice_conv_frac(:,:), &
liq_mmr(:,:), ice_mmr(:,:), liq_conv_mmr(:,:), ice_conv_mmr(:,:), &
@@ -61,7 +61,7 @@ subroutine set_cld(cld, control, dimen, spectrum, n_profile, n_layer, &
! Liquid and ice cloud fractions, gridbox mean mixing ratios, and
! effective dimensions
-real(RealK), intent(in), optional :: dp_corr_strat, dp_corr_conv
+real(r_def), intent(in), optional :: dp_corr_strat, dp_corr_conv
! Decorrelation pressure scales for cloud vertical overlap
@@ -73,16 +73,16 @@ subroutine set_cld(cld, control, dimen, spectrum, n_profile, n_layer, &
integer :: i_cloud_type(dimen%nd_cloud_component)
! Types of cloud to which each component contributes
-real(RealK) :: condensed_min_dim
-real(RealK) :: condensed_max_dim
+real(r_def) :: condensed_min_dim
+real(r_def) :: condensed_max_dim
! Minimum and maximum dimensions of each condensed component
-real(RealK) :: eps = EPSILON(1.0)
-real(RealK) :: min_cloud_fraction = 0.0001
+real(r_def) :: eps = EPSILON(1.0)
+real(r_def) :: min_cloud_fraction = 0.0001
integer :: ierr = i_normal
character (len=*), parameter :: RoutineName = 'SET_CLD'
-character (len=errormessagelength) :: cmessage
+character (len=128) :: cmessage
! Functions called
integer, external :: set_n_cloud_parameter
@@ -136,7 +136,8 @@ subroutine set_cld(cld, control, dimen, spectrum, n_profile, n_layer, &
else
cmessage = 'Cloud on, but no condensed components included.'
ierr=i_err_fatal
- CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+! CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ call error_mesg(ModuleName,cmessage, FATAL)
end if
do i=1, cld%n_condensed
@@ -161,11 +162,13 @@ subroutine set_cld(cld, control, dimen, spectrum, n_profile, n_layer, &
cld%i_condensed_param(i) = ip_drop_unparametrized
cmessage = 'Prescribed liquid cloud not yet implemented.'
ierr=i_err_fatal
- CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ ! CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ call error_mesg(ModuleName,cmessage, FATAL)
else if (i_param_type > spectrum%dim%nd_drop_type) then
cmessage = 'Liquid cloud type outside allowed range.'
ierr=i_err_fatal
- CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ ! CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ call error_mesg(ModuleName,cmessage, FATAL)
else if (spectrum%drop%l_drop_type(i_param_type)) then
! Take parametrisation from spectral file
cld%i_condensed_param(i) = spectrum%drop%i_drop_parm(i_param_type)
@@ -195,7 +198,8 @@ subroutine set_cld(cld, control, dimen, spectrum, n_profile, n_layer, &
else
cmessage = 'Liquid MMR and effective radius not provided.'
ierr=i_err_fatal
- CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ ! CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ call error_mesg(ModuleName,cmessage, FATAL)
end if
case (ip_clcmp_cnv_water)
if (present(liq_conv_mmr).and.present(liq_conv_dim)) then
@@ -209,24 +213,28 @@ subroutine set_cld(cld, control, dimen, spectrum, n_profile, n_layer, &
else
cmessage = 'Convective liquid MMR and effective radius not provided.'
ierr=i_err_fatal
- CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ ! CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ call error_mesg(ModuleName,cmessage, FATAL)
end if
end select
else
cmessage = 'Liquid cloud type not in spectral file.'
ierr=i_err_fatal
- CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ ! CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ call error_mesg(ModuleName,cmessage, FATAL)
end if
case (ip_phase_ice)
if (i_param_type <= 0) then
cld%i_condensed_param(i) = ip_ice_unparametrized
cmessage = 'Prescribed ice cloud not yet implemented.'
ierr=i_err_fatal
- CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ ! CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ call error_mesg(ModuleName,cmessage, FATAL)
else if (i_param_type > spectrum%dim%nd_ice_type) then
cmessage = 'Ice cloud type outside allowed range.'
ierr=i_err_fatal
- CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ ! CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ call error_mesg(ModuleName,cmessage, FATAL)
else if (spectrum%ice%l_ice_type(i_param_type)) then
! Take parametrisation from spectral file
cld%i_condensed_param(i) = spectrum%ice%i_ice_parm(i_param_type)
@@ -255,7 +263,8 @@ subroutine set_cld(cld, control, dimen, spectrum, n_profile, n_layer, &
else
cmessage = 'Ice MMR and effective radius not provided.'
ierr=i_err_fatal
- CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ ! CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ call error_mesg(ModuleName,cmessage, FATAL)
end if
case (ip_clcmp_cnv_ice)
if (present(ice_conv_mmr).and.present(ice_conv_dim)) then
@@ -269,13 +278,15 @@ subroutine set_cld(cld, control, dimen, spectrum, n_profile, n_layer, &
else
cmessage = 'Convective ice MMR and effective radius not provided.'
ierr=i_err_fatal
- CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ ! CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ call error_mesg(ModuleName,cmessage, FATAL)
end if
end select
else
cmessage = 'Ice cloud type not in spectral file.'
ierr=i_err_fatal
- CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ ! CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ call error_mesg(ModuleName,cmessage, FATAL)
end if
end select
end do
@@ -284,12 +295,12 @@ subroutine set_cld(cld, control, dimen, spectrum, n_profile, n_layer, &
if (present(dp_corr_strat)) then
cld%dp_corr_strat = dp_corr_strat
else
- cld%dp_corr_strat = 0.0_RealK
+ cld%dp_corr_strat = 0.0_r_def
end if
if (present(dp_corr_conv)) then
cld%dp_corr_conv = dp_corr_conv
else
- cld%dp_corr_conv = 0.0_RealK
+ cld%dp_corr_conv = 0.0_r_def
end if
@@ -313,7 +324,8 @@ subroutine set_cld(cld, control, dimen, spectrum, n_profile, n_layer, &
else
cmessage = 'Cloud fraction not provided.'
ierr=i_err_fatal
- CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ ! CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ call error_mesg(ModuleName,cmessage, FATAL)
end if
case (ip_cloud_ice_water)
cld%n_cloud_type = 2
@@ -335,8 +347,8 @@ subroutine set_cld(cld, control, dimen, spectrum, n_profile, n_layer, &
cld%frac_cloud(l, k, ip_cloud_type_ice) = &
cloud_frac(l, k)*ice_frac(l, k) / (liq_frac(l, k)+ice_frac(l, k))
else
- cld%frac_cloud(l, k, ip_cloud_type_water) = 0.0_RealK
- cld%frac_cloud(l, k, ip_cloud_type_ice) = 0.0_RealK
+ cld%frac_cloud(l, k, ip_cloud_type_water) = 0.0_r_def
+ cld%frac_cloud(l, k, ip_cloud_type_ice) = 0.0_r_def
end if
end do
end do
@@ -350,7 +362,8 @@ subroutine set_cld(cld, control, dimen, spectrum, n_profile, n_layer, &
else
cmessage = 'Liquid and ice cloud fractions not provided.'
ierr=i_err_fatal
- CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ ! CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ call error_mesg(ModuleName,cmessage, FATAL)
end if
case (ip_cloud_conv_strat)
cld%n_cloud_type = 2
@@ -376,7 +389,8 @@ subroutine set_cld(cld, control, dimen, spectrum, n_profile, n_layer, &
else
cmessage = 'Cloud fraction and convective cloud fraction not provided.'
ierr=i_err_fatal
- CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ ! CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ call error_mesg(ModuleName,cmessage, FATAL)
end if
case (ip_cloud_csiw)
cld%n_cloud_type = 4
@@ -402,8 +416,8 @@ subroutine set_cld(cld, control, dimen, spectrum, n_profile, n_layer, &
cld%frac_cloud(l, k, ip_cloud_type_si) = &
cloud_frac(l, k)*ice_frac(l, k) / (liq_frac(l, k)+ice_frac(l, k))
else
- cld%frac_cloud(l, k, ip_cloud_type_sw) = 0.0_RealK
- cld%frac_cloud(l, k, ip_cloud_type_si) = 0.0_RealK
+ cld%frac_cloud(l, k, ip_cloud_type_sw) = 0.0_r_def
+ cld%frac_cloud(l, k, ip_cloud_type_si) = 0.0_r_def
end if
end do
end do
@@ -417,7 +431,8 @@ subroutine set_cld(cld, control, dimen, spectrum, n_profile, n_layer, &
else
cmessage = 'Liquid and ice cloud fractions not provided.'
ierr=i_err_fatal
- CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ ! CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ call error_mesg(ModuleName,cmessage, FATAL)
end if
if (present(liq_conv_frac).and.present(ice_conv_frac).and. &
present(conv_frac)) then
@@ -430,8 +445,8 @@ subroutine set_cld(cld, control, dimen, spectrum, n_profile, n_layer, &
cld%frac_cloud(l, k, ip_cloud_type_ci) = conv_frac(l, k) &
*ice_conv_frac(l, k) / (liq_conv_frac(l, k)+ice_conv_frac(l, k))
else
- cld%frac_cloud(l, k, ip_cloud_type_cw) = 0.0_RealK
- cld%frac_cloud(l, k, ip_cloud_type_ci) = 0.0_RealK
+ cld%frac_cloud(l, k, ip_cloud_type_cw) = 0.0_r_def
+ cld%frac_cloud(l, k, ip_cloud_type_ci) = 0.0_r_def
end if
end do
end do
@@ -445,7 +460,8 @@ subroutine set_cld(cld, control, dimen, spectrum, n_profile, n_layer, &
else
cmessage = 'Liquid and ice convective cloud fractions not provided.'
ierr=i_err_fatal
- CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ ! CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ call error_mesg(ModuleName,cmessage, FATAL)
end if
end select
@@ -468,15 +484,16 @@ subroutine set_cld(cld, control, dimen, spectrum, n_profile, n_layer, &
cld%frac_cloud(l, k, j) = cld%frac_cloud(l, k, j) / cld%w_cloud(l, k)
end do
else
- cld%w_cloud(l, k) = 0.0_RealK
- cld%frac_cloud(l, k, 1:cld%n_cloud_type) = 0.0_RealK
+ cld%w_cloud(l, k) = 0.0_r_def
+ cld%frac_cloud(l, k, 1:cld%n_cloud_type) = 0.0_r_def
end if
- if (cld%w_cloud(l, k) > 1.0_RealK + min_cloud_fraction) then
+ if (cld%w_cloud(l, k) > 1.0_r_def + min_cloud_fraction) then
cmessage = 'Cloud fraction greater than 1.'
ierr=i_err_fatal
- CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
- else if (cld%w_cloud(l, k) > 1.0_RealK) then
- cld%w_cloud(l, k) = 1.0_RealK
+ ! CALL ereport(ModuleName//':'//RoutineName, ierr, cmessage)
+ call error_mesg(ModuleName,cmessage, FATAL)
+ else if (cld%w_cloud(l, k) > 1.0_r_def) then
+ cld%w_cloud(l, k) = 1.0_r_def
end if
end do
end do
diff --git a/src/atmos_spectral/driver/solo/idealized_moist_phys.F90 b/src/atmos_spectral/driver/solo/idealized_moist_phys.F90
index 3326065c0..b48c25ba8 100644
--- a/src/atmos_spectral/driver/solo/idealized_moist_phys.F90
+++ b/src/atmos_spectral/driver/solo/idealized_moist_phys.F90
@@ -983,6 +983,8 @@ subroutine idealized_moist_phys(Time, p_half, p_full, z_half, z_full, ug, vg, tg
endif
+! write(6,*) minval(cf_rad), maxval(cf_rad), minval(reff_rad), maxval(reff_rad), minval(qcl_rad), maxval(qcl_rad)
+
tmp1 = maxval(reff_rad)
tmp2 = maxval(cf_rad)
@@ -1125,7 +1127,8 @@ subroutine idealized_moist_phys(Time, p_half, p_full, z_half, z_full, ug, vg, tg
! Socrates interface
call run_socrates(Time, Time+Time_step, rad_lat, rad_lon, tg(:,:,:,previous), grid_tracers(:,:,:,previous,nsphum), t_surf(:,:), p_full(:,:,:,current), &
- p_half(:,:,:,current),z_full(:,:,:,current),z_half(:,:,:,current), albedo, dt_tg(:,:,:), net_surf_sw_down(:,:), surf_lw_down(:,:), delta_t)
+ p_half(:,:,:,current),z_full(:,:,:,current),z_half(:,:,:,current), albedo, dt_tg(:,:,:), net_surf_sw_down(:,:), surf_lw_down(:,:), delta_t, do_cloud_simple, cf_rad(:,:,:), reff_rad(:,:,:), &
+ qcl_rad(:,:,:) )
endif
#endif
diff --git a/src/extra/model/socrates/path_names b/src/extra/model/socrates/path_names
index 2f4dac9eb..7ec1ee810 100644
--- a/src/extra/model/socrates/path_names
+++ b/src/extra/model/socrates/path_names
@@ -583,7 +583,7 @@ atmos_param/socrates/src/trunk/src/general/calc_planck_tbl.f
atmos_param/socrates/src/trunk/src/general/read_word.f
atmos_param/socrates/interface/read_control.F90
atmos_param/socrates/interface/set_atm.F90
-atmos_param/socrates/interface/set_cld.F90
+atmos_param/socrates/interface/socrates_set_cld.F90
atmos_param/socrates/interface/set_dimen.F90
atmos_param/socrates/interface/socrates_config_mod.f90
atmos_param/socrates/interface/compress_spectrum.F90
From a90692589237f87d800b856b89555a3ad93564fd Mon Sep 17 00:00:00 2001
From: sit23
Date: Fri, 7 Sep 2018 13:02:38 +0100
Subject: [PATCH 088/304] Turned socrates clouds on for the first time, and hit
error where cloud fraction is above one. Check this with Penny.
---
.../socrates/interface/socrates_interface.F90 | 27 ++++++++++++-------
.../driver/solo/idealized_moist_phys.F90 | 2 +-
2 files changed, 19 insertions(+), 10 deletions(-)
diff --git a/src/atmos_param/socrates/interface/socrates_interface.F90 b/src/atmos_param/socrates/interface/socrates_interface.F90
index a99b7a31e..e8fd828a0 100644
--- a/src/atmos_param/socrates/interface/socrates_interface.F90
+++ b/src/atmos_param/socrates/interface/socrates_interface.F90
@@ -80,7 +80,7 @@ MODULE socrates_interface_mod
CONTAINS
- SUBROUTINE socrates_init(is, ie, js, je, num_levels, axes, Time, lat, lonb, latb, delta_t_atmos)
+ SUBROUTINE socrates_init(is, ie, js, je, num_levels, axes, Time, lat, lonb, latb, delta_t_atmos, do_cloud_simple)
!! Initialises Socrates spectra, arrays, and constants
USE astronomy_mod, only: astronomy_init
@@ -94,6 +94,7 @@ SUBROUTINE socrates_init(is, ie, js, je, num_levels, axes, Time, lat, lonb, latb
INTEGER, INTENT(in) :: is, ie, js, je, num_levels
REAL, INTENT(in) , DIMENSION(:,:) :: lat
REAL, INTENT(in) , DIMENSION(:,:) :: lonb, latb
+ LOGICAL, INTENT(IN) :: do_cloud_simple
integer :: io, stdlog_unit
integer :: res, time_step_seconds
@@ -117,6 +118,18 @@ SUBROUTINE socrates_init(is, ie, js, je, num_levels, axes, Time, lat, lonb, latb
!Initialise astronomy
call astronomy_init
+ if(do_cloud_simple.and..not.account_for_clouds_in_socrates) then
+
+ call error_mesg( 'run_socrates', &
+ 'do_cloud_simple is True but account_for_clouds_in_socrates is False. Radiative effects of clouds NOT accounted for', WARNING)
+
+ elseif(.not.do_cloud_simple.and.account_for_clouds_in_socrates) then
+
+ call error_mesg( 'run_socrates', &
+ 'do_cloud_simple is False but account_for_clouds_in_socrates is True. Radiative effects of clouds NOT accounted for', WARNING)
+
+ endif
+
!Initialise variables related to radiation timestep
call get_time(delta_t_atmos,time_step_seconds)
@@ -976,18 +989,12 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
elseif(do_cloud_simple.and..not.account_for_clouds_in_socrates) then
- call error_mesg( 'run_socrates', &
- 'do_cloud_simple is True but account_for_clouds_in_socrates is False. Radiative effects of clouds NOT accounted for', WARNING)
-
cld_frac_soc = 0.
reff_rad_soc = 0.
mmr_cl_rad_soc = 0.
elseif(.not.do_cloud_simple.and.account_for_clouds_in_socrates) then
- call error_mesg( 'run_socrates', &
- 'do_cloud_simple is False but account_for_clouds_in_socrates is True. Radiative effects of clouds NOT accounted for', WARNING)
-
cld_frac_soc = 0.
reff_rad_soc = 0.
mmr_cl_rad_soc = 0.
@@ -1016,7 +1023,8 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
CALL socrates_interface(Time, rad_lat_soc, rad_lon_soc, soc_lw_mode, &
tg_tmp_soc, q_soc, ozone_soc, co2_soc, t_surf_for_soc, p_full_soc, p_half_soc, z_full_soc, z_half_soc, albedo_soc, coszen, rrsun, n_profile, n_layer, &
- output_heating_rate_lw, output_soc_flux_lw_down, output_soc_flux_lw_up, cld_frac_soc, reff_rad_soc, mmr_cl_rad_soc, output_soc_spectral_olr = outputted_soc_spectral_olr, t_half_level_out = t_half_out)
+ cld_frac_soc, reff_rad_soc, mmr_cl_rad_soc, &
+ output_heating_rate_lw, output_soc_flux_lw_down, output_soc_flux_lw_up, output_soc_spectral_olr = outputted_soc_spectral_olr, t_half_level_out = t_half_out)
tg_tmp_soc = tg_tmp_soc + output_heating_rate_lw*delta_t !Output heating rate in K/s, so is a temperature tendency
surf_lw_down(:,:) = REAL(output_soc_flux_lw_down(:,:, n_layer+1))
@@ -1031,7 +1039,8 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
soc_lw_mode = .FALSE.
CALL socrates_interface(Time, rad_lat_soc, rad_lon_soc, soc_lw_mode, &
tg_tmp_soc, q_soc, ozone_soc, co2_soc, t_surf_for_soc, p_full_soc, p_half_soc, z_full_soc, z_half_soc, albedo_soc, coszen, rrsun, n_profile, n_layer, &
- output_heating_rate_sw, output_soc_flux_sw_down, output_soc_flux_sw_up, cld_frac_soc, reff_rad_soc, mmr_cl_rad_soc)
+ cld_frac_soc, reff_rad_soc, mmr_cl_rad_soc, &
+ output_heating_rate_sw, output_soc_flux_sw_down, output_soc_flux_sw_up)
tg_tmp_soc = tg_tmp_soc + output_heating_rate_sw*delta_t !Output heating rate in K/s, so is a temperature tendency
net_surf_sw_down(:,:) = REAL(output_soc_flux_sw_down(:,:, n_layer+1)-output_soc_flux_sw_up(:,:,n_layer+1) )
diff --git a/src/atmos_spectral/driver/solo/idealized_moist_phys.F90 b/src/atmos_spectral/driver/solo/idealized_moist_phys.F90
index b48c25ba8..c51a4032a 100644
--- a/src/atmos_spectral/driver/solo/idealized_moist_phys.F90
+++ b/src/atmos_spectral/driver/solo/idealized_moist_phys.F90
@@ -763,7 +763,7 @@ subroutine idealized_moist_phys_init(Time, Time_step_in, nhum, rad_lon_2d, rad_l
endif
#else
if (do_socrates_radiation) then
- call socrates_init(is, ie, js, je, num_levels, axes, Time, rad_lat, rad_lonb_2d, rad_latb_2d, Time_step_in)
+ call socrates_init(is, ie, js, je, num_levels, axes, Time, rad_lat, rad_lonb_2d, rad_latb_2d, Time_step_in, do_cloud_simple)
endif
#endif
From b2b83f5035154b3432b7256d45a1c0e645fa36e0 Mon Sep 17 00:00:00 2001
From: sit23
Date: Fri, 7 Sep 2018 14:35:51 +0100
Subject: [PATCH 089/304] Initialised zeros array and getting seg-faults when
ice fraction is not 1.
---
src/atmos_param/socrates/interface/socrates_calc.F90 | 6 ++++--
src/atmos_param/socrates/interface/socrates_interface.F90 | 2 +-
src/atmos_param/socrates/interface/socrates_set_cld.F90 | 1 +
src/atmos_spectral/driver/solo/idealized_moist_phys.F90 | 6 +++++-
4 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/src/atmos_param/socrates/interface/socrates_calc.F90 b/src/atmos_param/socrates/interface/socrates_calc.F90
index ab545635e..b36e0ff7e 100644
--- a/src/atmos_param/socrates/interface/socrates_calc.F90
+++ b/src/atmos_param/socrates/interface/socrates_calc.F90
@@ -161,7 +161,7 @@ subroutine socrates_calc(Time_diag,control, spectrum,
!DIAG Diagnostic
logical :: used
-real(r_def) :: zeros_cld(n_profile, n_layer)
+real(r_def) :: zeros_cld(n_profile, n_layer), ten_microns_cld(n_profile, n_layer)
call set_control(control)
@@ -178,9 +178,11 @@ subroutine socrates_calc(Time_diag,control, spectrum,
! call set_cld(control, dimen, spectrum, cld, n_profile)
+ zeros_cld = 0.
+ ten_microns_cld = 1.
call set_cld(cld, control, dimen, spectrum, n_profile, n_layer, &
liq_frac = cld_frac, &
- ice_frac = zeros_cld, &
+ ice_frac = ten_microns_cld, &
liq_mmr = mmr_cl_rad, &
ice_mmr = zeros_cld, &
liq_dim = reff_rad, &
diff --git a/src/atmos_param/socrates/interface/socrates_interface.F90 b/src/atmos_param/socrates/interface/socrates_interface.F90
index e8fd828a0..70c41ad68 100644
--- a/src/atmos_param/socrates/interface/socrates_interface.F90
+++ b/src/atmos_param/socrates/interface/socrates_interface.F90
@@ -985,7 +985,7 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
reff_rad_soc = REAL(reff_rad, kind(r_def))
qcl_rad_soc = REAL(qcl_rad, kind(r_def))
- mmr_cl_rad_soc = qcl_rad_soc / (1.0 - qcl_rad_soc)
+ mmr_cl_rad_soc = qcl_rad_soc / (1.0 - qcl_rad_soc) !check if qcl is indeed specific humidity and not mmr
elseif(do_cloud_simple.and..not.account_for_clouds_in_socrates) then
diff --git a/src/atmos_param/socrates/interface/socrates_set_cld.F90 b/src/atmos_param/socrates/interface/socrates_set_cld.F90
index d98b215a6..99fd4a30e 100644
--- a/src/atmos_param/socrates/interface/socrates_set_cld.F90
+++ b/src/atmos_param/socrates/interface/socrates_set_cld.F90
@@ -482,6 +482,7 @@ subroutine set_cld(cld, control, dimen, spectrum, n_profile, n_layer, &
if (cld%w_cloud(l, k) > min_cloud_fraction) then
do j=1, cld%n_cloud_type
cld%frac_cloud(l, k, j) = cld%frac_cloud(l, k, j) / cld%w_cloud(l, k)
+ ! write(6,*) cld%frac_cloud(l, k, j) / cld%w_cloud(l, k), cld%frac_cloud(l, k, j) , cld%w_cloud(l, k), 'div?', cld%n_cloud_type
end do
else
cld%w_cloud(l, k) = 0.0_r_def
diff --git a/src/atmos_spectral/driver/solo/idealized_moist_phys.F90 b/src/atmos_spectral/driver/solo/idealized_moist_phys.F90
index c51a4032a..267311e16 100644
--- a/src/atmos_spectral/driver/solo/idealized_moist_phys.F90
+++ b/src/atmos_spectral/driver/solo/idealized_moist_phys.F90
@@ -1125,7 +1125,11 @@ subroutine idealized_moist_phys(Time, p_half, p_full, z_half, z_full, ug, vg, tg
#else
if (do_socrates_radiation) then
! Socrates interface
-
+
+ if(do_cloud_simple) then
+ reff_rad = 1.e-6 * reff_rad ! Simple cloud scheme outputs radii in microns. Socrates expects it in metres.
+ endif
+
call run_socrates(Time, Time+Time_step, rad_lat, rad_lon, tg(:,:,:,previous), grid_tracers(:,:,:,previous,nsphum), t_surf(:,:), p_full(:,:,:,current), &
p_half(:,:,:,current),z_full(:,:,:,current),z_half(:,:,:,current), albedo, dt_tg(:,:,:), net_surf_sw_down(:,:), surf_lw_down(:,:), delta_t, do_cloud_simple, cf_rad(:,:,:), reff_rad(:,:,:), &
qcl_rad(:,:,:) )
From f41093e91f0c4195355995962ece7f746f736302 Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Wed, 12 Sep 2018 11:15:32 +0100
Subject: [PATCH 090/304] Update debugging flag to get socrities to compile
---
src/extra/python/isca/templates/mkmf.template.debug | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/extra/python/isca/templates/mkmf.template.debug b/src/extra/python/isca/templates/mkmf.template.debug
index 15afb1696..45d7e20a3 100644
--- a/src/extra/python/isca/templates/mkmf.template.debug
+++ b/src/extra/python/isca/templates/mkmf.template.debug
@@ -19,7 +19,7 @@ NETCDF_LIBS = `nc-config --libs`
# This suppresses the warning: `warning #6843: A dummy argument with an explicit INTENT(OUT) declaration is not given an explicit value.` of which
# there are a lot of instances in the GFDL codebase.
FFLAGS_DEBUG = -check -check noarg_temp_created -check nopointer -warn -warn noerrors -debug variable_locations -inline_debug_info -fpe0 -traceback -ftrapuv
-FFLAGS = $(CPPFLAGS) -fpp -stack_temps -safe-cray-ptr -ftz -i_dynamic -assume byterecl -g -i4 -r8 -diag-disable 6843 -fpic $(FFLAGS_DEBUG)
+FFLAGS = $(CPPFLAGS) -fpp -stack_temps -safe-cray-ptr -ftz -i_dynamic -assume byterecl -g -i4 -r8 -diag-disable 6843 -mcmodel large $(FFLAGS_DEBUG)
FC = $(F90)
LD = $(F90) $(NETCDF_LIBS)
#CC = mpicc
From 2ed426789f3a5f924f95b53f06523a0b2fb3215d Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Wed, 12 Sep 2018 11:16:31 +0100
Subject: [PATCH 091/304] Minor changes to soc test case for debugging.
---
exp/test_cases/socrates_test/socrates_aquaplanet.py | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/exp/test_cases/socrates_test/socrates_aquaplanet.py b/exp/test_cases/socrates_test/socrates_aquaplanet.py
index 41b77bc33..40afa259d 100644
--- a/exp/test_cases/socrates_test/socrates_aquaplanet.py
+++ b/exp/test_cases/socrates_test/socrates_aquaplanet.py
@@ -95,6 +95,7 @@
'use_pressure_interp_for_half_levels':False,
'tidally_locked':False,
#'solday': 90
+ 'account_for_clouds_in_socrates': True,
},
'idealized_moist_phys_nml': {
'do_damping': True,
@@ -165,8 +166,9 @@
},
'sat_vapor_pres_nml': {
- 'do_simple':True
- },
+ 'do_simple':True,
+ 'construct_table_wrt_liq_and_ice':True
+ },
'damping_driver_nml': {
'do_rayleigh': True,
@@ -213,4 +215,4 @@
#This will be the name of the folder that the data will appear in.
exp.run(1, use_restart=False, num_cores=NCORES, overwrite_data=False)
for i in range(2,121):
- exp.run(i, num_cores=NCORES)
+ exp.run(i, num_cores=NCORES)
\ No newline at end of file
From 71f92afdc9a3a5faad17494a199bd066830f5a1a Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Wed, 12 Sep 2018 16:42:36 +0100
Subject: [PATCH 092/304] Remove debug and account for clouds flag
---
exp/test_cases/socrates_test/socrates_aquaplanet.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/exp/test_cases/socrates_test/socrates_aquaplanet.py b/exp/test_cases/socrates_test/socrates_aquaplanet.py
index 40afa259d..daee3879d 100644
--- a/exp/test_cases/socrates_test/socrates_aquaplanet.py
+++ b/exp/test_cases/socrates_test/socrates_aquaplanet.py
@@ -109,7 +109,7 @@
'two_stream_gray': False, #Use the grey radiation scheme
'do_socrates_radiation': True,
'convection_scheme': 'SIMPLE_BETTS_MILLER', #Use simple Betts miller convection
- 'do_cloud_simple': True,
+ 'do_cloud_simple': True
},
'cloud_simple_nml': {
From 18b5a70b4275bb0b882496b2fc15df45e5750d32 Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Wed, 12 Sep 2018 16:43:53 +0100
Subject: [PATCH 093/304] Socrates is not working properly with idb. Break
points not behaving logically. Cant confirm the compile is working properly
---
src/extra/python/isca/templates/mkmf.template.debug | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/extra/python/isca/templates/mkmf.template.debug b/src/extra/python/isca/templates/mkmf.template.debug
index 45d7e20a3..15afb1696 100644
--- a/src/extra/python/isca/templates/mkmf.template.debug
+++ b/src/extra/python/isca/templates/mkmf.template.debug
@@ -19,7 +19,7 @@ NETCDF_LIBS = `nc-config --libs`
# This suppresses the warning: `warning #6843: A dummy argument with an explicit INTENT(OUT) declaration is not given an explicit value.` of which
# there are a lot of instances in the GFDL codebase.
FFLAGS_DEBUG = -check -check noarg_temp_created -check nopointer -warn -warn noerrors -debug variable_locations -inline_debug_info -fpe0 -traceback -ftrapuv
-FFLAGS = $(CPPFLAGS) -fpp -stack_temps -safe-cray-ptr -ftz -i_dynamic -assume byterecl -g -i4 -r8 -diag-disable 6843 -mcmodel large $(FFLAGS_DEBUG)
+FFLAGS = $(CPPFLAGS) -fpp -stack_temps -safe-cray-ptr -ftz -i_dynamic -assume byterecl -g -i4 -r8 -diag-disable 6843 -fpic $(FFLAGS_DEBUG)
FC = $(F90)
LD = $(F90) $(NETCDF_LIBS)
#CC = mpicc
From eee4dff96bf3edb64dd4e10b7846730addff1c19 Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Wed, 12 Sep 2018 16:44:27 +0100
Subject: [PATCH 094/304] Removed additional unused files in order to get code
to compile for using simple clouds and soc
---
src/extra/model/socrates/path_names | 91 -----------------------------
1 file changed, 91 deletions(-)
diff --git a/src/extra/model/socrates/path_names b/src/extra/model/socrates/path_names
index 7ec1ee810..1a143cb31 100644
--- a/src/extra/model/socrates/path_names
+++ b/src/extra/model/socrates/path_names
@@ -329,89 +329,6 @@ atmos_param/socrates/src/trunk/src/radiance_core/monochromatic_radiance.F90
atmos_param/socrates/src/trunk/src/radiance_core/aggregate_cloud.F90
atmos_param/socrates/src/trunk/src/radiance_core/radiance_calc.F90
atmos_param/socrates/src/trunk/src/radiance_core/ir_source.F90
-atmos_param/socrates/src/trunk/src/scatter/conjugate_gradient_cloud_90.f90
-atmos_param/socrates/src/trunk/src/scatter/method_weight_pcf.f90
-atmos_param/socrates/src/trunk/src/scatter/select_weight_scatter_90.f90
-atmos_param/socrates/src/trunk/src/scatter/measure_particle_pcf.f90
-atmos_param/socrates/src/trunk/src/scatter/prec_integral_tcf.f90
-atmos_param/socrates/src/trunk/src/scatter/def_s_scat_prop.f90
-atmos_param/socrates/src/trunk/src/scatter/db_scatter_integral.f90
-atmos_param/socrates/src/trunk/src/scatter/weightings_90.f90
-atmos_param/socrates/src/trunk/src/scatter/def_db_ss_mono.f90
-atmos_param/socrates/src/trunk/src/scatter/cloud_fitting.f90
-atmos_param/socrates/src/trunk/src/scatter/shape_particle_pcf.f90
-atmos_param/socrates/src/trunk/src/scatter/number_particle_90.f90
-atmos_param/socrates/src/trunk/src/scatter/db_interp_ss_mono.f90
-atmos_param/socrates/src/trunk/src/scatter/db_read_single_wavelength.f90
-atmos_param/socrates/src/trunk/src/scatter/get_refract_index.f90
-atmos_param/socrates/src/trunk/src/scatter/read_scatter_block_90.f90
-atmos_param/socrates/src/trunk/src/scatter/proj_area_particle.f90
-atmos_param/socrates/src/trunk/src/scatter/line_search_cloud_90.f90
-atmos_param/socrates/src/trunk/src/scatter/volume_particle.f90
-atmos_param/socrates/src/trunk/src/scatter/distribution_pcf.f90
-atmos_param/socrates/src/trunk/src/scatter/size_integral_90.f90
-atmos_param/socrates/src/trunk/src/scatter/particle_size_90.f90
-atmos_param/socrates/src/trunk/src/scatter/max_size_acf.f90
-atmos_param/socrates/src/trunk/src/scatter/write_average_90.f90
-atmos_param/socrates/src/trunk/src/scatter/adt_mitchell96.f90
-atmos_param/socrates/src/trunk/src/scatter/get_db_wavelengths.f90
-atmos_param/socrates/src/trunk/src/scatter/decompose_phf_90.f90
-atmos_param/socrates/src/trunk/src/scatter/cloud_fit_parm_acf.f90
-atmos_param/socrates/src/trunk/src/scatter/cloud_fit_90.f90
-atmos_param/socrates/src/trunk/src/scatter/ice_db_read_geometry.f90
-atmos_param/socrates/src/trunk/src/scatter/def_sct_db.f90
-atmos_param/socrates/src/trunk/src/scatter/open_average_90.f90
-atmos_param/socrates/src/trunk/src/scatter/def_size_dist.f90
-atmos_param/socrates/src/trunk/src/scatter/parm_integ_acf.f90
-atmos_param/socrates/src/trunk/src/scatter/bna_factor_ccf.f90
-atmos_param/socrates/src/trunk/src/scatter/def_db_crystal_geometry.f90
-atmos_param/socrates/src/trunk/src/scatter/get_wavelengths.f90
-atmos_param/socrates/src/trunk/src/scatter/weightings_single_90.f90
-atmos_param/socrates/src/trunk/src/scatter/scatter_algorithm_pcf.f90
-atmos_param/socrates/src/trunk/src/scatter/db_type_ucf.f90
-atmos_param/socrates/src/trunk/src/scatter/scatter_integral_90.f90
-atmos_param/socrates/src/trunk/src/correlated_k/voigt_profile.f90
-atmos_param/socrates/src/trunk/src/correlated_k/adjust_path.f90
-atmos_param/socrates/src/trunk/src/correlated_k/func_scale_90.f90
-atmos_param/socrates/src/trunk/src/correlated_k/read_pt_line_90.f90
-atmos_param/socrates/src/trunk/src/correlated_k/set_condition_ck_90.f90
-atmos_param/socrates/src/trunk/src/correlated_k/caviar_continuum_v1_0.f90
-atmos_param/socrates/src/trunk/src/correlated_k/rad_weight_90.f90
-atmos_param/socrates/src/trunk/src/correlated_k/select_weight_ck_90.f90
-atmos_param/socrates/src/trunk/src/correlated_k/trans_k_dist.f90
-atmos_param/socrates/src/trunk/src/correlated_k/type_residual_pcf.f90
-atmos_param/socrates/src/trunk/src/correlated_k/map_shell.f90
-atmos_param/socrates/src/trunk/src/correlated_k/terminate_scale_90.f90
-atmos_param/socrates/src/trunk/src/correlated_k/ckd_continuum_v2_4.f90
-atmos_param/socrates/src/trunk/src/correlated_k/write_fit_90.f90
-atmos_param/socrates/src/trunk/src/correlated_k/ck_parm_acf.f90
-atmos_param/socrates/src/trunk/src/correlated_k/fit_parabola_90.f90
-atmos_param/socrates/src/trunk/src/correlated_k/func_scale_derivative_90.f90
-atmos_param/socrates/src/trunk/src/correlated_k/optimal_k.f90
-atmos_param/socrates/src/trunk/src/correlated_k/open_file_out_90.f90
-atmos_param/socrates/src/trunk/src/correlated_k/residual_gradient_90.f90
-atmos_param/socrates/src/trunk/src/correlated_k/scale_ck_fit_90.f90
-atmos_param/socrates/src/trunk/src/correlated_k/read_ref_pt_90.f90
-atmos_param/socrates/src/trunk/src/correlated_k/corr_k_single.f90
-atmos_param/socrates/src/trunk/src/correlated_k/planck_90.f90
-atmos_param/socrates/src/trunk/src/correlated_k/exponent_fit_90.f90
-atmos_param/socrates/src/trunk/src/correlated_k/conjugate_gradient_90.f90
-atmos_param/socrates/src/trunk/src/correlated_k/line_prof_corr_mod.f90
-atmos_param/socrates/src/trunk/src/correlated_k/set_extern_ckd_frn_data.f90
-atmos_param/socrates/src/trunk/src/correlated_k/set_g_point_90.f90
-atmos_param/socrates/src/trunk/src/correlated_k/bi_interp.f90
-atmos_param/socrates/src/trunk/src/correlated_k/residual_trans_90.f90
-atmos_param/socrates/src/trunk/src/correlated_k/set_extern_ckd_self_data.f90
-atmos_param/socrates/src/trunk/src/correlated_k/line_search_90.f90
-atmos_param/socrates/src/trunk/src/correlated_k/read_hitran.f90
-atmos_param/socrates/src/trunk/src/correlated_k/read_nc.f90
-atmos_param/socrates/src/trunk/src/correlated_k/ckd_extern_data.f90
-atmos_param/socrates/src/trunk/src/correlated_k/def_hitran_record.f90
-atmos_param/socrates/src/trunk/src/correlated_k/d_planck_90.f90
-atmos_param/socrates/src/trunk/src/correlated_k/scale_parameters_acf.f90
-atmos_param/socrates/src/trunk/src/correlated_k/offset_residual_trans_acf.f90
-atmos_param/socrates/src/trunk/src/correlated_k/hitran_cnst.f90
-atmos_param/socrates/src/trunk/src/correlated_k/ck_fit_pcf.f90
atmos_param/socrates/src/trunk/src/aux/qsat_wat.F90
atmos_param/socrates/src/trunk/src/aux/qsat_gill.F90
atmos_param/socrates/src/trunk/src/aux/write_cdf.f90
@@ -434,7 +351,6 @@ atmos_param/socrates/src/trunk/src/general/make_block_18.f90
atmos_param/socrates/src/trunk/src/general/remove_negative_gas_90.f90
atmos_param/socrates/src/trunk/src/general/make_block_17.f90
atmos_param/socrates/src/trunk/src/general/make_block_1.f90
-atmos_param/socrates/src/trunk/src/general/solar_intensity_90.f90
atmos_param/socrates/src/trunk/src/general/make_block_19.f90
atmos_param/socrates/src/trunk/src/general/make_block_0.f90
atmos_param/socrates/src/trunk/src/general/make_block_10.f90
@@ -484,8 +400,6 @@ atmos_param/socrates/src/trunk/src/radiation_control/set_moist_aerosol_propertie
atmos_param/socrates/src/trunk/src/radiation_control/mcica_mod.F90
atmos_param/socrates/src/trunk/src/radiation_control/cld_generator_mod.F90
atmos_param/socrates/src/trunk/src/radiation_control/open_cloud_gen.F90
-atmos_param/socrates/src/trunk/src/um/out_nml.f90
-atmos_param/socrates/src/trunk/src/um/def_um_nml.f90
atmos_param/socrates/src/trunk/src/modules_core/errormessagelength_mod.F90
atmos_param/socrates/src/trunk/src/modules_core/dimensions_spec_ucf.F90
atmos_param/socrates/src/trunk/src/modules_core/rad_ccf.F90
@@ -497,11 +411,6 @@ atmos_param/socrates/src/trunk/src/modules_core/vectlib_mod.F90
atmos_param/socrates/src/trunk/src/modules_core/ereport_mod.F90
atmos_param/socrates/src/trunk/src/modules_core/realtype_rd.f90
atmos_param/socrates/src/trunk/src/modules_core/filenamelength_mod.F90
-atmos_param/socrates/src/trunk/src/scatter/grow_particles.f
-atmos_param/socrates/src/trunk/src/scatter/mie_scatter.f
-atmos_param/socrates/src/trunk/src/scatter/adt_integral.f
-atmos_param/socrates/src/trunk/src/scatter/gamma_fnc.f
-atmos_param/socrates/src/trunk/src/scatter/refractive_index.f
atmos_param/socrates/src/trunk/src/aux/output_vert_cdl.f
atmos_param/socrates/src/trunk/src/aux/assign_input_opt_cdf.f
atmos_param/socrates/src/trunk/src/aux/assign_input_ss_cdl.f
From 9c57555cbf4d5fd2d163cd9725b591de94bfabd4 Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Wed, 12 Sep 2018 16:44:51 +0100
Subject: [PATCH 095/304] Initialise variables and cleaning debug statements
---
.../driver/solo/idealized_moist_phys.F90 | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/atmos_spectral/driver/solo/idealized_moist_phys.F90 b/src/atmos_spectral/driver/solo/idealized_moist_phys.F90
index 267311e16..7e87562a6 100644
--- a/src/atmos_spectral/driver/solo/idealized_moist_phys.F90
+++ b/src/atmos_spectral/driver/solo/idealized_moist_phys.F90
@@ -809,7 +809,6 @@ subroutine idealized_moist_phys(Time, p_half, p_full, z_half, z_full, ug, vg, tg
real, dimension(1,1,1):: tracer, tracertnd
integer :: nql, nqi, nqa ! tracer indices for stratiform clouds
-real :: tmp1, tmp2 !remove tmp1 and tmp2 after debugging
if(current == previous) then
delta_t = dt_real
@@ -970,6 +969,12 @@ subroutine idealized_moist_phys(Time, p_half, p_full, z_half, z_full, ug, vg, tg
! Call the simple cloud scheme in line with SPOOKIE-2 requirements
! Using start of time step variables
! using soecific humidity NOT mixing ratios
+
+ !Set to zero regarles of if clouds are used in radiation code
+ cf_rad = 0.
+ reff_rad = 0.
+ qcl_rad = 0.
+
if(do_cloud_simple) then
call cloud_simple(p_half(:,:,:,current), p_full(:,:,:,current), &
@@ -983,11 +988,6 @@ subroutine idealized_moist_phys(Time, p_half, p_full, z_half, z_full, ug, vg, tg
endif
-! write(6,*) minval(cf_rad), maxval(cf_rad), minval(reff_rad), maxval(reff_rad), minval(qcl_rad), maxval(qcl_rad)
-
-tmp1 = maxval(reff_rad)
-tmp2 = maxval(cf_rad)
-
! Begin the radiation calculation by computing downward fluxes.
! This part of the calculation does not depend on the surface temperature.
From e897a836c47f66f306ca5b8cb8a67b611ea27f7d Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Wed, 12 Sep 2018 16:45:15 +0100
Subject: [PATCH 096/304] Remove account for cloud flag from namelist
---
src/atmos_param/socrates/interface/read_control.F90 | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/src/atmos_param/socrates/interface/read_control.F90 b/src/atmos_param/socrates/interface/read_control.F90
index 92d5eeefb..755a10357 100644
--- a/src/atmos_param/socrates/interface/read_control.F90
+++ b/src/atmos_param/socrates/interface/read_control.F90
@@ -9,13 +9,15 @@ MODULE read_control_mod
! Subroutine to set input algorithmic options for the core radiation code
!------------------------------------------------------------------------------
-SUBROUTINE read_control(control, spectrum)
+SUBROUTINE read_control(control, spectrum, do_cloud_simple)
USE rad_pcf
USE def_control, ONLY: StrCtrl, allocate_control
USE def_spectrum, ONLY: StrSpecData
-USE socrates_config_mod, ONLY: l_planet_grey_surface, inc_h2o, inc_co2, inc_co, inc_o3, inc_n2o, inc_ch4, inc_o2, inc_so2, inc_cfc11, inc_cfc12, inc_cfc113, inc_hcfc22, inc_hfc134a, account_for_clouds_in_socrates
+USE socrates_config_mod, ONLY: l_planet_grey_surface, inc_h2o, inc_co2, inc_co, &
+ inc_o3, inc_n2o, inc_ch4, inc_o2, inc_so2, inc_cfc11, &
+ inc_cfc12, inc_cfc113, inc_hcfc22, inc_hfc134a
IMPLICIT NONE
@@ -26,6 +28,10 @@ SUBROUTINE read_control(control, spectrum)
! Spectral data:
TYPE (StrSpecData), INTENT(IN) :: spectrum
+LOGICAL, INTENT(IN), OPTIONAL :: do_cloud_simple
+
+
+
! Local variables.
INTEGER :: i
! Loop variable
@@ -93,7 +99,7 @@ SUBROUTINE read_control(control, spectrum)
control%i_gas_overlap = ip_overlap_k_eqv_scl
! Properties of clouds
-if (account_for_clouds_in_socrates) then
+if (do_cloud_simple) then
control%i_cloud_representation = ip_cloud_ice_water
else
control%i_cloud_representation = ip_cloud_off
From db746214e26283c283e0e7f42274a5a95b00d0cc Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Wed, 12 Sep 2018 16:45:47 +0100
Subject: [PATCH 097/304] Was using 1 micron as a work around for debugging.
Should be zero
---
src/atmos_param/socrates/interface/socrates_calc.F90 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/atmos_param/socrates/interface/socrates_calc.F90 b/src/atmos_param/socrates/interface/socrates_calc.F90
index b36e0ff7e..0fd98b578 100644
--- a/src/atmos_param/socrates/interface/socrates_calc.F90
+++ b/src/atmos_param/socrates/interface/socrates_calc.F90
@@ -182,7 +182,7 @@ subroutine socrates_calc(Time_diag,control, spectrum,
ten_microns_cld = 1.
call set_cld(cld, control, dimen, spectrum, n_profile, n_layer, &
liq_frac = cld_frac, &
- ice_frac = ten_microns_cld, &
+ ice_frac = zeros_cld, &
liq_mmr = mmr_cl_rad, &
ice_mmr = zeros_cld, &
liq_dim = reff_rad, &
From ac3ad25b3aac6927ea0b1a5faf002b5d28505882 Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Wed, 12 Sep 2018 16:47:19 +0100
Subject: [PATCH 098/304] File cleaning. Changes to fix seg fault which
originated due to flipped pressure levels. Removed account for clouds.
---
.../interface/socrates_config_mod.f90 | 3 -
.../socrates/interface/socrates_interface.F90 | 95 ++++++++++---------
2 files changed, 49 insertions(+), 49 deletions(-)
diff --git a/src/atmos_param/socrates/interface/socrates_config_mod.f90 b/src/atmos_param/socrates/interface/socrates_config_mod.f90
index c97018716..90a712da8 100644
--- a/src/atmos_param/socrates/interface/socrates_config_mod.f90
+++ b/src/atmos_param/socrates/interface/socrates_config_mod.f90
@@ -42,8 +42,6 @@ module socrates_config_mod
logical :: use_pressure_interp_for_half_levels = .False. !By default (.False.) does linear interpolation in height for half-level temperatures. True does linear interp using pressure.
- logical :: account_for_clouds_in_socrates = .false. !Do we want to account for the radiative effects of clouds in socrates?
-
! Incoming radiation options for namelist
integer :: solday=0 ! if >0, do perpetual run corresponding to day of the year = solday \in [0,days per year]
@@ -131,5 +129,4 @@ module socrates_config_mod
use_pressure_interp_for_half_levels, &
frierson_solar_rad, del_sol, del_sw, &
account_for_clouds_in_socrates
-
end module socrates_config_mod
diff --git a/src/atmos_param/socrates/interface/socrates_interface.F90 b/src/atmos_param/socrates/interface/socrates_interface.F90
index 70c41ad68..daf6f2cf0 100644
--- a/src/atmos_param/socrates/interface/socrates_interface.F90
+++ b/src/atmos_param/socrates/interface/socrates_interface.F90
@@ -118,18 +118,6 @@ SUBROUTINE socrates_init(is, ie, js, je, num_levels, axes, Time, lat, lonb, latb
!Initialise astronomy
call astronomy_init
- if(do_cloud_simple.and..not.account_for_clouds_in_socrates) then
-
- call error_mesg( 'run_socrates', &
- 'do_cloud_simple is True but account_for_clouds_in_socrates is False. Radiative effects of clouds NOT accounted for', WARNING)
-
- elseif(.not.do_cloud_simple.and.account_for_clouds_in_socrates) then
-
- call error_mesg( 'run_socrates', &
- 'do_cloud_simple is False but account_for_clouds_in_socrates is True. Radiative effects of clouds NOT accounted for', WARNING)
-
- endif
-
!Initialise variables related to radiation timestep
call get_time(delta_t_atmos,time_step_seconds)
@@ -210,10 +198,10 @@ SUBROUTINE socrates_init(is, ie, js, je, num_levels, axes, Time, lat, lonb, latb
CALL read_spectrum(control_sw_hires%spectral_file,spectrum_sw_hires)
! Set Socrates configuration
- CALL read_control(control_lw,spectrum_lw)
- CALL read_control(control_lw_hires,spectrum_lw_hires)
- CALL read_control(control_sw,spectrum_sw)
- CALL read_control(control_sw_hires,spectrum_sw_hires)
+ CALL read_control(control_lw,spectrum_lw, do_cloud_simple)
+ CALL read_control(control_lw_hires,spectrum_lw_hires, do_cloud_simple)
+ CALL read_control(control_sw,spectrum_sw, do_cloud_simple)
+ CALL read_control(control_sw_hires,spectrum_sw_hires, do_cloud_simple)
! Specify LW and SW setups
control_sw%isolir=1
@@ -444,9 +432,15 @@ end subroutine socrates_init
! Set up the call to the Socrates radiation scheme
! -----------------------------------------------------------------------------
subroutine socrates_interface(Time_diag, rlat, rlon, soc_lw_mode, &
- fms_temp, fms_spec_hum, fms_ozone, fms_co2, fms_t_surf, fms_p_full, fms_p_half, fms_z_full, fms_z_half, fms_albedo, fms_coszen, fms_rrsun, n_profile, n_layer, &
- fms_cld_frac, fms_reff_rad, fms_mmr_cl_rad, &
- output_heating_rate, output_flux_down, output_flux_up, output_soc_spectral_olr, output_flux_direct, t_half_level_out )
+ fms_temp, fms_spec_hum, fms_ozone, fms_co2, fms_t_surf, &
+ fms_p_full, fms_p_half, fms_z_full, fms_z_half, fms_albedo, &
+ fms_coszen, fms_rrsun, n_profile, n_layer, &
+ fms_cld_frac, fms_reff_rad, fms_mmr_cl_rad, &
+ output_heating_rate, output_flux_down, output_flux_up, &
+ do_cloud_simple, &
+ !optionals
+ output_soc_spectral_olr, output_flux_direct, &
+ t_half_level_out )
use realtype_rd
use read_control_mod
@@ -486,10 +480,14 @@ subroutine socrates_interface(Time_diag, rlat, rlon, soc_lw_mode, &
real(r_def), intent(in) :: fms_rrsun
real(r_def), intent(in) :: fms_cld_frac(:,:,:), fms_reff_rad(:,:,:), fms_mmr_cl_rad(:,:,:)
+ logical, intent(in) :: do_cloud_simple
+
! Output arrays
real(r_def), intent(out) :: output_heating_rate(:,:,:)
real(r_def), intent(out) :: output_flux_up(:,:,:)
real(r_def), intent(out) :: output_flux_down(:,:,:)
+
+
real(r_def), intent(out), optional :: output_flux_direct(:,:,:)
real(r_def), intent(out), optional :: output_soc_spectral_olr(:,:,:)
real(r_def), intent(out), optional :: t_half_level_out(size(fms_temp,1),size(fms_temp,2),size(fms_temp,3)+1)
@@ -500,13 +498,15 @@ subroutine socrates_interface(Time_diag, rlat, rlon, soc_lw_mode, &
REAL :: soc_spectral_olr(n_profile, size(outputted_soc_spectral_olr,3))
! Arrays to send to Socrates
- real, dimension(n_profile, n_layer) :: input_p, input_t, input_mixing_ratio, &
+ real(r_def), dimension(n_profile, n_layer) :: input_p, input_t, input_mixing_ratio, &
input_d_mass, input_density, input_layer_heat_capacity, &
soc_heating_rate, input_o3_mixing_ratio, &
- input_co2_mixing_ratio,z_full_reshaped
- real, dimension(n_profile, 0:n_layer) :: input_p_level, input_t_level, soc_flux_direct, &
- soc_flux_down, soc_flux_up, z_half_reshaped, input_cld_frac, input_reff_rad, input_mmr_cl_rad
- real, dimension(n_profile) :: input_t_surf, input_cos_zenith_angle, input_solar_irrad, &
+ input_co2_mixing_ratio,z_full_reshaped, input_cld_frac, input_reff_rad, input_mmr_cl_rad
+
+ real(r_def), dimension(n_profile, 0:n_layer) :: input_p_level, input_t_level, soc_flux_direct, &
+ soc_flux_down, soc_flux_up, z_half_reshaped
+
+ real(r_def), dimension(n_profile) :: input_t_surf, input_cos_zenith_angle, input_solar_irrad, &
input_orog_corr, input_planet_albedo
@@ -533,7 +533,7 @@ subroutine socrates_interface(Time_diag, rlat, rlon, soc_lw_mode, &
!----------------------------i
! Set array sizes
- input_n_cloud_layer = n_layer
+ input_n_cloud_layer = 1
input_n_aer_mode = n_layer
input_cld_subcol_gen = n_layer
input_cld_subcol_req = n_layer
@@ -615,7 +615,7 @@ subroutine socrates_interface(Time_diag, rlat, rlon, soc_lw_mode, &
! Test if LW or SW mode
if (soc_lw_mode == .TRUE.) then
control_lw%isolir = 2
- CALL read_control(control_lw, spectrum_lw)
+ CALL read_control(control_lw, spectrum_lw, do_cloud_simple)
if (socrates_hires_mode == .FALSE.) then
control_calc = control_lw
spectrum_calc = spectrum_lw
@@ -626,7 +626,7 @@ subroutine socrates_interface(Time_diag, rlat, rlon, soc_lw_mode, &
else
control_sw%isolir = 1
- CALL read_control(control_sw, spectrum_sw)
+ CALL read_control(control_sw, spectrum_sw, do_cloud_simple)
if(socrates_hires_mode == .FALSE.) then
control_calc = control_sw
spectrum_calc = spectrum_sw
@@ -639,7 +639,7 @@ subroutine socrates_interface(Time_diag, rlat, rlon, soc_lw_mode, &
! Do calculation
- CALL read_control(control_calc, spectrum_calc)
+ CALL read_control(control_calc, spectrum_calc, do_cloud_simple)
n_chunk_loop = (si*sj)/chunk_size
n_profile_chunk = n_profile / n_chunk_loop
@@ -980,21 +980,14 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
endif
- if(do_cloud_simple.and.account_for_clouds_in_socrates) then
+ if(do_cloud_simple) then
cld_frac_soc = REAL(cf_rad, kind(r_def))
reff_rad_soc = REAL(reff_rad, kind(r_def))
qcl_rad_soc = REAL(qcl_rad, kind(r_def))
mmr_cl_rad_soc = qcl_rad_soc / (1.0 - qcl_rad_soc) !check if qcl is indeed specific humidity and not mmr
- elseif(do_cloud_simple.and..not.account_for_clouds_in_socrates) then
-
- cld_frac_soc = 0.
- reff_rad_soc = 0.
- mmr_cl_rad_soc = 0.
-
- elseif(.not.do_cloud_simple.and.account_for_clouds_in_socrates) then
-
+ else
cld_frac_soc = 0.
reff_rad_soc = 0.
mmr_cl_rad_soc = 0.
@@ -1004,7 +997,6 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
n_profile = INT(size(temp_in,2)*size(temp_in,1), kind(i_def))
n_layer = INT(size(temp_in,3), kind(i_def))
t_surf_for_soc = REAL(t_surf_in(:,:), kind(r_def))
-
! LW calculation
! Retrieve output_heating_rate, and downward surface SW and LW fluxes
soc_lw_mode = .TRUE.
@@ -1021,10 +1013,17 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
z_full_soc = REAL(z_full_in, kind(r_def))
z_half_soc = REAL(z_half_in, kind(r_def))
- CALL socrates_interface(Time, rad_lat_soc, rad_lon_soc, soc_lw_mode, &
- tg_tmp_soc, q_soc, ozone_soc, co2_soc, t_surf_for_soc, p_full_soc, p_half_soc, z_full_soc, z_half_soc, albedo_soc, coszen, rrsun, n_profile, n_layer, &
- cld_frac_soc, reff_rad_soc, mmr_cl_rad_soc, &
- output_heating_rate_lw, output_soc_flux_lw_down, output_soc_flux_lw_up, output_soc_spectral_olr = outputted_soc_spectral_olr, t_half_level_out = t_half_out)
+
+ CALL socrates_interface(Time, rad_lat_soc, rad_lon_soc, soc_lw_mode, &
+ tg_tmp_soc, q_soc, ozone_soc, co2_soc, t_surf_for_soc, p_full_soc, &
+ p_half_soc, z_full_soc, z_half_soc, albedo_soc, coszen, rrsun, &
+ n_profile, n_layer, cld_frac_soc, reff_rad_soc, mmr_cl_rad_soc, &
+ output_heating_rate_lw, output_soc_flux_lw_down, output_soc_flux_lw_up, &
+ do_cloud_simple, &
+ !optional outs
+ output_soc_spectral_olr = outputted_soc_spectral_olr, &
+ t_half_level_out = t_half_out)
+
tg_tmp_soc = tg_tmp_soc + output_heating_rate_lw*delta_t !Output heating rate in K/s, so is a temperature tendency
surf_lw_down(:,:) = REAL(output_soc_flux_lw_down(:,:, n_layer+1))
@@ -1034,13 +1033,17 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
temp_tend(:,:,:) = temp_tend(:,:,:) + real(output_heating_rate_lw)
+
! SW calculation
! Retrieve output_heating_rate, and downward surface SW and LW fluxes
soc_lw_mode = .FALSE.
- CALL socrates_interface(Time, rad_lat_soc, rad_lon_soc, soc_lw_mode, &
- tg_tmp_soc, q_soc, ozone_soc, co2_soc, t_surf_for_soc, p_full_soc, p_half_soc, z_full_soc, z_half_soc, albedo_soc, coszen, rrsun, n_profile, n_layer, &
- cld_frac_soc, reff_rad_soc, mmr_cl_rad_soc, &
- output_heating_rate_sw, output_soc_flux_sw_down, output_soc_flux_sw_up)
+ CALL socrates_interface(Time, rad_lat_soc, rad_lon_soc, soc_lw_mode, &
+ tg_tmp_soc, q_soc, ozone_soc, co2_soc, t_surf_for_soc, p_full_soc, &
+ p_half_soc, z_full_soc, z_half_soc, albedo_soc, coszen, rrsun, &
+ n_profile, n_layer, cld_frac_soc, reff_rad_soc, mmr_cl_rad_soc, &
+ output_heating_rate_sw, output_soc_flux_sw_down, output_soc_flux_sw_up, &
+ do_cloud_simple)
+
tg_tmp_soc = tg_tmp_soc + output_heating_rate_sw*delta_t !Output heating rate in K/s, so is a temperature tendency
net_surf_sw_down(:,:) = REAL(output_soc_flux_sw_down(:,:, n_layer+1)-output_soc_flux_sw_up(:,:,n_layer+1) )
From bcfa977c327720eb05b9ee0ca002ae349eaefc77 Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Wed, 12 Sep 2018 17:56:16 +0100
Subject: [PATCH 099/304] Added a with and without cloud test case for soc
---
.../socrates_test/socrates_aquaplanet.py | 19 +-
.../socrates_aquaplanet_with_cloud.py | 209 ++++++++++++++++++
2 files changed, 216 insertions(+), 12 deletions(-)
create mode 100644 exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
diff --git a/exp/test_cases/socrates_test/socrates_aquaplanet.py b/exp/test_cases/socrates_test/socrates_aquaplanet.py
index daee3879d..98618756d 100644
--- a/exp/test_cases/socrates_test/socrates_aquaplanet.py
+++ b/exp/test_cases/socrates_test/socrates_aquaplanet.py
@@ -23,7 +23,7 @@
# create an Experiment object to handle the configuration of model parameters
# and output diagnostics
-exp = Experiment('soc_test_aquaplanet', codebase=cb)
+exp = Experiment('soc_test_aquaplanet_without_clouds', codebase=cb)
exp.clear_rundir()
inputfiles = [os.path.join(GFDL_BASE,'input/rrtm_input_files/ozone_1990.nc')]
@@ -59,6 +59,10 @@
diag.add_field('socrates', 'soc_olr', time_avg=True)
diag.add_field('socrates', 'soc_toa_sw', time_avg=True)
diag.add_field('socrates', 'soc_toa_sw_down', time_avg=True)
+diag.add_field('cloud_simple', 'cf_rad', time_avg=True)
+diag.add_field('cloud_simple', 'reff_rad', time_avg=True)
+diag.add_field('cloud_simple', 'frac_liq', time_avg=True)
+diag.add_field('cloud_simple', 'qcl_rad', time_avg=True)
# additional output options commented out
#diag.add_field('socrates', 'soc_flux_lw', time_avg=True)
@@ -95,7 +99,7 @@
'use_pressure_interp_for_half_levels':False,
'tidally_locked':False,
#'solday': 90
- 'account_for_clouds_in_socrates': True,
+ 'account_for_clouds_in_socrates': False,
},
'idealized_moist_phys_nml': {
'do_damping': True,
@@ -109,18 +113,9 @@
'two_stream_gray': False, #Use the grey radiation scheme
'do_socrates_radiation': True,
'convection_scheme': 'SIMPLE_BETTS_MILLER', #Use simple Betts miller convection
- 'do_cloud_simple': True
+ 'do_cloud_simple': False
},
- 'cloud_simple_nml': {
- 'simple_cca':0.0,
- 'rhcsfc': 0.95,
- 'rhc700': 0.7,
- 'rhc200': 0.3,
- 'rhmsfc': 0.95,
- 'rhm700': 0.7,
- 'rhm200': 0.3,
- },
'vert_turb_driver_nml': {
'do_mellor_yamada': False, # default: True
diff --git a/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
new file mode 100644
index 000000000..fa0d348fe
--- /dev/null
+++ b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
@@ -0,0 +1,209 @@
+import os
+
+import numpy as np
+
+from isca import SocratesCodeBase, DiagTable, Experiment, Namelist, GFDL_BASE
+from isca.util import exp_progress
+
+NCORES = 16
+base_dir = os.path.dirname(os.path.realpath(__file__))
+# a CodeBase can be a directory on the computer,
+# useful for iterative development
+cb = SocratesCodeBase.from_directory(GFDL_BASE)
+
+# or it can point to a specific git repo and commit id.
+# This method should ensure future, independent, reproducibility of results.
+# cb = DryCodeBase.from_repo(repo='https://github.com/isca/isca', commit='isca1.1')
+
+# compilation depends on computer specific settings. The $GFDL_ENV
+# environment variable is used to determine which `$GFDL_BASE/src/extra/env` file
+# is used to load the correct compilers. The env file is always loaded from
+# $GFDL_BASE and not the checked out git repo.
+
+# create an Experiment object to handle the configuration of model parameters
+# and output diagnostics
+
+exp = Experiment('soc_test_aquaplanet_with_clouds', codebase=cb)
+exp.clear_rundir()
+
+inputfiles = [os.path.join(GFDL_BASE,'input/rrtm_input_files/ozone_1990.nc')]
+
+#Tell model how to write diagnostics
+diag = DiagTable()
+diag.add_file('atmos_monthly', 30, 'days', time_units='days')
+
+#Tell model which diagnostics to write
+diag.add_field('dynamics', 'ps', time_avg=True)
+diag.add_field('dynamics', 'bk')
+diag.add_field('dynamics', 'pk')
+diag.add_field('atmosphere', 'precipitation', time_avg=True)
+diag.add_field('mixed_layer', 't_surf', time_avg=True)
+diag.add_field('dynamics', 'sphum', time_avg=True)
+diag.add_field('dynamics', 'ucomp', time_avg=True)
+diag.add_field('dynamics', 'vcomp', time_avg=True)
+diag.add_field('dynamics', 'temp', time_avg=True)
+diag.add_field('dynamics', 'vor', time_avg=True)
+diag.add_field('dynamics', 'div', time_avg=True)
+
+diag.add_field('socrates', 'soc_tdt_lw', time_avg=True)
+diag.add_field('socrates', 'soc_tdt_sw', time_avg=True)
+diag.add_field('socrates', 'soc_tdt_rad', time_avg=True)
+diag.add_field('socrates', 'soc_surf_flux_lw', time_avg=True)
+diag.add_field('socrates', 'soc_surf_flux_sw', time_avg=True)
+diag.add_field('socrates', 'soc_olr', time_avg=True)
+diag.add_field('socrates', 'soc_toa_sw', time_avg=True)
+diag.add_field('cloud_simple', 'cf_rad', time_avg=True)
+diag.add_field('cloud_simple', 'reff_rad', time_avg=True)
+diag.add_field('cloud_simple', 'frac_liq', time_avg=True)
+diag.add_field('cloud_simple', 'qcl_rad', time_avg=True)
+
+# additional output options commented out
+#diag.add_field('socrates', 'soc_flux_lw', time_avg=True)
+#diag.add_field('socrates', 'soc_flux_sw', time_avg=True)
+#diag.add_field('socrates', 'soc_co2', time_avg=True)
+#diag.add_field('socrates', 'soc_ozone', time_avg=True)
+#diag.add_field('socrates', 'soc_coszen', time_avg=True)
+#diag.add_field('socrates', 'soc_spectral_olr', time_avg=True)
+
+exp.diag_table = diag
+exp.inputfiles = inputfiles
+
+#Define values for the 'core' namelist
+exp.namelist = namelist = Namelist({
+ 'main_nml':{
+ 'days' : 30,
+ 'hours' : 0,
+ 'minutes': 0,
+ 'seconds': 0,
+ 'dt_atmos':600,
+ 'current_date' : [1,1,1,0,0,0],
+ 'calendar' : 'thirty_day'
+ },
+ 'socrates_rad_nml': {
+ 'stellar_constant':1370.,
+ 'lw_spectral_filename':os.path.join(GFDL_BASE,'src/atmos_param/socrates/src/trunk/data/spectra/ga7/sp_lw_ga7'),
+ 'sw_spectral_filename':os.path.join(GFDL_BASE,'src/atmos_param/socrates/src/trunk/data/spectra/ga7/sp_sw_ga7'),
+ 'do_read_ozone': True,
+ 'ozone_file_name':'ozone_1990',
+ 'ozone_field_name':'ozone_1990',
+ 'dt_rad':3600,
+ 'store_intermediate_rad':True,
+ 'chunk_size': 16,
+ 'use_pressure_interp_for_half_levels':False,
+ 'tidally_locked':False
+ },
+ 'idealized_moist_phys_nml': {
+ 'do_damping': True,
+ 'turb':True,
+ 'mixed_layer_bc':True,
+ 'do_virtual' :False,
+ 'do_simple': True,
+ 'roughness_mom':3.21e-05,
+ 'roughness_heat':3.21e-05,
+ 'roughness_moist':3.21e-05,
+ 'two_stream_gray': False, #Use the grey radiation scheme
+ 'do_socrates_radiation': True,
+ 'convection_scheme': 'SIMPLE_BETTS_MILLER', #Use simple Betts miller convection
+ 'do_cloud_simple': True
+ },
+
+ 'cloud_simple_nml': {
+ 'simple_cca':0.0,
+ 'rhcsfc': 0.95,
+ 'rhc700': 0.7,
+ 'rhc200': 0.3
+ },
+
+ 'vert_turb_driver_nml': {
+ 'do_mellor_yamada': False, # default: True
+ 'do_diffusivity': True, # default: False
+ 'do_simple': True, # default: False
+ 'constant_gust': 0.0, # default: 1.0
+ 'use_tau': False
+ },
+
+ 'diffusivity_nml': {
+ 'do_entrain':False,
+ 'do_simple': True,
+ },
+
+ 'surface_flux_nml': {
+ 'use_virtual_temp': False,
+ 'do_simple': True,
+ 'old_dtaudv': True
+ },
+
+ 'atmosphere_nml': {
+ 'idealized_moist_model': True
+ },
+
+ #Use a large mixed-layer depth, and the Albedo of the CTRL case in Jucker & Gerber, 2017
+ 'mixed_layer_nml': {
+ 'tconst' : 285.,
+ 'prescribe_initial_dist':True,
+ 'evaporation':True,
+ 'depth': 2.5, #Depth of mixed layer used
+ 'albedo_value': 0.38, #Albedo value used
+ },
+
+ 'qe_moist_convection_nml': {
+ 'rhbm':0.7,
+ 'Tmin':160.,
+ 'Tmax':350.
+ },
+
+ 'lscale_cond_nml': {
+ 'do_simple':True,
+ 'do_evap':True
+ },
+
+ 'sat_vapor_pres_nml': {
+ 'do_simple':True,
+ 'construct_table_wrt_liq_and_ice':True
+ },
+
+ 'damping_driver_nml': {
+ 'do_rayleigh': True,
+ 'trayfric': -0.5, # neg. value: time in *days*
+ 'sponge_pbottom': 150., #Setting the lower pressure boundary for the model sponge layer in Pa.
+ 'do_conserve_energy': True,
+ },
+
+ # FMS Framework configuration
+ 'diag_manager_nml': {
+ 'mix_snapshot_average_fields': False # time avg fields are labelled with time in middle of window
+ },
+
+ 'fms_nml': {
+ 'domains_stack_size': 600000 # default: 0
+ },
+
+ 'fms_io_nml': {
+ 'threading_write': 'single', # default: multi
+ 'fileset_write': 'single', # default: multi
+ },
+
+ 'spectral_dynamics_nml': {
+ 'damping_order': 4,
+ 'water_correction_limit': 200.e2,
+ 'reference_sea_level_press':1.0e5,
+ 'num_levels':40, #How many model pressure levels to use
+ 'valid_range_t':[100.,800.],
+ 'initial_sphum':[2.e-6],
+ 'vert_coord_option':'uneven_sigma',
+ 'surf_res':0.2, #Parameter that sets the vertical distribution of sigma levels
+ 'scale_heights' : 11.0,
+ 'exponent':7.0,
+ 'robert_coeff':0.03
+ },
+
+})
+
+#Lets do a run!
+if __name__=="__main__":
+
+ cb.compile(debug=False)
+ exp.run(1, use_restart=False, num_cores=NCORES, overwrite_data=True)#, run_idb=True)
+
+ for i in range(2,121):
+ exp.run(i, num_cores=NCORES)
From 4e6379ffa5a10a5f951c081ff22c724ed692a85a Mon Sep 17 00:00:00 2001
From: sit23
Date: Thu, 6 Dec 2018 09:44:09 +0000
Subject: [PATCH 100/304] Small changes at James Manners suggestion. Changes
results A LOT, so this needs to be checked closely.
---
exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py | 2 +-
src/atmos_param/socrates/interface/set_dimen.F90 | 3 ++-
src/atmos_param/socrates/interface/socrates_interface.F90 | 2 +-
3 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
index fa0d348fe..647ec0751 100644
--- a/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
+++ b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
@@ -23,7 +23,7 @@
# create an Experiment object to handle the configuration of model parameters
# and output diagnostics
-exp = Experiment('soc_test_aquaplanet_with_clouds', codebase=cb)
+exp = Experiment('soc_test_aquaplanet_with_clouds_post_jm_suggestions', codebase=cb)
exp.clear_rundir()
inputfiles = [os.path.join(GFDL_BASE,'input/rrtm_input_files/ozone_1990.nc')]
diff --git a/src/atmos_param/socrates/interface/set_dimen.F90 b/src/atmos_param/socrates/interface/set_dimen.F90
index 4f62eb3f9..6cf8eeac8 100644
--- a/src/atmos_param/socrates/interface/set_dimen.F90
+++ b/src/atmos_param/socrates/interface/set_dimen.F90
@@ -63,7 +63,8 @@ SUBROUTINE set_dimen(control, dimen, spectrum, n_profile, n_layer, &
dimen%id_cloud_top = dimen%nd_layer + 1 - n_cloud_layer
IF (control%l_cloud) THEN
- dimen%nd_layer_clr = dimen%id_cloud_top - 1
+ dimen%nd_layer_clr = MAX(dimen%id_cloud_top - 1, dimen%nd_layer)
+ ! MAX(dimen%id_cloud_top - 1, 1)
ELSE
dimen%nd_layer_clr = dimen%nd_layer
END IF
diff --git a/src/atmos_param/socrates/interface/socrates_interface.F90 b/src/atmos_param/socrates/interface/socrates_interface.F90
index daf6f2cf0..1dabdc602 100644
--- a/src/atmos_param/socrates/interface/socrates_interface.F90
+++ b/src/atmos_param/socrates/interface/socrates_interface.F90
@@ -533,7 +533,7 @@ subroutine socrates_interface(Time_diag, rlat, rlon, soc_lw_mode, &
!----------------------------i
! Set array sizes
- input_n_cloud_layer = 1
+ input_n_cloud_layer = n_layer
input_n_aer_mode = n_layer
input_cld_subcol_gen = n_layer
input_cld_subcol_req = n_layer
From afb2fd064dc9dc6885109d3292e8a245b6cfd31a Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Thu, 6 Dec 2018 11:22:17 +0000
Subject: [PATCH 101/304] Update suite to have more diagnostics
---
.../socrates_test/socrates_aquaplanet_with_cloud.py | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
index 647ec0751..2803f3100 100644
--- a/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
+++ b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
@@ -56,6 +56,9 @@
diag.add_field('cloud_simple', 'reff_rad', time_avg=True)
diag.add_field('cloud_simple', 'frac_liq', time_avg=True)
diag.add_field('cloud_simple', 'qcl_rad', time_avg=True)
+diag.add_field('cloud_simple', 'simple_rhcrit', time_avg=True)
+diag.add_field('cloud_simple', 'rh_in_cf', time_avg=True)
+
# additional output options commented out
#diag.add_field('socrates', 'soc_flux_lw', time_avg=True)
@@ -90,7 +93,8 @@
'store_intermediate_rad':True,
'chunk_size': 16,
'use_pressure_interp_for_half_levels':False,
- 'tidally_locked':False
+ 'tidally_locked':False,
+ 'sol_day':90
},
'idealized_moist_phys_nml': {
'do_damping': True,
From 7513cf31b28f3f31ff1b8689559286605525c765 Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Thu, 6 Dec 2018 11:23:24 +0000
Subject: [PATCH 102/304] Changes to simple clouds for more fields to be
outputted
---
src/atmos_param/cloud_simple/cloud_simple.F90 | 91 ++++++++++++-------
1 file changed, 56 insertions(+), 35 deletions(-)
diff --git a/src/atmos_param/cloud_simple/cloud_simple.F90 b/src/atmos_param/cloud_simple/cloud_simple.F90
index c35708ad3..ffcae1385 100644
--- a/src/atmos_param/cloud_simple/cloud_simple.F90
+++ b/src/atmos_param/cloud_simple/cloud_simple.F90
@@ -28,7 +28,9 @@ module cloud_simple_mod
rhmsfc, rhm700, rhm200
real :: zerodegc = 273.15
- integer :: id_cf_rad, id_reff_rad, id_frac_liq, id_qcl_rad
+ integer :: id_cf, id_reff_rad, id_frac_liq, id_qcl_rad, id_rh_in_cf, id_simple_rhcrit
+
+
character(len=14), parameter :: mod_name_cld = "cloud_simple"
contains
@@ -57,8 +59,8 @@ subroutine cloud_simple_init (axes, Time)
write(stdlog_unit, cloud_simple_nml)
!register diagnostics
- id_cf_rad = &
- register_diag_field ( mod_name_cld, 'cf_rad', axes(1:3), Time, &
+ id_cf = &
+ register_diag_field ( mod_name_cld, 'cf', axes(1:3), Time, &
'Cloud fraction for the simple cloud scheme', 'unitless: values 0-1')
id_frac_liq = &
@@ -76,30 +78,45 @@ subroutine cloud_simple_init (axes, Time)
'Specific humidity of cloud liquid', &
'kg/kg')
+
+ id_rh_in_cf = &
+ register_diag_field ( mod_name_cld, 'rh_in_cf', axes(1:3), Time, &
+ 'RH as a percent', &
+ '%')
+
+ id_simple_rhcrit = &
+ register_diag_field ( mod_name_cld, 'simple_rhcrit', axes(1:3), Time, &
+ 'RH as a percent', &
+ '%')
+
+
+
+
+
do_init = .false. !initialisation completed
end subroutine cloud_simple_init
!-----------------------------------------------
- subroutine cloud_simple (p_half, p_full, Time, &
- temp, q_hum, &
+ subroutine cloud_simple(p_half, p_full, Time, &
+ temp, q_hum, &
! outs
- cf_rad, reff_rad, qcl_rad )
+ cf, reff_rad, qcl_rad )
real , intent(in), dimension(:,:,:) :: temp, q_hum, p_full, p_half
type(time_type) , intent(in) :: Time
- real , intent(out), dimension(:,:,:) :: cf_rad, reff_rad, qcl_rad
+ real , intent(out), dimension(:,:,:) :: cf, reff_rad, qcl_rad
+
+ real, dimension(size(temp,1), size(temp, 2), size(temp, 3)) :: qs, frac_liq, rh_in_cf, simple_rhcrit
- real, dimension(size(temp,1), size(temp, 2), size(temp, 3)) :: qs, frac_liq
- real :: simple_rhcrit
integer :: i, j, k, k_surf
logical :: es_over_liq_and_ice
- real :: tmp1, tmp2 !remove tmp1 and tmp2 after debugging
+ real :: tmp1, tmp2 !remove tmp1 and tmp2 after debugging
!check initiation has been done - ie read in parameters
if (do_init) call error_mesg ('cloud_simple', &
@@ -117,20 +134,15 @@ subroutine cloud_simple (p_half, p_full, Time, &
!caluclate the frac_liq
call calc_liq_frac(temp(i,j,k), frac_liq(i,j,k))
call calc_reff(frac_liq(i,j,k), reff_rad(i,j,k))
- call calc_rhcrit(p_full(i,j,k), p_full(i,j,k_surf), simple_rhcrit)
- call calc_cf_rad(q_hum(i,j,k), qs(i,j,k), simple_rhcrit, cf_rad(i,j,k))
- call calc_qcl_rad(p_full(i,j,k), cf_rad(i,j,k), qcl_rad(i,j,k) )
+ call calc_rhcrit(p_full(i,j,k), p_full(i,j,k_surf), simple_rhcrit(i,j,k))
+ call calc_cf(q_hum(i,j,k), qs(i,j,k), simple_rhcrit(i,j,k), cf(i,j,k),rh_in_cf(i,j,k))
+ call calc_qcl_rad(p_full(i,j,k), cf(i,j,k), qcl_rad(i,j,k) )
end do
end do
end do
!save some diagnotics
- call output_cloud_diags(cf_rad, reff_rad, frac_liq, qcl_rad, Time )
-
-tmp2 = maxval(cf_rad)
-tmp1 = maxval(reff_rad)
-tmp2 = maxval(cf_rad)
-
+ call output_cloud_diags(cf, reff_rad, frac_liq, qcl_rad, rh_in_cf, simple_rhcrit, Time )
end subroutine cloud_simple
@@ -184,17 +196,18 @@ subroutine calc_rhcrit(p_full, p_surf, simple_rhcrit) !need to check p_full -
end subroutine calc_rhcrit
- subroutine calc_cf_rad (q_hum, qsat, simple_rhcrit, cf_rad)
+ subroutine calc_cf (q_hum, qsat, simple_rhcrit, cf, rh)
! Calculate LS (stratiform) cloud fraction
! as a simple linear function of RH
real, intent(in) :: q_hum, qsat, simple_rhcrit
- real, intent(out) :: cf_rad
+ real, intent(out) :: cf, rh
- real :: rh, cca
+ real :: cca
rh = q_hum/qsat
- cf_rad = MAX( 0.0, MIN( 1.0, ( rh - simple_rhcrit ) / ( 1.0 - simple_rhcrit ) ))
+ cf = MAX( 0.0, MIN( 1.0, ( rh - simple_rhcrit ) / ( 1.0 - simple_rhcrit ) ))
+
! include simple convective cloud fraction where present
@@ -202,17 +215,16 @@ subroutine calc_cf_rad (q_hum, qsat, simple_rhcrit, cf_rad)
! left in for fture use
if (cca > 0.0) then
- cf_rad = MAX( simple_cca, cf_rad )
+ cf = MAX( simple_cca, cf )
end if
+
-
-
- end subroutine calc_cf_rad
+ end subroutine calc_cf
- subroutine calc_qcl_rad(p_full, cf_rad, qcl_rad)
- ! calculate simple water content
+ subroutine calc_qcl_rad(p_full, cf, qcl_rad)
+ ! calculate water content
- real , intent(in) :: p_full, cf_rad
+ real , intent(in) :: p_full, cf
real , intent(out) :: qcl_rad
real :: in_cloud_qcl
@@ -222,22 +234,22 @@ subroutine calc_qcl_rad(p_full, cf_rad, qcl_rad)
in_cloud_qcl = MAX ( 0.0, in_cloud_qcl/1000.0 ) ! convert to kg/kg
- qcl_rad = cf_rad * in_cloud_qcl
+ qcl_rad = cf * in_cloud_qcl
end subroutine calc_qcl_rad
- subroutine output_cloud_diags(cf_rad, reff_rad, frac_liq, qcl_rad, Time)
+ subroutine output_cloud_diags(cf, reff_rad, frac_liq, qcl_rad, rh_in_cf, simple_rhcrit, Time)
- real, intent(in), dimension(:,:,:) :: cf_rad, reff_rad, frac_liq, qcl_rad
+ real, intent(in), dimension(:,:,:) :: cf, reff_rad, frac_liq, qcl_rad, rh_in_cf, simple_rhcrit
type(time_type) , intent(in) :: Time
real :: used
- if ( id_cf_rad > 0 ) then
- used = send_data ( id_cf_rad, cf_rad, Time)
+ if ( id_cf > 0 ) then
+ used = send_data ( id_cf, cf, Time)
endif
if ( id_reff_rad > 0 ) then
@@ -252,6 +264,15 @@ subroutine output_cloud_diags(cf_rad, reff_rad, frac_liq, qcl_rad, Time)
used = send_data ( id_qcl_rad, qcl_rad, Time)
endif
+ if ( id_rh_in_cf > 0 ) then
+ used = send_data ( id_rh_in_cf, rh_in_cf*100., Time)
+ endif
+
+ if ( id_simple_rhcrit > 0 ) then
+ used = send_data ( id_simple_rhcrit, simple_rhcrit*100.0, Time)
+ endif
+
+
end subroutine output_cloud_diags
From af5eff3a19bc82be2e222f66b0e08aa624e838d4 Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Thu, 6 Dec 2018 11:24:16 +0000
Subject: [PATCH 103/304] Change to cloud layer will have no science impact but
easier to understand logic
---
src/atmos_param/socrates/interface/set_dimen.F90 | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/atmos_param/socrates/interface/set_dimen.F90 b/src/atmos_param/socrates/interface/set_dimen.F90
index 6cf8eeac8..01d9aca75 100644
--- a/src/atmos_param/socrates/interface/set_dimen.F90
+++ b/src/atmos_param/socrates/interface/set_dimen.F90
@@ -61,10 +61,12 @@ SUBROUTINE set_dimen(control, dimen, spectrum, n_profile, n_layer, &
dimen%nd_subcol_gen = cld_subcol_gen
dimen%nd_subcol_req = cld_subcol_req
-dimen%id_cloud_top = dimen%nd_layer + 1 - n_cloud_layer
+dimen%id_cloud_top = dimen%nd_layer + 1 - n_cloud_layer !ie TOA
IF (control%l_cloud) THEN
- dimen%nd_layer_clr = MAX(dimen%id_cloud_top - 1, dimen%nd_layer)
- ! MAX(dimen%id_cloud_top - 1, 1)
+ ! this gives the allocate the full column for radiation
+ ! rather than the layers over which cloud is present
+ dimen%nd_layer_clr = dimen%nd_layer
+
ELSE
dimen%nd_layer_clr = dimen%nd_layer
END IF
From ec2abd30cd769bc4125f1515d35308f4cc1add0b Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Thu, 6 Dec 2018 12:04:20 +0000
Subject: [PATCH 104/304] qsat is causing very large RH values. Debugging
---
exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py | 2 +-
src/atmos_param/cloud_simple/cloud_simple.F90 | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
index 2803f3100..10afc714b 100644
--- a/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
+++ b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
@@ -52,7 +52,7 @@
diag.add_field('socrates', 'soc_surf_flux_sw', time_avg=True)
diag.add_field('socrates', 'soc_olr', time_avg=True)
diag.add_field('socrates', 'soc_toa_sw', time_avg=True)
-diag.add_field('cloud_simple', 'cf_rad', time_avg=True)
+diag.add_field('cloud_simple', 'cf', time_avg=True)
diag.add_field('cloud_simple', 'reff_rad', time_avg=True)
diag.add_field('cloud_simple', 'frac_liq', time_avg=True)
diag.add_field('cloud_simple', 'qcl_rad', time_avg=True)
diff --git a/src/atmos_param/cloud_simple/cloud_simple.F90 b/src/atmos_param/cloud_simple/cloud_simple.F90
index ffcae1385..e1e57b04b 100644
--- a/src/atmos_param/cloud_simple/cloud_simple.F90
+++ b/src/atmos_param/cloud_simple/cloud_simple.F90
@@ -123,7 +123,7 @@ subroutine cloud_simple(p_half, p_full, Time, &
'cloud_simple_init has not been called.', FATAL)
! Get the saturated specific humidity TOTAL (ie ice and vap) ***double check maths!
- call compute_qs(temp, p_full, qs, es_over_liq_and_ice=.true.) !qs=qsat in um
+ call compute_qs(temp, p_full, qs) !qs=qsat in um
k_surf = size(temp, 3)
From c539ed479ffeb3df13a4d4410371fbc0dbb5b010 Mon Sep 17 00:00:00 2001
From: sit23
Date: Thu, 6 Dec 2018 12:09:20 +0000
Subject: [PATCH 105/304] Updated experiment.
---
.../socrates_test/socrates_aquaplanet_with_cloud.py | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
index 10afc714b..8b6a36f79 100644
--- a/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
+++ b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
@@ -37,6 +37,7 @@
diag.add_field('dynamics', 'bk')
diag.add_field('dynamics', 'pk')
diag.add_field('atmosphere', 'precipitation', time_avg=True)
+diag.add_field('atmosphere', 'rh', time_avg=True)
diag.add_field('mixed_layer', 't_surf', time_avg=True)
diag.add_field('dynamics', 'sphum', time_avg=True)
diag.add_field('dynamics', 'ucomp', time_avg=True)
@@ -94,7 +95,7 @@
'chunk_size': 16,
'use_pressure_interp_for_half_levels':False,
'tidally_locked':False,
- 'sol_day':90
+ 'solday':90
},
'idealized_moist_phys_nml': {
'do_damping': True,
@@ -207,7 +208,7 @@
if __name__=="__main__":
cb.compile(debug=False)
- exp.run(1, use_restart=False, num_cores=NCORES, overwrite_data=True)#, run_idb=True)
+ exp.run(1, use_restart=False, num_cores=NCORES, overwrite_data=False)#, run_idb=True)
- for i in range(2,121):
+ for i in range(2,125):
exp.run(i, num_cores=NCORES)
From 995c9efa3fa0f885218f0cee8a3b31c79bd01990 Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Thu, 6 Dec 2018 15:35:26 +0000
Subject: [PATCH 106/304] Adding comments. No science changes
---
src/atmos_param/cloud_simple/cloud_simple.F90 | 27 +++++++------------
1 file changed, 10 insertions(+), 17 deletions(-)
diff --git a/src/atmos_param/cloud_simple/cloud_simple.F90 b/src/atmos_param/cloud_simple/cloud_simple.F90
index e1e57b04b..b27ba5788 100644
--- a/src/atmos_param/cloud_simple/cloud_simple.F90
+++ b/src/atmos_param/cloud_simple/cloud_simple.F90
@@ -116,14 +116,12 @@ subroutine cloud_simple(p_half, p_full, Time, &
logical :: es_over_liq_and_ice
- real :: tmp1, tmp2 !remove tmp1 and tmp2 after debugging
-
!check initiation has been done - ie read in parameters
if (do_init) call error_mesg ('cloud_simple', &
'cloud_simple_init has not been called.', FATAL)
! Get the saturated specific humidity TOTAL (ie ice and vap) ***double check maths!
- call compute_qs(temp, p_full, qs) !qs=qsat in um
+ call compute_qs(temp, p_full, qs)
k_surf = size(temp, 3)
@@ -131,7 +129,9 @@ subroutine cloud_simple(p_half, p_full, Time, &
do j=1, size(temp, 2)
do k=1, size(temp, 3)
- !caluclate the frac_liq
+ ! caluclate the liquid fraction, effective radius, critical RH for
+ ! the simple cloud scheme and cloud fraction.
+ ! rh_in_cf is an output diagnostic only for debugging
call calc_liq_frac(temp(i,j,k), frac_liq(i,j,k))
call calc_reff(frac_liq(i,j,k), reff_rad(i,j,k))
call calc_rhcrit(p_full(i,j,k), p_full(i,j,k_surf), simple_rhcrit(i,j,k))
@@ -166,6 +166,7 @@ subroutine calc_liq_frac(temp, frac_liq)
end subroutine calc_liq_frac
subroutine calc_reff(frac_liq, reff_rad)
+ ! the effective cloud radius is bounded between 10 and 20 microns
real, intent(in) :: frac_liq
real, intent(out) :: reff_rad
@@ -175,7 +176,7 @@ subroutine calc_reff(frac_liq, reff_rad)
end subroutine calc_reff
subroutine calc_rhcrit(p_full, p_surf, simple_rhcrit) !need to check p_full - > p_layer_centres
-
+ !get the RH needed as a threshold for the cloud fraction calc.
real, intent(in) :: p_full, p_surf
real, intent(out) :: simple_rhcrit
@@ -209,10 +210,9 @@ subroutine calc_cf (q_hum, qsat, simple_rhcrit, cf, rh)
cf = MAX( 0.0, MIN( 1.0, ( rh - simple_rhcrit ) / ( 1.0 - simple_rhcrit ) ))
- ! include simple convective cloud fraction where present
-
+ ! include simple convective cloud fraction where present (not currenly used)
cca = 0.0 ! no convective cloud fraction is calculated
- ! left in for fture use
+ ! left in for future use
if (cca > 0.0) then
cf = MAX( simple_cca, cf )
@@ -222,7 +222,7 @@ subroutine calc_cf (q_hum, qsat, simple_rhcrit, cf, rh)
end subroutine calc_cf
subroutine calc_qcl_rad(p_full, cf, qcl_rad)
- ! calculate water content
+ ! calculate cloud water content
real , intent(in) :: p_full, cf
real , intent(out) :: qcl_rad
@@ -238,8 +238,6 @@ subroutine calc_qcl_rad(p_full, cf, qcl_rad)
end subroutine calc_qcl_rad
-
-
subroutine output_cloud_diags(cf, reff_rad, frac_liq, qcl_rad, rh_in_cf, simple_rhcrit, Time)
real, intent(in), dimension(:,:,:) :: cf, reff_rad, frac_liq, qcl_rad, rh_in_cf, simple_rhcrit
@@ -272,16 +270,11 @@ subroutine output_cloud_diags(cf, reff_rad, frac_liq, qcl_rad, rh_in_cf, simple_
used = send_data ( id_simple_rhcrit, simple_rhcrit*100.0, Time)
endif
-
-
end subroutine output_cloud_diags
- !-----------------------------------------------
-
-
subroutine cloud_simple_end ()
- ! do we deallocate anything?
+ ! If alloocated are added in init then deallocate them here.
end subroutine cloud_simple_end
From 16cde24bc3e96a198a83922a87b3a8cac8c80605 Mon Sep 17 00:00:00 2001
From: sit23
Date: Thu, 6 Dec 2018 15:48:09 +0000
Subject: [PATCH 107/304] Made some changes to socrates cloud test experiment.
---
.../socrates_test/socrates_aquaplanet_with_cloud.py | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
index 8b6a36f79..f4500f04e 100644
--- a/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
+++ b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
@@ -62,8 +62,8 @@
# additional output options commented out
-#diag.add_field('socrates', 'soc_flux_lw', time_avg=True)
-#diag.add_field('socrates', 'soc_flux_sw', time_avg=True)
+diag.add_field('socrates', 'soc_flux_lw', time_avg=True)
+diag.add_field('socrates', 'soc_flux_sw', time_avg=True)
#diag.add_field('socrates', 'soc_co2', time_avg=True)
#diag.add_field('socrates', 'soc_ozone', time_avg=True)
#diag.add_field('socrates', 'soc_coszen', time_avg=True)
@@ -148,7 +148,7 @@
'prescribe_initial_dist':True,
'evaporation':True,
'depth': 2.5, #Depth of mixed layer used
- 'albedo_value': 0.38, #Albedo value used
+ 'albedo_value': 0.2, #Albedo value used
},
'qe_moist_convection_nml': {
@@ -210,5 +210,5 @@
cb.compile(debug=False)
exp.run(1, use_restart=False, num_cores=NCORES, overwrite_data=False)#, run_idb=True)
- for i in range(2,125):
+ for i in range(2,171):
exp.run(i, num_cores=NCORES)
From cfa46d24b5bef7fb48785d0d297a226fdcb2f553 Mon Sep 17 00:00:00 2001
From: sit23
Date: Fri, 14 Dec 2018 10:25:34 +0000
Subject: [PATCH 108/304] New test case with land and specified ssts.
---
...es_aquaplanet_with_cloud_amip_with_topo.py | 234 ++++++++++++++++++
.../scripts/run_plevel.py | 14 +-
2 files changed, 242 insertions(+), 6 deletions(-)
create mode 100644 exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud_amip_with_topo.py
diff --git a/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud_amip_with_topo.py b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud_amip_with_topo.py
new file mode 100644
index 000000000..0c88efd1d
--- /dev/null
+++ b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud_amip_with_topo.py
@@ -0,0 +1,234 @@
+import os
+
+import numpy as np
+
+from isca import SocratesCodeBase, DiagTable, Experiment, Namelist, GFDL_BASE
+from isca.util import exp_progress
+
+NCORES = 16
+base_dir = os.path.dirname(os.path.realpath(__file__))
+# a CodeBase can be a directory on the computer,
+# useful for iterative development
+cb = SocratesCodeBase.from_directory(GFDL_BASE)
+
+# or it can point to a specific git repo and commit id.
+# This method should ensure future, independent, reproducibility of results.
+# cb = DryCodeBase.from_repo(repo='https://github.com/isca/isca', commit='isca1.1')
+
+# compilation depends on computer specific settings. The $GFDL_ENV
+# environment variable is used to determine which `$GFDL_BASE/src/extra/env` file
+# is used to load the correct compilers. The env file is always loaded from
+# $GFDL_BASE and not the checked out git repo.
+
+# create an Experiment object to handle the configuration of model parameters
+# and output diagnostics
+
+exp = Experiment('soc_test_aquaplanet_with_clouds_post_jm_suggestions_amip_ssts_land_low_albedo_with_land', codebase=cb)
+exp.clear_rundir()
+
+inputfiles = [os.path.join(GFDL_BASE,'input/rrtm_input_files/ozone_1990.nc'),
+ os.path.join(base_dir,'input/sst_clim_amip.nc'), os.path.join(GFDL_BASE,'input/land_masks/era_land_t42.nc')]
+
+#Tell model how to write diagnostics
+diag = DiagTable()
+diag.add_file('atmos_monthly', 30, 'days', time_units='days')
+
+#Tell model which diagnostics to write
+diag.add_field('dynamics', 'ps', time_avg=True)
+diag.add_field('dynamics', 'bk')
+diag.add_field('dynamics', 'pk')
+diag.add_field('dynamics', 'zsurf', time_avg=True)
+diag.add_field('atmosphere', 'precipitation', time_avg=True)
+diag.add_field('atmosphere', 'rh', time_avg=True)
+diag.add_field('mixed_layer', 't_surf', time_avg=True)
+diag.add_field('dynamics', 'sphum', time_avg=True)
+diag.add_field('dynamics', 'ucomp', time_avg=True)
+diag.add_field('dynamics', 'vcomp', time_avg=True)
+diag.add_field('dynamics', 'temp', time_avg=True)
+diag.add_field('dynamics', 'vor', time_avg=True)
+diag.add_field('dynamics', 'div', time_avg=True)
+
+diag.add_field('socrates', 'soc_tdt_lw', time_avg=True)
+diag.add_field('socrates', 'soc_tdt_sw', time_avg=True)
+diag.add_field('socrates', 'soc_tdt_rad', time_avg=True)
+diag.add_field('socrates', 'soc_surf_flux_lw', time_avg=True)
+diag.add_field('socrates', 'soc_surf_flux_sw', time_avg=True)
+diag.add_field('socrates', 'soc_olr', time_avg=True)
+diag.add_field('socrates', 'soc_toa_sw', time_avg=True)
+diag.add_field('cloud_simple', 'cf', time_avg=True)
+diag.add_field('cloud_simple', 'reff_rad', time_avg=True)
+diag.add_field('cloud_simple', 'frac_liq', time_avg=True)
+diag.add_field('cloud_simple', 'qcl_rad', time_avg=True)
+diag.add_field('cloud_simple', 'simple_rhcrit', time_avg=True)
+diag.add_field('cloud_simple', 'rh_in_cf', time_avg=True)
+diag.add_field('mixed_layer', 'albedo', time_avg=True)
+
+
+# additional output options commented out
+diag.add_field('socrates', 'soc_flux_lw', time_avg=True)
+diag.add_field('socrates', 'soc_flux_sw', time_avg=True)
+#diag.add_field('socrates', 'soc_co2', time_avg=True)
+#diag.add_field('socrates', 'soc_ozone', time_avg=True)
+#diag.add_field('socrates', 'soc_coszen', time_avg=True)
+#diag.add_field('socrates', 'soc_spectral_olr', time_avg=True)
+
+exp.diag_table = diag
+exp.inputfiles = inputfiles
+
+#Define values for the 'core' namelist
+exp.namelist = namelist = Namelist({
+ 'main_nml':{
+ 'days' : 30,
+ 'hours' : 0,
+ 'minutes': 0,
+ 'seconds': 0,
+ 'dt_atmos':600,
+ 'current_date' : [1,1,1,0,0,0],
+ 'calendar' : 'thirty_day'
+ },
+ 'socrates_rad_nml': {
+ 'stellar_constant':1370.,
+ 'lw_spectral_filename':os.path.join(GFDL_BASE,'src/atmos_param/socrates/src/trunk/data/spectra/ga7/sp_lw_ga7'),
+ 'sw_spectral_filename':os.path.join(GFDL_BASE,'src/atmos_param/socrates/src/trunk/data/spectra/ga7/sp_sw_ga7'),
+ 'do_read_ozone': True,
+ 'ozone_file_name':'ozone_1990',
+ 'ozone_field_name':'ozone_1990',
+ 'dt_rad':3600,
+ 'store_intermediate_rad':True,
+ 'chunk_size': 16,
+ 'use_pressure_interp_for_half_levels':False,
+ 'tidally_locked':False,
+ },
+ 'idealized_moist_phys_nml': {
+ 'do_damping': True,
+ 'turb':True,
+ 'mixed_layer_bc':True,
+ 'do_virtual' :False,
+ 'do_simple': True,
+ 'roughness_mom':3.21e-05,
+ 'roughness_heat':3.21e-05,
+ 'roughness_moist':3.21e-05,
+ 'two_stream_gray': False, #Use the grey radiation scheme
+ 'do_socrates_radiation': True,
+ 'convection_scheme': 'SIMPLE_BETTS_MILLER', #Use simple Betts miller convection
+ 'do_cloud_simple': True,
+ 'land_option' : 'input',
+ 'land_file_name' : 'INPUT/era_land_t42.nc',
+ 'land_roughness_prefactor' :10.0,
+ },
+
+ 'cloud_simple_nml': {
+ 'simple_cca':0.0,
+ 'rhcsfc': 0.95,
+ 'rhc700': 0.7,
+ 'rhc200': 0.3
+ },
+
+ 'vert_turb_driver_nml': {
+ 'do_mellor_yamada': False, # default: True
+ 'do_diffusivity': True, # default: False
+ 'do_simple': True, # default: False
+ 'constant_gust': 0.0, # default: 1.0
+ 'use_tau': False
+ },
+
+ 'diffusivity_nml': {
+ 'do_entrain':False,
+ 'do_simple': True,
+ },
+
+ 'surface_flux_nml': {
+ 'use_virtual_temp': False,
+ 'do_simple': True,
+ 'old_dtaudv': True
+ },
+
+ 'atmosphere_nml': {
+ 'idealized_moist_model': True
+ },
+
+ #Use a large mixed-layer depth, and the Albedo of the CTRL case in Jucker & Gerber, 2017
+ 'mixed_layer_nml': {
+ 'tconst' : 285.,
+ 'prescribe_initial_dist':True,
+ 'evaporation':True,
+ 'depth': 20.0, #Depth of mixed layer used
+ 'albedo_value': 0.2, #Albedo value used
+ 'land_option': 'input', #Tell mixed layer to get land mask from input file
+ 'land_h_capacity_prefactor': 0.1, #What factor to multiply mixed-layer depth by over land.
+ 'albedo_value': 0.1, #Ocean albedo value
+ 'land_albedo_prefactor': 1.3, #What factor to multiply ocean albedo by over land
+ 'do_qflux' : False, #Don't use the prescribed analytical formula for q-fluxes
+ 'do_read_sst' : True, #Read in sst values from input file
+ 'do_sc_sst' : True, #Do specified ssts (need both to be true)
+ 'sst_file' : 'sst_clim_amip', #Set name of sst input file
+ 'specify_sst_over_ocean_only' : True, #Make sure sst only specified in regions of ocean.
+ },
+
+ 'qe_moist_convection_nml': {
+ 'rhbm':0.7,
+ 'Tmin':160.,
+ 'Tmax':350.
+ },
+
+ 'lscale_cond_nml': {
+ 'do_simple':True,
+ 'do_evap':True
+ },
+
+ 'sat_vapor_pres_nml': {
+ 'do_simple':True,
+ 'construct_table_wrt_liq_and_ice':True
+ },
+
+ 'damping_driver_nml': {
+ 'do_rayleigh': True,
+ 'trayfric': -0.5, # neg. value: time in *days*
+ 'sponge_pbottom': 150., #Setting the lower pressure boundary for the model sponge layer in Pa.
+ 'do_conserve_energy': True,
+ },
+
+ # FMS Framework configuration
+ 'diag_manager_nml': {
+ 'mix_snapshot_average_fields': False # time avg fields are labelled with time in middle of window
+ },
+
+ 'fms_nml': {
+ 'domains_stack_size': 600000 # default: 0
+ },
+
+ 'fms_io_nml': {
+ 'threading_write': 'single', # default: multi
+ 'fileset_write': 'single', # default: multi
+ },
+
+ 'spectral_dynamics_nml': {
+ 'damping_order': 4,
+ 'water_correction_limit': 200.e2,
+ 'reference_sea_level_press':1.0e5,
+ 'num_levels':40, #How many model pressure levels to use
+ 'valid_range_t':[100.,800.],
+ 'initial_sphum':[2.e-6],
+ 'vert_coord_option':'uneven_sigma',
+ 'surf_res':0.2, #Parameter that sets the vertical distribution of sigma levels
+ 'scale_heights' : 11.0,
+ 'exponent':7.0,
+ 'robert_coeff':0.03,
+ 'ocean_topog_smoothing': 0.8
+ },
+
+ 'spectral_init_cond_nml':{
+ 'topog_file_name': 'era_land_t42.nc',
+ 'topography_option': 'input'
+ },
+
+})
+
+#Lets do a run!
+if __name__=="__main__":
+
+ cb.compile(debug=False)
+ exp.run(1, use_restart=False, num_cores=NCORES, overwrite_data=False)#, run_idb=True)
+
+ for i in range(2,241):
+ exp.run(i, num_cores=NCORES)
diff --git a/postprocessing/plevel_interpolation/scripts/run_plevel.py b/postprocessing/plevel_interpolation/scripts/run_plevel.py
index 294ecb53a..5a04db3c1 100644
--- a/postprocessing/plevel_interpolation/scripts/run_plevel.py
+++ b/postprocessing/plevel_interpolation/scripts/run_plevel.py
@@ -7,11 +7,11 @@
import subprocess
start_time=time.time()
-base_dir='/scratch/sit204/Data_2013/'
-exp_name_list = ['no_ice_flux_lhe_exps_q_flux_hadgem_anoms_3']
+base_dir='/scratch/sit204/data_isca/'
+exp_name_list = ['soc_test_aquaplanet_with_clouds_post_jm_suggestions_amip_ssts_land_low_albedo']
avg_or_daily_list=['monthly']
-start_file=287
-end_file=288
+start_file=96
+end_file=120
nfiles=(end_file-start_file)+1
do_extra_averaging=False #If true, then 6hourly data is averaged into daily data using cdo
@@ -66,10 +66,12 @@
number_prefix=''
- if n+start_file < 100:
+ if n+start_file < 1000:
number_prefix='0'
- if n+start_file < 10:
+ if n+start_file < 100:
number_prefix='00'
+ if n+start_file < 10:
+ number_prefix='000'
nc_file_in = base_dir+'/'+exp_name+'/run'+number_prefix+str(n+start_file)+'/atmos_'+avg_or_daily+'.nc'
nc_file_out = out_dir+'/'+exp_name+'/run'+number_prefix+str(n+start_file)+'/atmos_'+avg_or_daily+file_suffix+'.nc'
From 90fbb93e58efdce7e5eb39a3bf7a8cd81f22a586 Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Thu, 28 Mar 2019 09:27:12 +0000
Subject: [PATCH 109/304] Adding diagnostics for clear sky in order to do CRE
calculation.
---
.../socrates_aquaplanet_with_cloud.py | 31 ++-
.../socrates/interface/socrates_calc.F90 | 22 +-
.../socrates/interface/socrates_interface.F90 | 242 +++++++++++++++---
3 files changed, 247 insertions(+), 48 deletions(-)
diff --git a/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
index f4500f04e..f3c189127 100644
--- a/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
+++ b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
@@ -5,7 +5,7 @@
from isca import SocratesCodeBase, DiagTable, Experiment, Namelist, GFDL_BASE
from isca.util import exp_progress
-NCORES = 16
+NCORES = 8
base_dir = os.path.dirname(os.path.realpath(__file__))
# a CodeBase can be a directory on the computer,
# useful for iterative development
@@ -46,13 +46,30 @@
diag.add_field('dynamics', 'vor', time_avg=True)
diag.add_field('dynamics', 'div', time_avg=True)
-diag.add_field('socrates', 'soc_tdt_lw', time_avg=True)
+#temperature tendency - units are K/s
+diag.add_field('socrates', 'soc_tdt_lw', time_avg=True) # net flux lw 3d (up - down)
diag.add_field('socrates', 'soc_tdt_sw', time_avg=True)
-diag.add_field('socrates', 'soc_tdt_rad', time_avg=True)
+diag.add_field('socrates', 'soc_tdt_rad', time_avg=True) #sum of the sw and lw heating rates
+
+#net (up) and down surface fluxes
diag.add_field('socrates', 'soc_surf_flux_lw', time_avg=True)
diag.add_field('socrates', 'soc_surf_flux_sw', time_avg=True)
+diag.add_field('socrates', 'soc_surf_flux_lw_down', time_avg=True)
+diag.add_field('socrates', 'soc_surf_flux_sw_down', time_avg=True)
+#net (up) TOA and downard fluxes
diag.add_field('socrates', 'soc_olr', time_avg=True)
-diag.add_field('socrates', 'soc_toa_sw', time_avg=True)
+diag.add_field('socrates', 'soc_toa_sw', time_avg=True)
+diag.add_field('socrates', 'soc_toa_sw_down', time_avg=True)
+
+#clear sky fluxes
+diag.add_field('socrates', 'soc_surf_flux_lw_clear', time_avg=True)
+diag.add_field('socrates', 'soc_surf_flux_sw_clear', time_avg=True)
+diag.add_field('socrates', 'soc_surf_flux_lw_down_clear', time_avg=True)
+diag.add_field('socrates', 'soc_surf_flux_sw_down_clear', time_avg=True)
+diag.add_field('socrates', 'soc_olr_clear', time_avg=True)
+diag.add_field('socrates', 'soc_toa_sw_clear', time_avg=True)
+diag.add_field('socrates', 'soc_toa_sw_down_clear', time_avg=True)
+
diag.add_field('cloud_simple', 'cf', time_avg=True)
diag.add_field('cloud_simple', 'reff_rad', time_avg=True)
diag.add_field('cloud_simple', 'frac_liq', time_avg=True)
@@ -208,7 +225,7 @@
if __name__=="__main__":
cb.compile(debug=False)
- exp.run(1, use_restart=False, num_cores=NCORES, overwrite_data=False)#, run_idb=True)
+ exp.run(1, use_restart=False, num_cores=NCORES, overwrite_data=True)#, run_idb=True)
- for i in range(2,171):
- exp.run(i, num_cores=NCORES)
+# for i in range(2,171):
+# exp.run(i, num_cores=NCORES)
diff --git a/src/atmos_param/socrates/interface/socrates_calc.F90 b/src/atmos_param/socrates/interface/socrates_calc.F90
index 0fd98b578..f50910a25 100644
--- a/src/atmos_param/socrates/interface/socrates_calc.F90
+++ b/src/atmos_param/socrates/interface/socrates_calc.F90
@@ -17,7 +17,7 @@ module socrates_calc_mod
contains
-! ==================================================================================
+! ==============================================================================
@@ -25,7 +25,7 @@ module socrates_calc_mod
! Set up the call to the Socrates radiation scheme
! -----------------------------------------------------------------------------
!DIAG Added Time
-subroutine socrates_calc(Time_diag,control, spectrum, &
+subroutine socrates_calc(Time_diag,control, spectrum, &
n_profile, n_layer, n_cloud_layer, n_aer_mode, &
cld_subcol_gen, cld_subcol_req, &
p_layer, t_layer, t_layer_boundaries, d_mass, density, &
@@ -34,7 +34,9 @@ subroutine socrates_calc(Time_diag,control, spectrum,
l_planet_grey_surface, planet_albedo, planet_emissivity, &
layer_heat_capacity, &
cld_frac, reff_rad, mmr_cl_rad, &
- flux_direct, flux_down, flux_up, heating_rate, spectral_olr)
+ flux_direct, flux_down, flux_up, &
+ flux_down_clear, flux_up_clear, &
+ heating_rate, spectral_olr)
use rad_pcf
use def_control, only: StrCtrl
@@ -126,9 +128,11 @@ subroutine socrates_calc(Time_diag,control, spectrum,
real(r_def), intent(out) :: flux_direct(n_profile, 0:n_layer)
! Direct (unscattered) downwards flux (Wm-2)
-real(r_def), intent(out) :: flux_down(n_profile, 0:n_layer)
+real(r_def), intent(out) :: flux_down(n_profile, 0:n_layer), &
+ flux_down_clear(n_profile, 0:n_layer)
! Downwards flux (Wm-2)
-real(r_def), intent(out) :: flux_up(n_profile, 0:n_layer)
+real(r_def), intent(out) :: flux_up(n_profile, 0:n_layer), &
+ flux_up_clear(n_profile, 0:n_layer)
! Upwards flux (Wm-2)
real(r_def), intent(out) :: heating_rate(n_profile, n_layer)
! Heating rate (Ks-1)
@@ -205,9 +209,11 @@ subroutine socrates_calc(Time_diag,control, spectrum,
do l=1, n_profile
do i=0, n_layer
- flux_direct(l, i) = radout%flux_direct(l, i, 1)
- flux_down(l, i) = radout%flux_down(l, i, 1)
- flux_up(l, i) = radout%flux_up(l, i, 1)
+ flux_direct(l, i) = radout%flux_direct(l, i, 1)
+ flux_down(l, i) = radout%flux_down(l, i, 1)
+ flux_down_clear(l, i) = radout%flux_down_clear(l, i, 1)
+ flux_up(l, i) = radout%flux_up(l, i, 1)
+ flux_up_clear(l, i) = radout%flux_up_clear(l, i, 1)
end do
if (present(spectral_olr)) then
spectral_olr(l,:) = radout%flux_up_clear_band(l,0,:)
diff --git a/src/atmos_param/socrates/interface/socrates_interface.F90 b/src/atmos_param/socrates/interface/socrates_interface.F90
index 1dabdc602..5ea0e5f13 100644
--- a/src/atmos_param/socrates/interface/socrates_interface.F90
+++ b/src/atmos_param/socrates/interface/socrates_interface.F90
@@ -59,6 +59,13 @@ MODULE socrates_interface_mod
INTEGER :: id_soc_flux_lw, id_soc_flux_sw
INTEGER :: id_soc_olr, id_soc_toa_sw
INTEGER :: id_soc_toa_sw_down
+ INTEGER :: id_soc_surf_flux_lw_clear, id_soc_surf_flux_sw_clear
+ INTEGER :: id_soc_surf_flux_lw_down, id_soc_surf_flux_sw_down
+ INTEGER :: id_soc_surf_flux_lw_down_clear, id_soc_surf_flux_sw_down_clear
+ INTEGER :: id_soc_flux_lw, id_soc_flux_sw
+ INTEGER :: id_soc_olr, id_soc_toa_sw, id_soc_olr_clear, id_soc_toa_sw_clear
+ INTEGER :: id_soc_toa_sw_down, id_soc_toa_sw_down_clear
+
INTEGER :: id_soc_ozone, id_soc_co2, id_soc_coszen
INTEGER :: n_soc_bands_lw, n_soc_bands_sw
INTEGER :: n_soc_bands_lw_hires, n_soc_bands_sw_hires
@@ -72,9 +79,12 @@ MODULE socrates_interface_mod
REAL(r_def), allocatable, dimension(:,:,:) :: tdt_soc_sw_store, tdt_soc_lw_store
REAL(r_def), allocatable, dimension(:,:,:) :: thd_sw_flux_net_store, thd_lw_flux_net_store
REAL(r_def), allocatable, dimension(:,:,:) :: thd_co2_store, thd_ozone_store
- REAL(r_def), allocatable, dimension(:,:) :: net_surf_sw_down_store, surf_lw_down_store, surf_lw_net_store, &
- surf_sw_down_store, toa_sw_down_store, &
- toa_sw_store, olr_store, coszen_store
+ REAL(r_def), allocatable, dimension(:,:) :: net_surf_sw_down_store, surf_sw_down_store, surf_lw_down_store, surf_lw_net_store, &
+ toa_sw_store, olr_store, coszen_store, &
+ toa_sw_down_store
+ REAL(r_def), allocatable, dimension(:,:) :: net_surf_sw_down_clear_store, surf_sw_down_clear_store, &
+ surf_lw_down_clear_store, surf_lw_net_clear_store, &
+ toa_sw_clear_store, olr_clear_store, toa_sw_down_clear_store
REAL(r_def), allocatable, dimension(:,:,:) :: outputted_soc_spectral_olr, spectral_olr_store
REAL(r_def), allocatable, dimension(:) :: soc_bins_lw, soc_bins_sw
@@ -259,36 +269,71 @@ SUBROUTINE socrates_init(is, ie, js, je, num_levels, axes, Time, lat, lonb, latb
'socrates Net LW surface flux (up)', &
'watts/m2', missing_value=missing_value )
+ id_soc_surf_flux_lw_clear = &
+ register_diag_field ( soc_mod_name, 'soc_surf_flux_lw_clear', axes(1:2), Time, &
+ 'socrates Net LW surface flux (up) clear sky', &
+ 'watts/m2', missing_value=missing_value )
+
id_soc_surf_flux_lw_down = &
register_diag_field ( soc_mod_name, 'soc_surf_flux_lw_down', axes(1:2), Time, &
'socrates LW surface flux down', &
'watts/m2', missing_value=missing_value )
+ id_soc_surf_flux_lw_down_clear = &
+ register_diag_field ( soc_mod_name, 'soc_surf_flux_lw_down_clear', axes(1:2), Time, &
+ 'socrates LW surface flux down clear sky', &
+ 'watts/m2', missing_value=missing_value )
+
id_soc_surf_flux_sw = &
register_diag_field ( soc_mod_name, 'soc_surf_flux_sw', axes(1:2), Time, &
'socrates Net SW surface flux (down)', &
'watts/m2', missing_value=missing_value )
+ id_soc_surf_flux_sw_clear = &
+ register_diag_field ( soc_mod_name, 'soc_surf_flux_sw_clear', axes(1:2), Time, &
+ 'socrates Net SW surface flux (down) clear sky', &
+ 'watts/m2', missing_value=missing_value )
+
id_soc_surf_flux_sw_down = &
register_diag_field ( soc_mod_name, 'soc_surf_flux_sw_down', axes(1:2), Time, &
'socrates SW surface flux down', &
'watts/m2', missing_value=missing_value )
+ id_soc_surf_flux_sw_down_clear = &
+ register_diag_field ( soc_mod_name, 'soc_surf_flux_sw_down_clear', axes(1:2), Time, &
+ 'socrates SW surface flux down clear sky', &
+ 'watts/m2', missing_value=missing_value )
+
id_soc_olr = &
register_diag_field ( soc_mod_name, 'soc_olr', axes(1:2), Time, &
'socrates TOA LW flux (up)', &
'watts/m2', missing_value=missing_value )
+ id_soc_olr_clear = &
+ register_diag_field ( soc_mod_name, 'soc_olr_clear', axes(1:2), Time, &
+ 'socrates TOA LW flux (up) clear-sky', &
+ 'watts/m2', missing_value=missing_value )
+
id_soc_toa_sw = &
register_diag_field ( soc_mod_name, 'soc_toa_sw', axes(1:2), Time, &
'socrates Net TOA SW flux (down)', &
'watts/m2', missing_value=missing_value )
+ id_soc_toa_sw_clear = &
+ register_diag_field ( soc_mod_name, 'soc_toa_sw_clear', axes(1:2), Time, &
+ 'socrates Net TOA SW flux (down) clear', &
+ 'watts/m2', missing_value=missing_value )
+
id_soc_toa_sw_down = &
register_diag_field ( soc_mod_name, 'soc_toa_sw_down', axes(1:2), Time, &
'socrates TOA SW flux down', &
'watts/m2', missing_value=missing_value )
+ id_soc_toa_sw_down_clear = &
+ register_diag_field ( soc_mod_name, 'soc_toa_sw_down_clear', axes(1:2), Time, &
+ 'socrates TOA SW flux down clear sky', &
+ 'watts/m2', missing_value=missing_value )
+
id_soc_flux_lw = &
register_diag_field ( soc_mod_name, 'soc_flux_lw', (/axes(1),axes(2),axes(4)/), Time, &
'socrates Net LW flux (up)', &
@@ -351,10 +396,6 @@ SUBROUTINE socrates_init(is, ie, js, je, num_levels, axes, Time, lat, lonb, latb
allocate(surf_lw_down_store(size(lonb,1)-1, size(latb,2)-1))
! only required for output
- if (id_soc_surf_flux_lw > 0) then
- allocate(surf_lw_net_store(size(lonb,1)-1, size(latb,2)-1))
- endif
-
if (id_soc_flux_lw > 0) then
allocate(thd_lw_flux_net_store(size(lonb,1)-1, size(latb,2)-1, num_levels+1))
endif
@@ -363,20 +404,48 @@ SUBROUTINE socrates_init(is, ie, js, je, num_levels, axes, Time, lat, lonb, latb
allocate(thd_sw_flux_net_store(size(lonb,1)-1, size(latb,2)-1, num_levels+1))
endif
+ if (id_soc_surf_flux_sw_clear > 0) then
+ allocate(net_surf_sw_down_clear_store(size(lonb,1)-1, size(latb,2)-1))
+ endif
+ if (id_soc_surf_flux_lw_down_clear > 0) then
+ allocate(surf_lw_down_clear_store(size(lonb,1)-1, size(latb,2)-1))
+ endif
+
+ !surface
+ if (id_soc_surf_flux_lw > 0) then
+ allocate(surf_lw_net_store(size(lonb,1)-1, size(latb,2)-1))
+ endif
+ if (id_soc_surf_flux_lw_clear > 0) then
+ allocate(surf_lw_net_clear_store(size(lonb,1)-1, size(latb,2)-1))
+ endif
if (id_soc_surf_flux_sw_down > 0) then
allocate(surf_sw_down_store(size(lonb,1)-1, size(latb,2)-1))
endif
+ if (id_soc_surf_flux_sw_down_clear > 0) then
+ allocate(surf_sw_down_clear_store(size(lonb,1)-1, size(latb,2)-1))
+ endif
if (id_soc_olr > 0) then
allocate(olr_store(size(lonb,1)-1, size(latb,2)-1))
endif
+ if (id_soc_olr_clear > 0) then
+ allocate(olr_clear_store(size(lonb,1)-1, size(latb,2)-1))
+ endif
if (id_soc_toa_sw > 0) then
allocate(toa_sw_store(size(lonb,1)-1, size(latb,2)-1))
endif
+ if (id_soc_toa_sw_clear > 0) then
+ allocate(toa_sw_clear_store(size(lonb,1)-1, size(latb,2)-1))
+ endif
if (id_soc_toa_sw_down > 0) then
allocate(toa_sw_down_store(size(lonb,1)-1, size(latb,2)-1))
endif
+ if (id_soc_toa_sw_down_clear > 0) then
+ allocate(toa_sw_down_clear_store(size(lonb,1)-1, size(latb,2)-1))
+ endif
+
+
if (id_soc_coszen > 0) then
allocate(coszen_store(size(lonb,1)-1, size(latb,2)-1))
endif
@@ -437,6 +506,7 @@ subroutine socrates_interface(Time_diag, rlat, rlon, soc_lw_mode, &
fms_coszen, fms_rrsun, n_profile, n_layer, &
fms_cld_frac, fms_reff_rad, fms_mmr_cl_rad, &
output_heating_rate, output_flux_down, output_flux_up, &
+ output_flux_down_clear, output_flux_up_clear, &
do_cloud_simple, &
!optionals
output_soc_spectral_olr, output_flux_direct, &
@@ -484,8 +554,8 @@ subroutine socrates_interface(Time_diag, rlat, rlon, soc_lw_mode, &
! Output arrays
real(r_def), intent(out) :: output_heating_rate(:,:,:)
- real(r_def), intent(out) :: output_flux_up(:,:,:)
- real(r_def), intent(out) :: output_flux_down(:,:,:)
+ real(r_def), intent(out) :: output_flux_up(:,:,:), output_flux_up_clear(:,:,:)
+ real(r_def), intent(out) :: output_flux_down(:,:,:), output_flux_down_clear(:,:,:)
real(r_def), intent(out), optional :: output_flux_direct(:,:,:)
@@ -504,7 +574,8 @@ subroutine socrates_interface(Time_diag, rlat, rlon, soc_lw_mode, &
input_co2_mixing_ratio,z_full_reshaped, input_cld_frac, input_reff_rad, input_mmr_cl_rad
real(r_def), dimension(n_profile, 0:n_layer) :: input_p_level, input_t_level, soc_flux_direct, &
- soc_flux_down, soc_flux_up, z_half_reshaped
+ soc_flux_down, soc_flux_up, z_half_reshaped, &
+ soc_flux_down_clear, soc_flux_up_clear
real(r_def), dimension(n_profile) :: input_t_surf, input_cos_zenith_angle, input_solar_irrad, &
input_orog_corr, input_planet_albedo
@@ -672,11 +743,13 @@ subroutine socrates_interface(Time_diag, rlat, rlon, soc_lw_mode, &
input_layer_heat_capacity(idx_chunk_start:idx_chunk_end,:), &
input_cld_frac(idx_chunk_start:idx_chunk_end,:), &
input_reff_rad(idx_chunk_start:idx_chunk_end,:), &
- input_mmr_cl_rad(idx_chunk_start:idx_chunk_end,:), &
+ input_mmr_cl_rad(idx_chunk_start:idx_chunk_end,:), &
soc_flux_direct(idx_chunk_start:idx_chunk_end,:), &
- soc_flux_down(idx_chunk_start:idx_chunk_end,:), &
- soc_flux_up(idx_chunk_start:idx_chunk_end,:), &
- soc_heating_rate(idx_chunk_start:idx_chunk_end,:), &
+ soc_flux_down(idx_chunk_start:idx_chunk_end,:), &
+ soc_flux_up(idx_chunk_start:idx_chunk_end,:), &
+ soc_flux_down_clear(idx_chunk_start:idx_chunk_end,:), &
+ soc_flux_up_clear(idx_chunk_start:idx_chunk_end,:), &
+ soc_heating_rate(idx_chunk_start:idx_chunk_end,:), &
soc_spectral_olr(idx_chunk_start:idx_chunk_end,:))
else
@@ -701,10 +774,12 @@ subroutine socrates_interface(Time_diag, rlat, rlon, soc_lw_mode, &
input_layer_heat_capacity(idx_chunk_start:idx_chunk_end,:), &
input_cld_frac(idx_chunk_start:idx_chunk_end,:), &
input_reff_rad(idx_chunk_start:idx_chunk_end,:), &
- input_mmr_cl_rad(idx_chunk_start:idx_chunk_end,:), &
+ input_mmr_cl_rad(idx_chunk_start:idx_chunk_end,:), &
soc_flux_direct(idx_chunk_start:idx_chunk_end,:), &
- soc_flux_down(idx_chunk_start:idx_chunk_end,:), &
- soc_flux_up(idx_chunk_start:idx_chunk_end,:), &
+ soc_flux_down(idx_chunk_start:idx_chunk_end,:), &
+ soc_flux_up(idx_chunk_start:idx_chunk_end,:), &
+ soc_flux_down_clear(idx_chunk_start:idx_chunk_end,:), &
+ soc_flux_up_clear(idx_chunk_start:idx_chunk_end,:), &
soc_heating_rate(idx_chunk_start:idx_chunk_end,:))
endif
@@ -714,6 +789,9 @@ subroutine socrates_interface(Time_diag, rlat, rlon, soc_lw_mode, &
output_flux_up(:,:,:) = reshape(soc_flux_up(:,:),(/si,sj,sk+1 /))
output_flux_down(:,:,:) = reshape(soc_flux_down(:,:),(/si,sj,sk+1 /))
+ output_flux_up_clear(:,:,:) = reshape(soc_flux_up_clear(:,:),(/si,sj,sk+1 /))
+ output_flux_down_clear(:,:,:) = reshape(soc_flux_down_clear(:,:),(/si,sj,sk+1 /))
+
if(present(output_flux_direct)) then
output_flux_direct(:,:,:) = reshape(soc_flux_direct(:,:),(/si,sj,sk+1 /))
endif
@@ -740,7 +818,7 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
real, intent(in), dimension(:,:,:) :: temp_in, p_full_in, q_in, z_full_in
real, intent(in), dimension(:,:,:) :: p_half_in, z_half_in
real, intent(inout), dimension(:,:,:) :: temp_tend
- real, intent(out), dimension(:,:) :: net_surf_sw_down, surf_lw_down
+ real, intent(out), dimension(:,:) :: net_surf_sw_down, surf_lw_down
real, intent(in) :: delta_t
logical, intent(in) :: do_cloud_simple
real, intent(in), dimension(:,:,:) :: cf_rad, reff_rad, qcl_rad
@@ -756,6 +834,11 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
integer :: seconds, days, year_in_s
real :: r_seconds, r_days, r_total_seconds, frac_of_day, frac_of_year, gmt, time_since_ae, rrsun, dt_rad_radians, day_in_s, r_solday, r_dt_rad_avg
real, dimension(size(temp_in,1), size(temp_in,2)) :: coszen, fracsun, surf_lw_net, olr, toa_sw, p2, toa_sw_down, surf_sw_down
+
+ real, dimension(size(temp_in,1), size(temp_in,2)) :: olr_clear, toa_sw_clear, toa_sw_down_clear
+ real, dimension(size(temp_in,1), size(temp_in,2)) :: surf_lw_down_clear, surf_lw_net_clear, &
+ surf_sw_down_clear, net_surf_sw_down_clear
+
real, dimension(size(temp_in,1), size(temp_in,2), size(temp_in,3)) :: ozone_in, co2_in
real, dimension(size(temp_in,1), size(temp_in,2), size(temp_in,3)+1) :: thd_sw_flux_net, thd_lw_flux_net
type(time_type) :: Time_loc
@@ -779,14 +862,25 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
surf_lw_down = real(surf_lw_down_store)
!only required for output
+ if (id_soc_surf_flux_sw_clear > 0) then
+ net_surf_sw_down_clear = net_surf_sw_down_clear_store
+ endif
+
+ if (id_soc_surf_flux_lw_down_clear > 0) then
+ surf_lw_down_clear = surf_lw_down_clear_store
+ endif
+
if (id_soc_surf_flux_lw > 0) then
surf_lw_net = real(surf_lw_net_store)
endif
-
+
+ if (id_soc_surf_flux_lw_clear > 0) then
+ surf_lw_net_clear = surf_lw_net_clear_store
+ endif
+
if (id_soc_flux_lw > 0) then
thd_lw_flux_net = thd_lw_flux_net_store
endif
-
if (id_soc_flux_sw > 0) then
thd_sw_flux_net = thd_sw_flux_net_store
endif
@@ -795,13 +889,32 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
surf_sw_down = surf_sw_down_store
endif
+ if (id_soc_surf_flux_sw_down_clear > 0) then
+ surf_sw_down_clear = surf_sw_down_clear_store
+ endif
+
if (id_soc_olr > 0) then
olr = olr_store
endif
+ if (id_soc_olr_clear > 0) then
+ olr_clear = olr_clear_store
+ endif
+
if (id_soc_toa_sw > 0) then
toa_sw = toa_sw_store
endif
+ if (id_soc_toa_sw_clear > 0) then
+ toa_sw_clear = toa_sw_clear_store
+ endif
+
+ if (id_soc_toa_sw_down > 0) then
+ toa_sw_down = toa_sw_down_store
+ endif
+
+ if (id_soc_toa_sw_down_clear > 0) then
+ toa_sw_down_clear = toa_sw_down_clear_store
+ endif
if (id_soc_toa_sw_down > 0) then
toa_sw_down = toa_sw_down_store
@@ -828,10 +941,14 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
thd_sw_flux_net = 0.
thd_lw_flux_net = 0.
net_surf_sw_down = 0.
+ surf_sw_down = 0.
surf_lw_down = 0.
surf_lw_net = 0.
toa_sw = 0.
+ toa_sw_down = 0.
olr = 0.
+ olr_clear = 0.
+
coszen = 0.
ozone_in = 0.
co2_in = 0.
@@ -842,7 +959,7 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
output_heating_rate_total = output_heating_rate_sw +output_heating_rate_lw
! Send diagnostics
- if(id_soc_tdt_lw > 0) then
+ if(id_soc_tdt_lw > 0) then !heating rate in (Ks-1)
used = send_data ( id_soc_tdt_lw, output_heating_rate_lw, Time_diag)
endif
if(id_soc_tdt_sw > 0) then
@@ -854,24 +971,45 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
if(id_soc_surf_flux_lw > 0) then
used = send_data ( id_soc_surf_flux_lw, surf_lw_net, Time_diag)
endif
+ if(id_soc_surf_flux_lw_clear > 0) then
+ used = send_data ( id_soc_surf_flux_lw_clear, surf_lw_net_clear, Time_diag)
+ endif
if(id_soc_surf_flux_lw_down > 0) then
used = send_data ( id_soc_surf_flux_lw_down, surf_lw_down, Time_diag)
endif
+ if(id_soc_surf_flux_lw_down_clear > 0) then
+ used = send_data ( id_soc_surf_flux_lw_down_clear, surf_lw_down_clear, Time_diag)
+ endif
if(id_soc_surf_flux_sw > 0) then
used = send_data ( id_soc_surf_flux_sw, net_surf_sw_down, Time_diag)
endif
+ if(id_soc_surf_flux_sw_clear > 0) then
+ used = send_data ( id_soc_surf_flux_sw_clear, net_surf_sw_down_clear, Time_diag)
+ endif
if(id_soc_surf_flux_sw_down > 0) then
used = send_data ( id_soc_surf_flux_sw_down, surf_sw_down, Time_diag)
endif
+ if(id_soc_surf_flux_sw_down_clear > 0) then
+ used = send_data ( id_soc_surf_flux_sw_down_clear, surf_sw_down_clear, Time_diag)
+ endif
if(id_soc_olr > 0) then
used = send_data ( id_soc_olr, olr, Time_diag)
endif
+ if(id_soc_olr_clear > 0) then
+ used = send_data ( id_soc_olr_clear, olr_clear, Time_diag)
+ endif
if(id_soc_toa_sw > 0) then
used = send_data ( id_soc_toa_sw, toa_sw, Time_diag)
endif
+ if(id_soc_toa_sw_clear > 0) then
+ used = send_data ( id_soc_toa_sw_clear, toa_sw_clear, Time_diag)
+ endif
if(id_soc_toa_sw_down > 0) then
used = send_data ( id_soc_toa_sw_down, toa_sw_down, Time_diag)
endif
+ if(id_soc_toa_sw_down_clear > 0) then
+ used = send_data ( id_soc_toa_sw_down_clear, toa_sw_down_clear, Time_diag)
+ endif
if(id_soc_flux_lw > 0) then
used = send_data ( id_soc_flux_lw, thd_lw_flux_net, Time_diag)
endif
@@ -1019,6 +1157,7 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
p_half_soc, z_full_soc, z_half_soc, albedo_soc, coszen, rrsun, &
n_profile, n_layer, cld_frac_soc, reff_rad_soc, mmr_cl_rad_soc, &
output_heating_rate_lw, output_soc_flux_lw_down, output_soc_flux_lw_up, &
+ output_soc_flux_lw_down_clear, output_soc_flux_lw_up_clear, &
do_cloud_simple, &
!optional outs
output_soc_spectral_olr = outputted_soc_spectral_olr, &
@@ -1027,9 +1166,16 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
tg_tmp_soc = tg_tmp_soc + output_heating_rate_lw*delta_t !Output heating rate in K/s, so is a temperature tendency
surf_lw_down(:,:) = REAL(output_soc_flux_lw_down(:,:, n_layer+1))
- surf_lw_net(:,:) = REAL(output_soc_flux_lw_up(:,:,n_layer+1) - output_soc_flux_lw_down(:,:, n_layer+1))
- olr(:,:) = REAL(output_soc_flux_lw_up(:,:,1))
- thd_lw_flux_net = REAL(output_soc_flux_lw_up - output_soc_flux_lw_down)
+ surf_lw_down_clear(:,:) = REAL(output_soc_flux_lw_down_clear(:,:, n_layer+1))
+
+ surf_lw_net(:,:) = REAL(output_soc_flux_lw_up(:,:,n_layer+1) - &
+ output_soc_flux_lw_down(:,:, n_layer+1))
+ surf_lw_net_clear(:,:) = REAL(output_soc_flux_lw_up_clear(:,:,n_layer+1) - &
+ output_soc_flux_lw_down_clear(:,:, n_layer+1))
+ olr(:,:) = REAL(output_soc_flux_lw_up(:,:,1))
+ olr_clear(:,:) = REAL(output_soc_flux_lw_up_clear(:,:,1))
+
+ thd_lw_flux_net = REAL(output_soc_flux_lw_up - output_soc_flux_lw_down)
temp_tend(:,:,:) = temp_tend(:,:,:) + real(output_heating_rate_lw)
@@ -1042,16 +1188,28 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
p_half_soc, z_full_soc, z_half_soc, albedo_soc, coszen, rrsun, &
n_profile, n_layer, cld_frac_soc, reff_rad_soc, mmr_cl_rad_soc, &
output_heating_rate_sw, output_soc_flux_sw_down, output_soc_flux_sw_up, &
+ output_soc_flux_sw_down_clear, output_soc_flux_sw_up_clear, &
do_cloud_simple)
tg_tmp_soc = tg_tmp_soc + output_heating_rate_sw*delta_t !Output heating rate in K/s, so is a temperature tendency
- net_surf_sw_down(:,:) = REAL(output_soc_flux_sw_down(:,:, n_layer+1)-output_soc_flux_sw_up(:,:,n_layer+1) )
- surf_sw_down(:,:) = REAL(output_soc_flux_sw_down(:,:, n_layer+1))
- toa_sw(:,:) = REAL(output_soc_flux_sw_down(:,:,1)-output_soc_flux_sw_up(:,:,1))
- toa_sw_down(:,:) = REAL(output_soc_flux_sw_down(:,:,1))
- thd_sw_flux_net = REAL(output_soc_flux_sw_up - output_soc_flux_sw_down)
+ net_surf_sw_down(:,:) = REAL(output_soc_flux_sw_down(:,:, n_layer+1) - &
+ output_soc_flux_sw_up(:,:,n_layer+1) )
+ net_surf_sw_down_clear(:,:) = REAL(output_soc_flux_sw_down_clear(:,:, n_layer+1) - &
+ output_soc_flux_sw_up_clear(:,:,n_layer+1) )
+
+ toa_sw(:,:) = REAL(output_soc_flux_sw_down(:,:,1) - &
+ output_soc_flux_sw_up(:,:,1))
+ toa_sw_clear(:,:) = REAL(output_soc_flux_sw_down_clear(:,:,1) - &
+ output_soc_flux_sw_up_clear(:,:,1))
+
+ thd_sw_flux_net = REAL(output_soc_flux_sw_up - output_soc_flux_sw_down) !net sw all levels
+
+ toa_sw_down(:,:) = REAL(output_soc_flux_sw_down(:,:,1))
+ toa_sw_down_clear(:,:) = REAL(output_soc_flux_sw_down_clear(:,:,1))
+ surf_sw_down(:,:) = REAL(output_soc_flux_sw_down(:,:, n_layer+1))
+ surf_sw_down_clear(:,:) = REAL(output_soc_flux_sw_down_clear(:,:, n_layer+1))
temp_tend(:,:,:) = temp_tend(:,:,:) + real(output_heating_rate_sw)
@@ -1065,10 +1223,6 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
surf_lw_down_store = real(surf_lw_down, kind(r_def))
! required for output
- if (id_soc_surf_flux_lw > 0) then
- surf_lw_net_store = real(surf_lw_net, kind(r_def))
- endif
-
if (id_soc_flux_lw > 0) then
thd_lw_flux_net_store = thd_lw_flux_net
endif
@@ -1085,10 +1239,26 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
toa_sw_down_store = toa_sw_down
endif
+ if (id_soc_surf_flux_lw > 0) then
+ surf_lw_net_store = real(surf_lw_net, kind(r_def))
+ endif
+
+ if (id_soc_surf_flux_sw_down > 0) then
+ surf_sw_down_store = surf_sw_down
+ endif
+
+ if (id_soc_toa_sw_down > 0) then
+ toa_sw_down_store = toa_sw_down
+ endif
+
if (id_soc_olr > 0) then
olr_store = olr
endif
+ if (id_soc_olr_clear > 0) then
+ olr_clear_store = olr_clear
+ endif
+
if (id_soc_toa_sw > 0) then
toa_sw_store = toa_sw
endif
@@ -1124,6 +1294,9 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
if(id_soc_surf_flux_lw > 0) then
used = send_data ( id_soc_surf_flux_lw, surf_lw_net, Time_diag)
endif
+ if(id_soc_surf_flux_lw_down > 0) then
+ used = send_data ( id_soc_surf_flux_lw_down, surf_lw_down, Time_diag)
+ endif
if(id_soc_surf_flux_sw > 0) then
used = send_data ( id_soc_surf_flux_sw, net_surf_sw_down, Time_diag)
endif
@@ -1133,6 +1306,9 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
if(id_soc_olr > 0) then
used = send_data ( id_soc_olr, olr, Time_diag)
endif
+ if(id_soc_olr_clear > 0) then
+ used = send_data ( id_soc_olr_clear, olr_clear, Time_diag)
+ endif
if(id_soc_toa_sw > 0) then
used = send_data ( id_soc_toa_sw, toa_sw, Time_diag)
endif
From 10d541ac71f125519ebd088a185a38a684ac083c Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Thu, 28 Mar 2019 13:40:55 +0000
Subject: [PATCH 110/304] Implement protocol 2 for spookie-2 and debugging
clear sky diagnostics
---
.../socrates_aquaplanet_with_cloud.py | 10 +-
src/atmos_param/cloud_simple/cloud_simple.F90 | 168 +++++++++++++-----
.../socrates/interface/socrates_calc.F90 | 16 +-
.../socrates/interface/socrates_interface.F90 | 74 ++++++--
.../driver/solo/idealized_moist_phys.F90 | 8 +-
5 files changed, 205 insertions(+), 71 deletions(-)
diff --git a/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
index f3c189127..3e8e3813d 100644
--- a/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
+++ b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
@@ -5,7 +5,7 @@
from isca import SocratesCodeBase, DiagTable, Experiment, Namelist, GFDL_BASE
from isca.util import exp_progress
-NCORES = 8
+NCORES = 16
base_dir = os.path.dirname(os.path.realpath(__file__))
# a CodeBase can be a directory on the computer,
# useful for iterative development
@@ -74,13 +74,13 @@
diag.add_field('cloud_simple', 'reff_rad', time_avg=True)
diag.add_field('cloud_simple', 'frac_liq', time_avg=True)
diag.add_field('cloud_simple', 'qcl_rad', time_avg=True)
-diag.add_field('cloud_simple', 'simple_rhcrit', time_avg=True)
+#diag.add_field('cloud_simple', 'simple_rhcrit', time_avg=True)
+diag.add_field('cloud_simple', 'rh_min', time_avg=True)
diag.add_field('cloud_simple', 'rh_in_cf', time_avg=True)
-
# additional output options commented out
-diag.add_field('socrates', 'soc_flux_lw', time_avg=True)
-diag.add_field('socrates', 'soc_flux_sw', time_avg=True)
+#diag.add_field('socrates', 'soc_flux_lw', time_avg=True)
+#diag.add_field('socrates', 'soc_flux_sw', time_avg=True)
#diag.add_field('socrates', 'soc_co2', time_avg=True)
#diag.add_field('socrates', 'soc_ozone', time_avg=True)
#diag.add_field('socrates', 'soc_coszen', time_avg=True)
diff --git a/src/atmos_param/cloud_simple/cloud_simple.F90 b/src/atmos_param/cloud_simple/cloud_simple.F90
index b27ba5788..b51cc84fe 100644
--- a/src/atmos_param/cloud_simple/cloud_simple.F90
+++ b/src/atmos_param/cloud_simple/cloud_simple.F90
@@ -17,19 +17,39 @@ module cloud_simple_mod
logical :: do_init = .true. ! Check if init needs to be run
real :: simple_cca = 0.0
- real :: rhcsfc = 0.95
- real :: rhc700 = 0.7
- real :: rhc200 = 0.3
+
+ ! Critical RH (fraction) values - spookie protocol 1 only
+ real :: rhc_sfc = 0.95
+ real :: rhc_base = 0.7
+ real :: rhc_top = 0.3
+ !
real :: rhmsfc = 0.95
real :: rhm700 = 0.7
real :: rhm200 = 0.3
- namelist /cloud_simple_nml/ simple_cca, rhcsfc, rhc700, rhc200, &
- rhmsfc, rhm700, rhm200
+ ! Critical RH (fraction) values - spookie protocol 2 only
+ real :: rh_min_top = 0.9
+ real :: rh_min_sfc = 1.0
+ real :: rh_min_base = 0.8
+ real :: rh_max_top = 1.0
+ real :: rh_max_sfc = 1.0
+ real :: rh_max_base = 1.0
+
+ ! Pressure (Pa.) at cloud bottom and top (very approx)
+ real :: p_base = 70000.
+ real :: p_top = 20000.
+
+ integer :: spookie_protocol = 2
+
+ namelist /cloud_simple_nml/ simple_cca, rhc_sfc, rhc_base, rhc_top, &
+ rhmsfc, rhm700, rhm200, &
+ rh_min_top, rh_min_sfc, rh_min_base, &
+ rh_max_top, rh_max_sfc, rh_max_base
+
real :: zerodegc = 273.15
- integer :: id_cf, id_reff_rad, id_frac_liq, id_qcl_rad, id_rh_in_cf, id_simple_rhcrit
-
+ integer :: id_cf, id_reff_rad, id_frac_liq, id_qcl_rad, id_rh_in_cf, &
+ id_simple_rhcrit, id_rh_min
character(len=14), parameter :: mod_name_cld = "cloud_simple"
@@ -86,11 +106,13 @@ subroutine cloud_simple_init (axes, Time)
id_simple_rhcrit = &
register_diag_field ( mod_name_cld, 'simple_rhcrit', axes(1:3), Time, &
- 'RH as a percent', &
+ 'RH as a percent for spookie protocol 1', &
'%')
-
-
+ id_rh_min = &
+ register_diag_field ( mod_name_cld, 'rh_min', axes(1:3), Time, &
+ 'RH as a percent for spookie protocol 2', &
+ '%')
do_init = .false. !initialisation completed
@@ -102,14 +124,14 @@ end subroutine cloud_simple_init
subroutine cloud_simple(p_half, p_full, Time, &
temp, q_hum, &
! outs
- cf, reff_rad, qcl_rad )
+ cf, cca, reff_rad, qcl_rad)
real , intent(in), dimension(:,:,:) :: temp, q_hum, p_full, p_half
type(time_type) , intent(in) :: Time
- real , intent(out), dimension(:,:,:) :: cf, reff_rad, qcl_rad
+ real , intent(out), dimension(:,:,:) :: cf, reff_rad, qcl_rad, cca
- real, dimension(size(temp,1), size(temp, 2), size(temp, 3)) :: qs, frac_liq, rh_in_cf, simple_rhcrit
+ real, dimension(size(temp,1), size(temp, 2), size(temp, 3)) :: qs, frac_liq, rh_in_cf, simple_rhcrit, rh_min, rh_max
integer :: i, j, k, k_surf
@@ -133,16 +155,26 @@ subroutine cloud_simple(p_half, p_full, Time, &
! the simple cloud scheme and cloud fraction.
! rh_in_cf is an output diagnostic only for debugging
call calc_liq_frac(temp(i,j,k), frac_liq(i,j,k))
+
call calc_reff(frac_liq(i,j,k), reff_rad(i,j,k))
- call calc_rhcrit(p_full(i,j,k), p_full(i,j,k_surf), simple_rhcrit(i,j,k))
- call calc_cf(q_hum(i,j,k), qs(i,j,k), simple_rhcrit(i,j,k), cf(i,j,k),rh_in_cf(i,j,k))
- call calc_qcl_rad(p_full(i,j,k), cf(i,j,k), qcl_rad(i,j,k) )
+
+ if (spookie_protocol .eq. 1) then
+ call calc_rhcrit(p_full(i,j,k), p_full(i,j,k_surf), simple_rhcrit(i,j,k))
+ else
+ call calc_rh_min_max(p_full(i,j,k), p_full(i,j,k_surf),rh_min(i,j,k), rh_max(i,j,k))
+ endif
+
+ call calc_cf(q_hum(i,j,k), qs(i,j,k), cf(i,j,k), cca(i,j,k), rh_in_cf(i,j,k), &
+ simple_rhcrit = simple_rhcrit(i,j,k), &
+ rh_min = rh_min(i,j,k), rh_max = rh_max(i,j,k) )
+
+ call calc_qcl_rad(p_full(i,j,k), cf(i,j,k), temp(i,j,k), qcl_rad(i,j,k) )
end do
end do
end do
!save some diagnotics
- call output_cloud_diags(cf, reff_rad, frac_liq, qcl_rad, rh_in_cf, simple_rhcrit, Time )
+ call output_cloud_diags(cf, reff_rad, frac_liq, qcl_rad, rh_in_cf, simple_rhcrit, rh_min, Time )
end subroutine cloud_simple
@@ -176,71 +208,111 @@ subroutine calc_reff(frac_liq, reff_rad)
end subroutine calc_reff
subroutine calc_rhcrit(p_full, p_surf, simple_rhcrit) !need to check p_full - > p_layer_centres
- !get the RH needed as a threshold for the cloud fraction calc.
+ ! get the RH needed as a threshold for the cloud fraction calc.
+ ! This is only requires for spookie_protocol=1
real, intent(in) :: p_full, p_surf
real, intent(out) :: simple_rhcrit
! Calculate RHcrit as function of pressure
- if (p_full > 70000.0 ) then
+ if (p_full > p_base ) then
- simple_rhcrit = rhcsfc - ( rhcsfc - rhc700 ) * &
- ( p_surf - p_full ) / ( p_surf - 70000.0 )
+ simple_rhcrit = rhc_sfc - ( rhc_sfc - rhc_base ) * &
+ ( p_surf - p_full ) / ( p_surf - p_base )
- else if ( p_full > 20000.0 ) then
+ else if ( p_full > p_top ) then
- simple_rhcrit = rhc700 - ( rhc700 - rhc200 ) * &
- ( 70000.0 - p_full) / 50000.0
+ simple_rhcrit = rhc_base - ( rhc_base - rhc_top ) * &
+ (p_base - p_full) / (p_base - p_top)
else
- simple_rhcrit = rhc200
+ simple_rhcrit = rhc_top
endif
end subroutine calc_rhcrit
- subroutine calc_cf (q_hum, qsat, simple_rhcrit, cf, rh)
+ subroutine calc_rh_min_max(p_full, p_surf, rh_min, rh_max)
+
+ real, intent(in) :: p_full, p_surf
+ real, intent(out) :: rh_min, rh_max
+
+
+ if (p_full > p_base ) then !surface up to base
+
+ rh_min = rh_min_sfc - ( rh_min_sfc - rh_min_base ) * ( p_surf - p_full ) / ( p_surf - p_base )
+ rh_max = rh_max_sfc - ( rh_max_sfc - rh_max_base ) * ( p_surf - p_full ) / ( p_surf - p_base )
+
+ else if ( p_full > p_top ) then ! base up to top
+
+ rh_min = rh_min_base - ( rh_min_base - rh_min_top ) * (p_base - p_full) / (p_base - p_top)
+ rh_max = rh_max_base - ( rh_max_base - rh_max_top ) * (p_base - p_full) / (p_base - p_top)
+
+ else ! above top
+
+ rh_min = rh_min_top
+ rh_max = rh_max_top
+
+ endif
+
+
+ end subroutine calc_rh_min_max
+
+ subroutine calc_cf(q_hum, qsat, cf, cca, rh, simple_rhcrit, rh_min, rh_max)
! Calculate LS (stratiform) cloud fraction
! as a simple linear function of RH
- real, intent(in) :: q_hum, qsat, simple_rhcrit
- real, intent(out) :: cf, rh
-
- real :: cca
+ real, intent(in) :: q_hum, qsat
+ real, intent(in), optional :: simple_rhcrit, rh_min, rh_max
+
+ real, intent(out) :: cf, rh, cca
rh = q_hum/qsat
- cf = MAX( 0.0, MIN( 1.0, ( rh - simple_rhcrit ) / ( 1.0 - simple_rhcrit ) ))
+ if (spookie_protocol .eq. 1) then
+ cf = (rh - simple_rhcrit ) / ( 1.0 - simple_rhcrit )
+ cf = MAX( 0.0, MIN( 1.0, cf))
+
+ else
+ cf = (rh - rh_min ) / ( rh_max - rh_min )
+ cf = MAX( 0.0, MIN( 1.0, cf))
+ end if
! include simple convective cloud fraction where present (not currenly used)
cca = 0.0 ! no convective cloud fraction is calculated
- ! left in for future use
+ ! left in for future use
if (cca > 0.0) then
- cf = MAX( simple_cca, cf )
+ cf = MAX( simple_cca, cf )
end if
-
+
end subroutine calc_cf
- subroutine calc_qcl_rad(p_full, cf, qcl_rad)
+ subroutine calc_qcl_rad(p_full, cf, temp, qcl_rad)
! calculate cloud water content
- real , intent(in) :: p_full, cf
- real , intent(out) :: qcl_rad
+ real , intent(in) :: p_full, cf, temp
+ real , intent(out) :: qcl_rad
real :: in_cloud_qcl
-
- in_cloud_qcl = 3.0e-4 + &
- (1.0-3.0e-4)*(p_full-20000.0)/80000.0
-
- in_cloud_qcl = MAX ( 0.0, in_cloud_qcl/1000.0 ) ! convert to kg/kg
-
- qcl_rad = cf * in_cloud_qcl
+
+ IF (spookie_protocol .eq. 1) THEN
+ ! pressure dependent in_cloud_qcl
+ in_cloud_qcl = 3.0e-4 + (1.0-3.0e-4)*(p_full-p_top)/80000.0
+ in_cloud_qcl = MAX ( 0.0, in_cloud_qcl/1000.0 ) ! convert to kg/kg
+ qcl_rad = cf * in_cloud_qcl
+ ELSE
+ ! temperatue dependent in_cloud_qcl
+ in_cloud_qcl = MIN(0.2, 0.2 * ( temp - 220. ) / ( 280. -220. ))
+ in_cloud_qcl = MAX (3.0e-4, in_cloud_qcl/1000.0 ) ! convert to kg/kg
+ qcl_rad = cf * in_cloud_qcl
+ ENDIF
end subroutine calc_qcl_rad
- subroutine output_cloud_diags(cf, reff_rad, frac_liq, qcl_rad, rh_in_cf, simple_rhcrit, Time)
+ subroutine output_cloud_diags(cf, reff_rad, frac_liq, qcl_rad, rh_in_cf, simple_rhcrit, rh_min, Time)
- real, intent(in), dimension(:,:,:) :: cf, reff_rad, frac_liq, qcl_rad, rh_in_cf, simple_rhcrit
+ real, intent(in), dimension(:,:,:) :: cf, reff_rad, frac_liq, qcl_rad, rh_in_cf
+ real, intent(in), dimension(:,:,:), optional :: simple_rhcrit, rh_min
type(time_type) , intent(in) :: Time
@@ -270,6 +342,10 @@ subroutine output_cloud_diags(cf, reff_rad, frac_liq, qcl_rad, rh_in_cf, simple_
used = send_data ( id_simple_rhcrit, simple_rhcrit*100.0, Time)
endif
+ if ( id_rh_min > 0 ) then
+ used = send_data ( id_rh_min, rh_min*100.0, Time)
+ endif
+
end subroutine output_cloud_diags
subroutine cloud_simple_end ()
diff --git a/src/atmos_param/socrates/interface/socrates_calc.F90 b/src/atmos_param/socrates/interface/socrates_calc.F90
index f50910a25..5474d0d5f 100644
--- a/src/atmos_param/socrates/interface/socrates_calc.F90
+++ b/src/atmos_param/socrates/interface/socrates_calc.F90
@@ -33,7 +33,7 @@ subroutine socrates_calc(Time_diag,control, spectrum, &
t_rad_surf, cos_zenith_angle, solar_irrad, orog_corr, &
l_planet_grey_surface, planet_albedo, planet_emissivity, &
layer_heat_capacity, &
- cld_frac, reff_rad, mmr_cl_rad, &
+ cld_frac, cld_conv_frac, reff_rad, mmr_cl_rad, &
flux_direct, flux_down, flux_up, &
flux_down_clear, flux_up_clear, &
heating_rate, spectral_olr)
@@ -118,7 +118,10 @@ subroutine socrates_calc(Time_diag,control, spectrum, &
! Heat capacity of layer
real(r_def), intent(in) :: cld_frac(n_profile, n_layer)
-! Cloud fraction at layer centres
+! Cloud fraction at layer centres for stratocumulus cloud
+
+real(r_def), intent(in) :: cld_conv_frac(n_profile, n_layer)
+! Cloud fraction at layer centres for convective cloud
real(r_def), intent(in) :: reff_rad(n_profile, n_layer)
! Cloud liquid particle radius from simple cloud scheme
@@ -185,11 +188,12 @@ subroutine socrates_calc(Time_diag,control, spectrum, &
zeros_cld = 0.
ten_microns_cld = 1.
call set_cld(cld, control, dimen, spectrum, n_profile, n_layer, &
+ conv_frac = cld_conv_frac,&
liq_frac = cld_frac, &
- ice_frac = zeros_cld, &
- liq_mmr = mmr_cl_rad, &
- ice_mmr = zeros_cld, &
- liq_dim = reff_rad, &
+ ice_frac = zeros_cld, &
+ liq_mmr = mmr_cl_rad, &
+ ice_mmr = zeros_cld, &
+ liq_dim = reff_rad, &
ice_dim = zeros_cld )
call set_aer(control, dimen, spectrum, aer, n_profile)
diff --git a/src/atmos_param/socrates/interface/socrates_interface.F90 b/src/atmos_param/socrates/interface/socrates_interface.F90
index 5ea0e5f13..4b219e4a3 100644
--- a/src/atmos_param/socrates/interface/socrates_interface.F90
+++ b/src/atmos_param/socrates/interface/socrates_interface.F90
@@ -84,7 +84,7 @@ MODULE socrates_interface_mod
toa_sw_down_store
REAL(r_def), allocatable, dimension(:,:) :: net_surf_sw_down_clear_store, surf_sw_down_clear_store, &
surf_lw_down_clear_store, surf_lw_net_clear_store, &
- toa_sw_clear_store, olr_clear_store, toa_sw_down_clear_store
+ toa_sw_clear_store, olr_clear_store, toa_sw_down_clear_store
REAL(r_def), allocatable, dimension(:,:,:) :: outputted_soc_spectral_olr, spectral_olr_store
REAL(r_def), allocatable, dimension(:) :: soc_bins_lw, soc_bins_sw
@@ -274,7 +274,7 @@ SUBROUTINE socrates_init(is, ie, js, je, num_levels, axes, Time, lat, lonb, latb
'socrates Net LW surface flux (up) clear sky', &
'watts/m2', missing_value=missing_value )
- id_soc_surf_flux_lw_down = &
+ id_soc_surf_flux_lw_down = &
register_diag_field ( soc_mod_name, 'soc_surf_flux_lw_down', axes(1:2), Time, &
'socrates LW surface flux down', &
'watts/m2', missing_value=missing_value )
@@ -504,7 +504,7 @@ subroutine socrates_interface(Time_diag, rlat, rlon, soc_lw_mode, &
fms_temp, fms_spec_hum, fms_ozone, fms_co2, fms_t_surf, &
fms_p_full, fms_p_half, fms_z_full, fms_z_half, fms_albedo, &
fms_coszen, fms_rrsun, n_profile, n_layer, &
- fms_cld_frac, fms_reff_rad, fms_mmr_cl_rad, &
+ fms_cld_frac, fms_cld_conv_frac, fms_reff_rad, fms_mmr_cl_rad,&
output_heating_rate, output_flux_down, output_flux_up, &
output_flux_down_clear, output_flux_up_clear, &
do_cloud_simple, &
@@ -549,6 +549,7 @@ subroutine socrates_interface(Time_diag, rlat, rlon, soc_lw_mode, &
real(r_def), intent(in) :: fms_z_full(:,:,:), fms_z_half(:,:,:)
real(r_def), intent(in) :: fms_rrsun
real(r_def), intent(in) :: fms_cld_frac(:,:,:), fms_reff_rad(:,:,:), fms_mmr_cl_rad(:,:,:)
+ real(r_def), intent(in) :: fms_cld_conv_frac(:,:,:)
logical, intent(in) :: do_cloud_simple
@@ -571,7 +572,8 @@ subroutine socrates_interface(Time_diag, rlat, rlon, soc_lw_mode, &
real(r_def), dimension(n_profile, n_layer) :: input_p, input_t, input_mixing_ratio, &
input_d_mass, input_density, input_layer_heat_capacity, &
soc_heating_rate, input_o3_mixing_ratio, &
- input_co2_mixing_ratio,z_full_reshaped, input_cld_frac, input_reff_rad, input_mmr_cl_rad
+ input_co2_mixing_ratio,z_full_reshaped, input_cld_frac, input_reff_rad, input_mmr_cl_rad, &
+ input_cld_conv_frac
real(r_def), dimension(n_profile, 0:n_layer) :: input_p_level, input_t_level, soc_flux_direct, &
soc_flux_down, soc_flux_up, z_half_reshaped, &
@@ -618,6 +620,8 @@ subroutine socrates_interface(Time_diag, rlat, rlon, soc_lw_mode, &
input_p_level = reshape(fms_p_half(:,:,:),(/si*sj,sk+1 /))
input_cld_frac = reshape(fms_cld_frac(:,:,:),(/si*sj,sk /))
+ input_cld_conv_frac = reshape(fms_cld_conv_frac(:,:,:),(/si*sj,sk /))
+
input_reff_rad = reshape(fms_reff_rad(:,:,:),(/si*sj,sk /))
input_mmr_cl_rad = reshape(fms_mmr_cl_rad(:,:,:),(/si*sj,sk/))
@@ -742,6 +746,7 @@ subroutine socrates_interface(Time_diag, rlat, rlon, soc_lw_mode, &
input_planet_emissivity, &
input_layer_heat_capacity(idx_chunk_start:idx_chunk_end,:), &
input_cld_frac(idx_chunk_start:idx_chunk_end,:), &
+ input_cld_conv_frac(idx_chunk_start:idx_chunk_end,:), &
input_reff_rad(idx_chunk_start:idx_chunk_end,:), &
input_mmr_cl_rad(idx_chunk_start:idx_chunk_end,:), &
soc_flux_direct(idx_chunk_start:idx_chunk_end,:), &
@@ -773,6 +778,7 @@ subroutine socrates_interface(Time_diag, rlat, rlon, soc_lw_mode, &
input_planet_emissivity, &
input_layer_heat_capacity(idx_chunk_start:idx_chunk_end,:), &
input_cld_frac(idx_chunk_start:idx_chunk_end,:), &
+ input_cld_conv_frac(idx_chunk_start:idx_chunk_end,:), &
input_reff_rad(idx_chunk_start:idx_chunk_end,:), &
input_mmr_cl_rad(idx_chunk_start:idx_chunk_end,:), &
soc_flux_direct(idx_chunk_start:idx_chunk_end,:), &
@@ -805,7 +811,7 @@ subroutine socrates_interface(Time_diag, rlat, rlon, soc_lw_mode, &
end subroutine socrates_interface
subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf_in, p_full_in, p_half_in, z_full_in, z_half_in, albedo_in, &
- temp_tend, net_surf_sw_down, surf_lw_down, delta_t, do_cloud_simple, cf_rad, reff_rad, qcl_rad)
+ temp_tend, net_surf_sw_down, surf_lw_down, delta_t, do_cloud_simple, cf_rad, cca_rad, reff_rad, qcl_rad)
use astronomy_mod, only: diurnal_solar
use constants_mod, only: pi, wtmco2, wtmozone, rdgas, gas_constant
@@ -821,12 +827,13 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
real, intent(out), dimension(:,:) :: net_surf_sw_down, surf_lw_down
real, intent(in) :: delta_t
logical, intent(in) :: do_cloud_simple
- real, intent(in), dimension(:,:,:) :: cf_rad, reff_rad, qcl_rad
+ real, intent(in), dimension(:,:,:) :: cf_rad, cca_rad, reff_rad, qcl_rad
integer(i_def) :: n_profile, n_layer
real(r_def), dimension(size(temp_in,1), size(temp_in,2)) :: t_surf_for_soc, rad_lat_soc, rad_lon_soc, albedo_soc
real(r_def), dimension(size(temp_in,1), size(temp_in,2), size(temp_in,3)) :: tg_tmp_soc, q_soc, ozone_soc, co2_soc, p_full_soc, output_heating_rate_sw, output_heating_rate_lw, output_heating_rate_total, z_full_soc
+ real(r_def), dimension(size(temp_in,1), size(temp_in,2), size(temp_in,3)) :: cld_conv_frac_soc
real(r_def), dimension(size(temp_in,1), size(temp_in,2), size(temp_in,3)) :: output_soc_flux_sw_down, output_soc_flux_sw_up, output_soc_flux_lw_down, output_soc_flux_lw_up, cld_frac_soc, reff_rad_soc, mmr_cl_rad_soc, qcl_rad_soc
real(r_def), dimension(size(temp_in,1), size(temp_in,2), size(temp_in,3)+1) :: p_half_soc, t_half_out, z_half_soc
@@ -936,19 +943,36 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
outputted_soc_spectral_olr = spectral_olr_store
endif
else
+ !all sky heating rates.
output_heating_rate_sw = 0.
output_heating_rate_lw = 0.
+
+ !all sky and clear sky fluxes.
thd_sw_flux_net = 0.
thd_lw_flux_net = 0.
+
net_surf_sw_down = 0.
+ net_surf_sw_down_clear = 0.
+
surf_sw_down = 0.
+ surf_sw_down_clear = 0.
+
surf_lw_down = 0.
+ surf_lw_down_clear = 0.
+
surf_lw_net = 0.
+ surf_lw_net_clear = 0.
+
toa_sw = 0.
+ toa_sw_clear = 0.
+
toa_sw_down = 0.
+ toa_sw_down_clear = 0.
+
olr = 0.
olr_clear = 0.
+ !Others
coszen = 0.
ozone_in = 0.
co2_in = 0.
@@ -1120,6 +1144,8 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
if(do_cloud_simple) then
cld_frac_soc = REAL(cf_rad, kind(r_def))
+ cld_conv_frac_soc = REAL(cca_rad, kind(r_def))
+
reff_rad_soc = REAL(reff_rad, kind(r_def))
qcl_rad_soc = REAL(qcl_rad, kind(r_def))
@@ -1127,6 +1153,8 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
else
cld_frac_soc = 0.
+ cld_conv_frac_soc = 0.
+
reff_rad_soc = 0.
mmr_cl_rad_soc = 0.
@@ -1155,7 +1183,7 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
CALL socrates_interface(Time, rad_lat_soc, rad_lon_soc, soc_lw_mode, &
tg_tmp_soc, q_soc, ozone_soc, co2_soc, t_surf_for_soc, p_full_soc, &
p_half_soc, z_full_soc, z_half_soc, albedo_soc, coszen, rrsun, &
- n_profile, n_layer, cld_frac_soc, reff_rad_soc, mmr_cl_rad_soc, &
+ n_profile, n_layer, cld_frac_soc, cld_conv_frac_soc, reff_rad_soc, mmr_cl_rad_soc,&
output_heating_rate_lw, output_soc_flux_lw_down, output_soc_flux_lw_up, &
output_soc_flux_lw_down_clear, output_soc_flux_lw_up_clear, &
do_cloud_simple, &
@@ -1165,7 +1193,7 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
tg_tmp_soc = tg_tmp_soc + output_heating_rate_lw*delta_t !Output heating rate in K/s, so is a temperature tendency
- surf_lw_down(:,:) = REAL(output_soc_flux_lw_down(:,:, n_layer+1))
+ surf_lw_down(:,:) = REAL(output_soc_flux_lw_down(:,:, n_layer+1))
surf_lw_down_clear(:,:) = REAL(output_soc_flux_lw_down_clear(:,:, n_layer+1))
surf_lw_net(:,:) = REAL(output_soc_flux_lw_up(:,:,n_layer+1) - &
@@ -1186,7 +1214,7 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
CALL socrates_interface(Time, rad_lat_soc, rad_lon_soc, soc_lw_mode, &
tg_tmp_soc, q_soc, ozone_soc, co2_soc, t_surf_for_soc, p_full_soc, &
p_half_soc, z_full_soc, z_half_soc, albedo_soc, coszen, rrsun, &
- n_profile, n_layer, cld_frac_soc, reff_rad_soc, mmr_cl_rad_soc, &
+ n_profile, n_layer, cld_frac_soc, cld_conv_frac_soc, reff_rad_soc, mmr_cl_rad_soc, &
output_heating_rate_sw, output_soc_flux_sw_down, output_soc_flux_sw_up, &
output_soc_flux_sw_down_clear, output_soc_flux_sw_up_clear, &
do_cloud_simple)
@@ -1347,7 +1375,33 @@ subroutine run_socrates_end
if(do_read_ozone) call interpolator_end(o3_interp)
if(do_read_co2) call interpolator_end(co2_interp)
-
+
+ DEALLOCATE(soc_bins_lw)
+ DEALLOCATE(soc_bins_sw)
+ DEALLOCATE(outputted_soc_spectral_olr)
+ DEALLOCATE(tdt_soc_sw_store)
+ DEALLOCATE(tdt_soc_lw_store)
+ DEALLOCATE(net_surf_sw_down_store)
+ DEALLOCATE(surf_lw_down_store)
+
+ if (id_soc_flux_lw > 0) DEALLOCATE(thd_lw_flux_net_store)
+ if (id_soc_flux_sw > 0) DEALLOCATE(thd_sw_flux_net_store)
+ if (id_soc_surf_flux_sw_clear > 0) DEALLOCATE(net_surf_sw_down_clear_store)
+ if (id_soc_surf_flux_lw_down_clear > 0) DEALLOCATE(surf_lw_down_clear_store)
+ if (id_soc_surf_flux_lw > 0) DEALLOCATE(surf_lw_net_store)
+ if (id_soc_surf_flux_lw_clear > 0) DEALLOCATE(surf_lw_net_clear_store)
+ if (id_soc_surf_flux_sw_down > 0) DEALLOCATE(surf_sw_down_store)
+ if (id_soc_surf_flux_sw_down_clear > 0) DEALLOCATE(surf_sw_down_clear_store)
+ if (id_soc_olr > 0) DEALLOCATE(olr_store)
+ if (id_soc_olr_clear > 0) DEALLOCATE(olr_clear_store)
+ if (id_soc_toa_sw > 0) DEALLOCATE(toa_sw_store)
+ if (id_soc_toa_sw_clear > 0) DEALLOCATE(toa_sw_clear_store)
+ if (id_soc_toa_sw_down > 0) DEALLOCATE(toa_sw_down_store)
+ if (id_soc_toa_sw_down_clear > 0) DEALLOCATE(toa_sw_down_clear_store)
+ if (id_soc_coszen > 0) DEALLOCATE(coszen_store)
+ if (id_soc_ozone > 0) DEALLOCATE(thd_ozone_store)
+ if (id_soc_co2 > 0 ) DEALLOCATE(thd_co2_store)
+ if (id_soc_spectral_olr > 0) DEALLOCATE(spectral_olr_store)
end subroutine run_socrates_end
diff --git a/src/atmos_spectral/driver/solo/idealized_moist_phys.F90 b/src/atmos_spectral/driver/solo/idealized_moist_phys.F90
index 7e87562a6..61f387da5 100644
--- a/src/atmos_spectral/driver/solo/idealized_moist_phys.F90
+++ b/src/atmos_spectral/driver/solo/idealized_moist_phys.F90
@@ -801,7 +801,7 @@ subroutine idealized_moist_phys(Time, p_half, p_full, z_half, z_full, ug, vg, tg
real, dimension(size(ug,1), size(ug,2), size(ug,3)) :: tg_tmp, qg_tmp, RH,tg_interp, mc, dt_ug_conv, dt_vg_conv
! Simple cloud scheme variabilies to pass to radiation
-real, dimension(size(ug,1), size(ug,2), size(ug,3)) :: cf_rad, reff_rad, qcl_rad
+real, dimension(size(ug,1), size(ug,2), size(ug,3)) :: cf_rad, reff_rad, qcl_rad, cca_rad
real, intent(in) , dimension(:,:,:), optional :: mask
integer, intent(in) , dimension(:,:), optional :: kbot
@@ -982,8 +982,8 @@ subroutine idealized_moist_phys(Time, p_half, p_full, z_half, z_full, ug, vg, tg
tg(:,:,:,previous), &
grid_tracers(:,:,:,previous,nsphum), &
! outs -
- cf_rad(:,:,:), reff_rad(:,:,:), &
- qcl_rad(:,:,:) &
+ cf_rad(:,:,:), cca_rad(:,:,:), &
+ reff_rad(:,:,:), qcl_rad(:,:,:) &
)
endif
@@ -1131,7 +1131,7 @@ subroutine idealized_moist_phys(Time, p_half, p_full, z_half, z_full, ug, vg, tg
endif
call run_socrates(Time, Time+Time_step, rad_lat, rad_lon, tg(:,:,:,previous), grid_tracers(:,:,:,previous,nsphum), t_surf(:,:), p_full(:,:,:,current), &
- p_half(:,:,:,current),z_full(:,:,:,current),z_half(:,:,:,current), albedo, dt_tg(:,:,:), net_surf_sw_down(:,:), surf_lw_down(:,:), delta_t, do_cloud_simple, cf_rad(:,:,:), reff_rad(:,:,:), &
+ p_half(:,:,:,current),z_full(:,:,:,current),z_half(:,:,:,current), albedo, dt_tg(:,:,:), net_surf_sw_down(:,:), surf_lw_down(:,:), delta_t, do_cloud_simple, cf_rad(:,:,:), cca_rad(:,:,:), reff_rad(:,:,:), &
qcl_rad(:,:,:) )
endif
From 62a06634caf1a13df4c7e21ab910e2f3dad5bd30 Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Thu, 28 Mar 2019 14:27:50 +0000
Subject: [PATCH 111/304] Remove real conversions in soc_interface
---
.../socrates_aquaplanet_with_cloud.py | 15 ++++-----------
src/atmos_param/cloud_simple/cloud_simple.F90 | 3 +++
.../socrates/interface/socrates_interface.F90 | 4 ++--
.../socrates/interface/socrates_set_cld.F90 | 2 +-
4 files changed, 10 insertions(+), 14 deletions(-)
diff --git a/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
index 3e8e3813d..bc967d954 100644
--- a/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
+++ b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
@@ -129,21 +129,14 @@
'do_cloud_simple': True
},
- 'cloud_simple_nml': {
- 'simple_cca':0.0,
- 'rhcsfc': 0.95,
- 'rhc700': 0.7,
- 'rhc200': 0.3
- },
-
'vert_turb_driver_nml': {
'do_mellor_yamada': False, # default: True
'do_diffusivity': True, # default: False
'do_simple': True, # default: False
'constant_gust': 0.0, # default: 1.0
- 'use_tau': False
+ 'use_tau': False,
},
-
+
'diffusivity_nml': {
'do_entrain':False,
'do_simple': True,
@@ -227,5 +220,5 @@
cb.compile(debug=False)
exp.run(1, use_restart=False, num_cores=NCORES, overwrite_data=True)#, run_idb=True)
-# for i in range(2,171):
-# exp.run(i, num_cores=NCORES)
+ for i in range(2,121):
+ exp.run(i, num_cores=NCORES)
diff --git a/src/atmos_param/cloud_simple/cloud_simple.F90 b/src/atmos_param/cloud_simple/cloud_simple.F90
index b51cc84fe..184923dc7 100644
--- a/src/atmos_param/cloud_simple/cloud_simple.F90
+++ b/src/atmos_param/cloud_simple/cloud_simple.F90
@@ -280,6 +280,9 @@ subroutine calc_cf(q_hum, qsat, cf, cca, rh, simple_rhcrit, rh_min, rh_max)
cca = 0.0 ! no convective cloud fraction is calculated
! left in for future use
+ !cca can not be used in simple clouds as in read_control
+ ! control%i_cloud_representation = ip_cloud_ice_water
+
if (cca > 0.0) then
cf = MAX( simple_cca, cf )
end if
diff --git a/src/atmos_param/socrates/interface/socrates_interface.F90 b/src/atmos_param/socrates/interface/socrates_interface.F90
index 4b219e4a3..f99ea7a5b 100644
--- a/src/atmos_param/socrates/interface/socrates_interface.F90
+++ b/src/atmos_param/socrates/interface/socrates_interface.F90
@@ -878,7 +878,7 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
endif
if (id_soc_surf_flux_lw > 0) then
- surf_lw_net = real(surf_lw_net_store)
+ surf_lw_net = surf_lw_net_store
endif
if (id_soc_surf_flux_lw_clear > 0) then
@@ -1268,7 +1268,7 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
endif
if (id_soc_surf_flux_lw > 0) then
- surf_lw_net_store = real(surf_lw_net, kind(r_def))
+ surf_lw_net_store = surf_lw_net
endif
if (id_soc_surf_flux_sw_down > 0) then
diff --git a/src/atmos_param/socrates/interface/socrates_set_cld.F90 b/src/atmos_param/socrates/interface/socrates_set_cld.F90
index 99fd4a30e..3af8423b8 100644
--- a/src/atmos_param/socrates/interface/socrates_set_cld.F90
+++ b/src/atmos_param/socrates/interface/socrates_set_cld.F90
@@ -348,7 +348,7 @@ subroutine set_cld(cld, control, dimen, spectrum, n_profile, n_layer, &
cloud_frac(l, k)*ice_frac(l, k) / (liq_frac(l, k)+ice_frac(l, k))
else
cld%frac_cloud(l, k, ip_cloud_type_water) = 0.0_r_def
- cld%frac_cloud(l, k, ip_cloud_type_ice) = 0.0_r_def
+ cld%frac_cloud(l, k, ip_cloud_type_ice) = 0.0_r_def
end if
end do
end do
From a7001c100bbb450d2ad56b506d1c0a215fe4c100 Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Wed, 10 Apr 2019 10:44:23 +0100
Subject: [PATCH 112/304] Adding extra diagnostics to test case
---
.../socrates_test/socrates_aquaplanet_with_cloud.py | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
index bc967d954..389e0b898 100644
--- a/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
+++ b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
@@ -39,6 +39,8 @@
diag.add_field('atmosphere', 'precipitation', time_avg=True)
diag.add_field('atmosphere', 'rh', time_avg=True)
diag.add_field('mixed_layer', 't_surf', time_avg=True)
+diag.add_field('mixed_layer', 'flux_t', time_avg=True) #LH
+diag.add_field('mixed_layer', 'flux_lhe', time_avg=True) #SH
diag.add_field('dynamics', 'sphum', time_avg=True)
diag.add_field('dynamics', 'ucomp', time_avg=True)
diag.add_field('dynamics', 'vcomp', time_avg=True)
@@ -218,7 +220,9 @@
if __name__=="__main__":
cb.compile(debug=False)
- exp.run(1, use_restart=False, num_cores=NCORES, overwrite_data=True)#, run_idb=True)
+ overwrite=False
+
+ exp.run(1, use_restart=False, num_cores=NCORES, overwrite_data=overwrite)#, run_idb=True)
for i in range(2,121):
- exp.run(i, num_cores=NCORES)
+ exp.run(i, num_cores=NCORES, overwrite_data=overwrite)
From 4fe5aa07ceb2c984e06dc1db2551dfb9792d9e7a Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Wed, 5 Sep 2018 16:18:11 +0100
Subject: [PATCH 113/304] Add file to paths and namelist variables in test
scripts
---
exp/test_cases/socrates_test/socrates_aquaplanet.py | 3 ---
1 file changed, 3 deletions(-)
diff --git a/exp/test_cases/socrates_test/socrates_aquaplanet.py b/exp/test_cases/socrates_test/socrates_aquaplanet.py
index 98618756d..14591e570 100644
--- a/exp/test_cases/socrates_test/socrates_aquaplanet.py
+++ b/exp/test_cases/socrates_test/socrates_aquaplanet.py
@@ -114,8 +114,6 @@
'do_socrates_radiation': True,
'convection_scheme': 'SIMPLE_BETTS_MILLER', #Use simple Betts miller convection
'do_cloud_simple': False
- },
-
'vert_turb_driver_nml': {
'do_mellor_yamada': False, # default: True
@@ -162,7 +160,6 @@
'sat_vapor_pres_nml': {
'do_simple':True,
- 'construct_table_wrt_liq_and_ice':True
},
'damping_driver_nml': {
From 2b91c142f7af7bbbf51264adf1ff05d589ebe88e Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Wed, 5 Sep 2018 16:18:53 +0100
Subject: [PATCH 114/304] Additions to RRTM and ideal mosist phys to use the
simple cloud scheme
---
src/atmos_param/rrtm_radiation/rrtm_radiation.f90 | 5 ++---
src/atmos_spectral/driver/solo/idealized_moist_phys.F90 | 4 ++--
2 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/src/atmos_param/rrtm_radiation/rrtm_radiation.f90 b/src/atmos_param/rrtm_radiation/rrtm_radiation.f90
index 44865ab20..92fdbcf4f 100644
--- a/src/atmos_param/rrtm_radiation/rrtm_radiation.f90
+++ b/src/atmos_param/rrtm_radiation/rrtm_radiation.f90
@@ -542,7 +542,7 @@ end subroutine interp_temp
!*****************************************************************************************
subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half, &
albedo,q,t,t_surf_rad,tdt, &
- coszen,flux_sw,flux_lw,cf_rad,reff_rad, &
+ coszen,flux_sw,flux_lw,cfa_rad,reff_rad, &
do_cloud_simple)
!
! Driver for RRTMG radiation scheme.
@@ -589,7 +589,7 @@ subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half, &
real(kind=rb),dimension(:,:),intent(out),optional :: flux_sw,flux_lw ! surface fluxes [W/m2]
! dimension (lat x lon)
! need to have both or none!
- real(kind=rb), dimension(:,:,:), intent(in) :: cf_rad,reff_rad !cloud properties
+ real(kind=rb), dimension(:,:,:), intent(in) :: cfa_rad,reff_rad !cloud properties
logical, intent(in) :: do_cloud_simple
@@ -604,7 +604,6 @@ subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half, &
real(kind=rb),dimension(ncols_rrt,nlay_rrt) :: pfull,tfull,fracday&
, hr,hrc, swhr, swhrc, cldfr, reliq, reice
-
real(kind=rb),dimension(ngptsw,ncols_rrt,nlay_rrt) :: cldfr_pass_sw
real(kind=rb),dimension(ngptlw,ncols_rrt,nlay_rrt) :: cldfr_pass_lw
diff --git a/src/atmos_spectral/driver/solo/idealized_moist_phys.F90 b/src/atmos_spectral/driver/solo/idealized_moist_phys.F90
index 61f387da5..b1bfd5c30 100644
--- a/src/atmos_spectral/driver/solo/idealized_moist_phys.F90
+++ b/src/atmos_spectral/driver/solo/idealized_moist_phys.F90
@@ -985,7 +985,7 @@ subroutine idealized_moist_phys(Time, p_half, p_full, z_half, z_full, ug, vg, tg
cf_rad(:,:,:), cca_rad(:,:,:), &
reff_rad(:,:,:), qcl_rad(:,:,:) &
)
-
+
endif
! Begin the radiation calculation by computing downward fluxes.
@@ -1113,7 +1113,7 @@ subroutine idealized_moist_phys(Time, p_half, p_full, z_half, z_full, ug, vg, tg
call interp_temp(z_full(:,:,:,current),z_half(:,:,:,current),tg_interp, Time)
call run_rrtmg(is,js,Time,rad_lat(:,:),rad_lon(:,:),p_full(:,:,:,current),p_half(:,:,:,current), &
albedo,grid_tracers(:,:,:,previous,nsphum),tg_interp,t_surf(:,:),dt_tg(:,:,:), &
- coszen,net_surf_sw_down(:,:),surf_lw_down(:,:), cf_rad(:,:,:), reff_rad(:,:,:), &
+ coszen,net_surf_sw_down(:,:),surf_lw_down(:,:), cfa_rad(:,:,:), reff_rad(:,:,:), &
do_cloud_simple )
endif
#endif
From 57a45b3bc10c2d1e9f040ef42dd1595a2efc4ac5 Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Wed, 5 Sep 2018 17:30:24 +0100
Subject: [PATCH 115/304] Changes so code will now compile
---
src/atmos_spectral/driver/solo/idealized_moist_phys.F90 | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/atmos_spectral/driver/solo/idealized_moist_phys.F90 b/src/atmos_spectral/driver/solo/idealized_moist_phys.F90
index b1bfd5c30..b4fffe0c0 100644
--- a/src/atmos_spectral/driver/solo/idealized_moist_phys.F90
+++ b/src/atmos_spectral/driver/solo/idealized_moist_phys.F90
@@ -349,7 +349,6 @@ subroutine idealized_moist_phys_init(Time, Time_step_in, nhum, rad_lon_2d, rad_l
if(do_cloud_simple) then
call cloud_simple_init(get_axis_id(), Time)
-end if
!s need to make sure that gray radiation and rrtm radiation are not both called.
if(two_stream_gray .and. do_rrtm_radiation) &
@@ -801,7 +800,7 @@ subroutine idealized_moist_phys(Time, p_half, p_full, z_half, z_full, ug, vg, tg
real, dimension(size(ug,1), size(ug,2), size(ug,3)) :: tg_tmp, qg_tmp, RH,tg_interp, mc, dt_ug_conv, dt_vg_conv
! Simple cloud scheme variabilies to pass to radiation
-real, dimension(size(ug,1), size(ug,2), size(ug,3)) :: cf_rad, reff_rad, qcl_rad, cca_rad
+real, dimension(size(ug,1), size(ug,2), size(ug,3)) :: cfa_rad, reff_rad, qcl_rad, cca_rad
real, intent(in) , dimension(:,:,:), optional :: mask
integer, intent(in) , dimension(:,:), optional :: kbot
From b8032341cb0e60915691e6e7c4c284ccc26e1fbb Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Thu, 6 Sep 2018 12:24:50 +0100
Subject: [PATCH 116/304] exp/test_cases/MiMA/MiMA_test_case.py
---
src/atmos_param/cloud_simple/cloud_simple.F90 | 4 ++--
src/atmos_spectral/driver/solo/idealized_moist_phys.F90 | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/atmos_param/cloud_simple/cloud_simple.F90 b/src/atmos_param/cloud_simple/cloud_simple.F90
index 184923dc7..a18178e7c 100644
--- a/src/atmos_param/cloud_simple/cloud_simple.F90
+++ b/src/atmos_param/cloud_simple/cloud_simple.F90
@@ -98,7 +98,6 @@ subroutine cloud_simple_init (axes, Time)
'Specific humidity of cloud liquid', &
'kg/kg')
-
id_rh_in_cf = &
register_diag_field ( mod_name_cld, 'rh_in_cf', axes(1:3), Time, &
'RH as a percent', &
@@ -133,11 +132,12 @@ subroutine cloud_simple(p_half, p_full, Time, &
real, dimension(size(temp,1), size(temp, 2), size(temp, 3)) :: qs, frac_liq, rh_in_cf, simple_rhcrit, rh_min, rh_max
-
integer :: i, j, k, k_surf
logical :: es_over_liq_and_ice
+ real :: tmp1, tmp2 !remove tmp1 and tmp2 after debugging
+
!check initiation has been done - ie read in parameters
if (do_init) call error_mesg ('cloud_simple', &
'cloud_simple_init has not been called.', FATAL)
diff --git a/src/atmos_spectral/driver/solo/idealized_moist_phys.F90 b/src/atmos_spectral/driver/solo/idealized_moist_phys.F90
index b4fffe0c0..55ec2a502 100644
--- a/src/atmos_spectral/driver/solo/idealized_moist_phys.F90
+++ b/src/atmos_spectral/driver/solo/idealized_moist_phys.F90
@@ -349,6 +349,7 @@ subroutine idealized_moist_phys_init(Time, Time_step_in, nhum, rad_lon_2d, rad_l
if(do_cloud_simple) then
call cloud_simple_init(get_axis_id(), Time)
+end if
!s need to make sure that gray radiation and rrtm radiation are not both called.
if(two_stream_gray .and. do_rrtm_radiation) &
@@ -808,7 +809,6 @@ subroutine idealized_moist_phys(Time, p_half, p_full, z_half, z_full, ug, vg, tg
real, dimension(1,1,1):: tracer, tracertnd
integer :: nql, nqi, nqa ! tracer indices for stratiform clouds
-
if(current == previous) then
delta_t = dt_real
else
From fdcf7d993c585e95b780206c7625620a451fd8e6 Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Thu, 6 Sep 2018 12:25:51 +0100
Subject: [PATCH 117/304] Previous commit did not have all files: attempting to
debug why cloud fraction is not passed out of the simple cloud scheme
---
exp/test_cases/MiMA/MiMA_test_case.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/exp/test_cases/MiMA/MiMA_test_case.py b/exp/test_cases/MiMA/MiMA_test_case.py
index 27dc00243..fc1dc4a47 100644
--- a/exp/test_cases/MiMA/MiMA_test_case.py
+++ b/exp/test_cases/MiMA/MiMA_test_case.py
@@ -4,7 +4,7 @@
from isca import IscaCodeBase, DiagTable, Experiment, Namelist, GFDL_BASE
-NCORES = 16
+NCORES = 1
# a CodeBase can be a directory on the computer,
# useful for iterative development
@@ -193,4 +193,4 @@
if __name__=="__main__":
exp.run(1, use_restart=False, num_cores=NCORES, overwrite_data=True)#, run_idb=True)
for i in range(2,25):
- exp.run(i, num_cores=NCORES, overwrite_data=True)
+ exp.run(i, num_cores=NCORES, overwrite_data=True)
\ No newline at end of file
From 009716603c09b22637a04d248be6193a3cefabfa Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Thu, 6 Sep 2018 16:27:53 +0100
Subject: [PATCH 118/304] Swapped to using mcica sw routine and added required
initialisation routine. Seems to run. Now swapping to lw mcica.
---
exp/test_cases/MiMA/MiMA_test_case.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/exp/test_cases/MiMA/MiMA_test_case.py b/exp/test_cases/MiMA/MiMA_test_case.py
index fc1dc4a47..69a4dcb82 100644
--- a/exp/test_cases/MiMA/MiMA_test_case.py
+++ b/exp/test_cases/MiMA/MiMA_test_case.py
@@ -4,7 +4,7 @@
from isca import IscaCodeBase, DiagTable, Experiment, Namelist, GFDL_BASE
-NCORES = 1
+NCORES = 16
# a CodeBase can be a directory on the computer,
# useful for iterative development
From 4bee8c4825409f4a2cb79f9fb00cf4ab18653a34 Mon Sep 17 00:00:00 2001
From: sit23
Date: Fri, 7 Sep 2018 13:02:38 +0100
Subject: [PATCH 119/304] Turned socrates clouds on for the first time, and hit
error where cloud fraction is above one. Check this with Penny.
---
.../socrates/interface/socrates_interface.F90 | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/src/atmos_param/socrates/interface/socrates_interface.F90 b/src/atmos_param/socrates/interface/socrates_interface.F90
index f99ea7a5b..febf4b85d 100644
--- a/src/atmos_param/socrates/interface/socrates_interface.F90
+++ b/src/atmos_param/socrates/interface/socrates_interface.F90
@@ -128,6 +128,18 @@ SUBROUTINE socrates_init(is, ie, js, je, num_levels, axes, Time, lat, lonb, latb
!Initialise astronomy
call astronomy_init
+ if(do_cloud_simple.and..not.account_for_clouds_in_socrates) then
+
+ call error_mesg( 'run_socrates', &
+ 'do_cloud_simple is True but account_for_clouds_in_socrates is False. Radiative effects of clouds NOT accounted for', WARNING)
+
+ elseif(.not.do_cloud_simple.and.account_for_clouds_in_socrates) then
+
+ call error_mesg( 'run_socrates', &
+ 'do_cloud_simple is False but account_for_clouds_in_socrates is True. Radiative effects of clouds NOT accounted for', WARNING)
+
+ endif
+
!Initialise variables related to radiation timestep
call get_time(delta_t_atmos,time_step_seconds)
@@ -1154,7 +1166,6 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
else
cld_frac_soc = 0.
cld_conv_frac_soc = 0.
-
reff_rad_soc = 0.
mmr_cl_rad_soc = 0.
@@ -1179,7 +1190,6 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
z_full_soc = REAL(z_full_in, kind(r_def))
z_half_soc = REAL(z_half_in, kind(r_def))
-
CALL socrates_interface(Time, rad_lat_soc, rad_lon_soc, soc_lw_mode, &
tg_tmp_soc, q_soc, ozone_soc, co2_soc, t_surf_for_soc, p_full_soc, &
p_half_soc, z_full_soc, z_half_soc, albedo_soc, coszen, rrsun, &
From 00e19da88f5762fd56e19f7c2392821b4812e68b Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Wed, 12 Sep 2018 11:15:32 +0100
Subject: [PATCH 120/304] Update debugging flag to get socrities to compile
---
src/extra/python/isca/templates/mkmf.template.debug | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/extra/python/isca/templates/mkmf.template.debug b/src/extra/python/isca/templates/mkmf.template.debug
index 15afb1696..45d7e20a3 100644
--- a/src/extra/python/isca/templates/mkmf.template.debug
+++ b/src/extra/python/isca/templates/mkmf.template.debug
@@ -19,7 +19,7 @@ NETCDF_LIBS = `nc-config --libs`
# This suppresses the warning: `warning #6843: A dummy argument with an explicit INTENT(OUT) declaration is not given an explicit value.` of which
# there are a lot of instances in the GFDL codebase.
FFLAGS_DEBUG = -check -check noarg_temp_created -check nopointer -warn -warn noerrors -debug variable_locations -inline_debug_info -fpe0 -traceback -ftrapuv
-FFLAGS = $(CPPFLAGS) -fpp -stack_temps -safe-cray-ptr -ftz -i_dynamic -assume byterecl -g -i4 -r8 -diag-disable 6843 -fpic $(FFLAGS_DEBUG)
+FFLAGS = $(CPPFLAGS) -fpp -stack_temps -safe-cray-ptr -ftz -i_dynamic -assume byterecl -g -i4 -r8 -diag-disable 6843 -mcmodel large $(FFLAGS_DEBUG)
FC = $(F90)
LD = $(F90) $(NETCDF_LIBS)
#CC = mpicc
From c06b14adc34d55f61d85f664e0ea46558b82b564 Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Wed, 12 Sep 2018 16:43:53 +0100
Subject: [PATCH 121/304] Socrates is not working properly with idb. Break
points not behaving logically. Cant confirm the compile is working properly
---
src/extra/python/isca/templates/mkmf.template.debug | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/extra/python/isca/templates/mkmf.template.debug b/src/extra/python/isca/templates/mkmf.template.debug
index 45d7e20a3..15afb1696 100644
--- a/src/extra/python/isca/templates/mkmf.template.debug
+++ b/src/extra/python/isca/templates/mkmf.template.debug
@@ -19,7 +19,7 @@ NETCDF_LIBS = `nc-config --libs`
# This suppresses the warning: `warning #6843: A dummy argument with an explicit INTENT(OUT) declaration is not given an explicit value.` of which
# there are a lot of instances in the GFDL codebase.
FFLAGS_DEBUG = -check -check noarg_temp_created -check nopointer -warn -warn noerrors -debug variable_locations -inline_debug_info -fpe0 -traceback -ftrapuv
-FFLAGS = $(CPPFLAGS) -fpp -stack_temps -safe-cray-ptr -ftz -i_dynamic -assume byterecl -g -i4 -r8 -diag-disable 6843 -mcmodel large $(FFLAGS_DEBUG)
+FFLAGS = $(CPPFLAGS) -fpp -stack_temps -safe-cray-ptr -ftz -i_dynamic -assume byterecl -g -i4 -r8 -diag-disable 6843 -fpic $(FFLAGS_DEBUG)
FC = $(F90)
LD = $(F90) $(NETCDF_LIBS)
#CC = mpicc
From 5d30ba1b9236fd1371d404ece3349a0695ec26e8 Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Wed, 12 Sep 2018 16:47:19 +0100
Subject: [PATCH 122/304] File cleaning. Changes to fix seg fault which
originated due to flipped pressure levels. Removed account for clouds.
---
src/atmos_param/socrates/interface/socrates_interface.F90 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/atmos_param/socrates/interface/socrates_interface.F90 b/src/atmos_param/socrates/interface/socrates_interface.F90
index febf4b85d..07d1a28d6 100644
--- a/src/atmos_param/socrates/interface/socrates_interface.F90
+++ b/src/atmos_param/socrates/interface/socrates_interface.F90
@@ -618,7 +618,7 @@ subroutine socrates_interface(Time_diag, rlat, rlon, soc_lw_mode, &
!----------------------------i
! Set array sizes
- input_n_cloud_layer = n_layer
+ input_n_cloud_layer = 1
input_n_aer_mode = n_layer
input_cld_subcol_gen = n_layer
input_cld_subcol_req = n_layer
From e0e9dd77fc7bba962aa6235eef7ed9f027c24d9b Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Wed, 12 Sep 2018 17:56:16 +0100
Subject: [PATCH 123/304] Added a with and without cloud test case for soc
---
exp/test_cases/socrates_test/socrates_aquaplanet.py | 1 +
.../socrates_test/socrates_aquaplanet_with_cloud.py | 11 +++++++++--
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/exp/test_cases/socrates_test/socrates_aquaplanet.py b/exp/test_cases/socrates_test/socrates_aquaplanet.py
index 14591e570..3f2934f5d 100644
--- a/exp/test_cases/socrates_test/socrates_aquaplanet.py
+++ b/exp/test_cases/socrates_test/socrates_aquaplanet.py
@@ -114,6 +114,7 @@
'do_socrates_radiation': True,
'convection_scheme': 'SIMPLE_BETTS_MILLER', #Use simple Betts miller convection
'do_cloud_simple': False
+ },
'vert_turb_driver_nml': {
'do_mellor_yamada': False, # default: True
diff --git a/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
index 389e0b898..b14b0d5ba 100644
--- a/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
+++ b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
@@ -131,12 +131,19 @@
'do_cloud_simple': True
},
+ 'cloud_simple_nml': {
+ 'simple_cca':0.0,
+ 'rhcsfc': 0.95,
+ 'rhc700': 0.7,
+ 'rhc200': 0.3
+ },
+
'vert_turb_driver_nml': {
'do_mellor_yamada': False, # default: True
'do_diffusivity': True, # default: False
'do_simple': True, # default: False
'constant_gust': 0.0, # default: 1.0
- 'use_tau': False,
+ 'use_tau': False
},
'diffusivity_nml': {
@@ -225,4 +232,4 @@
exp.run(1, use_restart=False, num_cores=NCORES, overwrite_data=overwrite)#, run_idb=True)
for i in range(2,121):
- exp.run(i, num_cores=NCORES, overwrite_data=overwrite)
+ exp.run(i, num_cores=NCORES, overwrite_data=overwrite)
\ No newline at end of file
From 67266c372536d01997291074ecd27dd4023f8dc0 Mon Sep 17 00:00:00 2001
From: sit23
Date: Thu, 6 Dec 2018 09:44:09 +0000
Subject: [PATCH 124/304] Small changes at James Manners suggestion. Changes
results A LOT, so this needs to be checked closely.
---
src/atmos_param/socrates/interface/socrates_interface.F90 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/atmos_param/socrates/interface/socrates_interface.F90 b/src/atmos_param/socrates/interface/socrates_interface.F90
index 07d1a28d6..febf4b85d 100644
--- a/src/atmos_param/socrates/interface/socrates_interface.F90
+++ b/src/atmos_param/socrates/interface/socrates_interface.F90
@@ -618,7 +618,7 @@ subroutine socrates_interface(Time_diag, rlat, rlon, soc_lw_mode, &
!----------------------------i
! Set array sizes
- input_n_cloud_layer = 1
+ input_n_cloud_layer = n_layer
input_n_aer_mode = n_layer
input_cld_subcol_gen = n_layer
input_cld_subcol_req = n_layer
From 2994de3a2a20ab7052fbefe2046c9479832994ed Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Thu, 6 Dec 2018 11:23:24 +0000
Subject: [PATCH 125/304] Changes to simple clouds for more fields to be
outputted
---
src/atmos_param/cloud_simple/cloud_simple.F90 | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/atmos_param/cloud_simple/cloud_simple.F90 b/src/atmos_param/cloud_simple/cloud_simple.F90
index a18178e7c..3b6b261a7 100644
--- a/src/atmos_param/cloud_simple/cloud_simple.F90
+++ b/src/atmos_param/cloud_simple/cloud_simple.F90
@@ -136,7 +136,7 @@ subroutine cloud_simple(p_half, p_full, Time, &
logical :: es_over_liq_and_ice
- real :: tmp1, tmp2 !remove tmp1 and tmp2 after debugging
+ real :: tmp1, tmp2 !remove tmp1 and tmp2 after debugging
!check initiation has been done - ie read in parameters
if (do_init) call error_mesg ('cloud_simple', &
@@ -267,6 +267,7 @@ subroutine calc_cf(q_hum, qsat, cf, cca, rh, simple_rhcrit, rh_min, rh_max)
rh = q_hum/qsat
+
if (spookie_protocol .eq. 1) then
cf = (rh - simple_rhcrit ) / ( 1.0 - simple_rhcrit )
cf = MAX( 0.0, MIN( 1.0, cf))
@@ -286,7 +287,7 @@ subroutine calc_cf(q_hum, qsat, cf, cca, rh, simple_rhcrit, rh_min, rh_max)
if (cca > 0.0) then
cf = MAX( simple_cca, cf )
end if
-
+
end subroutine calc_cf
From b16a01ed0aa796b5a2d37972223934535c213a4f Mon Sep 17 00:00:00 2001
From: sit23
Date: Thu, 6 Dec 2018 15:48:09 +0000
Subject: [PATCH 126/304] Made some changes to socrates cloud test experiment.
---
.../socrates_test/socrates_aquaplanet_with_cloud.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
index b14b0d5ba..8b779aff1 100644
--- a/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
+++ b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
@@ -81,8 +81,8 @@
diag.add_field('cloud_simple', 'rh_in_cf', time_avg=True)
# additional output options commented out
-#diag.add_field('socrates', 'soc_flux_lw', time_avg=True)
-#diag.add_field('socrates', 'soc_flux_sw', time_avg=True)
+diag.add_field('socrates', 'soc_flux_lw', time_avg=True)
+diag.add_field('socrates', 'soc_flux_sw', time_avg=True)
#diag.add_field('socrates', 'soc_co2', time_avg=True)
#diag.add_field('socrates', 'soc_ozone', time_avg=True)
#diag.add_field('socrates', 'soc_coszen', time_avg=True)
From bab6fe3b5f773d4a9cab9cd9063a42663f287653 Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Thu, 28 Mar 2019 09:27:12 +0000
Subject: [PATCH 127/304] Adding diagnostics for clear sky in order to do CRE
calculation.
---
.../socrates_test/socrates_aquaplanet_with_cloud.py | 3 ++-
.../socrates/interface/socrates_interface.F90 | 13 ++++++++++---
2 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
index 8b779aff1..87ccaef95 100644
--- a/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
+++ b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
@@ -5,7 +5,7 @@
from isca import SocratesCodeBase, DiagTable, Experiment, Namelist, GFDL_BASE
from isca.util import exp_progress
-NCORES = 16
+NCORES = 8
base_dir = os.path.dirname(os.path.realpath(__file__))
# a CodeBase can be a directory on the computer,
# useful for iterative development
@@ -227,6 +227,7 @@
if __name__=="__main__":
cb.compile(debug=False)
+
overwrite=False
exp.run(1, use_restart=False, num_cores=NCORES, overwrite_data=overwrite)#, run_idb=True)
diff --git a/src/atmos_param/socrates/interface/socrates_interface.F90 b/src/atmos_param/socrates/interface/socrates_interface.F90
index febf4b85d..21a503e76 100644
--- a/src/atmos_param/socrates/interface/socrates_interface.F90
+++ b/src/atmos_param/socrates/interface/socrates_interface.F90
@@ -56,8 +56,15 @@ MODULE socrates_interface_mod
INTEGER :: id_soc_tdt_sw, id_soc_tdt_lw, id_soc_tdt_rad
INTEGER :: id_soc_surf_flux_lw, id_soc_surf_flux_sw
INTEGER :: id_soc_surf_flux_lw_down, id_soc_surf_flux_sw_down
+
+ INTEGER :: id_soc_surf_flux_lw_clear, id_soc_surf_flux_sw_clear
+ INTEGER :: id_soc_surf_flux_lw_down_clear, id_soc_surf_flux_sw_down_clear
+
INTEGER :: id_soc_flux_lw, id_soc_flux_sw
+
INTEGER :: id_soc_olr, id_soc_toa_sw
+ INTEGER :: id_soc_olr_clear, id_soc_toa_sw_clear
+
INTEGER :: id_soc_toa_sw_down
INTEGER :: id_soc_surf_flux_lw_clear, id_soc_surf_flux_sw_clear
INTEGER :: id_soc_surf_flux_lw_down, id_soc_surf_flux_sw_down
@@ -79,9 +86,9 @@ MODULE socrates_interface_mod
REAL(r_def), allocatable, dimension(:,:,:) :: tdt_soc_sw_store, tdt_soc_lw_store
REAL(r_def), allocatable, dimension(:,:,:) :: thd_sw_flux_net_store, thd_lw_flux_net_store
REAL(r_def), allocatable, dimension(:,:,:) :: thd_co2_store, thd_ozone_store
- REAL(r_def), allocatable, dimension(:,:) :: net_surf_sw_down_store, surf_sw_down_store, surf_lw_down_store, surf_lw_net_store, &
- toa_sw_store, olr_store, coszen_store, &
- toa_sw_down_store
+ REAL(r_def), allocatable, dimension(:,:) :: net_surf_sw_down_store, surf_lw_down_store, surf_lw_net_store, surf_lw_net_store, &
+ surf_sw_down_store, toa_sw_down_store, &
+ toa_sw_store, olr_store, coszen_store
REAL(r_def), allocatable, dimension(:,:) :: net_surf_sw_down_clear_store, surf_sw_down_clear_store, &
surf_lw_down_clear_store, surf_lw_net_clear_store, &
toa_sw_clear_store, olr_clear_store, toa_sw_down_clear_store
From 10082c1a4eb3a8b15eba798f324f31526fbd195d Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Thu, 28 Mar 2019 13:40:55 +0000
Subject: [PATCH 128/304] Implement protocol 2 for spookie-2 and debugging
clear sky diagnostics
---
.../socrates_test/socrates_aquaplanet_with_cloud.py | 6 +++---
src/atmos_param/cloud_simple/cloud_simple.F90 | 11 +++++++++--
2 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
index 87ccaef95..c189a04d2 100644
--- a/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
+++ b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
@@ -5,7 +5,7 @@
from isca import SocratesCodeBase, DiagTable, Experiment, Namelist, GFDL_BASE
from isca.util import exp_progress
-NCORES = 8
+NCORES = 16
base_dir = os.path.dirname(os.path.realpath(__file__))
# a CodeBase can be a directory on the computer,
# useful for iterative development
@@ -81,8 +81,8 @@
diag.add_field('cloud_simple', 'rh_in_cf', time_avg=True)
# additional output options commented out
-diag.add_field('socrates', 'soc_flux_lw', time_avg=True)
-diag.add_field('socrates', 'soc_flux_sw', time_avg=True)
+#diag.add_field('socrates', 'soc_flux_lw', time_avg=True)
+#diag.add_field('socrates', 'soc_flux_sw', time_avg=True)
#diag.add_field('socrates', 'soc_co2', time_avg=True)
#diag.add_field('socrates', 'soc_ozone', time_avg=True)
#diag.add_field('socrates', 'soc_coszen', time_avg=True)
diff --git a/src/atmos_param/cloud_simple/cloud_simple.F90 b/src/atmos_param/cloud_simple/cloud_simple.F90
index 3b6b261a7..91f81ea67 100644
--- a/src/atmos_param/cloud_simple/cloud_simple.F90
+++ b/src/atmos_param/cloud_simple/cloud_simple.F90
@@ -136,7 +136,6 @@ subroutine cloud_simple(p_half, p_full, Time, &
logical :: es_over_liq_and_ice
- real :: tmp1, tmp2 !remove tmp1 and tmp2 after debugging
!check initiation has been done - ie read in parameters
if (do_init) call error_mesg ('cloud_simple', &
@@ -267,6 +266,14 @@ subroutine calc_cf(q_hum, qsat, cf, cca, rh, simple_rhcrit, rh_min, rh_max)
rh = q_hum/qsat
+ if (spookie_protocol .eq. 1) then
+ cf = (rh - simple_rhcrit ) / ( 1.0 - simple_rhcrit )
+ cf = MAX( 0.0, MIN( 1.0, cf))
+
+ else
+ cf = (rh - rh_min ) / ( rh_max - rh_min )
+ cf = MAX( 0.0, MIN( 1.0, cf))
+ end if
if (spookie_protocol .eq. 1) then
cf = (rh - simple_rhcrit ) / ( 1.0 - simple_rhcrit )
@@ -287,7 +294,7 @@ subroutine calc_cf(q_hum, qsat, cf, cca, rh, simple_rhcrit, rh_min, rh_max)
if (cca > 0.0) then
cf = MAX( simple_cca, cf )
end if
-
+
end subroutine calc_cf
From 996899ab06199e211b1d19a477b6ed26cf6a311f Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Tue, 14 Apr 2020 10:43:15 +0100
Subject: [PATCH 129/304] Correct errors made during rebase. Code runs but
needs to be checked for changes in the cloud scheme to make sure all changes
survived the rebase.
---
exp/test_cases/socrates_test/socrates_aquaplanet.py | 2 +-
src/atmos_param/socrates/interface/socrates_interface.F90 | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/exp/test_cases/socrates_test/socrates_aquaplanet.py b/exp/test_cases/socrates_test/socrates_aquaplanet.py
index 3f2934f5d..3f23ec6c8 100644
--- a/exp/test_cases/socrates_test/socrates_aquaplanet.py
+++ b/exp/test_cases/socrates_test/socrates_aquaplanet.py
@@ -208,4 +208,4 @@
#This will be the name of the folder that the data will appear in.
exp.run(1, use_restart=False, num_cores=NCORES, overwrite_data=False)
for i in range(2,121):
- exp.run(i, num_cores=NCORES)
\ No newline at end of file
+ exp.run(i, num_cores=NCORES)
diff --git a/src/atmos_param/socrates/interface/socrates_interface.F90 b/src/atmos_param/socrates/interface/socrates_interface.F90
index 21a503e76..e5c4920e6 100644
--- a/src/atmos_param/socrates/interface/socrates_interface.F90
+++ b/src/atmos_param/socrates/interface/socrates_interface.F90
@@ -86,7 +86,7 @@ MODULE socrates_interface_mod
REAL(r_def), allocatable, dimension(:,:,:) :: tdt_soc_sw_store, tdt_soc_lw_store
REAL(r_def), allocatable, dimension(:,:,:) :: thd_sw_flux_net_store, thd_lw_flux_net_store
REAL(r_def), allocatable, dimension(:,:,:) :: thd_co2_store, thd_ozone_store
- REAL(r_def), allocatable, dimension(:,:) :: net_surf_sw_down_store, surf_lw_down_store, surf_lw_net_store, surf_lw_net_store, &
+ REAL(r_def), allocatable, dimension(:,:) :: net_surf_sw_down_store, surf_lw_down_store, surf_lw_net_store, &
surf_sw_down_store, toa_sw_down_store, &
toa_sw_store, olr_store, coszen_store
REAL(r_def), allocatable, dimension(:,:) :: net_surf_sw_down_clear_store, surf_sw_down_clear_store, &
From fc6ee77a13e8baf8b147169a583b84a49a2c4de5 Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Tue, 14 Apr 2020 10:58:30 +0100
Subject: [PATCH 130/304] Resolving push/pull conflicts
---
exp/test_cases/socrates_test/socrates_aquaplanet.py | 1 +
1 file changed, 1 insertion(+)
diff --git a/exp/test_cases/socrates_test/socrates_aquaplanet.py b/exp/test_cases/socrates_test/socrates_aquaplanet.py
index 3f23ec6c8..14a163bd0 100644
--- a/exp/test_cases/socrates_test/socrates_aquaplanet.py
+++ b/exp/test_cases/socrates_test/socrates_aquaplanet.py
@@ -59,6 +59,7 @@
diag.add_field('socrates', 'soc_olr', time_avg=True)
diag.add_field('socrates', 'soc_toa_sw', time_avg=True)
diag.add_field('socrates', 'soc_toa_sw_down', time_avg=True)
+
diag.add_field('cloud_simple', 'cf_rad', time_avg=True)
diag.add_field('cloud_simple', 'reff_rad', time_avg=True)
diag.add_field('cloud_simple', 'frac_liq', time_avg=True)
From 009c1cb73b24041ddca19a8763632eca67fa4858 Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Thu, 21 May 2020 07:40:13 +0100
Subject: [PATCH 131/304] Rebase was a mess. Commit to fit test scripts
---
exp/test_cases/MiMA/MiMA_test_case.py | 37 ++++++-------------
.../MiMA/MiMA_test_case_no_cloud.py | 15 +++++---
.../socrates_aquaplanet_with_cloud.py | 1 -
3 files changed, 21 insertions(+), 32 deletions(-)
diff --git a/exp/test_cases/MiMA/MiMA_test_case.py b/exp/test_cases/MiMA/MiMA_test_case.py
index 69a4dcb82..e35ada72e 100644
--- a/exp/test_cases/MiMA/MiMA_test_case.py
+++ b/exp/test_cases/MiMA/MiMA_test_case.py
@@ -4,7 +4,7 @@
from isca import IscaCodeBase, DiagTable, Experiment, Namelist, GFDL_BASE
-NCORES = 16
+NCORES = 4
# a CodeBase can be a directory on the computer,
# useful for iterative development
@@ -19,11 +19,11 @@
# is used to load the correct compilers. The env file is always loaded from
# $GFDL_BASE and not the checked out git repo.
-cb.compile()#debug=True) # compile the source code to working directory $GFDL_WORK/codebase
+cb.compile() # compile the source code to working directory $GFDL_WORK/codebase
# create an Experiment object to handle the configuration of model parameters
# and output diagnostics
-exp = Experiment('mima_test_experiment_with_mcica', codebase=cb)
+exp = Experiment('mima_test_experiment', codebase=cb)
exp.inputfiles = [os.path.join(GFDL_BASE,'input/rrtm_input_files/ozone_1990.nc')]
@@ -43,10 +43,6 @@
diag.add_field('dynamics', 'temp', time_avg=True)
diag.add_field('dynamics', 'vor', time_avg=True)
diag.add_field('dynamics', 'div', time_avg=True)
-diag.add_field('cloud_simple', 'cf_rad', time_avg=True)
-diag.add_field('cloud_simple', 'reff_rad', time_avg=True)
-diag.add_field('cloud_simple', 'frac_liq', time_avg=True)
-diag.add_field('cloud_simple', 'qcl_rad', time_avg=True)
diag.add_field('rrtm_radiation', 'olr', time_avg=True)
exp.diag_table = diag
@@ -79,16 +75,7 @@
'roughness_mom':3.21e-05,
'roughness_heat':3.21e-05,
'roughness_moist':3.21e-05,
- 'do_cloud_simple': True,
- },
- 'cloud_simple_nml': {
- 'simple_cca':0.0,
- 'rhcsfc': 0.95,
- 'rhc700': 0.7,
- 'rhc200': 0.3,
- 'rhmsfc': 0.95,
- 'rhm700': 0.7,
- 'rhm200': 0.3,
+ 'do_cloud_simple': False
},
'vert_turb_driver_nml': {
@@ -136,14 +123,13 @@
},
'sat_vapor_pres_nml': {
- 'do_simple':True,
- 'construct_table_wrt_liq_and_ice':True
+ 'do_simple':True
},
'damping_driver_nml': {
'do_rayleigh': True,
'trayfric': -0.5, # neg. value: time in *days*
- 'sponge_pbottom': 150.,
+ 'sponge_pbottom': 50.,
'do_conserve_energy': True,
},
@@ -155,8 +141,7 @@
'solr_cnst': 1360, #s set solar constant to 1360, rather than default of 1368.22
'dt_rad': 7200, #Use long RRTM timestep
'do_read_ozone':True,
- 'ozone_file':'ozone_1990',
- 'icld': 1 #cloud overlap method
+ 'ozone_file':'ozone_1990'
},
# FMS Framework configuration
@@ -181,7 +166,7 @@
'valid_range_t':[100.,800.],
'initial_sphum':[2.e-6],
'vert_coord_option':'uneven_sigma',
- 'surf_res':0.2,
+ 'surf_res':0.5,
'scale_heights' : 11.0,
'exponent':7.0,
'robert_coeff':0.03
@@ -191,6 +176,6 @@
})
#Lets do a run!
if __name__=="__main__":
- exp.run(1, use_restart=False, num_cores=NCORES, overwrite_data=True)#, run_idb=True)
- for i in range(2,25):
- exp.run(i, num_cores=NCORES, overwrite_data=True)
\ No newline at end of file
+ exp.run(1, use_restart=False, num_cores=NCORES)
+ for i in range(2,121):
+ exp.run(i, num_cores=NCORES)
diff --git a/exp/test_cases/MiMA/MiMA_test_case_no_cloud.py b/exp/test_cases/MiMA/MiMA_test_case_no_cloud.py
index 645a589ea..0ece0f029 100644
--- a/exp/test_cases/MiMA/MiMA_test_case_no_cloud.py
+++ b/exp/test_cases/MiMA/MiMA_test_case_no_cloud.py
@@ -23,7 +23,7 @@
# create an Experiment object to handle the configuration of model parameters
# and output diagnostics
-exp = Experiment('mima_test_experiment_no_cloud', codebase=cb)
+exp = Experiment('mima_test_experiment_with_mcica', codebase=cb)
exp.inputfiles = [os.path.join(GFDL_BASE,'input/rrtm_input_files/ozone_1990.nc')]
@@ -43,6 +43,10 @@
diag.add_field('dynamics', 'temp', time_avg=True)
diag.add_field('dynamics', 'vor', time_avg=True)
diag.add_field('dynamics', 'div', time_avg=True)
+diag.add_field('cloud_simple', 'cf_rad', time_avg=True)
+diag.add_field('cloud_simple', 'reff_rad', time_avg=True)
+diag.add_field('cloud_simple', 'frac_liq', time_avg=True)
+diag.add_field('cloud_simple', 'qcl_rad', time_avg=True)
diag.add_field('rrtm_radiation', 'olr', time_avg=True)
exp.diag_table = diag
@@ -75,7 +79,7 @@
'roughness_mom':3.21e-05,
'roughness_heat':3.21e-05,
'roughness_moist':3.21e-05,
- 'do_cloud_simple': False,
+ 'do_cloud_simple': True,
},
'cloud_simple_nml': {
'simple_cca':0.0,
@@ -151,7 +155,8 @@
'solr_cnst': 1360, #s set solar constant to 1360, rather than default of 1368.22
'dt_rad': 7200, #Use long RRTM timestep
'do_read_ozone':True,
- 'ozone_file':'ozone_1990'
+ 'ozone_file':'ozone_1990',
+ 'icld': 1 #cloud overlap method
},
# FMS Framework configuration
@@ -186,6 +191,6 @@
})
#Lets do a run!
if __name__=="__main__":
- exp.run(1, use_restart=False, num_cores=NCORES, overwrite_data=True)
+ exp.run(1, use_restart=False, num_cores=NCORES, overwrite_data=True)#, run_idb=True)
for i in range(2,25):
- exp.run(i, num_cores=NCORES, overwrite_data=True)
+ exp.run(i, num_cores=NCORES, overwrite_data=True)
\ No newline at end of file
diff --git a/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
index c189a04d2..13b5bd19f 100644
--- a/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
+++ b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
@@ -231,6 +231,5 @@
overwrite=False
exp.run(1, use_restart=False, num_cores=NCORES, overwrite_data=overwrite)#, run_idb=True)
-
for i in range(2,121):
exp.run(i, num_cores=NCORES, overwrite_data=overwrite)
\ No newline at end of file
From 2b35e13b4f61aefc252fb945bb447b60ec2db6f2 Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Thu, 21 May 2020 07:58:51 +0100
Subject: [PATCH 132/304] Changed socrates_aquaplanet.py to be more consistent
with master
---
exp/test_cases/socrates_test/socrates_aquaplanet.py | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/exp/test_cases/socrates_test/socrates_aquaplanet.py b/exp/test_cases/socrates_test/socrates_aquaplanet.py
index 14a163bd0..ba2d0d922 100644
--- a/exp/test_cases/socrates_test/socrates_aquaplanet.py
+++ b/exp/test_cases/socrates_test/socrates_aquaplanet.py
@@ -23,7 +23,7 @@
# create an Experiment object to handle the configuration of model parameters
# and output diagnostics
-exp = Experiment('soc_test_aquaplanet_without_clouds', codebase=cb)
+exp = Experiment('soc_test_aquaplanet', codebase=cb)
exp.clear_rundir()
inputfiles = [os.path.join(GFDL_BASE,'input/rrtm_input_files/ozone_1990.nc')]
@@ -60,11 +60,6 @@
diag.add_field('socrates', 'soc_toa_sw', time_avg=True)
diag.add_field('socrates', 'soc_toa_sw_down', time_avg=True)
-diag.add_field('cloud_simple', 'cf_rad', time_avg=True)
-diag.add_field('cloud_simple', 'reff_rad', time_avg=True)
-diag.add_field('cloud_simple', 'frac_liq', time_avg=True)
-diag.add_field('cloud_simple', 'qcl_rad', time_avg=True)
-
# additional output options commented out
#diag.add_field('socrates', 'soc_flux_lw', time_avg=True)
#diag.add_field('socrates', 'soc_flux_sw', time_avg=True)
@@ -161,7 +156,7 @@
},
'sat_vapor_pres_nml': {
- 'do_simple':True,
+ 'do_simple':True
},
'damping_driver_nml': {
From 57db0e4c363f2882d4bc6a79f74e302aeda5bba2 Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Thu, 21 May 2020 08:07:04 +0100
Subject: [PATCH 133/304] Remove redundent line
---
src/atmos_param/cloud_simple/cloud_simple.F90 | 12 +-----------
1 file changed, 1 insertion(+), 11 deletions(-)
diff --git a/src/atmos_param/cloud_simple/cloud_simple.F90 b/src/atmos_param/cloud_simple/cloud_simple.F90
index 91f81ea67..431c5909c 100644
--- a/src/atmos_param/cloud_simple/cloud_simple.F90
+++ b/src/atmos_param/cloud_simple/cloud_simple.F90
@@ -136,7 +136,6 @@ subroutine cloud_simple(p_half, p_full, Time, &
logical :: es_over_liq_and_ice
-
!check initiation has been done - ie read in parameters
if (do_init) call error_mesg ('cloud_simple', &
'cloud_simple_init has not been called.', FATAL)
@@ -268,21 +267,12 @@ subroutine calc_cf(q_hum, qsat, cf, cca, rh, simple_rhcrit, rh_min, rh_max)
if (spookie_protocol .eq. 1) then
cf = (rh - simple_rhcrit ) / ( 1.0 - simple_rhcrit )
- cf = MAX( 0.0, MIN( 1.0, cf))
else
cf = (rh - rh_min ) / ( rh_max - rh_min )
- cf = MAX( 0.0, MIN( 1.0, cf))
end if
- if (spookie_protocol .eq. 1) then
- cf = (rh - simple_rhcrit ) / ( 1.0 - simple_rhcrit )
- cf = MAX( 0.0, MIN( 1.0, cf))
-
- else
- cf = (rh - rh_min ) / ( rh_max - rh_min )
- cf = MAX( 0.0, MIN( 1.0, cf))
- end if
+ cf = MAX( 0.0, MIN( 1.0, cf))
! include simple convective cloud fraction where present (not currenly used)
cca = 0.0 ! no convective cloud fraction is calculated
From 259623ccf80c65d35ed041000c66ddf808caa0a7 Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Thu, 21 May 2020 08:12:12 +0100
Subject: [PATCH 134/304] Returned script to original form
---
postprocessing/plevel_interpolation/scripts/run_plevel.py | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/postprocessing/plevel_interpolation/scripts/run_plevel.py b/postprocessing/plevel_interpolation/scripts/run_plevel.py
index 5a04db3c1..334c15950 100644
--- a/postprocessing/plevel_interpolation/scripts/run_plevel.py
+++ b/postprocessing/plevel_interpolation/scripts/run_plevel.py
@@ -7,11 +7,11 @@
import subprocess
start_time=time.time()
-base_dir='/scratch/sit204/data_isca/'
-exp_name_list = ['soc_test_aquaplanet_with_clouds_post_jm_suggestions_amip_ssts_land_low_albedo']
+base_dir='/scratch/sit204/Data_2013/'
+exp_name_list = ['no_ice_flux_lhe_exps_q_flux_hadgem_anoms_3']
avg_or_daily_list=['monthly']
-start_file=96
-end_file=120
+start_file=287
+end_file=288
nfiles=(end_file-start_file)+1
do_extra_averaging=False #If true, then 6hourly data is averaged into daily data using cdo
From f7af8a9d3aef1bd4dfabaac5e418aa67723940d5 Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Thu, 21 May 2020 08:12:43 +0100
Subject: [PATCH 135/304] New script for running post-processing on cloud tests
---
.../scripts/run_plevel_cloud_tests.py | 108 ++++++++++++++++++
1 file changed, 108 insertions(+)
create mode 100644 postprocessing/plevel_interpolation/scripts/run_plevel_cloud_tests.py
diff --git a/postprocessing/plevel_interpolation/scripts/run_plevel_cloud_tests.py b/postprocessing/plevel_interpolation/scripts/run_plevel_cloud_tests.py
new file mode 100644
index 000000000..5a04db3c1
--- /dev/null
+++ b/postprocessing/plevel_interpolation/scripts/run_plevel_cloud_tests.py
@@ -0,0 +1,108 @@
+from netCDF4 import Dataset
+from plevel_fn import plevel_call, daily_average, join_files, two_daily_average, monthly_average
+import sys
+import os
+import time
+import pdb
+import subprocess
+
+start_time=time.time()
+base_dir='/scratch/sit204/data_isca/'
+exp_name_list = ['soc_test_aquaplanet_with_clouds_post_jm_suggestions_amip_ssts_land_low_albedo']
+avg_or_daily_list=['monthly']
+start_file=96
+end_file=120
+nfiles=(end_file-start_file)+1
+
+do_extra_averaging=False #If true, then 6hourly data is averaged into daily data using cdo
+group_months_into_one_file=False # If true then monthly data files and daily data files are merged into one big netcdf file each.
+level_set='standard' #Default is the standard levels used previously. ssw_diagnostics are the ones blanca requested for MiMa validation
+mask_below_surface_set=' ' #Default is to mask values that lie below the surface pressure when interpolated. For some applications, e.g. Tom Clemo's / Mark Baldwin's stratosphere index, you want to have values interpolated below ground, i.e. as if the ground wasn't there. To use this option, this value should be set to '-x '.
+
+
+try:
+ out_dir
+except:
+ out_dir = base_dir
+
+plevs={}
+var_names={}
+
+if level_set=='standard':
+
+ plevs['monthly']=' -p "3 16 51 138 324 676 1000 1266 2162 3407 5014 6957 9185 10000 11627 14210 16864 19534 20000 22181 24783 27331 29830 32290 34731 37173 39637 42147 44725 47391 50164 53061 56100 59295 62661 66211 70000 73915 78095 82510 85000 87175 92104 97312"'
+
+ plevs['timestep']=' -p "3 16 51 138 324 676 1000 1266 2162 3407 5014 6957 9185 10000 11627 14210 16864 19534 20000 22181 24783 27331 29830 32290 34731 37173 39637 42147 44725 47391 50164 53061 56100 59295 62661 66211 70000 73915 78095 82510 85000 87175 92104 97312"'
+
+ plevs['pentad']=' -p "3 16 51 138 324 676 1000 1266 2162 3407 5014 6957 9185 10000 11627 14210 16864 19534 20000 22181 24783 27331 29830 32290 34731 37173 39637 42147 44725 47391 50164 53061 56100 59295 62661 66211 70000 73915 78095 82510 85000 87175 92104 97312"'
+
+ plevs['6hourly']=' -p "1000 10000 25000 50000 85000 92500"'
+ plevs['daily'] =' -p "1000 10000 25000 50000 85000 92500"'
+
+ var_names['monthly']='-a slp height'
+ var_names['pentad']='-a slp height'
+ var_names['timestep']='-a'
+ var_names['6hourly']='ucomp slp height vor t_surf vcomp omega'
+ var_names['daily']='ucomp slp height vor t_surf vcomp omega temp'
+ file_suffix='_interp_new_height_temp'
+
+elif level_set=='ssw_diagnostics':
+ plevs['6hourly']=' -p "1000 10000"'
+ var_names['monthly']='ucomp temp height'
+ var_names['6hourly']='ucomp vcomp temp'
+ file_suffix='_bl'
+
+elif level_set=='tom_diagnostics':
+ var_names['daily']='height temp'
+ plevs['daily']=' -p "10 30 100 300 500 700 1000 3000 5000 7000 10000 15000 20000 25000 30000 40000 50000 60000 70000 75000 80000 85000 90000 95000 100000"'
+ mask_below_surface_set='-x '
+ file_suffix='_tom_mk2'
+
+
+for exp_name in exp_name_list:
+ for n in range(nfiles):
+ for avg_or_daily in avg_or_daily_list:
+ print(n+start_file)
+
+ number_prefix=''
+
+ if n+start_file < 1000:
+ number_prefix='0'
+ if n+start_file < 100:
+ number_prefix='00'
+ if n+start_file < 10:
+ number_prefix='000'
+
+ nc_file_in = base_dir+'/'+exp_name+'/run'+number_prefix+str(n+start_file)+'/atmos_'+avg_or_daily+'.nc'
+ nc_file_out = out_dir+'/'+exp_name+'/run'+number_prefix+str(n+start_file)+'/atmos_'+avg_or_daily+file_suffix+'.nc'
+
+ if not os.path.isfile(nc_file_out):
+ plevel_call(nc_file_in,nc_file_out, var_names = var_names[avg_or_daily], p_levels = plevs[avg_or_daily], mask_below_surface_option=mask_below_surface_set)
+ if do_extra_averaging and avg_or_daily=='6hourly':
+ nc_file_out_daily = base_dir+'/'+exp_name+'/run'+str(n+start_file)+'/atmos_daily'+file_suffix+'.nc'
+ daily_average(nc_file_out, nc_file_out_daily)
+ if do_extra_averaging and avg_or_daily=='pentad':
+ nc_file_out_daily = base_dir+'/'+exp_name+'/run'+str(n+start_file)+'/atmos_monthly'+file_suffix+'.nc'
+ monthly_average(nc_file_out, nc_file_out_daily, adjust_time = True)
+# if do_extra_averaging and avg_or_daily=='6hourly':
+# nc_file_out_two_daily = base_dir+'/'+exp_name+'/run'+str(n+start_file)+'/atmos_two_daily'+file_suffix+'.nc'
+# two_daily_average(nc_file_out, nc_file_out_two_daily, avg_or_daily)
+
+if group_months_into_one_file:
+ avg_or_daily_list_together=['daily']
+
+
+ for exp_name in exp_name_list:
+ for avg_or_daily in avg_or_daily_list_together:
+ nc_file_string=''
+ for n in range(nfiles):
+ nc_file_in = base_dir+'/'+exp_name+'/run'+number_prefix+str(n+start_file)+'/atmos_'+avg_or_daily+file_suffix+'.nc'
+ nc_file_string=nc_file_string+' '+nc_file_in
+ nc_file_out=base_dir+'/'+exp_name+'/atmos_'+avg_or_daily+'_together'+file_suffix+'.nc'
+ if not os.path.isfile(nc_file_out):
+ join_files(nc_file_string,nc_file_out)
+
+print('execution time', time.time()-start_time)
+
+
+
From e63e099e7e163b84e612812edec73ef173e0ae62 Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Thu, 21 May 2020 08:17:09 +0100
Subject: [PATCH 136/304] Merged back in stephens old changes that were missed
in rebase
---
src/extra/model/isca/path_names | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/extra/model/isca/path_names b/src/extra/model/isca/path_names
index c147c0ba3..eebdfd2b0 100644
--- a/src/extra/model/isca/path_names
+++ b/src/extra/model/isca/path_names
@@ -47,7 +47,7 @@ atmos_param/rrtm_radiation/rrtmg_lw/gcm_model/modules/rrlw_wvn.f90
atmos_param/rrtm_radiation/rrtm_radiation.f90
atmos_param/rrtm_radiation/rrtmg_lw/gcm_model/src/mcica_random_numbers.f90
atmos_param/rrtm_radiation/rrtmg_lw/gcm_model/src/rrtmg_lw_cldprop.f90
-atmos_param/rrtm_radiation/rrtmg_lw/gcm_model/src/rrtmg_lw_rad.f90
+atmos_param/rrtm_radiation/rrtmg_lw/gcm_model/src/rrtmg_lw_rad.nomcica.f90
atmos_param/rrtm_radiation/rrtmg_lw/gcm_model/src/rrtmg_lw_rtrn.f90
atmos_param/rrtm_radiation/rrtmg_lw/gcm_model/src/rrtmg_lw_setcoef.f90
atmos_param/rrtm_radiation/rrtmg_lw/gcm_model/src/mcica_subcol_gen_lw.f90
@@ -83,7 +83,7 @@ atmos_param/rrtm_radiation/rrtmg_sw/gcm_model/modules/rrsw_vsn.f90
atmos_param/rrtm_radiation/rrtmg_sw/gcm_model/modules/rrsw_wvn.f90
atmos_param/rrtm_radiation/rrtmg_sw/gcm_model/src/mcica_random_numbers.f90
atmos_param/rrtm_radiation/rrtmg_sw/gcm_model/src/mcica_subcol_gen_sw.f90
-atmos_param/rrtm_radiation/rrtmg_sw/gcm_model/src/rrtmg_sw_rad.f90
+atmos_param/rrtm_radiation/rrtmg_sw/gcm_model/src/rrtmg_sw_rad.nomcica.f90
atmos_param/rrtm_radiation/rrtmg_sw/gcm_model/src/rrtmg_sw_cldprop.f90
atmos_param/rrtm_radiation/rrtmg_sw/gcm_model/src/rrtmg_sw_cldprmc.f90
atmos_param/rrtm_radiation/rrtmg_sw/gcm_model/src/rrtmg_sw_init.f90
From 3bf24efe45dc260234c0ec81abcb05af8e93923f Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Thu, 21 May 2020 08:22:47 +0100
Subject: [PATCH 137/304] Resolved filename merge errors
---
src/extra/model/socrates/path_names | 92 +++++++++++++++++++++++++++++
1 file changed, 92 insertions(+)
diff --git a/src/extra/model/socrates/path_names b/src/extra/model/socrates/path_names
index 1a143cb31..0305b32ba 100644
--- a/src/extra/model/socrates/path_names
+++ b/src/extra/model/socrates/path_names
@@ -329,6 +329,89 @@ atmos_param/socrates/src/trunk/src/radiance_core/monochromatic_radiance.F90
atmos_param/socrates/src/trunk/src/radiance_core/aggregate_cloud.F90
atmos_param/socrates/src/trunk/src/radiance_core/radiance_calc.F90
atmos_param/socrates/src/trunk/src/radiance_core/ir_source.F90
+atmos_param/socrates/src/trunk/src/scatter/conjugate_gradient_cloud_90.f90
+atmos_param/socrates/src/trunk/src/scatter/method_weight_pcf.f90
+atmos_param/socrates/src/trunk/src/scatter/select_weight_scatter_90.f90
+atmos_param/socrates/src/trunk/src/scatter/measure_particle_pcf.f90
+atmos_param/socrates/src/trunk/src/scatter/prec_integral_tcf.f90
+atmos_param/socrates/src/trunk/src/scatter/def_s_scat_prop.f90
+atmos_param/socrates/src/trunk/src/scatter/db_scatter_integral.f90
+atmos_param/socrates/src/trunk/src/scatter/weightings_90.f90
+atmos_param/socrates/src/trunk/src/scatter/def_db_ss_mono.f90
+atmos_param/socrates/src/trunk/src/scatter/cloud_fitting.f90
+atmos_param/socrates/src/trunk/src/scatter/shape_particle_pcf.f90
+atmos_param/socrates/src/trunk/src/scatter/number_particle_90.f90
+atmos_param/socrates/src/trunk/src/scatter/db_interp_ss_mono.f90
+atmos_param/socrates/src/trunk/src/scatter/db_read_single_wavelength.f90
+atmos_param/socrates/src/trunk/src/scatter/get_refract_index.f90
+atmos_param/socrates/src/trunk/src/scatter/read_scatter_block_90.f90
+atmos_param/socrates/src/trunk/src/scatter/proj_area_particle.f90
+atmos_param/socrates/src/trunk/src/scatter/line_search_cloud_90.f90
+atmos_param/socrates/src/trunk/src/scatter/volume_particle.f90
+atmos_param/socrates/src/trunk/src/scatter/distribution_pcf.f90
+atmos_param/socrates/src/trunk/src/scatter/size_integral_90.f90
+atmos_param/socrates/src/trunk/src/scatter/particle_size_90.f90
+atmos_param/socrates/src/trunk/src/scatter/max_size_acf.f90
+atmos_param/socrates/src/trunk/src/scatter/write_average_90.f90
+atmos_param/socrates/src/trunk/src/scatter/adt_mitchell96.f90
+atmos_param/socrates/src/trunk/src/scatter/get_db_wavelengths.f90
+atmos_param/socrates/src/trunk/src/scatter/decompose_phf_90.f90
+atmos_param/socrates/src/trunk/src/scatter/cloud_fit_parm_acf.f90
+atmos_param/socrates/src/trunk/src/scatter/cloud_fit_90.f90
+atmos_param/socrates/src/trunk/src/scatter/ice_db_read_geometry.f90
+atmos_param/socrates/src/trunk/src/scatter/def_sct_db.f90
+atmos_param/socrates/src/trunk/src/scatter/open_average_90.f90
+atmos_param/socrates/src/trunk/src/scatter/def_size_dist.f90
+atmos_param/socrates/src/trunk/src/scatter/parm_integ_acf.f90
+atmos_param/socrates/src/trunk/src/scatter/bna_factor_ccf.f90
+atmos_param/socrates/src/trunk/src/scatter/def_db_crystal_geometry.f90
+atmos_param/socrates/src/trunk/src/scatter/get_wavelengths.f90
+atmos_param/socrates/src/trunk/src/scatter/weightings_single_90.f90
+atmos_param/socrates/src/trunk/src/scatter/scatter_algorithm_pcf.f90
+atmos_param/socrates/src/trunk/src/scatter/db_type_ucf.f90
+atmos_param/socrates/src/trunk/src/scatter/scatter_integral_90.f90
+atmos_param/socrates/src/trunk/src/correlated_k/voigt_profile.f90
+atmos_param/socrates/src/trunk/src/correlated_k/adjust_path.f90
+atmos_param/socrates/src/trunk/src/correlated_k/func_scale_90.f90
+atmos_param/socrates/src/trunk/src/correlated_k/read_pt_line_90.f90
+atmos_param/socrates/src/trunk/src/correlated_k/set_condition_ck_90.f90
+atmos_param/socrates/src/trunk/src/correlated_k/caviar_continuum_v1_0.f90
+atmos_param/socrates/src/trunk/src/correlated_k/rad_weight_90.f90
+atmos_param/socrates/src/trunk/src/correlated_k/select_weight_ck_90.f90
+atmos_param/socrates/src/trunk/src/correlated_k/trans_k_dist.f90
+atmos_param/socrates/src/trunk/src/correlated_k/type_residual_pcf.f90
+atmos_param/socrates/src/trunk/src/correlated_k/map_shell.f90
+atmos_param/socrates/src/trunk/src/correlated_k/terminate_scale_90.f90
+atmos_param/socrates/src/trunk/src/correlated_k/ckd_continuum_v2_4.f90
+atmos_param/socrates/src/trunk/src/correlated_k/write_fit_90.f90
+atmos_param/socrates/src/trunk/src/correlated_k/ck_parm_acf.f90
+atmos_param/socrates/src/trunk/src/correlated_k/fit_parabola_90.f90
+atmos_param/socrates/src/trunk/src/correlated_k/func_scale_derivative_90.f90
+atmos_param/socrates/src/trunk/src/correlated_k/optimal_k.f90
+atmos_param/socrates/src/trunk/src/correlated_k/open_file_out_90.f90
+atmos_param/socrates/src/trunk/src/correlated_k/residual_gradient_90.f90
+atmos_param/socrates/src/trunk/src/correlated_k/scale_ck_fit_90.f90
+atmos_param/socrates/src/trunk/src/correlated_k/read_ref_pt_90.f90
+atmos_param/socrates/src/trunk/src/correlated_k/corr_k_single.f90
+atmos_param/socrates/src/trunk/src/correlated_k/planck_90.f90
+atmos_param/socrates/src/trunk/src/correlated_k/exponent_fit_90.f90
+atmos_param/socrates/src/trunk/src/correlated_k/conjugate_gradient_90.f90
+atmos_param/socrates/src/trunk/src/correlated_k/line_prof_corr_mod.f90
+atmos_param/socrates/src/trunk/src/correlated_k/set_extern_ckd_frn_data.f90
+atmos_param/socrates/src/trunk/src/correlated_k/set_g_point_90.f90
+atmos_param/socrates/src/trunk/src/correlated_k/bi_interp.f90
+atmos_param/socrates/src/trunk/src/correlated_k/residual_trans_90.f90
+atmos_param/socrates/src/trunk/src/correlated_k/set_extern_ckd_self_data.f90
+atmos_param/socrates/src/trunk/src/correlated_k/line_search_90.f90
+atmos_param/socrates/src/trunk/src/correlated_k/read_hitran.f90
+atmos_param/socrates/src/trunk/src/correlated_k/read_nc.f90
+atmos_param/socrates/src/trunk/src/correlated_k/ckd_extern_data.f90
+atmos_param/socrates/src/trunk/src/correlated_k/def_hitran_record.f90
+atmos_param/socrates/src/trunk/src/correlated_k/d_planck_90.f90
+atmos_param/socrates/src/trunk/src/correlated_k/scale_parameters_acf.f90
+atmos_param/socrates/src/trunk/src/correlated_k/offset_residual_trans_acf.f90
+atmos_param/socrates/src/trunk/src/correlated_k/hitran_cnst.f90
+atmos_param/socrates/src/trunk/src/correlated_k/ck_fit_pcf.f90
atmos_param/socrates/src/trunk/src/aux/qsat_wat.F90
atmos_param/socrates/src/trunk/src/aux/qsat_gill.F90
atmos_param/socrates/src/trunk/src/aux/write_cdf.f90
@@ -351,6 +434,7 @@ atmos_param/socrates/src/trunk/src/general/make_block_18.f90
atmos_param/socrates/src/trunk/src/general/remove_negative_gas_90.f90
atmos_param/socrates/src/trunk/src/general/make_block_17.f90
atmos_param/socrates/src/trunk/src/general/make_block_1.f90
+atmos_param/socrates/src/trunk/src/general/solar_intensity_90.f90
atmos_param/socrates/src/trunk/src/general/make_block_19.f90
atmos_param/socrates/src/trunk/src/general/make_block_0.f90
atmos_param/socrates/src/trunk/src/general/make_block_10.f90
@@ -400,6 +484,8 @@ atmos_param/socrates/src/trunk/src/radiation_control/set_moist_aerosol_propertie
atmos_param/socrates/src/trunk/src/radiation_control/mcica_mod.F90
atmos_param/socrates/src/trunk/src/radiation_control/cld_generator_mod.F90
atmos_param/socrates/src/trunk/src/radiation_control/open_cloud_gen.F90
+atmos_param/socrates/src/trunk/src/um/out_nml.f90
+atmos_param/socrates/src/trunk/src/um/def_um_nml.f90
atmos_param/socrates/src/trunk/src/modules_core/errormessagelength_mod.F90
atmos_param/socrates/src/trunk/src/modules_core/dimensions_spec_ucf.F90
atmos_param/socrates/src/trunk/src/modules_core/rad_ccf.F90
@@ -411,6 +497,11 @@ atmos_param/socrates/src/trunk/src/modules_core/vectlib_mod.F90
atmos_param/socrates/src/trunk/src/modules_core/ereport_mod.F90
atmos_param/socrates/src/trunk/src/modules_core/realtype_rd.f90
atmos_param/socrates/src/trunk/src/modules_core/filenamelength_mod.F90
+atmos_param/socrates/src/trunk/src/scatter/grow_particles.f
+atmos_param/socrates/src/trunk/src/scatter/mie_scatter.f
+atmos_param/socrates/src/trunk/src/scatter/adt_integral.f
+atmos_param/socrates/src/trunk/src/scatter/gamma_fnc.f
+atmos_param/socrates/src/trunk/src/scatter/refractive_index.f
atmos_param/socrates/src/trunk/src/aux/output_vert_cdl.f
atmos_param/socrates/src/trunk/src/aux/assign_input_opt_cdf.f
atmos_param/socrates/src/trunk/src/aux/assign_input_ss_cdl.f
@@ -492,6 +583,7 @@ atmos_param/socrates/src/trunk/src/general/calc_planck_tbl.f
atmos_param/socrates/src/trunk/src/general/read_word.f
atmos_param/socrates/interface/read_control.F90
atmos_param/socrates/interface/set_atm.F90
+atmos_param/socrates/interface/set_cld.F90
atmos_param/socrates/interface/socrates_set_cld.F90
atmos_param/socrates/interface/set_dimen.F90
atmos_param/socrates/interface/socrates_config_mod.f90
From 7ec0fc5a429a6c1874760a99e59d9710262ba18b Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Thu, 21 May 2020 09:03:13 +0100
Subject: [PATCH 138/304] Minor fix
---
src/atmos_param/socrates/interface/socrates_config_mod.f90 | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/src/atmos_param/socrates/interface/socrates_config_mod.f90 b/src/atmos_param/socrates/interface/socrates_config_mod.f90
index 90a712da8..a0d102d5f 100644
--- a/src/atmos_param/socrates/interface/socrates_config_mod.f90
+++ b/src/atmos_param/socrates/interface/socrates_config_mod.f90
@@ -126,7 +126,6 @@ module socrates_config_mod
hfc134a_mix_ratio, &
inc_h2o, inc_co2, inc_co, inc_o3, inc_n2o, inc_ch4, inc_o2, &
inc_so2, inc_cfc11, inc_cfc12, inc_cfc113, inc_hcfc22, inc_hfc134a, &
- use_pressure_interp_for_half_levels, &
- frierson_solar_rad, del_sol, del_sw, &
- account_for_clouds_in_socrates
+ use_pressure_interp_for_half_levels, &
+ frierson_solar_rad, del_sol, del_sw
end module socrates_config_mod
From 67475802a0d2baf0b999864e87c22ad5d2ba15e6 Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Thu, 21 May 2020 09:03:33 +0100
Subject: [PATCH 139/304] Minor fix
---
src/atmos_param/socrates/interface/socrates_config_mod.f90 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/atmos_param/socrates/interface/socrates_config_mod.f90 b/src/atmos_param/socrates/interface/socrates_config_mod.f90
index a0d102d5f..8f9e9881b 100644
--- a/src/atmos_param/socrates/interface/socrates_config_mod.f90
+++ b/src/atmos_param/socrates/interface/socrates_config_mod.f90
@@ -126,6 +126,6 @@ module socrates_config_mod
hfc134a_mix_ratio, &
inc_h2o, inc_co2, inc_co, inc_o3, inc_n2o, inc_ch4, inc_o2, &
inc_so2, inc_cfc11, inc_cfc12, inc_cfc113, inc_hcfc22, inc_hfc134a, &
- use_pressure_interp_for_half_levels, &
+ use_pressure_interp_for_half_levels, &
frierson_solar_rad, del_sol, del_sw
end module socrates_config_mod
From 36959ed5fb2103ed81e3bac2a0528024e5d7e107 Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Thu, 21 May 2020 09:10:05 +0100
Subject: [PATCH 140/304] Removed redundent line
---
src/atmos_param/socrates/interface/socrates_calc.F90 | 1 -
1 file changed, 1 deletion(-)
diff --git a/src/atmos_param/socrates/interface/socrates_calc.F90 b/src/atmos_param/socrates/interface/socrates_calc.F90
index 5474d0d5f..c4a6018ff 100644
--- a/src/atmos_param/socrates/interface/socrates_calc.F90
+++ b/src/atmos_param/socrates/interface/socrates_calc.F90
@@ -183,7 +183,6 @@ subroutine socrates_calc(Time_diag,control, spectrum, &
t_rad_surf, cos_zenith_angle, solar_irrad, orog_corr, &
l_planet_grey_surface, planet_albedo, planet_emissivity)
-! call set_cld(control, dimen, spectrum, cld, n_profile)
zeros_cld = 0.
ten_microns_cld = 1.
From 00a4e3d7dc7540223532d7d96ac5f2b9873c9bbe Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Thu, 21 May 2020 09:57:09 +0100
Subject: [PATCH 141/304] Removed extra variable declarations (merge error)
---
.../socrates/interface/socrates_interface.F90 | 13 -------------
1 file changed, 13 deletions(-)
diff --git a/src/atmos_param/socrates/interface/socrates_interface.F90 b/src/atmos_param/socrates/interface/socrates_interface.F90
index e5c4920e6..00ca66b95 100644
--- a/src/atmos_param/socrates/interface/socrates_interface.F90
+++ b/src/atmos_param/socrates/interface/socrates_interface.F90
@@ -56,23 +56,11 @@ MODULE socrates_interface_mod
INTEGER :: id_soc_tdt_sw, id_soc_tdt_lw, id_soc_tdt_rad
INTEGER :: id_soc_surf_flux_lw, id_soc_surf_flux_sw
INTEGER :: id_soc_surf_flux_lw_down, id_soc_surf_flux_sw_down
-
- INTEGER :: id_soc_surf_flux_lw_clear, id_soc_surf_flux_sw_clear
- INTEGER :: id_soc_surf_flux_lw_down_clear, id_soc_surf_flux_sw_down_clear
-
- INTEGER :: id_soc_flux_lw, id_soc_flux_sw
-
- INTEGER :: id_soc_olr, id_soc_toa_sw
- INTEGER :: id_soc_olr_clear, id_soc_toa_sw_clear
-
- INTEGER :: id_soc_toa_sw_down
INTEGER :: id_soc_surf_flux_lw_clear, id_soc_surf_flux_sw_clear
- INTEGER :: id_soc_surf_flux_lw_down, id_soc_surf_flux_sw_down
INTEGER :: id_soc_surf_flux_lw_down_clear, id_soc_surf_flux_sw_down_clear
INTEGER :: id_soc_flux_lw, id_soc_flux_sw
INTEGER :: id_soc_olr, id_soc_toa_sw, id_soc_olr_clear, id_soc_toa_sw_clear
INTEGER :: id_soc_toa_sw_down, id_soc_toa_sw_down_clear
-
INTEGER :: id_soc_ozone, id_soc_co2, id_soc_coszen
INTEGER :: n_soc_bands_lw, n_soc_bands_sw
INTEGER :: n_soc_bands_lw_hires, n_soc_bands_sw_hires
@@ -1177,7 +1165,6 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
mmr_cl_rad_soc = 0.
endif
-
n_profile = INT(size(temp_in,2)*size(temp_in,1), kind(i_def))
n_layer = INT(size(temp_in,3), kind(i_def))
t_surf_for_soc = REAL(t_surf_in(:,:), kind(r_def))
From dfb4e639368d11dddab6d5b3ae3c906df1ef5772 Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Thu, 21 May 2020 10:45:38 +0100
Subject: [PATCH 142/304] Cleaned up var name cfa_rad to cf_rad. Cleaned up
variable declarations. Removed ref to account_for_clouds_in_soc
---
.../socrates_test/socrates_aquaplanet.py | 1 -
.../socrates_aquaplanet_with_cloud.py | 4 +--
.../rrtm_radiation/rrtm_radiation.f90 | 4 +--
.../socrates/interface/socrates_interface.F90 | 26 ++++++++-----------
.../driver/solo/idealized_moist_phys.F90 | 4 +--
5 files changed, 17 insertions(+), 22 deletions(-)
diff --git a/exp/test_cases/socrates_test/socrates_aquaplanet.py b/exp/test_cases/socrates_test/socrates_aquaplanet.py
index 58b713f4c..955b1df66 100644
--- a/exp/test_cases/socrates_test/socrates_aquaplanet.py
+++ b/exp/test_cases/socrates_test/socrates_aquaplanet.py
@@ -100,7 +100,6 @@
'use_pressure_interp_for_half_levels':False,
'tidally_locked':False,
#'solday': 90
- 'account_for_clouds_in_socrates': False,
},
'idealized_moist_phys_nml': {
'do_damping': True,
diff --git a/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
index 13b5bd19f..865a9d18a 100644
--- a/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
+++ b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
@@ -231,5 +231,5 @@
overwrite=False
exp.run(1, use_restart=False, num_cores=NCORES, overwrite_data=overwrite)#, run_idb=True)
- for i in range(2,121):
- exp.run(i, num_cores=NCORES, overwrite_data=overwrite)
\ No newline at end of file
+ #for i in range(2,121):
+ # exp.run(i, num_cores=NCORES, overwrite_data=overwrite)
diff --git a/src/atmos_param/rrtm_radiation/rrtm_radiation.f90 b/src/atmos_param/rrtm_radiation/rrtm_radiation.f90
index 92fdbcf4f..ee4859d1e 100644
--- a/src/atmos_param/rrtm_radiation/rrtm_radiation.f90
+++ b/src/atmos_param/rrtm_radiation/rrtm_radiation.f90
@@ -542,7 +542,7 @@ end subroutine interp_temp
!*****************************************************************************************
subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half, &
albedo,q,t,t_surf_rad,tdt, &
- coszen,flux_sw,flux_lw,cfa_rad,reff_rad, &
+ coszen,flux_sw,flux_lw,cf_rad,reff_rad, &
do_cloud_simple)
!
! Driver for RRTMG radiation scheme.
@@ -589,7 +589,7 @@ subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half, &
real(kind=rb),dimension(:,:),intent(out),optional :: flux_sw,flux_lw ! surface fluxes [W/m2]
! dimension (lat x lon)
! need to have both or none!
- real(kind=rb), dimension(:,:,:), intent(in) :: cfa_rad,reff_rad !cloud properties
+ real(kind=rb), dimension(:,:,:), intent(in) :: cf_rad,reff_rad !cloud properties
logical, intent(in) :: do_cloud_simple
diff --git a/src/atmos_param/socrates/interface/socrates_interface.F90 b/src/atmos_param/socrates/interface/socrates_interface.F90
index a868486b3..4adffbb89 100644
--- a/src/atmos_param/socrates/interface/socrates_interface.F90
+++ b/src/atmos_param/socrates/interface/socrates_interface.F90
@@ -124,18 +124,6 @@ SUBROUTINE socrates_init(is, ie, js, je, num_levels, axes, Time, lat, lonb, latb
!Initialise astronomy
call astronomy_init
- if(do_cloud_simple.and..not.account_for_clouds_in_socrates) then
-
- call error_mesg( 'run_socrates', &
- 'do_cloud_simple is True but account_for_clouds_in_socrates is False. Radiative effects of clouds NOT accounted for', WARNING)
-
- elseif(.not.do_cloud_simple.and.account_for_clouds_in_socrates) then
-
- call error_mesg( 'run_socrates', &
- 'do_cloud_simple is False but account_for_clouds_in_socrates is True. Radiative effects of clouds NOT accounted for', WARNING)
-
- endif
-
!Initialise variables related to radiation timestep
call get_time(delta_t_atmos,time_step_seconds)
@@ -840,10 +828,18 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
integer(i_def) :: n_profile, n_layer
real(r_def), dimension(size(temp_in,1), size(temp_in,2)) :: t_surf_for_soc, rad_lat_soc, rad_lon_soc, albedo_soc
- real(r_def), dimension(size(temp_in,1), size(temp_in,2), size(temp_in,3)) :: tg_tmp_soc, q_soc, ozone_soc, co2_soc, p_full_soc, output_heating_rate_sw, output_heating_rate_lw, output_heating_rate_total, z_full_soc
- real(r_def), dimension(size(temp_in,1), size(temp_in,2), size(temp_in,3)) :: cld_conv_frac_soc
- real(r_def), dimension(size(temp_in,1), size(temp_in,2), size(temp_in,3)) :: output_soc_flux_sw_down, output_soc_flux_sw_up, output_soc_flux_lw_down, output_soc_flux_lw_up, cld_frac_soc, reff_rad_soc, mmr_cl_rad_soc, qcl_rad_soc
+ real(r_def), dimension(size(temp_in,1), size(temp_in,2), size(temp_in,3)) :: tg_tmp_soc, q_soc, ozone_soc, co2_soc, p_full_soc
+ real(r_def), dimension(size(temp_in,1), size(temp_in,2), size(temp_in,3)) :: output_heating_rate_sw, output_heating_rate_lw
+ real(r_def), dimension(size(temp_in,1), size(temp_in,2), size(temp_in,3)) :: output_heating_rate_total, z_full_soc
+ real(r_def), dimension(size(temp_in,1), size(temp_in,2), size(temp_in,3)) :: cld_frac_soc, cld_conv_frac_soc
+ real(r_def), dimension(size(temp_in,1), size(temp_in,2), size(temp_in,3)) :: reff_rad_soc, mmr_cl_rad_soc, qcl_rad_soc
+
real(r_def), dimension(size(temp_in,1), size(temp_in,2), size(temp_in,3)+1) :: p_half_soc, t_half_out, z_half_soc
+ real(r_def), dimension(size(temp_in,1), size(temp_in,2), size(temp_in,3)+1) :: output_soc_flux_sw_down, output_soc_flux_sw_up
+ real(r_def), dimension(size(temp_in,1), size(temp_in,2), size(temp_in,3)+1) :: output_soc_flux_lw_down, output_soc_flux_lw_up
+ real(r_def), dimension(size(temp_in,1), size(temp_in,2), size(temp_in,3)+1) :: output_soc_flux_lw_down_clear, output_soc_flux_lw_up_clear
+ real(r_def), dimension(size(temp_in,1), size(temp_in,2), size(temp_in,3)+1) :: output_soc_flux_sw_down_clear, output_soc_flux_sw_up_clear
+
logical :: soc_lw_mode, used
integer :: seconds, days, year_in_s
diff --git a/src/atmos_spectral/driver/solo/idealized_moist_phys.F90 b/src/atmos_spectral/driver/solo/idealized_moist_phys.F90
index e914db31f..36efa6f85 100644
--- a/src/atmos_spectral/driver/solo/idealized_moist_phys.F90
+++ b/src/atmos_spectral/driver/solo/idealized_moist_phys.F90
@@ -801,7 +801,7 @@ subroutine idealized_moist_phys(Time, p_half, p_full, z_half, z_full, ug, vg, tg
real, dimension(size(ug,1), size(ug,2), size(ug,3)) :: tg_tmp, qg_tmp, RH,tg_interp, mc, dt_ug_conv, dt_vg_conv
! Simple cloud scheme variabilies to pass to radiation
-real, dimension(size(ug,1), size(ug,2), size(ug,3)) :: cfa_rad, reff_rad, qcl_rad, cca_rad
+real, dimension(size(ug,1), size(ug,2), size(ug,3)) :: cf_rad, reff_rad, qcl_rad, cca_rad
real, intent(in) , dimension(:,:,:), optional :: mask
integer, intent(in) , dimension(:,:), optional :: kbot
@@ -1113,7 +1113,7 @@ subroutine idealized_moist_phys(Time, p_half, p_full, z_half, z_full, ug, vg, tg
call interp_temp(z_full(:,:,:,current),z_half(:,:,:,current),tg_interp, Time)
call run_rrtmg(is,js,Time,rad_lat(:,:),rad_lon(:,:),p_full(:,:,:,current),p_half(:,:,:,current), &
albedo,grid_tracers(:,:,:,previous,nsphum),tg_interp,t_surf(:,:),dt_tg(:,:,:), &
- coszen,net_surf_sw_down(:,:),surf_lw_down(:,:), cfa_rad(:,:,:), reff_rad(:,:,:), &
+ coszen,net_surf_sw_down(:,:),surf_lw_down(:,:), cf_rad(:,:,:), reff_rad(:,:,:), &
do_cloud_simple )
endif
#endif
From 2608ff93c0fe9719e16e1f232678f038bab57de8 Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Thu, 21 May 2020 10:55:33 +0100
Subject: [PATCH 143/304] Soc with clouds compiles and runs for 1 month
---
exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
index 865a9d18a..013b4663d 100644
--- a/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
+++ b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
@@ -23,7 +23,7 @@
# create an Experiment object to handle the configuration of model parameters
# and output diagnostics
-exp = Experiment('soc_test_aquaplanet_with_clouds_post_jm_suggestions', codebase=cb)
+exp = Experiment('soc_test_aquaplanet_with_clouds_post_jm_suggestions', codebase=cb) # need to update after testing is complete.
exp.clear_rundir()
inputfiles = [os.path.join(GFDL_BASE,'input/rrtm_input_files/ozone_1990.nc')]
From 8b6606f402f8f9f4c21d9991e01296c3ac5e680c Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Thu, 21 May 2020 11:02:28 +0100
Subject: [PATCH 144/304] Changed error in filename
---
.../{MiMA_test_case_no_cloud.py => MiMA_test_case_with_cloud.py} | 0
1 file changed, 0 insertions(+), 0 deletions(-)
rename exp/test_cases/MiMA/{MiMA_test_case_no_cloud.py => MiMA_test_case_with_cloud.py} (100%)
diff --git a/exp/test_cases/MiMA/MiMA_test_case_no_cloud.py b/exp/test_cases/MiMA/MiMA_test_case_with_cloud.py
similarity index 100%
rename from exp/test_cases/MiMA/MiMA_test_case_no_cloud.py
rename to exp/test_cases/MiMA/MiMA_test_case_with_cloud.py
From b63f5eb5354bf139178b2dfd7ea25b1f40cb3486 Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Thu, 21 May 2020 11:10:41 +0100
Subject: [PATCH 145/304] Revert some changes during rebase and update to set
cloud scheme to off
---
exp/test_cases/MiMA/MiMA_test_case.py | 24 +++++++++++-------------
1 file changed, 11 insertions(+), 13 deletions(-)
diff --git a/exp/test_cases/MiMA/MiMA_test_case.py b/exp/test_cases/MiMA/MiMA_test_case.py
index 420fc1a3a..a2c0ce518 100644
--- a/exp/test_cases/MiMA/MiMA_test_case.py
+++ b/exp/test_cases/MiMA/MiMA_test_case.py
@@ -4,7 +4,7 @@
from isca import IscaCodeBase, DiagTable, Experiment, Namelist, GFDL_BASE
-NCORES = 16
+NCORES = 4
# a CodeBase can be a directory on the computer,
# useful for iterative development
@@ -19,11 +19,11 @@
# is used to load the correct compilers. The env file is always loaded from
# $GFDL_BASE and not the checked out git repo.
-cb.compile()#debug=True) # compile the source code to working directory $GFDL_WORK/codebase
+cb.compile() # compile the source code to working directory $GFDL_WORK/codebase
# create an Experiment object to handle the configuration of model parameters
# and output diagnostics
-exp = Experiment('mima_test_experiment_with_mcica', codebase=cb)
+exp = Experiment('mima_test_experiment', codebase=cb)
exp.inputfiles = [os.path.join(GFDL_BASE,'input/rrtm_input_files/ozone_1990.nc')]
@@ -43,7 +43,6 @@
diag.add_field('dynamics', 'temp', time_avg=True)
diag.add_field('dynamics', 'vor', time_avg=True)
diag.add_field('dynamics', 'div', time_avg=True)
-diag.add_field('rrtm_radiation', 'olr', time_avg=True)
exp.diag_table = diag
@@ -123,14 +122,13 @@
},
'sat_vapor_pres_nml': {
- 'do_simple':True,
- 'construct_table_wrt_liq_and_ice':True
+ 'do_simple':True
},
'damping_driver_nml': {
'do_rayleigh': True,
'trayfric': -0.5, # neg. value: time in *days*
- 'sponge_pbottom': 150.,
+ 'sponge_pbottom': 50.,
'do_conserve_energy': True,
},
@@ -142,8 +140,7 @@
'solr_cnst': 1360, #s set solar constant to 1360, rather than default of 1368.22
'dt_rad': 7200, #Use long RRTM timestep
'do_read_ozone':True,
- 'ozone_file':'ozone_1990',
- 'icld': 1 #cloud overlap method
+ 'ozone_file':'ozone_1990'
},
# FMS Framework configuration
@@ -168,7 +165,7 @@
'valid_range_t':[100.,800.],
'initial_sphum':[2.e-6],
'vert_coord_option':'uneven_sigma',
- 'surf_res':0.2,
+ 'surf_res':0.5,
'scale_heights' : 11.0,
'exponent':7.0,
'robert_coeff':0.03
@@ -178,6 +175,7 @@
})
#Lets do a run!
if __name__=="__main__":
- exp.run(1, use_restart=False, num_cores=NCORES, overwrite_data=True)#, run_idb=True)
- for i in range(2,25):
- exp.run(i, num_cores=NCORES, overwrite_data=True)
+ exp.run(1, use_restart=False, num_cores=NCORES)
+ for i in range(2,121):
+ exp.run(i, num_cores=NCORES)
+
From b9c466618e0b1d1b208ecfb1668aab3778e3eb02 Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Thu, 21 May 2020 11:42:57 +0100
Subject: [PATCH 146/304] RRTM not currenly working with cloud scheme. To be
investigated in seperate PR once simple cloud scheme is merged in usig soc
---
src/atmos_param/rrtm_radiation/rrtm_radiation.f90 | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/atmos_param/rrtm_radiation/rrtm_radiation.f90 b/src/atmos_param/rrtm_radiation/rrtm_radiation.f90
index ee4859d1e..daabf3f00 100644
--- a/src/atmos_param/rrtm_radiation/rrtm_radiation.f90
+++ b/src/atmos_param/rrtm_radiation/rrtm_radiation.f90
@@ -552,9 +552,11 @@ subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half, &
! Modules
use fms_mod, only: error_mesg, FATAL
use mpp_mod, only: mpp_pe,mpp_root_pe
- use rrtmg_lw_rad, only: rrtmg_lw, mcica_subcol_lw
- use rrtmg_sw_rad, only: rrtmg_sw, mcica_subcol_sw
- use astronomy_mod, only: diurnal_solar
+ use rrtmg_lw_rad, only: rrtmg_lw
+ use rrtmg_sw_rad, only: rrtmg_sw
+ use mcica_subcol_gen_lw, only: mcica_subcol_lw
+ use mcica_subcol_gen_sw, only: mcica_subcol_sw
+ use astronomy_mod, only: diurnal_solar
use rrtm_vars
use time_manager_mod,only: time_type,get_time,set_time, length_of_year, length_of_day
use interpolator_mod,only: interpolator
From 93c8933c30ed469fca390390433bfad587e18507 Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Fri, 22 May 2020 09:23:35 +0100
Subject: [PATCH 147/304] Change to namelist variables for cloud scheme
---
.../MiMA/MiMA_test_case_with_cloud.py | 7 +-
.../socrates_aquaplanet_with_cloud.py | 2 +-
...es_aquaplanet_with_cloud_amip_with_topo.py | 2 +-
src/atmos_param/cloud_simple/cloud_simple.F90 | 162 ++++++++++--------
.../driver/solo/idealized_moist_phys.F90 | 14 +-
5 files changed, 102 insertions(+), 85 deletions(-)
diff --git a/exp/test_cases/MiMA/MiMA_test_case_with_cloud.py b/exp/test_cases/MiMA/MiMA_test_case_with_cloud.py
index 0ece0f029..e544c14a3 100644
--- a/exp/test_cases/MiMA/MiMA_test_case_with_cloud.py
+++ b/exp/test_cases/MiMA/MiMA_test_case_with_cloud.py
@@ -82,13 +82,10 @@
'do_cloud_simple': True,
},
'cloud_simple_nml': {
- 'simple_cca':0.0,
+ 'cca_lower_limit':0.0,
'rhcsfc': 0.95,
'rhc700': 0.7,
'rhc200': 0.3,
- 'rhmsfc': 0.95,
- 'rhm700': 0.7,
- 'rhm200': 0.3,
},
'vert_turb_driver_nml': {
@@ -193,4 +190,4 @@
if __name__=="__main__":
exp.run(1, use_restart=False, num_cores=NCORES, overwrite_data=True)#, run_idb=True)
for i in range(2,25):
- exp.run(i, num_cores=NCORES, overwrite_data=True)
\ No newline at end of file
+ exp.run(i, num_cores=NCORES, overwrite_data=True)
diff --git a/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
index 013b4663d..c0ac93c70 100644
--- a/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
+++ b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
@@ -132,7 +132,7 @@
},
'cloud_simple_nml': {
- 'simple_cca':0.0,
+ 'cca_lower_limit':0.0,
'rhcsfc': 0.95,
'rhc700': 0.7,
'rhc200': 0.3
diff --git a/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud_amip_with_topo.py b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud_amip_with_topo.py
index 0c88efd1d..ad5632df3 100644
--- a/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud_amip_with_topo.py
+++ b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud_amip_with_topo.py
@@ -118,7 +118,7 @@
},
'cloud_simple_nml': {
- 'simple_cca':0.0,
+ 'cca_lower_limit':0.0,
'rhcsfc': 0.95,
'rhc700': 0.7,
'rhc200': 0.3
diff --git a/src/atmos_param/cloud_simple/cloud_simple.F90 b/src/atmos_param/cloud_simple/cloud_simple.F90
index 431c5909c..71f1eb20d 100644
--- a/src/atmos_param/cloud_simple/cloud_simple.F90
+++ b/src/atmos_param/cloud_simple/cloud_simple.F90
@@ -8,46 +8,49 @@ module cloud_simple_mod
use fms_mod, only: stdlog, FATAL, WARNING, error_mesg
use time_manager_mod, only: time_type
- use sat_vapor_pres_mod, only: compute_qs
+ use sat_vapor_pres_mod, only: compute_qs
+ use constants_mod, only: KELVIN
use diag_manager_mod, only: register_diag_field, send_data
implicit none
- logical :: do_init = .true. ! Check if init needs to be run
+ logical :: do_init = .true. ! update to false after init has been run
- real :: simple_cca = 0.0
+ real :: cca_lower_limit = 0.0 ! simple convective cloud fraction min
+ ! the default is zero. Not being used but
+ ! could be adapted in future.
- ! Critical RH (fraction) values - spookie protocol 1 only
- real :: rhc_sfc = 0.95
+ ! There were two testing schenarios developed for the sppookie-2 project.
+ ! The first was implemented but not tested very much. The second protocol is
+ ! what was used for that project and what has been more tested in Isca.
+
+ integer :: spookie_protocol = 2
+
+ ! Critical RH (fraction) values - spookie-2 protocol version 1
+ real :: rhc_sfc = 1.0
real :: rhc_base = 0.7
real :: rhc_top = 0.3
- !
- real :: rhmsfc = 0.95
- real :: rhm700 = 0.7
- real :: rhm200 = 0.3
- ! Critical RH (fraction) values - spookie protocol 2 only
- real :: rh_min_top = 0.9
+ ! Critical RH (fraction) values - spookie-2 protocol version 2
+ ! initial values for RH. Updated in calc_rh_min_max
real :: rh_min_sfc = 1.0
real :: rh_min_base = 0.8
- real :: rh_max_top = 1.0
+ real :: rh_min_top = 0.9
+
real :: rh_max_sfc = 1.0
real :: rh_max_base = 1.0
+ real :: rh_max_top = 1.0
- ! Pressure (Pa.) at cloud bottom and top (very approx)
+ ! Pressure (Pa) at cloud bottom and top (very approx)
real :: p_base = 70000.
real :: p_top = 20000.
- integer :: spookie_protocol = 2
+ namelist /cloud_simple_nml/ cca_lower_limit, rhc_sfc, rhc_base, rhc_top, &
- namelist /cloud_simple_nml/ simple_cca, rhc_sfc, rhc_base, rhc_top, &
- rhmsfc, rhm700, rhm200, &
rh_min_top, rh_min_sfc, rh_min_base, &
rh_max_top, rh_max_sfc, rh_max_base
- real :: zerodegc = 273.15
-
integer :: id_cf, id_reff_rad, id_frac_liq, id_qcl_rad, id_rh_in_cf, &
id_simple_rhcrit, id_rh_min
@@ -63,7 +66,7 @@ subroutine cloud_simple_init (axes, Time)
type(time_type), intent(in) :: Time
integer, intent(in), dimension(4) :: axes
- integer :: io ,stdlog_unit
+ integer :: io, stdlog_unit
#ifdef INTERNAL_FILE_NML
@@ -98,6 +101,8 @@ subroutine cloud_simple_init (axes, Time)
'Specific humidity of cloud liquid', &
'kg/kg')
+ ! rh_in_cf is an output diagnostic only for debugging
+
id_rh_in_cf = &
register_diag_field ( mod_name_cld, 'rh_in_cf', axes(1:3), Time, &
'RH as a percent', &
@@ -123,50 +128,57 @@ end subroutine cloud_simple_init
subroutine cloud_simple(p_half, p_full, Time, &
temp, q_hum, &
! outs
- cf, cca, reff_rad, qcl_rad)
+ cf, reff_rad, qcl_rad)
real , intent(in), dimension(:,:,:) :: temp, q_hum, p_full, p_half
type(time_type) , intent(in) :: Time
- real , intent(out), dimension(:,:,:) :: cf, reff_rad, qcl_rad, cca
+ real , intent(out), dimension(:,:,:) :: cf, reff_rad, qcl_rad
- real, dimension(size(temp,1), size(temp, 2), size(temp, 3)) :: qs, frac_liq, rh_in_cf, simple_rhcrit, rh_min, rh_max
+ real, dimension(size(temp,1), size(temp, 2), size(temp, 3)) :: qs, frac_liq
+ real, dimension(size(temp,1), size(temp, 2), size(temp, 3)) :: rh_in_cf
+ real, dimension(size(temp,1), size(temp, 2), size(temp, 3)) :: simple_rhcrit
+ real, dimension(size(temp,1), size(temp, 2), size(temp, 3)) :: rh_min,rh_max
integer :: i, j, k, k_surf
logical :: es_over_liq_and_ice
- !check initiation has been done - ie read in parameters
+ !check initiation has been done
if (do_init) call error_mesg ('cloud_simple', &
'cloud_simple_init has not been called.', FATAL)
-
- ! Get the saturated specific humidity TOTAL (ie ice and vap) ***double check maths!
+
+ ! Get the saturated specific humidity with respect to water and ice
+ ! this is set by the namelist variable sat_vapor_pres_nml
call compute_qs(temp, p_full, qs)
- k_surf = size(temp, 3)
+ k_surf = size(temp, 3) !set the location of the lowest model level
do i=1, size(temp, 1)
do j=1, size(temp, 2)
do k=1, size(temp, 3)
- ! caluclate the liquid fraction, effective radius, critical RH for
- ! the simple cloud scheme and cloud fraction.
- ! rh_in_cf is an output diagnostic only for debugging
+ ! calculate the liquid fraction
call calc_liq_frac(temp(i,j,k), frac_liq(i,j,k))
+ ! calculate the effective radius
call calc_reff(frac_liq(i,j,k), reff_rad(i,j,k))
if (spookie_protocol .eq. 1) then
+ ! calculate the critical RH
call calc_rhcrit(p_full(i,j,k), p_full(i,j,k_surf), simple_rhcrit(i,j,k))
else
+ ! calculate the min and max RH
call calc_rh_min_max(p_full(i,j,k), p_full(i,j,k_surf),rh_min(i,j,k), rh_max(i,j,k))
endif
+ ! calculate the cloud fraction
call calc_cf(q_hum(i,j,k), qs(i,j,k), cf(i,j,k), cca(i,j,k), rh_in_cf(i,j,k), &
simple_rhcrit = simple_rhcrit(i,j,k), &
rh_min = rh_min(i,j,k), rh_max = rh_max(i,j,k) )
- call calc_qcl_rad(p_full(i,j,k), cf(i,j,k), temp(i,j,k), qcl_rad(i,j,k) )
+ ! calculate the specific humidity of cloud liquid
+ call calc_mixing_ratio(p_full(i,j,k), cf(i,j,k), temp(i,j,k), qcl_rad(i,j,k) )
end do
end do
end do
@@ -177,19 +189,19 @@ subroutine cloud_simple(p_half, p_full, Time, &
end subroutine cloud_simple
subroutine calc_liq_frac(temp, frac_liq)
- ! All liquid if above zero and all ice below -40C
- ! linearly interpolate between T=0 and -40C
real, intent(in) :: temp
real, intent(out) :: frac_liq
-
- if (temp > zerodegc) then
+ if (temp > KELVIN) then
+ ! All liquid if temp above zero
frac_liq = 1.0
- else if (temp < zerodegc-40.0) then
+ else if (temp < KELVIN-40.0) then
+ ! All ice if temp is below -40C
frac_liq = 0.0
else
- frac_liq = 1.0 - (zerodegc-temp) / 40.0
+ ! linearly interpolate between T=0 and -40C
+ frac_liq = 1.0 - (KELVIN-temp) / 40.0
end if
@@ -233,29 +245,37 @@ subroutine calc_rh_min_max(p_full, p_surf, rh_min, rh_max)
real, intent(in) :: p_full, p_surf
real, intent(out) :: rh_min, rh_max
+ real :: layer
- if (p_full > p_base ) then !surface up to base
+ ! calculate RH min and max as a function of pressure
- rh_min = rh_min_sfc - ( rh_min_sfc - rh_min_base ) * ( p_surf - p_full ) / ( p_surf - p_base )
- rh_max = rh_max_sfc - ( rh_max_sfc - rh_max_base ) * ( p_surf - p_full ) / ( p_surf - p_base )
+ if (p_full > p_base) then
+ ! For the layer between the surface and cloud base (default is 700 hpa)
- else if ( p_full > p_top ) then ! base up to top
+ layer = (p_surf - p_full) / (p_surf - p_base)
- rh_min = rh_min_base - ( rh_min_base - rh_min_top ) * (p_base - p_full) / (p_base - p_top)
- rh_max = rh_max_base - ( rh_max_base - rh_max_top ) * (p_base - p_full) / (p_base - p_top)
-
- else ! above top
+ ! correction step to update initial values
+ rh_min = rh_min_sfc - (rh_min_sfc - rh_min_base) * layer
+ rh_max = rh_max_sfc - (rh_max_sfc - rh_max_base) * layer
+
+ else if ( p_full > p_top ) then
+ ! For the layer where the cloud is (base up to top)
+ layer = (p_base - p_full) / (p_base - p_top)
+ rh_min = rh_min_base - ( rh_min_base - rh_min_top ) * layer
+ rh_max = rh_max_base - ( rh_max_base - rh_max_top ) * layer
+
+ else
+ ! Above the cloud top above top
rh_min = rh_min_top
rh_max = rh_max_top
-
endif
end subroutine calc_rh_min_max
subroutine calc_cf(q_hum, qsat, cf, cca, rh, simple_rhcrit, rh_min, rh_max)
- ! Calculate LS (stratiform) cloud fraction
+ ! Calculate large scale (stratiform) cloud fraction
! as a simple linear function of RH
real, intent(in) :: q_hum, qsat
@@ -263,6 +283,7 @@ subroutine calc_cf(q_hum, qsat, cf, cca, rh, simple_rhcrit, rh_min, rh_max)
real, intent(out) :: cf, rh, cca
+ ! The environment RH
rh = q_hum/qsat
if (spookie_protocol .eq. 1) then
@@ -274,41 +295,46 @@ subroutine calc_cf(q_hum, qsat, cf, cca, rh, simple_rhcrit, rh_min, rh_max)
cf = MAX( 0.0, MIN( 1.0, cf))
- ! include simple convective cloud fraction where present (not currenly used)
- cca = 0.0 ! no convective cloud fraction is calculated
- ! left in for future use
-
- !cca can not be used in simple clouds as in read_control
- ! control%i_cloud_representation = ip_cloud_ice_water
+ ! include simple convective cloud fraction where present
+ ! This is currently not being used and array are zeros as
+ ! no convective cloud fraction is calculated
+ ! left in for future use
- if (cca > 0.0) then
- cf = MAX( simple_cca, cf )
- end if
+ !if (cca > 0.0) then
+ ! cf = MAX( cca_lower_limit, cf )
+ !end if
end subroutine calc_cf
- subroutine calc_qcl_rad(p_full, cf, temp, qcl_rad)
+ subroutine calc_mixing_ratio(p_full, cf, temp, qcl_rad)
+
! calculate cloud water content
real , intent(in) :: p_full, cf, temp
- real , intent(out) :: qcl_rad
+ real , intent(out) :: qcl_rad ! mixing ratio of cloud liquid
real :: in_cloud_qcl
IF (spookie_protocol .eq. 1) THEN
! pressure dependent in_cloud_qcl
+ ! bounded between:
+ ! 1 g/kg at 1000hpa
+ ! 3e-4 g/kg at 200 hpa
in_cloud_qcl = 3.0e-4 + (1.0-3.0e-4)*(p_full-p_top)/80000.0
- in_cloud_qcl = MAX ( 0.0, in_cloud_qcl/1000.0 ) ! convert to kg/kg
- qcl_rad = cf * in_cloud_qcl
+ in_cloud_qcl = MAX ( 0.0, in_cloud_qcl) ! in g/kg
ELSE
- ! temperatue dependent in_cloud_qcl
- in_cloud_qcl = MIN(0.2, 0.2 * ( temp - 220. ) / ( 280. -220. ))
- in_cloud_qcl = MAX (3.0e-4, in_cloud_qcl/1000.0 ) ! convert to kg/kg
- qcl_rad = cf * in_cloud_qcl
+ ! temperatue dependent in_cloud_qcl
+ ! bounded between:
+ ! 3e-4 g/kg at 220 K
+ ! 0.2 g/kg at 280K
+ in_cloud_qcl = MIN(0.2, 0.2 * ( temp - 220. ) / ( 280. - 220. ))
+ in_cloud_qcl = MAX (3.0e-4, in_cloud_qcl) ! in g/kg
ENDIF
- end subroutine calc_qcl_rad
+ qcl_rad = cf * in_cloud_qcl/1000. ! convert to kg/kg
+
+ end subroutine calc_mixing_ratio
subroutine output_cloud_diags(cf, reff_rad, frac_liq, qcl_rad, rh_in_cf, simple_rhcrit, rh_min, Time)
@@ -349,12 +375,4 @@ subroutine output_cloud_diags(cf, reff_rad, frac_liq, qcl_rad, rh_in_cf, simple_
end subroutine output_cloud_diags
- subroutine cloud_simple_end ()
-
- ! If alloocated are added in init then deallocate them here.
-
- end subroutine cloud_simple_end
-
- !-----------------------------------------------
-
end module cloud_simple_mod
diff --git a/src/atmos_spectral/driver/solo/idealized_moist_phys.F90 b/src/atmos_spectral/driver/solo/idealized_moist_phys.F90
index 36efa6f85..7b28fabc0 100644
--- a/src/atmos_spectral/driver/solo/idealized_moist_phys.F90
+++ b/src/atmos_spectral/driver/solo/idealized_moist_phys.F90
@@ -18,7 +18,7 @@ module idealized_moist_phys_mod
use two_stream_gray_rad_mod, only: two_stream_gray_rad_init, two_stream_gray_rad_down, two_stream_gray_rad_up, two_stream_gray_rad_end
-use cloud_simple_mod, only: cloud_simple_init, cloud_simple_end, cloud_simple
+use cloud_simple_mod, only: cloud_simple_init, cloud_simple
use mixed_layer_mod, only: mixed_layer_init, mixed_layer, mixed_layer_end, albedo_calc
@@ -970,10 +970,12 @@ subroutine idealized_moist_phys(Time, p_half, p_full, z_half, z_full, ug, vg, tg
! Using start of time step variables
! using soecific humidity NOT mixing ratios
- !Set to zero regarles of if clouds are used in radiation code
- cf_rad = 0.
- reff_rad = 0.
- qcl_rad = 0.
+! initialise outs to zero
+
+cf_rad(:,:,:) = 0.
+reff_rad(:,:,:) = 0.
+qcl_rad(:,:,:) = 0.
+cca_rad(:,:,:) = 0.
if(do_cloud_simple) then
@@ -982,7 +984,7 @@ subroutine idealized_moist_phys(Time, p_half, p_full, z_half, z_full, ug, vg, tg
tg(:,:,:,previous), &
grid_tracers(:,:,:,previous,nsphum), &
! outs -
- cf_rad(:,:,:), cca_rad(:,:,:), &
+ cf_rad(:,:,:), &
reff_rad(:,:,:), qcl_rad(:,:,:) &
)
From c9ab5bee3eed2f4662a3471e684d01d66a47b56d Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Wed, 10 Jun 2020 14:51:24 +0100
Subject: [PATCH 148/304] Test case missing zsurf that is needed for
interpolation
---
exp/test_cases/socrates_test/socrates_aquaplanet.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/exp/test_cases/socrates_test/socrates_aquaplanet.py b/exp/test_cases/socrates_test/socrates_aquaplanet.py
index 955b1df66..1ef82e914 100644
--- a/exp/test_cases/socrates_test/socrates_aquaplanet.py
+++ b/exp/test_cases/socrates_test/socrates_aquaplanet.py
@@ -32,10 +32,13 @@
diag = DiagTable()
diag.add_file('atmos_monthly', 30, 'days', time_units='days')
-#Tell model which diagnostics to write
+#Write out diagnostics need for vertical interpolation post-processing
diag.add_field('dynamics', 'ps', time_avg=True)
diag.add_field('dynamics', 'bk')
diag.add_field('dynamics', 'pk')
+diag.add_field('dynamics', 'zsurf', time_avg=True)
+
+#Tell model which diagnostics to write
diag.add_field('atmosphere', 'precipitation', time_avg=True)
diag.add_field('mixed_layer', 't_surf', time_avg=True)
diag.add_field('dynamics', 'sphum', time_avg=True)
From b99f12e818fdcc2298f2bfee4d0a3da8ddd623b5 Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Wed, 10 Jun 2020 14:52:18 +0100
Subject: [PATCH 149/304] Update vertical interpolation levels. Bug fix to
clear sky fluxes in soc interface
---
.../scripts/run_plevel_cloud_tests.py | 24 +++++++++++--------
src/atmos_param/cloud_simple/cloud_simple.F90 | 14 +++++------
.../socrates/interface/socrates_interface.F90 | 21 ++++++++++++++++
.../driver/solo/idealized_moist_phys.F90 | 4 ++--
4 files changed, 44 insertions(+), 19 deletions(-)
diff --git a/postprocessing/plevel_interpolation/scripts/run_plevel_cloud_tests.py b/postprocessing/plevel_interpolation/scripts/run_plevel_cloud_tests.py
index 5a04db3c1..95b120485 100644
--- a/postprocessing/plevel_interpolation/scripts/run_plevel_cloud_tests.py
+++ b/postprocessing/plevel_interpolation/scripts/run_plevel_cloud_tests.py
@@ -7,16 +7,16 @@
import subprocess
start_time=time.time()
-base_dir='/scratch/sit204/data_isca/'
-exp_name_list = ['soc_test_aquaplanet_with_clouds_post_jm_suggestions_amip_ssts_land_low_albedo']
+base_dir='/scratch/pm366/OutputIsca/'
+exp_name_list = ['soc_test_aquaplanet_with_clouds']
avg_or_daily_list=['monthly']
-start_file=96
+start_file=1
end_file=120
nfiles=(end_file-start_file)+1
do_extra_averaging=False #If true, then 6hourly data is averaged into daily data using cdo
group_months_into_one_file=False # If true then monthly data files and daily data files are merged into one big netcdf file each.
-level_set='standard' #Default is the standard levels used previously. ssw_diagnostics are the ones blanca requested for MiMa validation
+level_set='era_int' #Default is the standard levels used previously. ssw_diagnostics are the ones blanca requested for MiMa validation
mask_below_surface_set=' ' #Default is to mask values that lie below the surface pressure when interpolated. For some applications, e.g. Tom Clemo's / Mark Baldwin's stratosphere index, you want to have values interpolated below ground, i.e. as if the ground wasn't there. To use this option, this value should be set to '-x '.
@@ -46,17 +46,21 @@
var_names['daily']='ucomp slp height vor t_surf vcomp omega temp'
file_suffix='_interp_new_height_temp'
+elif level_set=='era_int':
+
+ plevs['monthly']=' -p "10000 15000 20000 25000 30000 35000 40000 45000 50000 55000 60000 65000 70000 75000 80000 85000 90000 95000 97500 100000"'
+ plevs['daily'] =' -p "10000 15000 20000 25000 30000 35000 40000 45000 50000 55000 60000 65000 70000 75000 80000 85000 90000 95000 97500 100000"'
+
+ var_names['monthly']='-a height'
+ var_names['daily']='-a height'
+
+ file_suffix='_interp_all'
+
elif level_set=='ssw_diagnostics':
plevs['6hourly']=' -p "1000 10000"'
var_names['monthly']='ucomp temp height'
var_names['6hourly']='ucomp vcomp temp'
file_suffix='_bl'
-
-elif level_set=='tom_diagnostics':
- var_names['daily']='height temp'
- plevs['daily']=' -p "10 30 100 300 500 700 1000 3000 5000 7000 10000 15000 20000 25000 30000 40000 50000 60000 70000 75000 80000 85000 90000 95000 100000"'
- mask_below_surface_set='-x '
- file_suffix='_tom_mk2'
for exp_name in exp_name_list:
diff --git a/src/atmos_param/cloud_simple/cloud_simple.F90 b/src/atmos_param/cloud_simple/cloud_simple.F90
index 71f1eb20d..64c6e262a 100644
--- a/src/atmos_param/cloud_simple/cloud_simple.F90
+++ b/src/atmos_param/cloud_simple/cloud_simple.F90
@@ -47,7 +47,6 @@ module cloud_simple_mod
real :: p_top = 20000.
namelist /cloud_simple_nml/ cca_lower_limit, rhc_sfc, rhc_base, rhc_top, &
-
rh_min_top, rh_min_sfc, rh_min_base, &
rh_max_top, rh_max_sfc, rh_max_base
@@ -128,12 +127,12 @@ end subroutine cloud_simple_init
subroutine cloud_simple(p_half, p_full, Time, &
temp, q_hum, &
! outs
- cf, reff_rad, qcl_rad)
+ cf, cca, reff_rad, qcl_rad)
real , intent(in), dimension(:,:,:) :: temp, q_hum, p_full, p_half
type(time_type) , intent(in) :: Time
- real , intent(out), dimension(:,:,:) :: cf, reff_rad, qcl_rad
+ real , intent(inout), dimension(:,:,:) :: cf, cca, reff_rad, qcl_rad
real, dimension(size(temp,1), size(temp, 2), size(temp, 3)) :: qs, frac_liq
real, dimension(size(temp,1), size(temp, 2), size(temp, 3)) :: rh_in_cf
@@ -213,13 +212,14 @@ subroutine calc_reff(frac_liq, reff_rad)
real, intent(in) :: frac_liq
real, intent(out) :: reff_rad
- reff_rad = 10.0 * frac_liq + 20.0 * (1.0 - frac_liq) !units in microns
+ reff_rad = 10.0 * frac_liq + 20.0 * (1.0 - frac_liq)
+ ! units in microns this will be updated before passing into soc
end subroutine calc_reff
- subroutine calc_rhcrit(p_full, p_surf, simple_rhcrit) !need to check p_full - > p_layer_centres
- ! get the RH needed as a threshold for the cloud fraction calc.
- ! This is only requires for spookie_protocol=1
+ subroutine calc_rhcrit(p_full, p_surf, simple_rhcrit)
+ ! Get the RH needed as a threshold for the cloud fraction calc.
+ ! This is only requires for spookmie_protocol=1
real, intent(in) :: p_full, p_surf
real, intent(out) :: simple_rhcrit
diff --git a/src/atmos_param/socrates/interface/socrates_interface.F90 b/src/atmos_param/socrates/interface/socrates_interface.F90
index 4adffbb89..4afcaee31 100644
--- a/src/atmos_param/socrates/interface/socrates_interface.F90
+++ b/src/atmos_param/socrates/interface/socrates_interface.F90
@@ -1330,15 +1330,27 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
if(id_soc_surf_flux_lw > 0) then
used = send_data ( id_soc_surf_flux_lw, surf_lw_net, Time_diag)
endif
+ if(id_soc_surf_flux_lw_clear > 0) then
+ used = send_data ( id_soc_surf_flux_lw_clear, surf_lw_net_clear, Time_diag)
+ endif
if(id_soc_surf_flux_lw_down > 0) then
used = send_data ( id_soc_surf_flux_lw_down, surf_lw_down, Time_diag)
endif
+ if(id_soc_surf_flux_lw_down_clear > 0) then
+ used = send_data ( id_soc_surf_flux_lw_down_clear, surf_lw_down_clear, Time_diag)
+ endif
if(id_soc_surf_flux_sw > 0) then
used = send_data ( id_soc_surf_flux_sw, net_surf_sw_down, Time_diag)
endif
+ if(id_soc_surf_flux_sw_clear > 0) then
+ used = send_data ( id_soc_surf_flux_sw_clear, net_surf_sw_down_clear, Time_diag)
+ endif
if(id_soc_surf_flux_sw_down > 0) then
used = send_data ( id_soc_surf_flux_sw_down, surf_sw_down, Time_diag)
endif
+ if(id_soc_surf_flux_sw_down_clear > 0) then
+ used = send_data ( id_soc_surf_flux_sw_down_clear, surf_sw_down_clear, Time_diag)
+ endif
if(id_soc_olr > 0) then
used = send_data ( id_soc_olr, olr, Time_diag)
endif
@@ -1348,15 +1360,24 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
if(id_soc_toa_sw > 0) then
used = send_data ( id_soc_toa_sw, toa_sw, Time_diag)
endif
+ if(id_soc_toa_sw_clear > 0) then
+ used = send_data ( id_soc_toa_sw_clear, toa_sw_clear, Time_diag)
+ endif
if(id_soc_toa_sw_down > 0) then
used = send_data ( id_soc_toa_sw_down, toa_sw_down, Time_diag)
endif
+ if(id_soc_toa_sw_down_clear > 0) then
+ used = send_data ( id_soc_toa_sw_down_clear, toa_sw_down_clear, Time_diag)
+ endif
if(id_soc_flux_lw > 0) then
used = send_data ( id_soc_flux_lw, thd_lw_flux_net, Time_diag)
endif
if(id_soc_surf_flux_lw_down > 0) then
used = send_data ( id_soc_surf_flux_lw_down, surf_lw_down, Time_diag)
endif
+ if(id_soc_surf_flux_lw_down_clear > 0) then
+ used = send_data ( id_soc_surf_flux_lw_down_clear, surf_lw_down_clear, Time_diag)
+ endif
if(id_soc_flux_sw > 0) then
used = send_data ( id_soc_flux_sw, thd_sw_flux_net, Time_diag)
endif
diff --git a/src/atmos_spectral/driver/solo/idealized_moist_phys.F90 b/src/atmos_spectral/driver/solo/idealized_moist_phys.F90
index 7b28fabc0..a82a9ca76 100644
--- a/src/atmos_spectral/driver/solo/idealized_moist_phys.F90
+++ b/src/atmos_spectral/driver/solo/idealized_moist_phys.F90
@@ -983,8 +983,8 @@ subroutine idealized_moist_phys(Time, p_half, p_full, z_half, z_full, ug, vg, tg
Time, &
tg(:,:,:,previous), &
grid_tracers(:,:,:,previous,nsphum), &
- ! outs -
- cf_rad(:,:,:), &
+ ! inouts -
+ cf_rad(:,:,:), cca_rad(:,:,:), &
reff_rad(:,:,:), qcl_rad(:,:,:) &
)
From a83d94e06ba8bb9b03b9c084c15e14f5f4db9824 Mon Sep 17 00:00:00 2001
From: mckimb <35553666+mckimb@users.noreply.github.com>
Date: Wed, 15 Jul 2020 11:12:27 +0200
Subject: [PATCH 150/304] Create remote_access.rst
In this commit I created the basic structure of remote_access.rst
---
docs/source/remote_access.rst | 37 +++++++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)
create mode 100644 docs/source/remote_access.rst
diff --git a/docs/source/remote_access.rst b/docs/source/remote_access.rst
new file mode 100644
index 000000000..9969fe722
--- /dev/null
+++ b/docs/source/remote_access.rst
@@ -0,0 +1,37 @@
+Remote Access
+==============
+
+Summary
+-------
+This is a guide for how to edit remote files on a local text editor via port-
+fowarding. By the end you should know:
+
+* how to quickly login to your remote server using an SSH config file
+* how to edit remote files in a local text editor through ``rmate``
+* how to edit remote python files in a local ``jupyter`` environment
+
+Simplifying Logins
+------------------
+If you use a Unix-based operating system on your personal computer, you can make use
+of an SSH config file to create shortcuts to your frequently used remote computers.
+
+Edit Remote Files Locally
+-------------------------
+As an alternative to remote-based text editors such as ``vi`` and ``emacs``, we can
+use port-fowarding to set up a local-based text editor like ``Atom`` which includes
+features such as syntax highlighting and code completion.
+
+Edit Remote python Files in a ``jupyter`` Environment
+-----------------------------------------------------
+The ``jupyter`` environment is a great environent for data exploration and integrating
+your figures inline with your code.
+
+
+References
+----------
+..
+ Add relevant references. This is done in 2 steps:
+ 1. Add the reference itself to docs/source/references.rst
+ 2. Insert the citation key here, e.g. [Vallis2017]_
+
+ See the Contributing guide for more info.
From 3a830c5cb3179190c44f93e8a822821c7c78614e Mon Sep 17 00:00:00 2001
From: mckimb <35553666+mckimb@users.noreply.github.com>
Date: Wed, 15 Jul 2020 12:05:10 +0200
Subject: [PATCH 151/304] Update remote_access.rst
Added how to set up an SSH config file and set up port-fowarding.
---
docs/source/remote_access.rst | 34 +++++++++++++++++++++++++++++++---
1 file changed, 31 insertions(+), 3 deletions(-)
diff --git a/docs/source/remote_access.rst b/docs/source/remote_access.rst
index 9969fe722..068883af6 100644
--- a/docs/source/remote_access.rst
+++ b/docs/source/remote_access.rst
@@ -10,10 +10,38 @@ fowarding. By the end you should know:
* how to edit remote files in a local text editor through ``rmate``
* how to edit remote python files in a local ``jupyter`` environment
-Simplifying Logins
-------------------
+Simplifying Logins and Port Fowarding
+-------------------------------------
If you use a Unix-based operating system on your personal computer, you can make use
-of an SSH config file to create shortcuts to your frequently used remote computers.
+of an SSH config file to create shortcuts to your frequently used remote computers. We will take this one step further to simplify port-fowarding, a method which allows a user to redirect data from a specified remote host and port, through a secure tunnel, to a specified local port. Port-fowarding is helfpul because it will enable us to edit remote files locally.
+
+As an example without any fancy tricks, let's set up an SSH tunnel that maps ``localhost`` port 3039 on my local machine to 8450 on my remote machine (the number is arbitrary as long as its between 1024 and 49150): ``$ ssh -l localhost:3039:host:8450 user@host``. You will then be required to enter in your password. This is cumbersome to repeat everytime we log in. Our goal will be to shorten the command to : ``$ ssh hostalias`` and without having to enter in your password. We give some instructions below:
+
+**1.** In the home directory of your **local machine**, create a new directory called ``.ssh`` if it does not already exist. Navigate to this directory and create file called ``config``.
+Put in the following contents (making sure to replace the text surrounded by ``**double astericks**`` with your own information)::
+
+ Host **hostalias**
+ Hostname **hostname**
+ User **username**
+
+By using an SSH config file, secure methods for copying (e.g. ``scp`` or ``sftp``) can now use the same host aliases. Let's say I want to copy a file from my local machine to my remove machine. This is now as simple as: ``$ scp localfile.txt hostalias:/path/to/directory``.
+
+**2.** If your local machine is a Mac, you can eliminate the need to enter a password every time you want to log in by using an SSH key pair. To do this, on your **local machine** navigate to your ``~/.ssh`` directory and enter the following command to generate a set of RSA keys: ``$ ssh-keygen -t rsa``. You will then be prompted to supply a filename and a password. For the file name I recommend `id_rsa_hostalias` and for the password I recommend it to be the same as your remote machine's password. If you use a Mac, the operating system can use its internal keychain to remember your password, meaning you won't need to type it in every time you log in!
+
+This command will generate 2 files:the one with the ``.pub`` extension is the "public key", the one without the ``.pub`` extension is the "private key". You keep your private
+key strictly on your local machine. You need to copy your public key to the remote machine you would like to use the key pair to log in to. First create the `~/.ssh` on your **remote machine**. Then from your **local machine** enter: ``$ scp ~/.ssh/id_rsa_hostalias.pub hostalias:~/.ssh/``. After copying the public key over to ``hostalias``, you need to create an ``authorized_keys`` file in your ``~/.ssh/`` on your **remote machine**.
+
+**3.** Now from a terminal window on your **local machine**, you can try logging in to ``hostalias`` with the following command: ``$ ssh -i ~/.ssh/id_rsa_hostalias hostalias``. This will prompt you for the password you specified upon creating your key pair using ``ssh-keygen``. To always make use of your private key when logging in to ``hostalias``, add the following to your ``config`` file on your **local machine**::
+
+ Hostname **hostname**
+ User **username**
+ LocalForward 8450 localhost:3039
+ IdentityFile **~/.ssh/id_rsa_hostname**
+ UseKeychain yes
+ AddKeysToAgent Yes
+
+Congratulations!
+
Edit Remote Files Locally
-------------------------
From 31580e0922a0568e96f6e4d9c5c3555723112db2 Mon Sep 17 00:00:00 2001
From: mckimb <35553666+mckimb@users.noreply.github.com>
Date: Wed, 15 Jul 2020 16:23:27 +0200
Subject: [PATCH 152/304] Update remote_access.rst
Added to the sections on editing remote files with a local text editor and on using jupyter with port-forwarding.
---
docs/source/remote_access.rst | 24 +++++++++---------------
1 file changed, 9 insertions(+), 15 deletions(-)
diff --git a/docs/source/remote_access.rst b/docs/source/remote_access.rst
index 068883af6..6c97cbc97 100644
--- a/docs/source/remote_access.rst
+++ b/docs/source/remote_access.rst
@@ -15,9 +15,9 @@ Simplifying Logins and Port Fowarding
If you use a Unix-based operating system on your personal computer, you can make use
of an SSH config file to create shortcuts to your frequently used remote computers. We will take this one step further to simplify port-fowarding, a method which allows a user to redirect data from a specified remote host and port, through a secure tunnel, to a specified local port. Port-fowarding is helfpul because it will enable us to edit remote files locally.
-As an example without any fancy tricks, let's set up an SSH tunnel that maps ``localhost`` port 3039 on my local machine to 8450 on my remote machine (the number is arbitrary as long as its between 1024 and 49150): ``$ ssh -l localhost:3039:host:8450 user@host``. You will then be required to enter in your password. This is cumbersome to repeat everytime we log in. Our goal will be to shorten the command to : ``$ ssh hostalias`` and without having to enter in your password. We give some instructions below:
+As an example without any fancy tricks, let's set up an SSH tunnel that maps ``localhost`` port 3039 on my local machine to 3039 on my remote machine (the number is arbitrary as long as its between 1024 and 49150): ``$ ssh -l localhost:3039:host:3039 user@host``. You will then be required to enter in your password. This is cumbersome to repeat everytime we log in. Our goal will be to shorten the command to : ``$ ssh hostalias`` and without having to enter in your password. We give some instructions below:
-**1.** In the home directory of your **local machine**, create a new directory called ``.ssh`` if it does not already exist. Navigate to this directory and create file called ``config``.
+**1.** In the home directory of your **local machine**, create a new directory called ``.ssh`` if it does not already exist. Navigate to this directory and create file called ``config``.
Put in the following contents (making sure to replace the text surrounded by ``**double astericks**`` with your own information)::
Host **hostalias**
@@ -35,31 +35,25 @@ key strictly on your local machine. You need to copy your public key to the remo
Hostname **hostname**
User **username**
- LocalForward 8450 localhost:3039
+ LocalForward 3039 localhost:3039
IdentityFile **~/.ssh/id_rsa_hostname**
UseKeychain yes
AddKeysToAgent Yes
-Congratulations!
+You should not be able to log in simply by typing ``$ ssh hostalias``. Congratulations!
Edit Remote Files Locally
-------------------------
As an alternative to remote-based text editors such as ``vi`` and ``emacs``, we can
-use port-fowarding to set up a local-based text editor like ``Atom`` which includes
-features such as syntax highlighting and code completion.
+use port-fowarding to set up a `local-based text editor like Atom `_ which includes features such as syntax highlighting and code completion. For additional instruction go to the ``rmate`` `homepage on Github `_. To specifically use Atom to edit remote files, `click here `_.
+
Edit Remote python Files in a ``jupyter`` Environment
-----------------------------------------------------
The ``jupyter`` environment is a great environent for data exploration and integrating
-your figures inline with your code.
-
+your figures inline with your code. To open your first Jupyter notebook, log in to your **remote machine** and type: ``$ jupyter lab --no-browser --port=3039``. This should function because of all the work we put in during the port forwarding section. To shorten this command, add an alias to your ``~/.bashrc`` file on your **remote machine**. I personally use the alias ``rjlab``
-References
+Authors
----------
-..
- Add relevant references. This is done in 2 steps:
- 1. Add the reference itself to docs/source/references.rst
- 2. Insert the citation key here, e.g. [Vallis2017]_
-
- See the Contributing guide for more info.
+This documentation was written by Brett McKim, peer reviewed by Dennis Sergeev, and quality controlled by Ross Castle.
From 0f36fd34d64d48e16891cf12a44f799d928a37d5 Mon Sep 17 00:00:00 2001
From: mckimb <35553666+mckimb@users.noreply.github.com>
Date: Wed, 15 Jul 2020 16:39:13 +0200
Subject: [PATCH 153/304] Update remote_access.rst
Added a recap and updated some text.
---
docs/source/remote_access.rst | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/docs/source/remote_access.rst b/docs/source/remote_access.rst
index 6c97cbc97..705833c5c 100644
--- a/docs/source/remote_access.rst
+++ b/docs/source/remote_access.rst
@@ -46,7 +46,7 @@ You should not be able to log in simply by typing ``$ ssh hostalias``. Congratul
Edit Remote Files Locally
-------------------------
As an alternative to remote-based text editors such as ``vi`` and ``emacs``, we can
-use port-fowarding to set up a `local-based text editor like Atom `_ which includes features such as syntax highlighting and code completion. For additional instruction go to the ``rmate`` `homepage on Github `_. To specifically use Atom to edit remote files, `click here `_.
+use port-fowarding to set up a `local-based text editor like Atom `_ which includes features such as syntax highlighting and code completion. For instructions to install ``rmate`` on your **local machine**, `click here `_. Then to specifically use Atom to edit remote files, `click here `_. You will need to add the following line to your ``~/.ssh/config`` file: ``RemoteForward 52698 localhost:52698``.
Edit Remote python Files in a ``jupyter`` Environment
@@ -54,6 +54,24 @@ Edit Remote python Files in a ``jupyter`` Environment
The ``jupyter`` environment is a great environent for data exploration and integrating
your figures inline with your code. To open your first Jupyter notebook, log in to your **remote machine** and type: ``$ jupyter lab --no-browser --port=3039``. This should function because of all the work we put in during the port forwarding section. To shorten this command, add an alias to your ``~/.bashrc`` file on your **remote machine**. I personally use the alias ``rjlab``
+Recap
+-----
+Your final ``~/.ssh/config`` file should look like this::
+
+ Host **hostalias**
+ Hostname **hostname**
+ User **username**
+
+ Hostname **hostname**
+ User **username**
+ LocalForward 3039 localhost:3039
+ RemoteForward 52698 localhost:52698
+ IdentityFile **~/.ssh/id_rsa_hostname**
+ UseKeychain yes
+ AddKeysToAgent Yes
+
+**One final note:** Remember the port numbers chosen are arbitary. If you choose the same number as someone else on your network, their files may open up on your computer and vice versa!
+
Authors
----------
This documentation was written by Brett McKim, peer reviewed by Dennis Sergeev, and quality controlled by Ross Castle.
From 62a70d721ed65c01138c20b8a80a2bf09dc3b5a6 Mon Sep 17 00:00:00 2001
From: mckimb <35553666+mckimb@users.noreply.github.com>
Date: Wed, 15 Jul 2020 16:51:35 +0200
Subject: [PATCH 154/304] Update remote_access.rst
Stylistic changes.
---
docs/source/remote_access.rst | 23 +++++++++++++----------
1 file changed, 13 insertions(+), 10 deletions(-)
diff --git a/docs/source/remote_access.rst b/docs/source/remote_access.rst
index 705833c5c..4d37f0730 100644
--- a/docs/source/remote_access.rst
+++ b/docs/source/remote_access.rst
@@ -10,14 +10,16 @@ fowarding. By the end you should know:
* how to edit remote files in a local text editor through ``rmate``
* how to edit remote python files in a local ``jupyter`` environment
-Simplifying Logins and Port Fowarding
+Simplifying logins and port-fowarding
-------------------------------------
If you use a Unix-based operating system on your personal computer, you can make use
of an SSH config file to create shortcuts to your frequently used remote computers. We will take this one step further to simplify port-fowarding, a method which allows a user to redirect data from a specified remote host and port, through a secure tunnel, to a specified local port. Port-fowarding is helfpul because it will enable us to edit remote files locally.
As an example without any fancy tricks, let's set up an SSH tunnel that maps ``localhost`` port 3039 on my local machine to 3039 on my remote machine (the number is arbitrary as long as its between 1024 and 49150): ``$ ssh -l localhost:3039:host:3039 user@host``. You will then be required to enter in your password. This is cumbersome to repeat everytime we log in. Our goal will be to shorten the command to : ``$ ssh hostalias`` and without having to enter in your password. We give some instructions below:
-**1.** In the home directory of your **local machine**, create a new directory called ``.ssh`` if it does not already exist. Navigate to this directory and create file called ``config``.
+Set up an SSH config file
+^^^^^^^^^^^^^^^^^^^^^^^^^
+In the home directory of your **local machine**, create a new directory called ``.ssh`` if it does not already exist. Navigate to this directory and create file called ``config``.
Put in the following contents (making sure to replace the text surrounded by ``**double astericks**`` with your own information)::
Host **hostalias**
@@ -26,12 +28,13 @@ Put in the following contents (making sure to replace the text surrounded by ``*
By using an SSH config file, secure methods for copying (e.g. ``scp`` or ``sftp``) can now use the same host aliases. Let's say I want to copy a file from my local machine to my remove machine. This is now as simple as: ``$ scp localfile.txt hostalias:/path/to/directory``.
-**2.** If your local machine is a Mac, you can eliminate the need to enter a password every time you want to log in by using an SSH key pair. To do this, on your **local machine** navigate to your ``~/.ssh`` directory and enter the following command to generate a set of RSA keys: ``$ ssh-keygen -t rsa``. You will then be prompted to supply a filename and a password. For the file name I recommend `id_rsa_hostalias` and for the password I recommend it to be the same as your remote machine's password. If you use a Mac, the operating system can use its internal keychain to remember your password, meaning you won't need to type it in every time you log in!
+Set up an SSH key pair
+^^^^^^^^^^^^^^^^^^^^^^
+If your local machine is a Mac, you can eliminate the need to enter a password every time you want to log in by using an SSH key pair. To do this, on your **local machine** navigate to your ``~/.ssh`` directory and enter the following command to generate a set of RSA keys: ``$ ssh-keygen -t rsa``. You will then be prompted to supply a filename and a password. For the file name I recommend ``id_rsa_hostalias`` and for the password I recommend it to be the same as your remote machine's password. If you use a Mac, the operating system can use its internal keychain to remember your password, meaning you won't need to type it in every time you log in!
-This command will generate 2 files:the one with the ``.pub`` extension is the "public key", the one without the ``.pub`` extension is the "private key". You keep your private
-key strictly on your local machine. You need to copy your public key to the remote machine you would like to use the key pair to log in to. First create the `~/.ssh` on your **remote machine**. Then from your **local machine** enter: ``$ scp ~/.ssh/id_rsa_hostalias.pub hostalias:~/.ssh/``. After copying the public key over to ``hostalias``, you need to create an ``authorized_keys`` file in your ``~/.ssh/`` on your **remote machine**.
+This command will generate 2 files:the one with the ``.pub`` extension is the "public key", the one without the ``.pub`` extension is the "private key". You keep your private key strictly on your local machine. You need to copy your public key to the remote machine you would like to use the key pair to log in to. First create the ``~/.ssh`` on your **remote machine**. Then from your **local machine** enter: ``$ scp ~/.ssh/id_rsa_hostalias.pub hostalias:~/.ssh/``. After copying the public key over to ``hostalias``, you need to create an ``authorized_keys`` file in your ``~/.ssh/`` on your **remote machine**.
-**3.** Now from a terminal window on your **local machine**, you can try logging in to ``hostalias`` with the following command: ``$ ssh -i ~/.ssh/id_rsa_hostalias hostalias``. This will prompt you for the password you specified upon creating your key pair using ``ssh-keygen``. To always make use of your private key when logging in to ``hostalias``, add the following to your ``config`` file on your **local machine**::
+Now from a terminal window on your **local machine**, you can try logging in to ``hostalias`` with the following command: ``$ ssh -i ~/.ssh/id_rsa_hostalias hostalias``. This will prompt you for the password you specified upon creating your key pair using ``ssh-keygen``. To always make use of your private key when logging in to ``hostalias``, add the following to your ``config`` file on your **local machine**::
Hostname **hostname**
User **username**
@@ -43,13 +46,13 @@ key strictly on your local machine. You need to copy your public key to the remo
You should not be able to log in simply by typing ``$ ssh hostalias``. Congratulations!
-Edit Remote Files Locally
--------------------------
+Edit remote files in a local text editor
+----------------------------------------
As an alternative to remote-based text editors such as ``vi`` and ``emacs``, we can
use port-fowarding to set up a `local-based text editor like Atom `_ which includes features such as syntax highlighting and code completion. For instructions to install ``rmate`` on your **local machine**, `click here `_. Then to specifically use Atom to edit remote files, `click here `_. You will need to add the following line to your ``~/.ssh/config`` file: ``RemoteForward 52698 localhost:52698``.
-Edit Remote python Files in a ``jupyter`` Environment
+Edit remote python files in a ``jupyter`` environment
-----------------------------------------------------
The ``jupyter`` environment is a great environent for data exploration and integrating
your figures inline with your code. To open your first Jupyter notebook, log in to your **remote machine** and type: ``$ jupyter lab --no-browser --port=3039``. This should function because of all the work we put in during the port forwarding section. To shorten this command, add an alias to your ``~/.bashrc`` file on your **remote machine**. I personally use the alias ``rjlab``
@@ -73,5 +76,5 @@ Your final ``~/.ssh/config`` file should look like this::
**One final note:** Remember the port numbers chosen are arbitary. If you choose the same number as someone else on your network, their files may open up on your computer and vice versa!
Authors
-----------
+-------
This documentation was written by Brett McKim, peer reviewed by Dennis Sergeev, and quality controlled by Ross Castle.
From cb033a744aa29bf1ef411feb8060101435f74d5b Mon Sep 17 00:00:00 2001
From: mckimb <35553666+mckimb@users.noreply.github.com>
Date: Wed, 15 Jul 2020 16:52:47 +0200
Subject: [PATCH 155/304] Update remote_access.rst
Stylistic changes
---
docs/source/remote_access.rst | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/docs/source/remote_access.rst b/docs/source/remote_access.rst
index 4d37f0730..a98f61c6c 100644
--- a/docs/source/remote_access.rst
+++ b/docs/source/remote_access.rst
@@ -46,8 +46,8 @@ Now from a terminal window on your **local machine**, you can try logging in to
You should not be able to log in simply by typing ``$ ssh hostalias``. Congratulations!
-Edit remote files in a local text editor
-----------------------------------------
+Edit remote files in a local text editor using ``rmate``
+--------------------------------------------------------
As an alternative to remote-based text editors such as ``vi`` and ``emacs``, we can
use port-fowarding to set up a `local-based text editor like Atom `_ which includes features such as syntax highlighting and code completion. For instructions to install ``rmate`` on your **local machine**, `click here `_. Then to specifically use Atom to edit remote files, `click here `_. You will need to add the following line to your ``~/.ssh/config`` file: ``RemoteForward 52698 localhost:52698``.
From 6e43a896226854a729ad17ee039e9499da84b594 Mon Sep 17 00:00:00 2001
From: mckimb <35553666+mckimb@users.noreply.github.com>
Date: Wed, 15 Jul 2020 16:54:32 +0200
Subject: [PATCH 156/304] Update remote_access.rst
stylistic changes
---
docs/source/remote_access.rst | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/docs/source/remote_access.rst b/docs/source/remote_access.rst
index a98f61c6c..1f194139e 100644
--- a/docs/source/remote_access.rst
+++ b/docs/source/remote_access.rst
@@ -20,7 +20,7 @@ As an example without any fancy tricks, let's set up an SSH tunnel that maps ``l
Set up an SSH config file
^^^^^^^^^^^^^^^^^^^^^^^^^
In the home directory of your **local machine**, create a new directory called ``.ssh`` if it does not already exist. Navigate to this directory and create file called ``config``.
-Put in the following contents (making sure to replace the text surrounded by ``**double astericks**`` with your own information)::
+Put in the following contents (making sure to replace the text surrounded by ``**double asterisks**`` with your own information)::
Host **hostalias**
Hostname **hostname**
@@ -59,7 +59,7 @@ your figures inline with your code. To open your first Jupyter notebook, log in
Recap
-----
-Your final ``~/.ssh/config`` file should look like this::
+Your final ``~/.ssh/config`` file should look like this (making sure to replace the text surrounded by ``**double asterisks**`` with your own information)::
Host **hostalias**
Hostname **hostname**
From 2b6be132a93168f7288c86dfbddcd154d333683b Mon Sep 17 00:00:00 2001
From: mckimb <35553666+mckimb@users.noreply.github.com>
Date: Wed, 15 Jul 2020 16:56:20 +0200
Subject: [PATCH 157/304] Update remote_access.rst
Changed "Summary" section to "Overview".
---
docs/source/remote_access.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/source/remote_access.rst b/docs/source/remote_access.rst
index 1f194139e..468c26bae 100644
--- a/docs/source/remote_access.rst
+++ b/docs/source/remote_access.rst
@@ -1,7 +1,7 @@
Remote Access
==============
-Summary
+Overview
-------
This is a guide for how to edit remote files on a local text editor via port-
fowarding. By the end you should know:
From 949b55b41e1a0c0ee54f16200795f8c9f8da7dea Mon Sep 17 00:00:00 2001
From: Matthew Henry
Date: Wed, 23 Sep 2020 10:36:30 +0100
Subject: [PATCH 158/304] adding intro page and change in index
---
docs/source/modules/index.rst | 5 +-
docs/source/modules/introduction.rst | 114 +++++++++++++++++++++++++++
2 files changed, 116 insertions(+), 3 deletions(-)
create mode 100644 docs/source/modules/introduction.rst
diff --git a/docs/source/modules/index.rst b/docs/source/modules/index.rst
index 1621c7fc9..88af81dc1 100644
--- a/docs/source/modules/index.rst
+++ b/docs/source/modules/index.rst
@@ -7,8 +7,7 @@ Components of Isca
.. toctree::
:maxdepth: 1
+ introduction
dynamics
physics
- output
- convection_simple_betts_miller
- socrates
+ output
\ No newline at end of file
diff --git a/docs/source/modules/introduction.rst b/docs/source/modules/introduction.rst
new file mode 100644
index 000000000..f78e9b609
--- /dev/null
+++ b/docs/source/modules/introduction.rst
@@ -0,0 +1,114 @@
+Experiment configuration scripts
+==============
+
+Summary
+-------
+Once you have managed to run a test case, you may want to run your own experiment. The model configuration, diagnostics, and simulation parameters
+of your experiment can be configured with a python-based run script.
+Find the test case in ``Isca/exp/test_cases`` that most resembles your experiment, copy and modify it. The important lines are described below.
+
+Setup
+-------
+::
+
+ from isca import DryCodeBase
+imports the Isca python module that should have been installed.
+``DryCodeBase`` refers to the part of the code needed to run the dry model. The codebase object is defined in ``Isca/src/extra/python/isca/codebase.py``. The different default codebases are designed to avoid the model compiling un-needed parts of the code, which speeds up compilation. ``DryCodeBase`` can be replaced by ``IscaCodeBase``, ``GreyCodeBase``, or ``SocratesCodeBase`` (provided you setup Socrates, see Socrates documentation).
+
+::
+
+ NCORES = 16
+specifies how many cores should be used when running the model.
+
+::
+
+ RESOLUTION = T42, 25
+specifies the horizontal (in this case, spectral T42) and vertical (25 pressure levels)
+resolution. Runs at T42 by default. If the horizontal resolution is not T42, make sure the
+input files (such as land masks) are changed and add ``exp.set_resolution(*RESOLUTION)`` after exp is defined.
+
+::
+
+ cb = DryCodeBase.from_directory(GFDL_BASE)
+tells Isca to find the model code at the location ``GFDL_BASE``, which is where the source code may be changed. You can replace ``from_directory(GFDL_BASE)`` with ``from_repo(repo='https://github.com/isca/isca', commit='isca1.1')`` to point to a specific git repository and commit id. This should ensure future, independent, reproducibility of results. But, the compilation depends on computer specific settings. The ``$GFDL_ENV`` environment variable is used to determine which ``$GFDL_BASE/src/extra/env`` file is used to load the correct compilers. The env file is always loaded from ``$GFDL_BASE`` and not the checked out git repo.
+
+::
+
+ cb.compile()
+compiles the source code.
+
+::
+
+ exp = Experiment('EXPERIMENT_NAME', codebase=cb)
+creates an experiment object which will handle the configuration of model parameters and output diagnostics. The output files will be found at ``$GFDL_DATA/EXPERIMENT_NAME``.
+
+
+Diagnostics
+-------
+
+::
+
+ diag = DiagTable()
+creates a DiagTable object which we can configure to tell Isca which variables to output.
+
+::
+
+ diag.add_file('atmos_monthly', 30, 'days', time_units='days')
+creates an ``atmos_monthly.nc`` file which contains output from the model run every 30 days. The output files can be found at ``$GFDL_DATA/EXPERIMENT_NAME/run####/*``.
+
+::
+
+ diag.add_field(MODULE_NAME, VARIABLE_NAME, time_avg=True)
+determines which fields will be written in ``atmos_monthly.nc``. Find the available VARIABLE_NAMEs by going to the MODULE_NAME documentation or by finding the relevant source code (``cd Isca/src/ & find . -name "MODULE_NAME*"``).
+
+
+Namelist
+-------
+
+::
+
+ namelist = Namelist({...})
+defines a namelist object, which lets us configure the science options.
+It is only necessary to set values that are different from the default parameters, which are defined
+in the relevant module documentation (for example, ``atmosphere_nml`` parameters can be found in the ``atmosphere``
+module documentation or at the beginning of the ``atmosphere.F90`` source file).
+
+Running the experiment
+-------
+
+::
+
+ exp.run(...)
+will make the model run for the amount of time specified in ``main_nml`` (usually 30 days).
+
+The ``use_restart`` option can be set to ``False`` to start from scratch (isothermal atmosphere) or can point to a restart file (``use_restart = $GFDL_DATA/exp_name/run####/restarts/*``) to initialize the run from the output of a previous run. If unspecified, it will start from where the previous run left off or from an isothermal atmosphere in the absence of a previous run.
+
+Output
+-------
+
+Output from the experiment can be found at ``$GFDL_DATA/EXP_NAME``. The atmospheric output is provided on
+sigma levels where sigma is the pressure normalized by the surface pressure. For a planet with no topography, sigma and pressure levels are quite similar.
+If there is topography present (such as in the ``realistic_continents`` test case), you need to interpolate the
+data onto pressure levels before analyzing it. Top of atmosphere and surface values are not affected, but in-atmosphere values are.
+
+The details and code for interpolation to pressure levels can be found at https://github.com/ExeClim/Isca/tree/master/postprocessing/plevel_interpolation
+
+In the python code, there is a convenient function which can be used to call the interpolation code: https://github.com/ExeClim/Isca/blob/master/src/extra/python/isca/util.py (line 134).
+
+For example::
+
+ from isca.util import interpolate_output
+ for run in ["EXPERIMENT_NAME"]:
+ print(run)
+ for i in range(121, 241):
+ try:
+ infile = '/data_directory/' + run + '/run%04d/atmos_monthly.nc' % i
+ outfile = '/data_directory/' + run + '/run%04d/plev_monthly.nc' % i
+ interpolate_output(infile, outfile, p_levs='EVEN', var_names=['slp', 'height'])
+ except:
+ print(i)
+
+Authors
+-------
+
+This documentation was written by Matthew Henry (heavily inspired from document written by Neil Lewis), peer reviewed by Will Seviour, and quality controlled by X.
From 7aec5d7b4d4206d0f073a66bd06ec86868d36a93 Mon Sep 17 00:00:00 2001
From: Daniel Williams
Date: Wed, 16 Dec 2020 14:39:31 +0000
Subject: [PATCH 159/304] New contants docs (relies on introduction of updated
constants file).
---
docs/source/modules/constants.rst | 86 +++++++++++++++++++++++++++++++
1 file changed, 86 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..2b386393d
--- /dev/null
+++ b/docs/source/modules/constants.rst
@@ -0,0 +1,86 @@
+
+Constants: Atmospheric and Planetary Parameters
+===============================================
+
+Summary
+-------
+
+``constants.F90`` provides a number of controls that set the fundamental parameters of the planet being studied - it is used by nearly every other module 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
+^^^^^^^^^^^^^^^^^^^^
+
+Below are a set of controls that allow the physical size and rotation to be set. This allows us to model a range of planets, including others in the Solar System such as Mars and Jupiter, in addition to exoplanets. Rotation can be set by two different parameters: a rotation rate :math:`\Omega` can be specified; or alternatively a period in seconds can be given that is converted back to a value of :math:`\Omega`.
+
++-------------------+----------------------------------+---------------------------------------+-------------------------------------------------+
+| Name | Default | Units | Description |
++===================+==================================+=======================================+=================================================+
+|``radius`` | 6371e3 | m | Radius of planet |
++-------------------+----------------------------------+---------------------------------------+-------------------------------------------------+
+|``gravity`` | 9.80 | ms :math:`^{-2}` | Surface gravitational acceleration |
++-------------------+----------------------------------+---------------------------------------+-------------------------------------------------+
+|``omega`` | 7.2921150e-5 | rad :math:`\cdot` s :math:`^{-1}` | Rotation rate of planet |
++-------------------+----------------------------------+---------------------------------------+-------------------------------------------------+
+|``rotation_period``| -1.0 (inactive) | s | Rotation period of planet (overrides ``omega`` )|
++-------------------+----------------------------------+---------------------------------------+-------------------------------------------------+
+|``orbital_period`` | 31557600 | s | Orbital period of planet |
++-------------------+----------------------------------+---------------------------------------+-------------------------------------------------+
+|``orbital_rate`` | :math:`2\pi` / ``orbital_period``| rad :math:`\cdot` s :math:`^{-1}` | Orbital rate of planet |
++-------------------+----------------------------------+---------------------------------------+-------------------------------------------------+
+
+.. note:: Whilst the rotation and orbital rates are set within this module, other parameters associated with planetary motion such as axial tilt (obliquity) and eccentricity are controlled from the ``astronomy_mod`` module.
+
+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 :math:`R` by the average molar mass of the atmosphere.
+
++------------+----------------------+-------------------------------------+-------------------------------------------------------+
+| Name | Default | Units | Description |
++============+======================+=====================================+=======================================================+
+|``pstd_mks``| 101325.0 | Pa / Nm :math:`^{-2}` | Mean (reference) surface pressure (SI) |
++------------+----------------------+-------------------------------------+-------------------------------------------------------+
+|``pstd`` | 1.013250e06 | dyn :math:`\cdot` cm :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 ( :math:`\gamma` for an ideal gas)|
++------------+----------------------+-------------------------------------+-------------------------------------------------------+
+|``cp_air`` | ``rvgas`` / ``kappa``| Jkg :math:`^{-1}`K :math:`^{-1}` | Dry air heat capcity |
++------------+----------------------+-------------------------------------+-------------------------------------------------------+
+
+.. 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.
+
+
+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 |
++--------------+-------------------+----------------------------------+-------------------------------------------+
+
+
+
+Authors
+-------
+This documentation was written by Daniel Williams, peer reviewed by YY, and quality controlled by ZZ.
From 7b93f1db75b915b8f50f34d7843c5827182eb65a Mon Sep 17 00:00:00 2001
From: Marianne Pietschnig
Date: Wed, 16 Dec 2020 17:42:37 +0000
Subject: [PATCH 160/304] Diag_manager_mod documentation PR
---
docs/source/modules/diag_manager_mod.rst | 162 +++++++++++++++++++++++
docs/source/modules/index.rst | 1 +
2 files changed, 163 insertions(+)
create mode 100644 docs/source/modules/diag_manager_mod.rst
diff --git a/docs/source/modules/diag_manager_mod.rst b/docs/source/modules/diag_manager_mod.rst
new file mode 100644
index 000000000..a955778f3
--- /dev/null
+++ b/docs/source/modules/diag_manager_mod.rst
@@ -0,0 +1,162 @@
+Diagnostics Manager Module & Saving model output
+==============
+
+Summary
+-------
+
+This module handles the writing of diagnostic output to netCDF files. The user can specify which fields should be output and at which temporal resolution (e.g. monthly means, daily means ... ). The source code is located at ``src/shared/diag_manager/diag_manager.F90``.
+
+
+Namelist options
+----------------
+
++--------------------------------+----------+-----------------------------------------------------------------------------------------+
+| Name | Default | Description |
++================================+==========+=========================================================================================+
+|``append_pelist_name`` | False | Decides whether to append the pelist_name to file name |
++--------------------------------+----------+-----------------------------------------------------------------------------------------+
+|``mix_snapshot_average_fields`` | False | Allow both time average and instantaneous fields in the same output file |
++--------------------------------+----------+-----------------------------------------------------------------------------------------+
+|``max_files`` | 31 | Sets the maximum number of output files allowed |
++--------------------------------+----------+-----------------------------------------------------------------------------------------+
+|``max_output_fields`` | 300 | Sets the maximum number of output fields allowed |
++--------------------------------+----------+-----------------------------------------------------------------------------------------+
+|``max_input_fields`` | 300 | Sets the maximum number of input fields allowed |
++--------------------------------+----------+-----------------------------------------------------------------------------------------+
+|``max_axes`` | 60 | Sets the maximum number of independent axes |
++--------------------------------+----------+-----------------------------------------------------------------------------------------+
+|``do_diag_field_log`` | False | to log the registration of the data field, put the OPTIONAL parameter |
+| | | ``do_not_log`` = ``False`` and the namelist variable ``do_diag_field_log`` to ``True`` |
++--------------------------------+----------+-----------------------------------------------------------------------------------------+
+|``write_bytes_in_files`` | False | Write out the number of bytes of data saved to this file |
++--------------------------------+----------+-----------------------------------------------------------------------------------------+
+|``debug_diag_manager`` | False | When set to true, bounds are checked in ``send_data`` (send data to output fields) |
++--------------------------------+----------+-----------------------------------------------------------------------------------------+
+|``max_num_axis_sets`` | 25 | Set maximum number of axes for output (e.g. time and space axes) |
++--------------------------------+----------+-----------------------------------------------------------------------------------------+
+|``use_cmor`` | False | Let the ``diag_manager`` know if the missing value (if supplied) should be overridden |
+| | | to be the CMOR standard value of -1.0e20 |
++--------------------------------+----------+-----------------------------------------------------------------------------------------+
+|``issue_oor_warnings`` | True | If ``True`` check for values outside the valid range. This range is passed to the |
+| | | ``diag_manager_mod`` via the OPTIONAL variable range in the |
+| | | ``register_diag_field`` function |
++--------------------------------+----------+-----------------------------------------------------------------------------------------+
+|``oor_warnings_fatal`` | True | If ``True`` issue a fatal error if any values for the output field are outside the |
+| | | given range |
++--------------------------------+----------+-----------------------------------------------------------------------------------------+
+
+
+Diagnostics
+-----------
+
+This part of the code does not have its own diagnostics, but rather handles the saving of all variables. See also ``/src/extra/python/isca/diagtable.py``
+
+Output files
+^^^^^^^^^^^^
+
+In order to save output in Isca, an output file is created first in your experiment runscript (see examples in ``/exp/test_cases/``). Commonly used output timesteps include monthly, daily or x-hourly.
+
+``diag.add_file('atmos_monthly', 30, 'days', time_units='days')``
+``diag.add_file('atmos_daily', 1, 'days', time_units='days')``
+``diag.add_file('atmos_6_hourly', 6, 'hours', time_units='hours')``
+
+The frequency at which data is saved can be set in the ``main_nml``: ::
+
+ 'main_nml': {
+ 'dt_atmos': 600,
+ 'days': 30,
+ 'calendar': 'thirty_day'
+ }
+
+For example, set ``'days': 15`` and ``'calendar': 'fifteen_day'``.
+
+
+Output fields
+^^^^^^^^^^^^^
+
+An output field is created via ``diag.add_field(module, name, time_avg, files)`` in the experiment runscript.
+The default for ``time_avg`` = False, the default for ``files`` = None.
+``time_avg`` is usually set to True for most variables when an output field is defined.
+
+If ``files`` = None, then the diagnostics will be saved to all of the given output files (in our example monthly, daily and 6h).
+An output file can be specified via e.g. ``files=['atmos_6_hourly']`` in
+``diag.add_field('dynamics', 'ucomp', time_avg=True, files=['atmos_6_hourly'])`` if 6h zonal winds shall be saved, but not monthly/daily
+
+
+
+Below is a list of commonly saved diagnostics. See the relevant modules for an exhaustive list of available diagnostics.
+
++--------------------------+----------------------+-------------------------+---------------------------------------------+--------------------+
+| Module | Name | Dimensions | Description | Units |
++==========================+======================+=========================+=============================================+====================+
+| ``dynamics`` | ``ps`` | (time, lat, lon) | surface pressure | :math:`Pa` |
++--------------------------+----------------------+-------------------------+---------------------------------------------+--------------------+
+| ``dynamics`` | ``bk`` | (phalf) | vertical coordinate sigma values | :math:`Pa` |
++--------------------------+----------------------+-------------------------+---------------------------------------------+--------------------+
+| ``dynamics`` | ``pk`` | (phalf) | vertical coordinate pressure values | :math:`Pa` |
++--------------------------+----------------------+-------------------------+---------------------------------------------+--------------------+
+| ``dynamics`` | ``slp`` | (time, lat, lon) | sea level pressure | :math:`Pa` |
++--------------------------+----------------------+-------------------------+---------------------------------------------+--------------------+
+| ``dynamics`` | ``height`` | (time, pfull, lat, lon) | geopotential height at full model levels | :math:`m` |
++--------------------------+----------------------+-------------------------+---------------------------------------------+--------------------+
+| ``dynamics`` | ``zsurf`` | (lat, lon) | geopotential height at the surface | :math:`m` |
++--------------------------+----------------------+-------------------------+---------------------------------------------+--------------------+
+| ``dynamics`` | ``u_comp`` | (time, pfull, lat, lon) | zonal component of the horizontal winds | :math:`m/s` |
++--------------------------+----------------------+-------------------------+---------------------------------------------+--------------------+
+| ``dynamics`` | ``v_comp`` | (time, pfull, lat, lon) | meridional component of the horizontal winds| :math:`m/s` |
++--------------------------+----------------------+-------------------------+---------------------------------------------+--------------------+
+| ``dynamics`` | ``omega`` | (time, pfull, lat, lon) | vertical velocity | :math:`Pa/s` |
++--------------------------+----------------------+-------------------------+---------------------------------------------+--------------------+
+| ``dynamics`` | ``sphum`` | (time, pfull, lat, lon) | specific humidity | :math:`kg/kg` |
++--------------------------+----------------------+-------------------------+---------------------------------------------+--------------------+
+| ``dynamics`` | ``temp`` | (time, pfull, lat, lon) | temperature | :math:`K` |
++--------------------------+----------------------+-------------------------+---------------------------------------------+--------------------+
+| ``dynamics`` | ``vor`` | (time, pfull, lat, lon) | vorticity | :math:`1/s` |
++--------------------------+----------------------+-------------------------+---------------------------------------------+--------------------+
+| ``dynamics`` | ``div`` | (time, pfull, lat, lon) | divergence | :math:`1/s` |
++--------------------------+----------------------+-------------------------+---------------------------------------------+--------------------+
+| ``atmosphere`` | ``precipitation`` | (time, lat, lon) | precipitation from resolved, parameterised | :math:`kg/(m^2 s)` |
+| | | | and snow | |
++--------------------------+----------------------+-------------------------+---------------------------------------------+--------------------+
+| ``atmosphere`` | ``rh`` | (time, pfull, lat, lon) | relative humidity | :math:`\%` |
++--------------------------+----------------------+-------------------------+---------------------------------------------+--------------------+
+| ``mixed-layer`` | ``t_surf`` | (time, lat, lon) | surface temperature | :math:`K` |
++--------------------------+----------------------+-------------------------+---------------------------------------------+--------------------+
+| ``mixed-layer`` | ``flux_t`` | (time, lat, lon) | sensible heat flux at the surface (up) | :math:`W/m^2` |
++--------------------------+----------------------+-------------------------+---------------------------------------------+--------------------+
+| ``mixed-layer`` | ``flux_lhe`` | (time, lat, lon) | latent heat flux at the surface (up) | :math:`W/m^2` |
++--------------------------+----------------------+-------------------------+---------------------------------------------+--------------------+
+| ``rrtm_radiation`` | ``flux_sw`` | (time, lat, lon) | net shortwave flux at the surface (down) | :math:`W/m^2` |
++--------------------------+----------------------+-------------------------+---------------------------------------------+--------------------+
+| ``rrtm_radiation`` | ``flux_lw`` | (time, lat, lon) | longwave flux at the surface (down only) | :math:`W/m^2` |
++--------------------------+----------------------+-------------------------+---------------------------------------------+--------------------+
+
+
+Relevant modules and subroutines
+--------------------------------
+
+The ``diag_manager_mod`` uses several modules and subroutines, including
+
+* ``diag_axis``
+* ``diag_grid``
+* ``diag_output``
+* ``diag_util``
+* ``diag_data``
+* ``diag_table``
+
+
+.. References
+.. ----------
+.. ..
+.. Add relevant references. This is done in 2 steps:
+.. 1. Add the reference itself to docs/source/references.rst
+.. 2. Insert the citation key here, e.g. [Vallis2017]_
+
+.. See the Contributing guide for more info.
+
+.. None
+
+Authors
+-------
+
+This documentation was written by Marianne Pietschnig, peer reviewed by Stephen Thomson and quality controlled by Ross Castle.
diff --git a/docs/source/modules/index.rst b/docs/source/modules/index.rst
index aee2d373c..ee4e81ba0 100644
--- a/docs/source/modules/index.rst
+++ b/docs/source/modules/index.rst
@@ -14,3 +14,4 @@ Components of Isca
two_stream_gray_rad
convection_simple_betts_miller
socrates
+ diag_manager_mod
From dfff8dfc2c371b3cb65a7c2ab04f93b7673febd8 Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Mon, 21 Dec 2020 10:59:19 +0000
Subject: [PATCH 161/304] Run scripts for testing cloud scheme
---
exp/spookie2/socrates_aquaplanet.py | 231 +++++++++++++++++
.../socrates_aquaplanet_with_cloud.py | 238 ++++++++++++++++++
2 files changed, 469 insertions(+)
create mode 100644 exp/spookie2/socrates_aquaplanet.py
create mode 100644 exp/spookie2/socrates_aquaplanet_with_cloud.py
diff --git a/exp/spookie2/socrates_aquaplanet.py b/exp/spookie2/socrates_aquaplanet.py
new file mode 100644
index 000000000..ddbf5d2b0
--- /dev/null
+++ b/exp/spookie2/socrates_aquaplanet.py
@@ -0,0 +1,231 @@
+import os
+
+import numpy as np
+
+from isca import SocratesCodeBase, DiagTable, Experiment, Namelist, GFDL_BASE
+from isca.util import exp_progress
+
+NCORES = 16
+base_dir = os.path.dirname(os.path.realpath(__file__))
+# a CodeBase can be a directory on the computer,
+# useful for iterative development
+cb = SocratesCodeBase.from_directory(GFDL_BASE)
+
+# or it can point to a specific git repo and commit id.
+# This method should ensure future, independent, reproducibility of results.
+# cb = DryCodeBase.from_repo(repo='https://github.com/isca/isca', commit='isca1.1')
+
+# compilation depends on computer specific settings. The $GFDL_ENV
+# environment variable is used to determine which `$GFDL_BASE/src/extra/env` file
+# is used to load the correct compilers. The env file is always loaded from
+# $GFDL_BASE and not the checked out git repo.
+
+# create an Experiment object to handle the configuration of model parameters
+# and output diagnostics
+
+exp = Experiment('soc_test_aquaplanet', codebase=cb)
+exp.clear_rundir()
+
+inputfiles = [os.path.join(GFDL_BASE,'input/rrtm_input_files/ozone_1990.nc')]
+
+#Tell model how to write diagnostics
+diag = DiagTable()
+diag.add_file('atmos_monthly', 30, 'days', time_units='days')
+
+#Tell model which diagnostics to write
+diag.add_field('dynamics', 'ps', time_avg=True)
+diag.add_field('dynamics', 'bk')
+diag.add_field('dynamics', 'pk')
+diag.add_field('dynamics', 'zsurf', time_avg=True)
+
+diag.add_field('atmosphere', 'precipitation', time_avg=True)
+diag.add_field('atmosphere', 'rh', time_avg=True)
+diag.add_field('mixed_layer', 't_surf', time_avg=True)
+diag.add_field('mixed_layer', 'flux_t', time_avg=True) #LH
+diag.add_field('mixed_layer', 'flux_lhe', time_avg=True) #SH
+diag.add_field('dynamics', 'sphum', time_avg=True)
+diag.add_field('dynamics', 'ucomp', time_avg=True)
+diag.add_field('dynamics', 'vcomp', time_avg=True)
+diag.add_field('dynamics', 'omega', time_avg=True)
+diag.add_field('dynamics', 'temp', time_avg=True)
+diag.add_field('dynamics', 'vor', time_avg=True)
+diag.add_field('dynamics', 'div', time_avg=True)
+
+#temperature tendency - units are K/s
+diag.add_field('socrates', 'soc_tdt_lw', time_avg=True) # net flux lw 3d (up - down)
+diag.add_field('socrates', 'soc_tdt_sw', time_avg=True)
+diag.add_field('socrates', 'soc_tdt_rad', time_avg=True) #sum of the sw and lw heating rates
+
+#net (up) and down surface fluxes
+diag.add_field('socrates', 'soc_surf_flux_lw', time_avg=True)
+diag.add_field('socrates', 'soc_surf_flux_sw', time_avg=True)
+diag.add_field('socrates', 'soc_surf_flux_lw_down', time_avg=True)
+diag.add_field('socrates', 'soc_surf_flux_sw_down', time_avg=True)
+#net (up) TOA and downard fluxes
+diag.add_field('socrates', 'soc_olr', time_avg=True)
+diag.add_field('socrates', 'soc_toa_sw', time_avg=True)
+diag.add_field('socrates', 'soc_toa_sw_down', time_avg=True)
+
+#clear sky fluxes
+diag.add_field('socrates', 'soc_surf_flux_lw_clear', time_avg=True)
+diag.add_field('socrates', 'soc_surf_flux_sw_clear', time_avg=True)
+diag.add_field('socrates', 'soc_surf_flux_lw_down_clear', time_avg=True)
+diag.add_field('socrates', 'soc_surf_flux_sw_down_clear', time_avg=True)
+diag.add_field('socrates', 'soc_olr_clear', time_avg=True)
+diag.add_field('socrates', 'soc_toa_sw_clear', time_avg=True)
+diag.add_field('socrates', 'soc_toa_sw_down_clear', time_avg=True)
+
+#diag.add_field('cloud_simple', 'cf', time_avg=True)
+#diag.add_field('cloud_simple', 'reff_rad', time_avg=True)
+#diag.add_field('cloud_simple', 'frac_liq', time_avg=True)
+#diag.add_field('cloud_simple', 'qcl_rad', time_avg=True)
+#diag.add_field('cloud_simple', 'simple_rhcrit', time_avg=True)
+#diag.add_field('cloud_simple', 'rh_min', time_avg=True)
+#diag.add_field('cloud_simple', 'rh_in_cf', time_avg=True)
+
+# additional output options commented out
+#diag.add_field('socrates', 'soc_flux_lw', time_avg=True)
+#diag.add_field('socrates', 'soc_flux_sw', time_avg=True)
+#diag.add_field('socrates', 'soc_co2', time_avg=True)
+#diag.add_field('socrates', 'soc_ozone', time_avg=True)
+#diag.add_field('socrates', 'soc_coszen', time_avg=True)
+#diag.add_field('socrates', 'soc_spectral_olr', time_avg=True)
+
+exp.diag_table = diag
+exp.inputfiles = inputfiles
+
+#Define values for the 'core' namelist
+exp.namelist = namelist = Namelist({
+ 'main_nml':{
+ 'days' : 30,
+ 'hours' : 0,
+ 'minutes': 0,
+ 'seconds': 0,
+ 'dt_atmos':600,
+ 'current_date' : [1,1,1,0,0,0],
+ 'calendar' : 'thirty_day'
+ },
+ 'socrates_rad_nml': {
+ 'stellar_constant':1370.,
+ 'lw_spectral_filename':os.path.join(GFDL_BASE,'src/atmos_param/socrates/src/trunk/data/spectra/ga7/sp_lw_ga7'),
+ 'sw_spectral_filename':os.path.join(GFDL_BASE,'src/atmos_param/socrates/src/trunk/data/spectra/ga7/sp_sw_ga7'),
+ 'do_read_ozone': True,
+ 'ozone_file_name':'ozone_1990',
+ 'ozone_field_name':'ozone_1990',
+ 'dt_rad':3600,
+ 'store_intermediate_rad':True,
+ 'chunk_size': 16,
+ 'use_pressure_interp_for_half_levels':False,
+ 'tidally_locked':False,
+ 'solday':90
+ },
+ 'idealized_moist_phys_nml': {
+ 'do_damping': True,
+ 'turb':True,
+ 'mixed_layer_bc':True,
+ 'do_virtual' :False,
+ 'do_simple': True,
+ 'roughness_mom':3.21e-05,
+ 'roughness_heat':3.21e-05,
+ 'roughness_moist':3.21e-05,
+ 'two_stream_gray': False, #Use the grey radiation scheme
+ 'do_socrates_radiation': True,
+ 'convection_scheme': 'SIMPLE_BETTS_MILLER', #Use simple Betts miller convection
+ 'do_cloud_simple': False
+ },
+
+
+ 'vert_turb_driver_nml': {
+ 'do_mellor_yamada': False, # default: True
+ 'do_diffusivity': True, # default: False
+ 'do_simple': True, # default: False
+ 'constant_gust': 0.0, # default: 1.0
+ 'use_tau': False
+ },
+
+ 'diffusivity_nml': {
+ 'do_entrain':False,
+ 'do_simple': True,
+ },
+
+ 'surface_flux_nml': {
+ 'use_virtual_temp': False,
+ 'do_simple': True,
+ 'old_dtaudv': True
+ },
+
+ 'atmosphere_nml': {
+ 'idealized_moist_model': True
+ },
+
+ #Use a large mixed-layer depth, and the Albedo of the CTRL case in Jucker & Gerber, 2017
+ 'mixed_layer_nml': {
+ 'tconst' : 285.,
+ 'prescribe_initial_dist':True,
+ 'evaporation':True,
+ 'depth': 2.5, #Depth of mixed layer used
+ 'albedo_value': 0.38, #Albedo value used
+ },
+
+ 'qe_moist_convection_nml': {
+ 'rhbm':0.7,
+ 'Tmin':160.,
+ 'Tmax':350.
+ },
+
+ 'lscale_cond_nml': {
+ 'do_simple':True,
+ 'do_evap':True
+ },
+
+ 'sat_vapor_pres_nml': {
+ 'do_simple':True
+ },
+
+ 'damping_driver_nml': {
+ 'do_rayleigh': True,
+ 'trayfric': -0.5, # neg. value: time in *days*
+ 'sponge_pbottom': 150., #Setting the lower pressure boundary for the model sponge layer in Pa.
+ 'do_conserve_energy': True,
+ },
+
+ # FMS Framework configuration
+ 'diag_manager_nml': {
+ 'mix_snapshot_average_fields': False # time avg fields are labelled with time in middle of window
+ },
+
+ 'fms_nml': {
+ 'domains_stack_size': 600000 # default: 0
+ },
+
+ 'fms_io_nml': {
+ 'threading_write': 'single', # default: multi
+ 'fileset_write': 'single', # default: multi
+ },
+
+ 'spectral_dynamics_nml': {
+ 'damping_order': 4,
+ 'water_correction_limit': 200.e2,
+ 'reference_sea_level_press':1.0e5,
+ 'num_levels':40, #How many model pressure levels to use
+ 'valid_range_t':[100.,800.],
+ 'initial_sphum':[2.e-6],
+ 'vert_coord_option':'uneven_sigma',
+ 'surf_res':0.2, #Parameter that sets the vertical distribution of sigma levels
+ 'scale_heights' : 11.0,
+ 'exponent':7.0,
+ 'robert_coeff':0.03
+ },
+
+})
+
+#Lets do a run!
+if __name__=="__main__":
+
+ cb.compile(debug=False)
+
+ overwrite=True
+
+ exp.run(1, use_restart=False, num_cores=NCORES, overwrite_data=overwrite)#, run_idb=True)
+ for i in range(2,121):
+ exp.run(i, num_cores=NCORES, overwrite_data=overwrite)
diff --git a/exp/spookie2/socrates_aquaplanet_with_cloud.py b/exp/spookie2/socrates_aquaplanet_with_cloud.py
new file mode 100644
index 000000000..bbe031042
--- /dev/null
+++ b/exp/spookie2/socrates_aquaplanet_with_cloud.py
@@ -0,0 +1,238 @@
+import os
+
+import numpy as np
+
+from isca import SocratesCodeBase, DiagTable, Experiment, Namelist, GFDL_BASE
+from isca.util import exp_progress
+
+NCORES = 16
+base_dir = os.path.dirname(os.path.realpath(__file__))
+# a CodeBase can be a directory on the computer,
+# useful for iterative development
+cb = SocratesCodeBase.from_directory(GFDL_BASE)
+
+# or it can point to a specific git repo and commit id.
+# This method should ensure future, independent, reproducibility of results.
+# cb = DryCodeBase.from_repo(repo='https://github.com/isca/isca', commit='isca1.1')
+
+# compilation depends on computer specific settings. The $GFDL_ENV
+# environment variable is used to determine which `$GFDL_BASE/src/extra/env` file
+# is used to load the correct compilers. The env file is always loaded from
+# $GFDL_BASE and not the checked out git repo.
+
+# create an Experiment object to handle the configuration of model parameters
+# and output diagnostics
+
+exp = Experiment('soc_test_aquaplanet_with_clouds', codebase=cb)
+exp.clear_rundir()
+
+inputfiles = [os.path.join(GFDL_BASE,'input/rrtm_input_files/ozone_1990.nc')]
+
+#Tell model how to write diagnostics
+diag = DiagTable()
+diag.add_file('atmos_monthly', 30, 'days', time_units='days')
+
+diag.add_field('dynamics', 'ps', time_avg=True)
+diag.add_field('dynamics', 'bk')
+diag.add_field('dynamics', 'pk')
+diag.add_field('dynamics', 'zsurf', time_avg=True)
+
+#Tell model which diagnostics to write
+diag.add_field('atmosphere', 'precipitation', time_avg=True)
+diag.add_field('atmosphere', 'rh', time_avg=True)
+diag.add_field('mixed_layer', 't_surf', time_avg=True)
+diag.add_field('mixed_layer', 'flux_t', time_avg=True) #LH
+diag.add_field('mixed_layer', 'flux_lhe', time_avg=True) #SH
+diag.add_field('dynamics', 'sphum', time_avg=True)
+diag.add_field('dynamics', 'ucomp', time_avg=True)
+diag.add_field('dynamics', 'vcomp', time_avg=True)
+diag.add_field('dynamics', 'omega', time_avg=True)
+diag.add_field('dynamics', 'temp', time_avg=True)
+diag.add_field('dynamics', 'vor', time_avg=True)
+diag.add_field('dynamics', 'div', time_avg=True)
+
+#temperature tendency - units are K/s
+diag.add_field('socrates', 'soc_tdt_lw', time_avg=True) # net flux lw 3d (up - down)
+diag.add_field('socrates', 'soc_tdt_sw', time_avg=True)
+diag.add_field('socrates', 'soc_tdt_rad', time_avg=True) #sum of the sw and lw heating rates
+
+#net (up) and down surface fluxes
+diag.add_field('socrates', 'soc_surf_flux_lw', time_avg=True)
+diag.add_field('socrates', 'soc_surf_flux_sw', time_avg=True)
+diag.add_field('socrates', 'soc_surf_flux_lw_down', time_avg=True)
+diag.add_field('socrates', 'soc_surf_flux_sw_down', time_avg=True)
+#net (up) TOA and downard fluxes
+diag.add_field('socrates', 'soc_olr', time_avg=True)
+diag.add_field('socrates', 'soc_toa_sw', time_avg=True)
+diag.add_field('socrates', 'soc_toa_sw_down', time_avg=True)
+
+#clear sky fluxes
+diag.add_field('socrates', 'soc_surf_flux_lw_clear', time_avg=True)
+diag.add_field('socrates', 'soc_surf_flux_sw_clear', time_avg=True)
+diag.add_field('socrates', 'soc_surf_flux_lw_down_clear', time_avg=True)
+diag.add_field('socrates', 'soc_surf_flux_sw_down_clear', time_avg=True)
+diag.add_field('socrates', 'soc_olr_clear', time_avg=True)
+diag.add_field('socrates', 'soc_toa_sw_clear', time_avg=True)
+diag.add_field('socrates', 'soc_toa_sw_down_clear', time_avg=True)
+
+diag.add_field('cloud_simple', 'cf', time_avg=True)
+diag.add_field('cloud_simple', 'reff_rad', time_avg=True)
+diag.add_field('cloud_simple', 'frac_liq', time_avg=True)
+diag.add_field('cloud_simple', 'qcl_rad', time_avg=True)
+#diag.add_field('cloud_simple', 'simple_rhcrit', time_avg=True)
+diag.add_field('cloud_simple', 'rh_min', time_avg=True)
+diag.add_field('cloud_simple', 'rh_in_cf', time_avg=True)
+
+# additional output options commented out
+#diag.add_field('socrates', 'soc_flux_lw', time_avg=True)
+#diag.add_field('socrates', 'soc_flux_sw', time_avg=True)
+#diag.add_field('socrates', 'soc_co2', time_avg=True)
+#diag.add_field('socrates', 'soc_ozone', time_avg=True)
+#diag.add_field('socrates', 'soc_coszen', time_avg=True)
+#diag.add_field('socrates', 'soc_spectral_olr', time_avg=True)
+
+exp.diag_table = diag
+exp.inputfiles = inputfiles
+
+#Define values for the 'core' namelist
+exp.namelist = namelist = Namelist({
+ 'main_nml':{
+ 'days' : 30,
+ 'hours' : 0,
+ 'minutes': 0,
+ 'seconds': 0,
+ 'dt_atmos':600,
+ 'current_date' : [1,1,1,0,0,0],
+ 'calendar' : 'thirty_day'
+ },
+ 'socrates_rad_nml': {
+ 'stellar_constant':1370.,
+ 'lw_spectral_filename':os.path.join(GFDL_BASE,'src/atmos_param/socrates/src/trunk/data/spectra/ga7/sp_lw_ga7'),
+ 'sw_spectral_filename':os.path.join(GFDL_BASE,'src/atmos_param/socrates/src/trunk/data/spectra/ga7/sp_sw_ga7'),
+ 'do_read_ozone': True,
+ 'ozone_file_name':'ozone_1990',
+ 'ozone_field_name':'ozone_1990',
+ 'dt_rad':3600,
+ 'store_intermediate_rad':True,
+ 'chunk_size': 16,
+ 'use_pressure_interp_for_half_levels':False,
+ 'tidally_locked':False,
+ 'solday':90
+ },
+ 'idealized_moist_phys_nml': {
+ 'do_damping': True,
+ 'turb':True,
+ 'mixed_layer_bc':True,
+ 'do_virtual' :False,
+ 'do_simple': True,
+ 'roughness_mom':3.21e-05,
+ 'roughness_heat':3.21e-05,
+ 'roughness_moist':3.21e-05,
+ 'two_stream_gray': False, #Use the grey radiation scheme
+ 'do_socrates_radiation': True,
+ 'convection_scheme': 'SIMPLE_BETTS_MILLER', #Use simple Betts miller convection
+ 'do_cloud_simple': True
+ },
+
+ 'cloud_simple_nml': {
+ 'cca_lower_limit':0.0,
+ 'rhcsfc': 0.95,
+ 'rhc700': 0.7,
+ 'rhc200': 0.3
+ },
+
+ 'vert_turb_driver_nml': {
+ 'do_mellor_yamada': False, # default: True
+ 'do_diffusivity': True, # default: False
+ 'do_simple': True, # default: False
+ 'constant_gust': 0.0, # default: 1.0
+ 'use_tau': False
+ },
+
+ 'diffusivity_nml': {
+ 'do_entrain':False,
+ 'do_simple': True,
+ },
+
+ 'surface_flux_nml': {
+ 'use_virtual_temp': False,
+ 'do_simple': True,
+ 'old_dtaudv': True
+ },
+
+ 'atmosphere_nml': {
+ 'idealized_moist_model': True
+ },
+
+ #Use a large mixed-layer depth, and the Albedo of the CTRL case in Jucker & Gerber, 2017
+ 'mixed_layer_nml': {
+ 'tconst' : 285.,
+ 'prescribe_initial_dist':True,
+ 'evaporation':True,
+ 'depth': 2.5, #Depth of mixed layer used
+ 'albedo_value': 0.2, #Albedo value used
+ },
+
+ 'qe_moist_convection_nml': {
+ 'rhbm':0.7,
+ 'Tmin':160.,
+ 'Tmax':350.
+ },
+
+ 'lscale_cond_nml': {
+ 'do_simple':True,
+ 'do_evap':True
+ },
+
+ 'sat_vapor_pres_nml': {
+ 'do_simple':True,
+ 'construct_table_wrt_liq_and_ice':True
+ },
+
+ 'damping_driver_nml': {
+ 'do_rayleigh': True,
+ 'trayfric': -0.5, # neg. value: time in *days*
+ 'sponge_pbottom': 150., #Setting the lower pressure boundary for the model sponge layer in Pa.
+ 'do_conserve_energy': True,
+ },
+
+ # FMS Framework configuration
+ 'diag_manager_nml': {
+ 'mix_snapshot_average_fields': False # time avg fields are labelled with time in middle of window
+ },
+
+ 'fms_nml': {
+ 'domains_stack_size': 600000 # default: 0
+ },
+
+ 'fms_io_nml': {
+ 'threading_write': 'single', # default: multi
+ 'fileset_write': 'single', # default: multi
+ },
+
+ 'spectral_dynamics_nml': {
+ 'damping_order': 4,
+ 'water_correction_limit': 200.e2,
+ 'reference_sea_level_press':1.0e5,
+ 'num_levels':40, #How many model pressure levels to use
+ 'valid_range_t':[100.,800.],
+ 'initial_sphum':[2.e-6],
+ 'vert_coord_option':'uneven_sigma',
+ 'surf_res':0.2, #Parameter that sets the vertical distribution of sigma levels
+ 'scale_heights' : 11.0,
+ 'exponent':7.0,
+ 'robert_coeff':0.03
+ },
+
+})
+
+#Lets do a run!
+if __name__=="__main__":
+
+ cb.compile(debug=False)
+
+ overwrite=True
+
+ exp.run(1, use_restart=False, num_cores=NCORES, overwrite_data=overwrite)#, run_idb=True)
+ for i in range(2,121):
+ exp.run(i, num_cores=NCORES, overwrite_data=overwrite)
From d33580332ead6ca20752ccd4120b7454cd31229c Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Tue, 22 Dec 2020 11:23:09 +0000
Subject: [PATCH 162/304] Updates to test_script to be more consistent between
master and dev branch
---
exp/test_cases/MiMA/MiMA_test_case.py | 1 -
.../socrates_test/socrates_aquaplanet.py | 23 ++++++++++---------
.../socrates_aquaplanet_with_cloud.py | 10 ++++++--
3 files changed, 20 insertions(+), 14 deletions(-)
diff --git a/exp/test_cases/MiMA/MiMA_test_case.py b/exp/test_cases/MiMA/MiMA_test_case.py
index a2c0ce518..9ea39f279 100644
--- a/exp/test_cases/MiMA/MiMA_test_case.py
+++ b/exp/test_cases/MiMA/MiMA_test_case.py
@@ -178,4 +178,3 @@
exp.run(1, use_restart=False, num_cores=NCORES)
for i in range(2,121):
exp.run(i, num_cores=NCORES)
-
diff --git a/exp/test_cases/socrates_test/socrates_aquaplanet.py b/exp/test_cases/socrates_test/socrates_aquaplanet.py
index 1ef82e914..f70884719 100644
--- a/exp/test_cases/socrates_test/socrates_aquaplanet.py
+++ b/exp/test_cases/socrates_test/socrates_aquaplanet.py
@@ -40,7 +40,10 @@
#Tell model which diagnostics to write
diag.add_field('atmosphere', 'precipitation', time_avg=True)
+diag.add_field('atmosphere', 'rh', time_avg=True)
diag.add_field('mixed_layer', 't_surf', time_avg=True)
+diag.add_field('mixed_layer', 'flux_t', time_avg=True) #LH
+diag.add_field('mixed_layer', 'flux_lhe', time_avg=True) #SH
diag.add_field('dynamics', 'sphum', time_avg=True)
diag.add_field('dynamics', 'ucomp', time_avg=True)
diag.add_field('dynamics', 'vcomp', time_avg=True)
@@ -48,10 +51,10 @@
diag.add_field('dynamics', 'vor', time_avg=True)
diag.add_field('dynamics', 'div', time_avg=True)
-#radiative tendencies
-diag.add_field('socrates', 'soc_tdt_lw', time_avg=True)
+#temperature tendency - units are K/s
+diag.add_field('socrates', 'soc_tdt_lw', time_avg=True) # net flux lw 3d (up - down)
diag.add_field('socrates', 'soc_tdt_sw', time_avg=True)
-diag.add_field('socrates', 'soc_tdt_rad', time_avg=True)
+diag.add_field('socrates', 'soc_tdt_rad', time_avg=True) #sum of the sw and lw heating rates
#net (up) and down surface fluxes
diag.add_field('socrates', 'soc_surf_flux_lw', time_avg=True)
@@ -63,11 +66,6 @@
diag.add_field('socrates', 'soc_toa_sw', time_avg=True)
diag.add_field('socrates', 'soc_toa_sw_down', time_avg=True)
-diag.add_field('cloud_simple', 'cf_rad', time_avg=True)
-diag.add_field('cloud_simple', 'reff_rad', time_avg=True)
-diag.add_field('cloud_simple', 'frac_liq', time_avg=True)
-diag.add_field('cloud_simple', 'qcl_rad', time_avg=True)
-
# additional output options commented out
#diag.add_field('socrates', 'soc_flux_lw', time_avg=True)
#diag.add_field('socrates', 'soc_flux_sw', time_avg=True)
@@ -102,7 +100,7 @@
'chunk_size': 16,
'use_pressure_interp_for_half_levels':False,
'tidally_locked':False,
- #'solday': 90
+ 'solday':90
},
'idealized_moist_phys_nml': {
'do_damping': True,
@@ -164,7 +162,8 @@
},
'sat_vapor_pres_nml': {
- 'do_simple':True
+ 'do_simple':True,
+ 'construct_table_wrt_liq_and_ice':True
},
'damping_driver_nml': {
@@ -212,6 +211,8 @@
#This will be the name of the folder that the data will appear in.
exp.run(1, use_restart=False, num_cores=NCORES, overwrite_data=False)
+ overwrite=False
+ exp.run(1, use_restart=False, num_cores=NCORES, overwrite_data=overwrite)#, run_idb=True)
for i in range(2,121):
- exp.run(i, num_cores=NCORES)
+ exp.run(i, num_cores=NCORES, overwrite_data=overwrite)
diff --git a/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
index c0ac93c70..fc6bd015d 100644
--- a/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
+++ b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
@@ -32,10 +32,13 @@
diag = DiagTable()
diag.add_file('atmos_monthly', 30, 'days', time_units='days')
-#Tell model which diagnostics to write
+#Write out diagnostics need for vertical interpolation post-processing
diag.add_field('dynamics', 'ps', time_avg=True)
diag.add_field('dynamics', 'bk')
diag.add_field('dynamics', 'pk')
+diag.add_field('dynamics', 'zsurf', time_avg=True)
+
+#Tell model which diagnostics to write
diag.add_field('atmosphere', 'precipitation', time_avg=True)
diag.add_field('atmosphere', 'rh', time_avg=True)
diag.add_field('mixed_layer', 't_surf', time_avg=True)
@@ -61,7 +64,7 @@
#net (up) TOA and downard fluxes
diag.add_field('socrates', 'soc_olr', time_avg=True)
diag.add_field('socrates', 'soc_toa_sw', time_avg=True)
-diag.add_field('socrates', 'soc_toa_sw_down', time_avg=True)
+diag.add_field('socrates', 'soc_toa_sw_down', time_avg=True)
#clear sky fluxes
diag.add_field('socrates', 'soc_surf_flux_lw_clear', time_avg=True)
@@ -227,6 +230,9 @@
if __name__=="__main__":
cb.compile(debug=False)
+ #Set up the experiment object, with the first argument being the experiment name.
+ #This will be the name of the folder that the data will appear in.
+ exp.run(1, use_restart=False, num_cores=NCORES, overwrite_data=False)
overwrite=False
From 421d21905fb2db7b485c53fb0d6255c3100d7600 Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Tue, 22 Dec 2020 11:28:39 +0000
Subject: [PATCH 163/304] Brought exp into line with each other where relevant
---
.../socrates_test/socrates_aquaplanet.py | 9 ----
.../socrates_aquaplanet_with_cloud.py | 8 +--
...es_aquaplanet_with_cloud_amip_with_topo.py | 50 +++++++++++++------
3 files changed, 36 insertions(+), 31 deletions(-)
diff --git a/exp/test_cases/socrates_test/socrates_aquaplanet.py b/exp/test_cases/socrates_test/socrates_aquaplanet.py
index f70884719..2a3b010f4 100644
--- a/exp/test_cases/socrates_test/socrates_aquaplanet.py
+++ b/exp/test_cases/socrates_test/socrates_aquaplanet.py
@@ -66,14 +66,6 @@
diag.add_field('socrates', 'soc_toa_sw', time_avg=True)
diag.add_field('socrates', 'soc_toa_sw_down', time_avg=True)
-# additional output options commented out
-#diag.add_field('socrates', 'soc_flux_lw', time_avg=True)
-#diag.add_field('socrates', 'soc_flux_sw', time_avg=True)
-#diag.add_field('socrates', 'soc_co2', time_avg=True)
-#diag.add_field('socrates', 'soc_ozone', time_avg=True)
-#diag.add_field('socrates', 'soc_coszen', time_avg=True)
-#diag.add_field('socrates', 'soc_spectral_olr', time_avg=True)
-
exp.diag_table = diag
exp.inputfiles = inputfiles
@@ -163,7 +155,6 @@
'sat_vapor_pres_nml': {
'do_simple':True,
- 'construct_table_wrt_liq_and_ice':True
},
'damping_driver_nml': {
diff --git a/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
index fc6bd015d..fcdf0ce5b 100644
--- a/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
+++ b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
@@ -82,14 +82,8 @@
#diag.add_field('cloud_simple', 'simple_rhcrit', time_avg=True)
diag.add_field('cloud_simple', 'rh_min', time_avg=True)
diag.add_field('cloud_simple', 'rh_in_cf', time_avg=True)
+diag.add_field('mixed_layer', 'albedo', time_avg=True)
-# additional output options commented out
-#diag.add_field('socrates', 'soc_flux_lw', time_avg=True)
-#diag.add_field('socrates', 'soc_flux_sw', time_avg=True)
-#diag.add_field('socrates', 'soc_co2', time_avg=True)
-#diag.add_field('socrates', 'soc_ozone', time_avg=True)
-#diag.add_field('socrates', 'soc_coszen', time_avg=True)
-#diag.add_field('socrates', 'soc_spectral_olr', time_avg=True)
exp.diag_table = diag
exp.inputfiles = inputfiles
diff --git a/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud_amip_with_topo.py b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud_amip_with_topo.py
index ad5632df3..aafc5371e 100644
--- a/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud_amip_with_topo.py
+++ b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud_amip_with_topo.py
@@ -33,14 +33,18 @@
diag = DiagTable()
diag.add_file('atmos_monthly', 30, 'days', time_units='days')
-#Tell model which diagnostics to write
+#Write out diagnostics need for vertical interpolation post-processing
diag.add_field('dynamics', 'ps', time_avg=True)
diag.add_field('dynamics', 'bk')
diag.add_field('dynamics', 'pk')
diag.add_field('dynamics', 'zsurf', time_avg=True)
+
+#Tell model which diagnostics to write
diag.add_field('atmosphere', 'precipitation', time_avg=True)
diag.add_field('atmosphere', 'rh', time_avg=True)
diag.add_field('mixed_layer', 't_surf', time_avg=True)
+diag.add_field('mixed_layer', 'flux_t', time_avg=True) #LH
+diag.add_field('mixed_layer', 'flux_lhe', time_avg=True) #SH
diag.add_field('dynamics', 'sphum', time_avg=True)
diag.add_field('dynamics', 'ucomp', time_avg=True)
diag.add_field('dynamics', 'vcomp', time_avg=True)
@@ -48,30 +52,40 @@
diag.add_field('dynamics', 'vor', time_avg=True)
diag.add_field('dynamics', 'div', time_avg=True)
-diag.add_field('socrates', 'soc_tdt_lw', time_avg=True)
+#temperature tendency - units are K/s
+diag.add_field('socrates', 'soc_tdt_lw', time_avg=True) # net flux lw 3d (up - down)
diag.add_field('socrates', 'soc_tdt_sw', time_avg=True)
-diag.add_field('socrates', 'soc_tdt_rad', time_avg=True)
+diag.add_field('socrates', 'soc_tdt_rad', time_avg=True) #sum of the sw and lw heating rates
+
+#net (up) and down surface fluxes
diag.add_field('socrates', 'soc_surf_flux_lw', time_avg=True)
diag.add_field('socrates', 'soc_surf_flux_sw', time_avg=True)
+diag.add_field('socrates', 'soc_surf_flux_lw_down', time_avg=True)
+diag.add_field('socrates', 'soc_surf_flux_sw_down', time_avg=True)
+#net (up) TOA and downard fluxes
diag.add_field('socrates', 'soc_olr', time_avg=True)
-diag.add_field('socrates', 'soc_toa_sw', time_avg=True)
+diag.add_field('socrates', 'soc_toa_sw', time_avg=True)
+diag.add_field('socrates', 'soc_toa_sw_down', time_avg=True)
+
+#clear sky fluxes
+diag.add_field('socrates', 'soc_surf_flux_lw_clear', time_avg=True)
+diag.add_field('socrates', 'soc_surf_flux_sw_clear', time_avg=True)
+diag.add_field('socrates', 'soc_surf_flux_lw_down_clear', time_avg=True)
+diag.add_field('socrates', 'soc_surf_flux_sw_down_clear', time_avg=True)
+diag.add_field('socrates', 'soc_olr_clear', time_avg=True)
+diag.add_field('socrates', 'soc_toa_sw_clear', time_avg=True)
+diag.add_field('socrates', 'soc_toa_sw_down_clear', time_avg=True)
+
diag.add_field('cloud_simple', 'cf', time_avg=True)
diag.add_field('cloud_simple', 'reff_rad', time_avg=True)
diag.add_field('cloud_simple', 'frac_liq', time_avg=True)
diag.add_field('cloud_simple', 'qcl_rad', time_avg=True)
-diag.add_field('cloud_simple', 'simple_rhcrit', time_avg=True)
+#diag.add_field('cloud_simple', 'simple_rhcrit', time_avg=True)
+diag.add_field('cloud_simple', 'rh_min', time_avg=True)
diag.add_field('cloud_simple', 'rh_in_cf', time_avg=True)
diag.add_field('mixed_layer', 'albedo', time_avg=True)
-# additional output options commented out
-diag.add_field('socrates', 'soc_flux_lw', time_avg=True)
-diag.add_field('socrates', 'soc_flux_sw', time_avg=True)
-#diag.add_field('socrates', 'soc_co2', time_avg=True)
-#diag.add_field('socrates', 'soc_ozone', time_avg=True)
-#diag.add_field('socrates', 'soc_coszen', time_avg=True)
-#diag.add_field('socrates', 'soc_spectral_olr', time_avg=True)
-
exp.diag_table = diag
exp.inputfiles = inputfiles
@@ -98,6 +112,7 @@
'chunk_size': 16,
'use_pressure_interp_for_half_levels':False,
'tidally_locked':False,
+ 'solday':90
},
'idealized_moist_phys_nml': {
'do_damping': True,
@@ -228,7 +243,12 @@
if __name__=="__main__":
cb.compile(debug=False)
- exp.run(1, use_restart=False, num_cores=NCORES, overwrite_data=False)#, run_idb=True)
+ #Set up the experiment object, with the first argument being the experiment name.
+ #This will be the name of the folder that the data will appear in.
+ exp.run(1, use_restart=False, num_cores=NCORES, overwrite_data=False)
+
+ overwrite=False
+ exp.run(1, use_restart=False, num_cores=NCORES, overwrite_data=overwrite)#, run_idb=True)
for i in range(2,241):
- exp.run(i, num_cores=NCORES)
+ exp.run(i, num_cores=NCORES, overwrite_data=overwrite)
From 35b6631bd4b2f6502d50dacebc9f9d53887e78d8 Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Tue, 22 Dec 2020 12:56:28 +0000
Subject: [PATCH 164/304] Minor edits to cloud schem while checking merge
---
src/atmos_param/cloud_simple/cloud_simple.F90 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/atmos_param/cloud_simple/cloud_simple.F90 b/src/atmos_param/cloud_simple/cloud_simple.F90
index 64c6e262a..347438f02 100644
--- a/src/atmos_param/cloud_simple/cloud_simple.F90
+++ b/src/atmos_param/cloud_simple/cloud_simple.F90
@@ -219,7 +219,7 @@ end subroutine calc_reff
subroutine calc_rhcrit(p_full, p_surf, simple_rhcrit)
! Get the RH needed as a threshold for the cloud fraction calc.
- ! This is only requires for spookmie_protocol=1
+ ! This is only requires for spookie_protocol=1
real, intent(in) :: p_full, p_surf
real, intent(out) :: simple_rhcrit
From 3cbfaabaf08581a9c75d380ffe2aa9299212c563 Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Tue, 22 Dec 2020 13:05:04 +0000
Subject: [PATCH 165/304] Removed mp comments which are not needed
---
.../rrtm_radiation/rrtm_radiation.f90 | 21 +++++++------------
1 file changed, 7 insertions(+), 14 deletions(-)
diff --git a/src/atmos_param/rrtm_radiation/rrtm_radiation.f90 b/src/atmos_param/rrtm_radiation/rrtm_radiation.f90
index daabf3f00..48fb8049e 100644
--- a/src/atmos_param/rrtm_radiation/rrtm_radiation.f90
+++ b/src/atmos_param/rrtm_radiation/rrtm_radiation.f90
@@ -161,15 +161,10 @@ module rrtm_vars
integer(kind=im) :: dt_rad_avg = -1 ! If averaging, over what time? dt_rad_avg=dt_rad if dt_rad_avg<=0
integer(kind=im) :: lonstep=1 ! Subsample fields along longitude
! for faster radiation calculation
-
-!!!!!! mp586 added for annual mean insolation!!!!!
-
logical :: frierson_solar_rad =.false.
real(kind=rb) :: del_sol = 0.95 ! frierson 2006 default = 1.4, but 0.95 gets the curve closer to the annual mean insolation
real(kind=rb) :: del_sw = 0.0 !frierson 2006 default
-!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
! some fancy radiation tweaks
real(kind=rb) :: slowdown_rad = 1.0 ! factor do simulate slower seasonal cycle: >1 means faster, <1 slower
logical :: do_zm_rad=.false. ! Only compute zonal mean radiation
@@ -210,7 +205,8 @@ module rrtm_vars
&h2o_lower_limit,temp_lower_limit,temp_upper_limit,co2ppmv, &
&do_fixed_water,fixed_water,fixed_water_pres,fixed_water_lat, &
&slowdown_rad, &
- &store_intermediate_rad, do_rad_time_avg, frierson_solar_rad, del_sol, del_sw, dt_rad, dt_rad_avg, & !mp586 added frierson_solar_rad, del_sol, del_sw for annual mean insolation
+ &store_intermediate_rad, do_rad_time_avg, &
+ &frierson_solar_rad, del_sol, del_sw, dt_rad, dt_rad_avg, &
&lonstep, do_zm_tracers, do_zm_rad, &
&do_precip_albedo, precip_albedo_mode, precip_albedo, precip_lat,&
&do_read_co2, co2_file, co2_variable_name, use_dyofyr, solrad, &
@@ -621,7 +617,7 @@ subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half, &
real(kind=rb),dimension(size(q,1),size(q,2)) :: albedo_loc
real(kind=rb),dimension(size(q,1),size(q,2),size(q,3)) :: q_tmp, h2o_vmr
real(kind=rb),dimension(size(q,1),size(q,2)) :: fracsun
- real(kind=rb),dimension(size(q,1),size(q,2)) :: p2 !mp586 addition for annual mean insolation
+ real(kind=rb),dimension(size(q,1),size(q,2)) :: p2 !used for annual mean insolation
integer :: year_in_s
real :: r_seconds, r_days, r_total_seconds, frac_of_day, frac_of_year, gmt, time_since_ae, rrsun, dt_rad_radians, day_in_s, r_solday, r_dt_rad_avg
@@ -677,17 +673,14 @@ subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half, &
Time_loc = Time
endif
-!!!!! mp586 addition for annual mean insolation !!!!!
-!!!! following https://github.com/sit23/Isca/blob/master/src/atmos_param/socrates/interface/socrates_interface.F90#L888 !!!!
-
if (frierson_solar_rad) then
p2 = (1. - 3.*sin(lat(:,:))**2)/4.
coszen = 0.25 * (1.0 + del_sol * p2 + del_sw * sin(lat(:,:)))
- rrsun = 1 ! needs to be set, set to 1 so that stellar_radiation is unchanged in socrates_interface
+ rrsun = 1
+ ! rrsun needs to be set to 1 so that stellar_radiation
+ ! is unchanged in socrates_interface
else
-!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
!
! compute zenith angle
! this is also an output, so need to compute even if we read radiation from file
@@ -719,7 +712,7 @@ subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half, &
call diurnal_solar(lat, lon, gmt, time_since_ae, coszen, fracsun, rrsun)
end if
- end if !mp586 addition for annual mean insolation
+ end if
! input files: only deal with case where we don't need to call radiation at all
if(do_read_radiation .and. do_read_sw_flux .and. do_read_lw_flux) then
From 671d81cc249245f26998d280f82562df8347ed0f Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Tue, 22 Dec 2020 13:10:05 +0000
Subject: [PATCH 166/304] Edits after compair to master and asses diff
---
src/atmos_param/rrtm_radiation/rrtm_radiation.f90 | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/atmos_param/rrtm_radiation/rrtm_radiation.f90 b/src/atmos_param/rrtm_radiation/rrtm_radiation.f90
index 48fb8049e..0f58a75ca 100644
--- a/src/atmos_param/rrtm_radiation/rrtm_radiation.f90
+++ b/src/atmos_param/rrtm_radiation/rrtm_radiation.f90
@@ -57,7 +57,7 @@ module rrtm_vars
real(kind=rb),allocatable,dimension(:,:,:) :: zeros ! place holder for any species set
! to zero
real(kind=rb),allocatable,dimension(:,:,:) :: ones ! place holder for any species set
- ! to zero
+ ! to one
! the following species are only set if use_secondary_gases=.true.
real(kind=rb),allocatable,dimension(:,:) :: ch4 ! CH4 [vmr]
! dimension (ncols_rrt x nlay_rrt)
@@ -631,7 +631,6 @@ subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half, &
real(kind=rb),dimension(ngptlw, ncols_rrt,nlay_rrt) :: cldfmcl_lw, ciwpmcl_lw, clwpmcl_lw, taucmcl_lw
! debug
- real :: tmp1, tmp2 !remove tmp1 and tmp2 after debugging
integer :: indx2(2),indx(3),ii,ji,ki, pt1,pt2
logical :: used
@@ -889,6 +888,7 @@ subroutine run_rrtmg(is,js,Time,lat,lon,p_full,p_half, &
endif
+ !TODO PM: the below code changes compared to the master need to be discussed with ST in detail.
if(include_secondary_gases)then
call rrtmg_sw &
(ncols_rrt, nlay_rrt , icld , iaer , &
From f521c4d1b624fb4aaa016f58734ae0cf1f335d27 Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Tue, 22 Dec 2020 13:37:29 +0000
Subject: [PATCH 167/304] Start of clean up of code. Removed unhelpful comments
attributed to individuals
---
.../driver/solo/idealized_moist_phys.F90 | 210 ++++++++----------
1 file changed, 95 insertions(+), 115 deletions(-)
diff --git a/src/atmos_spectral/driver/solo/idealized_moist_phys.F90 b/src/atmos_spectral/driver/solo/idealized_moist_phys.F90
index a82a9ca76..8479126e6 100644
--- a/src/atmos_spectral/driver/solo/idealized_moist_phys.F90
+++ b/src/atmos_spectral/driver/solo/idealized_moist_phys.F90
@@ -8,7 +8,8 @@ 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
+! cp_air needed for rrtmg and pstd_mks needed for pref calculation
+use constants_mod, only: grav, rdgas, rvgas, cp_air, PSTD_MKS, dens_h2o
use time_manager_mod, only: time_type, get_time, operator( + )
@@ -40,13 +41,13 @@ module idealized_moist_phys_mod
use surface_flux_mod, only: surface_flux, gp_surface_flux
-use sat_vapor_pres_mod, only: lookup_es !s Have added this to allow relative humdity to be calculated in a consistent way.
+use sat_vapor_pres_mod, only: lookup_es ! needed for relative humdity to be calculated in a consistent way.
-use damping_driver_mod, only: damping_driver, damping_driver_init, damping_driver_end !s MiMA uses damping
+use damping_driver_mod, only: damping_driver, damping_driver_init, damping_driver_end ! MiMA uses damping
use press_and_geopot_mod, only: pressure_variables
-use mpp_domains_mod, only: mpp_get_global_domain !s added to enable land reading
+use mpp_domains_mod, only: mpp_get_global_domain ! needed for reading in land
use transforms_mod, only: grid_domain
@@ -199,22 +200,23 @@ module idealized_moist_phys_mod
dtaudu_atm, & ! d(stress component)/d(atmos wind)
fracland, & ! fraction of land in gridbox
rough, & ! roughness for vert_turb_driver
- albedo, & !s albedo now defined in mixed_layer_init
- coszen, & !s make sure this is ready for assignment in run_rrtmg
- pbltop, & !s Used as an input to damping_driver, outputted from vert_turb_driver
- ex_del_m, & !mp586 for 10m winds and 2m temp
- ex_del_h, & !mp586 for 10m winds and 2m temp
- ex_del_q, & !mp586 for 10m winds and 2m temp
- temp_2m, & !mp586 for 10m winds and 2m temp
- u_10m, & !mp586 for 10m winds and 2m temp
- v_10m, & !mp586 for 10m winds and 2m temp
- q_2m, & ! Add 2m specific humidity
- rh_2m ! Add 2m relative humidity
+ albedo, & ! albedo now defined in mixed_layer_init
+ coszen, & ! make sure this is ready for assignment in run_rrtmg
+ pbltop, & ! used as an input to damping_driver, outputted from vert_turb_driver
+ ex_del_m, & ! used for 10m winds and 2m temp
+ ex_del_h, & ! used for 10m winds and 2m temp
+ ex_del_q, & ! used for 10m winds and 2m temp
+ temp_2m, & ! used for 10m winds and 2m temp
+ u_10m, & ! used for 10m winds and 2m temp
+ v_10m, & ! used for 10m winds and 2m temp
+ q_2m, & ! used for 2m specific humidity
+ rh_2m ! used for 2m relative humidity
real, allocatable, dimension(:,:,:) :: &
diff_m, & ! momentum diffusion coeff.
diff_t, & ! temperature diffusion coeff.
- tdtlw, & ! place holder. appears in calling arguments of vert_turb_driver but not used unless do_edt=.true. -- pjp
+ tdtlw, & ! place holder. appears in calling arguments of
+ !vert_turb_driver but not used unless do_edt=.true.
diss_heat, & ! heat dissipated by vertical diffusion
diss_heat_ray, & ! heat dissipated by rayleigh bottom drag (used when gp_surface=.True.)
non_diff_dt_ug, & ! zonal wind tendency except from vertical diffusion
@@ -231,7 +233,8 @@ module idealized_moist_phys_mod
avail, & ! generate surf. flux (all true)
land, & ! land points (all false)
coldT, & ! should precipitation be snow at this point
- convect ! place holder. appears in calling arguments of vert_turb_driver but not used unless do_entrain=.true. -- pjp
+ convect ! place holder. appears in calling arguments of
+ ! vert_turb_driver but not used unless do_entrain=.true.
real, allocatable, dimension(:,:) :: &
land_ones ! land points (all zeros)
@@ -277,11 +280,11 @@ module idealized_moist_phys_mod
id_cin, &
id_flux_u, & ! surface flux of zonal mom.
id_flux_v, & ! surface flux of meridional mom.
- id_temp_2m, & !mp586 for 10m winds and 2m temp
- id_u_10m, & !mp586 for 10m winds and 2m temp
- id_v_10m, & !mp586 for 10m winds and 2m temp
- id_q_2m, & ! Add 2m specific humidity
- id_rh_2m ! Add 2m relative humidity
+ id_temp_2m, & ! used for 10m winds and 2m temp
+ id_u_10m, & ! used for 10m winds and 2m temp
+ id_v_10m, & ! used for 10m winds and 2m temp
+ id_q_2m, & ! used for 2m specific humidity
+ id_rh_2m ! used for 2m relative humidity
integer, allocatable, dimension(:,:) :: convflag ! indicates which qe convection subroutines are used
real, allocatable, dimension(:,:) :: rad_lat, rad_lon
@@ -310,7 +313,7 @@ subroutine idealized_moist_phys_init(Time, Time_step_in, nhum, rad_lon_2d, rad_l
real, intent(in), dimension(:,:) :: rad_lon_2d, rad_lat_2d, rad_lonb_2d, rad_latb_2d, t_surf_init
integer :: io, nml_unit, stdlog_unit, seconds, days, id, jd, kd
-real, dimension (size(rad_lonb_2d,1)-1, size(rad_latb_2d,2)-1) :: sgsmtn !s added for damping_driver
+real, dimension (size(rad_lonb_2d,1)-1, size(rad_latb_2d,2)-1) :: sgsmtn ! needed for damping_driver
!s added for land reading
integer, dimension(4) :: siz
@@ -369,7 +372,6 @@ subroutine idealized_moist_phys_init(Time, Time_step_in, nhum, rad_lon_2d, rad_l
do_bm = .false.
do_ras = .false.
-
else if(uppercase(trim(convection_scheme)) == 'FULL_BETTS_MILLER') then
r_conv_scheme = FULL_BETTS_MILLER_CONV
call error_mesg('idealized_moist_phys','Using Betts-Miller convection scheme.', NOTE)
@@ -377,7 +379,6 @@ subroutine idealized_moist_phys_init(Time, Time_step_in, nhum, rad_lon_2d, rad_l
lwet_convection = .false.
do_ras = .false.
-
else if(uppercase(trim(convection_scheme)) == 'RAS') then
r_conv_scheme = RAS_CONV
call error_mesg('idealized_moist_phys','Using relaxed Arakawa Schubert convection scheme.', NOTE)
@@ -431,12 +432,12 @@ subroutine idealized_moist_phys_init(Time, Time_step_in, nhum, rad_lon_2d, rad_l
allocate(rad_lat (is:ie, js:je)); rad_lat = rad_lat_2d
allocate(rad_lon (is:ie, js:je)); rad_lon = rad_lon_2d
-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 (dt_bucket (is:ie, js:je)); dt_bucket = 0.0
+allocate (filt (is:ie, js:je)); filt = 0.0
+allocate(bucket_depth (is:ie, js:je, num_time_levels)); bucket_depth = init_bucket_depth
+allocate(depth_change_lh(is:ie, js:je))
+allocate(depth_change_cond(is:ie, js:je))
+allocate(depth_change_conv(is:ie, js:je))
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
@@ -467,14 +468,13 @@ subroutine idealized_moist_phys_init(Time, Time_step_in, nhum, rad_lon_2d, rad_l
allocate(dedq_atm (is:ie, js:je))
allocate(dtaudv_atm (is:ie, js:je))
allocate(dtaudu_atm (is:ie, js:je))
-allocate(ex_del_m (is:ie, js:je)) !mp586 added for 10m wind and 2m temp
-allocate(ex_del_h (is:ie, js:je)) !mp586 added for 10m wind and 2m temp
-allocate(ex_del_q (is:ie, js:je)) !mp586 added for 10m wind and 2m temp
-allocate(temp_2m (is:ie, js:je)) !mp586 added for 10m wind and 2m temp
-allocate(u_10m (is:ie, js:je)) !mp586 added for 10m wind and 2m temp
-allocate(v_10m (is:ie, js:je)) !mp586 added for 10m wind and 2m temp
-allocate(q_2m (is:ie, js:je)) ! Add 2m specific humidity
-allocate(rh_2m (is:ie, js:je)) ! Add 2m relative humidity
+allocate(ex_del_m (is:ie, js:je))
+allocate(ex_del_h (is:ie, js:je))
+allocate(ex_del_q (is:ie, js:je))
+allocate(temp_2m (is:ie, js:je))
+allocate(u_10m (is:ie, js:je))
+allocate(q_2m (is:ie, js:je))
+allocate(rh_2m (is:ie, js:je))
allocate(land (is:ie, js:je)); land = .false.
allocate(land_ones (is:ie, js:je)); land_ones = 0.0
allocate(avail (is:ie, js:je)); avail = .true.
@@ -557,9 +557,7 @@ subroutine idealized_moist_phys_init(Time, Time_step_in, nhum, rad_lon_2d, rad_l
where ( z_surf > 10. ) land = .true.
endif
-
-!s Add option to alter surface roughness length over land
-
+!option to alter surface roughness length over land
if(trim(land_option) .eq. 'input') then
where(land)
@@ -570,17 +568,12 @@ subroutine idealized_moist_phys_init(Time, Time_step_in, nhum, rad_lon_2d, rad_l
endif
-!RG Add bucket - initialise bucket depth
if(bucket) then
where(land)
bucket_depth(:,:,1) = init_bucket_depth_land
bucket_depth(:,:,2) = init_bucket_depth_land
end where
endif
-!RG end Add bucket
-
-!s end option to alter surface roughness length over land
-
if (gp_surface) then
call rayleigh_bottom_drag_init(get_axis_id(), Time)
@@ -594,7 +587,9 @@ subroutine idealized_moist_phys_init(Time, Time_step_in, nhum, rad_lon_2d, rad_l
if(do_damping) then
call pressure_variables(p_half_1d,ln_p_half_1d,pref(1:num_levels),ln_p_full_1d,PSTD_MKS)
pref(num_levels+1) = PSTD_MKS
- call damping_driver_init (rad_lonb_2d(:,1),rad_latb_2d(1,:), pref(:), get_axis_id(), Time, & !s note that in the original this is pref(:,1), which is the full model pressure levels and the surface pressure at the bottom. There is pref(:2) in this version with 81060 as surface pressure??
+ call damping_driver_init (rad_lonb_2d(:,1),rad_latb_2d(1,:), pref(:), get_axis_id(), Time, &
+!note that in the original this is pref(:,1), which is the full model pressure levels and
+!the surface pressure at the bottom. There is pref(:2) in this version with 81060 as surface pressure??
sgsmtn)
endif
@@ -645,33 +640,27 @@ subroutine idealized_moist_phys_init(Time, Time_step_in, nhum, rad_lon_2d, rad_l
axes(1:2), Time, 'Meridional momentum flux', 'Pa')
if(bucket) then
- id_bucket_depth = register_diag_field(mod_name, 'bucket_depth', & ! RG Add bucket
+ id_bucket_depth = register_diag_field(mod_name, 'bucket_depth', &
axes(1:2), Time, 'Depth of surface reservoir', 'm')
- id_bucket_depth_conv = register_diag_field(mod_name, 'bucket_depth_conv', & ! RG Add bucket
+ id_bucket_depth_conv = register_diag_field(mod_name, 'bucket_depth_conv', &
axes(1:2), Time, 'Tendency of bucket depth induced by Convection', 'm/s')
- id_bucket_depth_cond = register_diag_field(mod_name, 'bucket_depth_cond', & ! RG Add bucket
+ id_bucket_depth_cond = register_diag_field(mod_name, 'bucket_depth_cond', &
axes(1:2), Time, 'Tendency of bucket depth induced by Condensation', 'm/s')
- id_bucket_depth_lh = register_diag_field(mod_name, 'bucket_depth_lh', & ! RG Add bucket
+ id_bucket_depth_lh = register_diag_field(mod_name, 'bucket_depth_lh', &
axes(1:2), Time, 'Tendency of bucket depth induced by LH', 'm/s')
endif
-!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-!!!!!!! added by mp586 for 10m winds and 2m temperature add mo_profile()!!!!!!!!
-
-id_temp_2m = register_diag_field(mod_name, 'temp_2m', & !mp586 add 2m temp
+id_temp_2m = register_diag_field(mod_name, 'temp_2m', &
axes(1:2), Time, 'Air temperature 2m above surface', 'K')
-id_u_10m = register_diag_field(mod_name, 'u_10m', & !mp586 add 10m wind (u)
+id_u_10m = register_diag_field(mod_name, 'u_10m', &
axes(1:2), Time, 'Zonal wind 10m above surface', 'm/s')
-id_v_10m = register_diag_field(mod_name, 'v_10m', & !mp586 add 10m wind (v)
+id_v_10m = register_diag_field(mod_name, 'v_10m', &
axes(1:2), Time, 'Meridional wind 10m above surface', 'm/s')
-!!!!!!!!!!!! end of mp586 additions !!!!!!!!!!!!!!!!!!!!!!!
-!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
id_q_2m = register_diag_field(mod_name, 'sphum_2m', &
- axes(1:2), Time, 'Specific humidity 2m above surface', 'kg/kg') !Add 2m specific humidity
+ axes(1:2), Time, 'Specific humidity 2m above surface', 'kg/kg')
id_rh_2m = register_diag_field(mod_name, 'rh_2m', &
- axes(1:2), Time, 'Relative humidity 2m above surface', 'percent') !Add 2m relative humidity
+ axes(1:2), Time, 'Relative humidity 2m above surface', 'percent')
select case(r_conv_scheme)
@@ -1027,69 +1016,60 @@ subroutine idealized_moist_phys(Time, p_half, p_full, z_half, z_full, ug, vg, tg
p_half(:,:,num_levels+1,current), &
t_surf(:,:), &
t_surf(:,:), &
- q_surf(:,:), & ! is intent(inout)
- bucket, & ! RG Add bucket
- bucket_depth(:,:,current), & ! RG Add bucket
- max_bucket_depth_land, & ! RG Add bucket
- depth_change_lh(:,:), & ! RG Add bucket
- depth_change_conv(:,:), & ! RG Add bucket
- depth_change_cond(:,:), & ! RG Add bucket
+ q_surf(:,:), &
+ bucket, &
+ bucket_depth(:,:,current), &
+ max_bucket_depth_land, &
+ depth_change_lh(:,:), &
+ depth_change_conv(:,:), &
+ depth_change_cond(:,:), &
u_surf(:,:), &
v_surf(:,:), &
rough_mom(:,:), &
rough_heat(:,:), &
rough_moist(:,:), &
- rough_mom(:,:), & ! using rough_mom in place of rough_scale -- pjp
+ rough_mom(:,:), &
gust(:,:), &
- flux_t(:,:), & ! is intent(out)
- flux_q(:,:), & ! is intent(out)
- flux_r(:,:), & ! is intent(out)
- flux_u(:,:), & ! is intent(out)
- flux_v(:,:), & ! is intent(out)
- drag_m(:,:), & ! is intent(out)
- drag_t(:,:), & ! is intent(out)
- drag_q(:,:), & ! is intent(out)
- w_atm(:,:), & ! is intent(out)
- ustar(:,:), & ! is intent(out)
- bstar(:,:), & ! is intent(out)
- qstar(:,:), & ! is intent(out)
- dhdt_surf(:,:), & ! is intent(out)
- dedt_surf(:,:), & ! is intent(out)
- dedq_surf(:,:), & ! is intent(out)
- drdt_surf(:,:), & ! is intent(out)
- dhdt_atm(:,:), & ! is intent(out)
- dedq_atm(:,:), & ! is intent(out)
- dtaudu_atm(:,:), & ! is intent(out)
- dtaudv_atm(:,:), & ! is intent(out)
- ex_del_m(:,:), & ! mp586 for 10m winds and 2m temp
- ex_del_h(:,:), & ! mp586 for 10m winds and 2m temp
- ex_del_q(:,:), & ! mp586 for 10m winds and 2m temp
- temp_2m(:,:), & ! mp586 for 10m winds and 2m temp
- u_10m(:,:), & ! mp586 for 10m winds and 2m temp
- v_10m(:,:), & ! mp586 for 10m winds and 2m temp
- q_2m(:,:), & ! Add 2m specific humidity
- rh_2m(:,:), & ! Add 2m relative humidity
- delta_t, &
+ flux_t(:,:), &
+ flux_q(:,:), &
+ flux_r(:,:), &
+ flux_u(:,:), &
+ flux_v(:,:), &
+ drag_m(:,:), &
+ drag_t(:,:), &
+ drag_q(:,:), &
+ w_atm(:,:), &
+ ustar(:,:), &
+ bstar(:,:), &
+ qstar(:,:), &
+ dhdt_surf(:,:), &
+ dedt_surf(:,:), &
+ dedq_surf(:,:), &
+ drdt_surf(:,:), &
+ dhdt_atm(:,:), &
+ dedq_atm(:,:), &
+ dtaudu_atm(:,:), &
+ dtaudv_atm(:,:), &
+ ex_del_m(:,:), &
+ ex_del_h(:,:), &
+ ex_del_q(:,:), &
+ temp_2m(:,:), &
+ u_10m(:,:), &
+ v_10m(:,:), &
+ q_2m(:,:), &
+ rh_2m(:,:), &
+ delta_t, &
land(:,:), &
.not.land(:,:), &
avail(:,:) )
if(id_flux_u > 0) used = send_data(id_flux_u, flux_u, Time)
if(id_flux_v > 0) used = send_data(id_flux_v, flux_v, Time)
-
- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- !!!!!!! added by mp586 for 10m winds and 2m temperature add mo_profile()!!!!!!!!
-
- if(id_temp_2m > 0) used = send_data(id_temp_2m, temp_2m, Time) ! mp586 add 2m temp
- if(id_u_10m > 0) used = send_data(id_u_10m, u_10m, Time) ! mp586 add 10m wind (u)
- if(id_v_10m > 0) used = send_data(id_v_10m, v_10m, Time) ! mp586 add 10m wind (v)
-
-
- !!!!!!!!!!!! end of mp586 additions !!!!!!!!!!!!!!!!!!!!!!!
- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
- if(id_q_2m > 0) used = send_data(id_q_2m, q_2m, Time) ! Add 2m specific humidity
- if(id_rh_2m > 0) used = send_data(id_rh_2m, rh_2m*1e2, Time) ! Add 2m relative humidity
+ if(id_temp_2m > 0) used = send_data(id_temp_2m, temp_2m, Time)
+ if(id_u_10m > 0) used = send_data(id_u_10m, u_10m, Time)
+ if(id_v_10m > 0) used = send_data(id_v_10m, v_10m, Time)
+ if(id_q_2m > 0) used = send_data(id_q_2m, q_2m, Time)
+ if(id_rh_2m > 0) used = send_data(id_rh_2m, rh_2m*1e2, Time)
endif
@@ -1165,7 +1145,7 @@ subroutine idealized_moist_phys(Time, p_half, p_full, z_half, z_full, ug, vg, tg
!----------------------------------------------------------------------
z_pbl(:,:) = pbltop(is:ie,js:je)
if(do_damping) then
- call damping_driver (is, js, rad_lat, Time+Time_step, delta_t, &
+ call damping_driver (is, js, rad_lat, Time+Time_step, delta_t, &
p_full(:,:,:,current), p_half(:,:,:,current), &
z_full(:,:,:,current), z_half(:,:,:,current), &
ug(:,:,:,previous), vg(:,:,:,previous), &
From e8a14cd9b79480197881e8d2d109f4703b54b8cf Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Tue, 22 Dec 2020 13:48:59 +0000
Subject: [PATCH 168/304] Further cleaning to idealized moist phys
---
.../driver/solo/idealized_moist_phys.F90 | 31 +++++++++----------
1 file changed, 15 insertions(+), 16 deletions(-)
diff --git a/src/atmos_spectral/driver/solo/idealized_moist_phys.F90 b/src/atmos_spectral/driver/solo/idealized_moist_phys.F90
index 8479126e6..3bb6d7eed 100644
--- a/src/atmos_spectral/driver/solo/idealized_moist_phys.F90
+++ b/src/atmos_spectral/driver/solo/idealized_moist_phys.F90
@@ -173,9 +173,9 @@ module idealized_moist_phys_mod
rough_mom, & ! momentum roughness length for surface_flux
rough_heat, & ! heat roughness length for surface_flux
rough_moist, & ! moisture roughness length for surface_flux
- depth_change_lh, & ! tendency in bucket depth due to latent heat transfer ! RG Add bucket
- depth_change_cond, & ! tendency in bucket depth due to condensation rain ! RG Add bucket
- depth_change_conv, & ! tendency in bucket depth due to convection rain ! RG Add bucket
+ depth_change_lh, & ! tendency in bucket depth due to latent heat transfer
+ depth_change_cond, & ! tendency in bucket depth due to condensation rain
+ depth_change_conv, & ! tendency in bucket depth due to convection rain
gust, & ! gustiness constant
z_pbl, & ! gustiness constant
flux_t, & ! surface sensible heat flux
@@ -216,7 +216,7 @@ module idealized_moist_phys_mod
diff_m, & ! momentum diffusion coeff.
diff_t, & ! temperature diffusion coeff.
tdtlw, & ! place holder. appears in calling arguments of
- !vert_turb_driver but not used unless do_edt=.true.
+ ! vert_turb_driver but not used unless do_edt=.true.
diss_heat, & ! heat dissipated by vertical diffusion
diss_heat_ray, & ! heat dissipated by rayleigh bottom drag (used when gp_surface=.True.)
non_diff_dt_ug, & ! zonal wind tendency except from vertical diffusion
@@ -269,10 +269,10 @@ module idealized_moist_phys_mod
id_conv_dt_qg, & ! temperature tendency from convection
id_cond_dt_tg, & ! temperature tendency from condensation
id_cond_dt_qg, & ! temperature tendency from condensation
- id_bucket_depth, & ! bucket depth variable for output - RG Add bucket
- id_bucket_depth_conv, & ! bucket depth variation induced by convection - RG Add bucket
- id_bucket_depth_cond, & ! bucket depth variation induced by condensation - RG Add bucket
- id_bucket_depth_lh, & ! bucket depth variation induced by LH - RG Add bucket
+ id_bucket_depth, & ! bucket depth variable for output
+ id_bucket_depth_conv, & ! bucket depth variation induced by convection
+ id_bucket_depth_cond, & ! bucket depth variation induced by condensation
+ id_bucket_depth_lh, & ! bucket depth variation induced by LH
id_rh, & ! Relative humidity
id_diss_heat_ray,& ! Heat dissipated by rayleigh bottom drag if gp_surface=.True.
id_z_tg, & ! Relative humidity
@@ -798,7 +798,6 @@ subroutine idealized_moist_phys(Time, p_half, p_full, z_half, z_full, ug, vg, tg
real, dimension(1,1,1):: tracer, tracertnd
integer :: nql, nqi, nqa ! tracer indices for stratiform clouds
-
if(current == previous) then
delta_t = dt_real
else
@@ -1050,12 +1049,12 @@ subroutine idealized_moist_phys(Time, p_half, p_full, z_half, z_full, ug, vg, tg
dedq_atm(:,:), &
dtaudu_atm(:,:), &
dtaudv_atm(:,:), &
- ex_del_m(:,:), &
- ex_del_h(:,:), &
- ex_del_q(:,:), &
- temp_2m(:,:), &
- u_10m(:,:), &
- v_10m(:,:), &
+ ex_del_m(:,:), &
+ ex_del_h(:,:), &
+ ex_del_q(:,:), &
+ temp_2m(:,:), &
+ u_10m(:,:), &
+ v_10m(:,:), &
q_2m(:,:), &
rh_2m(:,:), &
delta_t, &
@@ -1095,7 +1094,7 @@ subroutine idealized_moist_phys(Time, p_half, p_full, z_half, z_full, ug, vg, tg
call interp_temp(z_full(:,:,:,current),z_half(:,:,:,current),tg_interp, Time)
call run_rrtmg(is,js,Time,rad_lat(:,:),rad_lon(:,:),p_full(:,:,:,current),p_half(:,:,:,current), &
albedo,grid_tracers(:,:,:,previous,nsphum),tg_interp,t_surf(:,:),dt_tg(:,:,:), &
- coszen,net_surf_sw_down(:,:),surf_lw_down(:,:), cf_rad(:,:,:), reff_rad(:,:,:), &
+ coszen,net_surf_sw_down(:,:),surf_lw_down(:,:), cf_rad(:,:,:), reff_rad(:,:,:), &
do_cloud_simple )
endif
#endif
From c4362657b6b263064f8417abaf8142a514ea1ea4 Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Tue, 22 Dec 2020 13:52:57 +0000
Subject: [PATCH 169/304] Minor style editing
---
src/atmos_param/socrates/interface/read_control.F90 | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/src/atmos_param/socrates/interface/read_control.F90 b/src/atmos_param/socrates/interface/read_control.F90
index 755a10357..92c8cec9d 100644
--- a/src/atmos_param/socrates/interface/read_control.F90
+++ b/src/atmos_param/socrates/interface/read_control.F90
@@ -30,8 +30,6 @@ SUBROUTINE read_control(control, spectrum, do_cloud_simple)
LOGICAL, INTENT(IN), OPTIONAL :: do_cloud_simple
-
-
! Local variables.
INTEGER :: i
! Loop variable
@@ -102,7 +100,7 @@ SUBROUTINE read_control(control, spectrum, do_cloud_simple)
if (do_cloud_simple) then
control%i_cloud_representation = ip_cloud_ice_water
else
- control%i_cloud_representation = ip_cloud_off
+ control%i_cloud_representation = ip_cloud_off
end if
control%i_overlap = ip_max_rand
control%i_inhom = ip_homogeneous
From fc842756c519542d09c1eb370debe842b39df88a Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Tue, 22 Dec 2020 13:58:35 +0000
Subject: [PATCH 170/304] Minor style changes
---
.../socrates/interface/socrates_interface.F90 | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/src/atmos_param/socrates/interface/socrates_interface.F90 b/src/atmos_param/socrates/interface/socrates_interface.F90
index 4afcaee31..a5abe3219 100644
--- a/src/atmos_param/socrates/interface/socrates_interface.F90
+++ b/src/atmos_param/socrates/interface/socrates_interface.F90
@@ -1080,15 +1080,16 @@ subroutine run_socrates(Time, Time_diag, rad_lat, rad_lon, temp_in, q_in, t_surf
!Set tide-locked flux if tidally-locked = .true. Else use diurnal-solar
!to calculate insolation from orbit!
- if (tidally_locked.eq..true.) then
+ if (tidally_locked) then
coszen = COS(rad_lat(:,:))*COS(rad_lon(:,:))
WHERE (coszen < 0.0) coszen = 0.0
- rrsun = 1 ! needs to be set, set to 1 so that stellar_radiation is unchanged in socrates_interface
+ rrsun = 1
+ ! needs to be set to 1 so that stellar_radiation is unchanged in socrates_interface
- elseif (frierson_solar_rad .eq. .true.) then
+ elseif (frierson_solar_rad) then
p2 = (1. - 3.*sin(rad_lat(:,:))**2)/4.
coszen = 0.25 * (1.0 + del_sol * p2 + del_sw * sin(rad_lat(:,:)))
- rrsun = 1 ! needs to be set, set to 1 so that stellar_radiation is unchanged in socrates_interface
+ rrsun = 1 ! needs to be set to 1 so that stellar_radiation is unchanged in socrates_interface
else
From 1a4ccdb9bfb2febcfae18133b3ae21a9c4eb00bd Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Tue, 29 Dec 2020 09:00:05 +0000
Subject: [PATCH 171/304] Commit for runs completed on 24 dec 2020
---
.../socrates_test/socrates_aquaplanet.py | 5 ++---
.../socrates_aquaplanet_with_cloud.py | 16 ++++++++--------
...rates_aquaplanet_with_cloud_amip_with_topo.py | 5 ++---
.../scripts/run_plevel_cloud_tests.py | 4 ++--
4 files changed, 14 insertions(+), 16 deletions(-)
diff --git a/exp/test_cases/socrates_test/socrates_aquaplanet.py b/exp/test_cases/socrates_test/socrates_aquaplanet.py
index 2a3b010f4..24202debc 100644
--- a/exp/test_cases/socrates_test/socrates_aquaplanet.py
+++ b/exp/test_cases/socrates_test/socrates_aquaplanet.py
@@ -23,7 +23,7 @@
# create an Experiment object to handle the configuration of model parameters
# and output diagnostics
-exp = Experiment('soc_test_aquaplanet_without_clouds', codebase=cb)
+exp = Experiment('validate_clouds_soc/soc_test_aquaplanet_without_clouds', codebase=cb)
exp.clear_rundir()
inputfiles = [os.path.join(GFDL_BASE,'input/rrtm_input_files/ozone_1990.nc')]
@@ -36,7 +36,7 @@
diag.add_field('dynamics', 'ps', time_avg=True)
diag.add_field('dynamics', 'bk')
diag.add_field('dynamics', 'pk')
-diag.add_field('dynamics', 'zsurf', time_avg=True)
+diag.add_field('dynamics', 'zsurf')
#Tell model which diagnostics to write
diag.add_field('atmosphere', 'precipitation', time_avg=True)
@@ -200,7 +200,6 @@
cb.compile(debug=False)
#Set up the experiment object, with the first argument being the experiment name.
#This will be the name of the folder that the data will appear in.
- exp.run(1, use_restart=False, num_cores=NCORES, overwrite_data=False)
overwrite=False
diff --git a/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
index fcdf0ce5b..00d632346 100644
--- a/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
+++ b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
@@ -5,7 +5,7 @@
from isca import SocratesCodeBase, DiagTable, Experiment, Namelist, GFDL_BASE
from isca.util import exp_progress
-NCORES = 16
+NCORES = 8
base_dir = os.path.dirname(os.path.realpath(__file__))
# a CodeBase can be a directory on the computer,
# useful for iterative development
@@ -23,7 +23,7 @@
# create an Experiment object to handle the configuration of model parameters
# and output diagnostics
-exp = Experiment('soc_test_aquaplanet_with_clouds_post_jm_suggestions', codebase=cb) # need to update after testing is complete.
+exp = Experiment('validate_clouds_soc/soc_test_aquaplanet_with_clouds_post_jm_suggestions', codebase=cb) # need to update after testing is complete.
exp.clear_rundir()
inputfiles = [os.path.join(GFDL_BASE,'input/rrtm_input_files/ozone_1990.nc')]
@@ -36,7 +36,7 @@
diag.add_field('dynamics', 'ps', time_avg=True)
diag.add_field('dynamics', 'bk')
diag.add_field('dynamics', 'pk')
-diag.add_field('dynamics', 'zsurf', time_avg=True)
+diag.add_field('dynamics', 'zsurf')
#Tell model which diagnostics to write
diag.add_field('atmosphere', 'precipitation', time_avg=True)
@@ -82,7 +82,7 @@
#diag.add_field('cloud_simple', 'simple_rhcrit', time_avg=True)
diag.add_field('cloud_simple', 'rh_min', time_avg=True)
diag.add_field('cloud_simple', 'rh_in_cf', time_avg=True)
-diag.add_field('mixed_layer', 'albedo', time_avg=True)
+diag.add_field('mixed_layer', 'albedo')
exp.diag_table = diag
@@ -226,10 +226,10 @@
cb.compile(debug=False)
#Set up the experiment object, with the first argument being the experiment name.
#This will be the name of the folder that the data will appear in.
- exp.run(1, use_restart=False, num_cores=NCORES, overwrite_data=False)
overwrite=False
- exp.run(1, use_restart=False, num_cores=NCORES, overwrite_data=overwrite)#, run_idb=True)
- #for i in range(2,121):
- # exp.run(i, num_cores=NCORES, overwrite_data=overwrite)
+ exp.run(1, use_restart=False, num_cores=NCORES, overwrite_data=overwrite)
+
+ for i in range(2,121):
+ exp.run(i, num_cores=NCORES, overwrite_data=overwrite)
diff --git a/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud_amip_with_topo.py b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud_amip_with_topo.py
index aafc5371e..4a00e15c4 100644
--- a/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud_amip_with_topo.py
+++ b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud_amip_with_topo.py
@@ -23,7 +23,7 @@
# create an Experiment object to handle the configuration of model parameters
# and output diagnostics
-exp = Experiment('soc_test_aquaplanet_with_clouds_post_jm_suggestions_amip_ssts_land_low_albedo_with_land', codebase=cb)
+exp = Experiment('validate_clouds_soc/soc_test_aquaplanet_with_clouds_post_jm_suggestions_amip_ssts_land_low_albedo_with_land', codebase=cb)
exp.clear_rundir()
inputfiles = [os.path.join(GFDL_BASE,'input/rrtm_input_files/ozone_1990.nc'),
@@ -245,10 +245,9 @@
cb.compile(debug=False)
#Set up the experiment object, with the first argument being the experiment name.
#This will be the name of the folder that the data will appear in.
- exp.run(1, use_restart=False, num_cores=NCORES, overwrite_data=False)
overwrite=False
exp.run(1, use_restart=False, num_cores=NCORES, overwrite_data=overwrite)#, run_idb=True)
- for i in range(2,241):
+ for i in range(2,121):
exp.run(i, num_cores=NCORES, overwrite_data=overwrite)
diff --git a/postprocessing/plevel_interpolation/scripts/run_plevel_cloud_tests.py b/postprocessing/plevel_interpolation/scripts/run_plevel_cloud_tests.py
index 95b120485..949e6eb75 100644
--- a/postprocessing/plevel_interpolation/scripts/run_plevel_cloud_tests.py
+++ b/postprocessing/plevel_interpolation/scripts/run_plevel_cloud_tests.py
@@ -7,8 +7,8 @@
import subprocess
start_time=time.time()
-base_dir='/scratch/pm366/OutputIsca/'
-exp_name_list = ['soc_test_aquaplanet_with_clouds']
+base_dir='/scratch/pm366/OutputIsca/validate_clouds_soc'
+exp_name_list = ['soc_test_aquaplanet_without_clouds']
avg_or_daily_list=['monthly']
start_file=1
end_file=120
From f6e2d13d2b252471fb7023f4052568fa5076d638 Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Mon, 11 Jan 2021 10:02:02 +0000
Subject: [PATCH 172/304] Run test data to check if gibbs ripples are fixed
---
.../socrates_aquaplanet_amip_with_topo.py | 232 ++++++++++++++++++
1 file changed, 232 insertions(+)
create mode 100644 exp/test_cases/socrates_test/socrates_aquaplanet_amip_with_topo.py
diff --git a/exp/test_cases/socrates_test/socrates_aquaplanet_amip_with_topo.py b/exp/test_cases/socrates_test/socrates_aquaplanet_amip_with_topo.py
new file mode 100644
index 000000000..1ea709e0e
--- /dev/null
+++ b/exp/test_cases/socrates_test/socrates_aquaplanet_amip_with_topo.py
@@ -0,0 +1,232 @@
+import os
+
+import numpy as np
+
+from isca import SocratesCodeBase, DiagTable, Experiment, Namelist, GFDL_BASE
+from isca.util import exp_progress
+
+NCORES = 16
+base_dir = os.path.dirname(os.path.realpath(__file__))
+# a CodeBase can be a directory on the computer,
+# useful for iterative development
+cb = SocratesCodeBase.from_directory(GFDL_BASE)
+
+# or it can point to a specific git repo and commit id.
+# This method should ensure future, independent, reproducibility of results.
+# cb = DryCodeBase.from_repo(repo='https://github.com/isca/isca', commit='isca1.1')
+
+# compilation depends on computer specific settings. The $GFDL_ENV
+# environment variable is used to determine which `$GFDL_BASE/src/extra/env` file
+# is used to load the correct compilers. The env file is always loaded from
+# $GFDL_BASE and not the checked out git repo.
+
+# create an Experiment object to handle the configuration of model parameters
+# and output diagnostics
+
+exp = Experiment('validate_clouds_soc/soc_test_aquaplanet_amip_ssts_land_low_albedo', codebase=cb)
+exp.clear_rundir()
+
+inputfiles = [os.path.join(GFDL_BASE,'input/rrtm_input_files/ozone_1990.nc'),
+ os.path.join(GFDL_BASE,'exp/test_cases/realistic_continents/input/sst_clim_amip.nc'),
+ os.path.join(GFDL_BASE,'exp/test_cases/realistic_continents/input/siconc_clim_amip.nc'),
+ os.path.join(GFDL_BASE,'input/land_masks/era_land_t42.nc')]
+
+#Tell model how to write diagnostics
+diag = DiagTable()
+diag.add_file('atmos_monthly', 30, 'days', time_units='days')
+
+#Write out diagnostics need for vertical interpolation post-processing
+diag.add_field('dynamics', 'ps', time_avg=True)
+diag.add_field('dynamics', 'bk')
+diag.add_field('dynamics', 'pk')
+diag.add_field('dynamics', 'zsurf')
+
+#Tell model which diagnostics to write
+diag.add_field('atmosphere', 'precipitation', time_avg=True)
+diag.add_field('atmosphere', 'rh', time_avg=True)
+diag.add_field('mixed_layer', 't_surf', time_avg=True)
+diag.add_field('mixed_layer', 'flux_t', time_avg=True) #LH
+diag.add_field('mixed_layer', 'flux_lhe', time_avg=True) #SH
+diag.add_field('dynamics', 'sphum', time_avg=True)
+diag.add_field('dynamics', 'ucomp', time_avg=True)
+diag.add_field('dynamics', 'vcomp', time_avg=True)
+diag.add_field('dynamics', 'omega', time_avg=True)
+diag.add_field('dynamics', 'temp', time_avg=True)
+diag.add_field('dynamics', 'vor', time_avg=True)
+diag.add_field('dynamics', 'div', time_avg=True)
+
+#temperature tendency - units are K/s
+diag.add_field('socrates', 'soc_tdt_lw', time_avg=True) # net flux lw 3d (up - down)
+diag.add_field('socrates', 'soc_tdt_sw', time_avg=True)
+diag.add_field('socrates', 'soc_tdt_rad', time_avg=True) #sum of the sw and lw heating rates
+
+#net (up) and down surface fluxes
+diag.add_field('socrates', 'soc_surf_flux_lw', time_avg=True)
+diag.add_field('socrates', 'soc_surf_flux_sw', time_avg=True)
+diag.add_field('socrates', 'soc_surf_flux_lw_down', time_avg=True)
+diag.add_field('socrates', 'soc_surf_flux_sw_down', time_avg=True)
+#net (up) TOA and downard fluxes
+diag.add_field('socrates', 'soc_olr', time_avg=True)
+diag.add_field('socrates', 'soc_toa_sw', time_avg=True)
+diag.add_field('socrates', 'soc_toa_sw_down', time_avg=True)
+
+exp.diag_table = diag
+exp.inputfiles = inputfiles
+
+#Define values for the 'core' namelist
+exp.namelist = namelist = Namelist({
+ 'main_nml':{
+ 'days' : 30,
+ 'hours' : 0,
+ 'minutes': 0,
+ 'seconds': 0,
+ 'dt_atmos':600,
+ 'current_date' : [1,1,1,0,0,0],
+ 'calendar' : 'thirty_day'
+ },
+ 'socrates_rad_nml': {
+ 'stellar_constant':1370.,
+ 'lw_spectral_filename':os.path.join(GFDL_BASE,'src/atmos_param/socrates/src/trunk/data/spectra/ga7/sp_lw_ga7'),
+ 'sw_spectral_filename':os.path.join(GFDL_BASE,'src/atmos_param/socrates/src/trunk/data/spectra/ga7/sp_sw_ga7'),
+ 'do_read_ozone': True,
+ 'ozone_file_name':'ozone_1990',
+ 'ozone_field_name':'ozone_1990',
+ 'dt_rad':3600,
+ 'store_intermediate_rad':True,
+ 'chunk_size': 16,
+ 'use_pressure_interp_for_half_levels':False,
+ 'tidally_locked':False,
+ 'solday':90
+ },
+ 'idealized_moist_phys_nml': {
+ 'do_damping': True,
+ 'turb':True,
+ 'mixed_layer_bc':True,
+ 'do_virtual' :False,
+ 'do_simple': True,
+ 'roughness_mom':3.21e-05,
+ 'roughness_heat':3.21e-05,
+ 'roughness_moist':3.21e-05,
+ 'two_stream_gray': False, #Use the grey radiation scheme
+ 'do_socrates_radiation': True,
+ 'convection_scheme': 'SIMPLE_BETTS_MILLER', #Use simple Betts miller convection
+ 'do_cloud_simple': False,
+ 'land_option' : 'input',
+ 'land_file_name' : 'INPUT/era_land_t42.nc',
+ 'land_roughness_prefactor' :10.0,
+ },
+
+
+ 'vert_turb_driver_nml': {
+ 'do_mellor_yamada': False, # default: True
+ 'do_diffusivity': True, # default: False
+ 'do_simple': True, # default: False
+ 'constant_gust': 0.0, # default: 1.0
+ 'use_tau': False
+ },
+
+ 'diffusivity_nml': {
+ 'do_entrain':False,
+ 'do_simple': True,
+ },
+
+ 'surface_flux_nml': {
+ 'use_virtual_temp': False,
+ 'do_simple': True,
+ 'old_dtaudv': True,
+ 'land_humidity_prefactor': 0.7,
+ },
+
+ 'atmosphere_nml': {
+ 'idealized_moist_model': True
+ },
+
+ #Use a large mixed-layer depth, and the Albedo of the CTRL case in Jucker & Gerber, 2017
+ 'mixed_layer_nml': {
+ 'tconst' : 285.,
+ 'prescribe_initial_dist':True,
+ 'evaporation':True,
+ 'depth': 20.0, #Depth of mixed layer used
+ 'albedo_value': 0.2, #Albedo value used
+ 'land_option': 'input', #Tell mixed layer to get land mask from input file
+ 'land_h_capacity_prefactor': 0.1, #What factor to multiply mixed-layer depth by over land.
+ 'albedo_value': 0.25, #Ocean albedo value
+ 'land_albedo_prefactor': 1.3, #What factor to multiply ocean albedo by over land
+ 'do_qflux' : False, #Don't use the prescribed analytical formula for q-fluxes
+ 'do_read_sst' : True, #Read in sst values from input file
+ 'do_sc_sst' : True, #Do specified ssts (need both to be true)
+ 'sst_file' : 'sst_clim_amip', #Set name of sst input file
+ 'specify_sst_over_ocean_only' : True, #Make sure sst only specified in regions of ocean.
+ },
+
+ 'qe_moist_convection_nml': {
+ 'rhbm':0.7,
+ 'Tmin':160.,
+ 'Tmax':350.
+ },
+
+ 'lscale_cond_nml': {
+ 'do_simple':True,
+ 'do_evap':True
+ },
+
+ 'sat_vapor_pres_nml': {
+ 'do_simple':True,
+ 'construct_table_wrt_liq_and_ice':True
+ },
+
+ 'damping_driver_nml': {
+ 'do_rayleigh': True,
+ 'trayfric': -0.5, # neg. value: time in *days*
+ 'sponge_pbottom': 150., #Setting the lower pressure boundary for the model sponge layer in Pa.
+ 'do_conserve_energy': True,
+ },
+
+ # FMS Framework configuration
+ 'diag_manager_nml': {
+ 'mix_snapshot_average_fields': False # time avg fields are labelled with time in middle of window
+ },
+
+ 'fms_nml': {
+ 'domains_stack_size': 600000 # default: 0
+ },
+
+ 'fms_io_nml': {
+ 'threading_write': 'single', # default: multi
+ 'fileset_write': 'single', # default: multi
+ },
+
+ 'spectral_dynamics_nml': {
+ 'damping_order': 4,
+ 'water_correction_limit': 200.e2,
+ 'reference_sea_level_press':1.0e5,
+ 'num_levels':40, #How many model pressure levels to use
+ 'valid_range_t':[100.,800.],
+ 'initial_sphum':[2.e-6],
+ 'vert_coord_option':'uneven_sigma',
+ 'surf_res':0.2, #Parameter that sets the vertical distribution of sigma levels
+ 'scale_heights' : 11.0,
+ 'exponent':7.0,
+ 'robert_coeff':0.03,
+ 'ocean_topog_smoothing': 0.8
+ },
+
+ 'spectral_init_cond_nml':{
+ 'topog_file_name': 'era_land_t42.nc',
+ 'topography_option': 'input'
+ },
+
+})
+
+#Lets do a run!
+if __name__=="__main__":
+
+ cb.compile(debug=False)
+ #Set up the experiment object, with the first argument being the experiment name.
+ #This will be the name of the folder that the data will appear in.
+
+ overwrite=True
+
+ exp.run(1, use_restart=False, num_cores=NCORES, overwrite_data=overwrite)#, run_idb=True)
+ for i in range(2,61):
+ exp.run(i, num_cores=NCORES, overwrite_data=overwrite)
From e7f8f465d5ecf12d0c5e57129353235eb29feee7 Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Mon, 11 Jan 2021 10:03:09 +0000
Subject: [PATCH 173/304] Add omega variable
---
exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
index 00d632346..4a098757d 100644
--- a/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
+++ b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
@@ -5,7 +5,7 @@
from isca import SocratesCodeBase, DiagTable, Experiment, Namelist, GFDL_BASE
from isca.util import exp_progress
-NCORES = 8
+NCORES = 16
base_dir = os.path.dirname(os.path.realpath(__file__))
# a CodeBase can be a directory on the computer,
# useful for iterative development
@@ -47,6 +47,7 @@
diag.add_field('dynamics', 'sphum', time_avg=True)
diag.add_field('dynamics', 'ucomp', time_avg=True)
diag.add_field('dynamics', 'vcomp', time_avg=True)
+diag.add_field('dynamics', 'omega', time_avg=True)
diag.add_field('dynamics', 'temp', time_avg=True)
diag.add_field('dynamics', 'vor', time_avg=True)
diag.add_field('dynamics', 'div', time_avg=True)
From ecb3a18fbdcd5d1131e370c2c57e281cec12328e Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Mon, 11 Jan 2021 10:03:39 +0000
Subject: [PATCH 174/304] Added omega and update comments
---
exp/test_cases/socrates_test/socrates_aquaplanet.py | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/exp/test_cases/socrates_test/socrates_aquaplanet.py b/exp/test_cases/socrates_test/socrates_aquaplanet.py
index 24202debc..9158ec862 100644
--- a/exp/test_cases/socrates_test/socrates_aquaplanet.py
+++ b/exp/test_cases/socrates_test/socrates_aquaplanet.py
@@ -42,11 +42,12 @@
diag.add_field('atmosphere', 'precipitation', time_avg=True)
diag.add_field('atmosphere', 'rh', time_avg=True)
diag.add_field('mixed_layer', 't_surf', time_avg=True)
-diag.add_field('mixed_layer', 'flux_t', time_avg=True) #LH
-diag.add_field('mixed_layer', 'flux_lhe', time_avg=True) #SH
+diag.add_field('mixed_layer', 'flux_t', time_avg=True) #SH
+diag.add_field('mixed_layer', 'flux_lhe', time_avg=True) #LH
diag.add_field('dynamics', 'sphum', time_avg=True)
diag.add_field('dynamics', 'ucomp', time_avg=True)
diag.add_field('dynamics', 'vcomp', time_avg=True)
+diag.add_field('dynamics', 'omega', time_avg=True)
diag.add_field('dynamics', 'temp', time_avg=True)
diag.add_field('dynamics', 'vor', time_avg=True)
diag.add_field('dynamics', 'div', time_avg=True)
@@ -117,7 +118,7 @@
'constant_gust': 0.0, # default: 1.0
'use_tau': False
},
-
+
'diffusivity_nml': {
'do_entrain':False,
'do_simple': True,
From ecd7db3757d0901cad4408cdce8c0bc6fdbe826f Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Fri, 22 Jan 2021 08:55:01 +0000
Subject: [PATCH 175/304] Clean up original test case after I made
modifications to it
---
exp/spookie2/socrates_aquaplanet.py | 38 ++++++-----------------------
1 file changed, 8 insertions(+), 30 deletions(-)
diff --git a/exp/spookie2/socrates_aquaplanet.py b/exp/spookie2/socrates_aquaplanet.py
index ddbf5d2b0..cf96251cc 100644
--- a/exp/spookie2/socrates_aquaplanet.py
+++ b/exp/spookie2/socrates_aquaplanet.py
@@ -32,12 +32,13 @@
diag = DiagTable()
diag.add_file('atmos_monthly', 30, 'days', time_units='days')
-#Tell model which diagnostics to write
+#Write out diagnostics need for vertical interpolation post-processing
diag.add_field('dynamics', 'ps', time_avg=True)
diag.add_field('dynamics', 'bk')
diag.add_field('dynamics', 'pk')
-diag.add_field('dynamics', 'zsurf', time_avg=True)
+diag.add_field('dynamics', 'zsurf')
+#Tell model which diagnostics to write
diag.add_field('atmosphere', 'precipitation', time_avg=True)
diag.add_field('atmosphere', 'rh', time_avg=True)
diag.add_field('mixed_layer', 't_surf', time_avg=True)
@@ -64,32 +65,7 @@
#net (up) TOA and downard fluxes
diag.add_field('socrates', 'soc_olr', time_avg=True)
diag.add_field('socrates', 'soc_toa_sw', time_avg=True)
-diag.add_field('socrates', 'soc_toa_sw_down', time_avg=True)
-
-#clear sky fluxes
-diag.add_field('socrates', 'soc_surf_flux_lw_clear', time_avg=True)
-diag.add_field('socrates', 'soc_surf_flux_sw_clear', time_avg=True)
-diag.add_field('socrates', 'soc_surf_flux_lw_down_clear', time_avg=True)
-diag.add_field('socrates', 'soc_surf_flux_sw_down_clear', time_avg=True)
-diag.add_field('socrates', 'soc_olr_clear', time_avg=True)
-diag.add_field('socrates', 'soc_toa_sw_clear', time_avg=True)
-diag.add_field('socrates', 'soc_toa_sw_down_clear', time_avg=True)
-
-#diag.add_field('cloud_simple', 'cf', time_avg=True)
-#diag.add_field('cloud_simple', 'reff_rad', time_avg=True)
-#diag.add_field('cloud_simple', 'frac_liq', time_avg=True)
-#diag.add_field('cloud_simple', 'qcl_rad', time_avg=True)
-#diag.add_field('cloud_simple', 'simple_rhcrit', time_avg=True)
-#diag.add_field('cloud_simple', 'rh_min', time_avg=True)
-#diag.add_field('cloud_simple', 'rh_in_cf', time_avg=True)
-
-# additional output options commented out
-#diag.add_field('socrates', 'soc_flux_lw', time_avg=True)
-#diag.add_field('socrates', 'soc_flux_sw', time_avg=True)
-#diag.add_field('socrates', 'soc_co2', time_avg=True)
-#diag.add_field('socrates', 'soc_ozone', time_avg=True)
-#diag.add_field('socrates', 'soc_coszen', time_avg=True)
-#diag.add_field('socrates', 'soc_spectral_olr', time_avg=True)
+diag.add_field('socrates', 'soc_toa_sw_down', time_avg=True)
exp.diag_table = diag
exp.inputfiles = inputfiles
@@ -179,7 +155,7 @@
},
'sat_vapor_pres_nml': {
- 'do_simple':True
+ 'do_simple':True,
},
'damping_driver_nml': {
@@ -223,8 +199,10 @@
if __name__=="__main__":
cb.compile(debug=False)
+ #Set up the experiment object, with the first argument being the experiment name.
+ #This will be the name of the folder that the data will appear in.
- overwrite=True
+ overwrite=False
exp.run(1, use_restart=False, num_cores=NCORES, overwrite_data=overwrite)#, run_idb=True)
for i in range(2,121):
From 7939dfb96c46cc798c97af876fb5b062265b81fe Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Fri, 22 Jan 2021 08:55:36 +0000
Subject: [PATCH 176/304] Update diag outputs
---
.../socrates_aquaplanet_with_cloud.py | 20 +++++++++----------
1 file changed, 9 insertions(+), 11 deletions(-)
diff --git a/exp/spookie2/socrates_aquaplanet_with_cloud.py b/exp/spookie2/socrates_aquaplanet_with_cloud.py
index bbe031042..8fa76d3e3 100644
--- a/exp/spookie2/socrates_aquaplanet_with_cloud.py
+++ b/exp/spookie2/socrates_aquaplanet_with_cloud.py
@@ -32,10 +32,11 @@
diag = DiagTable()
diag.add_file('atmos_monthly', 30, 'days', time_units='days')
+#Write out diagnostics need for vertical interpolation post-processing
diag.add_field('dynamics', 'ps', time_avg=True)
diag.add_field('dynamics', 'bk')
diag.add_field('dynamics', 'pk')
-diag.add_field('dynamics', 'zsurf', time_avg=True)
+diag.add_field('dynamics', 'zsurf')
#Tell model which diagnostics to write
diag.add_field('atmosphere', 'precipitation', time_avg=True)
@@ -64,7 +65,7 @@
#net (up) TOA and downard fluxes
diag.add_field('socrates', 'soc_olr', time_avg=True)
diag.add_field('socrates', 'soc_toa_sw', time_avg=True)
-diag.add_field('socrates', 'soc_toa_sw_down', time_avg=True)
+diag.add_field('socrates', 'soc_toa_sw_down', time_avg=True)
#clear sky fluxes
diag.add_field('socrates', 'soc_surf_flux_lw_clear', time_avg=True)
@@ -82,14 +83,8 @@
#diag.add_field('cloud_simple', 'simple_rhcrit', time_avg=True)
diag.add_field('cloud_simple', 'rh_min', time_avg=True)
diag.add_field('cloud_simple', 'rh_in_cf', time_avg=True)
+diag.add_field('mixed_layer', 'albedo')
-# additional output options commented out
-#diag.add_field('socrates', 'soc_flux_lw', time_avg=True)
-#diag.add_field('socrates', 'soc_flux_sw', time_avg=True)
-#diag.add_field('socrates', 'soc_co2', time_avg=True)
-#diag.add_field('socrates', 'soc_ozone', time_avg=True)
-#diag.add_field('socrates', 'soc_coszen', time_avg=True)
-#diag.add_field('socrates', 'soc_spectral_olr', time_avg=True)
exp.diag_table = diag
exp.inputfiles = inputfiles
@@ -230,9 +225,12 @@
if __name__=="__main__":
cb.compile(debug=False)
+ #Set up the experiment object, with the first argument being the experiment name.
+ #This will be the name of the folder that the data will appear in.
- overwrite=True
+ overwrite=False
+
+ exp.run(1, use_restart=False, num_cores=NCORES, overwrite_data=overwrite)
- exp.run(1, use_restart=False, num_cores=NCORES, overwrite_data=overwrite)#, run_idb=True)
for i in range(2,121):
exp.run(i, num_cores=NCORES, overwrite_data=overwrite)
From bf2f1bc58da2d2f85e09b1a3ba4c864f3ed6af07 Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Fri, 22 Jan 2021 08:55:55 +0000
Subject: [PATCH 177/304] Update comments
---
.../socrates_aquaplanet_amip_with_topo.py | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/exp/test_cases/socrates_test/socrates_aquaplanet_amip_with_topo.py b/exp/test_cases/socrates_test/socrates_aquaplanet_amip_with_topo.py
index 1ea709e0e..0b2c22fad 100644
--- a/exp/test_cases/socrates_test/socrates_aquaplanet_amip_with_topo.py
+++ b/exp/test_cases/socrates_test/socrates_aquaplanet_amip_with_topo.py
@@ -27,9 +27,10 @@
exp.clear_rundir()
inputfiles = [os.path.join(GFDL_BASE,'input/rrtm_input_files/ozone_1990.nc'),
- os.path.join(GFDL_BASE,'exp/test_cases/realistic_continents/input/sst_clim_amip.nc'),
- os.path.join(GFDL_BASE,'exp/test_cases/realistic_continents/input/siconc_clim_amip.nc'),
- os.path.join(GFDL_BASE,'input/land_masks/era_land_t42.nc')]
+ os.path.join(GFDL_BASE,'input/land_masks/era_land_t42.nc')
+ os.path.join(GFDL_BASE,'exp/test_cases/realistic_continents/input/sst_clim_amip.nc'),
+ os.path.join(GFDL_BASE,'exp/test_cases/realistic_continents/input/siconc_clim_amip.nc'),
+ ]
#Tell model how to write diagnostics
diag = DiagTable()
@@ -45,8 +46,8 @@
diag.add_field('atmosphere', 'precipitation', time_avg=True)
diag.add_field('atmosphere', 'rh', time_avg=True)
diag.add_field('mixed_layer', 't_surf', time_avg=True)
-diag.add_field('mixed_layer', 'flux_t', time_avg=True) #LH
-diag.add_field('mixed_layer', 'flux_lhe', time_avg=True) #SH
+diag.add_field('mixed_layer', 'flux_t', time_avg=True) #SH
+diag.add_field('mixed_layer', 'flux_lhe', time_avg=True) #LH
diag.add_field('dynamics', 'sphum', time_avg=True)
diag.add_field('dynamics', 'ucomp', time_avg=True)
diag.add_field('dynamics', 'vcomp', time_avg=True)
From cbdce6d159b31a5a95369a6cfc1ae37e9088f107 Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Fri, 22 Jan 2021 08:56:13 +0000
Subject: [PATCH 178/304] Update comments
---
.../socrates_test/socrates_aquaplanet_with_cloud.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
index 4a098757d..95f08dc15 100644
--- a/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
+++ b/exp/test_cases/socrates_test/socrates_aquaplanet_with_cloud.py
@@ -42,8 +42,8 @@
diag.add_field('atmosphere', 'precipitation', time_avg=True)
diag.add_field('atmosphere', 'rh', time_avg=True)
diag.add_field('mixed_layer', 't_surf', time_avg=True)
-diag.add_field('mixed_layer', 'flux_t', time_avg=True) #LH
-diag.add_field('mixed_layer', 'flux_lhe', time_avg=True) #SH
+diag.add_field('mixed_layer', 'flux_t', time_avg=True) #SH
+diag.add_field('mixed_layer', 'flux_lhe', time_avg=True) #LH
diag.add_field('dynamics', 'sphum', time_avg=True)
diag.add_field('dynamics', 'ucomp', time_avg=True)
diag.add_field('dynamics', 'vcomp', time_avg=True)
From 2c103aee0675bd2fe52fa82551632cfd0fa2d6a3 Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Fri, 22 Jan 2021 08:56:46 +0000
Subject: [PATCH 179/304] Add overwrite option
---
.../scripts/run_plevel_cloud_tests.py | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/postprocessing/plevel_interpolation/scripts/run_plevel_cloud_tests.py b/postprocessing/plevel_interpolation/scripts/run_plevel_cloud_tests.py
index 949e6eb75..29f45da06 100644
--- a/postprocessing/plevel_interpolation/scripts/run_plevel_cloud_tests.py
+++ b/postprocessing/plevel_interpolation/scripts/run_plevel_cloud_tests.py
@@ -8,10 +8,10 @@
start_time=time.time()
base_dir='/scratch/pm366/OutputIsca/validate_clouds_soc'
-exp_name_list = ['soc_test_aquaplanet_without_clouds']
+exp_name_list = ['soc_test_aquaplanet_amip_ssts_land_low_albedo_gibbs_fix']
avg_or_daily_list=['monthly']
start_file=1
-end_file=120
+end_file=60
nfiles=(end_file-start_file)+1
do_extra_averaging=False #If true, then 6hourly data is averaged into daily data using cdo
@@ -62,6 +62,7 @@
var_names['6hourly']='ucomp vcomp temp'
file_suffix='_bl'
+overwrite_data = True
for exp_name in exp_name_list:
for n in range(nfiles):
@@ -80,7 +81,7 @@
nc_file_in = base_dir+'/'+exp_name+'/run'+number_prefix+str(n+start_file)+'/atmos_'+avg_or_daily+'.nc'
nc_file_out = out_dir+'/'+exp_name+'/run'+number_prefix+str(n+start_file)+'/atmos_'+avg_or_daily+file_suffix+'.nc'
- if not os.path.isfile(nc_file_out):
+ if (not os.path.isfile(nc_file_out)) or overwrite_data:
plevel_call(nc_file_in,nc_file_out, var_names = var_names[avg_or_daily], p_levels = plevs[avg_or_daily], mask_below_surface_option=mask_below_surface_set)
if do_extra_averaging and avg_or_daily=='6hourly':
nc_file_out_daily = base_dir+'/'+exp_name+'/run'+str(n+start_file)+'/atmos_daily'+file_suffix+'.nc'
@@ -95,7 +96,6 @@
if group_months_into_one_file:
avg_or_daily_list_together=['daily']
-
for exp_name in exp_name_list:
for avg_or_daily in avg_or_daily_list_together:
nc_file_string=''
From e25872a04179177dd707fabe95c7d4b5f0ac68af Mon Sep 17 00:00:00 2001
From: Penelope Maher
Date: Fri, 22 Jan 2021 08:57:33 +0000
Subject: [PATCH 180/304] Ruth and Gregss smoothed topography
---
.../input/era-spectral7_T42_64x128.out.nc | Bin 0 -> 66524 bytes
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 exp/test_cases/realistic_continents/input/era-spectral7_T42_64x128.out.nc
diff --git a/exp/test_cases/realistic_continents/input/era-spectral7_T42_64x128.out.nc b/exp/test_cases/realistic_continents/input/era-spectral7_T42_64x128.out.nc
new file mode 100644
index 0000000000000000000000000000000000000000..a85274e620edc22c0b761c8e31fe7e28d97ec55a
GIT binary patch
literal 66524
zcmaI-c{o+y7dVbzvoa@CREmtrkePdiJs@++kRcjWG?${;7(y8$5*ZQ=A}NY{_PHu4
znkRXsq*3!+O7*?(&-eFvp5OEPbqK
z>VG_Po7Znxw?u+S+W(0EYyUsIi4u~`|9D5OSg>kwmrDkc_Wy@Jf3j2uVXC5ceGW-qK-G>+SM1ud3t5y4f!v{
z9&hu-dT!4AWBNRw_C=jEl`N+vz({aLLSrS@SP2g+;bkRrSjk*gB7>F4VkI(xL^hD<
z01{n5q7z7T1BnelVhfPi1SGZriH$&FE0EX>B(?*I4?yAzkoW{7z5$7kK;kQq_zWbz
z|1Us{tpu6{0#-o+5}aKifpiI!B?{R8(XUAQCzAe0q5w#Ez!*jVCQ5JCs
zCF4NJSTYx^kc{Ic|Y
zA%JRY1W;ld)KV8fodE%y&?tZsJE6Y602=5E;IxkdXu=Did9DD?h!Q|+D*=?)5AAOV
zpi_kax~>sGi7ybS3m_U0K=(!g^h^{$AAbS#*B8Kmj{+$15r*UnU|5s@&bJakiNA2s
z4FOzIA%HP!1aJi-fUDI7aP5Eq#x)9{Bo1)1zW{F27r-4K1yB+bnA|0Rsa67*RxE&$
z_`r;10+@M20J9tgP!cP+TTuY_tP#N6UICQE4Hnc1V4=DI79|LvB!;lWLjd90G_lG
zz@}mWo;vFwHaIc^PgAhOMhjE1@i}E|s(cKa&GW$K<=uGt!>M?NI*l!z$78FIdTbs0
z58JGnfM+gM$F{zIu${3iwtGJp+aH>S9o*ZoL+>)|7?_S7xfJX)<~DW;5MZY*71(J{
zD0a$zj-BF0VJB399sd?%$I5ruaYi$CsL{X70aYt$1+hJSjKY`mZAG3
za1+bS^2ah^VOVCvC@fQ$fo0mKV3}7gSay6Qmi4p8vYA;}w#x_0Deb~?bJk+H3JLx>
z4atZ}&%k9l+-YySO=wM>1mc7!d~DS3>?Jz9?^n8{;Z$vWuWV(_Ht
zy?FAjV5~n>g|+t(JYifop15xuo-)cF8?JD|#-e-J?Dt1J!!QwB+wH@)7XH{_)D`S>
zc{+BDDZ|u|H)h?|V7S8@<9r+JzAX#SqHkf(`^DHBredGu+1NL~8~d%liv0~~>|d>e
z{XYca*@{Zo|7|GtFWrp&$8y*&xCr|$%ELa6i?P?;m)O%)6MHO|#%>GWVPt5G*@lUj
zmJP?QhB??teJ8fN?1ydq9q^39gV^l)Vr1n%SD^Ejqmf8C9<}80sOi!{bfOuf
zV_`I^6U|45drza9x-wKV?KY}$D?~MaZ=+f!7S;V;ijGa1gX)ViP@{hqI_0S`(g(nf2P=UlB=)S6DM6ie
zPUy1hMAQ=~hpvB2KzBxcL%pRIsQ&;$Ph}^gS6%h!{bL*S%{3qWzMF@o{3Q3?C3CFk
zorabA#8_?RLaZt9#_DYgv3B_etmheur?mNFqxV0s`7?QJRq_MdskdM!k8mtxK4RvV
z4@PlQuzUSq>{*+QeWEU5zdm~$pfv^0)jW;^d#~Z(WkxvUVm+Ss%>#%2^2K5Im2r4>
zG>#a*6Gv?6#}N(IIHLX!j#&E|hkuR2;g-{InBE|scQzA;Nay3g@56Y`J~izBY%=zF
z{2hB{FT`%I+c5Z@j493vJ6li3cC&wAtBJd@S?)7zcqAQ9TH=OvF7;vcn@M<7W*n9p
zrqS214)kpG7IbHBGrHh#6E)BBL5JFfsPIAwN-x}j;<#@pyzD-5*NQ;4OO%kI_yii~
znTpiLd_|)s_9FR6V{bWK^P+k17oAp~FirqhtJO)TkMPPI+!ar-S3r8JiX8bl+*z95jGVHlIN!
zMvX&9R@b0IqiIwwScLX%pM`QyJx7_hMJPq18f^mYXk~03S~&a(g}Q%3b1D}gKesc;
zC$<&&T5m_cg>;b?bF3o5?hi>fb|qK4IJsO=zyy6hFu
zU5(FZa7-HdFg_HGj6Q^Am)yjo4{yTSNl)>l%VyYUQxvwyJceifScsi2+GA??CWhrk
z*uAX=dxc7#)5H&WwsjYtv+^hooLP*6k}u)l@D?0=3E<#s5=f1}!P4zGXz3;#cxwa)
zF5Zd*?PuV?dF?pxZY~b0-im`8KjM&qhd5OA0}j*VaoA-VhpXPkVLjV$=+{O(FSP&%
zC*Q<#|2X3SIf>2_0DCFOV)qH@7`(lVsm+Dh>FjT8TY3sxs_0;oUpw&B+2^pXYz)>M
zJqnLrP>!X>+(YjpAbL=~99@|41D#mJq2e+Jlmf?~i0vzp{l|W!xqkl!JsmRikH4X%QL2M@r)HP-(@#!S@0MRlukzS@psY0Mp8v>YBVvV%2mf?%t>8@#nN6@Ha`r>JfJicBn@A!K_QEpk|kl9$tH
z?;I&qJ5C9m+x!JxbL7yV@;vmdu?)+uU4>Peda>qI9X!#}92;5M;~A=Vuqd)?8Sb%A8GZ21uEt8y26KA();8(lEk){j|tGc5eP9y^DaVtbEA*t#GMPgfG)
zX}jw1#Npjo%ew?Cr8i*#N1@k7(&*-@$EfAb22?h56Q%msqu{7r$TZL!{=?ny%&K{C
z-Rnx@N*s*dba;pQHvwH<{TOdG=>fXqN5H#+9EK+#n1>aT7hu!6t
z@Mvic%&PeUBX7-w)|4t#`MDN+TsZ)qHg5z!n{wc|wms0jq6?f6mqfzC9P*rvFc0I(Bq4`9Ot5e8!OT9sCKMq;eei$%A&8^E@SEC5AZ0*tyuM_
z9v<`JB-XZ)!Q=XlU|n`Io_OXu*543|4GM~|(Qh?uw#*h=to@EH_ord2CBL!dW>Y-9
zeit^GdP{PijKjKj_hGHNn^;}4ZYrXWSS5M`RvR3JwUl+SUgUpxn&x6W!(j;9KeodZ
zm5pK7HSF#>4SQ6nVh{yqD9kj!+-K-1P=G{ze
z+1P~5=Op84N3P;Y<#VvM^%$%iXOE>aKA<2G}YY>
ze)ww$YZo-Z5T!3**l813d1fBFC-EX5zVMe=sUnj+v7f;%I_(ZL_f7>#S*oDJ#SqHn
zPk|QKi{U({YM2tC1NVpbz{U!Bcu_Y5-g_7ZpIhyRAH*Z@dsQ_2h0NgZ1pxlKZw7~V
zw8Eci#qfvJZ1_D_AAT3d!yoYv;LmhNIDB3Je+w4E5oKdIQoIO`m@R?7#@vJ7;`8CV
zb&l`}Js#dzw;Hxh`vR*pO5x6QDLA)m8=UlL9(a7@5GYdh0Nxkh1Cve}fDWjGyfur!
zU^@rR51xPt`Y++J^Y7sE34us+SQk0njYW%+?xGCY3UpA*5}mQ{K|NL7Xi3m~v^_u-
zWm;RKJY`c1m5M=~9ge8I@CIrvwMA{;2T^C$40M0PZ1h&L
zM@VgU#>yTH*2>hxdOJ2?{ayn+we~5V8d8Y$vz+k6Z#%Fq^AC^vcmnJArDE-vW~{9q
ziM3v2Vy(DScr3jaYxEz(stOfYv0^8dYW|2mKZ`>HHX_vh)C8T`W`HU-L9`2*g8{a%@^umnF*^@sLX5z!Wi4#~xjZJYbgftp{}j7gRfwmb-6NJ(T*z1d
z)gr^*U5wn#_pBgi8oM(@#JI4;Kr5L;PIm@@Z47h464ll
zz2(86XQLhv&&~$tmiz%{uk8aoRRFG9SAoYX7l3cv52$c&H`IRn2AX_a3#r@t;k+sH
zVf<2WnDzW5EZtrO>wLDuhJWU;u}TgeF;Ipj6~-`S!xBr
z?2(tBJB*!}3Dcg8g#}wJVOc;ptPawIhqW@`;hSNwHa!v^eI5v#$6CWq-&**LsY41C
z-N<0p8U$A#M$vi|DA_6k?cQdJ3irpOqNUm>_vUSs_Dd73(YcG}v}7RHh74pm*oUk<
zdJ(l!ghIA!pv~81QEu3IR7H-WrlLB;Wz0kuf6qjhmBpxQ#S?VVA`0=@g{ZB=9<|)e
zK&KZ~qUQQgbUOMMI&(V`wY*c7oY|kDX34#J;^i?^bL$x@8Sp?^m-|q{=f`MXO&fC2
z{DdY=%0x0|o8g_ZJ+M~yI^3$*31_zK1n(CA1KFwXfs&}6Wmit+wB*D1e48hH);4cm
zPdthwpM69s47c-vx%K@0FD+tI{8~JJdbD`^>wIzYp(ycMA0qa+n=jTDUgmpN@8L5C
zqWBfY`Fv6E9{ve&7f*5Q75mIG5=VdT5l6W|vE#eP{M)U|`0>l9GFn>&42ia26=-+X
zykix+O1GbFzw`x6Y#$4D%!~!R-9jiAvJjdr@rAQw_rowheHbyT2l`4)hnA0(q2icf
za4umw2>Ls~HYH}z844X@<8)tftY}EQd~u98$i+j9wnvNYPu>*kJetYp&;$99D1UWvYDmxD$c=
zer^`;GUCNlZ);}HZC3&FgBF1s-4~##R~X!I%L-Ptu7;fvBKUalCVZXO4xa_d!E4#;
zVf~kHFthm*oU^4InhpfP$-oWToi2hgf(Te_(G2?K%gf*4d6mZMcHu#vDg7$p?_^>#;~Na|%+vy$Y#yxgfQT;b?Sf7ZT)m
z!e`|+uw(mTSYF%!1@5jedlW?s4t#be7=NyYf%E#ok9<7B
zc;aLxDyNhgtKvrj)@|UM4!;na-O?4$m+}<5AG76C&uwDax9@@SPyvXiLqUDZ25?KN
z0}MFs2X_rZz^Pg}kTSRyOz~OI<__LvtUP`ABDHA#gx?`vWt|HB7dtVUlUuKeZO=6~d$9aj|#f**?&
zwKBw`BKM1B>MHq<6N>r!mFfJ=g%_DgcBJd#XG8kN|0v_E;2G{b(g68rnQ1oyq*mTbug#A4O!e2Uq
zEg${CK5GkbQdbv<@0S4ai<96)5eBEui*5C9QnYI-7yZNeUBeM=6Na~uw*H}V`&$^
zRjZD7S-P3*Z-}LJGMCXWeu)@)2YdS3`%2pX`gKb2%SSHgU_9q-peh_FN}$cd2k9o~
zCPsE>DWjXK#i*+5(Jf=YP={`PB-7(LlK+z-v1ZEL=ultUVjzYN3G?J+!}56rx`9ve
zYvpsa97x@WB166@vpZkRVqZn>0~4RB06V)BF!O^L=$Z)G=l;5ER*N|^@?wO(tviXN
zS0YlB*vT2?-J~h=@ARf*J9^qTFKUzSLdwgakT#rx>ElV>^ye@Y`lGu#o&7qDYx8-`
zt0k}C)8ZB~9_w3~ZArhFymJSc!kb^1jCbA4;@U?H80coa5<{7k7adGP%v$E!QfKDk
z$Ob0;?P%I7rHYU2e#ZZJwNz~L;+{Bgl8rbjD^na2{Z9Ziy>eSBduo%8FNQxh7`Uq>ByXwZyu&+r(3T
zrisnAM2d|EmBkvLL;2flH}i{q5=rR1GJ0Xd2+i+5LD$Fcr8j#Vrd{k0(vvJEQMae=
z5h<*GOLUGjlK6dx$@URD5J|rsebO^?AIT#wtE&=L>#8
z+j@TXT%I@hPoE675pq1>A8FnsP5x^NBR{S$CciFrkRNOGcv*Tqua{-Yv!+w|m<$;{
z<;n#+gF*c991cCd4+n^|VscvgEBU@nboVM1!-Xl~CmS}}KWdt3D-;y*=(mzCYchvNZ0Yg{y+
zHBXL@%;tEdF<~TnxXN{TOaMK~qk|5vxkDF-4$;?#3mMHoWj>|)FQ2-02A^1RkB{px
zmq0Y1(WS=MdCq*W~d3-GjV1lJI!~#2ZQlaW@Qu=@??NULS~i9R`vBD+oqc$wX6_{oR=kY5Woan~Fj>Bk3`GjS(xGlwU7Fei@5GkGJO
zjJ3lcJxMo+9C+!+EB|!o<>iw}R&^P5PU9l|+OU9OWBxMhCXZ!y(D#@{HWADe+xPTd
zt2)t}S=}W1#Y~cP`4TZ0yvA)gRmWv3))Uvq(PYo9GsI74JGH;GpYEP-$*7&~Vx%Ui
z(DiSk>4+pTZT{s4HFAZb%pX4&t^Wk5QRNG0W5?t4wiOJ`e3BAYN>fDT+ha0Ue2mQP
zyh^~L%^kC)_^G&wuwHpFHrBPoGKi
zsnfsk$xd0^XTbt;a7_TYe_V%Ld0$16>rA*kw}jL_9U=AEbSY)OER86A%OpJq^ZA+Q
zCh(ia2l0DU3;3N+`*@_3M~>wMQ`Lhhbk!R%U1qV3dSaEp4SOvmyMAmSO%FZE+q5~n
zWz0!F;mbk3So0lUdhIQry7C!s^O?v1ftv&RykO5jdYBu)*Z6j5GR+77F
zk4fKzVAAy_i<}rEBDszW
z@!K(8!&SsXT83YZXG_jz{(Qdv3qC73m5*;q4&i)#Y^dy`YpI%CR`_z8t*c`AyS8~N
zM!4A8iNsRnH;GwkMU<3es0s8I>dTee!ds5piJZJ2(bxX%vih))c6~lb12utb%E?>A
zV91B4eE!GX>7Pw{lkV}!sTcT&no8z!w=dh@wH}0NegcIa^Fi_9dtgOM0FaZ~!Mf~z
zPv>O~6ZaVhM8B_ICd%d;$fcqMP<}0y
z(cHjk@w>U6(tq5+EL&lr<^gJW7NB**eW>L2bXq1clxAkD(!P^y=?TBhsKe6kR1{I8
z?nFJOL*%~GjY?|tH@9(&&ZG)P-(oi-Ti-~pm^PJoce(J>nkVyXJfrvxwa)qP$*
zL6P*ko+7U@y~xe1d&Is&mR46Tq>mmep!cpzrjEb*Lv%jeCMRbs=Vg`d@}?aRdE6)D
z12vcPbLuefY-Gkq-kn^u(B&;If8@9KCh(;jAM(|``}yK||M)F;Pw_7Q
zqj^xh`jov%Bu&M@}|4@^M)=V(-V#ie4B7qXfpM7NRMHpfWg9(}UESMsa!?I+Z%DLRyCb{vs?lTY@0
zd6UMV0kZe)SW>V@K>pjF!|R+MLq>+bigugZ(0!FWJ?Y~H-Xi8AC*#w=9vx#2(iLpM
z$Uqr1?P`b9rG-%XwkycGwSuj(?BO-{JmZ&zT%oru|I7$(ofUPSSV4+=9Yl*xInuQ;
zKj^}*bs~$y)+A~052?01Kq}Y#M{3m~NlC5-vANsh(w*5#eeM22D|Eh~$oAdTQM8tq
z-X2S8mGj9C+(>HQrtyM|DZF{}Dc(H%f4TugaHSru|MOf&YVwl
zx^^wy8@ZSsDAl1WwlvY>`*Va7-`wK9>pmijLXMH(ob93~-I{ccjXR@BCo#@BJTq>M
z6zvKvMIUuLnb@jNZ0vVM_I+V3&`0LdQC)Q3lvXLLXlqMtw_6Y^QlvBZ%`>QEamjjNYu1Eoik{1qI}Z+(sHW@DA9ysVfpq&
z!mlGe)FwMDI%hUWY(AxsxzE3H*^NWgnH8DTuU8rr?RA06Jr_yb!w!+47u{6&^)UKk
z)g@t(S`xqC&Vcup0N0
zI^})Lv|nerkAfKTuSS8$uDU}?+}#>1I^*kq;c{dqy%=uOK;&
z;Uqe?f)tI_A|sQWdDCqxcr)eu?Nxa_+(2g`3Cv$cR-PurOl7htZI&x-+OAAzpRS@4
z6vL@j;|pX$nKT)`mC6Te+~(s7*78%Y)N<=>lIR0rcC>$vm>WuaPu8x^;I1`P2_J|l
z;dpRERF*JJnC|wDv)ufclq~$rtC^YcWBG;Tj&e2GeM5^ZIWv~X>qQF7R;W|e85=}x
zYYr0kx_{*OroW`WQjR=5xsL1`ZOe^a`kVSGx<#e+Yj8Ub*>W8xHgeC_OZ@scigYxJ
zs09OinMwy8)?B=d4KlJ~EsXS-+>_em?64j$ot(-FRASiQ_d3D0;v&$bvJ|w&Ed{%J
z)xfBvl}vAS3ZE3@#(VuV<-SE^auEYx$*H+$qpUbnk#)Td_D>PgDl&V1|Nt8|%
z$*?fuPS`Y1ZY{=?)ZdewQJfQZiCA!D21jXYeRalS*G48|uN5=rowM0PXWq4`$SnQ;e%4O`3zgm=l-6%WXG
zv!}$+aV;s`FhY*JnMY{72JYbtp3EKJOZN1BA@&Qdav>QLxUTVTBvgXmi?j<2_~ve1ac-f*c5LMTK-)bpFGBZ
zdFUYvh0oI&hU*}ocP=HY
zie;n5kSilwLH1oo7}ci&FYS8@KUojL>l2*dh9oO+V)uSl&e4j`&{{@+ThvXrC4J!4
z<&W~CH>_|yBJD)I`XVOgmF?v4sZS)~LIW`qT9Ym6mq}f3ABp&x*|z85R!aKF74CD|
zQz9tvran$%>8$Bj$OC+ZSJ|FG97oAgUk>(@wCEdrf}en|`S6iHy!j=6d#Qm~mt)12
zoAvp@?NOX=P8k#bbS$G(7)H9BgZN1uNrZl5Mp>P)C5k`ylR15-xIi@@ZcCaa*-1Sk
zE3TAMCw6b9Q}SA9m0P>0cq)Q6eB((^`(wy4x;KdZhc@oYL|ZQJ$T|}4w}z|~%@ke;
z-A;SojHML1youHLYuv$a}-<(jlu)q;L)$ZIVzd85iRDgVmp5JwHh{}G#3~oD1iK!F`z@q0q|C0?j=4HzBMhTdQ0;H@)FXw)GC_~WW0
zEEXAq_a$H0E0IGCAG4gP|CmAzwhr-nD@GBi`Go2}=sxI2+XRyVlBi^oaFPdjobZ7UIaTat1zk@WAgB)e*|xr%=(+`shk
z1iB@0dzQRxzd2w?Caj)J=3e^9{nffo%63jBU$3rZtfw4hV}>-?Yqu`2H(Ix|F&+wZ
z-Rg;ajMp;y-kH1X3X4*pWmW+S<5j^obPMV|dIPnl^n&vbN`V>}%S%zs;t3`4e8`$b
z%-}==_QG2O;OyK8mMMh+r1z73Xg`+K^vs|)zp^9#qn42r880$xN)KngZn>yIGn1%u
z95>`)OF67sB1{OIK{V3DT>eK}s!t^AnyaWmoNM|xwRs8jc<~|bfYA+dFfW@sKK}~U
z^VyAf=e;0>&4^C=cZq(xnIkcqf_U}zakST^a7L=ulvf&kp7-ScG2@nBCKpa`6EC|H
z!(JSrAiZ)Me6oo`lj3{P*lr)#zI_YSz1a<%Pn=?#0}imBr6#1QZw`O(ww=qtt8Vnp
z$$sRz;sMhChvSmxe;4_hCAaOaIo9#mdbXiNpRLc^&$_YSnfc#qIFM~Z
z48NF=si9xFziJhtTZSxWe`U91Z}KCS_sv~9)=RnWn&M8(l`axZ=`A9`xoYlfrX1OB
zX3WXeIZ#6z?hsQS0Z9$~Mo$(3{64lj5!Byf-R^N({E-^p?c)MaY?>=NJY96J^4f=HE2}8Pg>Z|%iW5jQOR-YlJh0f
zXFrJ~hHs_5o|(qc8&$aH{^qo|?it}*39s|zAzC}{GoAl_lvp)#y8B9A9
z4M&RnkyY&zME575$&+PayG{?3HI-v!IAgJ;DNp=