<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">Dear Sijo,</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">The volume per grid point is given by the entries in bm1(i,j,k,e)</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">For each element e, there are points [i,j,k] with index ranges i=1,...,nx1</p>
<p style="margin-top:0;margin-bottom:0">j=1,...,ny1, k=1,...,nz1</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">You must reference elements by the 4th index (...,e).</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">Fortunately, all the data is contiguous, so, if accessing _all_ points,</p>
<p style="margin-top:0;margin-bottom:0">you can use a loop like</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0"> do i=1,n</p>
<p style="margin-top:0;margin-bottom:0"> volume_of_point_i = bm1(i,1,1,1)</p>
<p style="margin-top:0;margin-bottom:0"> enddo</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">You certainly do not need to do any summing if you only want the</p>
<p style="margin-top:0;margin-bottom:0">point wise volume.</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">Perhaps it'd be best if you indicate what exactly you are planning to</p>
<p style="margin-top:0;margin-bottom:0">do with the volume.</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">Finally, I see your use of glmax and glmin. How many processors</p>
<p style="margin-top:0;margin-bottom:0">are you using? If more than one, are you intending that they are</p>
<p style="margin-top:0;margin-bottom:0">all writing to the file hcoeff.dat?</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">hth,</p>
<p style="margin-top:0;margin-bottom:0">Paul</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
</div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Nek5000-users <nek5000-users-bounces@lists.mcs.anl.gov> on behalf of nek5000-users@lists.mcs.anl.gov <nek5000-users@lists.mcs.anl.gov><br>
<b>Sent:</b> Tuesday, February 27, 2018 4:45:30 AM<br>
<b>To:</b> nek5000-users<br>
<b>Subject:</b> Re: [Nek5000-users] Volume of an element</font>
<div> </div>
</div>
<div>
<div style="font-family:arial,helvetica,sans-serif; font-size:12pt; color:#000000">
<div><style style="display:none">
<!--
p
{margin-top:0;
margin-bottom:0}
-->
</style></div>
<div>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.<br>
</div>
<div> </div>
<div><br>
</div>
<div><br>
</div>
<div> nxyz = nx1*ny1*nz1<br>
n = nx1*ny1*nz1*nelv<br>
</div>
<div><br>
</div>
<div> vol = vlsum(bm1(1,1,1,1),nxyz)<br>
a=glmax(vol,1)<br>
b=glmin(vol,1)<br>
<br>
do e=1,n<br>
volume = vlsum(bm1(e,1,1,1),nxyz)<br>
open (unit=10,file="hcoeff.dat")<br>
write (10,7020) a,b,volume<br>
7020 format(7f20.14)<br>
enddo<br>
<br>
</div>
<div><br>
</div>
<div><br>
</div>
<div>Regards<br>
</div>
<div><br>
</div>
<div>Sijo GEORGE<br>
</div>
<div><br>
</div>
<hr id="x_zwchr">
<div><b>De: </b>"nek5000-users" <nek5000-users@lists.mcs.anl.gov><br>
<b>À: </b>"nek5000-users" <nek5000-users@lists.mcs.anl.gov><br>
<b>Envoyé: </b>Lundi 26 Février 2018 21:46:02<br>
<b>Objet: </b>Re: [Nek5000-users] Volume of an element<br>
</div>
<div><br>
</div>
<div>
<div id="x_divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:#000000; font-family:Calibri,Helvetica,sans-serif">
<p style="margin-top:0; margin-bottom:0"><br>
</p>
<p style="margin-top:0; margin-bottom:0">Dear Sijo,</p>
<p style="margin-top:0; margin-bottom:0"><br>
</p>
<p style="margin-top:0; margin-bottom:0">We typically refer to elements as the structures that have (N+1)^3</p>
<p style="margin-top:0; margin-bottom:0">points. (Here, N+1 = lx1.)</p>
<p style="margin-top:0; margin-bottom:0"><br>
</p>
<p style="margin-top:0; margin-bottom:0">They are enumerated in nek5000 by the element number, e:</p>
<p style="margin-top:0; margin-bottom:0"><br>
</p>
<p style="margin-top:0; margin-bottom:0"> integer e</p>
<p style="margin-top:0; margin-bottom:0"><br>
</p>
<p style="margin-top:0; margin-bottom:0"> nxyz = nx1*ny1*nz1</p>
<p style="margin-top:0; margin-bottom:0"> do e=1,nelt</p>
<p style="margin-top:0; margin-bottom:0"> volume = volel(e)</p>
<p style="margin-top:0; margin-bottom:0"> volume = vlsum(bm1(1,1,1,e),nxyz)</p>
<p style="margin-top:0; margin-bottom:0"> enddo</p>
<p style="margin-top:0; margin-bottom:0"><br>
</p>
<p style="margin-top:0; margin-bottom:0">would both yield the same value for the volume of element e.</p>
<p style="margin-top:0; margin-bottom:0"><br>
</p>
<p style="margin-top:0; margin-bottom:0">It appears to me that you are after something different, however.</p>
<p style="margin-top:0; margin-bottom:0">It seems like you want to associate a volume with each grid point.</p>
<p style="margin-top:0; margin-bottom:0">If that is the case, then the entries of the diagonal mass matrix, bm1,</p>
<p style="margin-top:0; margin-bottom:0">are indeed the quantities that you want.</p>
<p style="margin-top:0; margin-bottom:0"><br>
</p>
<p style="margin-top:0; margin-bottom:0">Each entry of bm1(i,1,1,1) for i=1 to n:=nxyz*nelt, corresponds to the</p>
<p style="margin-top:0; margin-bottom:0">integral of the underlying basis function. </p>
<p style="margin-top:0; margin-bottom:0"><br>
</p>
<p style="margin-top:0; margin-bottom:0">That is, if we think about a function phi_i(x) such that</p>
<p style="margin-top:0; margin-bottom:0"><br>
</p>
<p style="margin-top:0; margin-bottom:0"> u(x) = sum_i=1^n u(i,1,1,1)*phi_i(x)</p>
<p style="margin-top:0; margin-bottom:0"><br>
</p>
<p style="margin-top:0; margin-bottom:0">then</p>
<p style="margin-top:0; margin-bottom:0"><br>
</p>
<p style="margin-top:0; margin-bottom:0"> bm1(i,1,1,1) = \int phi_i(x) dx</p>
<p style="margin-top:0; margin-bottom:0"><br>
</p>
<p style="margin-top:0; margin-bottom:0">where the integral (\int) is taken over the entire computational domain.</p>
<p style="margin-top:0; margin-bottom:0"><br>
</p>
<p style="margin-top:0; margin-bottom:0">[ Note that we really don't have such a global phi_i(x) ... I use it simply</p>
<p style="margin-top:0; margin-bottom:0">for illustration, here.]</p>
<p style="margin-top:0; margin-bottom:0"><br>
</p>
<p style="margin-top:0; margin-bottom:0">hth</p>
<p style="margin-top:0; margin-bottom:0"><br>
</p>
<p style="margin-top:0; margin-bottom:0">Paul</p>
<p style="margin-top:0; margin-bottom:0"><br>
</p>
<p style="margin-top:0; margin-bottom:0"><br>
</p>
</div>
<hr style="display:inline-block; width:98%">
<div id="x_divRplyFwdMsg" dir="ltr"><span color="#000000" face="Calibri, sans-serif" style="font-size:11pt; color:#000000; font-family:Calibri,sans-serif"><b>From:</b> Nek5000-users <nek5000-users-bounces@lists.mcs.anl.gov> on behalf of nek5000-users@lists.mcs.anl.gov
<nek5000-users@lists.mcs.anl.gov><br>
<b>Sent:</b> Monday, February 26, 2018 11:59:19 AM<br>
<b>To:</b> nek5000-users<br>
<b>Subject:</b> [Nek5000-users] Volume of an element</span>
<div> </div>
</div>
<div>
<div style="font-family:arial,helvetica,sans-serif; font-size:12pt; color:#000000">
<div>Hi Neks,<br>
</div>
<div><br>
</div>
<div>How to calculate volume of an element in a 3D mesh? If i write<br>
</div>
<div><br>
</div>
<div>n = nx1*ny1*nz1*nelv<br>
</div>
<div>do i=1,n<br>
</div>
<div> v(i) = volume(1,1,1,i)<br>
</div>
<div>enddo<br>
</div>
<div><br>
</div>
<div><br>
</div>
<div>Can i store the volume of each element into a varibale called v?<br>
</div>
<div><br>
</div>
<div><br>
</div>
<div>What happens if i use bm1(1,1,1,i)? Instead of volume(1,1,1,i)</div>
<div><br>
</div>
<div><br>
</div>
<div>Thanks<br>
</div>
<div>Sijo<br>
</div>
<div><br>
</div>
<div><br>
</div>
</div>
</div>
<br>
_______________________________________________<br>
Nek5000-users mailing list<br>
Nek5000-users@lists.mcs.anl.gov<br>
https://lists.mcs.anl.gov/mailman/listinfo/nek5000-users<br>
</div>
</div>
</div>
</body>
</html>