<p><b>laura@ucar.edu</b> 2011-10-17 14:17:32 -0600 (Mon, 17 Oct 2011)</p><p>defined and implemented alarms to update surface boundary conditions and run physics parameterizations<br>
</p><hr noshade><pre><font color="gray">Modified: branches/atmos_physics/src/core_physics/module_physics_manager.F
===================================================================
--- branches/atmos_physics/src/core_physics/module_physics_manager.F        2011-10-17 20:15:27 UTC (rev 1101)
+++ branches/atmos_physics/src/core_physics/module_physics_manager.F        2011-10-17 20:17:32 UTC (rev 1102)
@@ -18,7 +18,6 @@
real(kind=RKIND), public:: curr_julday !Current Julian day (= 0.0 at 0Z on January 1st).
real(kind=RKIND), public:: gmt !Greenwich mean time hour of model start (hr)
- logical, public:: l_physics
integer, private:: i,k,j,n
!defines alarms for calling the long- and short-wave radiation codes, for calling the convec-
@@ -26,10 +25,19 @@
integer, parameter:: radtlwAlarmID = 11
integer, parameter:: radtswAlarmID = 12
integer, parameter:: convAlarmID = 13
+ integer, parameter:: pblAlarmID = 14
-!defines alarms to update the surface boundary conditions:
- integer, parameter:: sfcbdyAlarmID = 14
+!defines alarm to update the surface boundary conditions:
+ integer, parameter:: sfcbdyAlarmID = 15
+!defines alarm to update the background surface albedo and the greeness fraction:
+ integer, parameter:: greenAlarmID = 16
+
+!defines alarm to update the ozone path length,the trace gas path length,the total emissivity,
+!and the total absorptivity in the "CAM" long-wave radiation codes. The default time interval
+!between updates is 6 hours and is set with config_camrad_abs_update (00:30:00).
+ integer, parameter:: camAlarmID = 17
+
integer :: h, m, s, s_n, s_d, DoY, yr
real(kind=RKIND) :: utc_h
@@ -87,8 +95,11 @@
!update the background surface albedo and greeness of vegetation: interpolation of input
!monthly values to current day:
- write(0,*) '--- update background surface albedo, greeness fraction:', timeStamp
- call physics_update_surface(timeStamp,block%mesh,block%sfc_input)
+ if(MPAS_isAlarmRinging(clock,greenAlarmID,ierr=ierr)) then
+ call MPAS_resetClockAlarm(clock,greenAlarmID,ierr=ierr)
+ write(0,*) '--- update background surface albedo, greeness fraction:', timeStamp
+ call physics_update_surface(timeStamp,block%mesh,block%sfc_input)
+ endif
!update surface boundary conditions with input sea-surface temperatures and fractional
!sea-ice coverage:
@@ -110,24 +121,52 @@
block => block % next
end do
- xtime_m = xtime_s/60.
+!check to see if it is time to run the longwave and shortwave radiation codes:
+ if(trim(config_radt_lw_scheme) /= "off") then
+ l_radtlw = .false.
- l_physics = .false.
- l_radtlw = .false.
- l_radtsw = .false.
-
- if(mod(itimestep-1,config_n_physics) == 0) l_physics = .true.
+ if(config_radtlw_interval /= "none") then
+ if(MPAS_isAlarmRinging(clock,radtlwAlarmID,ierr=ierr)) then
+ call MPAS_resetClockAlarm(clock,radtlwAlarmID,ierr=ierr)
+ l_radtlw = .true.
+ endif
+ elseif(config_radtlw_interval == "none") then
+ l_radtlw = .true.
+ endif
+ write(0,*)
+ write(0,*) '--- time to run the LW radiation scheme L_RADLW =',l_radtlw
+ endif
- if(config_radt_lw_scheme .ne. 'off' .and. mod(itimestep-1,config_n_radt_lw) == 0) &
- l_radtlw = .true.
- if(config_radt_sw_scheme .ne. 'off' .and. mod(itimestep-1,config_n_radt_sw) == 0) &
- l_radtsw = .true.
+ if(trim(config_radt_sw_scheme) /= "off") then
+ l_radtsw = .false.
-!write(0,101) xtime_m,l_physics,l_radtlw,l_radtsw
-!write(0,*) xtime_m,l_physics,l_radtlw,l_radtsw
+ if(config_radtsw_interval /= "none") then
+ if(MPAS_isAlarmRinging(clock,radtswAlarmID,ierr=ierr)) then
+ call MPAS_resetClockAlarm(clock,radtswAlarmID,ierr=ierr)
+ l_radtsw = .true.
+ endif
+ elseif(config_radtsw_interval == "none") then
+ l_radtsw = .true.
+ endif
+ write(0,*) '--- time to run the SW radiation scheme L_RADSW =',l_radtsw
+ endif
+
+!check to see if it is time to update the ozone trace gas path lengths,the total emissivity,
+!and the total absorptivity in the "CAM" long-wave radiation codes.
+ if(trim(config_radt_lw_scheme) .eq. "cam_lw" .or. &
+ trim(config_radt_sw_scheme) .eq. "cam_sw" ) then
+
+ doabsems = .false.
+ if(MPAS_isAlarmRinging(clock,camAlarmID,ierr=ierr)) then
+ call MPAS_resetClockAlarm(clock,camAlarmID,ierr=ierr)
+ doabsems = .true.
+ endif
+ write(0,*) '--- update CAM absorptivity and emissivity arrays DOABSEMS =',doabsems
+
+ endif
!formats:
- 101 format(i4,3x,f13.7,3x,'l_physics = ',l1,3x,'l_radtlw = ',l1,3x,'l_radtsw = ',l1)
+ 101 format(3x,'l_radtlw = ',l1,3x,'l_radtsw = ',l1)
end subroutine physics_timetracker
@@ -150,12 +189,27 @@
write(0,*) '--- enter subroutine physics_run_init:'
!initialization of gmt, julian day, and alarms:
- 100 format(' YEAR =', i5 ,/, &
+ 101 format(' YEAR =', i5 ,/, &
' JULDAY =', i5 ,/, &
' GMT =', f16.9,/, &
' UTC_H =', f16.9,/, &
' CURR_JULDAY =', f16.9,/)
+ 102 format(' DT_RADTLW =', f16.9,/, &
+ ' DT_RADTSW =', f16.9,/, &
+ ' DT_CU =', f16.9,/, &
+ ' DT_PBL =', f16.9,/)
+
+ 103 format(' IMS =', i4,3x,'IME =', i8,/, &
+ ' JMS =', i4,3x,'JME =', i8,/, &
+ ' KMS =', i4,3x,'KME =', i8,//, &
+ ' IDS =', i4,3x,'IDE =', i8,/, &
+ ' JDS =', i4,3x,'JDE =', i8,/, &
+ ' KDS =', i4,3x,'KDE =', i8,//, &
+ ' ITS =', i4,3x,'ITE =', i8,/, &
+ ' JTS =', i4,3x,'JTE =', i8,/, &
+ ' KTS =', i4,3x,'KTE =', i8)
+
startTime = MPAS_getClockTime(clock, MPAS_START_TIME, ierr)
call MPAS_getTime(curr_time=startTime,YYYY=yr,H=h,M=m,S=s,S_n=s_n,S_d=s_d,DoY=DoY,ierr=ierr)
utc_h = real(h) + real(m) / 60.0 + real(s + s_n / s_d) / 3600.0
@@ -163,15 +217,28 @@
gmt = utc_h
julday = DoY
curr_julday = real(julday-1)
- write(0,100) year,julday,gmt,utc_h,curr_julday
+ write(0,101) year,julday,gmt,utc_h,curr_julday
-!set alarms for calling the longwave radiation, shortwave radiation, and convection schemes:
+!set alarms for calling the longwave and shortwave radiation schemes, the convection schemes,
+!and the PBL schemes at intervals different (greater) than the dynamical time-step:
+
if(trim(config_radtlw_interval) /= "none") then
call MPAS_setTimeInterval(alarmTimeStep,timeString=config_radtlw_interval,ierr=ierr)
alarmStartTime = startTime
call MPAS_addClockAlarm(clock,radtlwAlarmID,alarmStartTime,alarmTimeStep,ierr=ierr)
if(ierr /= 0) &
- call physics_error_fatal('subroutine physics_init: error creating alarm radtlw')
+ call physics_error_fatal('subroutine physics_run_init: error creating radtlwAlarmID')
+
+ call MPAS_getTimeInterval(interval=alarmTimeStep,dt=dt_radtlw,ierr=ierr)
+ if(ierr /= 0) &
+ call physics_error_fatal('subroutine physics_run_init: error defining dt_radtlw')
+
+ elseif(trim(config_radtlw_interval) == "none") then
+ dt_radtlw = config_dt
+
+ else
+ call physics_error_fatal('subroutine physics_run_init: dt_radtlw is not defined')
+
endif
if(trim(config_radtsw_interval) /= "none") then
@@ -179,7 +246,18 @@
alarmStartTime = startTime
call MPAS_addClockAlarm(clock,radtswAlarmID,alarmStartTime,alarmTimeStep,ierr=ierr)
if(ierr /= 0) &
- call physics_error_fatal('subroutine physics_init: error creating alarm radtsw')
+ call physics_error_fatal('subroutine physics_run_init: error creating alarm radtsw')
+
+ call MPAS_getTimeInterval(interval=alarmTimeStep,dt=dt_radtsw,ierr=ierr)
+ if(ierr /= 0) &
+ call physics_error_fatal('subroutine physics_run_init: error defining radtswAlarmID')
+
+ elseif(trim(config_radtsw_interval) == "none") then
+ dt_radtsw = config_dt
+
+ else
+ call physics_error_fatal('subroutine physics_run_init: dt_radtsw is not defined')
+
endif
if(trim(config_conv_interval) /= "none") then
@@ -187,11 +265,47 @@
alarmStartTime = startTime
call MPAS_addClockAlarm(clock,convAlarmID,alarmStartTime,alarmTimeStep,ierr=ierr)
if(ierr /= 0) &
- call physics_error_fatal('subroutine physics_init: error creating alarm conv')
- write(0,*) '--- end define alarm conv:'
+ call physics_error_fatal('subroutine physics_init: error creating convAlarmID')
+
+ call MPAS_getTimeInterval(interval=alarmTimeStep,dt=dt_cu,ierr=ierr)
+ if(ierr /= 0) &
+ call physics_error_fatal('subroutine physics_run_init: error defining dt_cu')
+
+ elseif(trim(config_conv_interval) == "none") then
+ dt_cu = config_dt
+
+ else
+ call physics_error_fatal('subroutine physics_run_init: dt_cu is not defined')
+
endif
-!set alarms for updating the surface boundary conditions:
+ if(trim(config_pbl_interval) /= "none") then
+ call MPAS_setTimeInterval(alarmTimeStep,timeString=config_pbl_interval,ierr=ierr)
+ alarmStartTime = startTime
+ call MPAS_addClockAlarm(clock,pblAlarmID,alarmStartTime,alarmTimeStep,ierr=ierr)
+ if(ierr /= 0) &
+ call physics_error_fatal('subroutine physics_init: error creating pblAlarmID')
+
+ call MPAS_getTimeInterval(interval=alarmTimeStep,dt=dt_pbl,ierr=ierr)
+ if(ierr /= 0) &
+ call physics_error_fatal('subroutine physics_run_init: error defining dt_pbl')
+
+ elseif(trim(config_conv_interval) == "none") then
+ dt_pbl = config_dt
+
+ else
+ call physics_error_fatal('subroutine physics_run_init: dt_pbl is not defined')
+
+ endif
+
+!set alarm for updating the background surface albedo and the greeness fraction:
+ call MPAS_setTimeInterval(alarmTimeStep,timeString=config_greeness_update,ierr=ierr)
+ alarmStartTime = startTime
+ call MPAS_addClockAlarm(clock,greenAlarmID,alarmStartTime,alarmTimeStep,ierr=ierr)
+ if(ierr /= 0) &
+ call physics_error_fatal('subroutine physics_init: error creating alarm greeness')
+
+!set alarm for updating the surface boundary conditions:
if(trim(config_sfc_update_interval) /= "none") then
call MPAS_setTimeInterval(alarmTimeStep,timeString=config_sfc_update_interval,ierr=ierr)
alarmStartTime = startTime
@@ -200,13 +314,24 @@
call physics_error_fatal('subroutine physics_init: error creating alarm sfcbdy')
endif
-!initialization of wrf dimensions:
+!set alarm to update the ozone path length, the trace gas path length, the total emissivity,
+!and the total absorptivity in the "CAM" long-wave radiation codes.
+ if(trim(config_radt_lw_scheme) .eq. "cam_lw" .or. &
+ trim(config_radt_sw_scheme) .eq. "cam_sw" ) then
+ call MPAS_setTimeInterval(alarmTimeStep,timeString=config_camrad_abs_update,ierr=ierr)
+ alarmStartTime = startTime
+ call MPAS_addClockAlarm(clock,camAlarmID,alarmStartTime,alarmTimeStep,ierr=ierr)
+ if(ierr /= 0) &
+ call physics_error_fatal('subroutine physics_init: error creating alarm CAM')
+ endif
-!ldf (10-10-201): changed initialization
- ims=1 ; ime = mesh % nCellsSolve
- jms=1 ; jme=1
- kms=1 ; kme = mesh % nVertLevels+1
+ write(0,102) dt_radtlw,dt_radtsw,dt_cu,dt_pbl
+!initialization of physics dimensions to mimic a rectangular grid:
+ ims=1 ; ime = mesh % nCellsSolve
+ jms=1 ; jme=1
+ kms=1 ; kme = mesh % nVertLevels+1
+
ids=ims ; ide=ime
jds=jms ; jde=jme
kds=kms ; kde=kme
@@ -215,39 +340,33 @@
jts=jms ; jte = jme
kts=kms ; kte = kme-1
- write(0,*) ' ims= ',ims,' ime=',ime
- write(0,*) ' jms= ',jms,' jme=',jme
- write(0,*) ' kms= ',kms,' kme=',kme
- write(0,*)
- write(0,*) ' ids= ',ids,' ide=',ide
- write(0,*) ' jds= ',jds,' jde=',jde
- write(0,*) ' kds= ',kds,' kde=',kde
- write(0,*)
- write(0,*) ' its= ',its,' ite=',ite
- write(0,*) ' jts= ',jts,' jte=',jte
- write(0,*) ' kts= ',kts,' kte=',kte
+ write(0,103) ims,ime,jms,jme,kms,kme, &
+ ids,ide,jds,jde,kds,kde, &
+ its,ite,jts,jte,kts,kte
!initialization:
num_months = mesh % nMonths
!initialization of physics time-steps:
dt_dyn = config_dt
- n_physics = config_n_physics
n_microp = config_n_microp
n_cu = config_n_conv
- n_pbl = config_n_pbl
- dt_physics = dt_dyn*n_physics
dt_microp = dt_dyn/n_microp !for now.
- dt_cu = dt_physics !for now.
- dt_pbl = dt_physics !for now.
-!longwave radiation scheme:
- radt_lw_scheme = trim(config_radt_lw_scheme)
+!write(0,*) 'mod =',mod(dt_dyn,dt_radtsw)
+!write(0,*) 'mod =',mod(dt_dyn,dt_microp)
+!stop
-!shortwave radiation scheme:
- radt_sw_scheme = trim(config_radt_sw_scheme)
- dt_radtsw = dt_dyn*config_n_radt_sw
+!cloud microphysics scheme:
+ microp_scheme = trim(config_microp_scheme)
+ conv_deep_scheme = trim(config_conv_deep_scheme)
+ conv_shallow_scheme = trim(config_conv_shallow_scheme)
+ sfclayer_scheme = trim(config_sfclayer_scheme)
+ pbl_scheme = trim(config_pbl_scheme)
+ radt_cld_scheme = trim(config_radt_cld_scheme)
+ radt_lw_scheme = trim(config_radt_lw_scheme)
+ radt_sw_scheme = trim(config_radt_sw_scheme)
!CAM radiation schemes:
if(trim(config_radt_lw_scheme) .eq. "cam_lw" .or. &
@@ -278,35 +397,6 @@
xice_threshold = 0.02
endif
-!allocation of all physics arrays:
-!call physics_allocate_all
-
-!initialization of variables and allocation of arrays related to microphysics:
-!if(config_microp_scheme .ne. 'off') then
-! microp_scheme = trim(config_microp_scheme)
-! call microphysics_allocate
-!endif
- if(config_microp_scheme .ne. 'off') &
- microp_scheme = trim(config_microp_scheme)
-
-!initialization of variables and allocation of arrays related to deep convection:
-
- if(config_conv_deep_scheme .ne. 'off') &
- conv_deep_scheme = trim(config_conv_deep_scheme)
-
-!initialization of variables and allocation of arrays related to shallow convection:
-
- if(config_conv_shallow_scheme .ne. 'off') &
- conv_shallow_scheme = trim(config_conv_shallow_scheme)
-
-!initialization of variables and allocation of arrays related to surface processes:
- if(config_sfclayer_scheme .ne. 'off') &
- sfclayer_scheme = trim(config_sfclayer_scheme)
-
-!initialization of variables and allocation of arrays related to pbl processes:
- if(config_pbl_scheme .ne. 'off' .and. config_sfclayer_scheme .ne. 'off') &
- pbl_scheme = trim(config_pbl_scheme)
-
end subroutine physics_run_init
!=============================================================================================
</font>
</pre>