[Nek5000-users] Volume of an element

nek5000-users at lists.mcs.anl.gov nek5000-users at lists.mcs.anl.gov
Tue Feb 27 06:28:54 CST 2018


Dear Sijo,


The volume per grid point is given by the entries in bm1(i,j,k,e)


For each element e, there are points [i,j,k] with index ranges i=1,...,nx1

j=1,...,ny1, k=1,...,nz1


You must reference elements by the 4th index (...,e).


Fortunately, all the data is contiguous, so, if accessing _all_ points,

you can use a loop like


      do i=1,n

           volume_of_point_i = bm1(i,1,1,1)

      enddo


You certainly do not need to do any summing if you only want the

point wise volume.


Perhaps it'd be best if you indicate what exactly you are planning to

do with the volume.


Finally, I see your use of glmax and glmin.  How many processors

are you using?  If more than one, are you intending that they are

all writing to the file hcoeff.dat?


hth,

Paul


________________________________
From: Nek5000-users <nek5000-users-bounces at lists.mcs.anl.gov> on behalf of nek5000-users at lists.mcs.anl.gov <nek5000-users at lists.mcs.anl.gov>
Sent: Tuesday, February 27, 2018 4:45:30 AM
To: nek5000-users
Subject: Re: [Nek5000-users] Volume of an element

Thanks Paul for your Kind replay. You were right. I want to get the volume associated with each grid point.  And I tried the code below, but at each time when I run I get different answers for volume so I think my ocde is not rubust. Could you please verify my code below.



      nxyz = nx1*ny1*nz1
      n = nx1*ny1*nz1*nelv

      vol = vlsum(bm1(1,1,1,1),nxyz)
      a=glmax(vol,1)
      b=glmin(vol,1)

      do e=1,n
         volume = vlsum(bm1(e,1,1,1),nxyz)
         open (unit=10,file="hcoeff.dat")
         write (10,7020) a,b,volume
7020  format(7f20.14)
      enddo



Regards

Sijo GEORGE

________________________________
De: "nek5000-users" <nek5000-users at lists.mcs.anl.gov>
À: "nek5000-users" <nek5000-users at lists.mcs.anl.gov>
Envoyé: Lundi 26 Février 2018 21:46:02
Objet: Re: [Nek5000-users] Volume of an element



Dear Sijo,


We typically refer to elements as the structures that have (N+1)^3

points.  (Here, N+1 = lx1.)


They are enumerated in nek5000 by the element number, e:


      integer e


      nxyz = nx1*ny1*nz1

      do e=1,nelt

            volume = volel(e)

            volume = vlsum(bm1(1,1,1,e),nxyz)

      enddo


would both yield the same value for the volume of element e.


It appears to me that you are after something different, however.

It seems like you want to associate a volume with each grid point.

If that is the case, then the entries of the diagonal mass matrix, bm1,

are indeed the quantities that you want.


Each entry of bm1(i,1,1,1)  for i=1 to n:=nxyz*nelt, corresponds to the

integral of the underlying basis function.


That is, if we think about a function phi_i(x) such that


             u(x) = sum_i=1^n u(i,1,1,1)*phi_i(x)


then


        bm1(i,1,1,1) = \int phi_i(x) dx


where the integral (\int) is taken over the entire computational domain.


[ Note that we really don't have such a global phi_i(x) ... I use it simply

for illustration, here.]


hth


Paul



________________________________
From: Nek5000-users <nek5000-users-bounces at lists.mcs.anl.gov> on behalf of nek5000-users at lists.mcs.anl.gov <nek5000-users at lists.mcs.anl.gov>
Sent: Monday, February 26, 2018 11:59:19 AM
To: nek5000-users
Subject: [Nek5000-users] Volume of an element

Hi Neks,

How to calculate volume of an element in a 3D mesh? If i write

n = nx1*ny1*nz1*nelv
do i=1,n
     v(i) = volume(1,1,1,i)
enddo


Can i store the volume of each element into a varibale called v?


What happens if i use bm1(1,1,1,i)? Instead of volume(1,1,1,i)


Thanks
Sijo



_______________________________________________
Nek5000-users mailing list
Nek5000-users at lists.mcs.anl.gov
https://lists.mcs.anl.gov/mailman/listinfo/nek5000-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/nek5000-users/attachments/20180227/769f4924/attachment.html>


More information about the Nek5000-users mailing list