solution[level].reinit(system_size);
defect[level].reinit(system_size);
+ t[level].reinit(system_size);
};
// traverse the grid top-down
};
};
};
-
// for that part of the level
// which is further refined:
// get the defect by
// restriction of the defect on
// one level higher
if (static_cast<unsigned int>(level) < maxlevel)
- transfer->restrict_and_add (level+1, defect[level], defect[level+1]);
+ {
+ transfer->restrict_and_add (level+1, defect[level], defect[level+1]);
+ }
};
};
minlevel(minlevel),
defect(minlevel,maxlevel),
solution(minlevel,maxlevel),
+ t(minlevel,maxlevel),
transfer(&transfer)
{
Assert(minlevel <= maxlevel,
// smoothing of the residual by modifying s
pre_smooth.smooth(level, solution[level], defect[level]);
- // t = d-As
#ifdef MG_DEBUG
sprintf(name, "MG%d-pre",level);
print_vector(level, solution[level], name);
#endif
- t.reinit(solution[level].size());
- level_vmult(level, t, solution[level], defect[level]);
+ t[level] = 0.;
+
+ // t = -A*solution[level]
+ level_vmult(level, t[level], solution[level], defect[level]);
// make t rhs of lower level
// The non-refined parts of the
// coarse-level defect already contain
- // the global defect.
- transfer->restrict_and_add (level, defect[level-1], t);
+ // the global defect, the refined parts
+ // its restriction.
+ for (unsigned int l = level;l>minlevel;--l)
+ {
+ t[l-1] = 0.;
+ transfer->restrict_and_add (l, t[l-1], t[l]);
+ defect[l-1] += t[l-1];
+ }
// add additional DG contribution
- edge_vmult(level, defect[level-1], defect[level]);
+// edge_vmult(level, defect[level-1], defect[level]);
// do recursion
level_mgstep(level-1, pre_smooth, post_smooth, coarse_grid_solver);
// vector, since it has been
// resized in the recursive call to
// level_mgstep directly above
- t.reinit(solution[level].size());
+ t[level] = 0.;
// do coarse grid correction
- transfer->prolongate(level, t, solution[level-1]);
+ transfer->prolongate(level, t[level], solution[level-1]);
#ifdef MG_DEBUG
sprintf(name, "MG%d-cgc",level);
print_vector(level, t, name);
#endif
- solution[level] += t;
+ solution[level] += t[level];
// post-smoothing
-
post_smooth.smooth(level, solution[level], defect[level]);
#ifdef MG_DEBUG
DEAL:Q1::DoFs 25
DEAL:Q1::Levels: 3
DEAL:Q1:cg::Starting
-DEAL:Q1:cg::Convergence step 7
+DEAL:Q1:cg::Convergence step 5
DEAL:Q1::DoFs 81
DEAL:Q1::Levels: 4
DEAL:Q1:cg::Starting
-DEAL:Q1:cg::Convergence step 9
+DEAL:Q1:cg::Convergence step 6
DEAL:Q2::DoFs 25
DEAL:Q2::Levels: 2
DEAL:Q2:cg::Starting
-DEAL:Q2:cg::Convergence step 6
+DEAL:Q2:cg::Convergence step 5
DEAL:Q2::DoFs 81
DEAL:Q2::Levels: 3
DEAL:Q2:cg::Starting
-DEAL:Q2:cg::Convergence step 10
+DEAL:Q2:cg::Convergence step 7
DEAL:Q2::DoFs 289
DEAL:Q2::Levels: 4
DEAL:Q2:cg::Starting
-DEAL:Q2:cg::Convergence step 9
+DEAL:Q2:cg::Convergence step 7
DEAL:Q3::DoFs 49
DEAL:Q3::Levels: 2
DEAL:Q3:cg::Starting
-DEAL:Q3:cg::Convergence step 7
+DEAL:Q3:cg::Convergence step 8
DEAL:Q3::DoFs 169
DEAL:Q3::Levels: 3
DEAL:Q3:cg::Starting
-DEAL:Q3:cg::Convergence step 10
+DEAL:Q3:cg::Convergence step 7
DEAL:Q3::DoFs 625
DEAL:Q3::Levels: 4
DEAL:Q3:cg::Starting
-DEAL:Q3:cg::Convergence step 11
+DEAL:Q3:cg::Convergence step 7