Error running an example of CLAWPACK by using Pyclaw

355 views
Skip to first unread message

Miguel Caro

unread,
Jul 21, 2014, 5:42:12 PM7/21/14
to claw-...@googlegroups.com
Hello,

i start using CLAWPACK 5.1. I am trying to running an example, e.g. Euler 2D, as it is written in http://clawpack.github.io/doc/first_run.html#first-run. But when i executed these code lines:

cd pyclaw/examples/euler_2d
python shock_bubble_interaction.py iplot=1

It is produced this error

miguel@miguel-desktop:~/clawpack-5.1.0/pyclaw/examples/euler_2d$ python shock_bubble_interaction.py  iplot=1
Traceback (most recent call last):
  File "shock_bubble_interaction.py", line 293, in <module>
    from clawpack.pyclaw.util import run_app_from_main
ImportError: No module named clawpack.pyclaw.util


Maybe  any person had the same error before.

Regards,

Miguel.
--
"Calmaras la sed recogiendo el agua con tus propias manos".
Antiguo proverbio somalí.

Prof. Dr. Miguel A. Caro Candezano
Departamento de Matemáticas
Universidad del Atlántico
Barranquilla-Colombia

Weston Lowrie

unread,
Jul 21, 2014, 6:27:14 PM7/21/14
to claw-...@googlegroups.com
Hi Miguel,

It looks like python cannot find your pyclaw installation.  You may want to verify that it is installed in a location like:
/usr/local/lib/python2.7/dist-packages/clawpack

or if in a non-standard location, that you set something like this:
export PYTHONPATH=$PYTHONPATH:/path/to/your/clawpack
where /path/to/your/clawpack is the place where the clawpack python module is installed.

I have had success compiling/installing clawpack by running in the clawpack repo directory:
sudo python setup.py build
and
sudo python setup.py install

Hope that helps,
Wes



--
You received this message because you are subscribed to the Google Groups "claw-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to claw-users+...@googlegroups.com.
To post to this group, send email to claw-...@googlegroups.com.
Visit this group at http://groups.google.com/group/claw-users.
For more options, visit https://groups.google.com/d/optout.



--
   O__  ----
  c/ /'_ ---
 (*) \(*) --
~~~~~~~~~~~~

Miguel Caro

unread,
Jul 22, 2014, 3:41:36 PM7/22/14
to claw-...@googlegroups.com
Hello Weston,

it is curious for me that when i run a  1D example from pyclaw/examples the numerical results are produced. 
But when i try to run a 2D examples, for instance euler_2D quadrants or shockbubble..., it is produced the followinf error:

2014-06-04 13:44:18,337 io INFO CLAW: 270 - Unable to open auxillary file /home/miguel/clawpack-5.1.0/pyclaw/examples/euler_2d/_output/fort.a0000 or /home/miguel/clawpack-5.1.    0/pyclaw/examples/euler_2d/_output/fort.a0000
 24 2014-06-04 13:44:18,337 io INFO CLAW: 355 - Read in solution for time t=0.0
 25 2014-06-04 14:39:28,575 io INFO CLAW: 270 - Unable to open auxillary file /home/miguel/clawpack-5.1.0/pyclaw/examples/euler_2d/_output/fort.a0000 or /home/miguel/clawpack-5.1.    0/pyclaw/examples/euler_2d/_output/fort.a0000
 26 2014-06-04 14:39:28,575 io INFO CLAW: 355 - Read in solution for time t=0.0

Miguel.

Kyle Mandli

unread,
Jul 22, 2014, 7:25:56 PM7/22/14
to claw-...@googlegroups.com
Is this happening during plotting?

Kyle

David Ketcheson

unread,
Jul 23, 2014, 2:51:46 AM7/23/14
to claw-...@googlegroups.com
As the logger message indicates, I believe that line is just "info" and not an error. It still plots the results, right?

If you update to 5.2, that message should go away.

Miguel Caro

unread,
Jul 23, 2014, 1:21:15 PM7/23/14
to claw-...@googlegroups.com
Dear friends,

it doesn't plot any figure. I run some 2D examples. Only the following examples i could see the results:
1. advection_2d_annulus, ok!
2. acoustic_2d_variables, ok!
3. acoustic_3d_variables (i couldnt see the figures, it appeared this error
Traceback (most recent call last):
  File "acoustics_3d_interface.py", line 131, in <module>
    output = run_app_from_main(setup)
  File "/usr/local/lib/python2.7/dist-packages/clawpack/pyclaw/util.py", line 68, in run_app_from_main
    pyclaw.plot.interactive_plot(outdir=outdir)
  File "/usr/local/lib/python2.7/dist-packages/clawpack/pyclaw/plot.py", line 69, in interactive_plot
    htmlplot=False)
  File "/usr/local/lib/python2.7/dist-packages/clawpack/pyclaw/plot.py", line 44, in plot
    if not isinstance(setplot_func, types.FunctionType):
UnboundLocalError: local variable 'setplot_func' referenced before assignment

4. shallow_2D, ok!

 5. euler 2D: When i run the euler 2D example, e.g. quadrants, the following error is produced:

 2014-06-04 13:44:06,277 root INFO CLAW: 403 - Solution 10 computed for time t=0.600000
 23 2014-06-04 13:44:18,337 io INFO CLAW: 270 - Unable to open auxillary file /home/miguel/clawpack-5.1.0/pyclaw/exam    ples/euler_2d/_output/fort.a0000 or /home/miguel/clawpack-5.1.0/pyclaw/examples/euler_2d/_output/fort.a0000
 24 2014-06-04 13:44:18,337 io INFO CLAW: 355 - Read in solution for time t=0.0
 25 2014-06-04 14:39:28,575 io INFO CLAW: 270 - Unable to open auxillary file /home/miguel/clawpack-5.1.0/pyclaw/exam    ples/euler_2d/_output/fort.a0000 or /home/miguel/clawpack-5.1.0/pyclaw/examples/euler_2d/_output/fort.a0000

and no figure is produced.

Thanks for any suggestions.

Miguel.


2014-07-23 1:51 GMT-05:00 David Ketcheson <dke...@gmail.com>:
As the logger message indicates, I believe that line is just "info" and not an error.  It still plots the results, right?

If you update to 5.2, that message should go away.
--
You received this message because you are subscribed to the Google Groups "claw-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to claw-users+...@googlegroups.com.
To post to this group, send email to claw-...@googlegroups.com.
Visit this group at http://groups.google.com/group/claw-users.
For more options, visit https://groups.google.com/d/optout.

Miguel Caro

unread,
Jul 23, 2014, 1:42:46 PM7/23/14
to claw-...@googlegroups.com
Hello friends,

i installed the version 5.2. And the problems were solved. I could execute the euler 2D, quadrants examples without errors. But no figure was produced of the numerical results of these examples.

Maybe somebody could me help in this case.

The propose of my work with the new version of CLAWPACK,  is to add new flux limiter, modify the output format to reproduce the numerical results with  visualization tools like for example: visit or paraview.

Regards,

Miguel.

Kyle Mandli

unread,
Jul 23, 2014, 1:56:17 PM7/23/14
to claw-...@googlegroups.com
I just looked at the Euler quadrants example in PyClaw and found that it does not include the normal command line interface of some of the other examples.  If you want to plot uncomment out the line

#pyclaw.plot.interactive_plot()

and it should give you interactive plots for each output time.

As for your goals, adding a new limiter should not be difficult.  If you are working with PyClaw I might suggest doing a Python version of your proposed limiter before mucking about with the Fortran.  Also, we did add support for outputting in HDF which I know VisIt and ParaView both can handle so hopefully plotting the  results will not be too difficult.

Kyle

Miguel Caro

unread,
Jul 23, 2014, 2:11:01 PM7/23/14
to claw-...@googlegroups.com
Dear Kyle,

thanks for your comments!

I uncomment out the line #pyclaw.plot.interactive_plot() in quadrants.py but this is the error produced

 File "/usr/local/lib/python2.7/dist-packages/clawpack/pyclaw/plot.py", line 44, in plot
    if not isinstance(setplot_func, types.FunctionType):
UnboundLocalError: local variable 'setplot_func' referenced before assignment

Another thing: i remembered that when i was working with the older version of clawpack 4., it was a file called inlimiter.f or philim.f, and  it was possible add  new flux limiter inthere.

Which file in  clawapck 5.2 contains the limiter? 

unfortunately i am a rookie using python, pyclaw and new versions of clawpack, i'm sorry :(.

Regards 

Miguel


Kyle Mandli

unread,
Jul 23, 2014, 2:55:48 PM7/23/14
to claw-...@googlegroups.com
Hi Miguel,

Attached is a modified version of the quadrants.py example which should plot itself.

The code you are referencing for PyClaw is now in pyclaw/src/pyclaw/classic with nearly the same names.  A word of caution though, you will need to rebuild the libraries every time you change the fortran source (this is dependent on how you originally installed the code unfortunately).  The Python implementations of the limiters are in pyclaw/src/pyclaw/limiters/tvd.py and can be modified much more easily.  In any case, please feel free to continue to email the list if you run into any problems.

Kyle
quadrants.py

David Ketcheson

unread,
Jul 24, 2014, 2:09:48 AM7/24/14
to claw-...@googlegroups.com
Dear Miguel,

Your installation is working fine.  It is simply that no "automatic" plotting is implemented for the examples where you don't see plots.  The simulation output is written to files in the subdirectory named "_output".  In the documentation (or by looking at other examples) you can find various ways to plot results.

If you change Fortran source code, the easiest way to recompile is to go to the top level clawpack directory and do

    pip install -e .

Just make sure you do this in the clawpack directory that contains your modified code in a subdirectory.

-David

Miguel Caro

unread,
Jul 24, 2014, 7:23:11 AM7/24/14
to claw-...@googlegroups.com
Thanks a lot friends,

i shall be in contact with you if any problem arises


Regards,

Miguel.


--
You received this message because you are subscribed to the Google Groups "claw-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to claw-users+...@googlegroups.com.
To post to this group, send email to claw-...@googlegroups.com.
Visit this group at http://groups.google.com/group/claw-users.
For more options, visit https://groups.google.com/d/optout.

Miguel Caro

unread,
Jul 24, 2014, 11:46:03 AM7/24/14
to claw-...@googlegroups.com
Hello again,

well, i implemented the quadrants.py kindly sent to me for Kyle and, i got the results and figures pretty well, just a little question.

In former versions of CLAWPACK, i modified the output.f and the data file of numerical results were organized of this way, for example, in a  2D case of Euler Eqns i set the output files like that:

x    y   rho  u  v  E.

In this way, I could with a C++ file create a new output data file with a vtk extension. Then i plot the figure by using Paraview and/or visit.

In the new CLAWPACK versions ( python environment) for example 5.2, where  can i modify the output file?

Regards

Miguel.

Kyle Mandli

unread,
Jul 24, 2014, 4:24:20 PM7/24/14
to claw-...@googlegroups.com
I am a little confused as to what you are looking for, since Clawpack grids are all structured you should be able to reconstruct the exact locations of all grid cell centers without outputting the x,y coordinates.  PyClaw also has the ability to write out derived quantities like u and v, the most relevant documentation is at http://clawpack.github.io/doc/pyclaw/output.html.

That being said, I think there are a few options open to you:

 - Outputting VTK data files directly would be possible.  The code that reads and writes data is located at pyclaw/src/pyclaw/io but you might think about writing a simple script that reads in data via the Solution object and follow the code at http://www.vtk.org/Wiki/VTK/Writing_VTK_files_using_python which describes how to write out VTK files with Python.
 - Modify the ascii format at the same path as above to output in your required format
 - Use PyClaw's HDF format to write out data and read it into VisIt and ParaView.

Kyle

David Ketcheson

unread,
Jul 25, 2014, 4:19:23 AM7/25/14
to claw-...@googlegroups.com
Hola Miguel,

Just to add a bit to what Kyle said:

You can get the grid coordinates via

    X, Y = claw.solution.grid.p_centers

and then write them to a file yourself at the beginning of the simulation (after all, it's not necessary to write the coordinates out at every time, is it?)

You could also output the coordinates as "derived quantities" at every step (see the page Kyle linked to).

Miguel Caro

unread,
Jul 25, 2014, 12:27:58 PM7/25/14
to claw-...@googlegroups.com
Thanks Kyle and David,

i shall follow your recommendations

Miguel.


--
You received this message because you are subscribed to the Google Groups "claw-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to claw-users+...@googlegroups.com.
To post to this group, send email to claw-...@googlegroups.com.
Visit this group at http://groups.google.com/group/claw-users.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages