Peano
Loading...
Searching...
No Matches
CollocatedMGSingleThreaded.py
Go to the documentation of this file.
2import peano4.api
3import jinja2
5import dastgen2
6import os
7
8from .Solver import Solver
9from .CollocatedMG import CollocatedMG
10from .actionsets.CollocatedMGSolver.InitDofs import InitDofsCollocatedMG
11from .actionsets.CollocatedMGSolver.ResetAndUpdateResidual import ResetAndUpdateResidual
12from .actionsets.CollocatedMGSolver.Restriction import Restriction
13from .actionsets.CollocatedMGSolver.Prolongation import Prolongation
14from .actionsets.PlotVertexDataInPeanoBlockFormat import PlotVertexDataInPeanoBlockFormat
15
16from .actionsets.CollocatedMGSingleThreaded.UpdateSolution import UpdateSolution
17
18from abc import abstractmethod
19from peano4.api.solversteps.ActionSet import ActionSet
20
22 """!
23 We can just inherit everything, except we must rewrite the
24 add_to_solve method.
25
26 The important difference here is that we update the residual and the solution all in the same
27 sweep, meaning that we don't need any complicated logic in the abstract solver class.
28
29 See the documentation of solvers.api.CollocatedMG.CollocatedMG
30
31 """
32 def __init__(self,
33 name,
34 unknowns_per_vertex,
35 dimensions,
36 min_h,
37 max_h,
38 local_assembly_matrix,
39 local_assembly_matrix_scaling,
40 mass_matrix,
41 mass_matrix_scaling,
42 correction_matrix,
43 correction_matrix_scaling,
44 solver_tolerance,
45 pre_smoothing_steps,
46 post_smoothing_steps,
47 descend_order,
48 restriction_matrix,
49 prolongation_matrix,
50 coarsest_level=0,
51 smoother_relaxation = 0.6,
52 plot_predicate="true"
53 ):
54 super( CollocatedMGSingleThreaded, self ).__init__(
55 name,
56 unknowns_per_vertex,
57 dimensions,
58 min_h,
59 max_h,
60 local_assembly_matrix,
61 local_assembly_matrix_scaling,
62 mass_matrix,
63 mass_matrix_scaling,
64 correction_matrix,
65 correction_matrix_scaling,
66 solver_tolerance,
67 pre_smoothing_steps,
68 post_smoothing_steps,
69 descend_order,
70 restriction_matrix,
71 prolongation_matrix,
72 coarsest_level,
73 smoother_relaxation,
74 plot_predicate
75 )
76
77 def add_to_solve(self, observer):
78 invocation_order = observer.highest_descend_invocation_order() + self._basic_descend_order + 1
79 observer.add_action_set( Prolongation(self,descend_invocation_order=invocation_order+0) )
80 observer.add_action_set( ResetAndUpdateResidual(self,descend_invocation_order=invocation_order+1) )
81 observer.add_action_set( UpdateSolution(self,descend_invocation_order=invocation_order+2) )
82 observer.add_action_set( Restriction(self,descend_invocation_order=invocation_order+3) )
83
85 return ""
Action set (reactions to events)
Definition ActionSet.py:6
We can just inherit everything, except we must rewrite the add_to_solve method.
__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")
A full mathematical description will follow later, but for now we outline some algorithmic steps here...
This should be identical to the original, with the only difference that we do stuff when we touch the...
This also should be called before the solver stuff.
This class comes last in the pecking order so that we restrict the residual after we've finished comp...
Definition Restriction.py:6