diff --git a/src/Flow.jl b/src/Flow.jl index eaf0d7c..9dbd39e 100644 --- a/src/Flow.jl +++ b/src/Flow.jl @@ -121,6 +121,13 @@ struct Flow{D, T, Sf<:AbstractArray{T}, Vf<:AbstractArray{T}, Tf<:AbstractArray{ end end +""" + time(a::Flow) + +Current flow time. +""" +time(a::Flow) = sum(@view(a.Δt[1:end-1])) + function BDIM!(a::Flow) dt = a.Δt[end] @loop a.f[Ii] = a.u⁰[Ii]+dt*a.f[Ii]-a.V[Ii] over Ii in CartesianIndices(a.f) diff --git a/src/WaterLily.jl b/src/WaterLily.jl index 9f588d2..bdb39de 100644 --- a/src/WaterLily.jl +++ b/src/WaterLily.jl @@ -77,7 +77,7 @@ struct Simulation end end -time(sim::Simulation) = sum(@view(sim.flow.Δt[1:end-1])) +time(sim::Simulation) = time(sim.flow) """ sim_time(sim::Simulation) diff --git a/src/util.jl b/src/util.jl index 72b08ec..5edc8be 100644 --- a/src/util.jl +++ b/src/util.jl @@ -228,6 +228,6 @@ function interp(x::SVector{D}, arr::AbstractArray{T,D}) where {D,T} end function interp(x::SVector{D}, varr::AbstractArray) where {D} # Shift to align with each staggered grid component and interpolate - @inline shift(i) = SVector{D}(ifelse(i==j,0.5f0,0f0) for j in 1:D) + @inline shift(i) = SVector{D}(ifelse(i==j,0.5,0.0) for j in 1:D) return SVector{D}(interp(x+shift(i),@view(varr[..,i])) for i in 1:D) end \ No newline at end of file