26 const std::string& reuse)
32 , rebalance_m(rebalance)
33 , setupTimer_m(
IpplTimings::getTimer(
"AMR MG bsolver setup"))
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));
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);
112 Teuchos::RCP<level_t> finest_p = hierarchy_mp->GetLevel(0);
113 finest_p->Set(
"A", A_mp);
115 factory_mp->SetupHierarchy(*hierarchy_mp);
117 this->isInitialized_m =
true;
123template <
class Level>
129template <
class Level>
133 std::map<std::string, std::string> map;
134 map[
"NONE"] =
"none";
137 map[
"SYMBOLIC"] =
"S";
138 map[
"FULL"] =
"full";
140 auto muelu = map.find(reuse);
142 if ( muelu == map.end() )
143 throw OpalException(
"MueLuBottomSolver::convertToMueLuReuseOption()",
144 "No MueLu reuse option '" + reuse +
"'.");
146 return muelu->second;
150template <
class Level>
152 mueluList_m.set(
"problem: type",
"Poisson-3D");
153 mueluList_m.set(
"verbosity",
"low");
154 mueluList_m.set(
"number of equations", 1);
155 mueluList_m.set(
"max levels", 8);
156 mueluList_m.set(
"cycle type",
"V");
158 mueluList_m.set(
"coarse: max size", 200);
159 mueluList_m.set(
"multigrid algorithm",
"sa");
160 mueluList_m.set(
"sa: damping factor", 1.33);
161 mueluList_m.set(
"sa: use filtered matrix",
true);
162 mueluList_m.set(
"filtered matrix: reuse eigenvalue",
false);
164 mueluList_m.set(
"repartition: enable", rebalance_m);
165 mueluList_m.set(
"repartition: rebalance P and R", rebalance_m);
166 mueluList_m.set(
"repartition: partitioner",
"zoltan2");
167 mueluList_m.set(
"repartition: min rows per proc", 800);
168 mueluList_m.set(
"repartition: start level", 2);
170 Teuchos::ParameterList reparms;
171 reparms.set(
"algorithm",
"multijagged");
174 mueluList_m.set(
"repartition: params", reparms);
176 mueluList_m.set(
"smoother: type",
"CHEBYSHEV");
177 mueluList_m.set(
"smoother: pre or post",
"both");
178 Teuchos::ParameterList smparms;
179 smparms.set(
"chebyshev: degree", 3);
180 smparms.set(
"chebyshev: assume matrix does not change",
false);
181 smparms.set(
"chebyshev: zero starting solution",
true);
182 mueluList_m.set(
"smoother: params", smparms);
184 mueluList_m.set(
"coarse: type",
"RELAXATION");
185 Teuchos::ParameterList cparms;
186 cparms.set(
"relaxation: type",
"Gauss-Seidel");
187 cparms.set(
"relaxation: sweeps", nSweeps_m);
188 cparms.set(
"relaxation: zero starting solution",
true);
189 cparms.set(
"relaxation: use l1",
true);
190 cparms.set(
"relaxation: l1 eta", 1.5);
191 mueluList_m.set(
"coarse: params", cparms);
195 mueluList_m.set(
"aggregation: type",
"uncoupled");
196 mueluList_m.set(
"aggregation: min agg size", 3);
197 mueluList_m.set(
"aggregation: max agg size", 27);
199 mueluList_m.set(
"transpose: use implicit",
false);
201 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)