Jump to DART Documentation Main Index
DART interface module for the ROMS model. This page documents the details of the module compiled into DART that interfaces with the ROMS data in the state vector.
The ROMS model_mod code reads the state data from a filter initial condition/restart file, typically called filter_ics or filter_restart. It also requires a NetCDF file named ROMSinput_d01 in the current directory (and d02, etc. for multiple domain cases). This file must be at the same resolution and have the same surface elevation data as the files converted to create the DART initial conditions. No data will be read from this file, but the grid information must match exactly. See the ROMS_to_dart documentation for more information on how to generate DART IC/restart files given ROMS NetCDF files.
The model interface code supports ROMS configurations with multiple domains. Data for all domains is read into the DART state vector. During the computation of the forward operators (getting the estimated observation values from each ensemble member), the search starts in the domain with the highest number, which is generally the finest nest or one of multiple finer nests. The search stops as soon as a domain contains the observation location, working its way from largest number to smallest number domain, ending with domain 1. For example, in a 4 domain case the data in the state vector that came from ROMSinput_d04 is searched first, then ROMSinput_d03, ROMSinput_d02, and finally ROMSinput_d01. The forward operator is computed from the first domain grid that contains the lat/lon of the observation. During the assimilation phase, when the state values are adjusted based on the correlations and assimilation increments, all points in all domains that are within the localization radius are adjusted, regardless of domain. The impact of an observation on the state depends only on the distance between the observation and the state vector point, and the regression coefficient based on the correlation between the distributions of the ensemble of state vector points and the ensemble of observation forward operator values.
The fields from ROMS that are copied into the DART state vector are controlled by namelist. See below for the documentation on the &model_nml entries. The state vector should include all fields needed to restart a ROMS run. There may be additional fields needed depending on the microphysics scheme selected. See the ascii file ROMS_state_variables_table in the models/ROMS directory for a list of fields that are often included in the DART state.
The 16 public interfaces are standardized for all DART compliant models. These interfaces allow DART to advance the model, get the model state and metadata describing this state, find state variables that are close to a given location, and do spatial interpolation for a variety of variables required in observational operators.
This namelist is read from the file input.nml. Namelists start with an ampersand '&' and terminate with a slash '/'. Character strings that contain a '/' must be enclosed in quotes to prevent them from prematurely terminating the namelist.
&model_nml output_state_vector = .false. assimilation_period_days = 8 assimilation_period_seconds = 0 roms_filename = 'roms_input.nc' vert_localization_coord = 3 debug = 1 variables = 'temp', 'QTY_TEMPERATURE', 'NA', 'NA', 'update', 'salt', 'QTY_SALINITY', '0.0', 'NA', 'update', 'u', 'QTY_U_CURRENT_COMPONENT', 'NA', 'NA', 'update', 'v', 'QTY_V_CURRENT_COMPONENT', 'NA', 'NA', 'update', 'zeta', 'QTY_SEA_SURFACE_HEIGHT' 'NA', 'NA', 'update', /
|default_state_variables||logical||If .true., the dart state vector contains the fields U, V, W, PH, T, MU, in that order, and only those. Any values listed in the ROMS_state_variables namelist item will be ignored.|
|ROMS_state_variables||character(:, 5)||A 2D array of strings, 5 per ROMS array
to be added to the dart state vector. If default_state_variables
is .true., this is ignored. When .false., this list of array
names controls which arrays and the order that they are added
to the state vector. The 5 strings are:
|ROMS_state_bounds||character(:, 4)||A 2D array of strings, 4 per ROMS array. During the copy of data to and
from the ROMS netcdf file, variables listed here will have minimum and maximum
values enforced. The 4 strings are:
|output_state_vector||logical||Controls the output to netCDF files. If .true., output the raw dart state vector. If .false., output the prognostic flavor (gridded data) for easier plotting (recommended).|
|num_domains||integer||Total number of ROMS domains, including nested domains.|
|calendar_type||integer||Calendar type. Should be 3 (GREGORIAN) for ROMS.|
|assimilation_period_seconds||integer||The time (in seconds) between assimilations. This is modified if necessary to be an integer multiple of the underlying model timestep.|
|periodic_x||logical||If .true., the grid is periodic in longitude, and points above the last grid cell and points below the first grid cell are wrapped. Note this is not the same as a grid which crosses the prime meridian. ROMS handles that with an offset in longitude and points beyond the last grid index are outside the domain.|
|periodic_y||logical||Used for the Single Column Model to make the grid wrap in Y (see scm below). This is NOT the same as wrapping in latitude (see polar below).|
|polar||logical||If .true., points at the poles are wrapped across the grid. It is not clear this is a good idea since the grid is degnerate here.|
|scm||logical||If .true. the Single Column Model is assumed. The grid is a single vertical column, and there are 9 cells arranged in a 3x3 grid. See the ROMS documentation for more information on this configuration. periodic_x and periodic_y should also be .true. in this case.|
|sfc_elev_max_diff||real(r8)||If > 0, the maximum difference, in meters, between an observation marked as a 'surface obs' as the vertical type (with the surface elevation, in meters, as the numerical vertical location), and the surface elevation as defined by the model. Observations further away from the surface than this threshold are rejected and not assimilated. If the value is negative, this test is skipped.|
|allow_obs_below_vol||logical||If .false. then if an observation with a vertical coordinate of pressure or height (i.e. not a surface observation) is below the lowest 3d sigma level, it is outside the field volume and the interpolation routine rejects it. If this is set to .true. and the observation is above the surface elevation but below the lowest field volume level, the code will extrapolate downward from data values at levels 1 and 2.|
|center_search_half_length||real(r8)||The model_mod now contains two schemes for searching for a vortex center location. If the old scheme is compiled in, then this and the center_spline_grid_scale namelist items are used. (Search code for 'use_old_vortex'.) Half length (in meters) of a square box for searching the vortex center.|
|center_spline_grid_scale||integer||The model_mod now contains two schemes for searching for a vortex center location. If the old scheme is compiled in, then this and the center_search_half_length namelist items are used. (Search code for 'use_old_vortex'.) Ratio of refining grid for spline-interpolation in determining the vortex center.|
|circulation_pres_level||real(r8)||The model_mod now contains two schemes for searching for a vortex center location. If the new scheme is compiled in, then this and the circulation_radius namelist items are used. (Search code for 'use_old_vortex'.) Pressure, in pascals, of the level at which the circulation is computed when searching for the vortex center.|
|circulation_radius||real(r8)||The model_mod now contains two schemes for searching for a vortex center location. If the new scheme is compiled in, then this and the circulation_pres_level namelist items are used. (Search code for 'use_old_vortex'.) Radius, in meters, of the circle over which the circulation calculation is done when searching for the vortex center.|
|vert_localization_coord||integer||Vertical coordinate for vertical localization.
The following items used to be in the ROMS namelist but have been removed. The first 4 are no longer needed, and the last one was moved to &dart_to_ROMS_nml in 2010. In the Lanai release having these values in the namelist does not cause a fatal error, but more recent versions of the code will fail if any of these values are specified. Remove them from your namelist to avoid errors.
|surf_obs||logical||OBSOLETE -- now an error to specify this.|
|soil_data||logical||OBSOLETE -- now an error to specify this.|
|h_diab||logical||OBSOLETE -- now an error to specify this.|
|num_moist_vars||integer||OBSOLETE -- now an error to specify this.|
|adv_mod_command||character(len=32)||OBSOLETE -- This variable was moved to the &dart_to_ROMS_nml namelist. Now an error to specify this here.|
types_mod time_manager_mod threed_sphere/location_mod utilities_mod obs_kind_mod map_utils netcdf typesizes
|use model_mod, only :||get_model_size|
The last 4 interfaces are only required for low-order models where advancing
the model can be done by a call to a subroutine. The ROMS model only advances by
executing the program ROMS.exe. Thus the last 4 interfaces only appear as stubs
in the ROMS module.
The interface pert_model_state is presently not provided for ROMS. The initial ensemble has to be generated off-line. If coherent structures are not required, the filter can generate an ensemble with uncorrelated random Gaussian noise of 0.002. This is of course not appropriate for a model like ROMS which has variables expressed in a wide range of scales. It is thus recommended to generate the initial ensemble off-line, perhaps with the tools provided in models/ROMS/PERTURB/3DVAR-COVAR.
A note about documentation style. Optional arguments are enclosed in brackets [like this].
integer :: get_model_size
Returns the length of the model state vector as an integer. This includes all nested domains.
|model_size||The length of the model state vector.|
integer, intent(in) :: index_in type(location_type), intent(out) :: location integer, optional, intent(out) :: var_type_out integer, optional, intent(out) :: id_out
Returns metadata about a given element, indexed by index_in, in the model state vector. The location defines where the state variable is located while the type of the variable (for instance temperature, or u wind component) is returned by var_type. The integer values used to indicate different variable types in var_type are themselves defined as public interfaces to model_mod if required. The last optional argument is the ROMS domain identification number - obviously this is unique to the ROMS version of this required routine.
|index_in||Index of state vector element about which information is requested.|
|location||Returns location of indexed state variable. The location should use a location_mod that is appropriate for the model domain. For realistic atmospheric models, for instance, a three-dimensional spherical location module that can represent height in a variety of ways is provided.|
|var_type_out||Returns the type of the indexed state variable as an optional argument.|
|id_out||Returns the ROMS domain identification number of the indexed state variable as an optional argument.|
real(r8), dimension(:), intent(in) :: x type(location_type), intent(in) :: location integer, intent(in) :: obs_kind real(r8), intent(out) :: obs_val integer, intent(out) :: istatus
Given model state, returns the value of observation type interpolated to a given location by a method of the model's choosing. All observation kinds defined in obs_kind_mod are supported. In the case where the observational operator is not defined at the given location (e.g. the observation is below the model surface or outside the domain), obs_val is returned as -888888.0 and istatus = 1. Otherwise, istatus = 0. The interpolation is performed in the domain with the highest resolution containing the observation.
|x||A model state vector.|
|location||Location to which to interpolate.|
|obs_kind||Integer indexing which type of observation is to be interpolated.|
|obs_val||The interpolated value from the model.|
|istatus||Integer flag indicating the result of the interpolation.|
type(time_type) :: get_model_time_step
Returns the model base time step as a time_type. For the model ROMS, it returns the time step used for domain 1 (usually the largest time step among all domains because domain 1 is the coarser grid). The time step is read from the ROMSinput_d01 file (used to be namelist.input). In the long run, a more general extended interface may be required that specifies the models range of time stepping possibilities.
|var||Smallest time step of model.|
Used for runtime initialization of the model. This is the first call made to the model by any DART compliant assimilation routine. It reads the model namelist parameters, set the calendar type (the GREGORIAN calendar is used with the ROMS model), and determine the dart vector length. This subroutine requires that ROMSinput_d01, ROMSinput_d02, ... (one file for each domain) be present in the working directory to retrieve model information (grid dimensions and spacing, time step, pressure at the top of the model, map projection parameters, etc).
integer :: nc_write_model_atts integer, intent(in) :: ncFileID
Function to write model specific attributes to a netCDF file. At present, DART is using the NetCDF format to output diagnostic information. This is not a requirement, and models could choose to provide output in other formats. This function writes the metadata associated with the model to a NetCDF file opened to a file identified by ncFileID.
|ncFileID||Integer file descriptor to previously-opened netCDF file.|
|ierr||Returns a 0 for successful completion.|
integer :: nc_write_model_vars integer, intent(in) :: ncFileID real(r8), dimension(:), intent(in) :: statevec integer, intent(in) :: copyindex integer, intent(in) :: timeindex
Writes a copy of the state variables to a netCDF file. Multiple copies of the state for a given time are supported, allowing, for instance, a single file to include multiple ensemble estimates of the state.
|ncFileID||file descriptor to previously-opened netCDF file.|
|statevec||A model state vector.|
|copyindex||Integer index of copy to be written.|
|timeindex||The timestep counter for the given state.|
|ierr||Returns 0 for normal completion.|
real(r8), dimension(:), intent(in) :: state real(r8), dimension(:), intent(out) :: pert_state logical, intent(out) :: interf_provided
Given a model state, produces a perturbed model state. This is used to generate initial ensemble conditions perturbed around some control trajectory state when one is preparing to spin-up ensembles. A DART compliant model can choose not to provide an implementation of this algorithm and use the default mechanism in DART by simply returning .false. as a returned value for the interf_provided argument. In this case, DART perturbs the state to generate ensemble members by adding a random sample from a N(0.0, 0.002) distribution independently to each state variable. Models should override this if some structure is required for perturbations or if the magnitude of perturbations in DART is too large. It is thus recommended to generate the initial ensemble off-line, perhaps with the tools provided in models/ROMS/PERTURB/3DVAR-COVAR.
|state||State vector to be perturbed.|
|pert_state||Perturbed state vector is returned.|
|interf_provided||Return false to have DART perturb state .|
type(get_close_type), intent(inout) :: gc real(r8), intent(in) :: maxdist
Pass-through to the 3-D sphere locations module. See get_close_maxdist_init() for the documentation of this subroutine.
type(get_close_type), intent(inout) :: gc integer, intent(in) :: num type(location_type), intent(in) :: obs(num)
Pass-through to the 3-D sphere locations module. See get_close_obs_init() for the documentation of this subroutine.
type(get_close_type), intent(in) :: gc type(location_type), intent(in) :: base_obs_loc integer, intent(in) :: base_obs_kind type(location_type), intent(in) :: obs(:) integer, intent(in) :: obs_kind(:) integer, intent(out) :: num_close integer, intent(out) :: close_ind(:) real(r8), optional, intent(out) :: dist(:)
Calls the 3-D sphere locations module to get a list of potentially close state vector points, and again for unassimilated observations. See get_close_obs() for the documentation of the locations module version of this code. Then, if vertical localization is enabled, this code converts all vertical locations to the selected vertical type (&model_nml::vert_localization_coord). It then computes a real 3D distance and returns it to the calling code.
real(r8), dimension(:), intent(in) :: ens_mean
A local copy is kept and used during other computations in the model_mod code.
|ens_mean||Ensemble mean state vector|
real(r8), dimension(:), intent(inout) :: x type(time_type), intent(in) :: time
This operation is not defined for the ROMS model. If called it will throw a fatal error.
|x||State vector of length model_size.|
|time||Gives time of the initial model state.|
Called when use of a model is completed to clean up storage, etc. A stub is provided for the ROMS model.
type(time_type), intent(in) :: i_time
Not supported for the ROMS model.
real(r8), dimension(:), intent(out) :: x
Not supported for the ROMS model. Will throw a fatal error if called.
|x||Model state vector.|
|num_moist_vars is too large||The maximum number of moist variable in ROMSV2.1 is 7|
|static_init_model||'Please put ROMSinput_d0'//idom//' in the work directory.'||One of the ROMSinput_d0# is missing in the work directory|
|static_init_model||Map projection no supported||Try PROJ_LATLON(0), PROJ_LC(1), PROJ_PS(2), PROJ_MERC(3)|
|Various NetCDF-f90 interface error messages||From one of the NetCDF calls in the named routine|
|get_state_meta_data||dart index out of range||Unlikely. Would indicate a serious bug in the code|
|wrong option for which_vert||See which_vert description in location/threed_sphere/location_mod.html|
|model_interpolate||'do not recognize obs kind ',obs_kind||See list in 'use obs_kind_mod' statement in model_mod.f90|
|get_ROMS_index||'Indices ',i,j,k,' exceed grid dimensions: ',#1,#2,#3||One of the grid indices exceeds the corresponding dimension for the var_type input. Unlikely to happen but would indicate a serious bug in the code|
|get_dist_ROMS||Unable to define vloc||The vertical location is below the model surface or above the model lid|
|nc_write_model_atts||Time dimension ID # must match Unlimited Dimension ID #||NetCDF file writing error|
|read_dt_from_ROMS_nml||Please put namelist.input in the work directory||The file namelist.input is missing in the work directory|
|read_dt_from_ROMS_nml||'max_dom in namelist.input = ',max_dom'num_domains in input.nml = ',num_domains'Make them consistent.'||The number of ROMS domains in namelist.input and in input.nml do not match|
Only the Lambert projection (MAP_PROJ = 1) is working. Other map projections (0=none, 2=polar, 3=Mercator) are likely to break the code.
none at this time
integer :: get_ROMS_index integer, intent(in) :: i,j,k,var_type,id
Given grid indices, variable type, and domain identification number, returns the index in the model state vector as an integer.
real(r8) :: get_dist_ROMS integer, intent(in) :: i,j,k,var_type,id type(location_type), intent(in) :: o_loc real(r8), dimension(:), intent(in) :: x
Given grid indices, variable type, and domain identification number, computes the distance to the observation at location o_loc.
integer, intent(in) :: i,j,var_type,id real(r8), intent(out) :: long, lat
Given horizontal grid indices, variable type, and domain identification number, returns the longitude and latitude in degrees.
real(r8), intent(in) :: x real(r8), intent(out) :: dx, dxm integer , intent(out) :: j
Given position x, find nearest grid point j (but smaller than or equal to x) and calculate its distance to grid j and j+1.
real(r8), intent(in) :: pres integer intent(in) :: n3 real(r8), dimension(0:n3), intent(in) :: mdl_v real(r8), intent(out) :: zk
Calculate the position zk on half (mass) levels in the profile mdl_v corresponding to pressure location pres.
real(r8), intent(in) :: obs_v integer intent(in) :: n3 real(r8), dimension(0:n3), intent(in) :: mdl_v real(r8), intent(out) :: zk
Calculate the position zk on half (mass) levels in the profile mdl_v corresponding to height location obs_v.
integer intent(in) :: i,j,n,id real(r8), intent(in) :: dx,dy,dxm,dym real(r8), dimension(:), intent(in) :: x real(r8), dimension(0:n), intent(out) :: v_p
Extract the pressure profile at position (i+dx, j+dy) on the non-staggered vertical grid (half (mass) levels).
real(r8), :: model_pressure integer intent(in) :: i,j,k,id,var_type real(r8), dimension(:), intent(in) :: x
Calculate the pressure at grid point (i,j,k), domain id. The grid is defined according to var_type.
real(r8) :: model_pressure_t integer intent(in) :: i,j,k,id real(r8), dimension(:), intent(in) :: x
Calculate the pressure at grid point (i,j,k), domain id, on mass point (half (mass) levels, T-point).
real(r8) :: model_rho_t integer intent(in) :: i,j,k,id real(r8), dimension(:), intent(in) :: x
Calculate the total density at grid point (i,j,k), domain id, on mass point (half (mass) levels, T-point).
integer intent(in) :: i,j,n,id real(r8), intent(in) :: dx,dy,dxm,dym real(r8), dimension(:), intent(in) :: x real(r8), dimension(n), intent(out) :: fld
Extract the height profile at position (i+dx, j+dy) on the non-staggered vertical grid.
real(r8) :: model_height integer intent(in) :: i,j,k,id,var_type real(r8), dimension(:), intent(in) :: x
Calculate the height at grid point (i,j,k), domain id. The grid is defined according to var_type.
Read the ROMS model time step from namelist.input for all domains.
|Contact:||Hui Liu, Glen Romine, Chris Synder, David Dowell|
|Revision:||$Revision: 11306 $|
|Source:||$URL: https://svn-dares-dart.cgd.ucar.edu/DART/releases/Manhattan/models/ROMS/model_mod.html $|
|Change Date:||$Date: 2017-03-14 14:20:57 -0600 (Tue, 14 Mar 2017) $|
|Change history:||try "svn log" or "svn diff"|