]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
local discontinuous multigrid
authorguido <guido@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 23 Aug 2002 15:25:11 +0000 (15:25 +0000)
committerguido <guido@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 23 Aug 2002 15:25:11 +0000 (15:25 +0000)
git-svn-id: https://svn.dealii.org/trunk@6339 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/include/multigrid/multigrid.h
deal.II/deal.II/include/multigrid/multigrid.templates.h
deal.II/deal.II/source/multigrid/multigrid.cc

index ad3afd36436e5d79cac6103c7922466a1a105dcc..0ae4bdfa08d479e0c845efe73b24f6478f7f54fd 100644 (file)
@@ -122,6 +122,13 @@ class Multigrid : public Subscriptor
                                      */
     void vcycle();
 
+                                    /**
+                                     * Set additional matrices to
+                                     * correct residual computation
+                                     * at refinement edges.
+                                     */
+    void set_edge_matrices (const MGMatrixBase<VECTOR>& edge_down,
+                           const MGMatrixBase<VECTOR>& edge_up);
   private:
     
                                     /**
@@ -301,6 +308,37 @@ class PreconditionMG : public Subscriptor
 /* --------------------------- inline functions --------------------- */
 
 
+template <class VECTOR>
+template <int dim>
+Multigrid<VECTOR>::Multigrid (const MGDoFHandler<dim>& mg_dof_handler,
+                             const MGMatrixBase<VECTOR>& matrix,
+                             const MGCoarseGrid<VECTOR>& coarse,
+                             const MGTransfer<VECTOR>& transfer,
+                             const MGSmoother<VECTOR>& pre_smooth,
+                             const MGSmoother<VECTOR>& post_smooth,
+                             const unsigned int min_level,
+                             const unsigned int max_level)
+               :
+               minlevel(min_level),
+               maxlevel(std::min(mg_dof_handler.get_tria().n_levels()-1,
+                                 max_level)),
+               defect(minlevel,maxlevel),
+               solution(minlevel,maxlevel),
+               t(minlevel,maxlevel),
+               matrix(&matrix),
+               coarse(&coarse),
+               transfer(&transfer),
+               pre_smooth(&pre_smooth),
+               post_smooth(&post_smooth),
+               edge_down(0),
+               edge_up(0)
+{
+};
+
+
+/* --------------------------- inline functions --------------------- */
+
+
 template<int dim, class VECTOR, class TRANSFER>
 PreconditionMG<dim, VECTOR, TRANSFER>
 ::PreconditionMG(const MGDoFHandler<dim>&      mg_dof_handler,
index dbd9e42384e07b7379d8c41c648e4e7e41cb7037..b7681037fdf82de5efa0c2e5292202587a411a9c 100644 (file)
 
 #include <multigrid/multigrid.h>
 
-/* --------------------------- inline functions --------------------- */
-
-
 template <class VECTOR>
-template <int dim>
-Multigrid<VECTOR>::Multigrid (const MGDoFHandler<dim>& mg_dof_handler,
-                             const MGMatrixBase<VECTOR>& matrix,
-                             const MGCoarseGrid<VECTOR>& coarse,
-                             const MGTransfer<VECTOR>& transfer,
-                             const MGSmoother<VECTOR>& pre_smooth,
-                             const MGSmoother<VECTOR>& post_smooth,
-                             const unsigned int min_level,
-                             const unsigned int max_level)
-               :
-               minlevel(min_level),
-               maxlevel(std::min(mg_dof_handler.get_tria().n_levels()-1,
-                                 max_level)),
-               defect(minlevel,maxlevel),
-               solution(minlevel,maxlevel),
-               t(minlevel,maxlevel),
-               matrix(&matrix),
-               coarse(&coarse),
-               transfer(&transfer),
-               pre_smooth(&pre_smooth),
-               post_smooth(&post_smooth)
+void
+Multigrid<VECTOR>::set_edge_matrices (const MGMatrixBase<VECTOR>& down,
+                                     const MGMatrixBase<VECTOR>& up)
 {
-};
+  edge_down = &down;
+  edge_up = &up;
+}
+
+
 
 
 template <class VECTOR>
@@ -75,9 +58,8 @@ Multigrid<VECTOR>::level_mgstep(const unsigned int level)
   print_vector(level, solution[level], name);
 #endif
   
-                                  // t = -A*solution[level]
+                                  // t = A*solution[level]
   matrix->vmult(level, t[level], solution[level]);
-  t[level].scale(-1);
   
                                   // make t rhs of lower level
                                   // The non-refined parts of the
@@ -87,13 +69,14 @@ Multigrid<VECTOR>::level_mgstep(const unsigned int level)
   for (unsigned int l = level;l>minlevel;--l)
     {
       t[l-1] = 0.;
+      if (l==level && edge_down != 0)
+       {
+         edge_down->vmult(level, t[level-1], solution[level]);
+       }
       transfer->restrict_and_add (l, t[l-1], t[l]);
-      defect[l-1] += t[l-1];
+      defect[l-1] -= t[l-1];
     }
 
-                                  // add additional DG contribution
-//  edge_vmult(level, defect[level-1], defect[level]);
-  
                                   // do recursion
   level_mgstep(level-1);
 
@@ -113,6 +96,12 @@ Multigrid<VECTOR>::level_mgstep(const unsigned int level)
 #endif
 
   solution[level] += t[level];
+
+  if (edge_up != 0)
+    {
+      edge_up->Tvmult(level, t[level], solution[level-1]);
+      defect[level] -= t[level];
+    }
   
                                   // post-smoothing
   post_smooth->smooth(level, solution[level], defect[level]);
index 3247ac607423c032b08057f90f1cc9143b23605d..f745f54f655917c7eec21091c13b9684d41b18fd 100644 (file)
@@ -23,7 +23,7 @@
 #include <multigrid/mg_dof_accessor.h>
 #include <multigrid/mg_transfer.h>
 #include <multigrid/mg_dof_tools.h>
-
+#include <multigrid/multigrid.templates.h>
 
 /* ----------------------------- MGTransferPrebuilt ------------------------ */
 

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.