Skip to content

Commit

Permalink
Adjusted kernels to work for multiple vertical layers again
Browse files Browse the repository at this point in the history
  • Loading branch information
jlk9 committed Aug 21, 2024
1 parent 0ca2182 commit dc72aa5
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions src/ocn/Operators.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ using KernelAbstractions
"""
@kernel function DivergenceOnCell_P1(temp, @Const(VecEdge), @Const(dvEdge), nEdges)

#iEdge, k = @index(Global, NTuple)
iEdge = @index(Global, Linear)
k = 1
iEdge, k = @index(Global, NTuple)
#iEdge = @index(Global, Linear)
#k = 1
if iEdge < nEdges + 1
@inbounds temp[k,iEdge] = VecEdge[k,iEdge] * dvEdge[iEdge]
end
Expand All @@ -27,9 +27,9 @@ end
@Const(edgeSignOnCell),
@Const(areaCell)) #::Val{n}, where {n}

#iCell, k = @index(Global, NTuple)
iCell = @index(Global, Linear)
k = 1
iCell, k = @index(Global, NTuple)
#iCell = @index(Global, Linear)
#k = 1

DivCell[k,iCell] = 0.0

Expand Down Expand Up @@ -57,17 +57,17 @@ function DivergenceOnCell!(DivCell, VecEdge, temp, Mesh::Mesh; backend=CUDABacke
kernel1! = DivergenceOnCell_P1(backend, nthreads)
kernel2! = DivergenceOnCell_P2(backend, nthreads)

#kernel1!(VecEdge, dvEdge, ndrange=(nEdges, nVertLevels))
kernel1!(temp, VecEdge, dvEdge, nEdges, ndrange=nEdges)
kernel1!(temp, VecEdge, dvEdge, nEdges, ndrange=(nEdges, nVertLevels))
#kernel1!(temp, VecEdge, dvEdge, nEdges, ndrange=nEdges)

kernel2!(DivCell,
temp,
nEdgesOnCell,
edgesOnCell,
edgeSignOnCell,
areaCell,
ndrange=nCells)
#ndrange=(nCells, nVertLevels))
#ndrange=nCells)
ndrange=(nCells, nVertLevels))

KA.synchronize(backend)

Expand Down Expand Up @@ -128,9 +128,9 @@ end
@Const(vertexDegree))

# global indicies over nVertices and vertexDegree
#iVertex, k = @index(Global, NTuple)
iVertex = @index(Global, Linear)
k = 1
iVertex, k = @index(Global, NTuple)
#iVertex = @index(Global, Linear)
#k = 1

#CurlVertex[k, iVertex] = 0.0

Expand Down Expand Up @@ -169,8 +169,8 @@ function CurlOnVertex!(CurlVertex, VecEdge, Mesh::Mesh; backend = KA.CPU())
edgeSignOnVertex,
areaTriangle,
vertexDegree,
ndrange=nVertices)
#ndrange=(nVertices, nVertLevels))
#ndrange=nVertices)
ndrange=(nVertices, nVertLevels))


KA.synchronize(backend)
Expand Down

0 comments on commit dc72aa5

Please sign in to comment.