Skip to content

Commit

Permalink
Small updates
Browse files Browse the repository at this point in the history
  • Loading branch information
kyrillh committed Oct 14, 2024
1 parent c689de7 commit 3dc0575
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -383,9 +383,7 @@ void CoarseNonLinearSchwarzOperator<SC, LO, GO, NO>::apply(const BlockMultiVecto

if (nlIts == 0) {
if (absResidual < absNewtonTol_) {
std::cout
<< "==> Exiting coarse Newton solver immediately: absolute residual is already below the tolerance."
<< std::endl;
FEDD::logGreen("Exiting coarse Newton solver immediately: absolute residual is already below the tolerance.", this->MpiComm_);
break; // We are already done
} else {
residual0 = absResidual;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -325,9 +325,9 @@ void NonLinearSchwarzOperator<SC, LO, GO, NO>::apply(const BlockMultiVectorPtrFE

if (nlIts == 0) {
if (absResidual < absNewtonTol_) {
std::cout
<< "==> Exiting local Newton solver immediately: absolute residual is already below the tolerance."
<< std::endl;
FEDD::logGreen(
"Exiting local Newton solver immediately: absolute residual is already below the tolerance.",
this->MpiComm_);
break; // We are already done
} else {
residual0 = absResidual;
Expand Down
2 changes: 2 additions & 0 deletions feddlib/problems/Solver/NonLinearSolver_def.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -634,6 +634,8 @@ void NonLinearSolver<SC, LO, GO, NO>::solveNonLinearSchwarz(NonLinearProblem_Typ
// The coarse space is built using this Jacobian
// Calling these first two lines does have an affect on the Jacobian that is used to build the coarse space.
// Depending on the particular problem implementation a different set of these calls to assemble should be used.
/* problem.solution_->scale(-1.); */
problem.bcFactory_->setVectorMinusBC( problem.solution_, problem.solution_);
problem.assemble();
problem.assemble("FixedPoint");
problem.assemble("Newton");
Expand Down
25 changes: 11 additions & 14 deletions feddlib/problems/tests/steadyLDCSchwarz/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,9 @@ int main(int argc, char *argv[]) {
comm->barrier();
comm->barrier();

// Teuchos::RCP<StackedTimer> stackedTimer = rcp(new StackedTimer("Steady Navier-Stokes", true));
// TimeMonitor::setStackedTimer(stackedTimer);
Teuchos::RCP<StackedTimer> stackedTimer = rcp(new StackedTimer("Nonlinear Schwarz solver", true));
TimeMonitor::setStackedTimer(stackedTimer);

ParameterListPtr_Type parameterListProblem = Teuchos::getParametersFromXmlFile(xmlProblemFile);

ParameterListPtr_Type parameterListSolver = Teuchos::getParametersFromXmlFile(xmlSchwarzSolverFile);
Expand Down Expand Up @@ -153,13 +154,8 @@ int main(int argc, char *argv[]) {
int numProcsCoarseSolve = parameterListProblem->sublist("General").get("Mpi Ranks Coarse", 0);
int size = comm->getSize() - numProcsCoarseSolve;

Teuchos::RCP<Teuchos::Time> totalTime(Teuchos::TimeMonitor::getNewCounter("main: Total Time"));
Teuchos::RCP<Teuchos::Time> buildMesh(Teuchos::TimeMonitor::getNewCounter("main: Build Mesh"));
Teuchos::RCP<Teuchos::Time> solveTime(Teuchos::TimeMonitor::getNewCounter("main: Solve problem time"));
DomainPtr_Type domainPressure;
DomainPtr_Type domainVelocity;
Teuchos::TimeMonitor totalTimeMonitor(*totalTime);
Teuchos::TimeMonitor buildMeshMonitor(*buildMesh);
if (verbose) {
cout << "-- Building Mesh ..." << flush;
}
Expand Down Expand Up @@ -217,8 +213,6 @@ int main(int argc, char *argv[]) {
domainPressure->info();
navierStokes.info();

Teuchos::TimeMonitor solveTimeMonitor(*solveTime);

navierStokes.addBoundaries(bcFactory);
navierStokes.addRhsFunction(dummyFunc);

Expand All @@ -231,14 +225,17 @@ int main(int argc, char *argv[]) {

std::string nlSolverType = parameterListProblem->sublist("General").get("Linearization", "NonlinearSchwarz");
NonLinearSolver<SC, LO, GO, NO> nlSolver(nlSolverType);
FEDD_TIMER_START(SolveTimer, " - Schwarz - global solve");
nlSolver.solve(navierStokes);
FEDD_TIMER_STOP(SolveTimer);

comm->barrier();

Teuchos::TimeMonitor::report(cout);
// stackedTimer->stop("Steady Navier-Stokes");
// StackedTimer::OutputOptions options;
// options.output_fraction = options.output_histogram = options.output_minmax = true;
// stackedTimer->report((std::cout), comm, options);
Teuchos::TimeMonitor::report(cout, "FEDD");
stackedTimer->stop("Nonlinear Schwarz solver");
StackedTimer::OutputOptions options;
options.output_fraction = options.output_histogram = options.output_minmax = true;
stackedTimer->report((std::cout), comm, options);

if (parameterListAll->sublist("General").get("ParaViewExport", false)) {
Teuchos::RCP<ExporterParaView<SC, LO, GO, NO>> exParaVelocity(new ExporterParaView<SC, LO, GO, NO>());
Expand Down

0 comments on commit 3dc0575

Please sign in to comment.