|
Peano
|
Matrix-free Collocated Solver for d-linear shape functions. More...


Public Member Functions | |
| __init__ (self, name, unknowns_per_vertex, dimensions, min_h, max_h, local_assembly_matrix, local_assembly_matrix_scaling, mass_matrix, mass_matrix_scaling, solver_tolerance, smoother_relaxation=0.6, custom_init_actionset=None, custom_plot_actionset=None, custom_init_vertex="", custom_boundary_conditions="", enable_plotting=True, plot_predicate="true") | |
| Collocated low-order (d-linear) Finite Elements. | |
| add_to_Peano4_datamodel (self, datamodel, verbose) | |
| add_use_statements (self, observer) | |
| This routine should still be called even if overwritten in child class. | |
| add_to_plot (self, observer) | |
| Tell the project's observer how to plot the data. | |
| add_to_create_grid (self, observer) | |
| add_to_init_solution (self, observer) | |
| Solution initialisation. | |
| add_to_solve (self, observer) | |
| add_implementation_files_to_project (self, namespace, output, subdirectory="", abstract_overwrite=True) | |
| The solver creates two classes: An abstract base class and its implementations. | |
| get_vertex_merge_method (self) | |
Public Member Functions inherited from solvers.api.Solver.Solver | |
| typename (self) | |
| instance_name (self) | |
| Return the name of the object that will be created for this solver. | |
| create_readme_descriptor (self) | |
| add_to_abstract_solver (self, header, implementation) | |
| add_to_vertex_data (self, name, size) | |
| Add in extra attributes on the fly. | |
| add_to_cell_data (self, name, size) | |
| Add in extra attributes on the fly. | |
| add_to_face_data (self, name, size) | |
| Add in extra attributes on the fly. | |
| name (self) | |
| __str__ (self) | |
Data Fields | |
| max_h | |
| min_h | |
Data Fields inherited from solvers.api.Solver.Solver | |
| min_h | |
| max_h | |
Matrix-free Collocated Solver for d-linear shape functions.
Mathematical and algorithmic descriptions are to follow later. For now, we describe how to use this solver and a little about how it works under the hood.
Each vertex stores a certain number of values, given by the parameter unknowns_per_vertex. In essence, if this parameter is more than one, we are solving multiple different equations simultaneously, or we can equivalently think of our PDE being vector-valued.
The user needs to provide an assembly matrix, and a mass matrix. If our vector-valued PDE has \( K \) components, then each of these matrices should be square, with \( K * 2^D \) rows.
In particular, they should be structured as block diagonals. Let \( A_i \) be square with \( 2^D \) rows. Then the mass/assembly matrices should be structured as follows:
\( diag( A_1, A_2, \dots A_K ) \).
During the actual solver step, we run through each equation one after another, fetching the appropriate mass and assembly matrices for the equation in hand.
At present, it hasn't been decided how to plot the output of multiple equations, since only 1 is supported.
This array holds the actual solution which we later plot. This is updated when we touch a vertex for the last time.
This array holds the right-hand side of the equation. We assign this in experiment-specific implementation files.
This array holds the sum of the diagonals of the local assembly matrix. This is set to 0 at the start of every solver step
This is used to store \( Mb - Ax \), i.e. the RHS multiplied by the matrix, and subtract the solution multiplied by the assembly matrix.
After the grid is created, we run around the mesh and assign types to the vertices and cells.
Vertices:
Cells:
There is only one action set in this solver. We do something non-trivial during touchCellFirstTime, touchVertexFirstTime and touchVertexLastTime.
We check that the Vertex is not a coarse grid vertex, then we set the residuals and the diagonals to 0.
All four vertices are in scope here. We create three vectors, each of length \( 2^D \) to hold one value per vertex. For each vertex in the cell (regardless of whether it is on the boundary), we :
We update the solution value (on all vertices) to be equal to the solution at the previous sweep, and we add on \( \omega \times r / d \) where \( r \) and \( d \) stand for the residual and diagonal respectively.
We currently overcount the residual on vertices that are shared across boundaries. This isn't an issue at present, since we only check for the max, which is unaffected by this bug. But something to fix at later date.
Definition at line 19 of file CollocatedDLinearDiscretisationWithPointJacobi.py.
| solvers.api.CollocatedDLinearDiscretisationWithPointJacobi.CollocatedDLinearDiscretisationWithPointJacobi.__init__ | ( | self, | |
| name, | |||
| unknowns_per_vertex, | |||
| dimensions, | |||
| min_h, | |||
| max_h, | |||
| local_assembly_matrix, | |||
| local_assembly_matrix_scaling, | |||
| mass_matrix, | |||
| mass_matrix_scaling, | |||
| solver_tolerance, | |||
smoother_relaxation = 0.6, |
|||
custom_init_actionset = None, |
|||
custom_plot_actionset = None, |
|||
custom_init_vertex = "", |
|||
custom_boundary_conditions = "", |
|||
enable_plotting = True, |
|||
plot_predicate = "true" |
|||
| ) |
Collocated low-order (d-linear) Finite Elements.
Reimplemented from solvers.api.Solver.Solver.
Definition at line 115 of file CollocatedDLinearDiscretisationWithPointJacobi.py.
References solvers.api.CollocatedDLinearDiscretisationWithPointJacobi.CollocatedDLinearDiscretisationWithPointJacobi.__init__(), solvers.api.Solver.Solver._vertex_data, solvers.api.CollocatedDLinearDiscretisationWithPointJacobi.CollocatedDLinearDiscretisationWithPointJacobi.get_vertex_merge_method(), solvers.api.CollocatedMG.CollocatedMG.get_vertex_merge_method(), and solvers.api.CollocatedMGSingleThreaded.CollocatedMGSingleThreaded.get_vertex_merge_method().
Referenced by solvers.api.CollocatedDLinearDiscretisationWithPointJacobi.CollocatedDLinearDiscretisationWithPointJacobi.__init__().


| solvers.api.CollocatedDLinearDiscretisationWithPointJacobi.CollocatedDLinearDiscretisationWithPointJacobi.add_implementation_files_to_project | ( | self, | |
| namespace, | |||
| output, | |||
subdirectory = "", |
|||
abstract_overwrite = True |
|||
| ) |
The solver creates two classes: An abstract base class and its implementations.
The abstract base class will be overwritten if there is one in the directory. I pipe all the Python constants into this base class, so they are available in the C++ code.
Definition at line 258 of file CollocatedDLinearDiscretisationWithPointJacobi.py.
References peano4.api.output.ActionSet.ActionSet.__class__, peano4.api.output.Jinja2TemplatedHeaderImplementationFilePair.Jinja2TemplatedHeaderImplementationFilePair.__class__, and peano4.api.output.TemplatedHeaderFile.TemplatedHeaderFile.__class__.
| solvers.api.CollocatedDLinearDiscretisationWithPointJacobi.CollocatedDLinearDiscretisationWithPointJacobi.add_to_create_grid | ( | self, | |
| observer | |||
| ) |
Definition at line 227 of file CollocatedDLinearDiscretisationWithPointJacobi.py.
| solvers.api.CollocatedDLinearDiscretisationWithPointJacobi.CollocatedDLinearDiscretisationWithPointJacobi.add_to_init_solution | ( | self, | |
| observer | |||
| ) |
Solution initialisation.
We can either use the standard initialisation procedure or pass in another one when we instantiate this solver class.
Definition at line 231 of file CollocatedDLinearDiscretisationWithPointJacobi.py.
References solvers.api.CollocatedDLinearDiscretisationWithPointJacobi.CollocatedDLinearDiscretisationWithPointJacobi._custom_init_actionset, solvers.api.ContinuousGalerkinDiscretisationGaussLobattoWithBlockJacobi.ContinuousGalerkinDiscretisationGaussLobattoWithBlockJacobi._custom_init_actionset, and solvers.api.DiscontinuousGalerkinDiscretisationPointWiseRiemannSolver.DiscontinuousGalerkinDiscretisationPointWiseRiemannSolver._custom_init_actionset.
| solvers.api.CollocatedDLinearDiscretisationWithPointJacobi.CollocatedDLinearDiscretisationWithPointJacobi.add_to_Peano4_datamodel | ( | self, | |
| datamodel, | |||
| verbose | |||
| ) |
Reimplemented from solvers.api.Solver.Solver.
Definition at line 186 of file CollocatedDLinearDiscretisationWithPointJacobi.py.
Referenced by solvers.api.CollocatedDLinearDiscretisationWithPointJacobi.CollocatedDLinearDiscretisationWithPointJacobi.add_to_Peano4_datamodel().


| solvers.api.CollocatedDLinearDiscretisationWithPointJacobi.CollocatedDLinearDiscretisationWithPointJacobi.add_to_plot | ( | self, | |
| observer | |||
| ) |
Tell the project's observer how to plot the data.
Nothing fancy here. We add plotters from Peano's toolbox to visualise solution and right-hand side.
Definition at line 196 of file CollocatedDLinearDiscretisationWithPointJacobi.py.
References solvers.api.CollocatedDLinearDiscretisationWithPointJacobi.CollocatedDLinearDiscretisationWithPointJacobi._custom_plot_actionset, solvers.api.ContinuousGalerkinDiscretisationGaussLobattoWithBlockJacobi.ContinuousGalerkinDiscretisationGaussLobattoWithBlockJacobi._custom_plot_actionset, solvers.api.DiscontinuousGalerkinDiscretisationPointWiseRiemannSolver.DiscontinuousGalerkinDiscretisationPointWiseRiemannSolver._custom_plot_actionset, solvers.api.CollocatedDLinearDiscretisationWithPointJacobi.CollocatedDLinearDiscretisationWithPointJacobi._enable_plotting, solvers.api.ContinuousGalerkinDiscretisationGaussLobattoWithBlockJacobi.ContinuousGalerkinDiscretisationGaussLobattoWithBlockJacobi._enable_plotting, solvers.api.DiscontinuousGalerkinDiscretisationPointWiseRiemannSolver.DiscontinuousGalerkinDiscretisationPointWiseRiemannSolver._enable_plotting, solvers.api.CollocatedDLinearDiscretisationWithPointJacobi.CollocatedDLinearDiscretisationWithPointJacobi._plot_predicate, solvers.api.CollocatedMG.CollocatedMG._plot_predicate, solvers.api.ContinuousGalerkinDiscretisationGaussLobattoWithBlockJacobi.ContinuousGalerkinDiscretisationGaussLobattoWithBlockJacobi._plot_predicate, and solvers.api.DiscontinuousGalerkinDiscretisationPointWiseRiemannSolver.DiscontinuousGalerkinDiscretisationPointWiseRiemannSolver._plot_predicate.
| solvers.api.CollocatedDLinearDiscretisationWithPointJacobi.CollocatedDLinearDiscretisationWithPointJacobi.add_to_solve | ( | self, | |
| observer | |||
| ) |
Definition at line 246 of file CollocatedDLinearDiscretisationWithPointJacobi.py.
References solvers.api.CollocatedDLinearDiscretisationWithPointJacobi.CollocatedDLinearDiscretisationWithPointJacobi._basic_descend_order, solvers.api.CollocatedMG.CollocatedMG._basic_descend_order, and solvers.api.ContinuousGalerkinDiscretisationGaussLobattoWithBlockJacobi.ContinuousGalerkinDiscretisationGaussLobattoWithBlockJacobi._basic_descend_order.
| solvers.api.CollocatedDLinearDiscretisationWithPointJacobi.CollocatedDLinearDiscretisationWithPointJacobi.add_use_statements | ( | self, | |
| observer | |||
| ) |
This routine should still be called even if overwritten in child class.
Reimplemented from solvers.api.Solver.Solver.
Definition at line 191 of file CollocatedDLinearDiscretisationWithPointJacobi.py.
Referenced by solvers.api.CollocatedDLinearDiscretisationWithPointJacobi.CollocatedDLinearDiscretisationWithPointJacobi.add_use_statements().


| solvers.api.CollocatedDLinearDiscretisationWithPointJacobi.CollocatedDLinearDiscretisationWithPointJacobi.get_vertex_merge_method | ( | self | ) |
Definition at line 331 of file CollocatedDLinearDiscretisationWithPointJacobi.py.
References solvers.api.Solver.Solver.typename(), and api.solvers.Solver.Solver.typename().
Referenced by solvers.api.CollocatedDLinearDiscretisationWithPointJacobi.CollocatedDLinearDiscretisationWithPointJacobi.__init__().


|
protected |
Definition at line 289 of file CollocatedDLinearDiscretisationWithPointJacobi.py.
Referenced by solvers.api.Solver.Solver.add_to_abstract_solver().
|
protected |
Definition at line 290 of file CollocatedDLinearDiscretisationWithPointJacobi.py.
Referenced by solvers.api.Solver.Solver.add_to_abstract_solver().
|
protected |
Definition at line 174 of file CollocatedDLinearDiscretisationWithPointJacobi.py.
Referenced by solvers.api.CollocatedDLinearDiscretisationWithPointJacobi.CollocatedDLinearDiscretisationWithPointJacobi.add_to_solve(), solvers.api.CollocatedMG.CollocatedMG.add_to_solve(), solvers.api.CollocatedMGSingleThreaded.CollocatedMGSingleThreaded.add_to_solve(), and solvers.api.ContinuousGalerkinDiscretisationGaussLobattoWithBlockJacobi.ContinuousGalerkinDiscretisationGaussLobattoWithBlockJacobi.add_to_solve().
|
protected |
Definition at line 181 of file CollocatedDLinearDiscretisationWithPointJacobi.py.
|
protected |
Definition at line 177 of file CollocatedDLinearDiscretisationWithPointJacobi.py.
Referenced by solvers.api.CollocatedDLinearDiscretisationWithPointJacobi.CollocatedDLinearDiscretisationWithPointJacobi.add_to_init_solution(), and solvers.api.ContinuousGalerkinDiscretisationGaussLobattoWithBlockJacobi.ContinuousGalerkinDiscretisationGaussLobattoWithBlockJacobi.add_to_init_solution().
|
protected |
Definition at line 180 of file CollocatedDLinearDiscretisationWithPointJacobi.py.
|
protected |
Definition at line 178 of file CollocatedDLinearDiscretisationWithPointJacobi.py.
Referenced by solvers.api.CollocatedDLinearDiscretisationWithPointJacobi.CollocatedDLinearDiscretisationWithPointJacobi.add_to_plot(), and solvers.api.ContinuousGalerkinDiscretisationGaussLobattoWithBlockJacobi.ContinuousGalerkinDiscretisationGaussLobattoWithBlockJacobi.add_to_plot().
|
protected |
Definition at line 183 of file CollocatedDLinearDiscretisationWithPointJacobi.py.
Referenced by solvers.api.CollocatedDLinearDiscretisationWithPointJacobi.CollocatedDLinearDiscretisationWithPointJacobi.add_to_plot(), and solvers.api.ContinuousGalerkinDiscretisationGaussLobattoWithBlockJacobi.ContinuousGalerkinDiscretisationGaussLobattoWithBlockJacobi.add_to_plot().
|
protected |
Definition at line 167 of file CollocatedDLinearDiscretisationWithPointJacobi.py.
|
protected |
Definition at line 168 of file CollocatedDLinearDiscretisationWithPointJacobi.py.
|
protected |
Definition at line 170 of file CollocatedDLinearDiscretisationWithPointJacobi.py.
|
protected |
Definition at line 171 of file CollocatedDLinearDiscretisationWithPointJacobi.py.
|
protected |
Definition at line 184 of file CollocatedDLinearDiscretisationWithPointJacobi.py.
Referenced by solvers.api.CollocatedDLinearDiscretisationWithPointJacobi.CollocatedDLinearDiscretisationWithPointJacobi.add_to_plot(), solvers.api.CollocatedMG.CollocatedMG.add_to_plot(), and solvers.api.ContinuousGalerkinDiscretisationGaussLobattoWithBlockJacobi.ContinuousGalerkinDiscretisationGaussLobattoWithBlockJacobi.add_to_plot().
|
protected |
Definition at line 175 of file CollocatedDLinearDiscretisationWithPointJacobi.py.
|
protected |
Definition at line 172 of file CollocatedDLinearDiscretisationWithPointJacobi.py.
|
protected |
Definition at line 165 of file CollocatedDLinearDiscretisationWithPointJacobi.py.
| solvers.api.CollocatedDLinearDiscretisationWithPointJacobi.CollocatedDLinearDiscretisationWithPointJacobi.max_h |
| solvers.api.CollocatedDLinearDiscretisationWithPointJacobi.CollocatedDLinearDiscretisationWithPointJacobi.min_h |