ocnice_prep  1.13.0
All Data Structures Files Functions Variables Pages
utils_esmf_mod.F90 File Reference

Define a set of utilty procedures which use ESMF. More...

Go to the source code of this file.

Data Types

interface  utils_esmf_mod::remaprh
 
interface  utils_esmf_mod::rotremap
 

Functions/Subroutines

logical function, public utils_esmf_mod::chkerr (rc, line, file)
 Handle ESMF errors. More...
 
subroutine, public utils_esmf_mod::createrh (srcmeshfile, dstmeshfile, rc)
 Create a RH. More...
 
subroutine utils_esmf_mod::dynlevmaskproc (dynamicMaskList, dynamicSrcMaskValue, dynamicDstMaskValue, rc)
 A dynamic mask procedure for ocean vertical levels. More...
 
subroutine utils_esmf_mod::remaprh1d (kk, src_field, dst_field, rc)
 Remap a field of nlen via ESMF RH. More...
 
subroutine utils_esmf_mod::remaprh1ddyn (kk, src_field, dst_field, hmask, rc)
 Remap a field of nlen via ESMF RH with dynamic masking. More...
 
subroutine utils_esmf_mod::remaprh2d (src_field, dst_field, rc)
 Remap a packed field of nflds,nlen via ESMF RH. More...
 
subroutine utils_esmf_mod::remaprh2ddyn (kk, src_field, dst_field, hmask, rc)
 Remap a packed field of nflds,nlen via ESMF RH with dyanmic masking. More...
 
subroutine utils_esmf_mod::rotremap2d (wdir, vars, cosrot, sinrot, dims, nflds, fields)
 Rotate 2D vectors from EN->IJ and map back to native staggers. More...
 
subroutine utils_esmf_mod::rotremap3d (wdir, vars, cosrot, sinrot, dims, nflds, fields)
 Rotate 3D vectors on nlevs from EN->IJ and map back to native staggers. More...
 

Variables

type(esmf_dynamicmask) utils_esmf_mod::dynamiclevmask
 an ESMF dynamicMask object More...
 
type(esmf_mesh) utils_esmf_mod::meshdst
 an ESMF mesh for destination grids More...
 
type(esmf_mesh) utils_esmf_mod::meshsrc
 an ESMF mesh for the source grid More...
 
type(esmf_routehandle) utils_esmf_mod::rh
 an ESMF RouteHandle More...
 
integer utils_esmf_mod::srctermprocessing = 0
 The source term processing flag, required for Dynamic Masking. More...
 
character(len= *), parameter utils_esmf_mod::u_file_u = __FILE__
 a character string More...
 

Detailed Description

Define a set of utilty procedures which use ESMF.

Author
Denis.nosp@m.e.Wo.nosp@m.rthen.nosp@m.@noa.nosp@m.a.gov

This module defines the RouteHandle and mapping procedures

Author
Denis.nosp@m.e.Wo.nosp@m.rthen.nosp@m.@noa.nosp@m.a.gov

Definition in file utils_esmf_mod.F90.

Function/Subroutine Documentation

◆ chkerr()

logical function, public utils_esmf_mod::chkerr ( integer, intent(in)  rc,
integer, intent(in)  line,
character(len=*), intent(in)  file 
)

Handle ESMF errors.

Parameters
[in]rcreturn code to check
[in]lineinteger source line number
[in]fileuser-provided source file name
Returns
ChkErr a logical indicating if an ESMF error was detected
Author
Denis.nosp@m.e.Wo.nosp@m.rthen.nosp@m.@noa.nosp@m.a.gov

Definition at line 504 of file utils_esmf_mod.F90.

◆ createrh()

subroutine, public utils_esmf_mod::createrh ( character(len=*), intent(in)  srcmeshfile,
character(len=*), intent(in)  dstmeshfile,
integer, intent(out)  rc 
)

Create a RH.

Parameters
[in]srcmeshfilethe file name of the source mesh
[in]dstmeshfilethe file name of the destination mesh
[out]rcan error return code
Author
Denis.nosp@m.e.Wo.nosp@m.rthen.nosp@m.@noa.nosp@m.a.gov

Definition at line 53 of file utils_esmf_mod.F90.

◆ dynlevmaskproc()

subroutine utils_esmf_mod::dynlevmaskproc ( type(esmf_dynamicmaskelementr8r8r8), dimension(:), pointer  dynamicMaskList,
real(esmf_kind_r8), intent(in), optional  dynamicSrcMaskValue,
real(esmf_kind_r8), intent(in), optional  dynamicDstMaskValue,
integer, intent(out)  rc 
)
private

A dynamic mask procedure for ocean vertical levels.

Parameters
[in]dynamicMaskListan ESMF Dynamic Mask element list
[in]dynamicSrcMaskValuethe masking value on the source grid (optional)
[in]dynamicDstMaskValuethe masking value on the destination grid (optional)
[out]rcan error return code
Author
Adapted from example in ESMF Reference manual (37.2.6 Dynamic Masking)

Definition at line 454 of file utils_esmf_mod.F90.

◆ remaprh1d()

subroutine utils_esmf_mod::remaprh1d ( integer, intent(in)  kk,
real(kind=8), dimension(:), intent(in)  src_field,
real(kind=8), dimension(:), intent(out)  dst_field,
integer, intent(out)  rc 
)
private

Remap a field of nlen via ESMF RH.

Parameters
[in]kkthe vertical or category index
[in]src_fieldthe field on the source grid
[out]dst_fieldthe field on the destination grid
[out]rcan error return code
Author
Denis.nosp@m.e.Wo.nosp@m.rthen.nosp@m.@noa.nosp@m.a.gov

Definition at line 129 of file utils_esmf_mod.F90.

◆ remaprh1ddyn()

subroutine utils_esmf_mod::remaprh1ddyn ( integer, intent(in)  kk,
real(kind=8), dimension(:), intent(in)  src_field,
real(kind=8), dimension(:), intent(out)  dst_field,
real(kind=8), dimension(:), intent(in)  hmask,
integer, intent(out)  rc 
)
private

Remap a field of nlen via ESMF RH with dynamic masking.

Parameters
[in]kkthe vertical or category index
[in]src_fieldthe field on the source grid
[in]hmaskthe mask field to use with dynamic masking
[out]dst_fieldthe field on the destination grid
[out]rcan error return code
Author
Denis.nosp@m.e.Wo.nosp@m.rthen.nosp@m.@noa.nosp@m.a.gov

Definition at line 228 of file utils_esmf_mod.F90.

◆ remaprh2d()

subroutine utils_esmf_mod::remaprh2d ( real(kind=8), dimension(:,:), intent(in)  src_field,
real(kind=8), dimension(:,:), intent(out)  dst_field,
integer, intent(out)  rc 
)
private

Remap a packed field of nflds,nlen via ESMF RH.

Parameters
[in]src_fieldthe field on the source grid
[out]dst_fieldthe field on the destination grid
[out]rcan error return code
Author
Denis.nosp@m.e.Wo.nosp@m.rthen.nosp@m.@noa.nosp@m.a.gov

Definition at line 176 of file utils_esmf_mod.F90.

◆ remaprh2ddyn()

subroutine utils_esmf_mod::remaprh2ddyn ( integer, intent(in)  kk,
real(kind=8), dimension(:,:), intent(in)  src_field,
real(kind=8), dimension(:,:), intent(out)  dst_field,
real(kind=8), dimension(:), intent(in)  hmask,
integer, intent(out)  rc 
)
private

Remap a packed field of nflds,nlen via ESMF RH with dyanmic masking.

Parameters
[in]kkthe vertical or category index
[in]src_fieldthe field on the source grid
[in]hmaskthe mask field to use with dynamic masking
[out]dst_fieldthe field on the destination grid
[out]rcan error return code
Author
Denis.nosp@m.e.Wo.nosp@m.rthen.nosp@m.@noa.nosp@m.a.gov

Definition at line 281 of file utils_esmf_mod.F90.

◆ rotremap2d()

subroutine utils_esmf_mod::rotremap2d ( character(len=*), intent(in)  wdir,
type(vardefs), dimension(:), intent(in)  vars,
real(kind=8), dimension(:), intent(in)  cosrot,
real(kind=8), dimension(:), intent(in)  sinrot,
integer, dimension(:), intent(in)  dims,
integer, intent(in)  nflds,
real(kind=8), dimension(:,:), intent(inout)  fields 
)
private

Rotate 2D vectors from EN->IJ and map back to native staggers.

Parameters
[in]wdirthe path to the required ESMF regridding weights
[in]cosrotthe cosine of the rotation angle
[in]sinrotthe sine of the rotation angle
[in]varsa structure describing the variable metadata
[in]dimsthe dimensions of the fields
[in]nfldsthe number of fields in the packed array
[out]fieldsthe rotated and mapped fields
Author
Denis.nosp@m.e.Wo.nosp@m.rthen.nosp@m.@noa.nosp@m.a.gov

Definition at line 344 of file utils_esmf_mod.F90.

◆ rotremap3d()

subroutine utils_esmf_mod::rotremap3d ( character(len=*), intent(in)  wdir,
type(vardefs), dimension(:), intent(in)  vars,
real(kind=8), dimension(:), intent(in)  cosrot,
real(kind=8), dimension(:), intent(in)  sinrot,
integer, dimension(:), intent(in)  dims,
integer, intent(in)  nflds,
real(kind=8), dimension(:,:,:), intent(inout)  fields 
)
private

Rotate 3D vectors on nlevs from EN->IJ and map back to native staggers.

Parameters
[in]wdirthe path to the required ESMF regridding weights
[in]cosrotthe cosine of the rotation angle
[in]sinrotthe sine of the rotation angle
[in]varsa structure describing the variable metadata
[in]dimsthe dimensions of the fields
[in]nfldsthe number of fields in the packed array
[out]fieldsthe rotated and mapped fields
Author
Denis.nosp@m.e.Wo.nosp@m.rthen.nosp@m.@noa.nosp@m.a.gov

Definition at line 401 of file utils_esmf_mod.F90.

Variable Documentation

◆ dynamiclevmask

type(esmf_dynamicmask) utils_esmf_mod::dynamiclevmask
private

an ESMF dynamicMask object

Definition at line 20 of file utils_esmf_mod.F90.

◆ meshdst

type(esmf_mesh) utils_esmf_mod::meshdst
private

an ESMF mesh for destination grids

Definition at line 22 of file utils_esmf_mod.F90.

◆ meshsrc

type(esmf_mesh) utils_esmf_mod::meshsrc
private

an ESMF mesh for the source grid

Definition at line 21 of file utils_esmf_mod.F90.

◆ rh

type(esmf_routehandle) utils_esmf_mod::rh
private

an ESMF RouteHandle

Definition at line 19 of file utils_esmf_mod.F90.

◆ srctermprocessing

integer utils_esmf_mod::srctermprocessing = 0
private

The source term processing flag, required for Dynamic Masking.

Definition at line 24 of file utils_esmf_mod.F90.

◆ u_file_u

character(len=*), parameter utils_esmf_mod::u_file_u = __FILE__
private

a character string

Definition at line 43 of file utils_esmf_mod.F90.