Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance immersed boundary grid docs #3505

Merged
merged 5 commits into from
Mar 14, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions src/ImmersedBoundaries/grid_fitted_bottom.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,18 @@ struct InterfaceImmersedCondition end
Base.summary(::CenterImmersedCondition) = "CenterImmersedCondition"
Base.summary(::InterfaceImmersedCondition) = "InterfaceImmersedCondition"

"""
GridFittedBottom(bottom_height, [immersed_condition=CenterImmersedCondition()])

Return an immersed boundary with an irregular bottom fit to the underlying grid.
"""
struct GridFittedBottom{H, I} <: AbstractGridFittedBottom{H}
bottom_height :: H
immersed_condition :: I
end

const GFBIBG = ImmersedBoundaryGrid{<:Any, <:Any, <:Any, <:Any, <:Any, <:GridFittedBottom}

"""
GridFittedBottom(bottom_height, [immersed_condition=CenterImmersedCondition()])

Return an immersed boundary with an irregular bottom fit to the underlying grid.
navidcy marked this conversation as resolved.
Show resolved Hide resolved
"""
GridFittedBottom(bottom_height) = GridFittedBottom(bottom_height, CenterImmersedCondition())

function Base.summary(ib::GridFittedBottom)
Expand Down Expand Up @@ -65,9 +65,9 @@ end
"""
ImmersedBoundaryGrid(grid, ib::GridFittedBottom)

Return a grid with `GridFittedBottom` immersed boundary.
Return a grid with `GridFittedBottom` immersed boundary (`ib`).

Computes ib.bottom_height and wraps in an array.
Computes `ib.bottom_height` and wraps it in a Field.
"""
function ImmersedBoundaryGrid(grid, ib::GridFittedBottom)
bottom_field = Field{Center, Center, Nothing}(grid)
Expand All @@ -81,16 +81,17 @@ end
@inline function _immersed_cell(i, j, k, underlying_grid, ib::GridFittedBottom{<:Any, <:InterfaceImmersedCondition})
z = znode(i, j, k+1, underlying_grid, c, c, f)
h = @inbounds ib.bottom_height[i, j, 1]
return z <= h
return z h
end

@inline function _immersed_cell(i, j, k, underlying_grid, ib::GridFittedBottom{<:Any, <:CenterImmersedCondition})
z = znode(i, j, k, underlying_grid, c, c, c)
h = @inbounds ib.bottom_height[i, j, 1]
return z <= h
return z h
end

@inline z_bottom(i, j, ibg::GFBIBG) = @inbounds ibg.immersed_boundary.bottom_height[i, j, 1]

on_architecture(arch, ib::GridFittedBottom) = GridFittedBottom(ib.bottom_height, ib.immersed_condition)

function on_architecture(arch, ib::GridFittedBottom{<:Field})
Expand All @@ -104,4 +105,3 @@ end

Adapt.adapt_structure(to, ib::GridFittedBottom) = GridFittedBottom(adapt(to, ib.bottom_height),
ib.immersed_condition)

1 change: 0 additions & 1 deletion src/ImmersedBoundaries/grid_fitted_boundary.jl
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,3 @@ on_architecture(arch, ib::GridFittedBoundary{<:Field}) = GridFittedBoundary(comp
on_architecture(arch, ib::GridFittedBoundary) = ib # need a workaround...

Adapt.adapt_structure(to, ib::AbstractGridFittedBoundary) = GridFittedBoundary(adapt(to, ib.mask))

6 changes: 3 additions & 3 deletions src/ImmersedBoundaries/immersed_boundary_condition.jl
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ Base.show(io::IO, ibc::IBC) =
"""
ImmersedBoundaryCondition(; interfaces...)

Return an ImmersedBoundaryCondition with conditions on individual
cell `interfaces ∈ (west, east, south, north, bottom, top)`
between the fluid and immersed boundary.
Return an `ImmersedBoundaryCondition` with conditions on individual cell
`interfaces ∈ (west, east, south, north, bottom, top)` between the fluid
and the immersed boundary.
"""
function ImmersedBoundaryCondition(; west = nothing,
east = nothing,
Expand Down