From: guido Date: Fri, 23 Aug 2002 15:25:11 +0000 (+0000) Subject: local discontinuous multigrid X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3a7c611b8e50365523be93e3a2e81a9240505915;p=dealii-svn.git local discontinuous multigrid git-svn-id: https://svn.dealii.org/trunk@6339 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/deal.II/include/multigrid/multigrid.h b/deal.II/deal.II/include/multigrid/multigrid.h index ad3afd3643..0ae4bdfa08 100644 --- a/deal.II/deal.II/include/multigrid/multigrid.h +++ b/deal.II/deal.II/include/multigrid/multigrid.h @@ -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& edge_down, + const MGMatrixBase& edge_up); private: /** @@ -301,6 +308,37 @@ class PreconditionMG : public Subscriptor /* --------------------------- inline functions --------------------- */ +template +template +Multigrid::Multigrid (const MGDoFHandler& mg_dof_handler, + const MGMatrixBase& matrix, + const MGCoarseGrid& coarse, + const MGTransfer& transfer, + const MGSmoother& pre_smooth, + const MGSmoother& 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 PreconditionMG ::PreconditionMG(const MGDoFHandler& mg_dof_handler, diff --git a/deal.II/deal.II/include/multigrid/multigrid.templates.h b/deal.II/deal.II/include/multigrid/multigrid.templates.h index dbd9e42384..b7681037fd 100644 --- a/deal.II/deal.II/include/multigrid/multigrid.templates.h +++ b/deal.II/deal.II/include/multigrid/multigrid.templates.h @@ -16,33 +16,16 @@ #include -/* --------------------------- inline functions --------------------- */ - - template -template -Multigrid::Multigrid (const MGDoFHandler& mg_dof_handler, - const MGMatrixBase& matrix, - const MGCoarseGrid& coarse, - const MGTransfer& transfer, - const MGSmoother& pre_smooth, - const MGSmoother& 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::set_edge_matrices (const MGMatrixBase& down, + const MGMatrixBase& up) { -}; + edge_down = &down; + edge_up = &up; +} + + template @@ -75,9 +58,8 @@ Multigrid::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::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::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]); diff --git a/deal.II/deal.II/source/multigrid/multigrid.cc b/deal.II/deal.II/source/multigrid/multigrid.cc index 3247ac6074..f745f54f65 100644 --- a/deal.II/deal.II/source/multigrid/multigrid.cc +++ b/deal.II/deal.II/source/multigrid/multigrid.cc @@ -23,7 +23,7 @@ #include #include #include - +#include /* ----------------------------- MGTransferPrebuilt ------------------------ */