<p><b>laura@ucar.edu</b> 2012-02-29 12:38:47 -0700 (Wed, 29 Feb 2012)</p><p>added logicals and alarms to 1) save the CAM arrays absnxt,absnst, and emstot when a restart is going to be written at the bottom of the time-step; and 2) limit the precipitation diagnostics rainc and rainnc to values less or equal to their respective bucket values<br>
</p><hr noshade><pre><font color="gray">Modified: branches/atmos_physics/src/core_atmos_physics/mpas_atmphys_manager.F
===================================================================
--- branches/atmos_physics/src/core_atmos_physics/mpas_atmphys_manager.F        2012-02-29 19:33:08 UTC (rev 1552)
+++ branches/atmos_physics/src/core_atmos_physics/mpas_atmphys_manager.F        2012-02-29 19:38:47 UTC (rev 1553)
@@ -38,6 +38,17 @@
 !between updates is 6 hours and is set with config_camrad_abs_update (00:30:00).
  integer, parameter:: camAlarmID    = 17
 
+!defines alarm to save the CAM arrays absnst, absnxt, and emstot to restart files. When the
+!alarm rings, the local arrays absnt_p, absnxt_p, and emstot_p are copied to the MPAS arrays
+!for writing to restart files at the bottom of the time-step:
+ integer, parameter:: camlwAlarmID  = 18
+ type(MPAS_TimeInterval_Type):: camlwTimeStep
+
+!defines alarm to check if the accumulated rain due to cloud microphysics and convection is
+!greater than its maximum allowed value:
+ integer, parameter:: rainAlarmID   = 19
+ type(MPAS_TimeInterval_Type):: rainTimeStep
+
  integer :: h, m, s, s_n, s_d, DoY, yr
  real(kind=RKIND) :: utc_h
 
@@ -164,6 +175,28 @@
     write(0,*) '--- update CAM absorptivity and emissivity arrays DOABSEMS =',doabsems
 
  endif
+
+!check to see if it is time to save the local CAM arrays absnst_p, absnxt_p, and emstot_p to
+!the MPAS arrays:
+ if(trim(config_radt_lw_scheme) .eq. &quot;cam_lw&quot;) then
+
+    l_camlw = .false.
+    if(mpas_is_alarm_ringing(clock,camlwAlarmID,camlwTimeStep,ierr=ierr)) then
+       call mpas_reset_clock_alarm(clock,camlwAlarmID,camlwTimeStep,ierr=ierr)
+       l_camlw = .true.
+    endif
+    write(0,*) '--- time to write local CAM arrays to MPAS arrays L_CAMLW =',l_camlw
+
+ endif
+
+!check to see if it is time to apply limit to the accumulated rain due to cloud microphysics
+!and convection:
+ l_rain = .false.
+ if(mpas_is_alarm_ringing(clock,rainAlarmID,rainTimeStep,ierr=ierr)) then
+    call mpas_reset_clock_alarm(clock,rainAlarmID,rainTimeStep,ierr=ierr)
+    l_rain = .true.
+ endif
+ write(0,*) '--- time to apply limit to accumulated rainc and rainnc L_RAIN =',l_rain
  
 !formats:
  101 format(3x,'l_radtlw = ',l1,3x,'l_radtsw = ',l1)
@@ -325,6 +358,28 @@
        call physics_error_fatal('subroutine physics_init: error creating alarm CAM')
  endif
 
+!set alarm to write the &quot;CAM&quot; local arrays absnst_p, absnxt_p, and emstot_p to the MPAS arrays
+!for writing to the restart file at the bottom of the time-step:
+ if(trim(config_radt_lw_scheme) .eq. &quot;cam_lw&quot; ) then
+    call mpas_set_timeInterval(camlwTimeStep,dt=config_dt,ierr=ierr)
+    call mpas_set_timeInterval(alarmTimeStep,timeString=config_restart_interval,ierr=ierr)
+    alarmStartTime = startTime + alarmTimeStep
+    call mpas_add_clock_alarm(clock,camlwAlarmID,alarmStartTime,alarmTimeStep,ierr=ierr)
+    if(ierr /= 0) &amp;
+       call physics_error_fatal('subroutine physics_init: error creating alarm CAMLW')
+ endif
+
+!set alarm to check if the accumulated rain due to cloud microphysics and convection is
+!greater than its maximum allowed value:
+ if(config_bucket_update /= &quot;none&quot;) then
+    call mpas_set_timeInterval(rainTimeStep,dt=config_dt,ierr=ierr)
+    call mpas_set_timeInterval(alarmTimeStep,timeString=config_bucket_update,ierr=ierr)
+    alarmStartTime = startTime + alarmTimeStep
+    call mpas_add_clock_alarm(clock,rainAlarmID,alarmStartTime,alarmTimeStep,ierr=ierr)
+       if(ierr /= 0) &amp;
+          call physics_error_fatal('subroutine physics_init: error creating alarm rain limit')
+ endif
+
  write(0,102) dt_radtlw,dt_radtsw,dt_cu,dt_pbl
 
 !initialization of physics dimensions to mimic a rectangular grid:

Modified: branches/atmos_physics/src/core_atmos_physics/mpas_atmphys_vars.F
===================================================================
--- branches/atmos_physics/src/core_atmos_physics/mpas_atmphys_vars.F        2012-02-29 19:33:08 UTC (rev 1552)
+++ branches/atmos_physics/src/core_atmos_physics/mpas_atmphys_vars.F        2012-02-29 19:38:47 UTC (rev 1553)
@@ -27,7 +27,9 @@
 !=============================================================================================
 
  logical:: l_radtlw                   !controls call to longwave radiation parameterization.
- logical:: l_radtsw                   !controls call to shortwave parameterization.
+ logical:: l_radtsw                   !controls call to shortwave radiationparameterization.
+ logical:: l_camlw                    !controls when to save local CAM LW abs and ems arrays.
+ logical:: l_rain                     !when .true., limit to accumulated rain is applied.
 
  integer,public:: ids,ide,jds,jde,kds,kde
  integer,public:: ims,ime,jms,jme,kms,kme

</font>
</pre>