DART PROGRAM model_mod_check

DART project logo

Jump to DART Documentation Main Index
version information for this file:
$Id: model_mod_check.html 11626 2017-05-11 17:27:50Z nancy@ucar.edu $



The program model_mod_check allows you to run standalone tests for the fundamental routines in the POP model_mod. This is intended to be used when testing new functionality of POP model_mod. As such, this program is meant to be hacked up and customized to your own purpose. This check was derived from a previous mpas_atm model_mod_check and was written to test new functionality to the POP model_interpolate, for models that use the tripole grid.



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.

   dart_input_file       = 'dart_ics'
   output_file           = 'check_me'
   advance_time_present  = .FALSE.
   verbose               = .FALSE.
   test1thru             = 11
   loc_of_interest       = 320.0, 18.0, 5.0
   kind_of_interest      = 'QTY_U_CURRENT_COMPONENT'
   interp_test_lonrange  = 0.0, 359.0
   interp_test_dlon      = 1.0
   interp_test_latrange  = -89.0, 89.0
   interp_test_dlat      = 1.0
   interp_test_vertrange = 1000.0,  1005.0
   interp_test_dvert     = 2000.0
   interp_test_vertcoord = 'VERTISHEIGHT'

Item Type Description
dart_input_file character(len=256) Name of a file containing DART initial conditions for the model. This file can be produced by running pop_to_dart with a POP restart file.
output_file character(len=256) base portion of the name of the test netCDF file that will exercise the DART routines that create the true_state.nc, preassim.nc, and analysis.nc files. The proper file extension will be added.
advance_time_present logical Flag to indicate if the DART restart file has the advance time present in the file.
verbose logical Print extra info about the model_mod_check run.
test1thru integer An integer that defines which test you would like to run up to.
loc_of_interest real(r8), dimension(3) The lat/lon/level for a particular location. Tests the routine to find the closest gridpoint and a single interpolation.
kind_of_interest character(len=32) Since there are usually many state variables on the same grid, it may be useful to restrict the search for a location of interest to include a particular kind of state variable.
interp_test_latrange real(r8), dimension(2) Range of latitudes used for rigorous model_interpolate. Valid range is between -90.0 and 90.0.
interp_test_lonrange real(r8), dimension(2) Range of longitudes used for rigorous model_interpolate. Valid range is between 0.0 and 360.0.
interp_test_vertrange real(r8), dimension(2) Range of longitudes used for rigorous model_interpolate. Valid typically between 0 and 5000 (measured in meters), depending on the grid.
interp_test_dlon real(r8), dimension(2) Distance between longitudinal spacing for rigorous model_interpolate.
interp_test_dlat real(r8), dimension(2) Distance between latitudinal spacing for rigorous model_interpolate.
interp_test_dvert real(r8), dimension(2) Distance between vertical spacing for rigorous model_interpolate (measured in meters).







To be able to build and run model_mod_check, you will need to create a path_names_model_mod_check file with the following contents:

as well as a mkmf_model_mod_check script. You should be able to look at any other mkmf_xxxx script and figure out what to change. Once they exist:

[~/DART/models/POP/work] % csh mkmf_model_mod_check
[~/DART/models/POP/work] % make
[~/DART/models/POP/work] % ./model_mod_check

Unlike other DART components, you are expected to modify model_mod_check.f90 to suit your needs as you develop your model_mod. The code is roughly divided into the following categories:

Test #1 and Test #2: Initialization and Geometry Information

The first block of code in model_mod_check is intended to test the of the most basic routines, especially static_init_model - which generally sets the geometry of the grid, the number of state variables and their shape, etc. Virtually everything requires knowledge of the grid and state vector, so this block should never be skipped.

Test #3: Read/write restart files

This block of code tests restart_file_to_sv, which reads a POP restart file and converts it to a dart state vector. The state vector is then written out using awrite_state_restart which outputs the state vector to output_file.

Test #4: Read dart input file:

This block of code reads a dart_ics file into the state vector. The dart_ics file can be generated by running pop_to_dart on a POP restart file. This step is imperative for the interpolation tests.

Test #5: Check the netCDF routines used to create the diagnostic output files

This block happens after a call to aread_state_restart(), so, depending on what was in the restart file (presumably, once you get model_to_dart working, you have converted a real model state to a DART restart and are using that), you can fine-tune what gets put into the DART true_state.nc, preassim.nc, and analysis.nc diagnostic files. Only one ensemble member is needed to test the routines (hence the hardcoded 1 in the test block).

Test #6: Check the metadata

It is critical to return the correct metadata for any given index into the DART state vector. This code block tests the two most common features of the metadata. As a bonus, this routine is also quite useful to determine EXACTLY where to place your first test observation. If you test precisely at a grid location, you should be able to really get a handle on debugging your model_interpolate() routine.

Test #7: Find closest gridpoint

The find_closest_gridpoint() routine is designed to ensure that your variable layout is as you expect. "closest" in this context is close in the horizontal only - all vertical levels will be reported.

Test #8: Run a test single model interpolate at loc_of_interest

Test the interpolation value of a single point point at loc_of_interest, of kind, kind_of_interest. For POP models we can test QTY_U_CURRENT_COMPONENT and QTY_TEMPERATURE.

Test #9: Run a model interpolate on a range of points specified in the input.nml

Test a range of values of interpolation specified in input.nml. Only returns the number of sucessful interpolations. Interpolation locations that are over land are ignored (please see ERROR CODES and CONDITIONS). Two output files are produced output_file_interptest.nc and output_file_interptest.m where the interpolated values can be viewed.





The test_interpolate routine ignores interpolations that fail with ios_status = 1, and ios_status = 3. In the current implementation model_interpolate returns:

When testing new interpolation methods please make sure this is the desired behavior.
if (ios_out == 1 .or. ios_out == 3) then
   nland = nland + 1
else if (ios_out /= 0) then
  if (verbose) then
     write(string1,*) 'interpolation return code was', ios_out
     call error_handler(E_MSG,'test_interpolate',string1,source,revision,revdate,text2=string2)
  nfailed = nfailed + 1


none at this time


Terms of Use

DART software - Copyright UCAR. This open source software is provided by UCAR, "as is", without charge, subject to all terms of use at http://www.image.ucar.edu/DAReS/DART/DART_download

Contact: Jonathan Hendricks
Revision: $Revision: 11626 $
Source: $URL: https://svn-dares-dart.cgd.ucar.edu/DART/releases/Manhattan/models/POP/model_mod_check.html $
Change Date: $Date: 2017-05-11 11:27:50 -0600 (Thu, 11 May 2017) $
Change history:  try "svn log" or "svn diff"