Progress in the implementation of the adjoint of the Ocean model NEMO by using the YAO
software
M. Berrada, C. Deltel, M. Crépon, F. Badran, S. ThiriaWork supported by the SHOM (Hydrographic and Oceanographic Department of the French Navy)
under SINOBAD project
University of Paris VILOCEAN Laboratory
9th European AD Workshop INRIA Sophia-Antipolis, 26-27, November 2009
NEMO (Nucleus for European Modeling of the Ocean)is a platform for numerical modeling of ocean
The Ocean model NEMO
NEMO Ocean Model
Ocean Circulation
OPA
Model of sea ice
LIM
MarineBiogeochemistry
LOBSTER, PISCES
Idealized configuration of the physical part of NEMO
The domain is a limited area in the North of the Atlantic ocean (Gulf stream region)
The horizontal dimension 32x22 and 31 vertical levels
GYRE area localisation
GYRE configuration
The ocean trajectory depends on the initial state Accurate initial ocean environment (V0 ,ssh0 ,T0 ,S0)
V=(u,v) velocity ssh the sea surface height T Temperature S salinity
Variational assimilation (YAO software) x=T0 : Control vector y=M(x)=ssh at t=T : Observations (twin data)
Cost functionJ(x)=||y-yobs||2
A validation experiment with twin data
YAO
Semi- automatic generator of the adjoint code Based on a modular graph structure The modular graph is a data flow diagram which
describes the underlying physical model It consists of a set of modules, where the input of
each one is provided by the output of its predecessors
YAO: Modular Graph
M1
x11y12
y11
x31
x32
x33y32
y31
x21
x22y21
Forward model
dd
d
d
dd
d
d
d
d
d
1i
1j1 x
yF
)(xfy 111
)(xfy qqq
)(xfy 333
)(xfy 222
3i
3j3 x
yF
2i
2j2 x
yF
M3
M2
Backward model qTqq dydx F
M’2
1. Defined the modular graph structure of the model
2. Coding of the local functions fq
3. Coding of the Jacobian Fq
Modular graph in a point of the grid
Modular graph in a point of the grid
Modular graph of the space discretization
M1
M2
M3 M1
M2
M3
M1
M2
M3
M1
M2
M3
M1
M2
M3
Time evolution of the modular graph of the space
M1
M2
M3
M1
M2
M3
M1
M2
M3
M1
M2
M3
M1
M2
M3
M1
M2
M3
M1
M2
M3
M1
M2
M3
M1
M2
M3
M1
M2
M3
M1
M2
M3
M1
M2
M3
t2t1 t3
x x
xx
t0
YAO: Modular Graph
Accomplished work
M1
x11
1i
1j1 x
yF
)(xfy 111 y11
y12
1. Defined the modular graph structure of the GYRE model under YAO
2. Coded the forward model
3. Implementation of the Jacobian of each module which is needed for the backpropagation (used for the computation of the cost function gradient )
d
d
d
Accomplished work
Comparison: GYRE-YAO vs GYRE-Fortran (accuracy 10-11)
Comparison of the ssh at t=100
(1 time step =2h)
Linear tangent test
α(k+1)=α(k)/2 1st order test 2nd order test : α (1): 2.500000e-02 : -1-> 7.914089e+00 -K-> 3.121720e+02 : α (2): 1.250000e-02 : -1-> 1.015254e+01 -K-> 8.051761e+02 : α (3): 6.250000e-03 : -1-> 3.269313e+00 -K-> 5.011360e+02 : α (4): 3.125000e-03 : -1-> 4.561872e+01 -K-> 1.460673e+04 : α (5): 1.562500e-03 : -1-> 8.877574e+01 -K-> 5.683726e+04 : α (6): 7.812500e-04 : -1-> 1.205476e+01 -K-> 1.542101e+04 : α (7): 3.906250e-04 : -1-> 1.799721e+02 -K-> 4.606209e+05 : α (8): 1.953125e-04 : -1-> 6.400455e+01 -K-> 3.278745e+05 : α (9): 9.765625e-05 : -1-> 3.628549e+03 -K-> 3.715594e+07 : α (10): 4.882813e-05 : -1-> 7.207983e+03 -K-> 1.476187e+08 : α (11): 2.441406e-05 : -1-> 9.999715e-01 -K-> 2.649493e+01 : α (12): 1.220703e-05 : -1-> 9.999856e-01 -K-> 2.674571e+01 : α (13): 6.103516e-06 : -1-> 9.999939e-01 -K-> 2.245280e+01 : α (14): 3.051758e-06 : -1-> 9.999962e-01 -K-> 2.876924e+01 : α (15): 1.525879e-06 : -1-> 9.999983e-01 -K-> 2.558008e+01
1).(
)()(lim
0
00
0
dXX
XMdXM
M
x KdXX
XMdXXM
1
).(
)()(1lim
0
00
0
M
1st order test 2nd order test
Adjoint test
dYdXdYdXdYdX TMM and ,,.,
13-4.198756eerror Relative
19-3179589e1.30390134MM
07-7329680e3.10544677M
07-7330984e3.10544677 M
T
T
dYdXdYdX
dYdX
dYdX
,,.
,
,.
Conclusion
Flexibility: Modifying the model at any time is straightforward due to modular graph structure
One can consider a more complex function as a module for the YAO graph and uses Tapenade (or other) to get the local adjoint
Encouraging results of the adjoint tests
Thank you!