56 list.set(
"multigrid algorithm",
"combine");
57 list.set(
"combine: numBlks", nBlks_);
60 std::string verbosity = list.get(
"verbosity",
"high");
63 arrayOfParamLists_.resize(nBlks_);
64 for (
int i = 0; i < nBlks_; i++) {
65 std::string listName =
"subblockList" + Teuchos::toString(i);
66 if (list.isSublist(listName)) {
67 arrayOfParamLists_[i] = Teuchos::rcpFromRef(list.sublist(listName));
71 arrayOfParamLists_[i]->set(
"verbosity", arrayOfParamLists_[i]->get(
"verbosity", verbosity));
72 arrayOfParamLists_[i]->set(
"smoother: pre or post",
"none");
73 arrayOfParamLists_[i]->set(
"smoother: type",
"none");
77 useKokkos_ = !Node::is_serial;
78 useKokkos_ = list.get(
"use kokkos refactor", useKokkos_);
80 paramListMultiphysics_ = Teuchos::rcpFromRef(list);
96 std::string timerLabel;
98 timerLabel =
"MueLu MultiPhys: compute (reuse)";
100 timerLabel =
"MueLu MultiPhys: compute";
101 RCP<Teuchos::TimeMonitor> tmCompute = getTimer(timerLabel);
106 for (
int iii = 0; iii < nBlks_; iii++) {
107 if (arrayOfCoords_ != Teuchos::null) {
108 arrayOfParamLists_[iii]->sublist(
"user data").set(
"Coordinates", arrayOfCoords_[iii]);
111 bool wantToRepartition =
false;
112 if (paramListMultiphysics_->isParameter(
"repartition: enable"))
113 wantToRepartition = paramListMultiphysics_->get<
bool>(
"repartition: enable");
115 arrayOfParamLists_[iii]->set(
"repartition: enable", wantToRepartition);
116 arrayOfParamLists_[iii]->set(
"repartition: rebalance P and R",
true);
117 arrayOfParamLists_[iii]->set(
"repartition: explicit via new copy rebalance P and R",
true);
119 if (paramListMultiphysics_->isParameter(
"repartition: use subcommunicators"))
120 arrayOfParamLists_[iii]->set(
"repartition: use subcommunicators", paramListMultiphysics_->isParameter(
"repartition: use subcommunicators"));
122 arrayOfParamLists_[iii]->set(
"repartition: use subcommunicators",
true);
127 paramListMultiphysics_->set<
bool>(
"repartition: enable",
false);
130 for (
int i = 0; i < nBlks_; i++) {
131 std::string operatorLabel =
"MultiPhys (" + Teuchos::toString(i) +
"," + Teuchos::toString(i) +
")";
132 arrayOfAuxMatrices_[i]->setObjectLabel(operatorLabel);
134 LO tempNlevels = arrayOfHierarchies_[i]->GetGlobalNumLevels();
135 if (tempNlevels < maxLevels) maxLevels = tempNlevels;
138 hierarchyMultiphysics_ = rcp(
new Hierarchy(
"Combo"));
139 for (LO i = 0; i < maxLevels; i++) {
140 hierarchyMultiphysics_->AddNewLevel();
142 for (
int i = 0; i < nBlks_; i++) {
143 std::string subblkName =
"Psubblock" + Teuchos::toString(i);
146 paramListMultiphysics_->set(
"coarse: max size", 1);
147 paramListMultiphysics_->set(
"max levels", maxLevels);
149 AmatMultiphysics_->setObjectLabel(
"A: block " + Teuchos::toString(nBlks_) +
" x " + Teuchos::toString(nBlks_) +
"multiphysics matrix");
152 Teuchos::ParameterList nonSerialListMultiphysics, processedListMultiphysics;
157 Teuchos::ParameterList stripped;
158 for (ParameterList::ConstIterator inListEntry = processedListMultiphysics.begin(); inListEntry != processedListMultiphysics.end(); inListEntry++) {
159 const std::string& levelName = inListEntry->first;
160 if (levelName.find(
"subblockList") != 0) stripped.setEntry(inListEntry->first, inListEntry->second);
164 hierarchyMultiphysics_->setlib(AmatMultiphysics_->getDomainMap()->lib());
165 hierarchyMultiphysics_->SetProcRankVerbose(AmatMultiphysics_->getDomainMap()->getComm()->getRank());
168 hierarchyMultiphysics_->GetLevel(0)->Set(
"A", AmatMultiphysics_);
173 mueLuFactory->SetupHierarchy(*hierarchyMultiphysics_);
221 initialize(
const Teuchos::RCP<Matrix>& AmatMultiPhysics,
222 const Teuchos::ArrayRCP<RCP<Matrix>> arrayOfAuxMatrices,
223 const Teuchos::ArrayRCP<Teuchos::RCP<MultiVector>> arrayOfNullspaces,
224 const Teuchos::ArrayRCP<Teuchos::RCP<RealValuedMultiVector>> arrayOfCoords,
226 Teuchos::ParameterList& List) {
227 arrayOfHierarchies_.resize(nBlks_);
228 for (
int i = 0; i < nBlks_; i++) arrayOfHierarchies_[i] = Teuchos::null;
232 enable_reuse_ =
false;
242 describe(Teuchos::FancyOStream& out,
const Teuchos::EVerbosityLevel )
const {
243 std::ostringstream oss;
245 RCP<const Teuchos::Comm<int>> comm = AmatMultiphysics_->getDomainMap()->getComm();
247 oss <<
"\n--------------------------------------------------------------------------------\n"
248 <<
"--- MultiPhysics Summary ---\n"
249 "--------------------------------------------------------------------------------"
256 AmatMultiphysics_->getRowMap()->getComm()->barrier();
258 for (
int i = 0; i < nBlks_; i++) {
259 numRows = arrayOfAuxMatrices_[i]->getGlobalNumRows();
260 nnz = arrayOfAuxMatrices_[i]->getGlobalNumEntries();
261 Xpetra::global_size_t tt = numRows;
274 oss <<
"block " << std::setw(rowspacer) <<
" rows " << std::setw(nnzspacer) <<
" nnz " << std::setw(9) <<
" nnz/row" << std::endl;
275 oss <<
"(" << Teuchos::toString(i) <<
", " << Teuchos::toString(i) <<
")" << std::setw(rowspacer) << numRows << std::setw(nnzspacer) << nnz << std::setw(9) << as<double>(nnz) / numRows << std::endl;
281 for (
int i = 0; i < nBlks_; i++) {
282 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,...