All Pyclaw solutions work via the following hierarchy:
Each solution contains a list of Grids which in turn contain a list of Dimensions, each containing higher level attributes.
Pyclaw grid container class
Input and output: | |
---|---|
Input and output of solution objects is handle via the io package. Solution contains the generic methods write(), read() and plot() which then figure out the correct method to call. Please see the io package for the particulars of each format and method and the methods in this class for general input and output information. |
|
Properties: | If there is only one grid belonging to this grid, the solution will appear to have many of the attributes assigned to its one grid. Some parameters that have in the past been parameters for all grids are also reachable although Solution does not check to see if these parameters are truly universal.
|
Initialization: |
|
Checks to see if this solution is valid
The Solution checks to make sure it is valid by checking each of its grids. If an invalid grid is found, a message is logged what specifically made this solution invalid.
Output: |
|
---|
Reads in a Solution object from a file
Reads in and initializes this Solution with the data specified. This function will raise an IOError if it was unsuccessful.
Any format must conform to the following call signiture and return True if the file has been successfully read into the given solution or False otherwise. Options is a dictionary of parameters that each format can specify. See the ascii module for an example.:
read_<format>(solution,path,frame,file_prefix,options={})
<format> is the name of the format in question.
Input: |
|
---|---|
Output: |
|
Sets all member grids attribute ‘attr’ to value
Input: |
|
---|
Write out a representation of the solution
Writes out a suitable representation of this solution object based on the format requested. The path is built from the optional path and file_prefix arguments. Will raise an IOError if unsuccessful.
Input: |
|
---|
Basic representation of a single grid in Pyclaw
Dimension information: | |
---|---|
Each dimension has an associated name with it that can be accessed via that name such as grid.x.n which would access the x dimension’s number of grid cells. |
|
Global grid information: | |
Each grid has a value for level, gridno, t, mbc, meqn and aux_global. These correspond to global grid traits and determine many of the properties and sizes of the data arrays. |
|
Grid data: | The arrays q, aux and capa have variable extents based on the set of dimensions present and the values of meqn and maux. Note that these are initialy set to None so need to be instantiated. For convenience, the methods emtpy_q(), ones_q(), and zeros_q() for q and emtpy_aux(), ones_aux(), and zeros_aux() for aux are provided to initialize these arrays. The capa array is initially set to all 1.0 and needs to be manually set. |
Properties: | If the requested property has multiple values, a list will be returned with the corresponding property belonging to the dimensions in order. |
Initialization: |
|
Add the specified dimension to this grid
Input: |
|
---|
Calculate the c_center array
This array is computed only when requested and then stored for later use unless the recompute flag is set to True.
Access the resulting computational coodinate array via the corresponding dimensions or via the computational grid properties c_center.
Input: |
|
---|
Calculate the c_edge array
This array is computed only when requested and then stored for later use unless the recompute flag is set to True.
Access the resulting computational coodinate array via the corresponding dimensions or via the computational grid properties c_edge.
Input: |
|
---|
Calculates the p_center array
This array is computed only when requested and then stored for later use unless the recompute flag is set to True (you may want to do this for time dependent mappings).
Access the resulting physical coordinate array via the corresponding dimensions or via the computational grid properties p_center.
Input: |
|
---|
Calculates the p_edge array
This array is computed only when requested and then stored for later use unless the recompute flag is set to True (you may want to do this for time dependent mappings).
Access the resulting physical coordinate array via the corresponding dimensions or via the computational grid properties p_edge.
Input: |
|
---|
Initialize aux to empty with given shape
Input: |
|
---|
Initialize q to empty
Input: |
|
---|
Checks to see if this grid is valid
A debug logger message will be sent documenting exactly what was not valid.
Output: |
|
---|
Initialize aux to ones with shape
Input: |
|
---|
Initialize q to all ones
Input: |
|
---|
Appends boundary conditions to q
This function returns an array of dimension determined by the mbc attribute. The type of boundary condition set is determined by mthbc_lower and mthbc_upper for the approprate dimension. Valid values for mthbc_lower and mthbc_upper include:
Output: |
|
---|
Note
Note that for user defined boundary conditions, the array sent to the boundary condition has not been rolled.
Remove the dimension named name
Input: |
|
---|
Convenience routine for parsing data files into the aux_global dict
Puts the data from the file at path and puts it into the aux_global dictionary using Data. This assumes that all values in the file are to be put into the aux_global dictionary and the file conforms to that which Data can read.
Input: |
|
---|
Note
This will not replace the aux_global dictionary but add to or replace any values already in it.
Initialize aux to zeros with shape
Input: |
|
---|
Initialize q to all zeros
Input: |
|
---|
Basic class representing a dimension of a Grid object
Initialization: |
---|
Apply lower boundary conditions to qbc
Sets the lower coordinate’s ghost cells of qbc depending on what mthbc_lower is. If mthbc_lower = 0 then the user boundary condition specified by user_bc_lower is used. Note that in this case the function user_bc_lower belongs only to this dimension but user_bc_lower could set all user boundary conditions at once with the appropriate calling sequence.
Input: |
|
---|---|
Input/ouput: |
|
Apply upper boundary conditions to qbc
Sets the upper coordinate’s ghost cells of qbc depending on what mthbc_upper is. If mthbc_upper = 0 then the user boundary condition specified by user_bc_upper is used. Note that in this case the function user_bc_upper belongs only to this dimension but user_bc_upper could set all user boundary conditions at once with the appropriate calling sequence.
Input: |
|
---|---|
Input/ouput: |
|