Skip to content
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

Newton fail test fix #3787

Merged
merged 3 commits into from Aug 17, 2020
Merged

Conversation

MFraters
Copy link
Member

This is a proposed fix for the problem found in #3705. I made a new pull request out of it to allow me to easily change the code.

In short, this introduces a test of whether the rhs has dropped more than 1e-8 (I could make this a parameter if desired).

While fixing this, I noticed that to get it working I had to enable rebuilding of the Newton stokes matrix every 0th nonlinear iteration. It doesn't seem to change anything for the other tests (as far as I could see locally) because they already did that due to their boundary conditions.

@@ -440,7 +441,7 @@ namespace aspect
// don't need to force assembly of the matrix.
if (stokes_matrix_depends_on_solution()
||
(nonlinear_iteration == 0 && boundary_velocity_manager.get_active_boundary_velocity_conditions().size() > 0))
(nonlinear_iteration == 0 ))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this an accident? I think that the original condition should have had an || instead of && -- that strikes me as a bug in the original code. Or do I misunderstand the situation?

// Test whether the rhs has dropped so much that we can assume that the iteration is done.
if (dcr.residual < dcr.residual_old * 1e-8)
{
return;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you output some status message here? Say

Suggested change
return;
pcout << " Nonlinear residual is small; skipping Stokes solve" << std::endl;
return;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that your new message text reflects what is happening well. You are saying that "it has been very large", but that's not the point -- it's just been the regular nonlinear residual. The point is that it is vastly smaller this time around, and that that's likely because the model is (more or less) a linear model that is adequately solved in one iteration, and you're now in the next iteration. I think that my text reflected that better: it's about being small this time; it may or may not have been large last time around, we really neither know nor care.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Related, what you print in parentheses is not actually the old residual that you reference when you say "has been very large"), but the ratio. It's confusing to see a statement "has been very large (1.234e-13)" I think :-)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm, isn't the point that the reduction in the residual has been very large? Do you have a better way of phrasing it? Should I just state that the reduction in the residual has been very large, and/or do you want me to show a different number?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I misread the text. I though you had said "Nonlinear residual has been very large", but you're saying "Nonlinear residual reduction has been very large. Yes, now it makes sense to me.

@MFraters
Copy link
Member Author

Thanks for the review, I think that I have addressed your comments.

tjhei and others added 2 commits August 14, 2020 11:31
This currently failing test is a linear problem, so the second nonlinear
iteration should do 0 iterations (and does when you use "single
Advection, iterated Stokes") but it crashes with the Stokes solver not
converging. It looks like we try to reduce the residual to 1e-20, which
won't work.
The test passes if you remove "set Linear solver tolerance".
@MFraters
Copy link
Member Author

I have changed the output a little bit to be a bit more descriptive and I updated the test results.

// Test whether the rhs has dropped so much that we can assume that the iteration is done.
if (dcr.residual < dcr.residual_old * 1e-8)
{
return;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that your new message text reflects what is happening well. You are saying that "it has been very large", but that's not the point -- it's just been the regular nonlinear residual. The point is that it is vastly smaller this time around, and that that's likely because the model is (more or less) a linear model that is adequately solved in one iteration, and you're now in the next iteration. I think that my text reflected that better: it's about being small this time; it may or may not have been large last time around, we really neither know nor care.

// Test whether the rhs has dropped so much that we can assume that the iteration is done.
if (dcr.residual < dcr.residual_old * 1e-8)
{
return;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Related, what you print in parentheses is not actually the old residual that you reference when you say "has been very large"), but the ratio. It's confusing to see a statement "has been very large (1.234e-13)" I think :-)

@bangerth
Copy link
Contributor

OK to merge if it tests ok.

@bangerth bangerth merged commit db67994 into geodynamics:master Aug 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants