-
Notifications
You must be signed in to change notification settings - Fork 7
Compute reference density with derivative #185
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
Open
glwagner
wants to merge
14
commits into
main
Choose a base branch
from
glw/ref-integral
base: main
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.
Open
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
6d3678c
compute reference pressure with integral
glwagner d33613f
compute density from pressure
glwagner 312e3b3
clean up?
glwagner c2a44ba
Merge branch 'main' into glw/ref-integral
glwagner df38360
Merge branch 'main' into glw/ref-integral
glwagner 0a49c6a
Add partial derivative operator to imports
glwagner bf9dac5
Merge branch 'main' into glw/ref-integral
glwagner fae0a01
Apply suggestions from code review
giordano a09cbcf
Merge branch 'main' into glw/ref-integral
giordano b0ecdd5
Merge branch 'main' into glw/ref-integral
glwagner 7972fca
rm whitespace
glwagner 1e3feca
Merge branch 'main' into glw/ref-integral
glwagner b2c781e
Fix discrete hydrostatic balance at top boundary in reference state
glwagner 31542cc
Fix discrete hydrostatic balance in reference state and update tests
glwagner 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 hidden or 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 hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -48,12 +48,13 @@ end | |
| @testset let p₀ = p₀, θ₀ = θ₀, formulation = formulation | ||
| reference_state = ReferenceState(grid, constants, surface_pressure=p₀, potential_temperature=θ₀) | ||
|
|
||
| # Check that interpolating to the first face (k=1) recovers surface values | ||
| # Note: surface_density correctly converts potential temperature to temperature using the Exner function | ||
| # Check that interpolating to the first face (k=1) approximately recovers surface values. | ||
| # Uses rtol=1e-4 because GradientBoundaryCondition is used for discrete hydrostatic balance, | ||
| # which introduces small interpolation errors at the surface. | ||
|
Comment on lines
+52
to
+53
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the comment, it preempted my question! 😃 |
||
| ρ₀ = surface_density(reference_state) | ||
| for i = 1:Nx, j = 1:Ny | ||
| @test p₀ ≈ @allowscalar ℑzᵃᵃᶠ(i, j, 1, grid, reference_state.pressure) | ||
| @test ρ₀ ≈ @allowscalar ℑzᵃᵃᶠ(i, j, 1, grid, reference_state.density) | ||
| @test isapprox(p₀, @allowscalar(ℑzᵃᵃᶠ(i, j, 1, grid, reference_state.pressure)), rtol=FT(1e-4)) | ||
| @test isapprox(ρ₀, @allowscalar(ℑzᵃᵃᶠ(i, j, 1, grid, reference_state.density)), rtol=FT(1e-4)) | ||
| end | ||
|
|
||
| dynamics = AnelasticDynamics(reference_state) | ||
|
|
||
This file contains hidden or 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 hidden or 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.
These lines are accessing individual elements of
z, which causes the "Scalar indexing is disallowed" error on GPU.