1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
---|
2 | <html><head> |
---|
3 | <meta content="text/html; charset=windows-1252" http-equiv="CONTENT-TYPE"><title>PALM chapter 3.5</title> <meta content="StarOffice 7 (Win32)" name="GENERATOR"> <meta content="Siegfried Raasch" name="AUTHOR"> <meta content="20040802;10431831" name="CREATED"> <meta content="20041112;14292662" name="CHANGED"> <meta content="parallel LES model" name="KEYWORDS"> <style> |
---|
4 | <!-- |
---|
5 | @page { size: 21cm 29.7cm } |
---|
6 | --> |
---|
7 | </style></head> |
---|
8 | <body style="direction: ltr;" lang="en-US"><h3 style="line-height: 100%;">3.5 Programming of user-defined |
---|
9 | code |
---|
10 | extensions<br> |
---|
11 | </h3><p style="line-height: 100%;">Programming |
---|
12 | user-defined code |
---|
13 | extensions usually requires exact knowledge of the internal structure |
---|
14 | of PALM. |
---|
15 | Appropriate explanations in <a href="chapter_2.0.html">chapter |
---|
16 | 2.0</a> and the technical documentation are usually not |
---|
17 | sufficient |
---|
18 | and must be supplemented by a rigorous study of the model's source code. Programming experiences with FORTRAN95 and if necessary |
---|
19 | experiences with the parallelization tool MPI are absolutely |
---|
20 | necessary! </p> |
---|
21 | <p style="line-height: 100%;">Changes of the standard |
---|
22 | model code by the |
---|
23 | user |
---|
24 | should be avoided whenever possible and are reserved to the |
---|
25 | developer-group of PALM. The corrections, revisions and extensions of |
---|
26 | the |
---|
27 | model accomplished by this group are published in the |
---|
28 | <a href="../tec/index.html">technical/numerical |
---|
29 | documentation</a> and the accordingly updated source files are |
---|
30 | accessible to the users (see <a href="chapter_5.1.html">chapter |
---|
31 | 5.1</a>).</p> |
---|
32 | <p style="line-height: 100%;">However, the user frequently |
---|
33 | may feel the |
---|
34 | need to make extensions of the model code for his/her own simulations. |
---|
35 | For this purpose, a set |
---|
36 | of interfaces is available, which can be used to add user-defined code |
---|
37 | to the model. This |
---|
38 | chapter describes the programming of such user-defined code extensions.</p><p style="line-height: 100%;">The integration of user-defined |
---|
39 | code |
---|
40 | occurs in the form of subroutine calls, which are made at a set of |
---|
41 | places in the model code, by default. These subroutines have |
---|
42 | pre-defined names, which must not be changed by the user. Their basic |
---|
43 | versions are a component of the standard model |
---|
44 | code and can be found in the source code files |
---|
45 | <tt><font style="font-size: 10pt;" size="2">user_***.f90</font></tt><font style="font-size: 10pt;" size="2">.</font> |
---|
46 | <font color="#000000">The</font> basic versions |
---|
47 | accomplish nearly no |
---|
48 | actions, thus they are pure templates, which can be extended by the |
---|
49 | user as required. Actions which are already accomplished in these |
---|
50 | basic versions by default should not be changed. Here is an example |
---|
51 | of such a basic version (file <span style="font-family: Courier New,Courier,monospace;">user_init.f90</span>): </p> |
---|
52 | <p style="line-height: 100%;"> </p> |
---|
53 | <pre style="line-height: 100%;"><font color="#000000"><font style="font-size: 10pt;" size="2">SUBROUTINE user_init</font></font><br><br><font color="#000000"><font style="font-size: 10pt;" size="2">!------------------------------------------------------------------------------</font></font><br><font color="#000000"><font style="font-size: 10pt;" size="2">!</font></font><br><font color="#000000"><font style="font-size: 10pt;" size="2">!</font></font><br><font color="#000000"><font style="font-size: 10pt;" size="2">! Description:</font></font><br><font color="#000000"><font style="font-size: 10pt;" size="2">! -----------</font></font><br><font color="#000000"><font style="font-size: 10pt;" size="2">! Execution of user-defined initializing actions</font></font><br><font color="#000000"><font style="font-size: 10pt;" size="2">!------------------------------------------------------------------------------</font></font><br><font color="#000000"><font style="font-size: 10pt;" size="2">!</font></font><br><br><font color="#000000"> <font style="font-size: 10pt;" size="2">USE control_parameters</font></font><br><font color="#000000"> <font style="font-size: 10pt;" size="2">USE user</font></font><br><br><font color="#000000"> <font style="font-size: 10pt;" size="2">IMPLICIT NONE</font></font><br><br><font color="#000000"><font style="font-size: 10pt;" size="2">!</font></font><br><font color="#000000"><font style="font-size: 10pt;" size="2">!-- Here the user defined initializing actions follow:</font></font><br><br><br><font color="#000000"><font style="font-size: 10pt;" size="2">END SUBROUTINE user_init</font></font></pre><p style="line-height: 100%;">The communication (handling of |
---|
54 | variables) |
---|
55 | with the model occurs via the |
---|
56 | global variables, which are defined within the individual FORTRAN - |
---|
57 | modules of PALM. The appropriate modules (they are all in the |
---|
58 | source code file <tt><font style="font-size: 10pt;" size="2">modules.f90</font></tt>) |
---|
59 | must be declared by means of <font size="2"><font face="Cumberland, monospace">USE</font></font> |
---|
60 | statements in the |
---|
61 | user-defined routines in order to be able to work with the variables |
---|
62 | contained in them. As in the example, this is already done with the |
---|
63 | module <tt><font style="font-size: 10pt;" size="2">control_parameters</font></tt>. |
---|
64 | This yields access to most of the existing parameters for steering the |
---|
65 | model. Furthermore, the module <tt><font style="font-size: 11pt;" size="2">user</font></tt> |
---|
66 | appears in the example |
---|
67 | above. This is a |
---|
68 | user-defined module (it can be found in file <tt><font style="font-size: 10pt;" size="2">user_module.f90</font></tt>) |
---|
69 | and can be used for communication between the user-defined routines. In |
---|
70 | this module own variables can be declared as desired. It |
---|
71 | is not used (and should not be used!) outside of the user code. </p> |
---|
72 | <p style="line-height: 100%;">A very typical request of |
---|
73 | users is the |
---|
74 | calculation and output of |
---|
75 | quantities which are not part of PALM's standard output. Several |
---|
76 | routines in the basic user interface are already designed and prepared |
---|
77 | for calculating and output of such quantities (see <a href="chapter_3.5.4.html">3.5.4</a>).</p><p style="line-height: 100%;">As already mentioned, the |
---|
78 | contents of |
---|
79 | the files <tt><font style="font-size: 10pt;" size="2">user_***.f90</font></tt> |
---|
80 | can be used as a basis for extensions. However these files should not be |
---|
81 | manipulated directly. Instead, a copy should be used. |
---|
82 | </p> |
---|
83 | <p style="line-height: 100%;">The following sections |
---|
84 | describe, which |
---|
85 | interfaces for user-defined code exist in the |
---|
86 | model, how user parameters can be defined for steering this code |
---|
87 | and how it is translated and linked to the model. </p> |
---|
88 | <hr><p style="line-height: 100%;"><br> |
---|
89 | <font color="#000080"><font color="#000080"><a href="chapter_3.4.html"><font color="#000080"><img name="Grafik1" src="left.gif" align="bottom" border="2" height="32" width="32"></font></a><a href="index.html"><font color="#000080"><img name="Grafik2" src="up.gif" align="bottom" border="2" height="32" width="32"></font></a><a href="chapter_3.5.1.html"><font color="#000080"><img name="Grafik3" src="right.gif" align="bottom" border="2" height="32" width="32"></font></a></font></font></p><p style="line-height: 100%;"><i>Last change: </i> |
---|
90 | $Id: chapter_3.5.html 212 2008-11-11 09:09:24Z boeske $</p> |
---|
91 | </body></html> |
---|