|
1 | 1 | @inline ∂(a,I::CartesianIndex{d},f::AbstractArray{T,d}) where {T,d} = @inbounds f[I]-f[I-δ(a,I)] |
2 | 2 | @inline ∂(a,I::CartesianIndex{m},u::AbstractArray{T,n}) where {T,n,m} = @inbounds u[I+δ(a,I),a]-u[I,a] |
3 | | -@inline ϕ(a,I,f) = @inbounds (f[I]+f[I-δ(a,I)])*0.5 |
| 3 | +@inline ϕ(a,I,f) = @inbounds (f[I]+f[I-δ(a,I)])/2 |
4 | 4 | @fastmath quick(u,c,d) = median((5c+2d-u)/6,c,median(10c-9u,c,d)) |
5 | 5 | @fastmath vanLeer(u,c,d) = (c≤min(u,d) || c≥max(u,d)) ? c : c+(d-c)*(c-u)/(d-u) |
6 | 6 | @inline ϕu(a,I,f,u,λ=quick) = @inbounds u>0 ? u*λ(f[I-2δ(a,I)],f[I-δ(a,I)],f[I]) : u*λ(f[I+δ(a,I)],f[I],f[I-δ(a,I)]) |
@@ -34,7 +34,7 @@ function median(a,b,c) |
34 | 34 | end |
35 | 35 |
|
36 | 36 | function conv_diff!(r,u,Φ;ν=0.1,perdir=()) |
37 | | - r .= 0. |
| 37 | + r .= zero(eltype(r)) |
38 | 38 | N,n = size_u(u) |
39 | 39 | for i ∈ 1:n, j ∈ 1:n |
40 | 40 | # if it is periodic direction |
@@ -109,7 +109,7 @@ struct Flow{D, T, Sf<:AbstractArray{T}, Vf<:AbstractArray{T}, Tf<:AbstractArray{ |
109 | 109 | fv, p, σ = zeros(T, Nd) |> f, zeros(T, Ng) |> f, zeros(T, Ng) |> f |
110 | 110 | V, μ₀, μ₁ = zeros(T, Nd) |> f, ones(T, Nd) |> f, zeros(T, Ng..., D, D) |> f |
111 | 111 | BC!(μ₀,ntuple(zero, D),false,perdir) |
112 | | - new{D,T,typeof(p),typeof(u),typeof(μ₁)}(u,u⁰,fv,p,σ,V,μ₀,μ₁,uBC,T[Δt],ν,g,exitBC,perdir) |
| 112 | + new{D,T,typeof(p),typeof(u),typeof(μ₁)}(u,u⁰,fv,p,σ,V,μ₀,μ₁,uBC,T[Δt],T(ν),g,exitBC,perdir) |
113 | 113 | end |
114 | 114 | end |
115 | 115 |
|
|
0 commit comments