[Dart-dev] DART/branches Revision: 12176
dart at ucar.edu
dart at ucar.edu
Tue Dec 5 10:54:39 MST 2017
nancy at ucar.edu
2017-12-05 10:54:38 -0700 (Tue, 05 Dec 2017)
256
added a perturb routine where you can specify only
certain quantities and an amplitude per quantity.
also i found you can ask for the quantity directly
back from get_model_variable_indices() so i removed
a separate call to get the quantity in 2 places.
Modified: DART/branches/recam/models/cam-fv/model_mod.f90
===================================================================
--- DART/branches/recam/models/cam-fv/model_mod.f90 2017-12-05 17:05:39 UTC (rev 12175)
+++ DART/branches/recam/models/cam-fv/model_mod.f90 2017-12-05 17:54:38 UTC (rev 12176)
@@ -34,9 +34,9 @@
QTY_SURFACE_PRESSURE, &
QTY_TEMPERATURE, QTY_SPECIFIC_HUMIDITY, &
get_index_for_quantity, get_num_quantities
-!#! use mpi_utilities_mod
-!#! use random_seq_mod
-use ensemble_manager_mod, only : ensemble_type
+use mpi_utilities_mod, only : my_task_id
+use random_seq_mod, only : random_seq_type, init_random_seq, random_gaussian
+use ensemble_manager_mod, only : ensemble_type, get_my_num_vars, get_my_vars
use distributed_state_mod, only : get_state
use state_structure_mod, only : add_domain, get_dart_vector_index, get_domain_size, &
get_dim_name, get_kind_index, get_num_dims, &
@@ -58,7 +58,7 @@
GRID_QUAD_IRREG_SPACED_REGULAR, &
QUAD_LOCATED_CELL_CENTERS
use default_model_mod, only : adv_1step, init_time, init_conditions, &
- nc_write_model_vars, pert_model_copies
+ nc_write_model_vars
implicit none
private
@@ -70,16 +70,16 @@
public :: static_init_model, &
get_model_size, &
get_state_meta_data, &
- model_interpolate, & ! big todo
+ model_interpolate, &
shortest_time_between_assimilations, &
nc_write_model_atts, &
- write_model_time, & ! todo
+ write_model_time, &
read_model_time, &
end_model
! code for these routines are in other modules
public :: nc_write_model_vars, &
- pert_model_copies, & ! todo
+ pert_model_copies, &
adv_1step, &
init_time, &
init_conditions, &
@@ -94,6 +94,10 @@
character(len=32 ), parameter :: revision = "$Revision$"
character(len=128), parameter :: revdate = "$Date$"
+! maximum number of fields you can list to be perturbed
+! to generate an ensemble if starting from a single state.
+integer, parameter :: MAX_PERT = 100
+
! model_nml namelist variables and default values
character(len=256) :: cam_template_filename = 'caminput.nc'
character(len=256) :: cam_phis_filename = 'camphis.nc'
@@ -105,6 +109,9 @@
logical :: use_damping_ramp_at_model_top = .false.
integer :: debug_level = 0
logical :: suppress_grid_info_in_output = .false.
+logical :: custom_routine_to_generate_ensemble = .false.
+character(len=32) :: fields_to_perturb(MAX_PERT) = "QTY_TEMPERATURE"
+real(r8) :: perturbation_amplitude(MAX_PERT)= 0.00001_r8
! state_variables defines the contents of the state vector.
! each line of this input should have the form:
@@ -130,6 +137,9 @@
no_assim_above_this_model_level, &
use_damping_ramp_at_model_top, &
suppress_grid_info_in_output, &
+ custom_routine_to_generate_ensemble, &
+ fields_to_perturb, &
+ perturbation_amplitude, &
debug_level
@@ -305,9 +315,8 @@
if ( .not. module_initialized ) call static_init_model
-call get_model_variable_indices(index_in, iloc, jloc, vloc, var_id=myvarid)
+call get_model_variable_indices(index_in, iloc, jloc, vloc, var_id=myvarid, kind_index=myqty)
-myqty = get_kind_index(domain_id, myvarid)
nd = get_num_dims(domain_id, myvarid)
location = get_location_from_index(iloc, jloc, vloc, myqty, nd)
@@ -1880,8 +1889,89 @@
end function read_model_time
+!--------------------------------------------------------------------
+!> if the namelist is set to not use this custom routine, the default
+!> dart routine will add 'pert_amp' of noise to every field in the state
+!> to generate an ensemble from a single member. if it is set to true
+!> this routine will be called. the pert_amp will be ignored, and the
+!> given list of quantities will be perturbed by the given amplitude
+!> (which can be different for each field) to generate an ensemble.
+subroutine pert_model_copies(state_ens_handle, ens_size, pert_amp, interf_provided)
More information about the Dart-dev
mailing list