[mpas-developers] COMMIT CHECK: Scratch Variables

Doug Jacobsen jacobsen.douglas at gmail.com
Thu Oct 11 15:05:56 MDT 2012


Hi All,

This is a commit check for two files which allow the addition of scratch
variables in mpas registry files. Just to explain how to use them a bit,
typical registry variable definitions look like this:
var persistent real    dvEdge ( nEdges ) 0 iro dvEdge mesh - -

where persistent means that the variable is allocated once on initialize,
persists throughout the run, and then is deallocated on finalize. The
proposed changes allow you to change persistent to scratch, in which case
the field is allocated on initialize but the % array pointer is not. Then
if you want to allocate/deallocate space for the scratch variable in the
middle of the run routines are provided from mpas_grid_types.F. These
routines are named

mpas_allocate_scratch_field
and
mpas_deallocate_scratch_field

As a template for these routines, both look like the following.
mpas_allocate_scratch_field1d_integer(f, single_block_in)

where f is a pointer for a field, and single_block_in is an optional
logical that allows the allocation of a single block or the entire block
list. If single_block_in is omitted or set to be false f is assumed to be
the field in the header block as opposed to a field pointer to any other
block. The same is true for the deallocate routine. The allocate and
deallocate routines only work on scratch variables with at least 1d (no 0d
integers or reals).

Some restrictions apply to scratch variables.
1) Scratch variables cannot exists within a super array. IE. No scratch
tracers/scalars.
2) Currently, registry doesn't allow single variable types. IE. if you
create a new type called scratch (domain % blocklist % scratch) it has to
have more than one variable.

This change is needed to explore some of the OpenMP, and hopefully at a
later time 2) in the restrictions list will get fixed.

Please let me know if anyone has questions or comments. If not I'll
probably commit it next wednesday.

Thanks,
Doug
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/mpas-developers/attachments/20121011/0cb88a3f/attachment-0001.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gen_inc.c
Type: text/x-csrc
Size: 156610 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/mpas-developers/attachments/20121011/0cb88a3f/attachment-0001.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mpas_grid_types.F
Type: application/octet-stream
Size: 35922 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/mpas-developers/attachments/20121011/0cb88a3f/attachment-0001.obj 


More information about the mpas-developers mailing list