user_tracer_example module reference
A sample tracer package that has striped initial conditions.
Data Types
The control structure for the USER_tracer_example module. |
Functions/Subroutines
This subroutine is used to register tracer fields and subroutines to be used with MOM. |
|
This subroutine initializes the NTR tracer fields in tr(:,:,:,:) and it sets up the tracer output. |
|
This subroutine applies diapycnal diffusion and any other column tracer physics or chemistry to the tracers from this file. |
|
This function calculates the mass-weighted integral of all tracer stocks, returning the number of stocks it has calculated. |
|
This subroutine extracts the surface fields from this tracer package that are to be shared with the atmosphere in coupled configurations. |
|
Clean up allocated memory at the end. |
Detailed Description
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).
Type Documentation
- type user_tracer_example/user_tracer_example_cs
The control structure for the USER_tracer_example module.
- Type fields:
% coupled_tracers ::
logicalThese tracers are not offered to the coupler.% tracer_ic_file ::
character(len=200)The full path to the IC file, or “ “ to initialize internally.% time ::
type(time_type), pointerA pointer to the ocean model’s clock.% tr_reg ::
type(tracer_registry_type), pointerA pointer to the tracer registry.% tr ::
real, dimension(:,:,:,:), pointerThe array of tracers used in this subroutine, perhaps in [g kg-1]?% land_val ::
real, dimension(ntr)The value of tr that is used where land is masked out, perhaps in [g kg-1]?% stripe_width ::
realThe Gaussian width of the stripe in the initial condition for the tracer_example tracers [L ~> m].% stripe_lat ::
realThe central latitude of the stripe in the initial condition for the tracer_example tracers, in [degrees_N] or [km] or [m].% use_sponge ::
logicalIf true, sponges may be applied somewhere in the domain.% ind_tr ::
integer, dimension(ntr)Indices returned by atmos_ocn_coupler_flux if it is used and the surface tracer concentrations are to be provided to the coupler.% diag ::
type(diag_ctrl), pointerA structure that is used to regulate the timing of diagnostic output.% tr_desc ::
type(vardesc), dimension(ntr)Descriptions of each of the tracers.
Function/Subroutine Documentation
- function user_tracer_example/user_register_tracer_example(G, GV, US, param_file, CS, tr_Reg, restart_CS)
This subroutine is used to register tracer fields and subroutines to be used with MOM.
- Parameters:
g :: [in] The ocean’s grid structure
gv :: [in] The ocean’s vertical grid structure
us :: [in] A dimensional unit scaling type
param_file ::
param_file[in] A structure to parse for run-time parameterscs :: 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 :: [inout] MOM restart control struct
- Call to:
mom_error_handler::mom_errorntrmom_tracer_registry::register_tracermom_io::var_desc
- subroutine user_tracer_example/user_initialize_tracer(restart, day, G, GV, US, h, diag, OBC, CS, sponge_CSp)
This subroutine initializes the NTR tracer fields in tr(:,:,:,:) and it sets up the tracer output.
- Parameters:
restart ::
restart[in] .true. if the fields have already been read from a restart file.day ::
day[in] Time of the start of the run.g :: [in] The ocean’s grid structure
gv :: [in] The ocean’s vertical grid structure
us :: [in] A dimensional unit scaling type
h ::
h[in] Layer thicknesses [H ~> m or kg m-2]diag ::
diag[in] 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.
- Call to:
mom_error_handler::mom_errorntrmom_io::query_vardescmom_sponge::set_up_sponge_field
- subroutine user_tracer_example/tracer_column_physics(h_old, h_new, ea, eb, fluxes, dt, G, GV, US, 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 :: [in] The ocean’s grid structure
gv :: [in] The ocean’s vertical grid structure
h_old ::
h_old[in] Layer thickness before entrainment [H ~> m or kg m-2].h_new ::
h_new[in] Layer thickness after entrainment [H ~> m or kg m-2].ea ::
ea[in] an array to which the amount of fluid entrainedeb ::
eb[in] an array to which the amount of fluid entrainedfluxes ::
fluxes[in] A structure containing pointers to thermodynamic and tracer forcing fields. Unused fields have NULL ptrs.dt ::
dt[in] The amount of time covered by this call [T ~> s]us :: [in] A dimensional unit scaling type
cs :: The control structure returned by a previous call to USER_register_tracer_example.
- Call to:
ntr
- function user_tracer_example/user_tracer_stock(h, stocks, G, GV, CS, names, units, 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 :: [in] The ocean’s grid structure
gv :: [in] The ocean’s vertical grid structure
h ::
h[in] Layer thicknesses [H ~> m or kg m-2]stocks ::
stocks[out] 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 ::
names[out] The names of the stocks calculated.units ::
units[out] The units of the stocks calculated.stock_index ::
stock_index[in] The coded index of a specific stock being sought.
- Return:
undefined :: Return value: the number of stocks calculated here.
- Call to:
mom_spatial_means::global_mass_int_efpntrmom_io::query_vardesc
- subroutine user_tracer_example/user_tracer_surface_state(sfc_state, h, G, GV, CS)
This subroutine extracts the surface fields from this tracer package that are to be shared with the atmosphere in coupled configurations.
- Parameters:
g :: [in] The ocean’s grid structure
gv :: [in] The ocean’s vertical grid structure
sfc_state ::
sfc_state[inout] A structure containing fields that describe the surface state of the ocean.h ::
h[in] Layer thicknesses [H ~> m or kg m-2]cs :: The control structure returned by a previous call to register_USER_tracer.
- Call to:
- subroutine user_tracer_example/user_tracer_example_end(CS)
Clean up allocated memory at the end.
- Parameters:
cs :: The control structure returned by a previous call to register_USER_tracer.
- Called from: