diff --git a/scripts/ccpp_datafile.py b/scripts/ccpp_datafile.py index 9ceee5b8..2c546528 100755 --- a/scripts/ccpp_datafile.py +++ b/scripts/ccpp_datafile.py @@ -27,7 +27,7 @@ from metavar import Var from parse_tools import read_xml_file, write_xml_file from parse_tools import ParseContext, ParseSource -from suite_objects import VerticalLoop, Subcycle +from suite_objects import Subcycle # Global data _INDENT_STR = " " @@ -1094,9 +1094,6 @@ def _add_suite_object(parent, suite_object): if ptype: obj_elem.set("phase", ptype) # end if - if isinstance(suite_object, VerticalLoop): - obj_elem.set("dimension_name", suite_object.dimension_name) - # end if if isinstance(suite_object, Subcycle): obj_elem.set("loop", suite_object._loop) # end if diff --git a/scripts/suite_objects.py b/scripts/suite_objects.py index b1de44b8..1305953d 100755 --- a/scripts/suite_objects.py +++ b/scripts/suite_objects.py @@ -224,7 +224,6 @@ def __init__(self, name, context, parent, run_env, self.__call_list = None # end if self.__parts = list() - self.__needs_vertical = None self.__needs_horizontal = None self.__phase_type = phase_type # Initialize our dictionary @@ -239,11 +238,7 @@ def declarations(self): def add_part(self, item, replace=False): """Add an object (e.g., Scheme, Subcycle) to this SuiteObject. - If needs to be in a VerticalLoop, look for an appropriate - VerticalLoop object or create one. if is True, replace in its current position in self. - Note that if is not to be inserted in a VerticalLoop, - has no effect. """ if replace: if item in self.__parts: @@ -259,67 +254,9 @@ def add_part(self, item, replace=False): # end if index = len(self.__parts) # end if - # Does this item need to be in a VerticalLoop? - if item.needs_vertical is not None: - iparent = item.parent - if isinstance(self, VerticalLoop): - # It is being added to a VerticalLoop, call it good - pass - elif isinstance(iparent, VerticalLoop): - # Why are we doing this? - emsg = ('Trying to add {} {} to {} {} but it is already ' - 'in VerticalLoop {}') - raise ParseInternalError(emsg.format(item.__class__.__name__, - item.name, - self.__class__.__name__, - self.name, iparent.name)) - else: - pitem = iparent.part(-1, error=False) - added = False - if isinstance(pitem, VerticalLoop): - # Can we attach item to this loop? - if pitem.dimension_name == item.needs_vertical: - pitem.add_part(item) - if replace: - self.remove_part(index) - # end if (no else, we already added it) - added = True - # end if - # end if - if not added: - # Need to add item to a new VerticalLoop - # We are in the process of providing the vertical coord - vert_index = item.needs_vertical - item.needs_vertical = None - new_vl = VerticalLoop(vert_index, self.__context, - self, self.run_env, items=[item]) - if replace: - self.remove_part(index) - # end if (no else, adding the loop below) - self.__parts.insert(index, new_vl) - item.reset_parent(new_vl) - # end if - # end if - else: - # Just add - self.__parts.insert(index, item) - item.reset_parent(self) - # end if - - def remove_part(self, index): - """Remove the SuiteObject part at index""" - plen = len(self.__parts) - if (0 <= index < plen) or (abs(index) <= plen): - del self.__parts[index] - else: - errmsg = "Invalid index for remove_part, {}, ".format(index) - if plen > 0: - errmsg += "SuiteObject only has {} parts".format(plen) - else: - errmsg += "SuiteObject only has no parts" - # end if - raise ParseInternalError(errmsg, context=self.__context) - # end if + # Just add + self.__parts.insert(index, item) + item.reset_parent(self) def schemes(self): """Return a flattened list of schemes for this SuiteObject""" @@ -329,29 +266,6 @@ def schemes(self): # end for return schemes - def move_part(self, part, source_object, loc=-1): - """Operator to move from to . - If is -1, is appended to , - otherwise, is inserted at . - """ - if part in source_object.parts: - # Sanitize loc - try: - iloc = int(loc) - except ValueError: - errmsg = "Invalid loc value for move_part, {}".format(loc) - raise ParseInternalError(errmsg, context=self.__context) - # end try - if iloc == -1: - self.__parts.append(part) - else: - self.__parts.insert(iloc, part) - # end if - index = source_object.index(part) - source_object.remove_part(index) - # now has a new parent - part.reset_parent(self) - def reset_parent(self, new_parent): """Reset the parent of this SuiteObject (which has been moved)""" self.__parent = new_parent @@ -530,27 +444,6 @@ def add_variable_to_call_tree(self, var, vmatch=None, subst_dict=None): # end if return found_dims - def vert_dim_match(self, vloop_subst): - """If self is or is a part of a VerticalLoop object for - the substitute index for , return the substitute - loop index standard name, otherwise, return None. - """ - dim_match = None - parent = self - if len(vloop_subst.required_stdnames) != 1: - errmsg = 'vert_dim_match can only handle one substitute index' - raise ParseInternalError(errmsg) - # end if - index_dim = vloop_subst.required_stdnames[0] - while parent is not None: - if isinstance(parent, VerticalLoop) and (parent.name == index_dim): - dim_match = index_dim - break - # end if - parent = parent.parent - # end for - return dim_match - def horiz_dim_match(self, ndim, hdim, nloop_subst): """Find a match between and , if they are both horizontal dimensions. @@ -644,23 +537,20 @@ def match_dimensions(self, need_dims, have_dims): False, this string will contain information about the reason for the match failure. >>> SuiteObject('foo', _API_CONTEXT, None, _API_DUMMY_RUN_ENV).match_dimensions(['horizontal_loop_extent'], ['horizontal_loop_extent']) - (True, ['horizontal_loop_extent'], ['horizontal_loop_extent'], None, None, '') + (True, ['horizontal_loop_extent'], ['horizontal_loop_extent'], None, '') >>> SuiteObject('foo', _API_CONTEXT,None,_API_DUMMY_RUN_ENV,variables=[Var({'local_name':'beg','standard_name':'horizontal_loop_begin','units':'count','dimensions':'()','type':'integer'}, _API_LOCAL,_API_DUMMY_RUN_ENV),Var({'local_name':'end','standard_name':'horizontal_loop_end','units':'count','dimensions':'()','type':'integer'}, _API_LOCAL, _API_DUMMY_RUN_ENV)],active_call_list=True,phase_type='initialize').match_dimensions(['ccpp_constant_one:horizontal_loop_extent'], ['ccpp_constant_one:horizontal_dimension']) - (True, ['ccpp_constant_one:horizontal_dimension'], ['ccpp_constant_one:horizontal_dimension'], None, None, '') + (True, ['ccpp_constant_one:horizontal_dimension'], ['ccpp_constant_one:horizontal_dimension'], None, '') >>> SuiteObject('foo', _API_CONTEXT,None,_API_DUMMY_RUN_ENV,variables=[Var({'local_name':'beg','standard_name':'horizontal_loop_begin','units':'count','dimensions':'()','type':'integer'}, _API_LOCAL, _API_DUMMY_RUN_ENV),Var({'local_name':'end','standard_name':'horizontal_loop_end','units':'count','dimensions':'()','type':'integer'}, _API_LOCAL, _API_DUMMY_RUN_ENV)],active_call_list=True,phase_type=RUN_PHASE_NAME).match_dimensions(['ccpp_constant_one:horizontal_loop_extent'], ['horizontal_loop_begin:horizontal_loop_end']) - (True, ['horizontal_loop_begin:horizontal_loop_end'], ['horizontal_loop_begin:horizontal_loop_end'], None, None, '') - >>> SuiteObject('foo', _API_CONTEXT,None,_API_DUMMY_RUN_ENV,variables=[Var({'local_name':'beg','standard_name':'horizontal_loop_begin','units':'count','dimensions':'()','type':'integer'}, _API_LOCAL, _API_DUMMY_RUN_ENV),Var({'local_name':'end','standard_name':'horizontal_loop_end','units':'count','dimensions':'()','type':'integer'}, _API_LOCAL, _API_DUMMY_RUN_ENV),Var({'local_name':'lev','standard_name':'vertical_layer_dimension','units':'count','dimensions':'()','type':'integer'}, _API_LOCAL, _API_DUMMY_RUN_ENV)],active_call_list=True,phase_type=RUN_PHASE_NAME).match_dimensions(['ccpp_constant_one:horizontal_loop_extent'], ['horizontal_loop_begin:horizontal_loop_end','ccpp_constant_one:vertical_layer_dimension']) - (False, ['horizontal_loop_begin:horizontal_loop_end', 'vertical_layer_index'], ['horizontal_loop_begin:horizontal_loop_end', 'ccpp_constant_one:vertical_layer_dimension'], 'vertical_layer_index', None, 'missing vertical dimension') + (True, ['horizontal_loop_begin:horizontal_loop_end'], ['horizontal_loop_begin:horizontal_loop_end'], None, '') >>> SuiteObject('foo', _API_CONTEXT,None,_API_DUMMY_RUN_ENV,variables=[Var({'local_name':'beg','standard_name':'horizontal_loop_begin','units':'count','dimensions':'()','type':'integer'}, _API_LOCAL, _API_DUMMY_RUN_ENV),Var({'local_name':'end','standard_name':'horizontal_loop_end','units':'count','dimensions':'()','type':'integer'}, _API_LOCAL, _API_DUMMY_RUN_ENV),Var({'local_name':'lev','standard_name':'vertical_layer_dimension','units':'count','dimensions':'()','type':'integer'}, _API_LOCAL, _API_DUMMY_RUN_ENV)],active_call_list=True,phase_type=RUN_PHASE_NAME).match_dimensions(['ccpp_constant_one:horizontal_loop_extent','ccpp_constant_one:vertical_layer_dimension'], ['horizontal_loop_begin:horizontal_loop_end','ccpp_constant_one:vertical_layer_dimension']) - (True, ['horizontal_loop_begin:horizontal_loop_end', 'ccpp_constant_one:vertical_layer_dimension'], ['horizontal_loop_begin:horizontal_loop_end', 'ccpp_constant_one:vertical_layer_dimension'], None, None, '') + (True, ['horizontal_loop_begin:horizontal_loop_end', 'ccpp_constant_one:vertical_layer_dimension'], ['horizontal_loop_begin:horizontal_loop_end', 'ccpp_constant_one:vertical_layer_dimension'], None, '') >>> SuiteObject('foo', _API_CONTEXT,None,_API_DUMMY_RUN_ENV,variables=[Var({'local_name':'beg','standard_name':'horizontal_loop_begin','units':'count','dimensions':'()','type':'integer'}, _API_LOCAL, _API_DUMMY_RUN_ENV),Var({'local_name':'end','standard_name':'horizontal_loop_end','units':'count','dimensions':'()','type':'integer'}, _API_LOCAL, _API_DUMMY_RUN_ENV),Var({'local_name':'lev','standard_name':'vertical_layer_dimension','units':'count','dimensions':'()','type':'integer'}, _API_LOCAL, _API_DUMMY_RUN_ENV)],active_call_list=True,phase_type=RUN_PHASE_NAME).match_dimensions(['ccpp_constant_one:horizontal_loop_extent','ccpp_constant_one:vertical_layer_dimension'], ['ccpp_constant_one:vertical_layer_dimension','horizontal_loop_begin:horizontal_loop_end']) - (True, ['horizontal_loop_begin:horizontal_loop_end', 'ccpp_constant_one:vertical_layer_dimension'], ['ccpp_constant_one:vertical_layer_dimension', 'horizontal_loop_begin:horizontal_loop_end'], None, [1, 0], '') + (True, ['horizontal_loop_begin:horizontal_loop_end', 'ccpp_constant_one:vertical_layer_dimension'], ['ccpp_constant_one:vertical_layer_dimension', 'horizontal_loop_begin:horizontal_loop_end'], [1, 0], '') """ new_need_dims = [] new_have_dims = list(have_dims) perm = [] match = True - missing_vert_dim = None reason = '' nlen = len(need_dims) hlen = len(have_dims) @@ -720,66 +610,17 @@ def match_dimensions(self, need_dims, have_dims): break # end if (no else, we are still okay) # end for - # Find a missing vertical dimension index, if necessary - if nvdim_index < 0 <= hvdim_index: - # We need to make a substitution for the vertical - # coordinate in have_dims - vvmatch = VarDictionary.loop_var_match(have_dims[hvdim_index]) - if vvmatch: - vmatch_dims = ':'.join(vvmatch.required_stdnames) - # See if the missing vertical dimensions exist - missing_vert_dim = None - for mstdname in vvmatch.required_stdnames: - mvdim = self.find_variable(standard_name=mstdname, - any_scope=True) - if not mvdim: - missing_vert_dim = vmatch_dims - match = False # Should trigger vertical loop action - reason = 'missing vertical dimension' - break - # end if - # end for - # While we have a missing vertical dimension which has been - # created, do NOT enter the substitution into have_dims. - # The supplied variable still has a vertical dimension. - # On the other hand, we *do* need to add the new vertical - # loop index to new_need_dims. Try to put it in the correct - # place for easy calling from the existing variable. - # Also update perm to match the array access - if hvdim_index < len(new_need_dims): - # Insert the vertical loop dimension - if hvdim_index > 0: - before = new_need_dims[0:hvdim_index] - perm_before = perm[0:hvdim_index] - else: - before = [] - perm_before = [] - # end if - after = new_need_dims[hvdim_index:] - new_need_dims = before + [vmatch_dims] + after - perm = perm_before + [hvdim_index] + perm[hvdim_index:] - else: - new_need_dims.append(vmatch_dims) - perm.append(hvdim_index) - # end if - else: - emsg = "Unknown vertical dimension dimension, '{}'" - raise CCPPError(emsg.format(have_dims[hvdim_index])) - # end if - else: - missing_vert_dim = None - # end if perm_test = list(range(hlen)) # If no permutation is found, reset to None if perm == perm_test: perm = None - elif (not match) and (missing_vert_dim is None): + elif (not match): perm = None # end if (else, return perm as is) if new_have_dims == have_dims: have_dims = None # Do not make any substitutions # end if - return match, new_need_dims, new_have_dims, missing_vert_dim, perm, reason + return match, new_need_dims, new_have_dims, perm, reason def find_variable(self, standard_name=None, source_var=None, any_scope=True, clone=None, @@ -845,7 +686,6 @@ def match_variable(self, var, run_env): found_var: True if a match was found vert_dim: The vertical dimension in , or None call_dims: How this variable should be called (or None if no match) - missing_vert: Vertical dim in parent but not in perm: Permutation (XXgoldyXX: Not yet implemented) """ vstdname = var.get_prop_value('standard_name') @@ -857,7 +697,6 @@ def match_variable(self, var, run_env): # end if found_var = False - missing_vert = None new_vdims = list() var_vdim = var.has_vertical_dimension(dims=vdims) compat_obj = None @@ -866,7 +705,7 @@ def match_variable(self, var, run_env): if self.phase() == 'register': found_var = True new_vdims = [':'] - return found_var, dict_var, var_vdim, new_vdims, missing_vert, compat_obj + return found_var, dict_var, var_vdim, new_vdims, compat_obj else: errmsg = "Variables of type ccpp_constituent_properties_t only allowed in register phase: " sname = var.get_prop_value('standard_name') @@ -894,7 +733,7 @@ def match_variable(self, var, run_env): dict_dims = dict_var.get_dimensions() if vdims: args = self.parent.match_dimensions(vdims, dict_dims) - match, new_vdims, new_dict_dims, missing_vert, perm, err = args + match, new_vdims, new_dict_dims, perm, err = args if perm is not None: errmsg = "Permuted indices are not yet supported" lname = var.get_prop_value('local_name') @@ -929,15 +768,12 @@ def match_variable(self, var, run_env): subst_dict=sdict) if not match: found_var = False - if not missing_vert: - nctx = context_string(var.context) - nname = var.get_prop_value('local_name') - hctx = context_string(dict_var.context) - hname = dict_var.get_prop_value('local_name') - raise CCPPError(err.format(nname=nname, nctx=nctx, - hname=hname, hctx=hctx)) - # end if - # end if + nctx = context_string(var.context) + nname = var.get_prop_value('local_name') + hctx = context_string(dict_var.context) + hname = dict_var.get_prop_value('local_name') + raise CCPPError(err.format(nname=nname, nctx=nctx, + hname=hname, hctx=hctx)) # end if # end if # We have a match! @@ -948,7 +784,7 @@ def match_variable(self, var, run_env): dict_var = self.parent.find_variable(source_var=var, any_scope=True) compat_obj = var.compatible(dict_var, run_env) # end if - return found_var, dict_var, var_vdim, new_vdims, missing_vert, compat_obj + return found_var, dict_var, var_vdim, new_vdims, compat_obj def in_process_split(self): """Find out if we are in a process-split region""" @@ -1033,27 +869,6 @@ def parts(self): processing of the return value""" return self.__parts[:] - @property - def needs_vertical(self): - """Return the vertical dimension this SuiteObject is missing or None""" - return self.__needs_vertical - - @needs_vertical.setter - def needs_vertical(self, value): - """Reset the missing vertical dimension of this SuiteObject""" - if value is None: - self.__needs_vertical = value - elif self.__needs_vertical is not None: - if self.__needs_vertical != value: - errmsg = ('Attempt to change missing vertical dimension ' - 'from {} to {}') - raise ParseInternalError(errmsg.format(self.__needs_vertical, - value)) - # end if (no else, value is already correct) - else: - self.__needs_vertical = value - # end if - @property def context(self): """Return the context of this SuiteObject""" @@ -1207,7 +1022,7 @@ def analyze(self, phase, group, scheme_library, suite_vars, level): vdims = var.get_dimensions() vintent = var.get_prop_value('intent') args = self.match_variable(var, self.run_env) - found, dict_var, vert_dim, new_dims, missing_vert, compat_obj = args + found, dict_var, vert_dim, new_dims, compat_obj = args if found: if self.__group.run_env.debug: # Add variable allocation checks for group, suite and host variables @@ -1228,11 +1043,6 @@ def analyze(self, phase, group, scheme_library, suite_vars, level): self.update_group_call_list_variable(clone) # end if else: - if missing_vert is not None: - # This Scheme needs to be in a VerticalLoop - self.needs_vertical = missing_vert - break # Deal with this and come back - # end if if vintent == 'out': if self.__group is None: errmsg = 'Group not defined for {}'.format(self.name) @@ -1285,14 +1095,6 @@ def analyze(self, phase, group, scheme_library, suite_vars, level): # end if # end for - if self.needs_vertical is not None: - self.parent.add_part(self, replace=True) # Should add a vloop - if isinstance(self.parent, VerticalLoop): - # Restart the loop analysis - scheme_mods = self.parent.analyze(phase, group, scheme_library, - suite_vars, level) - # end if - # end if return scheme_mods def add_var_debug_check(self, var): @@ -1938,104 +1740,6 @@ def __str__(self): ############################################################################### -class VerticalLoop(SuiteObject): - """Class to call a group of schemes or scheme collections in a - loop over a vertical dimension.""" - - def __init__(self, index_name, context, parent, run_env, items=None): - """ is the standard name of the variable holding the - number of iterations (e.g., vertical_layer_dimension).""" - # self._dim_name is the standard name for the number of iterations - self._dim_name = VarDictionary.find_loop_dim_from_index(index_name) - if self._dim_name is None: - errmsg = 'No VerticalLoop dimension name for index = {}' - raise ParseInternalError(errmsg.format(index_name)) - # end if - if ':' in self._dim_name: - dims = self._dim_name.split(':') - if not dims[1]: - errmsg = 'Invalid loop dimension, {}' - raise ParseInternalError(errmsg.format(self._dim_name)) - # end if - self._dim_name = dims[1] - # end if - # self._local_dim_name is the variable name for self._dim_name - self._local_dim_name = None - super().__init__(index_name, context, parent, run_env) - if run_env.verbose: - lmsg = "Adding VerticalLoop for '{}'" - run_env.logger.debug(lmsg.format(index_name)) - # end if - # Add any items - if not isinstance(items, list): - if items is None: - items = list() - else: - items = [items] - # end if - # end if - for item in items: - self.add_part(item) - # end for - - def analyze(self, phase, group, scheme_library, suite_vars, level): - """Analyze the VerticalLoop's interface to prepare for writing""" - # Handle all the suite objects inside of this subcycle - scheme_mods = set() - # Create a variable for the loop index - newvar = Var({'local_name':self.name, 'standard_name':self.name, - 'type':'integer', 'units':'count', 'dimensions':'()'}, - _API_LOCAL, self.run_env) - # The Group will manage this variable - group.manage_variable(newvar) - # Find the loop-extent variable - dim_name = self._dim_name - local_dim = group.find_variable(standard_name=dim_name, any_scope=False) - if local_dim is None: - local_dim = group.call_list.find_variable(standard_name=dim_name, - any_scope=False) - # end if - # If not found, check the suite level - if local_dim is None: - local_dim = group.suite.find_variable(standard_name=dim_name) - # end if - if local_dim is None: - emsg = 'No variable found for vertical loop dimension {}' - raise ParseInternalError(emsg.format(self._dim_name)) - # end if - self._local_dim_name = local_dim.get_prop_value('local_name') - emsg = "VerticalLoop local name for '{}'".format(self.name) - emsg += " is '{}".format(self.dimension_name) - if self.run_env.logger: - self.run_env.logger.debug(emsg) - # end if - # Analyze our internal items - for item in self.parts: - smods = item.analyze(phase, group, scheme_library, - suite_vars, level+1) - for smod in smods: - scheme_mods.add(smod) - # end for - # end for - return scheme_mods - - def write(self, outfile, errcode, errmsg, indent): - """Write code for the vertical loop, including contents, to """ - outfile.write('do {} = 1, {}'.format(self.name, self.dimension_name), - indent) - # Note that 'scheme' may be a sybcycle or other construct - for item in self.parts: - item.write(outfile, errcode, errmsg, indent+1) - # end for - outfile.write('end do', 2) - - @property - def dimension_name(self): - """Return the vertical dimension over which this VerticalLoop loops""" - return self._local_dim_name - -############################################################################### - class Subcycle(SuiteObject): """Class to represent a subcycled group of schemes or scheme collections""" diff --git a/test/capgen_test/temp_adjust.F90 b/test/capgen_test/temp_adjust.F90 index c25d087b..35c951e0 100644 --- a/test/capgen_test/temp_adjust.F90 +++ b/test/capgen_test/temp_adjust.F90 @@ -39,13 +39,13 @@ subroutine temp_adjust_run(foo, timestep, interstitial_var, temp_prev, temp_laye integer, intent(in) :: foo real(kind=kind_phys), intent(in) :: timestep - real(kind=kind_phys), intent(inout), optional :: qv(:) + real(kind=kind_phys), intent(inout), optional :: qv(:, :) real(kind=kind_phys), intent(inout) :: ps(:) ! codee format off - REAL(kind_phys), intent(in) :: temp_prev(:) - REAL(kind_phys), intent(inout) :: temp_layer(foo) + REAL(kind_phys), intent(in) :: temp_prev(:,:) + REAL(kind_phys), intent(inout) :: temp_layer(:,:) ! codee format on - real(kind=kind_temp), intent(in) :: to_promote(:) + real(kind=kind_temp), intent(in) :: to_promote(:, :) real(kind=kind_phys), intent(in) :: promote_pcnst(:) integer, intent(out) :: interstitial_var(:) character(len=512), intent(out) :: errmsg @@ -73,8 +73,8 @@ subroutine temp_adjust_run(foo, timestep, interstitial_var, temp_prev, temp_laye end if do col_index = 1, foo - temp_layer(col_index) = temp_layer(col_index) + temp_prev(col_index) - if (present(qv)) qv(col_index) = qv(col_index) + 1.0_kind_phys + temp_layer(col_index, :) = temp_layer(col_index, :) + temp_prev(col_index, :) + if (present(qv)) qv(col_index, :) = qv(col_index, :) + 1.0_kind_phys end do if (present(innie) .and. present(outie) .and. present(optsie)) then outie = innie * optsie diff --git a/test/capgen_test/temp_adjust.meta b/test/capgen_test/temp_adjust.meta index 8acb05ce..63e7fcc1 100644 --- a/test/capgen_test/temp_adjust.meta +++ b/test/capgen_test/temp_adjust.meta @@ -54,14 +54,14 @@ [ temp_prev ] standard_name = potential_temperature_at_previous_timestep units = K - dimensions = (horizontal_loop_extent) + dimensions = (horizontal_loop_extent, vertical_layer_dimension) type = real kind = kind_phys intent = in [ temp_layer ] standard_name = potential_temperature units = K - dimensions = (horizontal_loop_extent) + dimensions = (horizontal_loop_extent, vertical_layer_dimension) type = real kind = kind_phys intent = inout @@ -69,7 +69,7 @@ [ qv ] standard_name = water_vapor_specific_humidity units = kg kg-1 - dimensions = (horizontal_loop_extent) + dimensions = (horizontal_loop_extent, vertical_layer_dimension) type = real kind = kind_phys intent = inout @@ -86,7 +86,7 @@ [ to_promote ] standard_name = promote_this_variable_to_suite units = K - dimensions = (horizontal_loop_extent) + dimensions = (horizontal_loop_extent, vertical_layer_dimension) type = real kind = kind_temp intent = in diff --git a/test/capgen_test/temp_calc_adjust.F90 b/test/capgen_test/temp_calc_adjust.F90 index cee0703f..7c423669 100644 --- a/test/capgen_test/temp_calc_adjust.F90 +++ b/test/capgen_test/temp_calc_adjust.F90 @@ -39,7 +39,7 @@ subroutine temp_calc_adjust_run(nbox, timestep, temp_level, temp_calc, & integer, intent(in) :: nbox real(kind=kind_phys), intent(in) :: timestep real(kind=kind_phys), intent(in) :: temp_level(:, :) - real(kind=kind_phys), intent(out) :: temp_calc(:) + real(kind=kind_phys), intent(out) :: temp_calc(:, :) character(len=512), intent(out) :: errmsg integer, intent(out) :: errflg !---------------------------------------------------------------- diff --git a/test/capgen_test/temp_calc_adjust.meta b/test/capgen_test/temp_calc_adjust.meta index e014fb6e..f795da63 100644 --- a/test/capgen_test/temp_calc_adjust.meta +++ b/test/capgen_test/temp_calc_adjust.meta @@ -54,7 +54,7 @@ [ temp_calc ] standard_name = potential_temperature_at_previous_timestep units = K - dimensions = (horizontal_loop_extent) + dimensions = (horizontal_loop_extent, vertical_layer_dimension) type = real kind = kind_phys intent = out diff --git a/test/ddthost_test/temp_adjust.F90 b/test/ddthost_test/temp_adjust.F90 index 0458292c..4ef3655d 100644 --- a/test/ddthost_test/temp_adjust.F90 +++ b/test/ddthost_test/temp_adjust.F90 @@ -17,22 +17,22 @@ module temp_adjust !> \section arg_table_temp_adjust_run Argument Table !! \htmlinclude arg_table_temp_adjust_run.html !! - subroutine temp_adjust_run(foo, timestep, temp_prev, temp_layer, qv, ps, & - to_promote, promote_pcnst, errmsg, errflg, innie, outie, optsie) - - integer, intent(in) :: foo - real(kind_phys), intent(in) :: timestep - real(kind_phys), intent(inout),optional :: qv(:) - real(kind_phys), intent(inout) :: ps(:) - real(kind_phys), intent(in) :: temp_prev(:) - real(kind_phys), intent(inout) :: temp_layer(foo) - real(kind_phys), intent(in) :: to_promote(:) - real(kind_phys), intent(in) :: promote_pcnst(:) - character(len=512), intent(out) :: errmsg - integer, intent(out) :: errflg - real(kind_phys), optional, intent(in) :: innie - real(kind_phys), optional, intent(out) :: outie - real(kind_phys), optional, intent(inout) :: optsie + subroutine temp_adjust_run(foo, timestep, temp_prev, temp_layer, qv, ps, & + to_promote, promote_pcnst, errmsg, errflg, innie, outie, optsie) + + integer, intent(in) :: foo + real(kind=kind_phys), intent(in) :: timestep + real(kind=kind_phys), intent(inout), optional :: qv(:, :) + real(kind=kind_phys), intent(inout) :: ps(:) + real(kind=kind_phys), intent(in) :: temp_prev(:, :) + real(kind=kind_phys), intent(inout) :: temp_layer(:, :) + real(kind=kind_phys), intent(in) :: to_promote(:, :) + real(kind=kind_phys), intent(in) :: promote_pcnst(:) + character(len=512), intent(out) :: errmsg + integer, intent(out) :: errflg + real(kind=kind_phys), optional, intent(in) :: innie + real(kind=kind_phys), optional, intent(out) :: outie + real(kind=kind_phys), optional, intent(inout) :: optsie !---------------------------------------------------------------- integer :: col_index @@ -41,12 +41,12 @@ subroutine temp_adjust_run(foo, timestep, temp_prev, temp_layer, qv, ps, & errflg = 0 do col_index = 1, foo - temp_layer(col_index) = temp_layer(col_index) + temp_prev(col_index) - if (present(qv)) qv(col_index) = qv(col_index) + 1.0_kind_phys + temp_layer(col_index, :) = temp_layer(col_index, :) + temp_prev(col_index, :) + if (present(qv)) qv(col_index, :) = qv(col_index, :) + 1.0_kind_phys end do if (present(innie) .and. present(outie) .and. present(optsie)) then - outie = innie * optsie - optsie = optsie + 1.0_kind_phys + outie = innie * optsie + optsie = optsie + 1.0_kind_phys end if end subroutine temp_adjust_run @@ -54,10 +54,10 @@ end subroutine temp_adjust_run !> \section arg_table_temp_adjust_init Argument Table !! \htmlinclude arg_table_temp_adjust_init.html !! - subroutine temp_adjust_init (errmsg, errflg) + subroutine temp_adjust_init(errmsg, errflg) - character(len=512), intent(out) :: errmsg - integer, intent(out) :: errflg + character(len=512), intent(out) :: errmsg + integer, intent(out) :: errflg ! This routine currently does nothing @@ -69,10 +69,10 @@ end subroutine temp_adjust_init !> \section arg_table_temp_adjust_finalize Argument Table !! \htmlinclude arg_table_temp_adjust_finalize.html !! - subroutine temp_adjust_finalize (errmsg, errflg) + subroutine temp_adjust_finalize(errmsg, errflg) - character(len=512), intent(out) :: errmsg - integer, intent(out) :: errflg + character(len=512), intent(out) :: errmsg + integer, intent(out) :: errflg ! This routine currently does nothing diff --git a/test/ddthost_test/temp_adjust.meta b/test/ddthost_test/temp_adjust.meta index c7e1ab43..a67cef8a 100644 --- a/test/ddthost_test/temp_adjust.meta +++ b/test/ddthost_test/temp_adjust.meta @@ -23,14 +23,14 @@ [ temp_prev ] standard_name = potential_temperature_at_previous_timestep units = K - dimensions = (horizontal_loop_extent) + dimensions = (horizontal_loop_extent, vertical_layer_dimension) type = real kind = kind_phys intent = in [ temp_layer ] standard_name = potential_temperature units = K - dimensions = (horizontal_loop_extent) + dimensions = (horizontal_loop_extent, vertical_layer_dimension) type = real kind = kind_phys intent = inout @@ -38,7 +38,7 @@ [ qv ] standard_name = water_vapor_specific_humidity units = kg kg-1 - dimensions = (horizontal_loop_extent) + dimensions = (horizontal_loop_extent, vertical_layer_dimension) type = real kind = kind_phys intent = inout @@ -55,7 +55,7 @@ [ to_promote ] standard_name = promote_this_variable_to_suite units = K - dimensions = (horizontal_loop_extent) + dimensions = (horizontal_loop_extent, vertical_layer_dimension) type = real kind = kind_phys intent = in diff --git a/test/ddthost_test/temp_calc_adjust.F90 b/test/ddthost_test/temp_calc_adjust.F90 index 941286e8..4c2d7ece 100644 --- a/test/ddthost_test/temp_calc_adjust.F90 +++ b/test/ddthost_test/temp_calc_adjust.F90 @@ -3,93 +3,93 @@ module temp_calc_adjust - use ccpp_kinds, only: kind_phys + use ccpp_kinds, only: kind_phys - implicit none - private + implicit none + private - public :: temp_calc_adjust_init - public :: temp_calc_adjust_run - public :: temp_calc_adjust_finalize + public :: temp_calc_adjust_init + public :: temp_calc_adjust_run + public :: temp_calc_adjust_finalize contains - !> \section arg_table_temp_calc_adjust_run Argument Table - !! \htmlinclude arg_table_temp_calc_adjust_run.html - !! - subroutine temp_calc_adjust_run(nbox, timestep, temp_level, temp_calc, & - errmsg, errflg) + !> \section arg_table_temp_calc_adjust_run Argument Table + !! \htmlinclude arg_table_temp_calc_adjust_run.html + !! + subroutine temp_calc_adjust_run(nbox, timestep, temp_level, temp_calc, & + errmsg, errflg) - integer, intent(in) :: nbox - real(kind_phys), intent(in) :: timestep - real(kind_phys), intent(in) :: temp_level(:,:) - real(kind_phys), intent(out) :: temp_calc(:) - character(len=512), intent(out) :: errmsg - integer, intent(out) :: errflg - !---------------------------------------------------------------- + integer, intent(in) :: nbox + real(kind=kind_phys), intent(in) :: timestep + real(kind=kind_phys), intent(in) :: temp_level(:, :) + real(kind=kind_phys), intent(out) :: temp_calc(:, :) + character(len=512), intent(out) :: errmsg + integer, intent(out) :: errflg + !---------------------------------------------------------------- - integer :: col_index - real(kind_phys) :: bar = 1.0_kind_phys + integer :: col_index + real(kind=kind_phys) :: bar = 1.0_kind_phys - errmsg = '' - errflg = 0 + errmsg = '' + errflg = 0 - call temp_calc_adjust_nested_subroutine(temp_calc) - if (check_foo()) then - call foo(bar) - end if + call temp_calc_adjust_nested_subroutine(temp_calc) + if (check_foo()) then + call foo(bar) + end if - contains + contains - elemental subroutine temp_calc_adjust_nested_subroutine(temp) + elemental subroutine temp_calc_adjust_nested_subroutine(temp) - real(kind_phys), intent(out) :: temp - !------------------------------------------------------------- + real(kind=kind_phys), intent(out) :: temp + !------------------------------------------------------------- - temp = 1.0_kind_phys + temp = 1.0_kind_phys - end subroutine temp_calc_adjust_nested_subroutine + end subroutine temp_calc_adjust_nested_subroutine - subroutine foo(bar) - real(kind_phys), intent(inout) :: bar - bar = bar + 1.0_kind_phys + subroutine foo(bar) + real(kind=kind_phys), intent(inout) :: bar + bar = bar + 1.0_kind_phys - end subroutine + end subroutine foo - logical function check_foo() - check_foo = .true. - end function check_foo + logical function check_foo() + check_foo = .true. + end function check_foo - end subroutine + end subroutine temp_calc_adjust_run - !> \section arg_table_temp_calc_adjust_init Argument Table - !! \htmlinclude arg_table_temp_calc_adjust_init.html - !! - subroutine temp_calc_adjust_init (errmsg, errflg) + !> \section arg_table_temp_calc_adjust_init Argument Table + !! \htmlinclude arg_table_temp_calc_adjust_init.html + !! + subroutine temp_calc_adjust_init(errmsg, errflg) - character(len=512), intent(out) :: errmsg - integer, intent(out) :: errflg + character(len=512), intent(out) :: errmsg + integer, intent(out) :: errflg - ! This routine currently does nothing + ! This routine currently does nothing - errmsg = '' - errflg = 0 + errmsg = '' + errflg = 0 - end subroutine temp_calc_adjust_init + end subroutine temp_calc_adjust_init - !> \section arg_table_temp_calc_adjust_finalize Argument Table - !! \htmlinclude arg_table_temp_calc_adjust_finalize.html - !! - subroutine temp_calc_adjust_finalize (errmsg, errflg) + !> \section arg_table_temp_calc_adjust_finalize Argument Table + !! \htmlinclude arg_table_temp_calc_adjust_finalize.html + !! + subroutine temp_calc_adjust_finalize(errmsg, errflg) - character(len=512), intent(out) :: errmsg - integer, intent(out) :: errflg + character(len=512), intent(out) :: errmsg + integer, intent(out) :: errflg - ! This routine currently does nothing + ! This routine currently does nothing - errmsg = '' - errflg = 0 + errmsg = '' + errflg = 0 - end subroutine temp_calc_adjust_finalize + end subroutine temp_calc_adjust_finalize end module temp_calc_adjust diff --git a/test/ddthost_test/temp_calc_adjust.meta b/test/ddthost_test/temp_calc_adjust.meta index 437de934..2a5279a4 100644 --- a/test/ddthost_test/temp_calc_adjust.meta +++ b/test/ddthost_test/temp_calc_adjust.meta @@ -30,7 +30,7 @@ [ temp_calc ] standard_name = potential_temperature_at_previous_timestep units = K - dimensions = (horizontal_loop_extent) + dimensions = (horizontal_loop_extent, vertical_layer_dimension) type = real kind = kind_phys intent = out