130 likes | 213 Views
Changes to state, tend, and ptend in cam5_2_09. Cheryl Craig January 31, 2013. Rationale for changes. A number of groups would like to use sub-columns within the CAM grid columns infrastructure changes to CAM are required to allow flexibility for sub-columns
E N D
Changes to state, tend, and ptend in cam5_2_09 Cheryl Craig January 31, 2013
Rationale for changes • A number of groups would like to use sub-columns within the CAM grid columns • infrastructure changes to CAM are required to allow flexibility for sub-columns • cam5_2_09 contains infrastructure changes – will affect all CAM developers • Implementations of sub-columns – still to come
Infrastructure changes • Statically sized state, tend, and ptend did not allow for sub-columns • state, tend, and ptend now contain fields which are allocated (no longer hardwired to be dimensioned by pcols) • routines to allocate state, tend and ptend fields have been introduced • added additional fields to these structures
I don’t care about sub-columns in my physics module – what do I need to do? • All changes have been made in trunk code • For your branches/new development: • pcols/ncols – no need to change how you use them – no need to use the additional parameters in state • local copies of state, tend and ptend will need to be allocated/deallocated by you – more on this later • physics_ptend_init has changed its parameter list – more on this later
I want to use sub-columns now – what should I do? • cam5_2_09 is just changes to infrastructure • Implementing sub-columns is still a work-in-progress – not yet ready • Steve Goldhaber and I will be working on three different implementations utilizing sub-columns – we are working out the details now • Let us know you are interested – we would like to meet with you and make sure our design fits your needs
State/tend/ptend allocates • Fields inside structures no longer statically dimensioned to pcols– must now be allocated • Global state and tend are already allocated for you • For local copies – routines which allocate: • physics_state_alloc, physics_tend_alloc, physics_ptend_alloc– perform the actual allocates • physics_state_copy, physics_ptend_copy - allocate arrays inside structure and then copy all components • physics_ptend_init– allocates arrays specified and then resets all variables (more details next slide) • physics_ptend_sum – allocates fields which might not have been already allocated if needed for summing • Deallocate local copies with physics_state_dealloc and physics_tend_dealloc • ptend is automatically deallocated at end of physics_update)
SUB-COLUMN sub-columns ppgrid_parameters state_variables (each column is a grid location) X = sub-columns Loops over 1 to ncol do not change NO SUB-COLUMN Loops over 1 to ncol do not change
CAM column variables ppgridglobals • pcols – max # grid columns • psubcols – max # sub-columns/grid column state • psetcols – max # columns set (pcols*psubcols) or pcols – replacement for static pcols • ngrdcol= # active grid columns • nsubcol(pcols) - # active sub-columns/grid column • ncol - # active columns (sum of nsubcol) – meaning changes subtly • indcol(pcols*psubcols) – indices for mapping from sub-columns to grid columns tend and ptend • psetcols- max # columns set (pcols*psubcols) or pcols
physics_ptend_init • physics_ptend_init(ptend, psetcols, name, ls, lu, lv,lq(:)): • Now has new mandatory arguments: • psetcols - dimension of state variables (usually supply state%psetcols) • name of ptend– name is now required instead of setting later • Optional arguments: • ls,lu, lv and lq(:) – logicals • set the ptend flags • allocates appropriate data fields if true • lq is allocated to full lq(pcnst) even if only one element is true – individual lq(:) fields control use as usual • Note ls,lq,lu and lv need to be set before calling physics_ptend_init (not as the last thing before exiting modules as was done sometimes before)
Variable summary • pcols is still maximum number of grid columns • state%ncol is still the number of columns to loop over, but may be larger than pcols if using sub-columns • psubcols is the maximum number of sub-columns • state%psetcols is the maximum number of total columns • state%ngrdcols is the number of active grid columns (old definition of ncol) – used when mapping between grid and sub-columns
Summary of changes • state%psetcols and state%ncol: the generic way to refer to maximum number of columns whether using grid columns or sub-columns • global variables pcols and state%ncol: will only work with grid columns, but can still be used • if want your own copy of state/tend or ptend, allocation needs to be done before you can use these structures
sub-columns constituents_parameter state_variables pcols = 6 psubcols = 4 psetcols = 24 indcol(24) = (1,1,2,3,3,3,4,5,0,…) ngrdcol = 5 nsubcol(6) = (2,1,3,1,1,0) ncol= 8 (each column is a grid location) X = sub-columns pcols = 6 psubcols = 1 psetcols = 6 indcol(6) = (1,2,3,4,5,0) ngrdcol = 5 nsubcol(6) = (1,1,1,1,1,0) ncol= 5