3 |
|
|
4 |
%********************************************************************** |
%********************************************************************** |
5 |
\section{Sensitivity of Air-Sea Exchange to Tracer Injection Site } |
\section{Sensitivity of Air-Sea Exchange to Tracer Injection Site } |
6 |
\label{www:tutorials} |
%\label{www:tutorials} |
7 |
\label{sect:eg-simple-tracer-adjoint} |
\label{sec:eg-simple-tracer-adjoint} |
8 |
\label{sec_ad_setup_ex} |
\label{sec_ad_setup_ex} |
9 |
\label{sect:tutorialIII} |
\label{sec:tutorialIII} |
10 |
\begin{rawhtml} |
\begin{rawhtml} |
11 |
<!-- CMIREDIR:sec_ad_setup_ex: --> |
<!-- CMIREDIR:sec_ad_setup_ex: --> |
12 |
\end{rawhtml} |
\end{rawhtml} |
13 |
|
\begin{center} |
14 |
|
(in directory: {\it verification/tutorial\_tracer\_adjsens/}) |
15 |
|
\end{center} |
16 |
%********************************************************************** |
%********************************************************************** |
17 |
|
|
18 |
MITgcm has been adapted to enable AD using TAMC or TAF. |
MITgcm has been adapted to enable AD using TAMC or TAF. |
26 |
\ref{fig:adthemodel}, \ref{fig:adthemain}. |
\ref{fig:adthemodel}, \ref{fig:adthemain}. |
27 |
|
|
28 |
\subsection{Overview of the experiment} |
\subsection{Overview of the experiment} |
29 |
\label{www:tutorials} |
%\label{www:tutorials} |
30 |
|
|
31 |
We describe an adjoint sensitivity analysis of out-gassing from |
We describe an adjoint sensitivity analysis of out-gassing from |
32 |
the ocean into the atmosphere of a carbon-like tracer injected |
the ocean into the atmosphere of a carbon-like tracer injected |
33 |
into the ocean interior (see \cite{hil-eta:01}). |
into the ocean interior (see \cite{hil-eta:01}). |
34 |
|
|
35 |
\subsubsection{Passive tracer equation} |
\subsubsection{Passive tracer equation} |
36 |
\label{www:tutorials} |
%\label{www:tutorials} |
37 |
|
|
38 |
For this work MITgcm was augmented with a thermodynamically |
For this work MITgcm was augmented with a thermodynamically |
39 |
inactive tracer, $C$. Tracer residing in the ocean |
inactive tracer, $C$. Tracer residing in the ocean |
68 |
$ S = 1 \,\, {\rm mol / s}$. |
$ S = 1 \,\, {\rm mol / s}$. |
69 |
|
|
70 |
\subsubsection{Model configuration} |
\subsubsection{Model configuration} |
71 |
\label{www:tutorials} |
%\label{www:tutorials} |
72 |
|
|
73 |
The model configuration employed has a constant |
The model configuration employed has a constant |
74 |
$4^\circ \times 4^\circ$ resolution horizontal grid and realistic |
$4^\circ \times 4^\circ$ resolution horizontal grid and realistic |
80 |
features of the ocean general circulation. |
features of the ocean general circulation. |
81 |
|
|
82 |
\subsubsection{Out-gassing cost function} |
\subsubsection{Out-gassing cost function} |
83 |
\label{www:tutorials} |
%\label{www:tutorials} |
84 |
|
|
85 |
To quantify and understand out-gassing due to injections of $C$ |
To quantify and understand out-gassing due to injections of $C$ |
86 |
in eqn. (\ref{carbon_ddt}), |
in eqn. (\ref{carbon_ddt}), |
107 |
sequestered within the ocean. |
sequestered within the ocean. |
108 |
|
|
109 |
\subsection{Code configuration} |
\subsection{Code configuration} |
110 |
\label{www:tutorials} |
%\label{www:tutorials} |
111 |
|
|
112 |
The model configuration for this experiment resides under the |
The model configuration for this experiment resides under the |
113 |
directory {\it verification/carbon/}. |
directory {\it verification/carbon/}. |
183 |
specific to this experiment. |
specific to this experiment. |
184 |
|
|
185 |
\subsubsection{File {\it .genmakerc}} |
\subsubsection{File {\it .genmakerc}} |
186 |
\label{www:tutorials} |
%\label{www:tutorials} |
187 |
This file overwrites default settings of {\it genmake}. |
This file overwrites default settings of {\it genmake}. |
188 |
In the present example it is used to switch on the following |
In the present example it is used to switch on the following |
189 |
packages which are related to automatic differentiation |
packages which are related to automatic differentiation |
193 |
\hspace*{4ex} {\tt set DISABLE=( aim obcs zonal\_filt shap\_filt cal exf )} |
\hspace*{4ex} {\tt set DISABLE=( aim obcs zonal\_filt shap\_filt cal exf )} |
194 |
|
|
195 |
\subsubsection{File {\it COST\_CPPOPTIONS.h, CTRL\_OPTIONS.h}} |
\subsubsection{File {\it COST\_CPPOPTIONS.h, CTRL\_OPTIONS.h}} |
196 |
\label{www:tutorials} |
%\label{www:tutorials} |
197 |
|
|
198 |
These files used to contain package-specific CPP-options |
These files used to contain package-specific CPP-options |
199 |
(see Section \ref{???}). |
(see Section ref:ask-the-author). |
200 |
For technical reasons those options have been grouped together |
For technical reasons those options have been grouped together |
201 |
in the file {\it ECCO\_OPTIONS.h}. |
in the file {\it ECCO\_OPTIONS.h}. |
202 |
To retain the modularity, the files have been kept and contain |
To retain the modularity, the files have been kept and contain |
203 |
the standard include of the {\it CPP\_OPTIONS.h} file. |
the standard include of the {\it CPP\_OPTIONS.h} file. |
204 |
|
|
205 |
\subsubsection{File {\it CPP\_EEOPTIONS.h}} |
\subsubsection{File {\it CPP\_EEOPTIONS.h}} |
206 |
\label{www:tutorials} |
%\label{www:tutorials} |
207 |
|
|
208 |
This file contains 'wrapper'-specific CPP options. |
This file contains 'wrapper'-specific CPP options. |
209 |
It only needs to be changed if the code is to be run |
It only needs to be changed if the code is to be run |
210 |
in a parallel environment (see Section \ref{???}). |
in a parallel environment (see Section ref:ask-the-author). |
211 |
|
|
212 |
\subsubsection{File {\it CPP\_OPTIONS.h}} |
\subsubsection{File {\it CPP\_OPTIONS.h}} |
213 |
\label{www:tutorials} |
%\label{www:tutorials} |
214 |
|
|
215 |
This file contains model-specific CPP options |
This file contains model-specific CPP options |
216 |
(see Section \ref{???}). |
(see Section ref:ask-the-author). |
217 |
Most options are related to the forward model setup. |
Most options are related to the forward model setup. |
218 |
They are identical to the global steady circulation setup of |
They are identical to the global steady circulation setup of |
219 |
{\it verification/global\_ocean.90x40x15/}. |
{\it verification/global\_ocean.90x40x15/}. |
242 |
The gradient check package is further described in Section ???. |
The gradient check package is further described in Section ???. |
243 |
|
|
244 |
\subsubsection{File {\it ECCO\_OPTIONS.h}} |
\subsubsection{File {\it ECCO\_OPTIONS.h}} |
245 |
\label{www:tutorials} |
%\label{www:tutorials} |
246 |
|
|
247 |
The CPP options of several AD-related packages are grouped |
The CPP options of several AD-related packages are grouped |
248 |
in this file: |
in this file: |
266 |
% |
% |
267 |
\hspace*{4ex} {\tt \#define ALLOW\_TAMC\_CHECKPOINTING} \\ |
\hspace*{4ex} {\tt \#define ALLOW\_TAMC\_CHECKPOINTING} \\ |
268 |
enables the checkpointing feature of TAMC |
enables the checkpointing feature of TAMC |
269 |
(see Section \ref{???}). |
(see Section ref:ask-the-author). |
270 |
In the present example a 3-level checkpointing is implemented. |
In the present example a 3-level checkpointing is implemented. |
271 |
The code contains the relevant store directives, common block |
The code contains the relevant store directives, common block |
272 |
and tape initializations, storing key computation, |
and tape initializations, storing key computation, |
279 |
% |
% |
280 |
\hspace*{4ex} {\tt \#define ALLOW\_AUTODIFF\_MONITOOR} \\ |
\hspace*{4ex} {\tt \#define ALLOW\_AUTODIFF\_MONITOOR} \\ |
281 |
enables the monitoring of intermediate adjoint variables |
enables the monitoring of intermediate adjoint variables |
282 |
(see Section \ref{???}). \\ |
(see Section ref:ask-the-author). \\ |
283 |
% |
% |
284 |
\hspace*{4ex} {\tt \#define ALLOW\_DIVIDED\_ADJOINT} \\ |
\hspace*{4ex} {\tt \#define ALLOW\_DIVIDED\_ADJOINT} \\ |
285 |
enables adjoint dump and restart |
enables adjoint dump and restart |
286 |
(see Section \ref{???}). |
(see Section ref:ask-the-author). |
287 |
% |
% |
288 |
\item Cost function package: {\it pkg/cost/} \\ |
\item Cost function package: {\it pkg/cost/} \\ |
289 |
This package contains all relevant routines for |
This package contains all relevant routines for |
290 |
initializing, accumulating and finalizing the cost function |
initializing, accumulating and finalizing the cost function |
291 |
(see Section \ref{???}). \\ |
(see Section ref:ask-the-author). \\ |
292 |
\hspace*{4ex} {\tt \#define ALLOW\_COST} \\ |
\hspace*{4ex} {\tt \#define ALLOW\_COST} \\ |
293 |
enables all general aspects of the cost function handling, |
enables all general aspects of the cost function handling, |
294 |
in particular the hooks in the forward code for |
in particular the hooks in the forward code for |
325 |
\end{itemize} |
\end{itemize} |
326 |
|
|
327 |
\subsubsection{File {\it SIZE.h}} |
\subsubsection{File {\it SIZE.h}} |
328 |
\label{www:tutorials} |
%\label{www:tutorials} |
329 |
|
|
330 |
The file contains the grid point dimensions of the forward |
The file contains the grid point dimensions of the forward |
331 |
model. It is identical to the {\it verification/exp2/}: \\ |
model. It is identical to the {\it verification/exp2/}: \\ |
338 |
{\tt OLx = OLy = 3}. |
{\tt OLx = OLy = 3}. |
339 |
|
|
340 |
\subsubsection{File {\it adcommon.h}} |
\subsubsection{File {\it adcommon.h}} |
341 |
\label{www:tutorials} |
%\label{www:tutorials} |
342 |
|
|
343 |
This file contains common blocks of some adjoint variables |
This file contains common blocks of some adjoint variables |
344 |
that are generated by TAMC. |
that are generated by TAMC. |
371 |
{\bf ALLOW\_AUTODIFF\_MONITOR}. |
{\bf ALLOW\_AUTODIFF\_MONITOR}. |
372 |
|
|
373 |
\subsubsection{File {\it tamc.h}} |
\subsubsection{File {\it tamc.h}} |
374 |
\label{www:tutorials} |
%\label{www:tutorials} |
375 |
|
|
376 |
This routine contains the dimensions for TAMC checkpointing |
This routine contains the dimensions for TAMC checkpointing |
377 |
and some indices relevant for storing ky computations. |
and some indices relevant for storing ky computations. |
380 |
% |
% |
381 |
\item {\tt \#ifdef ALLOW\_TAMC\_CHECKPOINTING} \\ |
\item {\tt \#ifdef ALLOW\_TAMC\_CHECKPOINTING} \\ |
382 |
3-level checkpointing is enabled, i.e. the timestepping |
3-level checkpointing is enabled, i.e. the timestepping |
383 |
is divided into three different levels (see Section \ref{???}). |
is divided into three different levels (see Section ref:ask-the-author). |
384 |
The model state of the outermost ({\tt nchklev\_3}) and the |
The model state of the outermost ({\tt nchklev\_3}) and the |
385 |
intermediate ({\tt nchklev\_2}) timestepping loop are stored to file |
intermediate ({\tt nchklev\_2}) timestepping loop are stored to file |
386 |
(handled in {\it the\_main\_loop}). |
(handled in {\it the\_main\_loop}). |
415 |
~ |
~ |
416 |
|
|
417 |
\subsubsection{File {\it makefile}} |
\subsubsection{File {\it makefile}} |
418 |
\label{www:tutorials} |
%\label{www:tutorials} |
419 |
|
|
420 |
This file contains all relevant parameter flags and |
This file contains all relevant parameter flags and |
421 |
lists to run TAMC or TAF. |
lists to run TAMC or TAF. |
499 |
|
|
500 |
|
|
501 |
\subsubsection{The input parameter files} |
\subsubsection{The input parameter files} |
502 |
\label{www:tutorials} |
%\label{www:tutorials} |
503 |
|
|
504 |
\paragraph{File {\it data}} |
\paragraph{File {\it data}} |
505 |
|
|
535 |
Contains model state after model spinup. |
Contains model state after model spinup. |
536 |
|
|
537 |
\subsection{Compiling the model and its adjoint} |
\subsection{Compiling the model and its adjoint} |
538 |
\label{www:tutorials} |
%\label{www:tutorials} |
539 |
|
|
540 |
The built process of the adjoint model is slightly more |
The built process of the adjoint model is slightly more |
541 |
complex than that of compiling the forward code. |
complex than that of compiling the forward code. |
657 |
{\small |
{\small |
658 |
\[ |
\[ |
659 |
\boxed{ |
\boxed{ |
660 |
\begin{split} |
\begin{aligned} |
661 |
~ & \mbox{\tt cd bin} \\ |
~ & \mbox{\tt cd bin} \\ |
662 |
~ & \mbox{\tt ln -s ../verification/my\_experiment/code/.genmakerc .} \\ |
~ & \mbox{\tt ln -s ../verification/my\_experiment/code/.genmakerc .} \\ |
663 |
~ & \mbox{\tt ln -s ../verification/my\_experiment/code/*.[Fh] .} \\ |
~ & \mbox{\tt ln -s ../verification/my\_experiment/code/*.[Fh] .} \\ |
669 |
~ & \hspace*{6ex} \mbox{\tt adrestore small\_f allcode admodeltaf/admodeltamc adchange} \\ |
~ & \hspace*{6ex} \mbox{\tt adrestore small\_f allcode admodeltaf/admodeltamc adchange} \\ |
670 |
~ & \mbox{\tt cd ../bin} \\ |
~ & \mbox{\tt cd ../bin} \\ |
671 |
~ & \mbox{\tt make} \\ |
~ & \mbox{\tt make} \\ |
672 |
\end{split} |
\end{aligned} |
673 |
} |
} |
674 |
\] |
\] |
675 |
} |
} |