11 const std::string& reuse)
17 , rebalance_m(rebalance)
18 , setupTimer_m(
IpplTimings::getTimer(
"AMR MG bsolver setup"))
29 template <
class Level>
31 const Teuchos::RCP<mv_t>& b)
34 Teuchos::RCP<xmv_t> xx = MueLu::TpetraMultiVector_To_XpetraMultiVector(x);
35 Teuchos::RCP<xmv_t> xb = MueLu::TpetraMultiVector_To_XpetraMultiVector(b);
39 hierarchy_mp->Iterate(*xb, *xx, nSweeps_m,
true, 0);
42 x->assign(*util_t::MV2NonConstTpetraMV2(*xx));
46 template <
class Level>
52 A_mp = MueLu::TpetraCrs_To_XpetraMatrix<scalar_t, lo_t, go_t, node_t>(A);
53 A_mp->SetFixedBlockSize(1);
55 Teuchos::RCP<mv_t> coords_p = Teuchos::rcp(
59 const scalar_t* domain = level_p->geom.ProbLo();
60 const scalar_t* dx = level_p->cellSize();
61 for (amrex::MFIter mfi(level_p->grids, level_p->dmap,
true);
65 const lo_t* lo = tbx.loVect();
66 const lo_t* hi = tbx.hiVect();
68 for (
lo_t i = lo[0]; i <= hi[0]; ++i) {
69 for (
lo_t j = lo[1]; j <= hi[1]; ++j) {
70 #if AMREX_SPACEDIM == 3
71 for (
lo_t k = lo[2]; k <= hi[2]; ++k) {
74 go_t gidx = level_p->serialize(iv);
76 coords_p->replaceGlobalValue(gidx, 0, domain[0] + (0.5 + i) * dx[0]);
77 coords_p->replaceGlobalValue(gidx, 1, domain[1] + (0.5 + j) * dx[1]);
78 #if AMREX_SPACEDIM == 3
79 coords_p->replaceGlobalValue(gidx, 2, domain[2] + (0.5 + k) * dx[2]);
86 Teuchos::RCP<xmv_t> coordinates = MueLu::TpetraMultiVector_To_XpetraMultiVector(coords_p);
88 Teuchos::RCP<mv_t> nullspace = Teuchos::rcp(
new mv_t(A->getRowMap(), 1));
89 Teuchos::RCP<xmv_t> xnullspace = MueLu::TpetraMultiVector_To_XpetraMultiVector(nullspace);
90 xnullspace->putScalar(1.0);
91 hierarchy_mp->GetLevel(0)->Set(
"Nullspace", xnullspace);
92 hierarchy_mp->GetLevel(0)->Set(
"Coordinates", coordinates);
93 hierarchy_mp->setDefaultVerbLevel(Teuchos::VERB_HIGH);
94 hierarchy_mp->IsPreconditioner(
false);
95 hierarchy_mp->GetLevel(0)->Set(
"A", A_mp);
98 Teuchos::RCP<level_t> finest_p = hierarchy_mp->GetLevel(0);
99 finest_p->Set(
"A", A_mp);
101 factory_mp->SetupHierarchy(*hierarchy_mp);
103 this->isInitialized_m =
true;
109 template <
class Level>
115 template <
class Level>
119 std::map<std::string, std::string> map;
120 map[
"NONE"] =
"none";
124 map[
"FULL"] =
"full";
128 if ( muelu == map.end() )
129 throw OpalException(
"MueLuBottomSolver::convertToMueLuReuseOption()",
130 "No MueLu reuse option '" + reuse +
"'.");
132 return muelu->second;
136 template <
class Level>
138 mueluList_m.set(
"problem: type",
"Poisson-3D");
139 mueluList_m.set(
"verbosity",
"low");
140 mueluList_m.set(
"number of equations", 1);
141 mueluList_m.set(
"max levels", 8);
142 mueluList_m.set(
"cycle type",
"V");
144 mueluList_m.set(
"coarse: max size", 200);
145 mueluList_m.set(
"multigrid algorithm",
"sa");
146 mueluList_m.set(
"sa: damping factor", 1.33);
147 mueluList_m.set(
"sa: use filtered matrix",
true);
148 mueluList_m.set(
"filtered matrix: reuse eigenvalue",
false);
150 mueluList_m.set(
"repartition: enable", rebalance_m);
151 mueluList_m.set(
"repartition: rebalance P and R", rebalance_m);
152 mueluList_m.set(
"repartition: partitioner",
"zoltan2");
153 mueluList_m.set(
"repartition: min rows per proc", 800);
154 mueluList_m.set(
"repartition: start level", 2);
156 Teuchos::ParameterList reparms;
157 reparms.set(
"algorithm",
"multijagged");
160 mueluList_m.set(
"repartition: params", reparms);
162 mueluList_m.set(
"smoother: type",
"CHEBYSHEV");
163 mueluList_m.set(
"smoother: pre or post",
"both");
164 Teuchos::ParameterList smparms;
165 smparms.set(
"chebyshev: degree", 3);
166 smparms.set(
"chebyshev: assume matrix does not change",
false);
167 smparms.set(
"chebyshev: zero starting solution",
true);
168 mueluList_m.set(
"smoother: params", smparms);
171 mueluList_m.set(
"coarse: type",
"RELAXATION");
172 Teuchos::ParameterList cparms;
173 cparms.set(
"relaxation: type",
"Gauss-Seidel");
174 cparms.set(
"relaxation: sweeps", nSweeps_m);
175 cparms.set(
"relaxation: zero starting solution",
true);
176 cparms.set(
"relaxation: use l1",
true);
177 cparms.set(
"relaxation: l1 eta", 1.5);
178 mueluList_m.set(
"coarse: params", cparms);
182 mueluList_m.set(
"aggregation: type",
"uncoupled");
183 mueluList_m.set(
"aggregation: min agg size", 3);
184 mueluList_m.set(
"aggregation: max agg size", 27);
186 mueluList_m.set(
"transpose: use implicit",
false);
188 mueluList_m.set(
"reuse: type", reuse);
void solve(const Teuchos::RCP< mv_t > &x, const Teuchos::RCP< mv_t > &b)
void setOperator(const Teuchos::RCP< matrix_t > &A, Level *level_p=nullptr)
MueLuBottomSolver(const bool &rebalance, const std::string &reuse)
The base class for all OPAL exceptions.
amr::AmrIntVect_t AmrIntVect_t
std::string toUpper(const std::string &str)
void initMueLuList_m(const std::string &reuse)
Teuchos::RCP< hierarchy_t > hierarchy_mp
manages the multigrid hierarchy
Abstract base class for all base level solvers.
static std::string convertToMueLuReuseOption(const std::string &reuse)
std::size_t getNumIters()
static void startTimer(TimerRef t)
Teuchos::RCP< manager_t > factory_mp
sets up hierarchy
MueLu::ParameterListInterpreter< scalar_t, lo_t, go_t, node_t > pListInterpreter_t
Tpetra::MultiVector< scalar_t, local_ordinal_t, global_ordinal_t, node_t > multivector_t
amr::global_ordinal_t go_t
Teuchos::ParameterList mueluList_m
static void stopTimer(TimerRef t)
amr::local_ordinal_t lo_t