From dart at ucar.edu Thu Dec 6 15:33:36 2018 From: dart at ucar.edu (dart at ucar.edu) Date: Thu, 6 Dec 2018 15:33:36 -0700 (MST) Subject: [Dart-dev] DART/branches Revision: 12945 Message-ID: <20181206223337.0CC621580059@svn41.cgd.ucar.edu> nancy at ucar.edu 2018-12-06 15:33:36 -0700 (Thu, 06 Dec 2018) 228 committing an updated model_mod for the simple_advection model to the recam branch just so there is a version in svn someplace for safekeeping. this needs review by jeff and then to be put on the rma_trunk and then manhattan. Modified: DART/branches/recam/models/simple_advection/model_mod.f90 =================================================================== --- DART/branches/recam/models/simple_advection/model_mod.f90 2018-11-29 18:44:20 UTC (rev 12944) +++ DART/branches/recam/models/simple_advection/model_mod.f90 2018-12-06 22:33:36 UTC (rev 12945) @@ -4,6 +4,48 @@ ! ! $Id$ +!> @brief Simple Advection model +!> +!> This model is on a periodic one-dimensional domain. A wind field is +!> modeled using Burger's Equation with an upstream semi-lagrangian +!> differencing. This diffusive numerical scheme is stable and forcing +!> is provided by adding in random gaussian noise to each wind grid +!> variable independently at each timestep. The domain mean value of the +!> wind is relaxed to a constant fixed value set by the namelist parameter +!> mean_wind. The random forcing magnitude is set by namelist parameter +!> wind_random_amp and the damping of the mean wind is controlled by +!> parameter wind_damping_rate. An Eulerian option with centered in +!> space differencing is also provided and can be used by setting namelist +!> parameter lagrangian_for_wind to .false. The Eulerian differencing is +!> both numerically unstable and subject to shock formation. However, it +!> can sometimes be made stable in assimilation mode (see recent work by +!> Majda and collaborators). +!> +!> The model state includes a single passive tracer that is advected by +!> the wind field using semi-lagrangian upstream differencing. The state +!> also includes a tracer source value at each gridpoint. At each time +!> step, the source is added into the concentration at each gridpoint. +!> There is also a constant global destruction of tracer that is controlled +!> by the namelist parameter destruction_rate. The appropriate percentage +!> of tracer is destroyed at each gridpoint at each timestep. +!> +!> The model also includes an associated model for the tracer source rate. +!> At each gridpoint, there is a value of the time mean source rate and +!> a value of the phase offset for a diurnal component of the source rate. +!> The diurnal source rate has an amplitude that is proportional to the +!> source rate (this proportion is controlled by namelist parameter +!> source_diurnal_rel_amp). At each grid point, the source is the sum +!> of the source rate plus the appropriate diurnally varying component. +!> The phase_offset at the gridpoint controls the diurnal phase. The +!> namelist parameter source_phase_noise controls the amplitude of +!> random gaussian noise that is added into the source phase at each +!> time step. If source_phase_noise is zero then the phase offset is +!> fixed. Finally, the time mean source rate is constant in time in the +!> present model version. The time mean source rate controls the +!> amplitude of the diurnal cycle of the tracer source. +!> +!> + module model_mod use types_mod, only : r8, PI, i4, i8 @@ -15,6 +57,8 @@ check_namelist_read, do_output, & do_nml_file, do_nml_term +use mpi_utilities_mod, only : sum_across_tasks, my_task_id + use location_mod, only : location_type, set_location, get_location, & get_close_obs, get_close_state, & convert_vertical_obs, convert_vertical_state @@ -29,13 +73,13 @@ use default_model_mod, only : end_model, nc_write_model_vars, init_time use obs_kind_mod, only : QTY_VELOCITY, QTY_TRACER_CONCENTRATION, & - QTY_TRACER_SOURCE, QTY_MEAN_SOURCE, QTY_SOURCE_PHASE + QTY_TRACER_SOURCE, QTY_MEAN_SOURCE, QTY_SOURCE_PHASE, & + get_name_for_quantity use random_seq_mod, only : random_seq_type, init_random_seq, random_gaussian -use ensemble_manager_mod, only : ensemble_type, get_allow_transpose, & - all_vars_to_all_copies, all_copies_to_all_vars, & - init_ensemble_manager, end_ensemble_manager +use ensemble_manager_mod, only : ensemble_type, init_ensemble_manager, end_ensemble_manager, & + get_my_num_vars, get_my_vars use distributed_state_mod, only : get_state @@ -136,8 +180,18 @@ real(r8) :: source_diurnal_rel_amp = 0.05_r8 real(r8) :: source_phase_noise = 0.0_r8 +! if you change NVARS or the order of any of +! these, you must change the 'add_domain()' call +! in static_init_model() below. integer, parameter :: NVARS = 5 -integer :: my_ens_size = 1 +integer, parameter :: CONC = 1 +integer, parameter :: TSOURCE = 2 +integer, parameter :: WIND = 3 +integer, parameter :: MEAN_SRC = 4 +integer, parameter :: SRC_PHASE = 5 +integer :: conc_offset, source_offset, wind_offset +integer :: mean_src_offset, src_phase_offset +integer :: model_size namelist /model_nml/ num_grid_points, grid_spacing_meters, & time_step_days, time_step_seconds, & @@ -175,14 +229,17 @@