-
Notifications
You must be signed in to change notification settings - Fork 13
Open
Description
MeshArrays.jl/src/Operations.jl
Lines 84 to 116 in dd3f19a
| """ | |
| curl(u::MeshArray,v::MeshArray,Γ::NamedTuple) | |
| Compute curl of a velocity field. | |
| """ | |
| function curl(u::MeshArray,v::MeshArray,Γ::NamedTuple) | |
| uvcurl=similar(Γ.XC) | |
| fac=exchange(1.0 ./Γ.RAZ,1) | |
| (U,V)=exchange(u,v,1) | |
| (DXC,DYC)=exchange(Γ.DXC,Γ.DYC,1) | |
| [DXC.MA[i].=abs.(DXC.MA[i]) for i in eachindex(U.MA)] | |
| [DYC.MA[i].=abs.(DYC.MA[i]) for i in eachindex(V.MA)] | |
| for i in eachindex(U.MA) | |
| ucur=U.MA[i][2:end,:] | |
| vcur=V.MA[i][:,2:end] | |
| tmpcurl=ucur[:,1:end-1]-ucur[:,2:end] | |
| tmpcurl=tmpcurl-(vcur[1:end-1,:]-vcur[2:end,:]) | |
| tmpcurl=tmpcurl.*fac.MA[i][1:end-1,1:end-1] | |
| ##still needed: | |
| ##- deal with corners | |
| ##- if putCurlOnTpoints | |
| tmpcurl=1/4*(tmpcurl[1:end-1,2:end]+tmpcurl[1:end-1,1:end-1]+ | |
| tmpcurl[2:end,2:end]+tmpcurl[2:end,1:end-1]) | |
| uvcurl[i]=tmpcurl | |
| end | |
| return uvcurl | |
| end |
Should U and V fields be weighted by some distance before computing the curl?
E.g.,
[DXC[i].=abs.(DXC[i]) for i in eachindex(U)]
[DYC[i].=abs.(DYC[i]) for i in eachindex(V)]
#not currently in code
U_DY = U .* DYC #weight by length of opposing side
V_DX = V .* DXC
###compute curl afterward###
Metadata
Metadata
Assignees
Labels
No labels