Skip to content

Commit

Permalink
MueLu RefMaxwell: Add toggle to use as preconditioned or as solver
Browse files Browse the repository at this point in the history
When used as preconditioned, the initial solution vector is assumed to
be zero.
  • Loading branch information
cgcgcg authored and lucbv committed Aug 27, 2018
1 parent 703e7be commit 5bd0588
Show file tree
Hide file tree
Showing 12 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,7 @@ namespace Thyra {
}
#endif
// build a new MueLu RefMaxwell preconditioner
paramList.set<bool>("refmaxwell: use as preconditioner", true);
preconditioner = rcp(new MueLu::RefMaxwell<Scalar,LocalOrdinal,GlobalOrdinal,Node>(A, paramList, true));

} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ namespace Thyra {
{
// build a new MueLu RefMaxwell preconditioner
Teuchos::TimeMonitor tMbuild(*Teuchos::TimeMonitor::getNewTimer(std::string("ThyraMueLuRefMaxwell::initializePrec build prec")));
paramList.set<bool>("refmaxwell: use as preconditioner", true);
preconditioner = rcp(new MueLu::RefMaxwell<Scalar,LocalOrdinal,GlobalOrdinal,Node>(A, paramList, true));
}

Expand Down
3 changes: 2 additions & 1 deletion packages/muelu/adapters/xpetra/MueLu_RefMaxwell_decl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ namespace MueLu {
Allowed values are: "additive" (default), "121", "212"
- <tt>refmaxwell: disable addon</tt> - <tt>bool</tt> specifing whether the addon should be built for stabilization.
Default: "true"
- <tt>refmaxwell: use as preconditioner</tt> - <tt>bool</tt> specifing whether RefMaxwell is used as a preconditioner or as a solver.
- <tt>refmaxwell: dump matrices</tt> - <tt>bool</tt> specifing whether the matrices should be dumped.
Default: "false"
- <tt>refmaxwell: prolongator compute algorithm</tt> - a <tt>string</tt> specifying the algorithm to build the prolongator.
Expand Down Expand Up @@ -362,7 +363,7 @@ namespace MueLu {
//! Parameter lists
Teuchos::ParameterList parameterList_, precList11_, precList22_, smootherList_;
//! Some options
bool disable_addon_, dump_matrices_,useKokkos_;
bool disable_addon_, dump_matrices_,useKokkos_,use_as_preconditioner_;
std::string mode_;
//! Temporary memory
mutable Teuchos::RCP<MultiVector> P11res_, P11x_, D0res_, D0x_, residual_;
Expand Down
3 changes: 2 additions & 1 deletion packages/muelu/adapters/xpetra/MueLu_RefMaxwell_def.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ namespace MueLu {
parameterList_ = list;
disable_addon_ = list.get("refmaxwell: disable addon",true);
mode_ = list.get("refmaxwell: mode","additive");
use_as_preconditioner_ = list.get<bool>("refmaxwell: use as preconditioner");
dump_matrices_ = list.get("refmaxwell: dump matrices",false);

if(list.isSublist("refmaxwell: 11list"))
Expand Down Expand Up @@ -1265,7 +1266,7 @@ namespace MueLu {
}
else
#endif
PreSmoother_->Apply(X, RHS, false);
PreSmoother_->Apply(X, RHS, use_as_preconditioner_);

// do solve for the 2x2 block system
if(mode_=="additive")
Expand Down
1 change: 1 addition & 0 deletions packages/muelu/test/maxwell/Maxwell.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<ParameterList name="MueLu">

<Parameter name="refmaxwell: use as preconditioner" type="bool" value="true"/>
<Parameter name="refmaxwell: mode" type="string" value="additive"/>
<Parameter name="refmaxwell: disable addon" type="bool" value="false"/>
<Parameter name="refmaxwell: dump matrices" type="bool" value="false"/>
Expand Down
1 change: 1 addition & 0 deletions packages/muelu/test/maxwell/Maxwell_complex.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<ParameterList name="MueLu">

<Parameter name="refmaxwell: use as preconditioner" type="bool" value="true"/>
<Parameter name="refmaxwell: mode" type="string" value="additive"/>
<Parameter name="refmaxwell: disable addon" type="bool" value="false"/>
<Parameter name="refmaxwell: dump matrices" type="bool" value="false"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@
<ParameterList name="Preconditioner Types">
<ParameterList name="MueLuRefMaxwell-Tpetra">
<Parameter name="parameterlist: syntax" type="string" value="muelu"/>
<Parameter name="refmaxwell: use as preconditioner" type="bool" value="true"/>
<Parameter name="refmaxwell: mode" type="string" value="additive"/>
<Parameter name="refmaxwell: disable addon" type="bool" value="false"/>
<Parameter name="refmaxwell: dump matrices" type="bool" value="false"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@
<ParameterList name="Preconditioner Types">
<ParameterList name="MueLuRefMaxwell-Tpetra">
<Parameter name="parameterlist: syntax" type="string" value="muelu"/>
<Parameter name="refmaxwell: use as preconditioner" type="bool" value="true"/>
<Parameter name="refmaxwell: mode" type="string" value="additive"/>
<Parameter name="refmaxwell: disable addon" type="bool" value="false"/>
<Parameter name="refmaxwell: dump matrices" type="bool" value="false"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@
<ParameterList name="Preconditioner Types">
<ParameterList name="MueLuRefMaxwell-Tpetra">
<Parameter name="parameterlist: syntax" type="string" value="muelu"/>
<Parameter name="refmaxwell: use as preconditioner" type="bool" value="true"/>
<Parameter name="refmaxwell: mode" type="string" value="additive"/>
<Parameter name="refmaxwell: disable addon" type="bool" value="false"/>
<Parameter name="refmaxwell: dump matrices" type="bool" value="false"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@
<ParameterList name="Preconditioner Types">
<ParameterList name="MueLuRefMaxwell">
<Parameter name="parameterlist: syntax" type="string" value="muelu"/>
<Parameter name="refmaxwell: use as preconditioner" type="bool" value="true"/>
<Parameter name="refmaxwell: mode" type="string" value="additive"/>
<Parameter name="refmaxwell: disable addon" type="bool" value="false"/>
<Parameter name="refmaxwell: dump matrices" type="bool" value="false"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@
<ParameterList name="MueLuRefMaxwell-Tpetra">
<Parameter name="parameterlist: syntax" type="string" value="muelu"/>
<Parameter name="use kokkos refactor" type="bool" value="true"/>
<Parameter name="refmaxwell: use as preconditioner" type="bool" value="true"/>
<Parameter name="refmaxwell: mode" type="string" value="additive"/>
<Parameter name="refmaxwell: disable addon" type="bool" value="false"/>
<Parameter name="refmaxwell: dump matrices" type="bool" value="false"/>
Expand Down
1 change: 1 addition & 0 deletions packages/trilinoscouplings/examples/scaling/Maxwell.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@

<ParameterList name="MueLu">

<Parameter name="refmaxwell: use as preconditioner" type="bool" value="true"/>
<Parameter name="refmaxwell: mode" type="string" value="additive"/>
<Parameter name="refmaxwell: disable addon" type="bool" value="false"/>
<Parameter name="refmaxwell: dump matrices" type="bool" value="false"/>
Expand Down

0 comments on commit 5bd0588

Please sign in to comment.