source: (diagnostics.module.f90) [ c_92_rp1 release ]

Types Subroutines Functions Parameters Variables


This module provides a diagnostic object for Poseidon.

Diagnostics are used for two main purposes:

Within the model, quantities derived from the state but which do not need to be saved to the restart can be "diagnosed" when needed, and passed among routines. The ocean object contains a T_Diagnostics item, and this item is created when the ocean object is created. Other diagnostics objects may be created separately, for example, see poseidon_history_module

Diagnostics may be kept to enhance budgets, debug, or pass information between routines.

A diagnostic object is a collection of items that use optional arrays (see Optional_Array_Module ) for storage. The intent is to provide a rich (almost limitless) set of possible diagnostics, but without allocating lots of space that may not be used. For each diagnostic that one can imagine, some code is placed in the model to evaluate it, and an item is put in the T_Diagnostics object to hold its value. Each routine is typically called with the diagnostic object as a parameter.

The typical sequence in a supervisor is:

Type (T_Ocean) :: ocean call INIT_OCEAN( ..., ocean, ...) call CREATE_FORCING(oforce,...) call MarkDiagForHistory( ocean%diag, "Nu_v", .false.) call CREATE_OHIST(ocean, oforce, ohist, ocean%diag)

A diagnostic item will be computed typically under the test

if ( DiagnosticWanted( diag%item ) ) then ...

To set the wanted property, the MarkDiagWanted routine is provided. It may be used before or after creating the diagnostic.

Use of the key codes may set more than one diagnostic to wanted status. They are defined as public integer parameters. The current ones are:

dgWENT sets W_ent, Vert_Heat_Flux, Vert_Salt_Flux, Vert_U_Flux, Vert_V_Flux

dgVORTICITY sets Ave_Press_x, Ave_Press_y, Ave_Force_x, Ave_Force_y, Ave_Advct_x, Ave_Advct_y, Ave_Frict_x, Ave_Frict_y, Ext_Mass_eq

dgMASS_FLUX sets Uhtotal , Vhtotal ,BUtotal, BVtotal , UHctotal, VHctotal, Ext_Mass_Change, Int_Mass_Change

dgDIFFUSIVITY sets Ri, Kappa, Nu_u, Nu_v

dgKFLUX sets KFluxT, KFluxS, KFluxU, KFluxv

dgMIXEDL sets Qbuoy, Bpen, Target_depth, Entrainment, Pendepth, Penfrac ml_Shear_Prod (U3 and Qrad and Qsfc are already included through forcing)

dgWEZ sets W_z dgSST sets SST dgSSS sets SSS

If you want to disable one or more specific diagnostics, you can set its wanted property to false, and you can use Destroy_optional_array to free up its space after it has been created.
        call Create_diagnostics( ocean%g, ocean%diag, dgWENT+dgVORTICITY ) 
        ocean%diag%Ave_Advct_x%wanted = .false.
        call Destroy_optional_array( ocean%diag%Ave_Advct_x )
        call CREATE_OHIST...


1. Add the appropriate optional array to T_Diagnostics .

          type T_Diagnostics
           type (T_Optional_Array2) :: NewItem
          end type T_Diagnostics

2. Increment the Nscalars2 or Nscalars3 value to reflect the fact that an item will be added to one of the databases

3. Add lines to Initialize_diagnostics_db like

           d%scalars2(n)%Array        => d%NewItem
           d%scalars2(n)%Name         = "Newitem" 
           d%scalars2(n)%LongName     = "A long name for GrADS" 
           d%scalars2(n)%GRIB         = 99
           d%scalars2(n)%Units        = "m^2/s"
           d%scalars2(n)%Description  = "Some even longer name, if wanted" 

where n points to the space you added to Nscalars2 or Nscalars3 above.

4. Add code to the model that sets the diagnostic val property:

if ( diag%item%wanted ) diag%item%val(:,:) = Mystuff(:,:)


1. Add each of the items in the group as above.

2. Declare a public integer parameter (like dgNEW) and give it a value that is 2 times larger than the largest assigned so far.

3. Add a private integer array like igNEW, that contains the database indices of the items in the group. Use negative numbers for 3-D arrays, positive for 2-D

4. Add line to MarkDiagWanted3 and MarkDiagForHistory3 like

           if ( IS_IN(key,dgNEW) )   call SetWanted(Diag,igNEW,val )


It is intended that the diagnostic type will grow as more and more items get added. Since the space is only allocated when needed the addition of diagnostics should be done once, then kept around. Others will pay a very small penalty for having lots of un-used diagnostics.

Module Private:

Subroutines Functions Parameters Variables Use

Poseidon Ocean Model (Release: c_92_rp1 )
Documentation automation by Paul Schopf's DocFort Perl scripts.