Skip to content

Commit

Permalink
Fix bug with PolarGrid
Browse files Browse the repository at this point in the history
  • Loading branch information
mncrowe committed Nov 12, 2024
1 parent a32ebe9 commit 9cc5251
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ Full descriptions can be found on the [List of Functions](https://mncrowe.github
| `Eval_w_SQG` | `src/create_modon.jl` | Function | Evaluates w at (non-surface) depths in the SQG model |
| `Calc_∇` | `src/create_modon.jl` | Function | Calculates the x and y derivatives of a given field |
| `CartesianGrid` | `src/create_modon.jl` | Function | Outputs 2D (x, y) Arrays from `grid` |
| `PolarGrid` | `src/create_modon.jl` | Function | Outputs 2D (r, θ) Arrays from `grid` |
| `PolarGrid` | `src/create_modon.jl` | Function | Outputs 2D (r, θ) Arrays created from `CartesianGrid` outputs |


[^1]: [Johnson, E. R., and M. N. Crowe, 2023, Oceanic dipoles in a surface quasigeostrophic model, J. Fluid Mech., 958, R2](https://doi.org/10.1017/jfm.2023.87).
Expand Down
16 changes: 8 additions & 8 deletions src/create_modon.jl
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ function Calc_ψq(a::Array, U::Number, ℓ::Number, R::Union{Number,Vector}, β:
# Create Cartesian and polar grids

x, y = CartesianGrid(grid)
r, θ = PolarGrid(grid, x₀)
r, θ = PolarGrid(x, y, x₀)

# Define temporary variable for RHS terms

Expand Down Expand Up @@ -276,7 +276,7 @@ function Calc_ψb(a::Array, U::Number, ℓ::Number, R::Vector, β::Number, grid,
# Create Cartesian and polar grids

x, y = CartesianGrid(grid)
r, θ = PolarGrid(grid, x₀)
r, θ = PolarGrid(x, y, x₀)

# Define temporary variable for RHS terms

Expand Down Expand Up @@ -547,7 +547,7 @@ function CreateLCD(grid, U::Number=1, ℓ::Number=1, x₀::Vector=[0, 0], α::Nu
# Create Cartesian and polar grids

x, y = CartesianGrid(grid)
r, θ = PolarGrid(grid, x₀)
r, θ = PolarGrid(x, y, x₀)

# Calculate ψ and q using analytic result

Expand Down Expand Up @@ -619,7 +619,7 @@ function CreateLRD(grid, U::Number=1, ℓ::Number=1, R::Number=1, β::Number=0,
# Create Cartesian and polar grids

x, y = CartesianGrid(grid)
r, θ = PolarGrid(grid, x₀)
r, θ = PolarGrid(x, y, x₀)

# Calculate ψ and q using analytic result

Expand Down Expand Up @@ -875,15 +875,15 @@ function CartesianGrid(grid)
end

"""
Function: `PolarGrid(grid, x₀)`
Function: `PolarGrid(x, y, x₀)`
Calculates the polar coordinates from `grid` as two-dimensional Array centred on `x₀`
Calculates the polar coordinates from (`x`, `y`) as two-dimensional Array centred on `x₀`
Arguments:
- `grid`: grid structure containing kr and l
- `x`, `y`: 2D Arrays for x and y, created using `CartesianGrid`
- `x₀`: Vector
"""
function PolarGrid(grid, x₀::Vector=[0])
function PolarGrid(x, y, x₀::Vector=[0])

r = @. sqrt((x-x₀[1])^2 + (y-x₀[2])^2)
θ = @. atan(y-x₀[2], x-x₀[1])
Expand Down

0 comments on commit 9cc5251

Please sign in to comment.