24 template <
class Level>
26 const std::string& reuse)
32 , rebalance_m(rebalance)
33 , setupTimer_m(
IpplTimings::getTimer(
"AMR MG bsolver setup"))
44 template <
class Level>
46 const Teuchos::RCP<mv_t>& b)
49 Teuchos::RCP<xmv_t> xx = MueLu::TpetraMultiVector_To_XpetraMultiVector(x);
50 Teuchos::RCP<xmv_t> xb = MueLu::TpetraMultiVector_To_XpetraMultiVector(b);
54 hierarchy_mp->Iterate(*xb, *xx, nSweeps_m,
true, 0);
57 x->assign(*util_t::MV2NonConstTpetraMV2(*xx));
61 template <
class Level>
67 A_mp = MueLu::TpetraCrs_To_XpetraMatrix<scalar_t, lo_t, go_t, node_t>(A);
68 A_mp->SetFixedBlockSize(1);
70 Teuchos::RCP<mv_t> coords_p = Teuchos::rcp(
74 const scalar_t* domain = level_p->geom.ProbLo();
75 const scalar_t* dx = level_p->cellSize();
76 for (amrex::MFIter mfi(level_p->grids, level_p->dmap,
true);
80 const lo_t* lo = tbx.loVect();
81 const lo_t* hi = tbx.hiVect();
83 for (
lo_t i = lo[0]; i <= hi[0]; ++i) {
84 for (
lo_t j = lo[1]; j <= hi[1]; ++j) {
85 #if AMREX_SPACEDIM == 3
86 for (
lo_t k = lo[2]; k <= hi[2]; ++k) {
89 go_t gidx = level_p->serialize(iv);
91 coords_p->replaceGlobalValue(gidx, 0, domain[0] + (0.5 + i) * dx[0]);
92 coords_p->replaceGlobalValue(gidx, 1, domain[1] + (0.5 + j) * dx[1]);
93 #if AMREX_SPACEDIM == 3
94 coords_p->replaceGlobalValue(gidx, 2, domain[2] + (0.5 + k) * dx[2]);
101 Teuchos::RCP<xmv_t> coordinates = MueLu::TpetraMultiVector_To_XpetraMultiVector(coords_p);
103 Teuchos::RCP<mv_t> nullspace = Teuchos::rcp(
new mv_t(A->getRowMap(), 1));
104 Teuchos::RCP<xmv_t> xnullspace = MueLu::TpetraMultiVector_To_XpetraMultiVector(nullspace);
105 xnullspace->putScalar(1.0);
106 hierarchy_mp->GetLevel(0)->Set(
"Nullspace", xnullspace);
107 hierarchy_mp->GetLevel(0)->Set(
"Coordinates", coordinates);
108 hierarchy_mp->setDefaultVerbLevel(Teuchos::VERB_HIGH);
109 hierarchy_mp->IsPreconditioner(
false);
110 hierarchy_mp->GetLevel(0)->Set(
"A", A_mp);
113 Teuchos::RCP<level_t> finest_p = hierarchy_mp->GetLevel(0);
114 finest_p->Set(
"A", A_mp);
116 factory_mp->SetupHierarchy(*hierarchy_mp);
118 this->isInitialized_m =
true;
124 template <
class Level>
130 template <
class Level>
134 std::map<std::string, std::string> map;
135 map[
"NONE"] =
"none";
139 map[
"FULL"] =
"full";
141 auto muelu = map.find(reuse);
143 if ( muelu == map.end() )
144 throw OpalException(
"MueLuBottomSolver::convertToMueLuReuseOption()",
145 "No MueLu reuse option '" + reuse +
"'.");
147 return muelu->second;
151 template <
class Level>
153 mueluList_m.set(
"problem: type",
"Poisson-3D");
154 mueluList_m.set(
"verbosity",
"low");
155 mueluList_m.set(
"number of equations", 1);
156 mueluList_m.set(
"max levels", 8);
157 mueluList_m.set(
"cycle type",
"V");
159 mueluList_m.set(
"coarse: max size", 200);
160 mueluList_m.set(
"multigrid algorithm",
"sa");
161 mueluList_m.set(
"sa: damping factor", 1.33);
162 mueluList_m.set(
"sa: use filtered matrix",
true);
163 mueluList_m.set(
"filtered matrix: reuse eigenvalue",
false);
165 mueluList_m.set(
"repartition: enable", rebalance_m);
166 mueluList_m.set(
"repartition: rebalance P and R", rebalance_m);
167 mueluList_m.set(
"repartition: partitioner",
"zoltan2");
168 mueluList_m.set(
"repartition: min rows per proc", 800);
169 mueluList_m.set(
"repartition: start level", 2);
171 Teuchos::ParameterList reparms;
172 reparms.set(
"algorithm",
"multijagged");
175 mueluList_m.set(
"repartition: params", reparms);
177 mueluList_m.set(
"smoother: type",
"CHEBYSHEV");
178 mueluList_m.set(
"smoother: pre or post",
"both");
179 Teuchos::ParameterList smparms;
180 smparms.set(
"chebyshev: degree", 3);
181 smparms.set(
"chebyshev: assume matrix does not change",
false);
182 smparms.set(
"chebyshev: zero starting solution",
true);
183 mueluList_m.set(
"smoother: params", smparms);
186 mueluList_m.set(
"coarse: type",
"RELAXATION");
187 Teuchos::ParameterList cparms;
188 cparms.set(
"relaxation: type",
"Gauss-Seidel");
189 cparms.set(
"relaxation: sweeps", nSweeps_m);
190 cparms.set(
"relaxation: zero starting solution",
true);
191 cparms.set(
"relaxation: use l1",
true);
192 cparms.set(
"relaxation: l1 eta", 1.5);
193 mueluList_m.set(
"coarse: params", cparms);
197 mueluList_m.set(
"aggregation: type",
"uncoupled");
198 mueluList_m.set(
"aggregation: min agg size", 3);
199 mueluList_m.set(
"aggregation: max agg size", 27);
201 mueluList_m.set(
"transpose: use implicit",
false);
203 mueluList_m.set(
"reuse: type", reuse);
Some AMR types used a lot.
Tpetra::MultiVector< scalar_t, local_ordinal_t, global_ordinal_t, node_t > multivector_t
void setOperator(const Teuchos::RCP< matrix_t > &A, Level *level_p=nullptr)
MueLu::ParameterListInterpreter< scalar_t, lo_t, go_t, node_t > pListInterpreter_t
std::size_t getNumIters()
amr::global_ordinal_t go_t
MueLuBottomSolver(const bool &rebalance, const std::string &reuse)
void solve(const Teuchos::RCP< mv_t > &x, const Teuchos::RCP< mv_t > &b)
amr::AmrIntVect_t AmrIntVect_t
Teuchos::RCP< manager_t > factory_mp
sets up hierarchy
static std::string convertToMueLuReuseOption(const std::string &reuse)
void initMueLuList_m(const std::string &reuse)
Teuchos::ParameterList mueluList_m
amr::local_ordinal_t lo_t
Teuchos::RCP< hierarchy_t > hierarchy_mp
manages the multigrid hierarchy
The base class for all OPAL exceptions.
static void stopTimer(TimerRef t)
static void startTimer(TimerRef t)