-
Notifications
You must be signed in to change notification settings - Fork 16
Features to support surface physics #135
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
Merged
Merged
Changes from all commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
45f6645
new constants
oelbert 453d033
adding some stencils and the stefan-boltzman constant
oelbert 5c1028b
adding namelist switches
oelbert 06ccaf4
merge develop
oelbert 08047cd
Merge branch 'feature/4d_data' into feature/lsm
oelbert d2bc643
add dtypes
oelbert 0abfe57
update dtypes
oelbert ee07993
hydlb
oelbert d5d65c1
add triple point temp
oelbert 171d123
Merge branch 'develop' into feature/lsm
oelbert ac211bf
cleanup of some constants
oelbert ab690a6
adding lsoil for lsm
oelbert 71b070c
add method to create array from compute domain
oelbert 8294a88
try ndim not 4d
oelbert 7bb467f
iop
oelbert cdb4588
adding masked tridiag
oelbert 638ecdc
added default stzrt to nd storage data
oelbert b1e249b
bool data handling
oelbert b33061e
Merge branch 'feature/lsm' of github.com:oelbert/NDSL into feature/lsm
oelbert eb1b3de
merged develop
oelbert a7163db
oops
oelbert 4190029
added keyword to translate indices between Fortran and Python for tra…
oelbert 0e111a0
ndsl/stencils/testing/translate.py
oelbert fb7fab7
remove break
oelbert 9f2371b
adding triple point constant
oelbert c9cf275
merge
oelbert d5d5021
update namelist
oelbert 920370e
oops
oelbert 0abee5d
better default
oelbert d395d9d
Merge branch 'feature/index_tests' of github.com:oelbert/NDSL into fe…
oelbert 88c83c9
merge index tests
oelbert 0c05368
merge develop
oelbert 0322a3a
intermediate commmit
oelbert f1f10e4
docstrings
oelbert 70d40fb
linting
oelbert 5cdcd79
Merge branch 'develop' into feature/lsm
romanc 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
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
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 |
|---|---|---|
| @@ -0,0 +1,89 @@ | ||
| from gt4py.cartesian.gtscript import BACKWARD, FORWARD, computation, interval | ||
|
|
||
| from ndsl.dsl.typing import BoolFieldIJ, FloatField | ||
|
|
||
|
|
||
| def tridiag_solve( | ||
| a: FloatField, | ||
| b: FloatField, | ||
| c: FloatField, | ||
| d: FloatField, | ||
| x: FloatField, | ||
| delta: FloatField, | ||
| ): | ||
| """ | ||
| This stencil solves a square, k x k tridiagonal matrix system | ||
| with coefficients a, b, and c, and vectors p and d using the Thomas algorithm: | ||
| ! ### ### ### ### ### ###! | ||
| ! #b(0), c(0), 0 , 0 , 0 , . . . , 0 # # x(0) # # d(0) #! | ||
| ! #a(1), b(1), c(1), 0 , 0 , . . . , 0 # # x(1) # # d(1) #! | ||
| ! # 0 , a(2), b(2), c(2), 0 , . . . , 0 # # x(2) # # d(2) #! | ||
| ! # 0 , 0 , a(3), b(3), c(3), . . . , 0 # # x(3) # # d(3) #! | ||
| ! # 0 , 0 , 0 , a(4), b(4), . . . , 0 # # x(4) # # d(4) #! | ||
| ! # . . # # . # = # . #! | ||
| ! # . . # # . # # . #! | ||
| ! # . . # # . # # . #! | ||
| ! # 0 , . . . , 0 , a(k-2), b(k-2), c(k-2), 0 # #x(k-3)# #d(k-3)#! | ||
| ! # 0 , . . . , 0 , 0 , a(k-1), b(k-1), c(k-1)# #x(k-2)# #d(k-2)#! | ||
| ! # 0 , . . . , 0 , 0 , 0 , a(k) , b(k) # #x(k-1)# #d(k-1)#! | ||
| ! ### ### ### ### ### ###! | ||
|
|
||
| Args: | ||
| a (in): lower-diagonal matrix coefficients | ||
| b (in): diagonal matrix coefficients | ||
| c (in): upper-diagonal matrix coefficients | ||
| d (in): Result vector | ||
| x (out): The vector to solve for | ||
| delta (out): d post-pivot | ||
| """ | ||
| with computation(FORWARD): # Forward sweep | ||
| with interval(0, 1): | ||
| x = c / b | ||
| delta = d / b | ||
| with interval(1, None): | ||
| x = c / (b - a * x[0, 0, -1]) | ||
| delta = (d - a * delta[0, 0, -1]) / (b - a * x[0, 0, -1]) | ||
| with computation(BACKWARD): # Reverse sweep | ||
| with interval(-1, None): | ||
| x = delta | ||
| with interval(0, -1): | ||
| x = delta - x * x[0, 0, 1] | ||
|
|
||
|
|
||
| def masked_tridiag_solve( | ||
| a: FloatField, | ||
| b: FloatField, | ||
| c: FloatField, | ||
| d: FloatField, | ||
| x: FloatField, | ||
| delta: FloatField, | ||
| mask: BoolFieldIJ, | ||
| ): | ||
| """ | ||
| Same as tridiag_solve but restricted to a subset of horizontal points | ||
|
|
||
| Args: | ||
| a (in): lower-diagonal matrix coefficients | ||
| b (in): diagonal matrix coefficients | ||
| c (in): upper-diagonal matrix coefficients | ||
| d (in): Result vector | ||
| mask (in): Columns to execute the stencil on | ||
| x (out): The vector to solve for | ||
| delta (out): d post-pivot | ||
| """ | ||
| with computation(FORWARD): # Forward sweep | ||
| with interval(0, 1): | ||
| if mask: | ||
| x = c / b | ||
| delta = d / b | ||
| with interval(1, None): | ||
| if mask: | ||
| x = c / (b - a * x[0, 0, -1]) | ||
| delta = (d - a * delta[0, 0, -1]) / (b - a * x[0, 0, -1]) | ||
| with computation(BACKWARD): # Reverse sweep | ||
| with interval(-1, None): | ||
| if mask: | ||
| x = delta | ||
| with interval(0, -1): | ||
| if mask: | ||
| x = delta - x * x[0, 0, 1] | ||
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.
Uh oh!
There was an error while loading. Please reload this page.