Changeset 40 for palm/trunk/DOC/app/chapter_3.5.5.html
- Timestamp:
- Mar 2, 2007 6:32:25 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
palm/trunk/DOC/app/chapter_3.5.5.html
r5 r40 1 1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> 2 <html> 3 <head> 4 <meta http-equiv="CONTENT-TYPE" 5 content="text/html; charset=windows-1252"> 6 <title>PALM chapter 3.5.5</title> 7 <meta name="GENERATOR" content="StarOffice 7 (Win32)"> 2 <html><head> 3 <meta http-equiv="CONTENT-TYPE" content="text/html; charset=windows-1252"> 4 5 <title>PALM chapter 3.5.5</title><meta name="GENERATOR" content="StarOffice 7 (Win32)"> 8 6 <meta name="AUTHOR" content="Siegfried Raasch"> 9 7 <meta name="CREATED" content="20040802;14050943"> … … 14 12 @page { size: 21cm 29.7cm } 15 13 --> 16 </style> 17 </head> 14 </style></head> 15 18 16 <body dir="ltr" lang="en-US"> 19 17 <h3 style="line-height: 100%;"><font size="4">3.5.5 Compiling and 20 18 linking user-defined code<br> 21 19 </font></h3> 22 <p style="line-height: 100%;">The compiling and linking of 23 user-defined code into a model run is done via the shellscript 24 <a 25 href="http://www.muk.uni-hannover.de/institut/software/mrun_beschreibung.html">mrun</a>. 26 The simplest (however not the most comfortable) way is by giving the 27 filenames of the files containing the user-defined code as an argument 28 of the shellscript option <a 29 href="http://www.muk.uni-hannover.de/institut/software/mrun_beschreibung.html#Opt-s">-s</a>. 30 If the user-defined subroutines are located e.g. on the two files <span 31 style="font-family: monospace;">user1.f90</span> and <span 32 style="font-family: monospace;">user2.f90</span>, then 33 the <b>mrun</b> call has to be:<br> 34 </p> 35 <p style="line-height: 100%; margin-left: 40px;"><span 36 style="font-family: monospace;">mrun... -s "user1.f90 user2.f90" ... .</span><br> 37 </p> 38 <p style="line-height: 100%;">For this call the user has to be in the 39 working directory <tt><tt><font style="font-size: 10pt;" size="2">~/palm/current_version/SOURCE</font></tt></tt>, 40 because the file with the source code of the main program is located 41 here. The main program is compiled with 42 each model run (without the appropriate filename given as argument for 43 the 44 option -s). </p> 45 <p style="line-height: 100%;">The call </p> 46 <ul> 47 <pre style="margin-bottom: 0.5cm; line-height: 100%;"><font 48 style="font-size: 10pt;" size="2">mrun 49 -s TEST 50 ,</font></pre> 51 </ul> 52 <p style="line-height: 100%;">is simpler and causes the compilation 53 of all files with suffix <tt><font style="font-size: 10pt;" size="2">.f90</font></tt> 54 located in the working 55 directory <font face="Thorndale, serif">a</font>nd having 56 user write permissions. Unchanged sources of the default model 57 have read permission only and therefore are not compiled with that 58 call. </p> 59 <p style="line-height: 100%;">Typically, users may have different 60 versions 61 of user-defined code which are to be used for different model runs. 62 According to the method just described for starting a certain model 63 run, 64 the associated user-defined code would have to be copied into the 65 working directory and code for other runs may have to be 66 removed (otherwise theses files would be compiled as well and the 67 routines like <tt><font style="font-size: 10pt;" size="2">user_actions</font></tt> 68 would occur twice or several times which would lead to compiling 69 errors). This procedure is quite tedious and can lead to errors if 70 different 71 model runs with restarts are to be carried out at the same time. It is 72 better 73 to store the different versions of user-defined code in different 74 subdirectories 75 using the base file name of the respective model run as subdirectory 76 name. In this case a line like </p> 77 <ul> 78 <pre style="margin-bottom: 0.5cm; line-height: 100%;"><font 79 style="font-size: 10pt;" size="2">% </font><a 80 href="http://www.muk.uni-hannover.de/institut/software/mrun_beschreibung.html#add_source_path"><font 81 style="font-size: 10pt;" size="2">add_source_path</font></a><font 82 style="font-size: 10pt;" size="2"> $HOME/palm/current_version/SOURCE/USER_CODE/$fname</font></pre> 83 </ul> 84 <p style="line-height: 100%;">has to be added to the <b>mrun</b> 85 configuration file. If you call <b>mrun</b> now with </p> 86 <ul> 87 <pre style="margin-bottom: 0.5cm; line-height: 100%;"><font 88 style="font-size: 10pt;" size="2">mrun -d run1 -s user1.f90 user2.f90 89 ,</font></pre> 90 </ul> 91 <p style="line-height: 100%;">the additional entry in the configuration 92 file 93 causes that the files given as argument of the option -s are also 94 looked 95 for in the directory <tt><font style="font-size: 10pt;" size="2">$HOME/palm/current_version/SOURCE/USER_CODE/run1</font></tt><font 96 style="font-size: 10pt;" size="2">,</font> 97 in case they are not found in the current working directory. The 98 specification of <tt><font style="font-size: 10pt;" size="2">-s</font><font 99 size="2"> 100 TEST</font></tt> in the <b>mrun</b> call now causes compilation of all 101 files with suffix <tt><font style="font-size: 10pt;" size="2">.f90</font></tt> 102 and user write permissions which are located in the working 103 directory or in the directory indicated by <span 104 style="font-family: monospace;">add_source_path</span>. In 105 this case no files with the same name are allowed to be in these two 106 directories. </p> 107 <p style="line-height: 100%;">Further detailed information for linking 108 user-defined code with <b>mrun</b> can be found in <a 109 href="http://www.muk.uni-hannover.de/institut/software/mrun_beschreibung.html#chapter7">chapter 110 7</a> of the <b>mrun </b>documentation (only in German). </p> 111 <p style="line-height: 100%;">While programming user-defined code, 20 <p style="line-height: 100%;">Users can add their own (modified) user-interface to a PALM-run by carrying out the following steps:</p><ol><li>Copy the default (empty) user-interface (file<span style="font-family: Courier New,Courier,monospace;"> user_interface.f90</span>) to a directory of your choice, e.g.:<br><br><span style="font-family: Courier New,Courier,monospace;"> cd ~/palm/current_version</span><br style="font-family: Courier New,Courier,monospace;"><span style="font-family: Courier New,Courier,monospace;"> mkdir -p USER_CODE/example</span><br style="font-family: Courier New,Courier,monospace;"><span style="font-family: Courier New,Courier,monospace;"> cp trunk/SOURCE/user_interface.f90 USER_CODE/example/user_example.f90</span><br></li><li>Set an additional path in the configuration file<span style="font-family: Courier New,Courier,monospace;"> .mrun.config </span>to allow <span style="font-weight: bold;">mrun </span>to find and include this file:<br><br><span style="font-family: Courier New,Courier,monospace;"> %add_source_path $base_directory/USER_CODE/$fname</span><br><br>The default configuration file (<span style="font-family: Courier New,Courier,monospace;">trunk/SCRIPTS/.mrun.config.default</span>) already includes this setting.</li><li>Modify the interface routines according to your needs.</li><li>Start a PALM run by executing<br><br><span style="font-family: Courier New,Courier,monospace;"> mrun -d example ...</span><br><br>The file<span style="font-family: Courier New,Courier,monospace;"> user_example.f90 </span>will be automatically compiled within the job and will replace PALM‘s default user-interface.<br></li></ol>The above method with including<span style="font-family: Courier New,Courier,monospace;"> $fname </span>in 21 the additional source path allows to use different user-interfaces for 22 different runs at the same time. Just store the respective 23 interface-files in subdirectories<span style="font-family: Courier New,Courier,monospace;"> USER_CODE/abcd</span>,<span style="font-family: Courier New,Courier,monospace;"> USER_CODE/cdef</span>, etc. and start <span style="font-weight: bold;">mrun</span> with option “<span style="font-family: Courier New,Courier,monospace;">-d abcd</span>“, “<span style="font-family: Courier New,Courier,monospace;">-d cdef</span>“, etc.<br><br><span style="font-weight: bold;">The modified user-interface file cannot be pre-compiled by using mbuild!</span><br><br>While programming user-defined code, 112 24 errors are frequently made. Possible ways of error 113 tracing are described in the next chapter. <br> 25 tracing are described in the next chapter. <br><p style="line-height: 100%;"> 114 26 </p> 115 27 <hr> 116 28 <p style="line-height: 100%;"><br> 117 <font color="#000080"><font color="#000080"><a href="chapter_3.5.3.html"><font 118 color="#000080"><img src="left.gif" name="Grafik1" align="bottom" 119 border="2" height="32" width="32"></font></a><a href="index.html"><font 120 color="#000080"><img src="up.gif" name="Grafik2" align="bottom" 121 border="2" height="32" width="32"></font></a><a href="chapter_3.6.html"><font 122 color="#000080"><img src="right.gif" name="Grafik3" align="bottom" 123 border="2" height="32" width="32"></font></a></font></font></p> 29 <font color="#000080"><font color="#000080"><a href="chapter_3.5.3.html"><font color="#000080"><img src="left.gif" name="Grafik1" align="bottom" border="2" height="32" width="32"></font></a><a href="index.html"><font color="#000080"><img src="up.gif" name="Grafik2" align="bottom" border="2" height="32" width="32"></font></a><a href="chapter_3.6.html"><font color="#000080"><img src="right.gif" name="Grafik3" align="bottom" border="2" height="32" width="32"></font></a></font></font></p> 124 30 <p style="line-height: 100%;"><i>Last change: </i> 15/04/05 (SR)</p> 125 </body> 126 </html> 31 </body></html>
Note: See TracChangeset
for help on using the changeset viewer.