Pyclaw Solver Base Classes

The solver module provides a template for a solver that Pyclaw knows how to interact with. It is expected that a subclass will override the class method step() in order to provide a complete solver.

The main method of interest defined in this module is the evolve_to_time() method which evolves the solutions given to the end time provided. Details of how this works can be found below.


Module specifying the interface to every solver in pyclaw.

Authors:Kyle T. Mandli (2008-08-19) Initial version
class pyclaw.evolve.solver.Solver(data=None)

Pyclaw solver superclass

All solvers should inherit from this object as it defines the interface that the Pyclaw expects for solvers. This mainly means the evolve_to_time exists and the solver can be initialized and called correctly.


Current time step, default = 0.1


Current Courant/Freidrichs/Levy number, default = 1.0

Dictionary of status values for the solver with the following keys:
  • cflmax = Maximum CFL condition reached
  • dtmin = Minimum time step taken
  • dtmax = Maximum time step taken
  • numsteps = Current number of time steps that have been taken

Whether to allow the time step to vary, default = True


The maximum number of time steps allowd to reach the end time requested, default = 1000


A list of run times taken by the solver, each request to evolve a solution to a new time a new timing is appended to this list.


Default logger for all solvers

Initialization :
  • data - (Data) Data object to initialize the solver with
  • (Solver) - Initialized Solver object
Version :1.0 (2008-08-19)

Evolve solutions[‘n’] to tend

This method contains the machinery to evolve the solution object in solutions['n'] to the requested end time tend if given, or one step if not. The solutions dictionary is provided as a generic interface to multistep methods that may require more than one solution at multiple times to evolve where it is understood that the solution at solutions['n'] is the solution at the current time step that is to be evolved.

Input :
  • solutions - (Solution) Dictionary of Solutions to be evolved
  • tend - (float) The end time to evolve to, if not provided then the method will take a single time step.
Output :
  • (dict) - Returns the status dictionary of the solver

Checks that all required attributes are set

Checks to make sure that all the required attributes for the solver have been set correctly. All required attributes that need to be set are contained in the attributes list of the class.

Will post debug level logging message of which required attributes have not been set.

Output :
  • valid - (bool) True if the solver is valid, False otherwise

Stub for solver setup routines.

This function is called before a set of time steps are taken in order to reach tend. A subclass should override it only if it needs to perform some setup based on attributes that would be set after the initialization routine.

This function is just a stub here.


Take one step

This method is only a stub and should be overridden by all solvers who would like to use the default time stepping in evolve_to_time.

Table Of Contents

Previous topic

Riemann Solver Package

Next topic

Pyclaw Input/Output Package

This Page