MeshArrays.jl
MeshArrays.jl copied to clipboard
Interpolating tracers to cell faces
Coordinates of velocity fields (Γ.XS, Γ.YS, Γ.XW, Γ.YW) seem to have some spurious discontinuities. For example, look at Γ.XS[1]. I think I have recreated these variables, but it requires a call to exch_UV
Here is an example of the code that I use. Heavily based of the convergence
function
function tofaces(uFLD::MeshArrays.gcmarray{T, 1, Matrix{T}},
vFLD::MeshArrays.gcmarray{T, 1, Matrix{T}}) where T<:Real
Ugrid = T.(similar(uFLD))
Vgrid = T.(similar(uFLD))
(tmpU,tmpV)=exch_UV(uFLD,vFLD)
for a in 1:5
(s1,s2)=size(uFLD.f[a])
tmpU1=view(tmpU.f[a],1:s1,1:s2)
tmpU2=view(tmpU.f[a],2:s1+1,1:s2)
tmpV1=view(tmpV.f[a],1:s1,1:s2)
tmpV2=view(tmpV.f[a],1:s1,2:s2+1)
Ugrid.f[a] =(tmpU1+tmpU2) / 2
Vgrid.f[a] =(tmpV1+tmpV2) / 2
end
return Ugrid, Vgrid
end
@time XW, XS = tofaces(Γ.XC, Γ.XC)
@time YW, YS = tofaces(Γ.YC, Γ.YC)