Title: Coupling MITgcm and GEOS5 using ESMF MAPL'
1Coupling MITgcm and GEOS-5 using ESMF MAPL.
- Chris Hill ( cnh_at_mit.edu )
- ( Max Suarez, Atanas Trayanov, Paul Schopf,
ESMF MAPL bits - Jean Utke adjoint bits )
2Background
- Couple GMAO GEOS-5
- atmosphere
- land
- vegetation
- and MITgcm CS/LLC configurations used in ECCO2
project - ocean
- sea-ice
3GEOS-5
- Multi-component model
- 1 degree
- ½ degree, ¼ degree atmos setups.
- Mosaic land, catchment, vegetation.
see - http//gmao.gsfc.nasa.gov/
4ECCO2 CS/LLC
CS32
- Ocean and sea-ice components.
- CS32, LLC360x90 and CS510 setups.
- used in eddying ocean climate state estimation
under MAP
LLC90x360
see http//ecco2.org
CS510
5Approach ESMF based Component Architecture
Targeting multi-model OGCM options, including
some ensemble capabilities.
(MITgcm, MOM, POSEIDON)
HISTORY
CAP
COUPLED
AGCM
AGCM
OGCM
MITgcm2G5
MITgcm
Suarez
MITgcm
MITgcm
6Key Parts
- Maps CS/LLC fields (A-grid, lat-lon oriented) to
AGCM grid (1,1/2,1/4 degree). - Plug which maps MITgcm (or MOM4, or POSEIDON)
native data to GEOS-5 compatible ESMF based
forms. - MITgcm (or other OGCM), extended as needed to
save full state between calls and provides hooks
to wire internal fields to fields from coupled
plug.
COUPLED
MITgcm2G5
MITgcm
7COUPLED
Raster mesh based
COUPLED - Handles raster map of the world. Each
raster connects some fraction of a CS/LLC ocean
cell to some fraction of a GEOS-5 (1,1/2,1/4)
atmospheric cell. Fractions are pre-computed
offline for specific atmos-ocean Projections
from atmos-ocean cell or ocean-atmos cell involve
sum over raster pixels.
8Requires precomputed raster intersections for
each mesh pairing (e.g)
COUPLED
1O
½O
¼O
not calculated (yet)
calculated
9MITgcm2G5
- ESMF gridded component that implements a GEOS-5
compatible socket for generic OGCM to attach to
and maps to ocean internal data structures - Compatibility rules include
- Loop over time for a period given e.g.
- do while ( MyTIme lt endTime )
- Unit conversions and coupling convention
conversions - SFLX FR(HNEWSNEW-HWSW)(RHO0/DT) ! kg
m-2 s-1 - Standard import/exports following MAPL
conventions - ESMF employs MAPL software from esmf_contrib/
MAPL talk this afternoon, intro. tutorial
tomorrow.
10ESMF MAPL code snippet
! Imports and exports specification !
--------------------------------- nimports
7 allocate(imports(nimports)) !
--------------------------------------------- impo
rts (/
ms('TAUX', 'Agrid_eastward_stress_on_skin',
'N m-2', MAPL_DimsHorzOnly,MAPL_VLocati
onNone), ms('TAUY', 'Agrid_northward_stress_on
_skin', 'N m-2', MAPL_DimsHorzOnly,MAPL
_VLocationNone), ms('PS', 'Surface
Atmospheric Pressure', 'Pa',
MAPL_DimsHorzOnly,MAPL_VLocationNone),
ms('SWHEAT,'solar_heating_rate',
'W m-2', MAPL_DimsHorzVert,MAPL_VLocation
Center), ms('QFLX', 'freshwater_flux_from_skin_t
o_ocean', 'kg m-2 s-1',MAPL_DimsHorzOnly,MAPL_V
LocationNone), ms('HFLX', 'turbulent_heat_flux
_from_skin_to_ocean','W m-2',
MAPL_DimsHorzOnly,MAPL_VLocationNone),
ms('SFLX', 'salt_flux_from_skin_to_ocean',
'N m-2', MAPL_DimsHorzOnly,MAPL_VLocation
None) /) DO I1,NIMPORTS CALL
MAPL_StateAddImportSpec(GC, SHORT_NAME
imports(i)short_name, LONG_NAME
imports(i)long_name, UNITS
imports(i)units, DIMS
imports(i)dims, VLOCATION
imports(i)vlocation, RC
status) VERIFY_(STATUS) ENDDO
MAPL provides short-cuts for standard steps in
ESMF and helps ensure consistent conventions are
followed.
In code fragment above (called in component
SetServices) a set of imports are registered
for a gridded component (GC) using MAPL. Under
the hood the MAPL layer can automatically create
an import state with appropriate entries based on
the specification registered (through
MAPL_GenericInitialize() call when component is
initialized). The MAPL layer can also control
naming of entries to adhere to a specific
convention.
11MITgcm
MITgcm component interface
- TYPE (MITgcm_internal_state)
- gt uVel,vVel,rA,hFacC etc
- support functions e.g.
internal_state(1) internal_state(2)
loop over internal states
vector rotations
?
This layer is unaware of GEOS-5 rules
- MITgcm internal
- data uVel, vVel, rA, hFacC etc
- interacts with MITgcm2G5 through
- driver subroutines driver_init(), driver_run()
- get routines
- getdp(iState, id_string, dPtr)e.g.
12GEOS-5 MITgcm in action
- Passing through scalar and vector fields e.g.
Zonal stress seen by 1 degree atmosphere
Zonal stress seen by CS510 ocean
ocean really sees rotated stress.
- MITgcm component code in mitgcm.org CVS
MITgcm_contrib area. - includes basis for limited ocean ensemble
capability (ensembles all on same mesh)
ESMF/MAPL providing enabling technology for this
13But - what about adjoints?
- Both MITgcm and GEOS have adjoint capabilities
- Very different space and time scales, but would
be interesting to explore using them together. - Even independently adjoints provide very useful
tool for understanding observations.
Heimbach, Hill, Utke
14Adjoint generation.
In an adjoint we numerically evaluate where J
is some scalar output e.g. heat transport across
24N, x is a vector representing the state
variables and F is the exact time and space
trajectory of the numerical integration. The
numerical evaluation is made using a code that is
the symbolic derivative of the prognostic code
that calculates J.
When x has a large number of elements (normally
the case for ocean and atmosphere questions of
interest), then calculating the partial
derivative elements by traversing the model
trajectory in reverse is essential (otherwise the
problem is not computationally feasible).
15Trivial example.
adjoint form
original program
j0 x1 push(x) DO I 1,3 yxx xx1
push(x) jjy ENDDO ad_j1 ad_y0 ad_x0 DO
i3,1,-1 ad_yad_yad_j1 ad_jad_j1 pop(x)
ad_xad_xad_y2x ad_y0 ENDDO
j0 x1 DO i 1,3 yxx xx1 jjy ENDDO
differentiate J wrt x.
Function evaluation
The transformation can be carried out
automatically by a source-source transformation
tool, if the dataflow and data dependencies are
clear. In a component architecture dataflows are
less transparent at the language level.
Reverse mode derivative calculation.
16Component foo equivalent.
driver program
gCcreateGC(fooSetServices) init(gC, imp, exp
) DO i 1,3 run(gC, imp, exp ) ENDDO j_finalget
(exp,j)
Within a component routine e.g fooRun() dataflows
and dependencies are decipherable. Following
flows through imp, exp containers, however, is
not, in general, practical, so
component foo
fooSetServices fooInit(gC,imp,exp) alloc(j)
add(exp,j,j) alloc(x)add(imp,x,x) fooRun(
gC,imp,exp) get(imp,x,x)get(exp,j,j)
jjxxxx1
17. instead use runtime recording for each block
(subroutine/function)
Requires two function evaluation passes before
reverse mode derivative calculation.
1
2
3
- First evaluation captures ESMF_State variable
status. - Second evaluation records based on status.
- Reverse mode derivative evaluation
Appears to work for simple componentFoo
example. More involved example under development.
18(No Transcript)
19(No Transcript)
20(No Transcript)
21(No Transcript)
22(No Transcript)
23OGCM
XXXogcm2G5
MITgcm
MITgcm
XXXogcm
24COUPLED
OGCM
MITgcm2G5
MITgcm
MITgcm
MITgcm
25(No Transcript)
26COUPLED
AGCM
OGCM
MITgcm2G5
MITgcm
MITgcm
MITgcm