namespace user_tracer_example

Overview

A sample tracer package that has striped initial conditions. More…

namespace user_tracer_example {

// global functions

logical function, public user_register_tracer_example(
    HI HI,
    GV GV,
    param_file param_file,
    CS CS,
    tr_Reg tr_Reg,
    restart_CS restart_CS
    );

subroutine, public user_initialize_tracer(
    restart restart,
    day day,
    G G,
    GV GV,
    h h,
    diag diag,
    OBC OBC,
    CS CS,
    sponge_CSp sponge_CSp
    );

subroutine, public tracer_column_physics(
    h_old h_old,
    h_new h_new,
    ea ea,
    eb eb,
    fluxes fluxes,
    dt dt,
    G G,
    GV GV,
    CS CS
    );

integer function, public user_tracer_stock(
    h h,
    stocks stocks,
    G G,
    GV GV,
    CS CS,
    names names,
    units units,
    stock_index stock_index
    );

subroutine, public user_tracer_surface_state(state state, h h, G G, CS CS);
subroutine, public user_tracer_example_end(CS CS);

} // namespace user_tracer_example

Detailed Documentation

A sample tracer package that has striped initial conditions.

Original by Robert Hallberg, 2002

This file contains an example of the code that is needed to set up and use a set (in this case one) of dynamically passive tracers.

A single subroutine is called from within each file to register each of the tracers for reinitialization and advection and to register the subroutine that initializes the tracers and set up their output and the subroutine that does any tracer physics or chemistry along with diapycnal mixing (included here because some tracers may float or swim vertically or dye diapycnal processes).

Global Functions

logical function, public user_register_tracer_example(
    HI HI,
    GV GV,
    param_file param_file,
    CS CS,
    tr_Reg tr_Reg,
    restart_CS restart_CS
    )

This subroutine is used to register tracer fields and subroutines to be used with MOM.

Parameters:

hi

A horizontal index type structure

gv

The ocean’s vertical grid structure

param_file

A structure to parse for run-time parameters

cs

A pointer that is set to point to the control structure for this module

tr_reg

A pointer that is set to point to the control structure for the tracer advection and diffusion module

restart_cs

A pointer to the restart control structure

subroutine, public user_initialize_tracer(
    restart restart,
    day day,
    G G,
    GV GV,
    h h,
    diag diag,
    OBC OBC,
    CS CS,
    sponge_CSp sponge_CSp
    )

This subroutine initializes the NTR tracer fields in tr(:,:,:,:) and it sets up the tracer output.

Parameters:

restart

.true. if the fields have already been read from a restart file.

day

Time of the start of the run.

g

The ocean’s grid structure

gv

The ocean’s vertical grid structure

h

Layer thicknesses [H ~> m or kg m-2]

diag

A structure that is used to regulate diagnostic output.

obc

This open boundary condition type specifies whether, where, and what open boundary conditions are used.

cs

The control structure returned by a previous call to USER_register_tracer_example.

sponge_csp

A pointer to the control structure for the sponges, if they are in use.

subroutine, public tracer_column_physics(
    h_old h_old,
    h_new h_new,
    ea ea,
    eb eb,
    fluxes fluxes,
    dt dt,
    G G,
    GV GV,
    CS CS
    )

This subroutine applies diapycnal diffusion and any other column tracer physics or chemistry to the tracers from this file. This is a simple example of a set of advected passive tracers. The arguments to this subroutine are redundant in that h_new(k) = h_old(k) + ea(k) - eb(k-1) + eb(k) - ea(k+1)

Parameters:

g

The ocean’s grid structure

gv

The ocean’s vertical grid structure

h_old

Layer thickness before entrainment [H ~> m or kg m-2].

h_new

Layer thickness after entrainment [H ~> m or kg m-2].

ea

an array to which the amount of fluid entrained

eb

an array to which the amount of fluid entrained

fluxes

A structure containing pointers to thermodynamic and tracer forcing fields. Unused fields have NULL ptrs.

dt

The amount of time covered by this call [s]

cs

The control structure returned by a previous call to USER_register_tracer_example.

integer function, public user_tracer_stock(
    h h,
    stocks stocks,
    G G,
    GV GV,
    CS CS,
    names names,
    units units,
    stock_index stock_index
    )

This function calculates the mass-weighted integral of all tracer stocks, returning the number of stocks it has calculated. If the stock_index is present, only the stock corresponding to that coded index is returned.

Parameters:

g

The ocean’s grid structure

gv

The ocean’s vertical grid structure

h

Layer thicknesses [H ~> m or kg m-2]

stocks

the mass-weighted integrated amount of each tracer, in kg times concentration units [kg conc].

cs

The control structure returned by a previous call to register_USER_tracer.

names

The names of the stocks calculated.

units

The units of the stocks calculated.

stock_index

The coded index of a specific stock being sought.

Returns:

Return value: the number of stocks calculated here.

subroutine, public user_tracer_surface_state(state state, h h, G G, CS CS)

This subroutine extracts the surface fields from this tracer package that are to be shared with the atmosphere in coupled configurations.

Parameters:

g

The ocean’s grid structure

state

A structure containing fields that describe the surface state of the ocean.

h

Layer thicknesses [H ~> m or kg m-2]

cs

The control structure returned by a previous call to register_USER_tracer.

subroutine, public user_tracer_example_end(CS CS)

Clean up allocated memory at the end.

Parameters:

cs

The control structure returned by a previous call to register_USER_tracer.