Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Curl Operation #163

Open
anthony-meza opened this issue Dec 17, 2024 · 0 comments
Open

Curl Operation #163

anthony-meza opened this issue Dec 17, 2024 · 0 comments

Comments

@anthony-meza
Copy link
Contributor

"""
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###
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant