diff src/SbpOperators/boundaryops/normal_derivative.jl @ 1654:f4dc17cfafce feature/sbp_operators/laplace_curvilinear

Start adding normal derivative for mapped grid
author Jonatan Werpers <jonatan@werpers.com>
date Wed, 26 Jun 2024 14:41:50 +0200
parents 08f06bfacd5c
children 89456aa6fa80
line wrap: on
line diff
--- a/src/SbpOperators/boundaryops/normal_derivative.jl	Wed Jun 26 13:42:19 2024 +0200
+++ b/src/SbpOperators/boundaryops/normal_derivative.jl	Wed Jun 26 14:41:50 2024 +0200
@@ -28,3 +28,14 @@
     scaled_stencil = scale(closure_stencil,h_inv)
     return BoundaryOperator(g, scaled_stencil, boundary)
 end
+
+function normal_derivative(g::MappedGrid, stencil_set::StencilSet, boundary)
+    g⁻¹ = geometric_tensor_inverse(g) # Extract boundary part
+    k = NaN # Dimension of boundary
+    mapreduce(1:ndims(g)) do i
+        gᵏⁱ = componentview(g⁻¹,k,i)
+        gᵏᵏ = componentview(g⁻¹,k,k)
+        # ∂ξᵢ = ...
+        DiagonalTensor(gᵏⁱ./sqrt.(gᵏᵏ)) * ∂ξᵢ # Should the metric expression be mapped lazily?
+    end
+end