Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ nav:
- "constants": docstrings/top/constants.md
- "io": docstrings/top/io.md
- "logging": docstrings/top/logging.md
- "namelist": docstrings/top/namelist.md
- "optional_imports": docstrings/top/optional_imports.md
- "types": docstrings/top/types.md
- "typing": docstrings/top/typing.md
Expand Down
2 changes: 1 addition & 1 deletion ndsl/quantity/quantity.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ def transpose(
>>> quantity = Quantity(
... data=np.zeros([2, 3, 4]),
... dims=[I_DIM, J_DIM, K_DIM],
... units="m",
... units="m",
... )

If you know you are working with cell-centered variables, you can do:
Expand Down
57 changes: 30 additions & 27 deletions ndsl/stencils/tridiag.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,30 @@ def tridiag_solve(
"""
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)#!
! ### ### ### ### ### ###!

```
### ### ### ### ### ###
#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
a: lower-diagonal matrix coefficients
b: diagonal matrix coefficients
c: upper-diagonal matrix coefficients
d: Result vector
x: The vector to solve for
delta: d post-pivot
"""
with computation(FORWARD): # Forward sweep
with interval(0, 1):
Expand All @@ -60,16 +63,16 @@ def masked_tridiag_solve(
mask: BoolFieldIJ,
) -> None:
"""
Same as tridiag_solve but restricted to a subset of horizontal points
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
a: lower-diagonal matrix coefficients
b: diagonal matrix coefficients
c: upper-diagonal matrix coefficients
d: Result vector
mask: Columns to execute the stencil on
x: The vector to solve for
delta: d post-pivot
"""
with computation(FORWARD): # Forward sweep
with interval(0, 1):
Expand Down