[Dart-dev] [3810] DART/trunk/obs_model/obs_model_mod.f90: Minore update to ensure that if advance_state() is called when
nancy at ucar.edu
nancy at ucar.edu
Mon Apr 13 11:56:46 MDT 2009
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/dart-dev/attachments/20090413/841bda3f/attachment.html
-------------- next part --------------
Modified: DART/trunk/obs_model/obs_model_mod.f90
===================================================================
--- DART/trunk/obs_model/obs_model_mod.f90 2009-04-13 16:21:33 UTC (rev 3809)
+++ DART/trunk/obs_model/obs_model_mod.f90 2009-04-13 17:56:46 UTC (rev 3810)
@@ -290,6 +290,7 @@
type(time_type) :: time_step, ens_time
integer :: is1, is2, id1, id2, my_num_state_copies, global_ens_index
integer :: i, control_unit, ic_file_unit, ud_file_unit
+integer :: need_advance, any_need_advance
! Initialize if needed
@@ -298,6 +299,11 @@
module_initialized = .true.
endif
+! Tasks without ensemble members do not know the ensemble time, so assume
+! no advance until we can read the time on at least some tasks and confirm
+! the advance is needed (which it should be).
+need_advance = 0
+
! Determine model time_step
time_step = get_model_time_step()
@@ -311,9 +317,6 @@
! contiguously on local processor
if(global_ens_index > ens_size) exit ENSEMBLE_MEMBERS
- ! Increment number of ensemble member copies I have
- my_num_state_copies = my_num_state_copies + 1
-
! No need to advance if already at target time
if(ens_handle%time(i) == target_time) exit ENSEMBLE_MEMBERS
@@ -325,6 +328,12 @@
call error_handler(E_ERR,'advance_state', errstring, source, revision, revdate)
endif
+ ! Ok, this task does need to advance something.
+ need_advance = 1
+
+ ! Increment number of ensemble member copies I have.
+ my_num_state_copies = my_num_state_copies + 1
+
!------------- Block for subroutine callable adv_1step interface -----------
if(async == 0) then
@@ -365,6 +374,14 @@
! Following is for async options that use shell to advance model
SHELL_ADVANCE_METHODS: if(async /= 0) then
+
+ ! If no one needs advance, get out now. This is a global communication routine.
+ call sum_across_tasks(need_advance, any_need_advance)
+ if (any_need_advance == 0) then
+ call error_handler(E_MSG, 'advance_state', 'Model time already at requested time')
+ return
+ endif
+
! Get a unique name for the control file; use process id
if(my_task_id() >= 10000) call error_handler(E_ERR, 'advance_state', &
'Can only have 10000 processes', source, revision, revdate)
More information about the Dart-dev
mailing list