1 | % $Id: user_defined_code.tex 1531 2015-01-26 13:58:29Z raasch $ |
---|
2 | \input{header_tmp.tex} |
---|
3 | %\input{../header_lectures.tex} |
---|
4 | |
---|
5 | \usepackage[utf8]{inputenc} |
---|
6 | \usepackage{ngerman} |
---|
7 | \usepackage{pgf} |
---|
8 | \usepackage{subfigure} |
---|
9 | \usepackage{units} |
---|
10 | \usepackage{multimedia} |
---|
11 | \usepackage{hyperref} |
---|
12 | \newcommand{\event}[1]{\newcommand{\eventname}{#1}} |
---|
13 | \usepackage{xmpmulti} |
---|
14 | \usepackage{tikz} |
---|
15 | \usetikzlibrary{shapes,arrows,positioning} |
---|
16 | %\usetikzlibrary{decorations.markings} %neues paket |
---|
17 | %\usetikzlibrary{decorations.pathreplacing} %neues paket |
---|
18 | \def\Tiny{\fontsize{4pt}{4pt}\selectfont} |
---|
19 | \usepackage{amsmath} |
---|
20 | \usepackage{amssymb} |
---|
21 | \usepackage{multicol} |
---|
22 | \usepackage{pdfcomment} |
---|
23 | \usepackage{graphicx} |
---|
24 | \usepackage{listings} |
---|
25 | \lstset{showspaces=false,language=fortran,basicstyle= |
---|
26 | \ttfamily,showstringspaces=false,captionpos=b} |
---|
27 | |
---|
28 | \institute{Institute of Meteorology and Climatology, Leibniz UniversitÀt Hannover} |
---|
29 | \selectlanguage{english} |
---|
30 | \date{last update: \today} |
---|
31 | \event{PALM Seminar} |
---|
32 | \setbeamertemplate{navigation symbols}{} |
---|
33 | |
---|
34 | \setbeamertemplate{footline} |
---|
35 | { |
---|
36 | \begin{beamercolorbox}[rightskip=-0.1cm]& |
---|
37 | {\includegraphics[height=0.65cm]{imuk_logo.pdf}\hfill \includegraphics[height=0.65cm]{luh_logo.pdf}} |
---|
38 | \end{beamercolorbox} |
---|
39 | \begin{beamercolorbox}[ht=2.5ex,dp=1.125ex, |
---|
40 | leftskip=.3cm,rightskip=0.3cm plus1fil]{title in head/foot} |
---|
41 | {\leavevmode{\usebeamerfont{author in head/foot}\insertshortauthor} \hfill \eventname \hfill \insertframenumber \; / \inserttotalframenumber} |
---|
42 | \end{beamercolorbox} |
---|
43 | \begin{beamercolorbox}[colsep=1.5pt]{lower separation line foot} |
---|
44 | \end{beamercolorbox} |
---|
45 | } |
---|
46 | %\logo{\includegraphics[width=0.3\textwidth]{luhimuk_logo.pdf}} |
---|
47 | |
---|
48 | \title[The PALM User-Interface]{The PALM User-Interface} |
---|
49 | \author{PALM group} |
---|
50 | |
---|
51 | \begin{document} |
---|
52 | |
---|
53 | % Folie 1 |
---|
54 | \begin{frame} |
---|
55 | \titlepage |
---|
56 | \end{frame} |
---|
57 | |
---|
58 | \section{The PALM User-Interface} |
---|
59 | \subsection{The PALM User-Interface} |
---|
60 | |
---|
61 | % Folie 2 |
---|
62 | \begin{frame} |
---|
63 | \frametitle{Purpose of the User-Interface} |
---|
64 | \scriptsize |
---|
65 | \begin{itemize} |
---|
66 | \item<2-> The standard (default) PALM code cannot account for every specific demand of a user. In order to include these specific demands, the user would have to modify the standard code. |
---|
67 | \end{itemize} |
---|
68 | \vspace{2mm} |
---|
69 | \onslide<3-> |
---|
70 | \textbf{Problem:} |
---|
71 | \begin{itemize} |
---|
72 | \item<3-> New releases of PALM (current release is 3.10) would require the user to add his modifications to the new release again. |
---|
73 | \end{itemize} |
---|
74 | \vspace{3mm} |
---|
75 | \onslide<4-> |
---|
76 | \textbf{Solution:} |
---|
77 | \begin{itemize} |
---|
78 | \item<4-> PALM offers a \grqq user-interface\grqq, i.e. a set of subroutines, where the user can add his modifications, and which can be re-used for future releases of the standard PALM code. |
---|
79 | \item<5-> By using the user-interface, the standard code does not have to be modified by the user in most of the cases. |
---|
80 | \item<6-> The user-interface subroutines are almost \grqq empty\grqq\, by default. They are called from the standard PALM code but (with some very minor exceptions) do not contain any executable code. |
---|
81 | \end{itemize} |
---|
82 | \end{frame} |
---|
83 | |
---|
84 | % Folie 3 |
---|
85 | \begin{frame} |
---|
86 | \frametitle{General Structure of the User-Interface} |
---|
87 | \tikzstyle{yellow} = [rectangle, draw, fill=yellow!30, text width=0.7\textwidth, font=\Tiny] |
---|
88 | \scriptsize |
---|
89 | \begin{itemize} |
---|
90 | \item<1-> All routines can be found under \texttt{.../trunk/SOURCE}. |
---|
91 | \item<2-> There is one file for each routine. Filenames are \texttt{user\underline{ }*.f90}.\\ |
---|
92 | Example: \texttt{user\underline{ }last\underline{ }actions.f90} |
---|
93 | \end{itemize} |
---|
94 | \onslide<3-> |
---|
95 | \begin{center} |
---|
96 | \begin{tikzpicture}[auto] |
---|
97 | \node[yellow]{~\texttt{SUBROUTINE user\_last\_actions} \\ |
---|
98 | \par\medskip |
---|
99 | \texttt{!------------------------------------------------------------------------------!}\\ |
---|
100 | \texttt{!}\\ |
---|
101 | \texttt{! Description:}\\ |
---|
102 | \texttt{! ------------}\\ |
---|
103 | \texttt{! Execution of user-defined actions at the end of a job.}\\ |
---|
104 | \texttt{!------------------------------------------------------------------------------!}\\ |
---|
105 | \par\medskip |
---|
106 | ~~~~\texttt{USE control\_parameters}\\ |
---|
107 | ~~~~\texttt{USE kinds}\\ |
---|
108 | ~~~~\texttt{USE user}\\ |
---|
109 | \par\medskip |
---|
110 | ~~~~\texttt{IMPLICIT NONE}\\ |
---|
111 | \par\medskip |
---|
112 | \texttt{!}\\ |
---|
113 | \texttt{!-- Here the user-defined actions at the end of a job follow.}\\ |
---|
114 | \texttt{!-- Sample for user-defined output:}\\ |
---|
115 | \vspace{0.5mm} |
---|
116 | ~~~~\texttt{IF ( write\_binary(1:4) == 'true' ) THEN}\\ |
---|
117 | \vspace{0.5mm} |
---|
118 | \texttt{!~~~~~~~IF ( ALLOCATED( u2\_av ) ) THEN}\\ |
---|
119 | \vspace{0.5mm} |
---|
120 | \texttt{!~~~~~~~~~~WRITE ( 14 ) 'u2\_av~~~~~~~~~~~~~~~'; WRITE ( 14 ) u2\_av}\\ |
---|
121 | \vspace{0.5mm} |
---|
122 | \texttt{!~~~~~~~ENDIF}\\ |
---|
123 | \par\medskip |
---|
124 | ~~~~~~~\texttt{WRITE ( 14 ) '*** end user ***~~~~'}\\ |
---|
125 | \par\medskip |
---|
126 | ~~~~\texttt{ENDIF}\\ |
---|
127 | \par\medskip |
---|
128 | ~\texttt{END SUBROUTINE user\_last\_actions}}; |
---|
129 | \end{tikzpicture} |
---|
130 | \end{center} |
---|
131 | % \includegraphics[scale=0.3]{user_defined_code_figures/user_last_actions.png}\\ |
---|
132 | \end{frame} |
---|
133 | |
---|
134 | % Folie 4 |
---|
135 | \begin{frame} |
---|
136 | \frametitle{Embedding of User-Interface Routines} |
---|
137 | \tikzstyle{yellow} = [rectangle, draw, fill=yellow!30, text width=0.7\textwidth, font=\Tiny] |
---|
138 | \scriptsize |
---|
139 | \begin{itemize} |
---|
140 | \item<1-> The user-interface routines are called from specific, well-defined locations in the standard PALM code.\\ |
---|
141 | \ \\ |
---|
142 | Example from \texttt{palm.f90}: |
---|
143 | \end{itemize} |
---|
144 | \onslide<2-> |
---|
145 | \begin{center} |
---|
146 | \begin{tikzpicture}[auto] |
---|
147 | \node[yellow]{~\texttt{...}\\ |
---|
148 | \vspace{0.5mm} |
---|
149 | \texttt{!}\\ |
---|
150 | \texttt{!-- If required, final user-defined actions, and}\\ |
---|
151 | \texttt{!-- last actions on the open files and close files. Unit 14 was opened}\\ |
---|
152 | \texttt{!-- in write\_3d\_binary but it is closed here, to allow writing on this}\\ |
---|
153 | \texttt{!-- unit in routine user\_last\_actions.}\\ |
---|
154 | \vspace{0.5mm} |
---|
155 | ~~~~\texttt{CALL cpu\_log( log\_point(4), 'last actions', 'start' )}\\ |
---|
156 | ~~~~\texttt{DO i = 0, io\_blocks-1}\\ |
---|
157 | ~~~~~~~\texttt{IF ( i == io\_group ) THEN}\\ |
---|
158 | ~~~~~~~~~~\texttt{\textcolor{blue}{CALL user\_last\_actions}}\\ |
---|
159 | \vspace{0.5mm} |
---|
160 | ~~~~~~~~~~\texttt{IF ( write\_binary(1:4) == 'true' ) CALL close\_file( 14 )}\\ |
---|
161 | ~~~~~~~\texttt{ENDIF}\\ |
---|
162 | \vspace{0.5mm} |
---|
163 | \texttt{\#if defined( \_\_parallel )}\\ |
---|
164 | ~~~~~~~\texttt{CALL MPI\_BARRIER( comm2d, ierr )}\\ |
---|
165 | \vspace{0.5mm} |
---|
166 | \texttt{\#endif}\\ |
---|
167 | \vspace{0.5mm} |
---|
168 | ~~~~\texttt{ENDDO}\\ |
---|
169 | \vspace{0.5mm} |
---|
170 | ~~~~\texttt{CALL close\_file( 0 )}\\ |
---|
171 | \vspace{0.5mm} |
---|
172 | ~~~~\texttt{CALL close\_dvrp}\\ |
---|
173 | ~~~~\texttt{CALL cpu\_log( log\_point(4), 'last actions', 'stop' )}\\ |
---|
174 | \vspace{1mm} |
---|
175 | ~\texttt{...}\\ |
---|
176 | \vspace{1mm} |
---|
177 | \texttt{!}\\ |
---|
178 | \texttt{!-- Take final CPU-time for CPU-time analysis}\\ |
---|
179 | ~~~~\texttt{CALL cpu\_log( log\_point(1), 'total', 'stop' )}\\ |
---|
180 | ~~~~\texttt{CALL cpu\_statistics}\\ |
---|
181 | \texttt{\#if defined( \_\_parallel )}\\ |
---|
182 | ~~~~\texttt{CALL MPI\_FINALIZE( ierr )}\\ |
---|
183 | \vspace{0.5mm} |
---|
184 | \texttt{\#endif}\\ |
---|
185 | \par\medskip |
---|
186 | ~\texttt{END PROGRAM palm}}; |
---|
187 | \end{tikzpicture} |
---|
188 | \end{center} |
---|
189 | |
---|
190 | % \includegraphics[scale=0.33]{user_defined_code_figures/embedding.png}\\ |
---|
191 | \end{frame} |
---|
192 | |
---|
193 | |
---|
194 | % Folie 5 |
---|
195 | \begin{frame} |
---|
196 | \frametitle{Embedding of User-Interface Routines\\ |
---|
197 | Flow Chart Overview (I): Initial Steps} |
---|
198 | \scriptsize |
---|
199 | \begin{tikzpicture}[scale=0.8, transform shape] |
---|
200 | % Define colours |
---|
201 | \tikzstyle{green} = [draw, fill=green!30, text width=7.1em, text centered, minimum height=1.6em] |
---|
202 | \tikzstyle{green1} = [draw, fill=green!30, text width=12em, text centered, minimum height=1.6em] |
---|
203 | \tikzstyle{green2} = [draw, fill=green!30, text width=10em, text centered, minimum height=1.6em] |
---|
204 | \tikzstyle{yellow} = [draw, fill=yellow!30, text width=7.1em, text centered, minimum height=1.6em] |
---|
205 | \tikzstyle{orange} = [draw, fill=orange!60, text width=7.1em, text centered] |
---|
206 | |
---|
207 | % Define coordinates and draw nodes |
---|
208 | \node[yellow, text width=5em] (PALM) at (0,0.1) {PALM}; |
---|
209 | |
---|
210 | \coordinate (A) at (0,-0.7); |
---|
211 | \node[yellow, right=0.6cm of A] (parin) {parin}; |
---|
212 | |
---|
213 | \node[green, right=1mm of parin] (userparin) {user\_parin}; |
---|
214 | \draw[-] (parin) -- (userparin); |
---|
215 | |
---|
216 | \coordinate[below=0.6cm of A] (B); |
---|
217 | \node[yellow, right=0.6cm of B] (initgrid) {init\_grid}; |
---|
218 | |
---|
219 | \node[green, right=1mm of initgrid] (userinigrid) {user\_init\_grid}; |
---|
220 | \draw[-] (initgrid) -- (userinigrid); |
---|
221 | |
---|
222 | \coordinate[below=0.6cm of B] (C); |
---|
223 | \node[yellow, right=0.6cm of C] (checkparam) {check\_parameters}; |
---|
224 | |
---|
225 | \coordinate[below=0.3cm of checkparam] (D); |
---|
226 | \node[green1, right=0.6cm of D] (usercheckdataout) {user\_check\_data\_output/\_pr}; |
---|
227 | |
---|
228 | \coordinate[below=0.55cm of D] (E); |
---|
229 | \node[green1, right=0.6cm of E] (usercheckparam) {user\_check\_parameters}; |
---|
230 | |
---|
231 | \coordinate[below=1.7cm of C] (F); |
---|
232 | \node[yellow, right=0.6cm of F] (init3dmodel) {init\_3d\_model}; |
---|
233 | |
---|
234 | \coordinate[below=0.3cm of init3dmodel] (G); |
---|
235 | \node[green2, right=0.6cm of G] (userinit3d) {user\_init\_3d\_model}; |
---|
236 | |
---|
237 | \coordinate[below=0.55cm of G] (H); |
---|
238 | \node[yellow, right=0.6cm of H] (read3dbin) {read\_3d\_binary}; |
---|
239 | |
---|
240 | \coordinate[below=0.3cm of read3dbin] (I); |
---|
241 | \node[green1, right=0.6cm of I] (userreadrestart) {user\_read\_restart\_data}; |
---|
242 | |
---|
243 | \coordinate[below=1.15cm of H] (J); |
---|
244 | \node[green1, right=0.6cm of J] (userinitplan) {user\_init\_plant\_canopy}; |
---|
245 | |
---|
246 | \coordinate[below=0.6cm of J] (K); |
---|
247 | \node[yellow, right=0.6cm of K] (lpminit) {lpm\_init}; |
---|
248 | |
---|
249 | \node[green, right=1mm of lpminit] (userlpminit) {user\_lpm\_init}; |
---|
250 | \draw[-] (lpminit) -- (userlpminit); |
---|
251 | |
---|
252 | \coordinate[below=0.6cm of K] (L); |
---|
253 | \node[green, right=0.6cm of L] (userinit) {user\_init}; |
---|
254 | |
---|
255 | \coordinate[below=4.05cm of F] (M); |
---|
256 | \node[yellow, right=0.6cm of M] (header) {header}; |
---|
257 | |
---|
258 | \node[green, right=1mm of header] (userheader) {user\_header}; |
---|
259 | \draw[-] (header) -- (userheader); |
---|
260 | % |
---|
261 | % Draw lines |
---|
262 | \draw[-, thick] (PALM) -- (0,-7.8); |
---|
263 | \draw[dotted, thick] (0,-8.2) -- (0,-7.8); |
---|
264 | \draw[-] (A) -- (parin); |
---|
265 | \draw[-] (B) -- (initgrid); |
---|
266 | \draw[-] (C) -- (checkparam); |
---|
267 | \draw[-] (checkparam.south) |- (usercheckdataout.west); |
---|
268 | \draw[-] (checkparam.south) |- (usercheckparam.west); |
---|
269 | \draw[-] (F) -- (init3dmodel); |
---|
270 | \draw[-,dashed] (init3dmodel.south) |- (userinit3d.west); |
---|
271 | \draw[-,dashed] (init3dmodel.south) |- (read3dbin.west); |
---|
272 | \draw[-] (read3dbin.south) |- (userreadrestart.west); |
---|
273 | \draw[-,dashed] (init3dmodel.south) |- (userinitplan); |
---|
274 | \draw[-,dashed] (init3dmodel.south) |- (lpminit); |
---|
275 | \draw[-] (init3dmodel.south) |- (userinit); |
---|
276 | \draw[-] (M) -- (header); |
---|
277 | |
---|
278 | \end{tikzpicture} |
---|
279 | \end{frame} |
---|
280 | |
---|
281 | % Folie 6 |
---|
282 | \begin{frame} |
---|
283 | \frametitle{Embedding of User-Interface Routines\\ |
---|
284 | Flow Chart Overview (II): Time Integration Loop} |
---|
285 | \scriptsize |
---|
286 | \begin{tikzpicture}[scale=0.7, transform shape] |
---|
287 | % Define colours |
---|
288 | \tikzstyle{green} = [draw, fill=green!30, text width=7.1em, text centered, minimum height=1.6em] |
---|
289 | \tikzstyle{green1} = [draw, fill=green!30, text width=10em, text centered, minimum height=1.6em] |
---|
290 | \tikzstyle{yellow} = [draw, fill=yellow!30, text width=7.1em, text centered, minimum height=1.6em] |
---|
291 | \tikzstyle{orange} = [draw, fill=orange!60, text width=7.1em, text centered] |
---|
292 | \tikzstyle{orange1} = [draw, fill=orange!80, text width=11em, text centered] |
---|
293 | \definecolor{grey}{rgb}{0.25,0.25,0.25} |
---|
294 | |
---|
295 | % Define coordinates and draw nodes |
---|
296 | \node[draw, text width=25em,minimum height=4.0em,fill=black!15] (progframe) at (5.75,-1.5) {}; |
---|
297 | |
---|
298 | \coordinate (A) at (0,0); |
---|
299 | |
---|
300 | \node[orange, right=0.6cm of A] (timeint) {time\_integration}; |
---|
301 | |
---|
302 | \coordinate[below=0.3cm of timeint] (B); |
---|
303 | \coordinate[below=0.8cm of timeint] (C); |
---|
304 | \coordinate[right=2cm of C] (D); |
---|
305 | \coordinate[right=3.8cm of D] (E); |
---|
306 | |
---|
307 | \node[green, right=0.6cm of B, text width=14em] (useractions1) {\textcolor{blue}{user\_actions\_(\textit{'before\_timestep'})}}; |
---|
308 | |
---|
309 | \node[orange1, below=0.2cm of D] (progeq) {prognostic\_equations\_vector}; |
---|
310 | \node[orange1, below=0.2cm of E] (progeqfast) {prognostic\_equations\_cache}; |
---|
311 | |
---|
312 | \node[green, right=0.3cm of progframe, text width=14em] (useractions2) {\textcolor{blue}{user\_actions\_(\textit{'*\_tendency'})}}; |
---|
313 | |
---|
314 | |
---|
315 | \coordinate[below=2.3cm of timeint] (F); |
---|
316 | \coordinate[below=2.9cm of timeint] (G); |
---|
317 | \coordinate[below=3.5cm of timeint] (H); |
---|
318 | \coordinate[below=4.1cm of timeint] (I); |
---|
319 | |
---|
320 | |
---|
321 | \node[yellow, right=0.6cm of F] (lpm) {lpm}; |
---|
322 | \node[green, right=0.9cm of lpm, text width=10em] (userlpmadvec) {user\_lpm\_advec}; |
---|
323 | \node[yellow, right=0.6cm of G] (exchangehoriz) {exchange\_horiz}; |
---|
324 | % \node[yellow, right=0.0cm of exchangehoriz] (asselin) {asselin\_filter}; |
---|
325 | \node[yellow, right=0.6cm of H] (swaptimelevel) {swap\_timelevel}; |
---|
326 | \node[yellow, right=0.6cm of I] (pres) {pres}; |
---|
327 | |
---|
328 | \coordinate[below=0.3cm of pres] (J); |
---|
329 | \coordinate[below=5.1cm of timeint] (K); |
---|
330 | \coordinate[below=5.7cm of timeint] (L); |
---|
331 | \coordinate[below=6.3cm of timeint] (M); |
---|
332 | \coordinate[below=6.9cm of timeint] (N); |
---|
333 | \coordinate[below=8.2cm of timeint] (O); |
---|
334 | \coordinate[below=8.8cm of timeint] (P); |
---|
335 | |
---|
336 | % \node[yellow, right=0.6cm of K] (prandtlfluxes) {prandtl\_fluxes}; |
---|
337 | \node[green, right=0.6cm of K, text width=14em] (useractions3) {\textcolor{blue}{user\_actions\_(\textit{'after\_integration'})}}; |
---|
338 | % \node[yellow, right=0.6cm of L] (diffusivities) {diffusivities}; |
---|
339 | % \node[yellow, right=0.6cm of L] (checkrestart) {check\_for\_restart}; |
---|
340 | \node[yellow, right=0.6cm of L] (flowstat) {flow\_statistics}; |
---|
341 | \node[green, right=0.6cm of flowstat] (userstat2) {user\_statistics}; |
---|
342 | |
---|
343 | \node[yellow, right=0.6cm of M] (sum3ddata) {sum\_up\_3d\_data}; |
---|
344 | \node[green1, right=0.6cm of sum3ddata] (user3ddataav) {user\_3d\_data\_averaging}; |
---|
345 | |
---|
346 | \node[green, right=0.6cm of O, text width=14em] (useractions4) {\textcolor{blue}{user\_actions\_(\textit{'after\_timestep'})}}; |
---|
347 | % \node[yellow, right=0.6cm of P] (timestep) {timestep}; |
---|
348 | |
---|
349 | \node[yellow, right=0.2cm of user3ddataav] (dataoutput) {data\_output\_***}; |
---|
350 | \node[green, right=0.2cm of dataoutput] (userdvrpcoltab) {user\_dvrp\_coltab}; |
---|
351 | \coordinate[below=0.2cm of dataoutput] (Q); |
---|
352 | \coordinate[right=0.4cm of Q] (R); |
---|
353 | \coordinate[right=3.0cm of R] (S); |
---|
354 | |
---|
355 | \node[green, below=0.2cm of R, text width=9em] (output2d) {user\_data\_output\_2d}; |
---|
356 | \node[green, below=0.2cm of S, text width=9em] (output3d) {user\_data\_output\_3d}; |
---|
357 | |
---|
358 | |
---|
359 | |
---|
360 | \draw[dotted, thick] (0,0.05) -- (0,0.3); |
---|
361 | \draw[-, thick] (0,0.05) -- (0,-8.8); |
---|
362 | \draw[dotted, thick] (0,-9.2) -- (0,-8.8); |
---|
363 | \draw[-, thick] (A) -- (timeint); |
---|
364 | \draw[-, thick] (timeint) -- (P); |
---|
365 | \draw[-, thick] (B) -- (useractions1); |
---|
366 | \draw[-, thick] (C) -- (D); |
---|
367 | \draw[-, thick] (D) -- (E); |
---|
368 | \draw[->, thick] (E) -- (progeqfast); |
---|
369 | \draw[-, thick] (progeq) -- (D); |
---|
370 | \draw[-, thick] (progframe) -- (useractions2); |
---|
371 | \draw[-, thick] (F) -- (lpm); |
---|
372 | \draw[-, thick] (userlpmadvec) -- (lpm); |
---|
373 | \draw[-, thick] (G) -- (exchangehoriz); |
---|
374 | \draw[-, thick] (H) -- (swaptimelevel); |
---|
375 | \draw[-, thick] (I) -- (pres); |
---|
376 | \draw[dotted, thick] (pres) -- (J); |
---|
377 | % \draw[-, thick] (K) -- (prandtlfluxes); |
---|
378 | \draw[-, thick] (K) -- (useractions3); |
---|
379 | \draw[-, thick] (L) -- (flowstat); |
---|
380 | \draw[-, thick] (M) -- (sum3ddata); |
---|
381 | \draw[-, thick] (sum3ddata) -- (user3ddataav); |
---|
382 | |
---|
383 | \draw[-, thick] (userstat2) -- (flowstat); |
---|
384 | \draw[-, thick] (O) -- (useractions4); |
---|
385 | % \draw[-, thick] (O) -- (timestep); |
---|
386 | \draw[-, thick] (dataoutput) -- (Q); |
---|
387 | \draw[-, thick] (S) -- (Q); |
---|
388 | \draw[-, thick] (R) -- (output2d); |
---|
389 | \draw[-, thick] (S) -- (output3d); |
---|
390 | \end{tikzpicture} |
---|
391 | \end{frame} |
---|
392 | |
---|
393 | |
---|
394 | % Folie 7 |
---|
395 | \begin{frame} |
---|
396 | \frametitle{Embedding of User-Interface Routines\\ |
---|
397 | Flow Chart Overview (III): Final Steps} |
---|
398 | \scriptsize |
---|
399 | \begin{tikzpicture}[scale=0.8, transform shape] |
---|
400 | % Define colours |
---|
401 | \tikzstyle{green} = [draw, fill=green!30, text width=7.1em, text centered, minimum height=1.6em] |
---|
402 | \tikzstyle{yellow} = [draw, fill=yellow!30, text width=7.1em, text centered, minimum height=1.6em] |
---|
403 | \tikzstyle{orange} = [draw, fill=orange!60, text width=7.1em, text centered] |
---|
404 | |
---|
405 | % Define coordinates and draw nodes |
---|
406 | \node[green, text width=5em] (PALM) at (0,0.1) {PALM}; |
---|
407 | |
---|
408 | \coordinate (A) at (0,-0.7); |
---|
409 | |
---|
410 | |
---|
411 | \node[orange, right=0.6cm of A] (timeint) {time\_integration}; |
---|
412 | \coordinate[below=0.5cm of timeint] (B); |
---|
413 | \coordinate[below=1.0cm of timeint] (C); |
---|
414 | |
---|
415 | \coordinate[below=2.5cm of PALM] (D); |
---|
416 | |
---|
417 | \node[yellow, right=0.6cm of D] (write3dbinary) {write\_3d\_binary}; |
---|
418 | \node[yellow, right=0.9cm of write3dbinary] (writevarlist) {write\_var\_list}; |
---|
419 | |
---|
420 | \coordinate[below=3.5cm of PALM] (E); |
---|
421 | \coordinate[below=4.1cm of PALM] (F); |
---|
422 | \coordinate[below=4.7cm of PALM] (G); |
---|
423 | \node[yellow, right=0.6cm of E] (header) {header}; |
---|
424 | \node[green, right=0.6cm of F] (userlastactions) {user\_last\_actions}; |
---|
425 | \node[yellow, right=0.6cm of G] (cpustat) {cpu\_statistics}; |
---|
426 | % Draw lines |
---|
427 | \draw[-, thick] (PALM) -- (G); |
---|
428 | \draw[-, thick] (A) -- (timeint); |
---|
429 | \draw[-, thick] (B) -- (timeint); |
---|
430 | \draw[dotted, thick] (B) -- (C); |
---|
431 | \draw[dashed, thick] (D) -- (write3dbinary); |
---|
432 | \draw[-, thick] (write3dbinary) -- (writevarlist); |
---|
433 | \draw[-, thick] (E) -- (header); |
---|
434 | \draw[-, thick] (F) -- (userlastactions); |
---|
435 | \draw[-, thick] (G) -- (cpustat); |
---|
436 | |
---|
437 | \end{tikzpicture} |
---|
438 | \end{frame} |
---|
439 | |
---|
440 | % Folie 8 |
---|
441 | \begin{frame} |
---|
442 | \frametitle{Complete List of User-Interface Routines (I)} |
---|
443 | \tiny |
---|
444 | \begin{tabular}{|p{2.5cm}|p{2.4cm}|p{2.1cm}|p{3cm}|} |
---|
445 | \hline |
---|
446 | \textbf{Name} & \textbf{Arguments} & \textbf{Called from} & \textbf{Task}\\ |
---|
447 | \hline |
---|
448 | \texttt{user\_3d\_data\_averaging} & \texttt{mode}, \texttt{variable} & \texttt{average\_3d\_data} + \texttt{sum\_up\_3d\_data} & temporal averaging for user-defined quantities\\ |
---|
449 | \hline |
---|
450 | \texttt{user\_actions} \texttt{user\_actions} & \texttt{location} \,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\, \texttt{i}, \texttt{j}, \texttt{location} & \texttt{time\_integration} + |
---|
451 | \texttt{prognostic\_equations} & e.g. additional forces to be included in the prognostic equations\\ |
---|
452 | \hline |
---|
453 | \texttt{user\_dummy (user\_additional \_routines.f90)} & - - - & - - - & for additional subroutines defined by the user\\ |
---|
454 | \hline |
---|
455 | \texttt{user\_check\_data\_output} & \texttt{variable}, \texttt{unit} & \texttt{check\_parameters} + \texttt{init\_masks}& check the user-defined output quantities\\ |
---|
456 | \hline |
---|
457 | \texttt{user\_check\_data\_output\_pr} & \texttt{variable}, \texttt{var\_count}, \texttt{unit} & \texttt{check\_parameters} & check the user-defined profile output quantities\\ |
---|
458 | \hline |
---|
459 | \texttt{user\_check\_parameters} & - - - & \texttt{check\_parameters} & check user-defined variables\\ |
---|
460 | \hline |
---|
461 | \texttt{user\_data\_output\_2d} & \texttt{av}, \texttt{variable}, \texttt{found}, \texttt{grid}, \texttt{local\_pf}, \texttt{two\_d} & \texttt{data\_output\_2d} & output/calculation of additional user-defined quantities\\ |
---|
462 | \hline |
---|
463 | \texttt{user\_data\_output\_3d} & \texttt{av}, \texttt{variable}, \texttt{found}, \texttt{local\_pf}, \texttt{nz\_do} & \texttt{data\_output\_3d} & output/calculation of additional user-defined quantities\\ |
---|
464 | \hline |
---|
465 | \texttt{user\_data\_output\_dvrp} & \texttt{output\_variable}, \texttt{local\_pf} & \texttt{data\_output\_dvrp} & output of additional user-defined quantities\\ |
---|
466 | \hline |
---|
467 | \texttt{user\_data\_output\_mask} & \texttt{av}, \texttt{variable}, \texttt{found}, \texttt{local\_pf} & \texttt{data\_output\_mask} & output of additional masked user-defined quantities\\ |
---|
468 | \hline |
---|
469 | \texttt{user\_define\_netcdf\_grid} & \texttt{variable}, \texttt{found}, \texttt{grid\_x}, \texttt{grid\_y}, \texttt{grid\_z} & \texttt{netcdf} & defining the grid for additional output quantities\\ |
---|
470 | \hline |
---|
471 | \texttt{user\_dvrp\_coltab} & \texttt{mode}, \texttt{variable} & \texttt{data\_output\_dvrp} & defining color tables for particles\\ |
---|
472 | \hline |
---|
473 | \texttt{user\_header} & \texttt{io} & \texttt{header} & output user variables to header\\ |
---|
474 | \hline |
---|
475 | \texttt{user\_init} & - - - & \texttt{init\_3d\_model} & e.g. reading from restart file\\ |
---|
476 | \hline |
---|
477 | \end{tabular} |
---|
478 | |
---|
479 | \end{frame} |
---|
480 | |
---|
481 | % Folie 9 |
---|
482 | \begin{frame} |
---|
483 | \frametitle{Complete List of User-Interface Routines (II)} |
---|
484 | \tiny |
---|
485 | \ \\ |
---|
486 | \begin{tabular}{|p{2.5cm}|p{2.4cm}|p{2.1cm}|p{3cm}|} |
---|
487 | \hline |
---|
488 | \textbf{Name} & \textbf{Arguments} & \textbf{Called from} & \textbf{Task}\\ |
---|
489 | \hline |
---|
490 | \texttt{user\_init\_3d\_model} & - - - & \texttt{init\_3d\_model} & special initializations\\ |
---|
491 | \hline |
---|
492 | \texttt{user\_init\_grid} & \texttt{gls} & \texttt{init\_grid} & defining a special topography\\ |
---|
493 | \hline |
---|
494 | \texttt{user\_init\_plant\_canopy} & - - - & \texttt{init\_3d\_model} & setting of leaf area density and canopy drag coefficient\\ |
---|
495 | \hline |
---|
496 | \texttt{user\_last\_actions} & - - - & \texttt{palm} & e.g. output for restart runs\\ |
---|
497 | \hline |
---|
498 | \texttt{user\_lpm\_advec} & - - - & \texttt{lpm} & modification of particles after advection \\ |
---|
499 | \hline |
---|
500 | \texttt{user\_lpm\_init} & - - - & \texttt{lpm\_init} & defining initial particle sources \\ |
---|
501 | \hline |
---|
502 | \texttt{user\_lpm\_set\_attributes} & - - - & \texttt{lpm} & defining particles attributes \\ |
---|
503 | \hline |
---|
504 | \texttt{MODULE user (user\_module.f90)} & - - - & - - - & contains user defined variables\\ |
---|
505 | \hline |
---|
506 | \texttt{user\_parin} & & \texttt{parin} & reading user variables\\ |
---|
507 | \hline |
---|
508 | \texttt{user\_read\_restart\_data} & \texttt{i}, \texttt{nxlfa}, \texttt{nxl\_on\_file}, \texttt{nxrfa}, \texttt{nxr\_on\_file}, \texttt{nynfa}, \texttt{nyn\_on\_file}, \texttt{nysfa}, \texttt{nys\_on\_file}, \texttt{offset\_xa}, \texttt{offset\_ya}, \texttt{overlap\_count}, \texttt{tmp\_2d}, \texttt{tmp\_3d} & \texttt{read\_3d\_binary} & reading user-defined 2d/3d-arrays from the restart file\\ |
---|
509 | \hline |
---|
510 | \texttt{user\_spectra} & \texttt{mode}, \texttt{m}, \texttt{pr} & \texttt{calc\_spectra} + \texttt{data\_output\_spectra} & output/calculation of additional user-defined quantities\\ |
---|
511 | \hline |
---|
512 | \texttt{user\_statistics} & \texttt{mode}, \texttt{sr}, \texttt{tn} & \texttt{flow\_statistics} & calculating additional horizontal averages + time series quantities\\ |
---|
513 | \hline |
---|
514 | \end{tabular} |
---|
515 | \ \\ |
---|
516 | \ \\ |
---|
517 | See PALM online documentation under \\ |
---|
518 | \textbf{http://palm.muk.uni-hannover.de/wiki/doc/app/userint}\\ |
---|
519 | for detailed explanations. |
---|
520 | |
---|
521 | \end{frame} |
---|
522 | |
---|
523 | % Folie 10 |
---|
524 | \begin{frame} |
---|
525 | \frametitle{Data Access / Exchange} |
---|
526 | \tikzstyle{yellow} = [rectangle, draw, fill=yellow!30, text width=0.6\textwidth, font=\tiny] |
---|
527 | \footnotesize |
---|
528 | \begin{itemize} |
---|
529 | \item<2-> \textbf{Between the standard PALM code and the user-interface:}\\ |
---|
530 | \begin{itemize} |
---|
531 | \scriptsize |
---|
532 | \item<3-> by including the respective \textcolor{blue}{PALM modules} in the user-interface subroutines.\\ |
---|
533 | \begin{center} |
---|
534 | % \includegraphics[scale=0.3]{user_defined_code_figures/data_access_exchange.png} |
---|
535 | \begin{tikzpicture}[auto] |
---|
536 | \node[yellow]{\texttt{SUBROUTINE user\_actions( location )} \\ |
---|
537 | \par\medskip |
---|
538 | ~~~~~\texttt{\textcolor{blue}{USE arrays\_3d}} \\ |
---|
539 | ~~~~~\texttt{\textcolor{blue}{USE control\_parameters}} \\ |
---|
540 | ~~~~~\texttt{\textcolor{blue}{USE cpulog}} \\ |
---|
541 | ~~~~~\texttt{\textcolor{blue}{USE indices}} \\ |
---|
542 | ~~~~~\texttt{\textcolor{blue}{USE interfaces}} \\ |
---|
543 | ~~~~~\texttt{\textcolor{blue}{USE pegrid}} \\ |
---|
544 | ~~~~~\texttt{\textcolor{red}{USE user}} \\ |
---|
545 | \par\medskip |
---|
546 | ~~~~~\texttt{IMPLICIT NONE} \\ |
---|
547 | \par\medskip |
---|
548 | ~~~~~\texttt{CHARACTER (LEN=$^\ast$) :: location} \\ |
---|
549 | \par\medskip |
---|
550 | ~~~~~\texttt{INTEGER :: i, j, k}}; |
---|
551 | \end{tikzpicture} |
---|
552 | \end{center} |
---|
553 | \end{itemize} |
---|
554 | \item<4-> \textbf{Within the user-interface:} |
---|
555 | \begin{itemize} |
---|
556 | \scriptsize |
---|
557 | \item by the module \texttt{\textcolor{red}{user}} (file \texttt{user\underline{ }module.f90}), which is used in every subroutine included in the interface.\\ \textbf{This module is (and should be) never used in the standard PALM code (otherwise, the default code would depend on the user\\ interface).} |
---|
558 | \end{itemize} |
---|
559 | \end{itemize} |
---|
560 | |
---|
561 | \end{frame} |
---|
562 | |
---|
563 | % Folie 11 |
---|
564 | \begin{frame} |
---|
565 | \frametitle{Usage of \texttt{user\underline{ }actions} (I)} |
---|
566 | \tikzstyle{yellow} = [rectangle, draw, fill=yellow!30, text width=0.7\textwidth, font=\tiny] |
---|
567 | \scriptsize |
---|
568 | \begin{itemize} |
---|
569 | \item<1-> \texttt{user\underline{ }actions} is designed to add additional terms to the prognostic equations or to carry out special actions at the beginning or the end of each timestep. |
---|
570 | \vspace{1.8mm} |
---|
571 | \item<2-> Therefore, several calls of \texttt{user\underline{ }actions} can be found in the default PALM routines \texttt{time\underline{ }integration} and \texttt{prognostic\underline{ }equations}. The place from which it is called is communicated to the routine by a string-argument, e.g.\\ |
---|
572 | \ \\ |
---|
573 | \quad \texttt{CALL user\underline{ }actions( 'u-tendency' )}\\ |
---|
574 | \ \\ |
---|
575 | \onslide<3-> It means that this call is from a line within \texttt{prognostic\underline{ }equations}, where the tendencies for the u-component are calculated and integrated: |
---|
576 | \end{itemize} |
---|
577 | \vspace{-3mm} |
---|
578 | \begin{center} |
---|
579 | \begin{tikzpicture}[auto] |
---|
580 | \node[yellow] {\texttt{DO i = nxl, nxr} \\ |
---|
581 | ~~~\texttt{DO j = nys, nyn} \\ |
---|
582 | \texttt{...} \\ |
---|
583 | ~~~~~~\texttt{CALL diffusion\_u( i, j )}\\ |
---|
584 | ~~~~~~\texttt{CALL coriolis( i, j, 1 )} \\ |
---|
585 | \texttt{...}\\ |
---|
586 | ~~~~~~\texttt{\textcolor{blue}{CALL user\_actions( i, j, 'u-tendency' )}}\\ |
---|
587 | \texttt{!} \\ |
---|
588 | \texttt{!-- Prognostic equation for u-velocity component} \\ |
---|
589 | ~~~~~~\texttt{DO k = nzb\_u\_inner(j,i)+1, nzt} \\ |
---|
590 | ~~~~~~~~~\texttt{u\_p(k,j,i) = u(k,j,i) + dt\_3d * ( tsc(2) * tend(k,j,i) + \&} \\ |
---|
591 | \hspace{4.08cm} \texttt{tsc(3) * tu\_m(k,j,i) ) \&} \\ |
---|
592 | \hspace{2.93cm} \texttt{- tsc(5) * rdf(k) * ( u(k,j,i) - ug(k) )}\\ |
---|
593 | ~~~~~~\texttt{ENDDO} \\ |
---|
594 | \texttt{...}}; |
---|
595 | \end{tikzpicture} |
---|
596 | \end{center} |
---|
597 | % \begin{center} |
---|
598 | % \includegraphics[scale=0.33]{user_defined_code_figures/user_actions_1.png} |
---|
599 | % \end{center} |
---|
600 | \end{frame} |
---|
601 | |
---|
602 | % Folie 12 |
---|
603 | \begin{frame} |
---|
604 | \frametitle{Usage of \texttt{user\underline{ }actions} (II)} |
---|
605 | \tikzstyle{yellow} = [rectangle, draw, fill=yellow!30, text width=0.7\textwidth, font=\tiny] |
---|
606 | \scriptsize |
---|
607 | \begin{itemize} |
---|
608 | \item Additional tendencies have to be included by the user at the respective code line in \texttt{user\underline{ }actions}: |
---|
609 | \end{itemize} |
---|
610 | \begin{center} |
---|
611 | \begin{tikzpicture}[auto] |
---|
612 | \node[yellow]{~\texttt{SUBROUTINE user\_actions( location )}\\ |
---|
613 | \texttt{...}\\ |
---|
614 | \texttt{!}\\ |
---|
615 | \texttt{!-- Here the user-defined actions follow}\\ |
---|
616 | \texttt{!-- No calls for single grid points are allowed at locations before and}\\ |
---|
617 | \texttt{!-- after the timestep, since these calls are not within an i,j-loop}\\ |
---|
618 | ~~~~~~\texttt{SELECT CASE ( location )}\\ |
---|
619 | \texttt{...}\\ |
---|
620 | ~~~~~~~~~~\texttt{CASE ( 'after\_timestep' )}\\ |
---|
621 | \texttt{!}\\ |
---|
622 | \texttt{!-- \hspace{6mm}Enter actions to be done after every timestep here}\\ |
---|
623 | \par\medskip |
---|
624 | ~~~~~~~~~~\texttt{CASE ( 'u-tendency' )}\\ |
---|
625 | \texttt{!}\\ |
---|
626 | \texttt{!-- \hspace{6mm}Enter actions to be done in the u-tendency term here}\\ |
---|
627 | ~~~~~~~~~~~~~~\texttt{\textcolor{blue}{DO i = nxl, nxr}}\\ |
---|
628 | ~~~~~~~~~~~~~~~~~\texttt{\textcolor{blue}{DO j = nys, nyn}}\\ |
---|
629 | ~~~~~~~~~~~~~~~~~~~~\texttt{\textcolor{blue}{DO k = nxb+1, nzt}}\\ |
---|
630 | ~~~~~~~~~~~~~~~~~~~~~~~~~~\texttt{\textcolor{blue}{tend(k,j,i) = tend(k,j,i) - const * u(k,j,i) ...}}\\ |
---|
631 | ~~~~~~~~~~~~~~~~~~~~\texttt{\textcolor{blue}{ENDDO}}\\ |
---|
632 | ~~~~~~~~~~~~~~~~~\texttt{\textcolor{blue}{ENDDO}}\\ |
---|
633 | ~~~~~~~~~~~~~~\texttt{\textcolor{blue}{ENDDO}}\\ |
---|
634 | \par\bigskip |
---|
635 | ~~~~~~~~~~\texttt{CASE ( 'v-tendency' )}\\ |
---|
636 | \texttt{...}}; |
---|
637 | \end{tikzpicture} |
---|
638 | % \includegraphics[scale=0.35]{user_defined_code_figures/user_actions_2.png} |
---|
639 | \end{center} |
---|
640 | \end{frame} |
---|
641 | |
---|
642 | % Folie 13 |
---|
643 | \begin{frame}[t] |
---|
644 | \frametitle{Usage of \texttt{user\underline{ }actions} (III)} |
---|
645 | \tikzstyle{yellow} = [rectangle, draw, fill=yellow!30, text width=0.5\textwidth, font=\Tiny] |
---|
646 | \scriptsize |
---|
647 | \begin{columns}[T] |
---|
648 | \begin{column}{1.15\textwidth} |
---|
649 | \begin{itemize} |
---|
650 | \item<1-> The different versions of \texttt{prognostic\underline{ }equations} (\texttt{prognostic\underline{ }equations\underline{ }cache}, \texttt{prognostic\underline{ }equations\underline{ }vector}) contain different calls of \texttt{user\underline{ }actions}: |
---|
651 | \item<2-> From \texttt{prognostic\underline{ }equations\underline{ }vector}: \hspace{0.6em}\texttt{CALL user\underline{ }actions( 'u-tendency' )} |
---|
652 | \item<3-> From \texttt{prognostic\underline{ }equations},\\ |
---|
653 | \texttt{prognostic\underline{ }equations\underline{ }cache}:\hspace{4em}\texttt{CALL user\underline{ }actions( i, j, 'u-tendency' )} |
---|
654 | \vspace{3mm} |
---|
655 | \item<4-> In case that \texttt{prognostic\underline{ }equations}\\ |
---|
656 | \texttt{prognostic\underline{ }equations\underline{ }cache} are\\ |
---|
657 | used, the user has to add his code in\\ |
---|
658 | the interface routine\\ |
---|
659 | \texttt{user\underline{ }actions\underline{ }ij}: |
---|
660 | \vspace{3mm} |
---|
661 | \item<5-> Here, only the \texttt{k}-loop (vertical direction)\\ |
---|
662 | has to be used, because loops over\\ |
---|
663 | i and j are executed in\\ |
---|
664 | \texttt{prognostic\underline{ }equations\underline{ }cache}. |
---|
665 | \end{itemize} |
---|
666 | \end{column} |
---|
667 | \end{columns} |
---|
668 | |
---|
669 | \uncover<4->{% |
---|
670 | \begin{tikzpicture}[remember picture, overlay] |
---|
671 | \node [yellow,shift={(9.2 cm,3.0cm)}] at (current page.south west){~\texttt{SUBROUTINE user\_actions\_ij( i, j, location )}\\ |
---|
672 | \par\medskip |
---|
673 | ~~~~~~\texttt{USE control\_parameters}\\ |
---|
674 | ~~~~~~\texttt{USE pegrid}\\ |
---|
675 | ~~~~~~\texttt{USE user}\\ |
---|
676 | \par\medskip |
---|
677 | ~~~~~~\texttt{IMPLICIT NONE}\ |
---|
678 | \par\medskip |
---|
679 | ~~~~~~\texttt{CHARACTER (LEN=*) :: location}\\ |
---|
680 | \par\medskip |
---|
681 | ~~~~~~\texttt{INTEGER(iwp) :: i, idum, j}\\ |
---|
682 | \par\medskip |
---|
683 | \texttt{!}\\ |
---|
684 | \texttt{!-- Here the user-defined actions follow}\\ |
---|
685 | \vspace{0.5mm} |
---|
686 | ~~~~~~\texttt{SELECT CASE ( location )}\\ |
---|
687 | \par\medskip |
---|
688 | ~~~~~~~~~\texttt{CASE ( 'u-tendency' )}\\ |
---|
689 | \texttt{!}\\ |
---|
690 | ~~~~~~\texttt{!-- Enter actions to be done in the u-tendency term here}\\ |
---|
691 | ~~~~~~~~~~~~\texttt{\textcolor{blue}{DO k = nzb+1, nzt-1}}\\ |
---|
692 | ~~~~~~~~~~~~~~~~~~\texttt{\textcolor{blue}{tend(k,j,i) = tend(k,j,i) + ...}}\\ |
---|
693 | ~~~~~~~~~~~~\texttt{\textcolor{blue}{ENDDO}}\\ |
---|
694 | \par\medskip |
---|
695 | ~~~~~~~~~\texttt{CASE ( 'v-tendency' )}}; |
---|
696 | % {% |
---|
697 | % \begin{tikzpicture}[remember picture, overlay] |
---|
698 | % % \node[text width=14em] at (0,0) {\includegraphics[scale=0.3]{user_defined_code_figures/user_actions_3.png}}; |
---|
699 | % \end{tikzpicture} |
---|
700 | % }; |
---|
701 | \end{tikzpicture}} |
---|
702 | |
---|
703 | \end{frame} |
---|
704 | |
---|
705 | % Folie 14 |
---|
706 | \begin{frame} |
---|
707 | \frametitle{Steering the User-Interface} |
---|
708 | \tikzstyle{yellow} = [rectangle, draw, fill=yellow!30, text width=0.7\textwidth, font=\Tiny] |
---|
709 | \scriptsize |
---|
710 | \begin{columns}[T] |
---|
711 | \begin{column}{1.1\textwidth} |
---|
712 | For steering the user-interface code, the user may want to add some additional variables and set their respective values within the parameter-file (e.g. \texttt{example\underline{ }cbl\underline{ }p3d}). This requires the following actions (example for a variable named \texttt{foo}): |
---|
713 | \end{column} |
---|
714 | \end{columns} |
---|
715 | \vspace{1mm} |
---|
716 | \begin{enumerate} |
---|
717 | \item<1-> Add the variable name to module \texttt{user} in order to define it and to make it available in all user-interface subroutines. Set a default value for this variable. |
---|
718 | \begin{center} |
---|
719 | % \includegraphics[scale=0.3]{user_defined_code_figures/steering_1.png} |
---|
720 | \begin{tikzpicture} |
---|
721 | \node[yellow]{~\texttt{MODULE user}\\ |
---|
722 | \vspace{0.4mm} |
---|
723 | \texttt{...}\\ |
---|
724 | \vspace{0.4mm} |
---|
725 | ~\texttt{REAL(wp) \hspace{0.4cm}:: ~~\textcolor{blue}{foo = 0.0}}\\ |
---|
726 | \vspace{0.4mm} |
---|
727 | \texttt{...}\\ |
---|
728 | \vspace{0.4mm} |
---|
729 | ~\texttt{END MODULE user}}; |
---|
730 | \end{tikzpicture} |
---|
731 | \end{center} |
---|
732 | \vspace{1mm} |
---|
733 | \item<2-> Add the variable to the NAMELIST \texttt{/userpar/}. This NAMELIST already contains four predefined variables. |
---|
734 | \begin{center} |
---|
735 | % \includegraphics[scale=0.3]{user_defined_code_figures/steering_2.png} |
---|
736 | \begin{tikzpicture} |
---|
737 | \node[yellow]{~\texttt{SUBROUTINE user\_parin}\\ |
---|
738 | \vspace{0.4mm} |
---|
739 | \texttt{...}\\ |
---|
740 | \vspace{0.4mm} |
---|
741 | ~~~~~\texttt{NAMELIST ~~/userpar/ ~~ data\_output\_pr\_user, data\_output\_user,}\\ |
---|
742 | \vspace{0.4mm} |
---|
743 | \hspace{3cm}\texttt{\textcolor{blue}{foo}, region}\\ |
---|
744 | \vspace{0.4mm} |
---|
745 | \texttt{...}\\ |
---|
746 | \vspace{0.4mm} |
---|
747 | ~\texttt{END SUBROUTINE user\_parin}}; |
---|
748 | \end{tikzpicture} |
---|
749 | \end{center} |
---|
750 | \vspace{1mm} |
---|
751 | \item<3-> Add the NAMELIST \texttt{\&userpar} to the parameter file (e.g. \texttt{example\underline{ }cbl\underline{ }p3d}) and assign a value to this variable. |
---|
752 | \begin{center} |
---|
753 | % \includegraphics[scale=0.3]{user_defined_code_figures/steering_3.png} |
---|
754 | \begin{tikzpicture} |
---|
755 | \node[yellow]{~\texttt{\&inipar ~~~ nx = ... ~~/}\\ |
---|
756 | \vspace{0.4mm} |
---|
757 | ~\texttt{\&d3par ~~~ end\_time = 3600.0, ... ~~/}\\ |
---|
758 | \par\smallskip |
---|
759 | ~\texttt{\textcolor{blue}{\&userpar ~~foo = 12345.6 ~~/}}}; |
---|
760 | \end{tikzpicture} |
---|
761 | \end{center} |
---|
762 | \vspace{1mm} |
---|
763 | \item<4-> Output the variable's value using \texttt{user\underline{ }header}. |
---|
764 | \end{enumerate} |
---|
765 | |
---|
766 | |
---|
767 | \end{frame} |
---|
768 | |
---|
769 | % Folie 15 |
---|
770 | \begin{frame} |
---|
771 | \frametitle{User-Defined Output} |
---|
772 | \scriptsize |
---|
773 | \begin{itemize} |
---|
774 | \item<2-> A very typical request of users is the calculation and output of quantities which are not part of PALM's standard output (e.g. a 3D-array of the resolved-scale vertical heat (temperature) flux). |
---|
775 | \vspace{2mm} |
---|
776 | \item<3-> The default user interface includes a number of subroutines which allow the calculation of user-defined quantities and output of these quantities as profiles, timeseries, 2d cross section or 3d volume data. These are e.g.\\ |
---|
777 | \texttt{user\underline{ }check\underline{ }data\underline{ }output}, \texttt{user\underline{ }check\underline{ }data\underline{ }output\underline{ }pr},\\ |
---|
778 | \texttt{user\underline{ }define\underline{ }netcdf\underline{ }grid}, \texttt{user\underline{ }statistics},\\ |
---|
779 | \texttt{user\underline{ }3d\underline{ }data\underline{ }averaging}, \texttt{user\underline{ }data\underline{ }output\underline{ }2d},\\ |
---|
780 | \texttt{user\underline{ }data\underline{ }output\underline{ }3d}. |
---|
781 | \vspace{2mm} |
---|
782 | \item<4-> The respective subroutines contain, as an example, code lines (written as comment lines) for calculating and output the square of the u-component velocity. |
---|
783 | \vspace{2mm} |
---|
784 | \item<5-> These quantities are output to PALMâs standard netCDF files, i.e.\\ \texttt{DATA\underline{ }1D\underline{ }PR\underline{ }NETCDF}, \texttt{DATA\underline{ }1D\underline{ }TS\underline{ }NETCDF}, \texttt{DATA\underline{ }2D\underline{ }XY\underline{ }NETCDF} or \texttt{DATA\underline{ }3D\underline{ }NETCDF}. |
---|
785 | \vspace{2mm} |
---|
786 | \item<6-> The online documentation gives very detailed instructions about how to modify the interface in order to output user-defined quantities under\\ |
---|
787 | \vspace{1mm} |
---|
788 | \textbf{http://palm.muk.uni-hannover.de/wiki/doc/app/userint/output} |
---|
789 | \end{itemize} |
---|
790 | \end{frame} |
---|
791 | |
---|
792 | % Folie 16 |
---|
793 | \begin{frame} |
---|
794 | \frametitle{User-Defined Data for Restart Runs (I)} |
---|
795 | \tikzstyle{yellow} = [rectangle, draw, fill=yellow!30, text width=0.7\textwidth, font=\tiny] |
---|
796 | \scriptsize |
---|
797 | \begin{itemize} |
---|
798 | \item It might be neccessary to save the values of user-defined variables at the end of a model run in order to use them for a restart run.\\ |
---|
799 | \ \\ |
---|
800 | This can be done using the routine \texttt{user\underline{ }last\underline{ }actions}.\\ |
---|
801 | \grqq \texttt{14}\grqq\, is the file-id for the restart file (local filename \texttt{BINOUT}): |
---|
802 | \end{itemize} |
---|
803 | \begin{center} |
---|
804 | % \includegraphics[scale=0.3]{user_defined_code_figures/restart_1.png} |
---|
805 | \begin{tikzpicture}[auto] |
---|
806 | \node[yellow]{~\texttt{SUBROUTINE user\_last\_actions}\\ |
---|
807 | \texttt{...}\\ |
---|
808 | ~~~~~\texttt{\textcolor{blue}{WRITE ( 14 ) 'foo \hspace{2cm}'; WRITE ( 14 ) foo}}\\ |
---|
809 | ~~~~~\texttt{\textcolor{blue}{WRITE ( 14 ) 'bar \hspace{2cm}'; WRITE ( 14 ) bar}} |
---|
810 | \par\smallskip |
---|
811 | ~~~~~\texttt{WRITE ( 14 ) '*** end user *** \hspace{0.66cm}'} |
---|
812 | \par\smallskip |
---|
813 | ~\texttt{END SUBROUTINE user\_last\_actions}}; |
---|
814 | \end{tikzpicture} |
---|
815 | \end{center} |
---|
816 | \end{frame} |
---|
817 | |
---|
818 | % Folie 17 |
---|
819 | \begin{frame} |
---|
820 | \frametitle{User-Defined Data for Restart Runs (II)} |
---|
821 | \tikzstyle{yellow} = [rectangle, draw, fill=yellow!30, text width=0.95\textwidth, font=\tiny] |
---|
822 | \scriptsize |
---|
823 | \begin{itemize} |
---|
824 | \item Additionally, these variables have to be read from the restart file (file-id \grqq \texttt{13}\grqq\,, local filename \texttt{BININ}) by adding code to the routine \texttt{user\underline{ }read\underline{ }restart\underline{ }data}: |
---|
825 | \end{itemize} |
---|
826 | \vspace{-2.7mm} |
---|
827 | \begin{center} |
---|
828 | % \includegraphics[scale=0.3]{user_defined_code_figures/restart_2.png} |
---|
829 | \begin{tikzpicture} |
---|
830 | \node[yellow]{\texttt{~SUBROUTINE user\_read\_restart\_data( i, nxlfa, nxl\_on\_file, nxrfa, nxr\_on\_file, \&} \\ |
---|
831 | \hspace{3.84cm}\texttt{nynfa, nyn\_on\_file, nysfa, nys\_on\_file, \&} \\ |
---|
832 | \hspace{3.84cm}\texttt{offset\_xa, offset\_ya, overlap\_count, \&} \\ |
---|
833 | \hspace{3.84cm}\texttt{tmp\_2d, tmp\_3d )}\\ |
---|
834 | \texttt{...} \\ |
---|
835 | ~~~~~\texttt{IF ( initializing\_actions == 'read\_restart\_data' ) THEN}\\ |
---|
836 | ~~~~~~~~~\texttt{READ ( 13 ) field\_char} \\ |
---|
837 | ~~~~~~~~~\texttt{DO WHILE ( TRIM( field\_char ) '*** end user ***' )}\\ |
---|
838 | \par\smallskip |
---|
839 | ~~~~~~~~~~~~~\texttt{nxlf = nxlfa(i,k)} |
---|
840 | \texttt{...} \\ |
---|
841 | ~~~~~~~~~~~~~\texttt{SELECT CASE ( TRIM( field\_char ) )}\\ |
---|
842 | \par\smallskip |
---|
843 | ~~~~~~~~~~~~~~~~~\texttt{CASE ( '\textcolor{blue}{foo}' )} \\ |
---|
844 | ~~~~~~~~~~~~~~~~~~~~~\texttt{IF ( .NOT. ALLOCATED( \textcolor{blue}{foo} ) ) THEN}\\ |
---|
845 | ~~~~~~~~~~~~~~~~~~~~~~~~~\texttt{ALLOCATE( \textcolor{blue}{foo}(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )}\\ |
---|
846 | ~~~~~~~~~~~~~~~~~~~~~\texttt{ENDIF}\\ |
---|
847 | ~~~~~~~~~~~~~~~~~~~~~\texttt{IF ( k == 1 ) READ ( 13 ) tmp\_3d}\\ |
---|
848 | ~~~~~~~~~~~~~~~~~~~~~\texttt{\textcolor{blue}{foo}(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) = \&} \\ |
---|
849 | \hspace{4.5cm}\texttt{tmp\_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)}\\ |
---|
850 | \texttt{...}\\ |
---|
851 | ~~~~~~~~~~~~~\texttt{END SELECT}\\ |
---|
852 | \par\smallskip |
---|
853 | ~~~~~~~~~\texttt{ENDDO} |
---|
854 | \par\smallskip |
---|
855 | ~~~~~~~~~\texttt{READ ( 13 ) field\_char}\\ |
---|
856 | \par\smallskip |
---|
857 | ~~~~~~~~~\texttt{ENDDO}\\ |
---|
858 | ~~~~~\texttt{ENDIF}\\ |
---|
859 | \par\smallskip |
---|
860 | ~\texttt{END SUBROUTINE user\_read\_restart\_data}}; |
---|
861 | \end{tikzpicture} |
---|
862 | \end{center} |
---|
863 | \end{frame} |
---|
864 | |
---|
865 | % Folie 18 |
---|
866 | \begin{frame} |
---|
867 | \frametitle{Using the User-Interface with \texttt{mrun}} |
---|
868 | \tiny |
---|
869 | \begin{columns}[T] |
---|
870 | \begin{column}{1.1\textwidth} |
---|
871 | \vspace{-1mm} |
---|
872 | \textbf{Users can add their own (modified) user-interface to a PALM-run by carrying out the following steps:} |
---|
873 | \begin{enumerate} |
---|
874 | \item<2-> Copy the default (empty) user-interface files that you need (e.g. user\underline{ }module.f90, user\underline{ }parin.f90, user\underline{ }actions.f90) to a directory of your choice, e.g.:\\ |
---|
875 | \scriptsize |
---|
876 | \par\smallskip |
---|
877 | \quad \texttt{cd \~{ }/palm/current\underline{ }version}\\ |
---|
878 | \quad \texttt{mkdir -p USER\underline{ }CODE/example\underline{ }cbl}\\ |
---|
879 | \quad \texttt{cp trunk/SOURCE/user\underline{ }module.f90 USER\underline{ }CODE/example\underline{ }cbl/user\underline{ }module.f90}\\ |
---|
880 | \quad \texttt{cp trunk/SOURCE/user\underline{ }parin.f90\hspace{1em}USER\underline{ }CODE/example\underline{ }cbl/user\underline{ }parin.f90}\\ |
---|
881 | \quad \texttt{...} |
---|
882 | |
---|
883 | \item<3-> Set an additional path in the configuration file \texttt{.mrun.config} to allow \texttt{mrun} to find and include this file:\\ |
---|
884 | \tiny |
---|
885 | \par\smallskip |
---|
886 | \scriptsize \quad \texttt{\%add\underline{ }source\underline{ }path \hspace{1em} \$base\underline{ }directory/USER\underline{ }CODE/\$fname} |
---|
887 | \par\smallskip |
---|
888 | \item<4-> Modify the interface routines according to your needs. |
---|
889 | \item<5-> Start a PALM run by executing\\ |
---|
890 | \par\smallskip |
---|
891 | \scriptsize \quad \texttt{mrun -d example\underline{ }cbl ...}\\ |
---|
892 | \par\smallskip |
---|
893 | \tiny |
---|
894 | The files user\underline{ }*.f90 will be automatically compiled within the job / interactive run and will replace the respective PALM default user-interface files. |
---|
895 | \end{enumerate} |
---|
896 | \begin{itemize} |
---|
897 | \item<6-> \textbf{The modified user-interface file cannot be pre-compiled by using} \texttt{mbuild}! |
---|
898 | \item<7-> The above method allows to use different user-interfaces for different runs. Just store the respective interface-files in subdirectories \texttt{USER\underline{ }CODE/abcd}, \texttt{USER\underline{ }CODE/cdef}, etc. and start \texttt{mrun} with option \grqq \texttt{-d abcd}\grqq, \grqq \texttt{-d cdef}\grqq, etc. |
---|
899 | \end{itemize} |
---|
900 | |
---|
901 | \end{column} |
---|
902 | \end{columns} |
---|
903 | |
---|
904 | \end{frame} |
---|
905 | |
---|
906 | \end{document} |
---|