ESMF Regridding Update Fei Liu, Rocky Dunlap NOAA Cooperative Institute for Research in...

15
ESMF Regridding Update Fei Liu, Rocky Dunlap NOAA Cooperative Institute for Research in Environmental Sciences University of Colorado, Boulder Training at NRL Monterey August 5-6, 2015

Transcript of ESMF Regridding Update Fei Liu, Rocky Dunlap NOAA Cooperative Institute for Research in...

Page 1: ESMF Regridding Update Fei Liu, Rocky Dunlap NOAA Cooperative Institute for Research in Environmental Sciences University of Colorado, Boulder Training.

ESMF Regridding Update

Fei Liu, Rocky Dunlap

NOAA Cooperative Institute for Research in Environmental SciencesUniversity of Colorado, Boulder

Training at NRL MontereyAugust 5-6, 2015

Page 2: ESMF Regridding Update Fei Liu, Rocky Dunlap NOAA Cooperative Institute for Research in Environmental Sciences University of Colorado, Boulder Training.

Context

• The Earth System Modeling Framework (ESMF) is software for building and coupling weather, climate, and related models.

• This talk is about the regridding part of ESMF

• The work presented here is finished and we expect it to come out in ESMF 7.0.0 due late spring/early summer

• Also available before that as a development snapshot

Page 3: ESMF Regridding Update Fei Liu, Rocky Dunlap NOAA Cooperative Institute for Research in Environmental Sciences University of Colorado, Boulder Training.

ESMF RegriddingRegridding (or remapping or interpolation) is the process of moving data

from one grid to another while preserving qualities of the original data.

ESMF regridding is: • Flexible:

– Computes weights between a wide range of grids: structured and unstructured, global and regional, 2D and 3D, spherical and Cartesian

– Options for interpolation method, pole treatment, masked points, …• Well Tested and Portable:

– >200 regridding cases tested every night– >40 different OS/Compiler/MPI combinations tested every night

• Parallel and Fast:– Able to compute weights in minutes which before took hours– Able to compute weights between very large grids

• Community developed:– Supported by NASA, NOAA, DOD and NSF funding– Well established (since 2005) community processes for prioritization,

support and review. – Development priorities set by users through quarterly Change Review Board

(CRB) meetings

Page 4: ESMF Regridding Update Fei Liu, Rocky Dunlap NOAA Cooperative Institute for Research in Environmental Sciences University of Colorado, Boulder Training.

Interfaces

• Complete F95 API:– use ESMF– Derived types and methods– Investigating moving to Fortran 2003

• Limited C API:– #include “ESMC.h”– Structs and methods

• Limited Python API:– Import ESMPy– Classes with methods

• Applications:– File-based interpolation weight generation:

mpirun –np <N> ESMF_RegridWeightGen –s ….– (NEW!) File-based weight generation AND application of weights:

mpirun –np <N> ESMF_Regrid –s…

! Create GridssrcGrid=ESMF_GridCreate(…)dstGrid=ESMF_GridCreate(…) ! Create FieldssrcField=ESMF_FieldCreate(srcGrid,…)dstField=ESMF_FieldCreate(dstGrid,…)

! Calc regrid sparse matrix (routeHandle)ESMF_FieldRegridStore(srcField, dstField, routeHandle,…)

do i=1,… ! Compute new srcField

….

! Apply regrid sparse matrix (routeHandle)ESMF_FieldRegrid(srcField, dstField,

routeHandle)enddo

Page 5: ESMF Regridding Update Fei Liu, Rocky Dunlap NOAA Cooperative Institute for Research in Environmental Sciences University of Colorado, Boulder Training.

Supported Geometry Types• Grid:

– Structured representation of a region– A logically rectangular tile

• Mesh: – Unstructured representation of a region– In 2D: polygons with any number of sides

• including concave– In 3D: tetrahedrons & hexahedrons

• LocStream (Location Stream):– NEW!– Set of disconnected points

• E.g. locations of observations– Very flexible and efficient– Can’t be used with every regrid method

Page 6: ESMF Regridding Update Fei Liu, Rocky Dunlap NOAA Cooperative Institute for Research in Environmental Sciences University of Colorado, Boulder Training.

Supported Grid File Formats

• SCRIP:– Format used by SCRIP regridding tool– 2D Spherical– Logically rectangular Grids or unstructured Meshes

• ESMF unstructured:– Custom ESMF format– 2D or 3D / Spherical or Cartesian– Unstructured Meshes

• UGRID:– Proposed CF convention– 2D or 3D / Spherical or Cartesian– Unstructured Meshes

• GRIDSPEC:– CF convention– ESMF currently supports: 2D spherical single tile Grids

Page 7: ESMF Regridding Update Fei Liu, Rocky Dunlap NOAA Cooperative Institute for Research in Environmental Sciences University of Colorado, Boulder Training.

Regrid Methods• Bilinear:

– Destination is a linear combination of source cell corners– Weights based distance from corners– LocStreams can be destination

• Higher order patch recovery:– Multiple polynomial patches represent region around source cell– Destination is linear combination of patch values– Yields better derivatives/smoother results than bilinear– Based on “patch recovery” used in finite element modeling [1][2]– LocStreams can be destination

• Nearest neighbor:– Destination is equal to closest source point (or vise versa)– LocStreams can be source or destination

• First order conservative:– Destination is combination of intersecting source cell areas– Preserves integral of data across interpolation

Page 8: ESMF Regridding Update Fei Liu, Rocky Dunlap NOAA Cooperative Institute for Research in Environmental Sciences University of Colorado, Boulder Training.

Other Options

•(NEW!) Path between points in bilinear on a sphere:– Straight line– Great circle

•Options for extrapolating across pole region:– Full circle average– N-point average– Teeth– No pole

•Others: – Masking– (New!) Normalization options for conservative: destination area or

fraction – User area– Ignore unmapped, Ignore degenerate

Full circle avg.N-point avg

Teeth No Pole

Page 9: ESMF Regridding Update Fei Liu, Rocky Dunlap NOAA Cooperative Institute for Research in Environmental Sciences University of Colorado, Boulder Training.

Spherical Regrid Support• Regrid works with spherical (lon, lat, radius) coordinates• All regrid methods supported between any pair of:

– 2D Global or 2D regional logically rectangular Grids– 2D Unstructured Meshes composed of polygons with any number of sides– 2D Multi-patch grids (e.g. cubed spheres) currently supported via Meshes

• (NEW! More Accurate!) Bilinear supported between any pair of:– 3D Meshes composed of hexahedrons– 3D Global or regional logically rectangular Grids

• LocStreams supported for above depending on regrid method

FIM Unstructured Grid Regional Grid3D Global Spherical Grid

Page 10: ESMF Regridding Update Fei Liu, Rocky Dunlap NOAA Cooperative Institute for Research in Environmental Sciences University of Colorado, Boulder Training.

Cartesian Regrid Support• Regrid works with Cartesian (x,y,z) coordinates• All regrid methods between any pair of:

– 2D Meshes composed of polygons with any number of sides– 2D logically rectangular Grids

• Bilinear, conservative, or nearest neighbor between any pair of:– 3D Meshes composed of hexahedrons– 3D logically rectangular Grids

• LocStreams supported for above depending on regrid method

2D Unstructured MeshFrom www.ngdc.noaa.gov

3D Grid 3D Unstructured Mesh

Page 11: ESMF Regridding Update Fei Liu, Rocky Dunlap NOAA Cooperative Institute for Research in Environmental Sciences University of Colorado, Boulder Training.

Regrid Weight Calculation Performance

Platform: IBM IDataPlex cluster (Yellowstone at NCAR)Grid size: ~30 million cells and ~4 millions cells

Page 12: ESMF Regridding Update Fei Liu, Rocky Dunlap NOAA Cooperative Institute for Research in Environmental Sciences University of Colorado, Boulder Training.

Other Tools Using ESMF Regrid

• Ultrascale Visualization Climate Data Analysis Tool (UV-CDAT):– Package designed for analyzing large climate data sets– Uses ESMF regridding via ESMPy– Recently won Federal Laboratory Consortium technology transfer award

• Cf-python:– Python package for manipulating cf data and files– Uses ESMF regridding via ESMPy

• NCAR Command Language (NCL): – Language for scientific data analysis and visualization– Uses ESMF regridding via ESMF_RegridWeightGen application

Page 13: ESMF Regridding Update Fei Liu, Rocky Dunlap NOAA Cooperative Institute for Research in Environmental Sciences University of Colorado, Boulder Training.

Selected Users• NOAA Environmental Modeling System (NEMS):

– Under development– Aimed to be the backbone of next generation forecast systems– ESMF regridding used to transfer data between models

• Community Earth System Model (CESM):– Has used ESMF regridding for 5+ years– Currently uses ESMF_RegridWeightGen, but are working towards online

regridding

• Met Office:– Multiple users of ESMF regridding there– Have been adding functionality for them (e.g. concave, great circle,…)

• NOAA Space Weather Prediction Center (SWPC):– Working towards coupled 3D ionosphere model using ESMF– New 3D spherical bilinear reduces error by 40x over Cartesian

Page 14: ESMF Regridding Update Fei Liu, Rocky Dunlap NOAA Cooperative Institute for Research in Environmental Sciences University of Colorado, Boulder Training.

Scheduled for Upcoming Releases

• Higher-order conservative regridding (7.1.0)

• Breaking up grid files to increase maximum grid size possible for interpolation weight generation (7.1.0)

• Extrapolation of points that lie outside the source grid (7.1.0)

• Dynamic masking during sparse matrix multiply (7.1.0)

• Additional weight file formats for ESMF_RegridWeightGen (7.1.0)– Other SCRIP format– Slim version

• Representation of higher-order elements (7.2.0)

Page 15: ESMF Regridding Update Fei Liu, Rocky Dunlap NOAA Cooperative Institute for Research in Environmental Sciences University of Colorado, Boulder Training.

References

• Patch interpolation:1. Khoei S.A., Gharehbaghi A. R. The superconvergent patch recovery

technique and data transfer operators in 3d plasticity problems. Finite Elements in Analysis and Design, 43(8), 2007.

2. Hung K.C, Gu H., Zong Z. A modified superconvergent patch recovery method and its application to large deformation problems. Finite Elements in Analysis and Design, 40(5-6), 2004.

If you have questions or requests, come talk to me, or email:

[email protected]