MOM6
|
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).
Data Types | |
type | user_tracer_example_cs |
The control structure for the USER_tracer_example module. More... | |
Functions/Subroutines | |
logical function, public | user_register_tracer_example (HI, GV, param_file, CS, tr_Reg, restart_CS) |
This subroutine is used to register tracer fields and subroutines to be used with MOM. More... | |
subroutine, public | user_initialize_tracer (restart, day, G, GV, h, diag, OBC, CS, sponge_CSp) |
This subroutine initializes the NTR tracer fields in tr(:,:,:,:) and it sets up the tracer output. More... | |
subroutine, public | 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) More... | |
integer function, public | 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. More... | |
subroutine, public | user_tracer_surface_state (state, h, G, CS) |
This subroutine extracts the surface fields from this tracer package that are to be shared with the atmosphere in coupled configurations. More... | |
subroutine, public | user_tracer_example_end (CS) |
Clean up allocated memory at the end. More... | |
Variables | |
integer, parameter | ntr = 1 |
The number of tracers in this module. More... | |
subroutine, public user_tracer_example::tracer_column_physics | ( | real, dimension( g %isd: g %ied, g %jsd: g %jed, g %ke), intent(in) | h_old, |
real, dimension( g %isd: g %ied, g %jsd: g %jed, g %ke), intent(in) | h_new, | ||
real, dimension( g %isd: g %ied, g %jsd: g %jed, g %ke), intent(in) | ea, | ||
real, dimension( g %isd: g %ied, g %jsd: g %jed, g %ke), intent(in) | eb, | ||
type(forcing), intent(in) | fluxes, | ||
real, intent(in) | dt, | ||
type(ocean_grid_type), intent(in) | G, | ||
type(verticalgrid_type), intent(in) | GV, | ||
type(unit_scale_type), intent(in) | US, | ||
type(user_tracer_example_cs), pointer | 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)
[in] | g | The ocean's grid structure |
[in] | gv | The ocean's vertical grid structure |
[in] | h_old | Layer thickness before entrainment [H ~> m or kg m-2]. |
[in] | h_new | Layer thickness after entrainment [H ~> m or kg m-2]. |
[in] | ea | an array to which the amount of fluid entrained |
[in] | eb | an array to which the amount of fluid entrained |
[in] | fluxes | A structure containing pointers to thermodynamic and tracer forcing fields. Unused fields have NULL ptrs. |
[in] | dt | The amount of time covered by this call [T ~> s] |
[in] | us | A dimensional unit scaling type |
cs | The control structure returned by a previous call to USER_register_tracer_example. |
Definition at line 264 of file tracer_example.F90.
References ntr.
subroutine, public user_tracer_example::user_initialize_tracer | ( | logical, intent(in) | restart, |
type(time_type), intent(in), target | day, | ||
type(ocean_grid_type), intent(in) | G, | ||
type(verticalgrid_type), intent(in) | GV, | ||
real, dimension(szi_(g),szj_(g),szk_(g)), intent(in) | h, | ||
type(diag_ctrl), intent(in), target | diag, | ||
type(ocean_obc_type), pointer | OBC, | ||
type(user_tracer_example_cs), pointer | CS, | ||
type(sponge_cs), pointer | sponge_CSp | ||
) |
This subroutine initializes the NTR tracer fields in tr(:,:,:,:) and it sets up the tracer output.
[in] | restart | .true. if the fields have already been read from a restart file. |
[in] | day | Time of the start of the run. |
[in] | g | The ocean's grid structure |
[in] | gv | The ocean's vertical grid structure |
[in] | h | Layer thicknesses [H ~> m or kg m-2] |
[in] | 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. |
Definition at line 141 of file tracer_example.F90.
References mom_error_handler::mom_error(), ntr, mom_io::query_vardesc(), and mom_sponge::set_up_sponge_field().
logical function, public user_tracer_example::user_register_tracer_example | ( | type(hor_index_type), intent(in) | HI, |
type(verticalgrid_type), intent(in) | GV, | ||
type(param_file_type), intent(in) | param_file, | ||
type(user_tracer_example_cs), pointer | CS, | ||
type(tracer_registry_type), pointer | tr_Reg, | ||
type(mom_restart_cs), pointer | restart_CS | ||
) |
This subroutine is used to register tracer fields and subroutines to be used with MOM.
[in] | hi | A horizontal index type structure |
[in] | gv | The ocean's vertical grid structure |
[in] | 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 |
Definition at line 57 of file tracer_example.F90.
References atmos_ocean_fluxes_mod::aof_set_coupler_flux(), mom_error_handler::mom_error(), ntr, mom_tracer_registry::register_tracer(), and mom_io::var_desc().
subroutine, public user_tracer_example::user_tracer_example_end | ( | type(user_tracer_example_cs), pointer | CS | ) |
Clean up allocated memory at the end.
cs | The control structure returned by a previous call to register_USER_tracer. |
Definition at line 440 of file tracer_example.F90.
integer function, public user_tracer_example::user_tracer_stock | ( | real, dimension( g %isd: g %ied, g %jsd: g %jed, g %ke), intent(in) | h, |
real, dimension(:), intent(out) | stocks, | ||
type(ocean_grid_type), intent(in) | G, | ||
type(verticalgrid_type), intent(in) | GV, | ||
type(user_tracer_example_cs), pointer | CS, | ||
character(len=*), dimension(:), intent(out) | names, | ||
character(len=*), dimension(:), intent(out) | units, | ||
integer, intent(in), optional | 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.
[in] | g | The ocean's grid structure |
[in] | gv | The ocean's vertical grid structure |
[in] | h | Layer thicknesses [H ~> m or kg m-2] |
[out] | 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. | |
[out] | names | The names of the stocks calculated. |
[out] | units | The units of the stocks calculated. |
[in] | stock_index | The coded index of a specific stock being sought. |
Definition at line 363 of file tracer_example.F90.
References ntr, and mom_io::query_vardesc().
subroutine, public user_tracer_example::user_tracer_surface_state | ( | type(surface), intent(inout) | state, |
real, dimension(szi_(g),szj_(g),szk_(g)), intent(in) | h, | ||
type(ocean_grid_type), intent(in) | G, | ||
type(user_tracer_example_cs), pointer | CS | ||
) |
This subroutine extracts the surface fields from this tracer package that are to be shared with the atmosphere in coupled configurations.
[in] | g | The ocean's grid structure |
[in,out] | state | A structure containing fields that describe the surface state of the ocean. |
[in] | h | Layer thicknesses [H ~> m or kg m-2] |
cs | The control structure returned by a previous call to register_USER_tracer. |
Definition at line 409 of file tracer_example.F90.
References ntr.
|
private |
The number of tracers in this module.
Definition at line 32 of file tracer_example.F90.
Referenced by tracer_column_physics(), user_initialize_tracer(), user_register_tracer_example(), user_tracer_stock(), and user_tracer_surface_state().