Skip to content

Commit

Permalink
kind of GPU frieldly
Browse files Browse the repository at this point in the history
  • Loading branch information
jagoosw committed Dec 12, 2024
1 parent ff0c79e commit 3257eec
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/boundary_mean.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ end
@inline (bam::BoundaryAdjacentMean)(args...) = bam.value[]

Adapt.adapt_structure(to, mo::BoundaryAdjacentMean) =
BoundaryAdjacentMean(adapt(to, mo.mean_outflow_velocity[]))
BoundaryAdjacentMean(; value = adapt(to, mo.value[]))

const MOPABC = BoundaryCondition{<:Open{<:PerturbationAdvection}, <:BoundaryAdjacentMean}

Expand Down Expand Up @@ -50,9 +50,11 @@ function update_boundary_condition!(bc::MOPABC, val_side, u, model)

(i, j, k), dims = boundary_adjacent_index(val_side, grid, loc)

total_area = sum(An; dims)[i, j, k]
total_area = CUDA.@allowscalar sum(An; dims)[i, j, k]

= sum(u * An; dims) / total_area

bc.condition.value[] = Ū[i, j, k]
bc.condition.value[] = CUDA.@allowscalar Ū[i, j, k]

return nothing
end

0 comments on commit 3257eec

Please sign in to comment.