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

Calculate tendencies on boundaries #677

Merged
merged 7 commits into from
Mar 6, 2020

Conversation

glwagner
Copy link
Member

@glwagner glwagner commented Mar 6, 2020

This PR modifies the time-stepping algorithm so that the tendencies for wall-normal velocity components are calculated on boundaries in Bounded directions.

In other words, when x is Bounded, the algorithm now calculates Gu on east boundaries, where i=Nx+1. Previously Gu was only calculated on west boundaries where i=1. The same applies to y and z.

This change is necessary because, in general, the values of Gu, Gv, and Gw on x, y, or z boundaries are needed to impose predictor velocity and pressure boundary conditions when x, y, or z are Bounded --- respectively.

The changes in this PR also motivated a slight refactoring of the way "equations" are specified. There is now a file dedicated to equation / tendency specification, called velocity_and_tracer_tendencies.jl in src/TimeStepping.

Resolves #259 (since it implements a simple / minimal abstraction for equations).

@codecov
Copy link

codecov bot commented Mar 6, 2020

Codecov Report

Merging #677 into master will decrease coverage by 0.00%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #677      +/-   ##
==========================================
- Coverage   77.99%   77.98%   -0.01%     
==========================================
  Files         120      121       +1     
  Lines        2413     2444      +31     
==========================================
+ Hits         1882     1906      +24     
- Misses        531      538       +7     
Impacted Files Coverage Δ
src/TimeSteppers/velocity_and_tracer_tendencies.jl 100.00% <0.00%> (ø)

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 74cfb85...10e1e55. Read the comment docs.

Copy link
Member

@ali-ramadhan ali-ramadhan left a comment

Choose a reason for hiding this comment

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

Looks great! Certainly would be easy to make changes to the momentum and tracer equations now.

I should add a page for private API documentation (so all these docstrings make it into the documentation, actually that's just #599).

Comment on lines +21 to +22
`parameters` is a `NamedTuple` of scalar parameters for user-defined forcing functions
and `time` is the physical time of the model.
Copy link
Member

Choose a reason for hiding this comment

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

I thought model.parameters could be anything passed in by the user, although we usually use named tuples (so do most people for these kinds of parameters).

Copy link
Member Author

Choose a reason for hiding this comment

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

That's true about model.parameters --- except that kernels will fail to compile on the GPU unless it only contains simple objects.

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, ok, I will change the docstring to be more accurate.

Copy link
Member

Choose a reason for hiding this comment

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

I think we're planning to get rid of model.parameters but whatever we replace it (e.g. model.forcing.parameters) with should probably work the same way for writing forcing functions so thankfully the docstrings will still be correct then.

Copy link
Member Author

Choose a reason for hiding this comment

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

Should we merge this and address when we address #682 ?

@ali-ramadhan
Copy link
Member

ali-ramadhan commented Mar 6, 2020

Should probably release v0.25.2 once this is merged as this PR fixes a bug.

@glwagner
Copy link
Member Author

glwagner commented Mar 6, 2020

@ali-ramadhan I propose we merge now and edit the tendency function docstrings when we address #682, since we'll have to do it then anyways.

@ali-ramadhan
Copy link
Member

Sounds good to me! Will release v0.25.2.

@ali-ramadhan ali-ramadhan merged commit 6955699 into master Mar 6, 2020
@ali-ramadhan ali-ramadhan deleted the glw/boundary-tendency-computation branch March 6, 2020 23:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants