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