next up previous contents
Next: 8 Namelist and Control Up: 1 General Modules and Previous: 6 Fields   Contents

Subsections

7 Mapping (Interpolation)

7.1 Module cpl_map_mod - mapping subsystem module (Source File: cpl_map_mod.F90)

This module represents a major subsystem of cpl6. "Mapping" refers to the interpolation of 2d field data from one domain/grid to another. It is often desirable that maps have the properties of being smooth and conservative. Common mapping techniques are bilinear interpolation and area-averaging. Mapping in cpl6 is implemented by a sparse matrix multiply. This module defines the cpl_map data type which hold all the information needed to complete a mapping of a bundle from one domain to another. It also includes routines to do the mapping and initialize the cpl_map data structure and check the properties of the weights from the sparse matrix.


REVISION HISTORY:

      2001-Aug-14 - B. Kauffman -- gathered all mapping routines into this module
      2001-May-20 - T. Craig -- first prototype
INTERFACE:
 
 module cpl_map_mod
USES:
 
    use cpl_mct_mod        ! mct interface
    use cpl_domain_mod     ! data type & methods
    use cpl_bundle_mod     ! data type & methods
    use cpl_comm_mod       ! global data
    use cpl_kind_mod       ! kinds
    use cpl_control_mod, only: dbug=>cpl_control_infoDBug
    use cpl_control_mod, only: bfbflag=>cpl_control_bfbflag
    use shr_sys_mod        ! flush
    use shr_mpi_mod        ! mpi layer
 
    implicit none
 
    private   ! except
PUBLIC TYPES:
 
    public :: cpl_map
    
    type cpl_map
      character(CL)            :: name    ! text ID of mapping data
      type(cpl_mct_sMat)       :: sMat    ! the mct sparse matrix data type
      type(cpl_domain),pointer :: src     ! the associated source domain
      type(cpl_domain),pointer :: dst     ! the associated destination domain
      type(cpl_domain)         :: new     ! new/intermediate domain required by mct
      type(cpl_mct_rearr)      :: rearr   ! rearranger to/from new
      character(3)             :: newtype ! intermediate domain type: src or dst ?
      integer(IN)              :: IDtype  ! 0=normal, 1=identity(ID)
      type(cpl_mct_Avect)      :: areasrc ! area of src grid from mapping file
      type(cpl_mct_Avect)      :: areadst ! area of dst grid from mapping file
    end type cpl_map
PUBLIC MEMBER FUNCTIONS:
 
    public :: cpl_map_init      ! initialize a map
    public :: cpl_map_clean     ! clean/dealloc a map
    public :: cpl_map_info      ! obtain information about a map
    public :: cpl_map_bun       ! map from one bundle to another
    public :: cpl_map_npFix     ! fix NP values wrt mapping vector fields
 
    interface cpl_map_npFix; module procedure cpl_map_npFixNew3; end interface
    interface cpl_map_npFix; module procedure cpl_map_npFixNew2; end interface
    interface cpl_map_npFix; module procedure cpl_map_npFixNew; end interface
    interface cpl_map_npFix; module procedure cpl_map_npFixOld; end interface
    interface cpl_map_npFix; module procedure cpl_map_npFixNone; end interface
PUBLIC DATA MEMBERS:
 
    character(*),parameter,public :: cpl_map_areaAV_field = 'aream'

7.1.1 cpl_map_init - Create a map between two domains

Initialize a map_X to interpolate data from domain dom_src to domain dom_dst. map_X is assigned the name mapName.

Mapping weights are read from the file fileName

newdom is either ``src'' or ``dst'' and specifies if the communication needed to complete the mapping is done before, ``src''-based, or after, ``dst''-based, the mapping.

If optional argument adj_areas is present and true, the mapping weights will be adjusted to account for area differences between the models and the SCRIP weight generation program. Experimental. Do not use.

If cpl_control_infoDBug is greater than 1, then this routine will perform consistency checks on the mapping weights.


REVISION HISTORY:

      2001-Jun-14 - T. Craig - first functioning version
      2001-Mar-20 - T. Craig, B. Kauffman, R. Jacob - first prototype
INTERFACE:
 
 subroutine cpl_map_init(map_X,dom_src,dom_dst,mapName,fileName,newdom,adj_areas)
USES:
INPUT/OUTPUT PARAMETERS:
 
    type(cpl_map)   ,intent(out)        :: map_X    ! map_X data
    type(cpl_domain),intent( in),target :: dom_src  ! map's source domain
    type(cpl_domain),intent( in),target :: dom_dst  ! map's destination domain
    character(*),intent( in)            :: mapName  ! map's ID string 
    character(*),intent( in)            :: fileName ! file containing map data
    character(*),intent( in)            :: newdom   ! which domain to alter (for mct)
    logical,optional                    :: adj_areas! flag to adjust areas

7.1.2 cpl_map_clean - Deallocate a map data type

Deallocate all memory associated with the input map type mapping.


REVISION HISTORY:

      2002-Jan-20 - T. Craig - first functioning version
INTERFACE:
 
 subroutine cpl_map_clean(mapping)
USES:
INPUT/OUTPUT PARAMETERS:
 
    type(cpl_map),intent(inout)    :: mapping ! mapping data

7.1.3 cpl_map_info - Print inforomation about the map

Print information about the map mapping to stdout.


REVISION HISTORY:

      2002-Jan-14 - T. Craig - first functioning version
INTERFACE:
 
 subroutine cpl_map_info(mapping)
USES:
INPUT/OUTPUT PARAMETERS:
 
    type(cpl_map)   ,intent(in)                  :: mapping ! mapping data

7.1.4 cpl_map_bun - map a bundle from one domain to domain

Map input bundle buni on one domain to output bundle buno on a different domain using the map mapx.

All attributes in buni and buno which have the same name will be mapped. Data in buno will be overwritten.

Both buni and buno must be initialized before calling this routine

If the set of optional arguments bunfs, fsname, bunfd, fsname are all present then the data in buni will be multiplied by field fsname from bunfs before mapping (Note: the data in buni will NOT be altered) and the data in buno will be multipled by field fdname in bundle bunfs after mapping.

If optional argument mvector controls the use of the vector-computer freindly versions of the mapping routine. This can be used to override the default settings.


REVISION HISTORY:

      20May01 - T. Craig -- first prototype
      15Jun01 - E.T. Ong -- Removed zeroing of bunn%data and buno%data -
                            this is done in mct calls.
INTERFACE:
 
 subroutine cpl_map_bun(buni,buno,mapx,bunfs,fsname,bunfd,fdname,mvector)
USES:
 
    use shr_timer_mod       ! share timer routines
INPUT/OUTPUT PARAMETERS:
 
    type(cpl_bundle),intent(inout)       :: buni    ! input bundle
    type(cpl_bundle),intent(out)         :: buno    ! output bundle
    type(cpl_map)   ,intent(inout)       :: mapx    ! mapping between two domains
    type(cpl_bundle),intent(in),optional :: bunfs   ! src fraction input bundle
    character(*)    ,intent(in),optional :: fsname  ! name of field in bunfs
    type(cpl_bundle),intent(in),optional :: bunfd   ! dst fraction input bundle
    character(*)    ,intent(in),optional :: fdname  ! name of field in bunfd
    logical         ,intent(in),optional :: mvector  ! enable vector-friendly mapping

7.1.5 cpl_map_npFixNew3 - correct the north pole mapping of velocity fields

Correct the north pole mapping of velocity fields from the atm to ocn grids. This assumes the input grid is a regular lat/lon with the north pole surrounded by the last latitude line in the input array. The longitudes in the last latitude must be ordered and equally spaced.


REVISION HISTORY:

      29Aug03 - T. Craig -- first prototype
INTERFACE:
 
 subroutine cpl_map_npFixNew3(buni,buno,fld1,fld2)
USES:
 
    use cpl_const_mod
    use shr_timer_mod       ! share timer routines
 
 #if (! defined HIDE_MPI)
 #include <mpif.h>         ! mpi library include file
 #endif
INPUT/OUTPUT PARAMETERS:
 
    type(cpl_bundle),intent(inout):: buni    ! input bundle
    type(cpl_bundle),intent(out)  :: buno    ! output bundle
    character(*)    ,intent(in)   :: fld1    ! name of first input field
    character(*)    ,intent(in)   :: fld2    ! name of second input field



next up previous contents
Next: 8 Namelist and Control Up: 1 General Modules and Previous: 6 Fields   Contents
cesm.ucar.edu