|
Peano
|
A full mathematical description will follow later, but for now we outline some algorithmic steps here. 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, correction_matrix, correction_matrix_scaling, solver_tolerance, pre_smoothing_steps, post_smoothing_steps, descend_order, restriction_matrix, prolongation_matrix, coarsest_level=0, smoother_relaxation=0.6, plot_predicate="true") | |
| 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_create_grid (self, observer) | |
| add_to_init_solution (self, observer) | |
| Solution initialisation. | |
| add_to_solve (self, observer) | |
| add_to_plot (self, observer) | |
| add_implementation_files_to_project (self, namespace, output, subdirectory="") | |
| 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 | |
A full mathematical description will follow later, but for now we outline some algorithmic steps here.
We borrow heavily from the original Collocated Solver. See matrixfree_collocated_solver.
We intialise by setting the values for u and the RHS in implementation files. So far this has been tested with the standard poisson set up ( \( 8\pi^2 sin(x)sin(y) \) on the rhs, with zeroes in the initial guess). We do this only on the finest level, and every other level receives 0.
We enumerate each level according to its coarseness. Ie the top level is marked as 0, and we increase this number as we refine.
Every time we run a sweep on the finest level, we update the global residuals. We terminate when the solution on the finest level conforms to the given stopping criterion.
We have 4 fundamental action sets, which we discuss here in order of invocation. Each of their operations is guarded by a bool function that lives in the abstract solver class.
This is where we take the residual and diag, and set the solution on vertices to \( u + du = u + \omega / (diag * residual) \). We want to avoid zero-divsion, as reset the diagonal every sweep, meaning we need to wait until the second pre/post-smoothing sweep to update the solution. We also need to make sure we finalise the solution updates before we restrict/prolongate as well. updateSolution() in the abstract solver class handles all of this behaviour.
To make sure the solver works in multiple trees, we tell the vertices that lie on parallel domain boundaries to share residual and diagonal with each other, to make sure contributions from neighbouring cells are registered properly. See get_vertex_merge_method in this class.
This action set also makes sure that the RHS is correctly consolidated - we write our restrictions into the vertex field NewRhs. When we touch a vertex for the first time after restriction, we make sure that the rhs is set to the value of what we restricted (ie the newrhs).
Ditto for delta after prolongation.
When we touch a vertex on the coarse level, we set the delta field to be \( U - OldU \). When we touch a vertex on the fine level, we prolongate the coarse delta into the fine level delta. On the next sweep, we update the fine solution to be \( u + delta \).
The abstract solver just needs to check if its smoothing state is set to prolongation, so the logic is much simpler.
When we touch the vertex for the first time, we reset residual and diag to 0, or apply boundary conditions. When we touch the cell for the first time, we perform the jacobi iteration and write the residual into the \( 2^D \) adjacent vertices.
The abstract solver class does this if updateResidual() returns true, which it does when:
When we touch a coarse vertex for the first time, we reset everything to 0, i.e. rhs and solution. When we touch a fine vertex for the first time, we hand over to the mghype::matrixfree::solvers::cgmultigrid::restrictToNextLevel which writes the fine level residual into the newRhs of the level above.
You can now specify the number of levels that you want to use in the solver itself. The finest level is set by the refinement of the mesh and is currently determined at runtime when the mesh is descended for the first time. If we find that the finest level isn't at least one larger than the coarest level, we throw a std::runtime_error.
Definition at line 22 of file CollocatedMG.py.
| solvers.api.CollocatedMG.CollocatedMG.__init__ | ( | self, | |
| name, | |||
| unknowns_per_vertex, | |||
| dimensions, | |||
| min_h, | |||
| max_h, | |||
| local_assembly_matrix, | |||
| local_assembly_matrix_scaling, | |||
| mass_matrix, | |||
| mass_matrix_scaling, | |||
| correction_matrix, | |||
| correction_matrix_scaling, | |||
| solver_tolerance, | |||
| pre_smoothing_steps, | |||
| post_smoothing_steps, | |||
| descend_order, | |||
| restriction_matrix, | |||
| prolongation_matrix, | |||
coarsest_level = 0, |
|||
smoother_relaxation = 0.6, |
|||
plot_predicate = "true" |
|||
| ) |
Reimplemented from solvers.api.Solver.Solver.
Reimplemented in solvers.api.CollocatedMGSingleThreaded.CollocatedMGSingleThreaded.
Definition at line 119 of file CollocatedMG.py.
References solvers.api.CollocatedMG.CollocatedMG.__init__().
Referenced by solvers.api.CollocatedMG.CollocatedMG.__init__().


| solvers.api.CollocatedMG.CollocatedMG.add_implementation_files_to_project | ( | self, | |
| namespace, | |||
| output, | |||
subdirectory = "" |
|||
| ) |
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 263 of file CollocatedMG.py.
References peano4.api.output.ActionSet.ActionSet.__class__, peano4.api.output.Jinja2TemplatedHeaderImplementationFilePair.Jinja2TemplatedHeaderImplementationFilePair.__class__, and peano4.api.output.TemplatedHeaderFile.TemplatedHeaderFile.__class__.
| solvers.api.CollocatedMG.CollocatedMG.add_to_create_grid | ( | self, | |
| observer | |||
| ) |
Definition at line 211 of file CollocatedMG.py.
| solvers.api.CollocatedMG.CollocatedMG.add_to_init_solution | ( | self, | |
| observer | |||
| ) |
Solution initialisation.
Definition at line 214 of file CollocatedMG.py.
| solvers.api.CollocatedMG.CollocatedMG.add_to_Peano4_datamodel | ( | self, | |
| datamodel, | |||
| verbose | |||
| ) |
Reimplemented from solvers.api.Solver.Solver.
Definition at line 205 of file CollocatedMG.py.
References solvers.api.CollocatedMG.CollocatedMG.add_to_Peano4_datamodel().
Referenced by solvers.api.CollocatedMG.CollocatedMG.add_to_Peano4_datamodel().


| solvers.api.CollocatedMG.CollocatedMG.add_to_plot | ( | self, | |
| observer | |||
| ) |
Definition at line 241 of file CollocatedMG.py.
References 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.CollocatedMG.CollocatedMG.add_to_solve | ( | self, | |
| observer | |||
| ) |
Reimplemented in solvers.api.CollocatedMGSingleThreaded.CollocatedMGSingleThreaded.
Definition at line 223 of file CollocatedMG.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.CollocatedMG.CollocatedMG.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 208 of file CollocatedMG.py.
References solvers.api.CollocatedMG.CollocatedMG.add_use_statements().
Referenced by solvers.api.CollocatedMG.CollocatedMG.add_use_statements().


| solvers.api.CollocatedMG.CollocatedMG.get_vertex_merge_method | ( | self | ) |
Reimplemented in solvers.api.CollocatedMGSingleThreaded.CollocatedMGSingleThreaded.
Definition at line 337 of file CollocatedMG.py.
References solvers.api.Solver.Solver.instance_name(), and api.solvers.Solver.Solver.instance_name().
Referenced by solvers.api.CollocatedDLinearDiscretisationWithPointJacobi.CollocatedDLinearDiscretisationWithPointJacobi.__init__().


|
protected |
Definition at line 200 of file CollocatedMG.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 154 of file CollocatedMG.py.
|
protected |
Definition at line 196 of file CollocatedMG.py.
|
protected |
Definition at line 197 of file CollocatedMG.py.
|
protected |
Definition at line 191 of file CollocatedMG.py.
|
protected |
Definition at line 192 of file CollocatedMG.py.
|
protected |
Definition at line 194 of file CollocatedMG.py.
|
protected |
Definition at line 195 of file CollocatedMG.py.
|
protected |
Definition at line 203 of file CollocatedMG.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 149 of file CollocatedMG.py.
|
protected |
Definition at line 148 of file CollocatedMG.py.
|
protected |
Definition at line 152 of file CollocatedMG.py.
|
protected |
Definition at line 151 of file CollocatedMG.py.
|
protected |
Definition at line 202 of file CollocatedMG.py.
|
protected |
Definition at line 198 of file CollocatedMG.py.
|
protected |
Definition at line 163 of file CollocatedMG.py.
| solvers.api.CollocatedMG.CollocatedMG.max_h |
Definition at line 212 of file CollocatedMG.py.
Referenced by solvers.api.Solver.Solver.__str__(), exaparty.api.particle.Particle.Particle.readme_descriptor(), and tarch.plotter.api.filters.ExtractMeshResolution.ExtractMeshResolution.render().
| solvers.api.CollocatedMG.CollocatedMG.min_h |
Definition at line 282 of file CollocatedMG.py.
Referenced by solvers.api.Solver.Solver.__str__(), exaparty.api.particle.Particle.Particle.readme_descriptor(), and tarch.plotter.api.filters.ExtractMeshResolution.ExtractMeshResolution.render().