AMReX-Fluids / IAMR

A parallel, adaptive mesh refinement (AMR) code that solves the variable-density incompressible Navier-Stokes equations.
https://amrex-fluids.github.io/IAMR/
80 stars 57 forks source link

Incorrect finite difference stencils in computing vorticity magnitude #38

Closed mameehan5 closed 4 years ago

mameehan5 commented 4 years ago

Hi all,

It appears to be that the single-sided difference stencils in computing vorticity magnitude in IAMR/DERIVE_ND.F90. I would have expected: uylo(i,j,k) = (U(i,j+1,k)+three*U(i,j,k)-four*U(i,j-1,k))/(three*dy) to be uylo(i,j,k) = (-three*U(i,j,k)+four*U(i,j+1,k)-U(i,j+2,k))/(two*dy), etc. Maybe I am possibly misinterpreting the code? I am happy to make the corrections if this is an issue.

Thanks! Mike

WeiqunZhang commented 4 years ago

I believe what's in the code is correct. If (i,j-1,k) is at external Dirichlet boundary, it is assumed to be on the face of the domain (i.e., -dy/2 from (i,j,k)), and we do have values there. It's not a completely one-sided stencil, it's a biased stencil.

mameehan5 commented 4 years ago

Ah, okay! That make sense to me after reading more about the biased stencils. Thanks!