Mercurial > repos > public > sbplib_julia
comparison src/Grids/mapped_grid.jl @ 1841:1c58005429fd feature/grids/manifolds
Merge default
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Tue, 22 Oct 2024 08:50:23 +0200 |
parents | 2b5f81e288f1 f21bfc5f21aa |
children | f2b32da29b73 |
comparison
equal
deleted
inserted
replaced
1801:2b5f81e288f1 | 1841:1c58005429fd |
---|---|
171 The outward pointing normal as a grid function on the corresponding boundary grid. | 171 The outward pointing normal as a grid function on the corresponding boundary grid. |
172 """ | 172 """ |
173 function normal(g::MappedGrid, boundary) | 173 function normal(g::MappedGrid, boundary) |
174 b_indices = boundary_indices(g, boundary) | 174 b_indices = boundary_indices(g, boundary) |
175 σ = _boundary_sign(component_type(g), boundary) | 175 σ = _boundary_sign(component_type(g), boundary) |
176 | |
177 # TODO: Refactor this when `boundary_indices(g, ...)` has been made iterable. | |
176 return map(jacobian(g)[b_indices...]) do ∂x∂ξ | 178 return map(jacobian(g)[b_indices...]) do ∂x∂ξ |
177 ∂ξ∂x = inv(∂x∂ξ) | 179 ∂ξ∂x = inv(∂x∂ξ) |
178 k = grid_id(boundary) | 180 k = grid_id(boundary) |
179 σ*∂ξ∂x[k,:]/norm(∂ξ∂x[k,:]) | 181 σ*∂ξ∂x[k,:]/norm(∂ξ∂x[k,:]) |
180 end | 182 end |
181 end | 183 end |
182 | 184 |
185 """ | |
186 normal(g::MappedGrid, boundary, i...) | |
187 | |
188 The outward pointing normal to the specified boundary in grid point `i`. | |
189 """ | |
183 function normal(g::MappedGrid, boundary, i...) | 190 function normal(g::MappedGrid, boundary, i...) |
184 σ = _boundary_sign(component_type(g), boundary) | 191 σ = _boundary_sign(component_type(g), boundary) |
185 ∂ξ∂x = inv(jacobian(g)[i...]) | 192 ∂ξ∂x = inv(jacobian(g)[i...]) |
186 | 193 |
187 k = grid_id(boundary) | 194 k = grid_id(boundary) |