98 list.set(
"multigrid algorithm",
"combine");
99 list.set(
"combine: numBlks",nBlks_);
102 std::string verbosity = list.get(
"verbosity",
"high");
105 arrayOfParamLists_.resize(nBlks_);
106 for (
int i = 0 ; i < nBlks_; i++) {
107 std::string listName =
"subblockList" + Teuchos::toString(i);
108 if(list.isSublist(listName)) {
109 arrayOfParamLists_[i] = Teuchos::rcpFromRef(list.sublist(listName));
114 arrayOfParamLists_[i]->set(
"verbosity",arrayOfParamLists_[i]->get(
"verbosity",verbosity));
115 arrayOfParamLists_[i]->set(
"smoother: pre or post",
"none");
116 arrayOfParamLists_[i]->set(
"smoother: type",
"none");
120#if !defined(HAVE_MUELU_KOKKOS_REFACTOR)
123# ifdef HAVE_MUELU_SERIAL
124 if (
typeid(
Node).name() ==
typeid(Kokkos::Compat::KokkosSerialWrapperNode).name())
127# ifdef HAVE_MUELU_OPENMP
128 if (
typeid(
Node).name() ==
typeid(Kokkos::Compat::KokkosOpenMPWrapperNode).name())
131# ifdef HAVE_MUELU_CUDA
132 if (
typeid(
Node).name() ==
typeid(Kokkos::Compat::KokkosCudaWrapperNode).name())
135 useKokkos_ = list.get(
"use kokkos refactor",useKokkos_);
138 paramListMultiphysics_ = Teuchos::rcpFromRef(list);
155 std::string timerLabel;
157 timerLabel =
"MueLu MultiPhys: compute (reuse)";
159 timerLabel =
"MueLu MultiPhys: compute";
160 RCP<Teuchos::TimeMonitor> tmCompute = getTimer(timerLabel);
165 for (
int iii = 0; iii < nBlks_; iii++) {
166 arrayOfParamLists_[iii]->sublist(
"user data").set(
"Coordinates",arrayOfCoords_[iii]);
168 bool wantToRepartition =
false;
169 if (paramListMultiphysics_->isParameter(
"repartition: enable"))
170 wantToRepartition = paramListMultiphysics_->get<
bool>(
"repartition: enable");
172 arrayOfParamLists_[iii]->set(
"repartition: enable",wantToRepartition);
173 arrayOfParamLists_[iii]->set(
"repartition: rebalance P and R",
true);
174 arrayOfParamLists_[iii]->set(
"repartition: explicit via new copy rebalance P and R",
true);
176 if (paramListMultiphysics_->isParameter(
"repartition: use subcommunicators"))
177 arrayOfParamLists_[iii]->set(
"repartition: use subcommunicators", paramListMultiphysics_->isParameter(
"repartition: use subcommunicators"));
179 arrayOfParamLists_[iii]->set(
"repartition: use subcommunicators",
true);
184 paramListMultiphysics_->set<
bool>(
"repartition: enable",
false);
188 for (
int i = 0; i < nBlks_; i++) {
189 std::string operatorLabel =
"MultiPhys (" + Teuchos::toString(i) +
"," + Teuchos::toString(i) +
")"; arrayOfAuxMatrices_[i]->setObjectLabel(operatorLabel);
191 LO tempNlevels = arrayOfHierarchies_[i]->GetGlobalNumLevels();
192 if (tempNlevels < maxLevels) maxLevels = tempNlevels;
195 hierarchyMultiphysics_ = rcp(
new Hierarchy(
"Combo"));
196 for (LO i = 0; i < maxLevels; i++) {
197 hierarchyMultiphysics_->AddNewLevel();
199 for (
int i = 0; i < nBlks_; i++) {
200 std::string subblkName =
"Psubblock" + Teuchos::toString(i);
203 paramListMultiphysics_->set(
"coarse: max size",1);
204 paramListMultiphysics_->set(
"max levels",maxLevels);
206 AmatMultiphysics_->setObjectLabel(
"A: block " + Teuchos::toString(nBlks_) +
" x " + Teuchos::toString(nBlks_) +
"multiphysics matrix");
210 Teuchos::ParameterList nonSerialListMultiphysics, processedListMultiphysics;
215 Teuchos::ParameterList stripped;
216 for (ParameterList::ConstIterator inListEntry = processedListMultiphysics.begin(); inListEntry != processedListMultiphysics.end(); inListEntry++) {
217 const std::string& levelName = inListEntry->first;
218 if (levelName.find(
"subblockList") != 0) stripped.setEntry(inListEntry->first, inListEntry->second);
222 hierarchyMultiphysics_->setlib(AmatMultiphysics_->getDomainMap()->lib());
223 hierarchyMultiphysics_->SetProcRankVerbose(AmatMultiphysics_->getDomainMap()->getComm()->getRank());
226 hierarchyMultiphysics_->GetLevel(0)->Set(
"A", AmatMultiphysics_);
231 mueLuFactory->SetupHierarchy(*hierarchyMultiphysics_);
283 initialize(
const Teuchos::RCP<Matrix> & AmatMultiPhysics,
284 const Teuchos::ArrayRCP<RCP<Matrix>> arrayOfAuxMatrices,
285 const Teuchos::ArrayRCP<Teuchos::RCP<MultiVector>> arrayOfNullspaces,
286 const Teuchos::ArrayRCP<Teuchos::RCP<RealValuedMultiVector>> arrayOfCoords,
288 Teuchos::ParameterList& List)
290 arrayOfHierarchies_.resize(nBlks_);
291 for (
int i = 0; i < nBlks_; i++) arrayOfHierarchies_[i] = Teuchos::null;
309 describe(Teuchos::FancyOStream& out,
const Teuchos::EVerbosityLevel )
const {
311 std::ostringstream oss;
313 RCP<const Teuchos::Comm<int> > comm = AmatMultiphysics_->getDomainMap()->getComm();
316 oss <<
"\n--------------------------------------------------------------------------------\n" <<
317 "--- MultiPhysics Summary ---\n"
318 "--------------------------------------------------------------------------------" << std::endl;
324 AmatMultiphysics_->getRowMap()->getComm()->barrier();
326 for (
int i = 0; i < nBlks_; i++) {
327 numRows = arrayOfAuxMatrices_[i]->getGlobalNumRows();
328 nnz = arrayOfAuxMatrices_[i]->getGlobalNumEntries();
329 Xpetra::global_size_t tt = numRows;
330 int rowspacer = 3;
while (tt != 0) { tt /= 10; rowspacer++; }
332 int nnzspacer = 2;
while (tt != 0) { tt /= 10; nnzspacer++; }
334 oss <<
"block " << std::setw(rowspacer) <<
" rows " << std::setw(nnzspacer) <<
" nnz " << std::setw(9) <<
" nnz/row" << std::endl;
335 oss <<
"(" << Teuchos::toString(i) <<
", " << Teuchos::toString(i) <<
")" << std::setw(rowspacer) << numRows << std::setw(nnzspacer) << nnz << std::setw(9) << as<double>(nnz) / numRows << std::endl;
340 for (
int i = 0; i < nBlks_; i++) {
341 arrayOfHierarchies_[i]->describe(out, GetVerbLevel());
void initialize(const Teuchos::RCP< Matrix > &AmatMultiPhysics, const Teuchos::ArrayRCP< RCP< Matrix > > arrayOfAuxMatrices, const Teuchos::ArrayRCP< Teuchos::RCP< MultiVector > > arrayOfNullspaces, const Teuchos::ArrayRCP< Teuchos::RCP< RealValuedMultiVector > > arrayOfCoords, const int nBlks, Teuchos::ParameterList &List)
Teuchos::RCP< MueLu::Hierarchy< Scalar, LocalOrdinal, GlobalOrdinal, Node > > CreateXpetraPreconditioner(Teuchos::RCP< Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > op, const Teuchos::ParameterList &inParamList)
Helper function to create a MueLu preconditioner that can be used by Xpetra.Given an Xpetra::Matrix,...