fix: add velocity to nodal function

This commit is contained in:
Jonas Juselius
2024-11-27 12:01:18 +01:00
parent 35e1f43fc0
commit ed0ac797d3

View File

@@ -361,7 +361,7 @@ module Util =
Sx / a, Sy / a, r
static member propToNodal (nIdx: NeighborIndex) (s: float []) =
[| 0 .. nIdx.NodesAroundNode.Count - 1 |]
[| 0 .. nIdx.NodesAroundNode.Count - 1 |] // total number of nodes
|> Array.Parallel.map (fun i ->
let ns = nIdx.ElemsAroundNode[i]
ns
@@ -369,7 +369,7 @@ module Util =
|> (*) (1. / float ns.Length))
static member speedToNodal (nIdx: NeighborIndex) (s: (float * float) []) =
[| 0 .. nIdx.NodesAroundNode.Count - 1 |]
[| 0 .. nIdx.NodesAroundNode.Count - 1 |] // total number of nodes
|> Array.Parallel.map (fun i ->
let ns = nIdx.ElemsAroundNode[i]
ns
@@ -380,6 +380,19 @@ module Util =
0.
|> (*) (1. / float ns.Length))
static member velocityToNodal (nIdx: NeighborIndex) (s: (float * float) []) =
[| 0 .. nIdx.NodesAroundNode.Count - 1 |] // total number of nodes
|> Array.Parallel.map (fun i ->
let ns = nIdx.ElemsAroundNode[i]
let n = float ns.Length
ns
|> Array.fold
(fun (au, av) n ->
let u, v = s[n]
u + au, v + av)
(0., 0.)
|> fun (u, v) -> u / n, v / n)
type Node =
static member calcNodeControlArea (idx: NeighborIndex) (grid: IGrid) =
let half = (*) 0.5
@@ -670,4 +683,4 @@ type ExtendedGrid(grid: IGrid) =
elementTree <- binarySerializer.UnPickle<IdxTree> pickle |> Some
true
else
false
false