<p><b>dwj07@fsu.edu</b> 2013-01-07 14:47:07 -0700 (Mon, 07 Jan 2013)</p><p><br>
        -- BRANCH COMMIT --<br>
<br>
        Fixing some issues with forcing from CESM.<br>
</p><hr noshade><pre><font color="gray">Modified: branches/ocean_projects/generic_forcing/src/core_ocean/Registry
===================================================================
--- branches/ocean_projects/generic_forcing/src/core_ocean/Registry        2013-01-04 23:23:40 UTC (rev 2376)
+++ branches/ocean_projects/generic_forcing/src/core_ocean/Registry        2013-01-07 21:47:07 UTC (rev 2377)
@@ -14,7 +14,6 @@
namelist logical sw_model config_prescribe_velocity false
namelist logical sw_model config_prescribe_thickness false
namelist integer sw_model config_num_halos 3
-namelist integer sw_model config_ncouple_per_day 1
namelist character io config_input_name grid.nc
namelist character io config_output_name output.nc
namelist character io config_restart_name restart.nc
@@ -221,7 +220,7 @@
var persistent integer cellMask ( nVertLevels nCells ) 0 o cellMask mesh - -
% Forcing variables.
-var persistent real windStress ( nVertLevels nEdges Time ) 2 - windStress state - -
+var persistent real windStress ( nVertLevels nEdges Time ) 2 o windStress state - -
var persistent real temperatureRestore ( nCells Time ) 2 - temperatureRestore state - -
var persistent real salinityRestore ( nCells Time ) 2 - salinityRestore state - -
var persistent real windStressInput ( nForcing nEdges Time ) 2 - windStressInput state - -
@@ -337,8 +336,8 @@
#ifdef MPAS_CESM
% Coupler input fields, for coupled runs
-var persistent real meridionalWindStress ( nCells Time ) 2 o meridionalWindStress state - -
-var persistent real zonalWindStress ( nCells Time ) 2 o zonalWindStress state - -
+var persistent real meridionalWindStress ( nCells Time ) 2 - meridionalWindStress state - -
+var persistent real zonalWindStress ( nCells Time ) 2 - zonalWindStress state - -
var persistent real latentHeatFlux ( nCells Time ) 2 - latentHeatFlux state - -
var persistent real sensibleHeatFlux ( nCells Time ) 2 - sensibleHeatFlux state - -
var persistent real longWaveHeatFluxUp ( nCells Time ) 2 - longWaveHeatFluxUp state - -
Modified: branches/ocean_projects/generic_forcing/src/core_ocean/mpas_ocn_forcing_coupled.F
===================================================================
--- branches/ocean_projects/generic_forcing/src/core_ocean/mpas_ocn_forcing_coupled.F        2013-01-04 23:23:40 UTC (rev 2376)
+++ branches/ocean_projects/generic_forcing/src/core_ocean/mpas_ocn_forcing_coupled.F        2013-01-07 21:47:07 UTC (rev 2377)
@@ -193,7 +193,6 @@
! + SALT_F(:,:,iblock)*sflux_factor)
end do
-
#endif
!--------------------------------------------------------------------
Modified: branches/ocean_projects/generic_forcing/src/core_ocean/mpas_ocn_tracer_short_wave_absorption_jerlov.F
===================================================================
--- branches/ocean_projects/generic_forcing/src/core_ocean/mpas_ocn_tracer_short_wave_absorption_jerlov.F        2013-01-04 23:23:40 UTC (rev 2376)
+++ branches/ocean_projects/generic_forcing/src/core_ocean/mpas_ocn_tracer_short_wave_absorption_jerlov.F        2013-01-07 21:47:07 UTC (rev 2377)
@@ -142,7 +142,7 @@
do k =1, maxLevelCell(iCell)
depth = depth + hZLevel(k)
- call ocn_get_jerlov_fraction(depth, weights(k))
+ call ocn_get_jerlov_fraction(depth, weights(k+1))
tend(index_temperature, k, iCell) = tend(index_temperature, k, iCell) + shortWaveHeatFlux(iCell)*(weights(k) - weights(k+1)) / h(k, iCell)
end do
end do
@@ -152,7 +152,7 @@
do k =1, maxLevelCell(iCell)
depth = depth + h(k, iCell)
- call ocn_get_jerlov_fraction(depth, weights(k))
+ call ocn_get_jerlov_fraction(depth, weights(k+1))
tend(index_temperature, k, iCell) = tend(index_temperature, k, iCell) + shortWaveHeatFlux(iCell)*(weights(k) - weights(k+1)) / h(k, iCell)
end do
end do
Modified: branches/ocean_projects/generic_forcing/src/ocean_cesm_driver/ocn_comp_mct.F
===================================================================
--- branches/ocean_projects/generic_forcing/src/ocean_cesm_driver/ocn_comp_mct.F        2013-01-04 23:23:40 UTC (rev 2376)
+++ branches/ocean_projects/generic_forcing/src/ocean_cesm_driver/ocn_comp_mct.F        2013-01-07 21:47:07 UTC (rev 2377)
@@ -32,6 +32,7 @@
use mpas_framework
use mpas_core
use mpas_kind_types
+ use ocn_constants, only : T0_Kelvin
!
! !PUBLIC MEMBER FUNCTIONS:
@@ -73,7 +74,7 @@
integer :: nsend, nrecv
- character(len=StrKIND) :: runtype
+ character(len=StrKIND) :: runtype, coupleTimeStamp
type(seq_infodata_type), pointer :: infodata
type (iosystem_desc_t), pointer :: io_system
@@ -287,15 +288,21 @@
!-----------------------------------------------------------------------
call seq_timemgr_EClockGetData(EClock, dtime=ocn_cpl_dt)
- mpas_o_cpl_dt = 86400 / config_ncouple_per_day
- if (mpas_o_cpl_dt /= ocn_cpl_dt) then
- write(0,*)'mpas-o_cpl_dt= ',mpas_o_cpl_dt, &
- ' ocn_cpl_dt= ',ocn_cpl_dt
- call mpas_dmpar_global_abort('ERROR mpas-o_cpl_dt and ocn_cpl_dt must be identical')
- end if
+ call convert_seconds_to_timestamp(ocn_cpl_dt, coupleTimeStamp)
!-----------------------------------------------------------------------
!
+! get intial state from driver
+!
+!-----------------------------------------------------------------------
+
+ call ocn_import_mct(x2o_o, errorCode)
+ if (errorCode /= 0) then
+ call mpas_dmpar_global_abort('ERROR in ocn_import_mct')
+ endif
+
+!-----------------------------------------------------------------------
+!
! send intial state to driver
!
!-----------------------------------------------------------------------
@@ -436,10 +443,12 @@
real (kind=RKIND) :: dt
type (block_type), pointer :: block_ptr
- type (MPAS_Time_Type) :: currTime
+ type (MPAS_Time_Type) :: currTime, alarmStartTime
+ type (MPAS_TimeInterval_Type) :: alarmTimeStep
character(len=StrKIND) :: timeStamp
integer :: ierr
-
+ integer, parameter :: couplingAlarmID = 4
+
! Eventually, dt should be domain specific
dt = config_dt
@@ -447,6 +456,11 @@
call mpas_get_time(curr_time=currTime, dateTimeString=timeStamp, ierr=ierr)
write(0,*) 'Initial time ', trim(timeStamp)
+ ! set coupling alarm
+ call mpas_set_timeInterval(alarmTimeStep, timeString=coupleTimeStamp, ierr=ierr)
+ alarmStartTime = currTime
+ call mpas_add_clock_alarm(clock, couplingAlarmID, alarmStartTime, alarmTimeStep, ierr=ierr)
+
call ocn_write_output_frame(output_obj, output_frame, domain)
block_ptr => domain % blocklist
@@ -483,6 +497,12 @@
call mpas_shift_time_levels_state(block_ptr % state)
block_ptr => block_ptr % next
end do
+
+ if (mpas_is_alarm_ringing(clock, couplingAlarmID, ierr=ierr)) then
+ call mpas_reset_clock_alarm(clock, couplingAlarmID, ierr=ierr)
+ call ocn_import_mct(x2o_o, ierr)
+ call ocn_export_mct(o2x_o, ierr)
+ end if
if (mpas_is_alarm_ringing(clock, outputAlarmID, ierr=ierr)) then
call mpas_reset_clock_alarm(clock, outputAlarmID, ierr=ierr)
@@ -863,7 +883,7 @@
call mct_gGrid_importRAttr(dom_o,"lon" ,data,lsize)
call mct_gGrid_importRAttr(dom_o,"area" ,data,lsize)
call mct_gGrid_importRAttr(dom_o,"aream",data,lsize)
- data(:) = 0.0_R8
+ data(:) = 1.0_R8
call mct_gGrid_importRAttr(dom_o,"mask",data,lsize)
call mct_gGrid_importRAttr(dom_o,"frac",data,lsize)
@@ -1008,31 +1028,31 @@
do while(associated(block_ptr))
do i = 1, block_ptr % mesh % nCellsSolve
n = n + 1
- block_ptr % state % time_levs(1) % state % zonalWindStress % array(n) = x2o_o % rAttr(index_x2o_Foxx_taux, n)
- block_ptr % state % time_levs(1) % state % meridionalWindStress % array(n) = x2o_o % rAttr(index_x2o_Foxx_tauy, n)
+ block_ptr % state % time_levs(1) % state % zonalWindStress % array(i) = x2o_o % rAttr(index_x2o_Foxx_taux, n)
+ block_ptr % state % time_levs(1) % state % meridionalWindStress % array(i) = x2o_o % rAttr(index_x2o_Foxx_tauy, n)
- block_ptr % state % time_levs(1) % state % latentHeatFlux % array(n) = x2o_o % rAttr(index_x2o_Foxx_lat, n)
- block_ptr % state % time_levs(1) % state % sensibleHeatFlux % array(n) = x2o_o % rAttr(index_x2o_Foxx_sen, n)
- block_ptr % state % time_levs(1) % state % longWaveHeatFluxUp % array(n) = x2o_o % rAttr(index_x2o_Foxx_lwup, n)
- block_ptr % state % time_levs(1) % state % longWaveHeatFluxDown % array(n) = x2o_o % rAttr(index_x2o_Faxa_lwdn, n)
- block_ptr % state % time_levs(1) % state % evaporationFlux % array(n) = x2o_o % rAttr(index_x2o_Foxx_evap, n)
- block_ptr % state % time_levs(1) % state % seaIceHeatFlux % array(n) = x2o_o % rAttr(index_x2o_Fioi_melth, n)
- block_ptr % state % time_levs(1) % state % snowFlux % array(n) = x2o_o % rAttr(index_x2o_Faxa_snow, n)
+ block_ptr % state % time_levs(1) % state % latentHeatFlux % array(i) = x2o_o % rAttr(index_x2o_Foxx_lat, n)
+ block_ptr % state % time_levs(1) % state % sensibleHeatFlux % array(i) = x2o_o % rAttr(index_x2o_Foxx_sen, n)
+ block_ptr % state % time_levs(1) % state % longWaveHeatFluxUp % array(i) = x2o_o % rAttr(index_x2o_Foxx_lwup, n)
+ block_ptr % state % time_levs(1) % state % longWaveHeatFluxDown % array(i) = x2o_o % rAttr(index_x2o_Faxa_lwdn, n)
+ block_ptr % state % time_levs(1) % state % evaporationFlux % array(i) = x2o_o % rAttr(index_x2o_Foxx_evap, n)
+ block_ptr % state % time_levs(1) % state % seaIceHeatFlux % array(i) = x2o_o % rAttr(index_x2o_Fioi_melth, n)
+ block_ptr % state % time_levs(1) % state % snowFlux % array(i) = x2o_o % rAttr(index_x2o_Faxa_snow, n)
- block_ptr % state % time_levs(1) % state % seaIceFreshWaterFlux % array(n) = x2o_o % rAttr(index_x2o_Fioi_meltw, n)
- block_ptr % state % time_levs(1) % state % seaIceSalinityFlux % array(n) = x2o_o % rAttr(index_x2o_Fioi_salt, n)
- block_ptr % state % time_levs(1) % state % riverRunoffFlux % array(n) = x2o_o % rAttr(index_x2o_Forr_roff, n)
- block_ptr % state % time_levs(1) % state % iceRunoffFlux % array(n) = x2o_o % rAttr(index_x2o_Forr_ioff, n)
+ block_ptr % state % time_levs(1) % state % seaIceFreshWaterFlux % array(i) = x2o_o % rAttr(index_x2o_Fioi_meltw, n)
+ block_ptr % state % time_levs(1) % state % seaIceSalinityFlux % array(i) = x2o_o % rAttr(index_x2o_Fioi_salt, n)
+ block_ptr % state % time_levs(1) % state % riverRunoffFlux % array(i) = x2o_o % rAttr(index_x2o_Forr_roff, n)
+ block_ptr % state % time_levs(1) % state % iceRunoffFlux % array(i) = x2o_o % rAttr(index_x2o_Forr_ioff, n)
- block_ptr % state % time_levs(1) % state % shortWaveHeatFlux % array(n) = max(x2o_o % rAttr(index_x2o_Foxx_swnet, n), 0.0_RKIND)
+ block_ptr % state % time_levs(1) % state % shortWaveHeatFlux % array(i) = max(x2o_o % rAttr(index_x2o_Foxx_swnet, n), 0.0_RKIND) * hflux_factor
- block_ptr % state % time_levs(1) % state % rainFlux % array(n) = x2o_o % rAttr(index_x2o_Faxa_rain, n)
- block_ptr % state % time_levs(1) % state % seaLevelPressure % array(n) = x2o_o % rAttr(index_x2o_Sa_pslv, n)
- block_ptr % state % time_levs(1) % state % iceFraction % array(n) = x2o_o % rAttr(index_x2o_Si_ifrac, n)
+ block_ptr % state % time_levs(1) % state % rainFlux % array(i) = x2o_o % rAttr(index_x2o_Faxa_rain, n)
+ block_ptr % state % time_levs(1) % state % seaLevelPressure % array(i) = x2o_o % rAttr(index_x2o_Sa_pslv, n)
+ block_ptr % state % time_levs(1) % state % iceFraction % array(i) = x2o_o % rAttr(index_x2o_Si_ifrac, n)
- block_ptr % state % time_levs(1) % state % prognosticCO2 % array(n) = x2o_o % rAttr(index_x2o_Sa_co2prog, n)
- block_ptr % state % time_levs(1) % state % diagnosticCO2 % array(n) = x2o_o % rAttr(index_x2o_Sa_co2diag, n)
- block_ptr % state % time_levs(1) % state % squaredWindSpeed10Meter % array(n) = x2o_o % rAttr(index_x2o_So_duu10n, n)
+ block_ptr % state % time_levs(1) % state % prognosticCO2 % array(i) = x2o_o % rAttr(index_x2o_Sa_co2prog, n)
+ block_ptr % state % time_levs(1) % state % diagnosticCO2 % array(i) = x2o_o % rAttr(index_x2o_Sa_co2diag, n)
+ block_ptr % state % time_levs(1) % state % squaredWindSpeed10Meter % array(i) = x2o_o % rAttr(index_x2o_So_duu10n, n)
if(block_ptr % state % time_levs(1) % state % iceRunoffFlux % array(n) < 0.0_RKIND) then
call shr_sys_abort ('Error: incoming IOFF_F is negative')
@@ -1117,16 +1137,16 @@
do while(associated(block_ptr))
do i = 1, block_ptr % mesh % nCellsSolve
n = n + 1
- o2x_o % rAttr(index_o2x_Fioo_q, n) = block_ptr % state % time_levs(1) % state % surfaceMeltHeatFlux % array(n)
- o2x_o % rAttr(index_o2x_So_t, n) = block_ptr % state % time_levs(1) % state % temperatureState % array(n)
- o2x_o % rAttr(index_o2x_So_s, n) = block_ptr % state % time_levs(1) % state % salinityState % array(n)
- o2x_o % rAttr(index_o2x_So_u, n) = block_ptr % state % time_levs(1) % state % zonalVelocityState % array(n)
- o2x_o % rAttr(index_o2x_So_v, n) = block_ptr % state % time_levs(1) % state % meridionalVelocityState % array(n)
- o2x_o % rAttr(index_o2x_So_dhdx, n) = block_ptr % state % time_levs(1) % state % zonalSSHGradientState % array(n)
- o2x_o % rAttr(index_o2x_So_dhdy, n) = block_ptr % state % time_levs(1) % state % meridionalSSHGradientState % array(n)
- o2x_o % rAttr(index_o2x_Faoo_fco2_ocn, n) = block_ptr % state % time_levs(1) % state % CO2Flux % array(n)
- o2x_o % rAttr(index_o2x_Faoo_fdms_ocn, n) = block_ptr % state % time_levs(1) % state % DMSFlux % array(n)
- o2x_o % rAttr(index_o2x_Faoo_fco2_ocn, n) = block_ptr % state % time_levs(1) % state % surfaceUpwardCO2Flux % array(n)
+ o2x_o % rAttr(index_o2x_Fioo_q, n) = block_ptr % state % time_levs(1) % state % surfaceMeltHeatFlux % array(i)
+ o2x_o % rAttr(index_o2x_So_t, n) = block_ptr % state % time_levs(1) % state % temperatureState % array(i) + T0_Kelvin
+ o2x_o % rAttr(index_o2x_So_s, n) = block_ptr % state % time_levs(1) % state % salinityState % array(i)
+ o2x_o % rAttr(index_o2x_So_u, n) = block_ptr % state % time_levs(1) % state % zonalVelocityState % array(i)
+ o2x_o % rAttr(index_o2x_So_v, n) = block_ptr % state % time_levs(1) % state % meridionalVelocityState % array(i)
+ o2x_o % rAttr(index_o2x_So_dhdx, n) = block_ptr % state % time_levs(1) % state % zonalSSHGradientState % array(i)
+ o2x_o % rAttr(index_o2x_So_dhdy, n) = block_ptr % state % time_levs(1) % state % meridionalSSHGradientState % array(i)
+ o2x_o % rAttr(index_o2x_Faoo_fco2_ocn, n) = block_ptr % state % time_levs(1) % state % CO2Flux % array(i)
+ o2x_o % rAttr(index_o2x_Faoo_fdms_ocn, n) = block_ptr % state % time_levs(1) % state % DMSFlux % array(i)
+ o2x_o % rAttr(index_o2x_Faoo_fco2_ocn, n) = block_ptr % state % time_levs(1) % state % surfaceUpwardCO2Flux % array(i)
end do
block_ptr => block_ptr % next
@@ -1138,146 +1158,35 @@
end subroutine ocn_export_mct!}}}
-!***********************************************************************
+ subroutine convert_seconds_to_timestamp(seconds, timeStamp)!{{{
+ integer, intent(in) :: seconds
+ character (len=StrKIND), intent(out) :: timeStamp
+ real (kind=RKIND) :: secondsPerHour, secondsPerMinute, remaining
+ integer :: minutes, hours, secondsLeft
-!BOP
-! !IROUTINE: pop_sum_buffer
-! !INTERFACE:
+ secondsPerHour = 3600
+ secondsPerMinute = 60
- subroutine pop_sum_buffer!{{{
+ if(seconds < 0 .or. seconds > 86400) then
+ secondsLeft = 00
+ minutes = 00
+ hours = 00
+ else
+ hours = int(seconds/secondsPerHour)
+ remaining = seconds - real(hours) * secondsPerHour
-! !DESCRIPTION:
-! This routine accumulates sums for averaging fields to
-! be sent to the coupler
-!
-! !REVISION HISTORY:
-! same as module
-!
-!EOP
-!BOC
+ minutes = int(remaining/secondsPerMinute)
+ remaining = remaining - real(minutes) * secondsPerMinute
-!#ifdef CCSMCOUPLED
-!!-----------------------------------------------------------------------
-!!
-!! local variables
-!!
-!!-----------------------------------------------------------------------
-!
-! real (r8), dimension(nx_block,ny_block,max_blocks_clinic) :: &
-! WORK ! local work arrays
-!
-! real (r8) :: &
-! delt, & ! time interval since last step
-! delt_last ! time interval for previous step
-!
-! integer (int_kind) :: &
-! iblock, & ! block index
-! sflux_co2_nf_ind = 0! named field index of fco2
-!
-! logical (log_kind) :: &
-! first = .true. ! only true for first call
-!
-! save first
-!
-!!-----------------------------------------------------------------------
-!!
-!! zero buffer if this is the first time after a coupling interval
-!!
-!!-----------------------------------------------------------------------
-!
-! if (tlast_coupled == c0) SBUFF_SUM = c0
-! WORK = c0
-!
-!!-----------------------------------------------------------------------
-!!
-!! update time since last coupling
-!!
-!!-----------------------------------------------------------------------
-!
-! if (avg_ts .or. back_to_back) then
-! delt = p5*dtt
-! else
-! delt = dtt
-! endif
-! tlast_coupled = tlast_coupled + delt
-!
-!!-----------------------------------------------------------------------
-!!
-!! allow for fco2 field to not be registered on first call
-!! because init_forcing is called before init_passive_tracers
-!! use weight from previous timestep because flux used here is that
-!! computed during the previous timestep
-!!
-!!-----------------------------------------------------------------------
-!
-! if (index_o2x_Faoo_fco2_ocn > 0) then
-! if (sflux_co2_nf_ind == 0) then
-! call named_field_get_index('SFLUX_CO2', sflux_co2_nf_ind, &
-! exit_on_err=.not. first)
-! endif
-!
-! if (avg_ts .or. back_to_back) then
-! delt_last = p5*dtt
-! else
-! delt_last = dtt
-! endif
-! endif
-!
-!!-----------------------------------------------------------------------
-!!
-!! accumulate sums of U,V,T,S and GRADP
-!! accumulate sum of co2 flux, if requested
-!! implicitly use zero flux if fco2 field not registered yet
-!! ice formation flux is handled separately in ice routine
-!!
-!!-----------------------------------------------------------------------
-!
-! !$OMP PARALLEL DO PRIVATE(iblock)
-! do iblock = 1, nblocks_clinic
-! SBUFF_SUM(:,:,iblock,index_o2x_So_u) = &
-! SBUFF_SUM(:,:,iblock,index_o2x_So_u) + delt* &
-! UVEL(:,:,1,curtime,iblock)
-!
-! SBUFF_SUM(:,:,iblock,index_o2x_So_v) = &
-! SBUFF_SUM(:,:,iblock,index_o2x_So_v) + delt* &
-! VVEL(:,:,1,curtime,iblock)
-!
-! SBUFF_SUM(:,:,iblock,index_o2x_So_t ) = &
-! SBUFF_SUM(:,:,iblock,index_o2x_So_t ) + delt* &
-! TRACER(:,:,1,1,curtime,iblock)
-!
-! SBUFF_SUM(:,:,iblock,index_o2x_So_s ) = &
-! SBUFF_SUM(:,:,iblock,index_o2x_So_s ) + delt* &
-! TRACER(:,:,1,2,curtime,iblock)
-!
-! SBUFF_SUM(:,:,iblock,index_o2x_So_dhdx) = &
-! SBUFF_SUM(:,:,iblock,index_o2x_So_dhdx) + delt* &
-! GRADPX(:,:,curtime,iblock)
-!
-! SBUFF_SUM(:,:,iblock,index_o2x_So_dhdy) = &
-! SBUFF_SUM(:,:,iblock,index_o2x_So_dhdy) + delt* &
-! GRADPY(:,:,curtime,iblock)
-!
-! if (index_o2x_Faoo_fco2_ocn > 0 .and. sflux_co2_nf_ind > 0) then
-! call named_field_get(sflux_co2_nf_ind, iblock, WORK(:,:,iblock))
-! SBUFF_SUM(:,:,iblock,index_o2x_Faoo_fco2_ocn) = &
-! SBUFF_SUM(:,:,iblock,index_o2x_Faoo_fco2_ocn) + delt_last*WORK(:,:,iblock)
-! endif
-!
-! enddo
-! !$OMP END PARALLEL DO
-!
-! first = .false.
-!
-!#endif
-!
-!-----------------------------------------------------------------------
-!EOC
+ secondsLeft = int(remaining)
+ end if
- end subroutine pop_sum_buffer!}}}
-
-!***********************************************************************
+ write(timeStamp,"(a,i2.2,a,i2.2,a,i2.2)") "00_",hours,":",minutes,":",secondsLeft
+ timeStamp = trim(timeStamp)
+ end subroutine convert_seconds_to_timestamp!}}}
+
+
end module ocn_comp_mct
!|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
</font>
</pre>