PageRenderTime 65ms CodeModel.GetById 33ms RepoModel.GetById 0ms app.codeStats 0ms

/v5.5.x/first_run.html

https://github.com/clawpack/clawpack.github.com
HTML | 268 lines | 256 code | 11 blank | 1 comment | 0 complexity | 78229a2b4d0dcb76ed2644d583d0f0bd MD5 | raw file
  1. <!DOCTYPE html>
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta charset="utf-8" />
  5. <title>Running an example &#8212; Clawpack 5.5.0 documentation</title>
  6. <link rel="stylesheet" href="_static/flasky.css" type="text/css" />
  7. <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
  8. <link rel="stylesheet" href="_static/base.css" type="text/css" />
  9. <link rel="stylesheet" href="_static/layout.css" type="text/css" />
  10. <link rel="stylesheet" type="text/css" href="_static/graphviz.css" />
  11. <script id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
  12. <script src="_static/jquery.js"></script>
  13. <script src="_static/underscore.js"></script>
  14. <script src="_static/doctools.js"></script>
  15. <script src="_static/language_data.js"></script>
  16. <script async="async" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
  17. <link rel="shortcut icon" href="_static/clawicon.ico"/>
  18. <link rel="author" title="About these documents" href="about.html" />
  19. <link rel="index" title="Index" href="genindex.html" />
  20. <link rel="search" title="Search" href="search.html" />
  21. <link rel="next" title="Clawpack components" href="clawpack_components.html" />
  22. <link rel="prev" title="Set environment variables" href="setenv.html" />
  23. </head><body>
  24. <div id="main-wrapper" class="sphinx">
  25. <div id="header-wrapper">
  26. <section id="header">
  27. <!-- <h1><a href="http://clawpack.org/">Clawpack</a></h1> -->
  28. <h1><a href="http://clawpack.org/">Clawpack-5</a></h1>
  29. <nav>
  30. <ul>
  31. <li>
  32. <a href="contents.html">Docs</a>
  33. </li>
  34. <li>
  35. <a href="installing.html">Install</a>
  36. </li>
  37. <li>
  38. <a class="" href="http://clawpack.org/gallery/index.html">Gallery</a>
  39. </li>
  40. <li>
  41. <a href="about.html">Citation</a>
  42. </li>
  43. <li>
  44. <a class="active" href="http://github.com/clawpack">GitHub</a>
  45. </li>
  46. <li>
  47. <a class="" href="community.html">Community</a>
  48. </li>
  49. <li>
  50. <a class="" href="developers.html">Contribute</a>
  51. </li>
  52. </ul>
  53. </nav>
  54. </section>
  55. <div class="decoration"></div>
  56. </div>
  57. <div class="related" role="navigation" aria-label="related navigation">
  58. <h3>Navigation</h3>
  59. <ul>
  60. <li class="right" style="margin-right: 10px">
  61. <a href="genindex.html" title="General Index"
  62. accesskey="I">index</a></li>
  63. <li class="right" >
  64. <a href="py-modindex.html" title="Python Module Index"
  65. >modules</a> |</li>
  66. <li class="right" >
  67. <a href="clawpack_components.html" title="Clawpack components"
  68. accesskey="N">next</a> |</li>
  69. <li class="right" >
  70. <a href="setenv.html" title="Set environment variables"
  71. accesskey="P">previous</a> |</li>
  72. <li class="nav-item nav-item-0"><a href="contents.html">Clawpack 5.5.0 documentation</a> &#187;</li>
  73. </ul>
  74. </div>
  75. <div class="document">
  76. <div class="documentwrapper">
  77. <div class="bodywrapper">
  78. <div class="body" role="main">
  79. <div class="section" id="running-an-example">
  80. <span id="first-run"></span><h1>Running an example<a class="headerlink" href="#running-an-example" title="Permalink to this headline"></a></h1>
  81. <p>Many examples of Clawpack simulations can be seen in the <span class="xref std std-ref">galleries</span>.</p>
  82. <p>See also <span class="xref std std-ref">first_tests</span>.</p>
  83. <div class="section" id="pyclaw">
  84. <h2>PyClaw<a class="headerlink" href="#pyclaw" title="Permalink to this headline"></a></h2>
  85. <p>To run an example and plot the results using PyClaw, simply do the following
  86. (starting from your <cite>clawpack</cite> directory):</p>
  87. <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">cd</span> <span class="n">pyclaw</span><span class="o">/</span><span class="n">examples</span><span class="o">/</span><span class="n">euler_2d</span>
  88. <span class="n">python</span> <span class="n">shock_bubble_interaction</span><span class="o">.</span><span class="n">py</span> <span class="n">iplot</span><span class="o">=</span><span class="mi">1</span>
  89. </pre></div>
  90. </div>
  91. <p>Thats it. For next steps with PyClaw, see <a class="reference internal" href="pyclaw/basics.html#basics"><span class="std std-ref">PyClaw Basics</span></a>.</p>
  92. </div>
  93. <div class="section" id="classic">
  94. <h2>Classic<a class="headerlink" href="#classic" title="Permalink to this headline"></a></h2>
  95. <p>First ensure that you have <a class="reference internal" href="setenv.html#setenv"><span class="std std-ref">Set environment variables</span></a>
  96. and that you have the <span class="xref std std-ref">install_prerequisites</span>.</p>
  97. <p>A simple 1-dimensional acoustics equations can be solved
  98. using the code in <a class="reference external" href="_static/classic/examples/acoustics_1d_example1/README.html">$CLAW/classic/examples/acoustics_1d_example1</a>, as
  99. illustrated in <span class="xref std std-ref">gallery_classic_amrclaw</span>.</p>
  100. <p>Move to this directory via:</p>
  101. <div class="highlight-default notranslate"><div class="highlight"><pre><span></span>cd $CLAW/classic/examples/acoustics_1d_example1
  102. </pre></div>
  103. </div>
  104. <p>You can try the following test in this directory, or you may want to first
  105. make a copy of it (see the instructions in <a class="reference internal" href="newapp.html#copyex"><span class="std std-ref">Copying an existing example</span></a>).</p>
  106. <p>The Makefiles are set up to do dependency checking so that in many
  107. application directories you can simply type:</p>
  108. <div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ make .plots
  109. </pre></div>
  110. </div>
  111. <p>and the Fortran code will be compiled, data files created, the code
  112. run, and the results plotted automatically, resulting in a set of webpages
  113. showing the results.</p>
  114. <p>However, if this is your first attempt to run a code, it is useful to go
  115. through these steps one at a time, both to understand the steps and so that
  116. any problems with your installation can be properly identified.</p>
  117. <p>You might want to start by examining the Makefile. This sets a number of
  118. variables, which at some point you might need to modify for other examples,
  119. see <a class="reference internal" href="makefiles.html#makefiles"><span class="std std-ref">Clawpack Makefiles</span></a> for more about this. At the bottom of the Makefile is
  120. an <cite>include</cite> statement that points to a common Makefile that is used by most
  121. applications, and where all the details of the make process can be found.</p>
  122. <p>To compile the code, type:</p>
  123. <div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ make .exe
  124. </pre></div>
  125. </div>
  126. <p>If this gives an error, see <a class="reference internal" href="trouble.html#trouble-makeexe"><span class="std std-ref">Trouble running make .exe</span></a>.</p>
  127. <p>This should compile the example code (after first compiling the required
  128. library routines) and produce an executable named <cite>xclaw</cite> in this directory.</p>
  129. <p>Before running the code, it is necessary to also create a set of data files
  130. that are read in by the Fortran code. This can be done via:</p>
  131. <div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ make .data
  132. </pre></div>
  133. </div>
  134. <p>If this gives an error, see <a class="reference internal" href="trouble.html#trouble-makedata"><span class="std std-ref">Trouble running make .data</span></a>.</p>
  135. <p>This uses the Python code in <cite>setrun.py</cite> to create data files that have the
  136. form <cite>*.data</cite>.</p>
  137. <p>Once the executable and the data files all exist, we can run the code. The
  138. recommended way to do this is to type:</p>
  139. <div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ make .output
  140. </pre></div>
  141. </div>
  142. <p>If this gives an error, see <a class="reference internal" href="trouble.html#trouble-makeoutput"><span class="std std-ref">Trouble running make .output</span></a>.</p>
  143. <p>Before running the code a subdirectory <cite>_output</cite> is created
  144. and the output of the code (often a large number of files) is directed to
  145. this subdirectory. This is convenient if you want to do several runs with
  146. different parameter values and keep the results organized. After the code
  147. has run you can rename the subdirectory, or you can modify the variable
  148. <cite>OUTDIR</cite> in the Makefile to direct results to a different directory. See
  149. <a class="reference internal" href="makefiles.html#makefiles"><span class="std std-ref">Clawpack Makefiles</span></a> for more details. Copies of all the data files are also
  150. placed in the output directory for future reference.</p>
  151. <p><strong>Plotting the results.</strong>
  152. Once the code has run and the files listed above have been created, there are several
  153. options for plotting the results.</p>
  154. <p>To try the Python tools, type:</p>
  155. <div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ make .plots
  156. </pre></div>
  157. </div>
  158. <p>If this gives an error, see <a class="reference internal" href="trouble.html#trouble-makeplots"><span class="std std-ref">Trouble running make .plots</span></a>.</p>
  159. <p>If this works, it will create a subdirectory named <cite>_plots</cite> that contains a number of
  160. image files (the <cite>*.png</cite> files) and a set of html files that can be used to view the
  161. results from a web browser. See <span class="xref std std-ref">plotting_makeplots</span> for more details.</p>
  162. <p>An alternative is to view the plots from an interactive Python session, as described in
  163. the section <a class="reference internal" href="plotting_python.html#plotting-iplotclaw"><span class="std std-ref">Interactive plotting with Iplotclaw</span></a>.</p>
  164. <p>If you wish to use Matlab instead, see <a class="reference internal" href="matlab_plotting.html#matlabplots"><span class="std std-ref">Plotting using Matlab</span></a>.</p>
  165. <p>Other visualization packages could also be used to display the results, but you will need
  166. to figure out how to read in the data. See <span class="xref std std-ref">fortfiles</span> for information about the
  167. format of the files produced by Clawpack.</p>
  168. </div>
  169. </div>
  170. </div>
  171. </div>
  172. </div>
  173. <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
  174. <div class="sphinxsidebarwrapper">
  175. <p><a href="http://clawpack.org/">
  176. <img class="logo" src= "_static/clawlogo.jpg" alt="Logo"/>
  177. </a>
  178. <h2>Version 5.5.0</h2>
  179. </p>
  180. <h3><a href="contents.html">Table of Contents</a></h3>
  181. <ul>
  182. <li><a class="reference internal" href="#">Running an example</a><ul>
  183. <li><a class="reference internal" href="#pyclaw">PyClaw</a></li>
  184. <li><a class="reference internal" href="#classic">Classic</a></li>
  185. </ul>
  186. </li>
  187. </ul>
  188. <h3>Related Topics</h3>
  189. <ul>
  190. <li><a href="contents.html">Documentation overview</a><ul>
  191. <li>Previous: <a href="setenv.html" title="previous chapter">Set environment variables</a></li>
  192. <li>Next: <a href="clawpack_components.html" title="next chapter">Clawpack components</a></li>
  193. </ul></li>
  194. </ul>
  195. <div class="widget navlinks">
  196. <h3>This Page</h3>
  197. <ul class="this-page-menu">
  198. <li><a href="_sources/first_run.rst.txt"
  199. rel="nofollow"
  200. target="_blank">Source .rst</a></li>
  201. <li><a href="https://github.com/clawpack/doc/blob/dev/doc/first_run.rst"
  202. rel="nofollow"
  203. target="_blank">Source on GitHub</a></li>
  204. <li><a href="https://github.com/clawpack/doc/commits/dev/doc/first_run.rst"
  205. rel="nofollow"
  206. target="_blank">History</a></li>
  207. <li><a href="https://github.com/clawpack/doc/edit/dev/doc/first_run.rst"
  208. rel="nofollow"
  209. target="_blank">Suggest Edits</a></li>
  210. <li><a href="https://github.com/clawpack/doc/issues/new/choose"
  211. rel="nofollow"
  212. target="_blank">Raise an Issue</a></li>
  213. </ul>
  214. </div>
  215. <div id="searchbox" style="display: none" role="search">
  216. <h3 id="searchlabel">Quick search</h3>
  217. <div class="searchformwrapper">
  218. <form class="search" action="search.html" method="get">
  219. <input type="text" name="q" aria-labelledby="searchlabel" />
  220. <input type="submit" value="Go" />
  221. </form>
  222. </div>
  223. </div>
  224. <script>$('#searchbox').show(0);</script>
  225. <h4>Latest Version</h4>
  226. <ul>
  227. <li><a href="../dev/first_run.html">dev</a></li>
  228. <li><a href="../v5.8.x/first_run.html">v5.8.x</a></li>
  229. </ul>
  230. <h4>Older Versions</h4>
  231. <ul>
  232. <li><a href="../v5.1.x/first_run.html">v5.1.x</a></li>
  233. <li><a href="../v5.2.x/first_run.html">v5.2.x</a></li>
  234. <li><a href="../v5.3.x/first_run.html">v5.3.x</a></li>
  235. <li><a href="../v5.4.x/first_run.html">v5.4.x</a></li>
  236. <li><a href="first_run.html">v5.5.x</a></li>
  237. <li><a href="../v5.6.x/first_run.html">v5.6.x</a></li>
  238. <li><a href="../v5.7.x/first_run.html">v5.7.x</a></li>
  239. </ul>
  240. </div>
  241. </div>
  242. <div class="clearer"></div>
  243. </div>
  244. <div class="footer">
  245. &copy; Copyright CC-BY 2020, The Clawpack Development Team.
  246. Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
  247. </div>
  248. <script>
  249. (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  250. (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  251. m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  252. })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
  253. ga('create', 'UA-44811544-1', 'auto');
  254. ga('send', 'pageview');
  255. </script>
  256. </body>
  257. </html>