[Nek5000-users] Computing total kinetic energy
nek5000-users at lists.mcs.anl.gov
nek5000-users at lists.mcs.anl.gov
Tue Dec 4 02:33:10 CST 2012
Hi Praveen,
Yes - this is correct.
The "glsc3" stands for
global scalar product, 3 arguments
and thus is fully parallel.
If you wanted (for some reason) a result local to each
processor, you would use
vlsc3, which stands for vector local scalar product, 3 arguments.
An example would be:
integer e
real ek(lelt)
nxyz = nx1*ny1*nz1
do e=1,nelv
ek(e) = (vlsc3(vx(1,1,1,e),vx(1,1,1,e),bm1(1,1,1,e),nxyz)
$ + vlsc3(vy(1,1,1,e),vy(1,1,1,e),bm1(1,1,1,e),nxyz)
$ + vlsc3(vz(1,1,1,e),vz(1,1,1,e),bm1(1,1,1,e),nxyz)) /2.
enddo
Paul
On Tue, 4 Dec 2012, nek5000-users at lists.mcs.anl.gov wrote:
> Hello
>
> I use following code to compute total kinetic energy in the domain inside
> userchk
>
> c Compute total kinetic energy
> if(mod(istep,10).eq.0)then
> n = nx1*ny1*nz1*nelv
> xke = glsc3(vx, vx, bm1, n)
> yke = glsc3(vy, vy, bm1, n)
> zke = glsc3(vz, vz, bm1, n)
> total_ke = 0.5*(xke + yke + zke)
> if(nid.eq.0) write(6,1) istep, time, total_ke
> 1 format(i6,1p2e14.6,' Totalke')
> endif
>
> Is this correct ? Does this account for the parallel computation or do I
> need to do something extra to gather from other processes ?
>
> Thanks
> praveen
>
More information about the Nek5000-users
mailing list