Changeset 1226 for palm/trunk/TUTORIAL/SOURCE/user_defined_code.tex
- Timestamp:
- Sep 18, 2013 1:19:19 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
palm/trunk/TUTORIAL/SOURCE/user_defined_code.tex
r1080 r1226 15 15 \usepackage{tikz} 16 16 \usetikzlibrary{shapes,arrows,positioning} 17 \usetikzlibrary{decorations.markings} %neues paket18 \usetikzlibrary{decorations.pathreplacing} %neues paket17 %\usetikzlibrary{decorations.markings} %neues paket 18 %\usetikzlibrary{decorations.pathreplacing} %neues paket 19 19 \def\Tiny{\fontsize{4pt}{4pt}\selectfont} 20 20 \usepackage{amsmath} … … 70 70 \textbf{Problem:} 71 71 \begin{itemize} 72 \item<3-> If a new PALM version is released (current release is 3. 8) and the user wants to use it, he would have to add his modifications to the new release again.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 73 \end{itemize} 74 74 \vspace{3mm} … … 85 85 \begin{frame} 86 86 \frametitle{General Structure of the User-Interface} 87 \tikzstyle{yellow} = [rectangle, draw, fill=yellow!30, text width=0.7\textwidth, font=\Tiny] 87 88 \scriptsize 88 89 \begin{itemize} … … 92 93 \end{itemize} 93 94 \onslide<3-> 94 \centering 95 \includegraphics[scale=0.3]{user_defined_code_figures/user_last_actions.png}\\ 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}\\ 96 131 \end{frame} 97 132 … … 99 134 \begin{frame} 100 135 \frametitle{Embedding of User-Interface Routines} 136 \tikzstyle{yellow} = [rectangle, draw, fill=yellow!30, text width=0.7\textwidth, font=\Tiny] 101 137 \scriptsize 102 138 \begin{itemize} … … 106 142 \end{itemize} 107 143 \onslide<2-> 108 \centering 109 \includegraphics[scale=0.33]{user_defined_code_figures/embedding.png}\\ 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}\\ 110 190 \end{frame} 111 191 … … 119 199 % Define colours 120 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] 121 203 \tikzstyle{yellow} = [draw, fill=yellow!30, text width=7.1em, text centered, minimum height=1.6em] 122 204 \tikzstyle{orange} = [draw, fill=orange!60, text width=7.1em, text centered] 123 205 124 206 % Define coordinates and draw nodes 125 \node[ green, text width=5em] (PALM) at (0,0.1) {PALM};207 \node[yellow, text width=5em] (PALM) at (0,0.1) {PALM}; 126 208 127 209 \coordinate (A) at (0,-0.7); 128 129 \node[green, right=0.6cm of A] (parin) {parin}; 130 131 \coordinate[below=0.3cm of parin] (B); 132 \coordinate[below=0.9cm of parin] (C); 133 \coordinate[below=1.5cm of parin] (D); 134 135 \node[green, right=0.6cm of B] (read) {read\_var\_list}; 136 \node[green, right=0.6cm of C] (package) {package\_parin}; 137 \node[yellow, right=0.6cm of D] (userparin) {user\_parin}; 138 139 \coordinate[below=3cm of PALM] (E); 140 \coordinate[below=3.6cm of PALM] (F); 141 \coordinate[below=4.2cm of PALM] (G); 142 \coordinate[below=4.8cm of PALM] (H); 143 \coordinate[below=5.6cm of PALM] (I); 144 \coordinate[below=7.4cm of PALM] (J); 145 146 \node[green, right=0.6cm of E] (initpegrid) {init\_pegrid}; 147 \node[green, right=0.6cm of F] (initgrid) {init\_grid}; 148 \node[yellow, right=0.9cm of initgrid] (userinitgrid) {user\_init\_grid}; 149 150 \node[green, right=0.6cm of G] (checkparameters) {check\_parameters}; 151 \node[yellow, right=0.9cm of checkparameters, text width=9.5em] (usercheckdataoutput) {user\_check\_data\_output}; 152 \node[green, right=0.6cm of H] (header) {header}; 153 \node[green, right=0.6cm of I] (init3dmodel) {init\_3d\_model}; 154 \node[yellow, right=0.9cm of header] (userheader) {user\_header}; 155 156 \node[orange, right=0.6cm of J] (timeint) {time\_integration}; 157 158 \coordinate[below=0.3cm of init3dmodel] (K); 159 \coordinate[below=0.9cm of init3dmodel] (L); 160 161 \node[green, right=0.6cm of K] (initparticles) {init\_particles}; 162 \node[yellow, right=0.9cm of initparticles] (userinitparticles) {user\_init\_particles}; 163 \node[yellow, right=0.6cm of L] (userinit) {user\_init}; 164 165 % Draw lines 166 \draw[-, thick] (PALM) -- (0,-7.8); 167 \draw[dotted, thick] (0,-8.2) -- (0,-7.8); 168 \draw[-, thick] (A) -- (parin); 169 \draw[-, thick] (parin) -- (D); 170 \draw[dashed, thick] (B) -- (read); 171 \draw[dashed, thick] (C) -- (package); 172 \draw[-, thick] (D) -- (userparin); 173 \draw[-, thick] (E) -- (initpegrid); 174 \draw[-, thick] (F) -- (initgrid); 175 \draw[-, thick] (G) -- (checkparameters); 176 \draw[-, thick] (H) -- (header); 177 \draw[-, thick] (I) -- (init3dmodel); 178 \draw[-, thick] (J) -- (timeint); 179 \draw[dotted, thick] (init3dmodel) -- (K); 180 \draw[-, thick] (K) -- (L); 181 \draw[dashed, thick] (K) -- (initparticles); 182 \draw[-, thick] (L) -- (userinit); 183 \draw[-, thick] (initgrid) -- (userinitgrid); 184 \draw[-, thick] (checkparameters) -- (usercheckdataoutput); 185 \draw[-, thick] (header) -- (userheader); 186 \draw[-, thick] (initparticles) -- (userinitparticles); 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); 187 276 188 277 \end{tikzpicture} … … 197 286 % Define colours 198 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] 199 289 \tikzstyle{yellow} = [draw, fill=yellow!30, text width=7.1em, text centered, minimum height=1.6em] 200 290 \tikzstyle{orange} = [draw, fill=orange!60, text width=7.1em, text centered] … … 214 304 \coordinate[right=3.8cm of D] (E); 215 305 216 \node[ yellow, right=0.6cm of B, text width=14em] (useractions1) {\textcolor{blue}{user\_actions\_(\textit{'before\_timestep'})}};306 \node[green, right=0.6cm of B, text width=14em] (useractions1) {\textcolor{blue}{user\_actions\_(\textit{'before\_timestep'})}}; 217 307 218 308 \node[orange1, below=0.2cm of D] (progeq) {prognostic\_equations}; … … 220 310 \node[draw, fill=red, text width=4em] at (8.6,-0.8) {\textcolor{white}{standard advection}}; 221 311 222 \node[ yellow, right=0.3cm of progframe, text width=14em] (useractions2) {\textcolor{blue}{user\_actions\_(\textit{'*\_tendency'})}};312 \node[green, right=0.3cm of progframe, text width=14em] (useractions2) {\textcolor{blue}{user\_actions\_(\textit{'*\_tendency'})}}; 223 313 224 314 … … 229 319 230 320 231 \node[ green, right=0.6cm of F] (advecparticles) {advec\_particles};232 \node[ yellow, right=0.9cm of advecparticles, text width=10em] (userparticlesattributes) {user\_particles\_attributes};233 \node[ green, right=0.6cm of G] (exchangehoriz) {exchange\_horiz};234 \node[green, right=0.0cm of exchangehoriz] (asselin) {asselin\_filter};235 \node[ green, right=0.6cm of H] (swaptimelevel) {swap\_timelevel};236 \node[ green, right=0.6cm of I] (pres) {pres};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}; 237 327 238 328 \coordinate[below=0.3cm of pres] (J); … … 244 334 \coordinate[below=8.8cm of timeint] (P); 245 335 246 \node[green, right=0.6cm of K] (prandtlfluxes) {prandtl\_fluxes}; 247 \node[yellow, right=0.6cm of L, text width=14em] (useractions3) {\textcolor{blue}{user\_actions\_(\textit{'after\_integration'})}}; 248 \node[green, right=0.6cm of M] (diffusivities) {diffusivities}; 249 \node[green, right=0.0cm of diffusivities] {check\_for\_restart}; 250 \node[green, right=0.6cm of N] (flowstat) {flow\_statistics}; 251 \node[green, right=0.0cm of flowstat] (runcontrol) {run\_control}; 252 \node[yellow, below=0.2cm of flowstat] (userstat) {user\_statistics}; 253 \node[yellow, right=0.6cm of O, text width=14em] (useractions4) {\textcolor{blue}{user\_actions\_(\textit{'after\_timestep'})}}; 254 \node[green, right=0.6cm of P] (timestep) {timestep}; 255 256 \node[green, right=0.2cm of runcontrol] (dataoutput) {data\_output\_***}; 257 \node[yellow, right=0.2cm of dataoutput] (userdvrpcoltab) {user\_dvrp\_coltab}; 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}; 258 351 \coordinate[below=0.2cm of dataoutput] (Q); 259 352 \coordinate[right=0.4cm of Q] (R); 260 353 \coordinate[right=3.0cm of R] (S); 261 354 262 \node[ yellow, below=0.2cm of R, text width=9em] (output2d) {user\_data\_output\_2d};263 \node[ yellow, below=0.2cm of S, text width=9em] (output3d) {user\_data\_output\_3d};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}; 264 357 265 358 … … 276 369 \draw[->, thick, color=red] (E) -- (progeqfast); 277 370 \draw[-, thick] (progframe) -- (useractions2); 278 \draw[-, thick] (F) -- ( advecparticles);279 \draw[-, thick] (user particlesattributes) -- (advecparticles);371 \draw[-, thick] (F) -- (lpm); 372 \draw[-, thick] (userlpmadvec) -- (lpm); 280 373 \draw[-, thick] (G) -- (exchangehoriz); 281 374 \draw[-, thick] (H) -- (swaptimelevel); 282 375 \draw[-, thick] (I) -- (pres); 283 376 \draw[dotted, thick] (pres) -- (J); 284 \draw[-, thick] (K) -- (prandtlfluxes); 285 \draw[-, thick] (L) -- (useractions3); 286 \draw[-, thick] (M) -- (diffusivities); 287 \draw[-, thick] (N) -- (flowstat); 288 \draw[-, thick] (userstat) -- (flowstat); 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); 289 384 \draw[-, thick] (O) -- (useractions4); 290 \draw[-, thick] (P) -- (timestep);385 % \draw[-, thick] (O) -- (timestep); 291 386 \draw[-, thick] (dataoutput) -- (Q); 292 387 \draw[-, thick] (S) -- (Q); … … 320 415 \coordinate[below=2.5cm of PALM] (D); 321 416 322 \node[ green, right=0.6cm of D] (write3dbinary) {write\_3d\_binary};323 \node[ green, right=0.9cm of write3dbinary] (writevarlist) {write\_var\_list};417 \node[yellow, right=0.6cm of D] (write3dbinary) {write\_3d\_binary}; 418 \node[yellow, right=0.9cm of write3dbinary] (writevarlist) {write\_var\_list}; 324 419 325 420 \coordinate[below=3.5cm of PALM] (E); 326 421 \coordinate[below=4.1cm of PALM] (F); 327 422 \coordinate[below=4.7cm of PALM] (G); 328 \node[ green, right=0.6cm of E] (header) {header};329 \node[ yellow, right=0.6cm of F] (userlastactions) {user\_last\_actions};330 \node[ green, right=0.6cm of G] (cpustat) {cpu\_statistics};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}; 331 426 % Draw lines 332 427 \draw[-, thick] (PALM) -- (G); … … 351 446 \textbf{Name} & \textbf{Arguments} & \textbf{Called from} & \textbf{Task}\\ 352 447 \hline 353 \texttt{user\_3d\_data\_averaging} & \texttt{mode}, \texttt{variable} & \texttt{ sum\_up\_3d\_data} & temporal averaging for user-defined quantities\\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\\ 354 449 \hline 355 450 \texttt{user\_actions} \texttt{user\_actions} & \texttt{location} \,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\, \texttt{i}, \texttt{j}, \texttt{location} & \texttt{time\_integration} + … … 358 453 \texttt{user\_dummy (user\_additional \_routines.f90)} & - - - & - - - & for additional subroutines defined by the user\\ 359 454 \hline 360 \texttt{user\_advec\_particles} & - - - & \texttt{advec\_particles} & modification of particles after advection\\ 361 \hline 362 \texttt{user\_check\_data\_output} & \texttt{variable}, \texttt{unit} & \texttt{check\_parameters} & check the user-defined output quantities\\ 455 \texttt{user\_check\_data\_output} & \texttt{variable}, \texttt{unit} & \texttt{check\_parameters} + \texttt{init\_masks}& check the user-defined output quantities\\ 363 456 \hline 364 457 \texttt{user\_check\_data\_output\_pr} & \texttt{variable}, \texttt{var\_count}, \texttt{unit} & \texttt{check\_parameters} & check the user-defined profile output quantities\\ … … 366 459 \texttt{user\_check\_parameters} & - - - & \texttt{check\_parameters} & check user-defined variables\\ 367 460 \hline 368 \texttt{user\_data\_output\_2d} & \texttt{av}, \texttt{variable}, \texttt{found}, \texttt{grid}, \texttt{local\_pf} & \texttt{data\_output\_2d} & output/calculation of additional user-defined quantities\\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\\ 369 462 \hline 370 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\\ … … 377 470 \hline 378 471 \texttt{user\_dvrp\_coltab} & \texttt{mode}, \texttt{variable} & \texttt{data\_output\_dvrp} & defining color tables for particles\\ 379 \hline 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 380 477 \end{tabular} 381 478 … … 391 488 \textbf{Name} & \textbf{Arguments} & \textbf{Called from} & \textbf{Task}\\ 392 489 \hline 393 \texttt{user\_header} & \texttt{io} & \texttt{header} & output user variables to header\\394 \hline395 \texttt{user\_init} & - - - & \texttt{init\_3d\_model} & e.g. reading from restart file\\396 \hline397 490 \texttt{user\_init\_3d\_model} & - - - & \texttt{init\_3d\_model} & special initializations\\ 398 491 \hline 399 \texttt{user\_init\_grid} & \texttt{gls} , \texttt{nzb\_local}& \texttt{init\_grid} & defining a special topography\\492 \texttt{user\_init\_grid} & \texttt{gls} & \texttt{init\_grid} & defining a special topography\\ 400 493 \hline 401 \texttt{user\_init\_particles} & - - - & \texttt{init\_particles} & defining initial particle sources\\402 \hline403 494 \texttt{user\_init\_plant\_canopy} & - - - & \texttt{init\_3d\_model} & setting of leaf area density and canopy drag coefficient\\ 404 495 \hline 405 496 \texttt{user\_last\_actions} & - - - & \texttt{palm} & e.g. output for restart runs\\ 406 \hline 497 \hline 498 \texttt{user\_lpm\_advec} & - - - & \texttt{lpm} & modification of particles after advection \\ 499 \hline 500 \texttt{user\_lmp\_init} & - - - & \texttt{lpm\_init} & defining initial particle sources \\ 501 \hline 502 \texttt{user\_lpm\_set\_attributes} & - - - & \texttt{lpm} & defining particles attributes \\ 503 \hline 407 504 \texttt{MODULE user (user\_module.f90)} & - - - & - - - & contains user defined variables\\ 408 505 \hline 409 506 \texttt{user\_parin} & & \texttt{parin} & reading user variables\\ 410 \hline 411 \texttt{user\_particle\_attributes} & - - - & \texttt{advec\_particles} & defining particles attributes\\ 412 \hline 507 \hline 413 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\\ 414 509 \hline 415 \texttt{user\_spectra} & \texttt{mode}, \texttt{m}, \texttt{pr} & \texttt{ data\_output\_spectra} & output/calculation of additional user-defined quantities\\510 \texttt{user\_spectra} & \texttt{mode}, \texttt{m}, \texttt{pr} & \texttt{calc\_spectra} + \texttt{data\_output\_spectra} & output/calculation of additional user-defined quantities\\ 416 511 \hline 417 512 \texttt{user\_statistics} & \texttt{mode}, \texttt{sr}, \texttt{tn} & \texttt{flow\_statistics} & calculating additional horizontal averages + time series quantities\\ … … 429 524 \begin{frame} 430 525 \frametitle{Data Access / Exchange} 526 \tikzstyle{yellow} = [rectangle, draw, fill=yellow!30, text width=0.6\textwidth, font=\tiny] 431 527 \footnotesize 432 528 \begin{itemize} … … 436 532 \item<3-> by including the respective PALM modules in the user-interface subroutines.\\ 437 533 \begin{center} 438 \includegraphics[scale=0.3]{user_defined_code_figures/data_access_exchange.png} 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} 439 552 \end{center} 440 553 \end{itemize} … … 451 564 \begin{frame} 452 565 \frametitle{Usage of \texttt{user\underline{ }actions} (I)} 566 \tikzstyle{yellow} = [rectangle, draw, fill=yellow!30, text width=0.7\textwidth, font=\tiny] 453 567 \scriptsize 454 568 \begin{itemize} 455 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. 456 \vspace{ 2mm}570 \vspace{1.8mm} 457 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.\\ 458 572 \ \\ … … 461 575 \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: 462 576 \end{itemize} 463 \vspace{- 2mm}577 \vspace{-3mm} 464 578 \begin{center} 465 \includegraphics[scale=0.33]{user_defined_code_figures/user_actions_1.png} 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} 466 596 \end{center} 597 % \begin{center} 598 % \includegraphics[scale=0.33]{user_defined_code_figures/user_actions_1.png} 599 % \end{center} 467 600 \end{frame} 468 601 … … 470 603 \begin{frame} 471 604 \frametitle{Usage of \texttt{user\underline{ }actions} (II)} 605 \tikzstyle{yellow} = [rectangle, draw, fill=yellow!30, text width=0.7\textwidth, font=\tiny] 472 606 \scriptsize 473 607 \begin{itemize} … … 475 609 \end{itemize} 476 610 \begin{center} 477 \includegraphics[scale=0.35]{user_defined_code_figures/user_actions_2.png} 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{!-- Enter actions to be done after every timestep here}\\ 623 \par\medskip 624 ~~~~~~~~~~\texttt{CASE ( 'u-tendency' )}\\ 625 \texttt{!}\\ 626 \texttt{!-- 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} 478 639 \end{center} 479 640 \end{frame} … … 482 643 \begin{frame}[t] 483 644 \frametitle{Usage of \texttt{user\underline{ }actions} (III)} 645 \tikzstyle{yellow} = [rectangle, draw, fill=yellow!30, text width=0.5\textwidth, font=\Tiny] 484 646 \scriptsize 485 647 \begin{columns}[T] … … 507 669 \uncover<4->{% 508 670 \begin{tikzpicture}[remember picture, overlay] 509 \node [shift={(8.3 cm,3.0cm)}] at (current page.south west) 510 {% 511 \begin{tikzpicture}[remember picture, overlay] 512 \node[text width=14em] at (0,0) {\includegraphics[scale=0.3]{user_defined_code_figures/user_actions_3.png}}; 513 \end{tikzpicture} 514 }; 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 :: 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 % }; 515 701 \end{tikzpicture}} 516 702 … … 520 706 \begin{frame} 521 707 \frametitle{Steering the User-Interface} 708 \tikzstyle{yellow} = [rectangle, draw, fill=yellow!30, text width=0.7\textwidth, font=\Tiny] 522 709 \scriptsize 523 710 \begin{columns}[T] … … 530 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. 531 718 \begin{center} 532 \includegraphics[scale=0.3]{user_defined_code_figures/steering_1.png} 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 \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} 533 731 \end{center} 534 732 \vspace{1mm} 535 733 \item<2-> Add the variable to the NAMELIST \texttt{/userpar/}. This NAMELIST already contains four predefined variables. 536 734 \begin{center} 537 \includegraphics[scale=0.3]{user_defined_code_figures/steering_2.png} 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} 538 749 \end{center} 539 750 \vspace{1mm} 540 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. 541 752 \begin{center} 542 \includegraphics[scale=0.3]{user_defined_code_figures/steering_3.png} 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} 543 761 \end{center} 544 762 \vspace{1mm} … … 575 793 \begin{frame} 576 794 \frametitle{User-Defined Data for Restart Runs (I)} 795 \tikzstyle{yellow} = [rectangle, draw, fill=yellow!30, text width=0.7\textwidth, font=\tiny] 577 796 \scriptsize 578 797 \begin{itemize} … … 583 802 \end{itemize} 584 803 \begin{center} 585 \includegraphics[scale=0.3]{user_defined_code_figures/restart_1.png} 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} 586 815 \end{center} 587 816 \end{frame} … … 590 819 \begin{frame} 591 820 \frametitle{User-Defined Data for Restart Runs (II)} 821 \tikzstyle{yellow} = [rectangle, draw, fill=yellow!30, text width=0.95\textwidth, font=\tiny] 592 822 \scriptsize 593 823 \begin{itemize} 594 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}: 595 825 \end{itemize} 826 \vspace{-2.7mm} 596 827 \begin{center} 597 \includegraphics[scale=0.3]{user_defined_code_figures/restart_2.png} 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} 598 862 \end{center} 599 863 \end{frame} … … 610 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.:\\ 611 875 \tiny 876 \par\smallskip 612 877 \quad \texttt{cd \~{ }/palm/current\underline{ }version}\\ 613 878 \quad \texttt{mkdir -p USER\underline{ }CODE/example\underline{ }cbl}\\
Note: See TracChangeset
for help on using the changeset viewer.