[Dart-dev] [5627] DART/branches/development/models/wrf/model_mod.f90: by default the perturb routine is commented out, but if the user

nancy at ucar.edu nancy at ucar.edu
Wed Mar 28 16:22:54 MDT 2012


Revision: 5627
Author:   nancy
Date:     2012-03-28 16:22:54 -0600 (Wed, 28 Mar 2012)
Log Message:
-----------
by default the perturb routine is commented out, but if the user
comments it in to use it, the line to pick a seed for the random
number generator wasn't a good one.  set a better default for
the seeds. 

Modified Paths:
--------------
    DART/branches/development/models/wrf/model_mod.f90

-------------- next part --------------
Modified: DART/branches/development/models/wrf/model_mod.f90
===================================================================
--- DART/branches/development/models/wrf/model_mod.f90	2012-03-28 20:00:11 UTC (rev 5626)
+++ DART/branches/development/models/wrf/model_mod.f90	2012-03-28 22:22:54 UTC (rev 5627)
@@ -6144,13 +6144,13 @@
 real(r8), intent(out) :: pert_state(:)
 logical,  intent(out) :: interf_provided
 
-real(r8)              :: pert_amount = 0.02   ! 2%
+real(r8)              :: pert_amount = 0.005   ! 0.5%
 
 real(r8)              :: pert_ampl, range
 real(r8)              :: minv, maxv, temp
 type(random_seq_type) :: random_seq
 integer               :: id, i, j, s, e
-integer, save :: counter = 1
+integer, save         :: counter = 0
 
 ! generally you do not want to perturb a single state
 ! to begin an experiment - unless you make minor perturbations
@@ -6173,20 +6173,21 @@
 ! start of pert code
 interf_provided = .true.
 
-! the first time through get the task id (0:N-1)
-! and set a unique seed per task.  this won't
-! be consistent between different numbers of mpi
-! tasks, but at least it will reproduce with
-! multiple runs with the same task count.
-! best i can do since this routine doesn't have
-! the ensemble member number as an argument
-! (which i think it needs for consistent seeds).
+! the first time through get the task id (0:N-1) and set a unique seed 
+! per task.  this should reproduce from run to run if you keep the number
+! of MPI tasks the same.  it WILL NOT reproduce if the number of tasks changes.
+! if this routine could at some point get the global ensemble member number
+! as an argument, that would be unique and the right thing to use as a seed.
 !
-! this only executes the first time since counter
-! gets incremented after the first use and the value
-! is saved between calls.
-if (counter == 1) counter = counter + (my_task_id() * 1000)
+! the line below only executes the first time since counter gets incremented 
+! after the first use and the value is saved between calls.  it is trying to 
+! generate a unique base number, and then just increments by 1 each subsequent 
+! time it is called (which only happens if there are multiple ensemble 
+! members/task).  it is assuming there are no more than 1000 ensembles/task,
+! which seems safe given the current sizes of state vecs and hardware memory.
 
+if (counter == 0) counter = ((my_task_id()+1) * 1000)
+
 call init_random_seq(random_seq, counter)
 counter = counter + 1
 


More information about the Dart-dev mailing list