Mercurial > repos > public > sbplib_julia
changeset 1798:25dbb1c02ddc feature/grids/curvilinear
Add function for getting the normal in a given boundary point
| author | Jonatan Werpers <jonatan@werpers.com> |
|---|---|
| date | Tue, 01 Oct 2024 11:46:22 +0200 |
| parents | a6deaf70862b |
| children | 8583f6379bd8 |
| files | src/Grids/mapped_grid.jl |
| diffstat | 1 files changed, 10 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
diff -r a6deaf70862b -r 25dbb1c02ddc src/Grids/mapped_grid.jl --- a/src/Grids/mapped_grid.jl Tue Oct 01 11:37:51 2024 +0200 +++ b/src/Grids/mapped_grid.jl Tue Oct 01 11:46:22 2024 +0200 @@ -172,7 +172,7 @@ """ function normal(g::MappedGrid, boundary) b_indices = boundary_indices(g, boundary) - σ =_boundary_sign(component_type(g), boundary) + σ = _boundary_sign(component_type(g), boundary) return map(jacobian(g)[b_indices...]) do ∂x∂ξ ∂ξ∂x = inv(∂x∂ξ) k = grid_id(boundary) @@ -180,6 +180,15 @@ end end +function normal(g::MappedGrid, boundary, i) + σ = _boundary_sign(component_type(g), boundary) + ∂ξ∂x = inv(jacobian(g)[i]) + + k = grid_id(boundary) + return σ*∂ξ∂x[k,:]/norm(∂ξ∂x[k,:]) +end + + function _boundary_sign(T, boundary) if boundary_id(boundary) == UpperBoundary() return one(T)
