-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CG: distribute periodicity and hanging node constraints #651
Draft
richardschu
wants to merge
2
commits into
exadg:master
Choose a base branch
from
richardschu:poisson_cg_constraints_fix
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most changes are made after solving. This change is made before solving. Why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you see the TODO a few lines below? This code that is currently commented, but code that we might want to take care of as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see #651 (comment)
Here, the
sol
is then used in the Newton solver to update the linearization vectorhttps://github.com/richardschu/exadg/blob/c5f489f1085b78f951d53cc62f510028c74c38be/include/exadg/solvers_and_preconditioners/newton/newton_solver.h#L79
and evaluate the residual
https://github.com/richardschu/exadg/blob/c5f489f1085b78f951d53cc62f510028c74c38be/include/exadg/solvers_and_preconditioners/newton/newton_solver.h#L104
Otherwise we have the zero hanging node values in the linearization vector.
I was surprised to not see an impact on the nonlinear iteration count, but maybe the solution we are searching for (with zero values at hanging nodes) is still close enough to the "real" one with correct hanging node values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that we need this vector for the evaluation of the residual/linearized operator. And it is also clear to me that we need to take these constraints into account correctly when evaluating the integrals. However, from a software design perspective, the problem is in my opinion that responsibilities are beginning to blur if we add these lines here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Operator has all affine_constraints objects, so I think it should also enforce the constraints.
I would not put it in the postprocessor, since the idea (up to now) for the postprocessor was, that it is entirely optional (see throughput applications, where it is not even set up). If we move the lines, I think they have to go together with the
elasticity_operator_nonlinear.set_inhomogeneous_boundary_values(sol);
otherwise we split things up unintuitively(?).
Where is in your opinion the right place to enforce constraints on a vector?
The Operator has the affine_constraints, so it should do it, right?
The
sol
could already have the right BCs enforced when callingsolve_nonlinear(sol)
.So should we add a
operator->enforce_constraints()
, which is called beforesolve_nonlinear
andsolve_linear(sol)
from the driver(s)? But that is also not really intuitive from the driver side: How would I expect that I have to update the vectors constraints due to internals of how the operator works? For the postprocessor, we could think about it, but then it would be different for linear and nonlinear solvers, which is also kinda confusing. So I would rather say, maybe introduce aoperator->enforce_constraints()
to bundle the constraints, but when callingoperator->solve_nonlinear(sol)
oroperator->solve_linear(sol)
, this should be done in the operator side automatically where needed.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should remove it, when coming up with something new here.