From: mortain on
Hello,
I have a parallelepiped, structured mesh, which means that he is
divided in nodes. I have the velocity vector for each node and I want
to evaluate the vorticity vector, which is:
w_x=(f(x,y+1,z)-f(x,y,z))-(f(x,y,z+1)-f(x,y,z))
w_y=(f(x,y,z+1)-f(x,y,z))-(f(x+1,y,z)-f(x,y,z))
w_z=(f(x+1,y,z)-f(x,y,z))-(f(x,y+1,z)-f(x,y,z))

SO for each node (x,y,z) I have to evaluate the velocities at the
neighbouring nodes (x+1,y,z),(x,y+1,z) and (x,y,z+1). I don't have any
idea about how to implement this do loop that calculates the
velocities at the three neighbouring nodes and at the node and
calculate the vorticity.

Have you got any udea, please?

Thank you for your time

Antonio
From: Gib Bogle on
mortain wrote:
> Hello,
> I have a parallelepiped, structured mesh, which means that he is
> divided in nodes. I have the velocity vector for each node and I want
> to evaluate the vorticity vector, which is:
> w_x=(f(x,y+1,z)-f(x,y,z))-(f(x,y,z+1)-f(x,y,z))
> w_y=(f(x,y,z+1)-f(x,y,z))-(f(x+1,y,z)-f(x,y,z))
> w_z=(f(x+1,y,z)-f(x,y,z))-(f(x,y+1,z)-f(x,y,z))
>
> SO for each node (x,y,z) I have to evaluate the velocities at the
> neighbouring nodes (x+1,y,z),(x,y+1,z) and (x,y,z+1). I don't have any
> idea about how to implement this do loop that calculates the
> velocities at the three neighbouring nodes and at the node and
> calculate the vorticity.
>
> Have you got any udea, please?

I don't much like your difference equations for the vorticity vector components,
because they are not centred on (x,y,z). But putting that aside, if the x index
ranges from 1 to NX, y from 1 to NY and z from 1 to NZ, you can do:

do z = 1,NZ-1
do y = 1,NY-1
do x = 1,NX-1
w_x=(f(x,y+1,z)-f(x,y,z))-(f(x,y,z+1)-f(x,y,z))
w_y=(f(x,y,z+1)-f(x,y,z))-(f(x+1,y,z)-f(x,y,z))
w_z=(f(x+1,y,z)-f(x,y,z))-(f(x,y+1,z)-f(x,y,z))
v(:,x,y,z) = (/ w_x, w_y, w_z /) ! presumably
enddo
enddo
enddo

(Note that you need to do something different when x = NX, or y = NY, or z = NZ.)
Is this what you were asking?