Skip to content

add numg, numl, numc and nump to bounds derived type #183

@ekluzek

Description

@ekluzek

Bill Sacks < sacks@ucar.edu > - 2013-08-29 12:29:49 -0600
Bugzilla Id: 1796
Bugzilla CC: muszala@ucar.edu, mvertens@ucar.edu,

I added the following code, then removed it when I found that it isn't needed right now - in order to avoid having unused, untested code in the system. This tracks the number of gridcells, landunits, columns & pfts that each clump (or proc) is responsible for.

But I'm filing this placeholder in case we find we want this later.

Index: decompMod.F90
===================================================================
--- decompMod.F90	(revision 50583)
+++ decompMod.F90	(revision 50582)
@@ -42,6 +42,8 @@
   public get_proc_bounds    ! this processor beg and end gridcell,landunit,column,pft
 
   ! !PRIVATE MEMBER FUNCTIONS:
+  private compute_bounds_derived_info
+     
   !
   ! !PRIVATE TYPES:
   private  ! (now mostly public for decompinitmod)
@@ -58,6 +60,11 @@
      integer :: begc, endc       ! beginning and ending column index
      integer :: begp, endp       ! beginning and ending pft index
 
+     integer :: numg             ! number of grid cells
+     integer :: numl             ! number of landunits
+     integer :: numc             ! number of columns
+     integer :: nump             ! number of pfts
+
      integer :: level            ! whether defined on the proc or clump level
      integer :: clump_index      ! if defined on the clump level, this gives the clump index
   end type bounds_type
@@ -148,6 +155,8 @@
      bounds%begg = clumps(cid)%begg
      bounds%endg = clumps(cid)%endg
      
+     call compute_bounds_derived_info(bounds)
+
      bounds%level = BOUNDS_LEVEL_CLUMP
      bounds%clump_index = n
 
@@ -207,6 +216,8 @@
      bounds%begg = procinfo%begg
      bounds%endg = procinfo%endg
 
+     call compute_bounds_derived_info(bounds)
+
      bounds%level = BOUNDS_LEVEL_PROC
      bounds%clump_index = -1           ! irrelevant for proc, so assigned a bogus value
 
@@ -362,4 +373,24 @@
     end select
   end subroutine get_clmlevel_gsmap
 
+  !-----------------------------------------------------------------------
+  subroutine compute_bounds_derived_info (bounds)
+    !
+    ! !DESCRIPTION:
+    ! Given a bounds variable that has the basic info set (begg, endg, and similarly for
+    ! landunit, col and pft), compute derived variables.
+    !
+    ! !USES:
+    !
+    ! !ARGUMENTS:
+    implicit none
+    type(bounds_type), intent(inout) :: bounds
+    !----------------------------------------------------------------------
+
+    bounds%numg = bounds%endg - bounds%begg + 1
+    bounds%numl = bounds%endl - bounds%begl + 1
+    bounds%numc = bounds%endc - bounds%begc + 1
+    bounds%nump = bounds%endp - bounds%begp + 1
+  end subroutine compute_bounds_derived_info
+
end module decompMod

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementnew capability or improved behavior of existing capabilitypriority: lowBackground task that doesn't need to be done right away.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions