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 : |
|
---|
Plot the solution
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 : |
|
---|
(ndarray(...,:attr:Grid.maux)) - Grid.aux of base grid
(dict) - Grid.aux_global of base grid
(list) - Grid.c_center of base grid
(list) - Grid.c_edge of base grid
(ndarray(...)) - Grid.capa of base grid
(list) - Grid.center of base grid
(list) - Grid.d of base grid
(list) - Grid.dimensions of base grid
(list) - Grid.edge of base grid
(Grid) - Base grid is returned
(list) - List of grids in this solution
(list) - Grid.lower of base grid
(int) - Grid.maux of base grid
(int) - Grid.mbc of base grid
(int) - Grid.meqn of base grid
(list) - Grid.mthbc_lower of base grid
(list) - Grid.mthbc_upper of base grid
(list) - Grid.n of base grid
(list) - Grid.name of base grid
(int) - Grid.ndim of base grid
(list) - Grid.p_center of base grid
(list) - Grid.p_edge of base grid
(ndarray(...,:attr:Grid.meqn)) - Grid.q of base grid
(float) - Grid.t of base grid
(list) - Grid.units of base grid
(list) - Grid.upper of base grid
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 : |
|
---|
Returns a tuple of all dimensions’ attribute attr
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 : |
|
---|
(ndarray(...,maux)) - Auxiliary array for this grid containing per cell information
(dict) - Dictionary of global values for this grid, default = {}
(list of ndarray(...)) - List containing the arrays locating the computational locations of cell centers, see compute_c_center() for more info.
(list of ndarray(...)) - List containing the arrays locating the computational locations of cell edges, see compute_c_edge() for more info.
(ndarray(...)) - Capacity array for this grid, default = 1.0
(list) - List of center coordinate arrays
(list) - List of computational grid cell widths
(list) - List of Dimension objects defining the grid’s extent and resolution
List of edge coordinate arrays
(int) - Grid number of current grid, default = 0
(int) - AMR level this grid belongs to, default = 1
(list) - Lower coordinate extents of each dimension
(func) - Grid mapping function
(int) - Rank of auxiliary array
(int) - Number of ghost cells along the boundaries, default = 2
(int) - Dimension of q array for this grid, default = 1
(list) - List of lower bc methods
(list) - List of upper bc methods
(list) - List of the number of grid cells in each dimension
(list) - List of names of each dimension
(int) - Number of dimensions
(list of ndarray(...)) - List containing the arrays locating the physical locations of cell centers, see compute_p_center() for more info.
(list of ndarray(...)) - List containing the arrays locating the physical locations of cell edges, see compute_p_edge() for more info.
(ndarray(...,meqn)) - Cell averaged quantity being evolved.
(float) - Current time represented on this grid, default = 0.0
(list) - List of dimension units
(list) - Upper coordinate extends of each dimension
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 : |
|
(ndarrary(:)) - Location of all grid cell center coordinates for this dimension
(float) - Size of an individual, computational grid cell
(ndarrary(:)) - Location of all grid cell edge coordinates for this dimension
(float) - Lower computational grid extent
(int) - Lower boundary condition fill method. default = 1
(int) - Upper boundary condition fill method. default = 1
(int) - Number of grid cells in this dimension units
(string) Name of this coordinate dimension (e.g. ‘x’)
(string) Corresponding physical units of this dimension (e.g. ‘m/s’), default = None
(float) - Upper computational grid extent
(func) - User defined boundary condition function, lower. default = None
(func) - User defined boundary condition function, upper. default = None