Module ocean_blob_util_mod
OVERVIEW
This module contains subroutines that are common (or are likely to
need be common to future implementations) to some or all of the
various modules that run the Lagrangian blob scheme.
This module contains subroutines that are common (or may be common
in a future implementation) to some of the modules that make up the
blobs framework.
Some of the subroutines contained herein perform tasks such as
performing checksums, checking a linked lists for very small blobs
(and deleting them), inserting blobs into a list, a bunch of routines
for writing blob restart and history files, grid cell search algorithms,
buffer manipulations, computations etc.
The module has no namelist. All potential namelist variables are
controlled through the ocean_blob_mod namelist.
OTHER MODULES USED
constants_mod
fms_mod
mpp_domains_mod
mpp_mod
ocean_parameters_mod
ocean_types_mod
ocean_workspace_mod
PUBLIC INTERFACE
PUBLIC ROUTINES
-
blob_util_init
-
DESCRIPTION
-
Initialises this module.
-
blob_chksum
-
DESCRIPTION
-
Performs global sums and checksums for all blob types (for diagnostic
purposes).
-
lagrangian_system_chksum
-
DESCRIPTION
-
Performs checksums for the Lagrangian_system derived type. This is
the derived type that stores all of the "gridded" blob variables,
and is essential for the accounting required to interact with the
Eulerian model in a conservative manner. The checksums are for
diagnostic purposes.
-
E_and_L_totals
-
DESCRIPTION
-
Gives a brief summary of the total mass, volume and tracer content
of the E, L and total systems. Usually used for debuggin purposes.
-
write_blobs
-
DESCRIPTION
-
Dumps most of the information carried around by blobs, for all blobs
in a particular list. Useful for debugging.
-
blob_delete
-
DESCRIPTION
-
Deletes all (nearly) zero mass blob objects from the linked list.
The size of the blobs that are deleted is controlled by the variable
blob_small_mass in the ocean_blob_nml.
-
unlink_blob
-
DESCRIPTION
-
Unlinks a blob from a doubly linked list. It returns pointers to
the blob, the head of the list, the (formerly) previous blob in the
list and the (formerly) next blob in the list.
-
insert_blob
-
DESCRIPTION
-
Inserts a blob to the linked list. The relative order of blobs in
a linked list determines whether bitwise reproduction is possible.
Regardless of bitwise reproducability or not, we must ensure that
blobs always appear in the same relative order when we are using
dynamic blobs because if we have a situation where dztL>dztT, we
start destroying blobs to enforce dztL<dztT. In order that we do
not significantly change answers, we must always destroy the same
blob, regardless of domain decomposition, restarts, etc. So, we must
always sort blobs so they appear in the linked list in the same
relative order.
-
count_blob
-
DESCRIPTION
-
Allocates a blob its hash and a number. These two numbers can
uniquely identify any blob. The hash and number is based on the grid
cell of origin. Each grid cell has a unique hash. We have an array
which keeps track of the number of blobs formed in a grid cell. These
two numbers give the unique identifier. So, we also need to increment
the counter array.
-
put_att
-
DESCRIPTION
-
Writes an attribute to a netcdf file.
-
inq_var
-
DESCRIPTION
-
Gets the variable identifier from a netcdf file.
-
get_double
-
DESCRIPTION
-
Gets the value of a "double" variable from a netcdf file
-
get_int
-
DESCRIPTION
-
Gets the value of an integer variable from a netcdf file
-
put_double
-
DESCRIPTION
-
Writes the value of a "double" variable to a netcdf file
-
put_int
-
DESCRIPTION
-
Writes the value of an integer variable to a netcdf file
-
def_var
-
DESCRIPTION
-
Defines a netcdf variable
-
give_error_code
-
DESCRIPTION
-
Gives error descriptions for netcdf calls.
-
hashfun
-
DESCRIPTION
-
Calculates the hash
-
blob_util_end
-
DESCRIPTION
-
Does what is necessary to shut down the module.
-
check_ijcell
-
DESCRIPTION
-
Checks whether a blob (horizontally) resides in a grid cell or not.
If it does not it figures out which direction the blob is in and
checks the neighbouring grid cell, until it finds which grid cell
the blob resides in.
It uses a cross product technique from computational geometry
(Cormen et al., 2001).
-
check_kcell
-
DESCRIPTION
-
Searches for which (vertical) grid cell a blob resides in).
-
kill_blob
-
DESCRIPTION
-
Kills a blob by returning all of its remaining properties to the E
system.
-
free_blob_memory
-
DESCRIPTION
-
Frees the heap memory taken up by a blob.
-
allocate_interaction_memory
-
DESCRIPTION
-
Allocates the history arrays for a blob (only used when
bitwise_reproduction=.true. in the ocean_blob_nml).
-
reallocate_interaction_memory
-
DESCRIPTION
-
Different blobs can have different history memory requirements.
When they change from one type of blob to another, we need to change
the memory allocated to a blob to reflect the new requirements. This
is only necessary if bitwise_reproduction=.true. in the ocean_blob_nml.
-
interp_tcoeff
-
DESCRIPTION
-
Used for the horizontal interpolation of T grid variables. The
routine returns coefficients required for inverse distance
weighting (Shephard, 1968).
-
interp_ucoeff
-
DESCRIPTION
-
Used for the horizontal interpolation of U grid variables. The
routine returns coefficients required for inverse distance
weighting (Shephard, 1968).
-
check_cyclic
-
DESCRIPTION
-
Checks and adjusts blob position and grid cell index
for cylclic/periodic domains, as well as
the Murray (1996) tripolar grid.
REFERENCES
-
Cormen, T. H, Leiserson, C. E. Rivest, R. L., Stein, C. (2001) Introduction
to Algorithms. The MIT Press.
-
Shepard, D. (1968) A two-dimensional interpolation function for
irregularly-spaced data. In: Proceedings of the 1968 23rd ACM national
conference. ACM '68. ACM, New York, NY, USA, pp. 517-524.
-
Murray, R. J. (1996) Explicit generation of orthogonal grids for
ocean models. Journal of Computational Physics 126, 251-273.