Skip to content

Commit

Permalink
Merge pull request #400 from NCAR/improved_roms_model_mod
Browse files Browse the repository at this point in the history
Add pert_model_copies subroutine to ROMS model_mod
  • Loading branch information
johnsonbk authored Sep 21, 2022
2 parents a456bf2 + 7c91b72 commit 220678f
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 5 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ individual files.

The changes are now listed with the most recent at the top.

**September 21 2022 :: ROMS model_mod perturbation routine Tag: v10.4.0**

- Adds a pert_model_copies subroutine to the ROMS model_mod to enable proper
functioning of perturb_single_instance for ROMS.
- Updates ROMS documentation with an explanation of how to generate an initial
ensemble of history files.

**September 16 2022 :: Bug-fix for CLM shell scripts. Tag: v10.3.2**

- Fixes dtlimit bug in cesm2.2 CLM shell scripts. Loads all CAM
Expand Down
4 changes: 2 additions & 2 deletions conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
# -- Project information -----------------------------------------------------

project = 'DART'
copyright = '2021, University Corporation for Atmospheric Research'
copyright = '2022, University Corporation for Atmospheric Research'
author = 'Data Assimilation Research Section'

# The full version, including alpha/beta/rc tags
release = '10.3.2'
release = '10.4.0'
master_doc = 'README'

# -- General configuration ---------------------------------------------------
Expand Down
43 changes: 41 additions & 2 deletions models/ROMS/model_mod.f90
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ module model_mod
use location_io_mod, only : nc_write_location_atts, nc_get_location_varids, &
nc_write_location

use default_model_mod, only : pert_model_copies, nc_write_model_vars, init_conditions, &
init_time, adv_1step
use default_model_mod, only : nc_write_model_vars, init_conditions, init_time, &
adv_1step

use typesizes
use netcdf
Expand Down Expand Up @@ -674,6 +674,45 @@ subroutine nc_write_model_atts(ncid, domain_id)

end subroutine nc_write_model_atts


subroutine pert_model_copies(state_ens_handle, ens_size, perturbation_amplitude, interf_provided)

type(ensemble_type), intent(inout) :: state_ens_handle
integer, intent(in) :: ens_size
real(r8), intent(in) :: perturbation_amplitude
logical, intent(out) :: interf_provided

integer :: var_type
integer :: j,i
integer(i8) :: dart_index
type(location_type) :: location

! Storage for a random sequence for perturbing a single initial state
type(random_seq_type) :: random_seq

if ( .not. module_initialized ) call static_init_model

interf_provided = .true.

! Initialize random number sequence
call init_random_seq(random_seq, my_task_id())

! Perturb the salinity and temperature fields

do i=1,state_ens_handle%my_num_vars
dart_index = state_ens_handle%my_vars(i)
call get_state_meta_data(dart_index, location, var_type)
if (var_type == QTY_TEMPERATURE .or. var_type == QTY_SALINITY) then
do j=1, ens_size
state_ens_handle%copies(j,i) = random_gaussian(random_seq, &
state_ens_handle%copies(j,i), &
perturbation_amplitude)
enddo
endif
enddo

end subroutine pert_model_copies

!-----------------------------------------------------------------------
!> writes the time of the current state and (optionally) the time
!> to be conveyed to ROMS to dictate the length of the forecast.
Expand Down
13 changes: 12 additions & 1 deletion models/ROMS/readme.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,18 @@ The DART forward operators require interpolation from the ROMS terrain-following
and horizontally curvilinear orthogonal coordinates to the observation location.
Please contact us for more information about this interpolation.

A Note About Filenames
Generating an initial ensemble
------------------------------

The ROMS interface provides the ability to create an ensemble of initial ROMS
history files from an initial file by using the
:doc:`/assimilation_code/programs/perturb_single_instance/perturb_single_instance`.
You can specify an ensemble of any size in the ``perturb_single_instance``
namelist in ``input.nml`` and this program will randomly perturb the
temperature and salinity fields of an initial ROMS history file to generate
the ensemble.

A note about filenames
----------------------

During the course of an experiment, many files are created. To make them unique,
Expand Down

0 comments on commit 220678f

Please sign in to comment.