Skip to content
Draft
Changes from all 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
10 changes: 5 additions & 5 deletions src/Flow.jl
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ accelerate!(r,t,g::Function,::Union{Nothing,Tuple}) = accelerate!(r,t,g)
accelerate!(r,t,::Nothing,U::Function) = accelerate!(r,t,(i,x,t)->ForwardDiff.derivative(τ->U(i,x,τ),t))
accelerate!(r,t,g::Function,U::Function) = accelerate!(r,t,(i,x,t)->g(i,x,t)+ForwardDiff.derivative(τ->U(i,x,τ),t))
"""
Flow{D::Int, T::Float, Sf<:AbstractArray{T,D}, Vf<:AbstractArray{T,D+1}, Tf<:AbstractArray{T,D+2}}
Flow{D::Int, T::Float, Sf<:AbstractArray{T,D}, Vf<:AbstractArray{T,D+1}, Tf<:AbstractArray{T,D+2}, UBC<:Union{NTuple{D,Number},Function}, G<:Union{Function,Nothing}}

Composite type for a multidimensional immersed boundary flow simulation.

Expand All @@ -81,7 +81,7 @@ Solid boundaries are modelled using the [Boundary Data Immersion Method](https:/
The primary variables are the scalar pressure `p` (an array of dimension `D`)
and the velocity vector field `u` (an array of dimension `D+1`).
"""
struct Flow{D, T, Sf<:AbstractArray{T}, Vf<:AbstractArray{T}, Tf<:AbstractArray{T}}
struct Flow{D, T, Sf<:AbstractArray{T}, Vf<:AbstractArray{T}, Tf<:AbstractArray{T}, UBC<:Union{NTuple{D,Number},Function}, G<:Union{Function,Nothing}}
# Fluid fields
u :: Vf # velocity vector field
u⁰:: Vf # previous velocity
Expand All @@ -93,10 +93,10 @@ struct Flow{D, T, Sf<:AbstractArray{T}, Vf<:AbstractArray{T}, Tf<:AbstractArray{
μ₀:: Vf # zeroth-moment vector
μ₁:: Tf # first-moment tensor field
# Non-fields
uBC :: Union{NTuple{D,Number},Function} # domain boundary values/function
uBC :: UBC # domain boundary values/function
Δt:: Vector{T} # time step (stored in CPU memory)
ν :: T # kinematic viscosity
g :: Union{Function,Nothing} # acceleration field funciton
g :: G # acceleration field funciton
exitBC :: Bool # Convection exit
perdir :: NTuple # tuple of periodic direction
function Flow(N::NTuple{D}, uBC; f=Array, Δt=0.25, ν=0., g=nothing,
Expand All @@ -111,7 +111,7 @@ struct Flow{D, T, Sf<:AbstractArray{T}, Vf<:AbstractArray{T}, Tf<:AbstractArray{
fv, p, σ = zeros(T, Nd) |> f, zeros(T, Ng) |> f, zeros(T, Ng) |> f
V, μ₀, μ₁ = zeros(T, Nd) |> f, ones(T, Nd) |> f, zeros(T, Ng..., D, D) |> f
BC!(μ₀,ntuple(zero, D),false,perdir)
new{D,T,typeof(p),typeof(u),typeof(μ₁)}(u,u⁰,fv,p,σ,V,μ₀,μ₁,uBC,T[Δt],T(ν),g,exitBC,perdir)
new{D,T,typeof(p),typeof(u),typeof(μ₁),typeof(uBC),typeof(g)}(u,u⁰,fv,p,σ,V,μ₀,μ₁,uBC,T[Δt],T(ν),g,exitBC,perdir)
end
end

Expand Down