Skip to content

Commit

Permalink
Changed formulation from u+g to u-g
Browse files Browse the repository at this point in the history
  • Loading branch information
kyrillh committed Jun 28, 2024
1 parent 4f7b7e5 commit 456044f
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ void CoarseNonLinearSchwarzOperator<SC, LO, GO, NO>::apply(const BlockMultiVecto
// Set solution_ to be u+P_0*g_0. g_0 is zero on the boundary, simulating P_0 locally
// x_ corresponds to u and problem_->solution_ corresponds to g_0
// this = alpha*xTmp + beta*this
problem_->solution_->update(ST::one(), *x_, ST::one());
problem_->solution_->update(ST::one(), *x_, -ST::one());

// Need to update solution_ within each iteration to assemble at u+P_0*g_0 but update only g_0
// This is necessary since u is nonzero on the artificial (interface) zero Dirichlet boundary
Expand Down Expand Up @@ -301,7 +301,7 @@ void CoarseNonLinearSchwarzOperator<SC, LO, GO, NO>::apply(const BlockMultiVecto
}

// Set solution_ to g_i
problem_->solution_->update(-ST::one(), *x_, ST::one());
problem_->solution_->update(ST::one(), *x_, -ST::one());
totalIters_ += nlIts;
FEDD::logGreen("Terminated coarse Newton", this->MpiComm_);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ void NonLinearH1Operator<SC, LO, GO, NO>::apply(const XMultiVector &x, XMultiVec
->apply(*this->XTmp_, *this->gTmp_, one, zero);
// Set YTmp_ = u - g0
this->YTmp_->update(one, *this->XTmp_, zero);
this->YTmp_->update(one, *this->gTmp_, one);
this->YTmp_->update(-one, *this->gTmp_, one);
// Get overlapping correction g evaluated at u - g0
// This will build the local Jacobians at v_i = u_0 - P_iT_i(u_0)
rcp_dynamic_cast<NonLinearOperator<SC, LO, GO, NO>>(this->NonLinearOperatorVector_[0])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ void NonLinearSchwarzOperator<SC, LO, GO, NO>::apply(const BlockMultiVectorPtrFE

// Set solution_ to be u+P_i*g_i. g_i is zero on the boundary, simulating P_i locally
// this = alpha*xTmp + beta*this
problem_->solution_->update(ST::one(), *x_, ST::one());
problem_->solution_->update(ST::one(), *x_, -ST::one());

// Need to update solution_ within each iteration to assemble at u+P_i*g_i but update only g_i
// This is necessary since u is nonzero on the artificial (interface) zero Dirichlet boundary
Expand Down Expand Up @@ -304,7 +304,7 @@ void NonLinearSchwarzOperator<SC, LO, GO, NO>::apply(const BlockMultiVectorPtrFE
}

// Set solution_ to g_i
problem_->solution_->update(-ST::one(), *x_, ST::one());
problem_->solution_->update(ST::one(), *x_, -ST::one());
FEDD::logGreen("Terminated inner Newton", this->MpiComm_);
totalIters_ += nlIts;

Expand Down
2 changes: 1 addition & 1 deletion feddlib/problems/Solver/NonLinearSolver_def.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -767,7 +767,7 @@ void NonLinearSolver<SC, LO, GO, NO>::solveNonLinearSchwarz(NonLinearProblem_Typ

// Update the current solution
// solution = alpha * deltaSolution + beta * solution
problem.solution_->update(ST::one(), deltaSolution, ST::one());
problem.solution_->update(-ST::one(), deltaSolution, ST::one());
// Compute the residual
problem.calculateNonLinResidualVec("reverse");
residual = problem.calculateResidualNorm();
Expand Down

0 comments on commit 456044f

Please sign in to comment.