Pyclaw Controller Class

The pyclaw controller object is a convenience class for running simulations based on the classic clawpack formats and output specifications. It allows for a variety of output time specifications, output styles and other ways to keep a simulation organized.

The main way to use a Controller object then is to provide it with an appropriate Solver and initial Solution object. Then specify what kind of output you would like different than the defaults (see Controller for details on what those are). Then simply call run() in order to run the desired simulation.

>>> import pyclaw.controller as controller
>>> claw = controller.Controller()            # Instantiate a new controller
>>> claw.solver = my_solver                   # Assign a solver
>>> claw.solutions['n'] = my_initial_solution # Assign an initial condition

Here we would set a variety of run parameters such as tfinal, keep_copy if we wanted to plot the solutions immediately, or output_format to specify a format other than ascii or no output files if we are going to use keep_copy = True. After we are all set up we just need to call the controller’s run() method and off we go.

>>> claw.run()

Please see the Pyclaw Tutorial for a detailed example of how this would work in its entirety.

pyclaw.controller.Controller

class pyclaw.controller.Controller

Controller for pyclaw simulation runs and plotting

Initialization:Input: None
Version:1.0 (2009-06-01)
get_data(claw_path=None)

Create a data object from this controller’s solver and solutions

This function will take the current solver and solutions[‘n’] and create a data object that can be read in via classic clawpack.

If claw_path is provided, then the data that should be written to the claw.data file will be written to that path.

Input:
  • claw_path - (string) Path to write data file to
Output:
  • (Data) - Data object claw_data containing the appropriate data for a claw.data file.
read_data(path)

Read in a claw.data file and initialize accordingly

Warning

Not implemented!

run()

Convenience routine that will evolve solutions[‘n’] based on the traditional clawpack output and run parameters.

This function uses the run parameters and solver parameters to evolve the solution to the end time specified in run_data, outputting at the appropriate times.

Input:None
Ouput:(dict) - Return a dictionary of the status of the solver.
Version:1.0 (2009-05-01)
runxclaw(verbose=True)

Run the command xdir/xclawcmd, directing the output fort.* files to outdir, writing unit 6 timestepping info to file xclawout. Runtime error messages are written to file xclawerr. If xclawout(xclawerr) is None, then output to stdout(stderr).

If savecode==True, archive a copy of the code into directory outdir.

This function returns the returncode from the process running xclawcmd, which will be nonzero if a runtime error occurs.

Table Of Contents

Previous topic

Pyclaw

Next topic

Pyclaw Data Objects

This Page