Skip to content

Commit

Permalink
tweak previous commit
Browse files Browse the repository at this point in the history
  • Loading branch information
gaelforget committed Nov 7, 2024
1 parent 0aa8c45 commit a574809
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/Operations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ end

function gradient(inFLD::MeshArray::NamedTuple,doDIV::Bool)

exFLD=exchange(inFLD,1)
exFLD=exchange(inFLD,1).MA
dFLDdx=similar(inFLD)
dFLDdy=similar(inFLD)

for a=1:inFLD.grid.nFaces
(s1,s2)=size(exFLD.MA.f[a])
tmpA=view(exFLD.MA.f[a],2:s1-1,2:s2-1)
tmpB=tmpA-view(exFLD.MA.f[a],1:s1-2,2:s2-1)
tmpC=tmpA-view(exFLD.MA.f[a],2:s1-1,1:s2-2)
(s1,s2)=size(exFLD.f[a])
tmpA=view(exFLD.f[a],2:s1-1,2:s2-1)
tmpB=tmpA-view(exFLD.f[a],1:s1-2,2:s2-1)
tmpC=tmpA-view(exFLD.f[a],2:s1-1,1:s2-2)
if doDIV
dFLDdx.f[a]=tmpB./Γ.DXC.f[a]
dFLDdy.f[a]=tmpC./Γ.DYC.f[a]
Expand All @@ -63,15 +63,15 @@ end

function gradient(inFLD::MeshArray,iDXC::MeshArray,iDYC::MeshArray)

exFLD=exchange(inFLD,1)
exFLD=exchange(inFLD,1).MA
dFLDdx=similar(inFLD)
dFLDdy=similar(inFLD)

for a=1:inFLD.grid.nFaces
(s1,s2)=size(exFLD.MA.f[a])
tmpA=view(exFLD.MA.f[a],2:s1-1,2:s2-1)
tmpB=tmpA-view(exFLD.MA.f[a],1:s1-2,2:s2-1)
tmpC=tmpA-view(exFLD.MA.f[a],2:s1-1,1:s2-2)
(s1,s2)=size(exFLD.f[a])
tmpA=view(exFLD.f[a],2:s1-1,2:s2-1)
tmpB=tmpA-view(exFLD.f[a],1:s1-2,2:s2-1)
tmpC=tmpA-view(exFLD.f[a],2:s1-1,1:s2-2)
dFLDdx.f[a]=tmpB.*iDXC.f[a]
dFLDdy.f[a]=tmpC.*iDYC.f[a]
end
Expand Down

0 comments on commit a574809

Please sign in to comment.