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

[WIP] Forced flow verification experiment #573

Closed
wants to merge 8 commits into from

Conversation

ali-ramadhan
Copy link
Member

This PR aims to add the forced flow analytic test as a verification experiment. The test is described in section 6.1 of Brown, Cortez, & Minion (2001) and is used to test various projection methods for the incompressible Navier-Stokes equations.

The reason for implementing this test is to investigate the accuracy of Oceananigans' projection (or fractional step) method following concerns brought up by @sandreza. In particular, we can test whether Oceananigans' time-stepping is indeed second-order accurate in velocity and pressure.

A couple of points regarding the accuracy of projection methods for us:

  1. In the introduction to Brown et al. (2001), they heuristically suggest adding a correction term to the pressure update that is linearly proportional to the viscosity ν. To me this suggests that perhaps the accuracy of the projection method matters more at low Reynolds number. The forced flow test uses Re = 1 so it's probably in a regime where the accuracy of the projection method matters a lot.
  2. The entire paper seems to focus on the semi-implicit form of the discrete Navier-Stokes equations where diffusion is treated implicitly. It's unclear to me whether their paper matters to us since we currently treat diffusion completely explicitly.

Right now the test blows up (no matter how small the time step). Not sure why. I'll have to investigate and plots things a bit. Most likely I just set things up incorrectly.

@ali-ramadhan ali-ramadhan added science 🌊 Sometimes addictive, sometimes allergenic numerics 🧮 So things don't blow up and boil the lobsters alive testing 🧪 Tests get priority in case of emergency evacuation labels Dec 14, 2019
@glwagner
Copy link
Member

Hmm. We know from mathematics that the pressure boundary conditions must be obtained by evaluating the momentum equation on the boundary. If we are not doing that, we are not calculating pressure correctly (therefore, if the test passes, the test is flawed). If we are doing that, then this test could serve as a test that we are doing that correctly. As far as I know we are not evaluating the pressure correctly. Therefore, this test must fail if it is implemented correctly.

It must also be noted that this test is incomplete. The pressure boundary condition is obtained by evaluating the momentum equation on the boundary --- and this applies to any momentum equation, including those with LES closures, biharmonic viscosity, anisotropic viscosity, wave-averaged surface wave terms, as well as arbitrary user-defined terms.

It is possible to evaluate the momentum equation on the boundary (since we already evaluate in the interior) and use the result to determine inhomogeneous boundary conditions; this is permitted by the algorithm we use and its implementation is described in Schumann and Sweet (1979).

@glwagner
Copy link
Member

In the introduction to Brown et al. (2001), they heuristically suggest adding a correction term to the pressure update that is linearly proportional to the viscosity ν. To me this suggests that perhaps the accuracy of the projection method matters more at low Reynolds number. The forced flow test uses Re = 1 so it's probably in a regime where the accuracy of the projection method matters a lot.

I think you are referring to the possibility that numerical discretization error may overcome the error associated with a mathematically incorrect boundary condition. While this could be true at a fixed resolution, it will not be true as resolution is increased indefinitely.

@ali-ramadhan
Copy link
Member Author

This is a test I tried to implement back in August (thus the old original commit). Noticed it still sitting on a stale branch so I figured I should try to revive it as it could serve as a pretty good verification experiment.

Therefore, this test must fail if it is implemented correctly.

Yeah I'm expecting the test to fail in that we won't see second-order accuracy, but I don't think it shouldn't be blowing up.

It must also be noted that this test is incomplete.

Ah because it doesn't test the LES models? I suppose the test was designed for constant diffusivity only.

I think you are referring to the possibility that numerical discretization error may overcome the error associated with a mathematically incorrect boundary condition. While this could be true at a fixed resolution, it will not be true as resolution is increased indefinitely.

Hmmm, we have other verification experiments that do pass and in general we're pretty certain that Oceananigans produces the correct results but they've most been at Re > 1 so maybe you're right that numerical discretization errors dominate over this boundary condition error which might be small for most oceanographic simulations.

@glwagner
Copy link
Member

Ah because it doesn't test the LES models? I suppose the test was designed for constant diffusivity only.

All terms in the momentum equation affect the boundary conditions on pressure. This includes user-defined forcings.

Hmmm, we have other verification experiments that do pass and in general we're pretty certain that Oceananigans produces the correct results but they've most been at Re > 1 so maybe you're right that numerical discretization errors dominate over this boundary condition error which might be small for most oceanographic simulations.

I don't think the verification tests show the pressure solver is correct (its not, we know that). They only imply that, if it is not correct, the error associated with it does not corrupt the solution in one particular case.

This 'test' seems different. It claims to verify that the pressure field obtained by our numerical method is correct.

@ali-ramadhan
Copy link
Member Author

I don't think the verification tests show the pressure solver is correct (its not, we know that).

True. But it shows that as we increase the resolution, the solution converges to the analytic solution.

This 'test' seems different. It claims to verify that the pressure field obtained by our numerical method is correct.

Yes, or at least tell use the order of accuracy on the pressure and velocity fields.

@codecov
Copy link

codecov bot commented Dec 22, 2019

Codecov Report

Merging #573 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #573   +/-   ##
=======================================
  Coverage   73.14%   73.14%           
=======================================
  Files          70       70           
  Lines        2011     2011           
=======================================
  Hits         1471     1471           
  Misses        540      540

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2d8eaa5...fa60043. Read the comment docs.

@ali-ramadhan
Copy link
Member Author

ali-ramadhan commented Dec 22, 2019

Alright the forced flow test runs now. Explicit time-stepping at Re = 1 is painful though.

Next I need to check that it's actually setting up the forced flow solution and do a convergence test.

Also to compare the model's pressure against the analytic expression for pressure, not just velocity.

@ali-ramadhan ali-ramadhan changed the title [WIP] Forced flow verification experiment for testing the accuracy of Oceananigans' projection method [WIP] Forced flow verification experiment Jan 10, 2020
@ali-ramadhan
Copy link
Member Author

Closing as a better forced flow verification experiment has been added in PR #767 and documented in PR #782.

@ali-ramadhan ali-ramadhan deleted the forced-flow-test branch August 4, 2020 13:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
numerics 🧮 So things don't blow up and boil the lobsters alive science 🌊 Sometimes addictive, sometimes allergenic testing 🧪 Tests get priority in case of emergency evacuation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants