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