<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
Hi Tanmoy,
<div class=""><br class="">
</div>
<div class="">thank you for taking the time to answer my questions and sharing your piece of code. It is very helpful.</div>
<div class=""><br class="">
</div>
<div class="">Marco<br class="">
<div>
<blockquote type="cite" class="">
<div class="">On Dec 1, 2016, at 10:21 PM, <a href="mailto:nek5000-users@lists.mcs.anl.gov" class="">
nek5000-users@lists.mcs.anl.gov</a> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div dir="ltr" class="">
<div class="">
<div class="">Hi Marco,<br class="">
<br class="">
</div>
From my experience, I got benefitted by remodifying the eddy_visc code, by having the element loop inside the subroutine as well. i.e. in the eddy_visc() structure all the calculations of the stresses, etc. done as follows. The benefit is that with the previous
 snippet, my code froze, whenever the number of processors did not divide nelv, i.e. whenever nelv/np had a non-zero remainder.<br class="">
<br class="">
</div>
<div class="">The following code gets rid of this short-coming.<br class="">
</div>
<div class=""><br class="">
 subroutine eddy_visc(ediff,cs)<br class="">
<br class="">
      include 'SIZE'<br class="">
      include 'TOTAL'<br class="">
<br class="">
      integer e<br class="">
      real zn0,zn01,zn02<br class="">
      integer ntot<br class="">
      real cs,kappa,z0<br class="">
      real ediff(lx1,ly1,lz1,lelv)<br class="">
      common /dynsmg/ sij (lx1,ly1,lz1,ldim,ldim)<br class="">
     $              , dg2 (lx1,ly1,lz1,lelv)<br class="">
     $              , snrm(lx1,ly1,lz1,lelv)<br class="">
<br class="">
</div>
          cstat = 0.16<br class="">
<div class="">t<br class="">
          ntot = nx1*ny1*nz1<br class="">
<br class="">
          call set_grid_spacing(dg2)<br class="">
          if(nid.eq.0) write(6,*) 'Calculating eddy visosity',session<br class="">
<br class="">
          do e=1,nelv<br class="">
          call comp_gije(sij,vx(1,1,1,e),vy(<wbr class="">1,1,1,e),vz(1,1,1,e),e)<br class="">
          call comp_sije(sij)<br class="">
<br class="">
          call mag_tensor_e(snrm(1,1,1,e),<wbr class="">sij)<br class="">
          call cmult(snrm(1,1,1,e),2.0,ntot)<br class="">
<br class="">
           do k = 1,nz1<br class="">
             do j = 1,ny1<br class="">
              do i = 1,nx1<br class="">
              ediff(i,j,k,e) = param(2) +<br class="">
     &                        (cstat**2)*snrm(i,j,k,e)<br class="">
              enddo<br class="">
             enddo<br class="">
           enddo<br class="">
          enddo<br class="">
<br class="">
      return<br class="">
      end<br class="">
<br class="">
</div>
<div class="">2. ifsplit flag is the for the formulation, ifsplit = true, --> Pn Pn, and ifsplit = false, --> PnPn-2, and ifstrs formulation works only for PnPn-2 formulation (atleast in the older versions). if you use PnPn-2 formulation, ifexplvis = .true.
 has no effect.<br class="">
<br class="">
</div>
<div class="">3. set_ds_filt() is the routine required for the second level of filtering in dynamic Smagorinsky, .i.e. required for calculation of L_ij, M_ij. The first level of filtering is assumed to be coming from the coarse grid. I would recommend reading
 the mathematics of dynamic Smagorinsky model to better understand the procedure. (See
<a href="http://www.scholarpedia.org/article/Turbulence:_Subgrid-Scale_Modeling" class="">
http://www.scholarpedia.org/article/Turbulence:_Subgrid-Scale_Modeling</a>)<br class="">
<br class="">
</div>
<div class="">Best Regards,<br class="">
</div>
<div class="">Tanmoy<br class="">
</div>
<div class=""><br class="">
<br class="">
</div>
</div>
<div class="gmail_extra"><br class="">
<div class="gmail_quote">On Wed, Nov 30, 2016 at 7:56 AM, <span dir="ltr" class="">
<<a href="mailto:nek5000-users@lists.mcs.anl.gov" target="_blank" class="">nek5000-users@lists.mcs.anl.gov</a>></span> wrote:<br class="">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word" class="">Hello,
<div class=""><br class="">
</div>
<div class="">I have a few questions on the turbChannel example.</div>
<div class=""><br class="">
</div>
<div class="">1) the ‘eddy viscosity ‘ is computed in the function eddy_visc and called in a loop over the elements of mesh 1. Inside the function eddy_visc there is the following piece of code:</div>
<div class=""><br class="">
</div>
<div class="">
<div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo" class="">
<i class=""><span style="font-variant-ligatures:no-common-ligatures" class="">     if (e.eq.nelv) then  ! planar avg and define nu_tau</span> </i></div>
</div>
<div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo" class="">
<i class="">     …</i></div>
<div style="margin:0px;line-height:normal" class="">
<div style="font-family:Menlo;font-size:11px;margin:0px;line-height:normal" class="">
<span style="font-variant-ligatures:no-common-ligatures" class=""><i class="">         ntot = nx1*ny1*nz1*nelv</i></span></div>
<div style="font-family:Menlo;font-size:11px;margin:0px;line-height:normal" class="">
<span style="font-variant-ligatures:no-common-ligatures" class=""><i class="">         do i=1,ntot</i></span></div>
<div style="font-family:Menlo;font-size:11px;margin:0px;line-height:normal" class="">
<span style="font-variant-ligatures:no-common-ligatures" class=""><i class="">            cdyn = 0</i></span></div>
<div style="font-family:Menlo;font-size:11px;margin:0px;line-height:normal" class="">
<span style="font-variant-ligatures:no-common-ligatures" class=""><i class="">            if (den(i,1).gt.0) cdyn = 0.5*num(i,1)/den(i,1)</i></span></div>
<div style="font-family:Menlo;font-size:11px;margin:0px;line-height:normal" class="">
<span style="font-variant-ligatures:no-common-ligatures" class=""><i class="">            cdyn = 0.16*0.16 ! max(cdyn,0.)   ! AS ALTERNATIVE, could clip ediff</i></span></div>
<div style="font-family:Menlo;font-size:11px;margin:0px;line-height:normal" class="">
<span style="font-variant-ligatures:no-common-ligatures" class=""><i class="">            ediff(i,1) = param(2)+cdyn*dg2(i,1)*snrm(i,<wbr class="">1)</i></span></div>
<div style="font-family:Menlo;font-size:11px;margin:0px;line-height:normal" class="">
<span style="font-variant-ligatures:no-common-ligatures" class=""><i class="">         enddo</i></span></div>
<div style="font-family:Menlo;font-size:11px;margin:0px;line-height:normal" class="">
<span style="font-variant-ligatures:no-common-ligatures" class=""><i class="">      endif</i></span></div>
<div style="font-family:Menlo;font-size:11px;margin:0px;line-height:normal" class="">
<span style="font-variant-ligatures:no-common-ligatures" class=""><i class=""><br class="">
</i></span></div>
<div style="font-family:Menlo;font-size:11px;margin:0px;line-height:normal" class="">
<span style="font-variant-ligatures:no-common-ligatures" class="">eddy that stores the eddy viscosity is updated when the last element of mesh 1 is called. Is there any reason why it should be done in this manner?</span></div>
<div style="font-family:Menlo;font-size:11px;margin:0px;line-height:normal" class="">
<span style="font-variant-ligatures:no-common-ligatures" class=""><br class="">
</span></div>
<div style="font-family:Menlo;font-size:11px;margin:0px;line-height:normal" class="">
<span style="font-variant-ligatures:no-common-ligatures" class="">2) I am still confused over the differences between ‘ifsplit’, ‘ifexplvis’ and ‘ifstrs’. From the archive and the documentation I understand the following (please correct me if I am wrong):</span></div>
<div style="margin:0px;line-height:normal" class="">
<ul class="m_328645922656418868MailOutline">
<li class=""><font face="Menlo" class=""><span style="font-size:11px" class="">‘ifexplvis’ is set to true when the user specified the viscosity coefficient in uservp. It does not required, however, the stress formation meaning the the diffusive term in the
 NS equations looks like \mu(x,t) \nabla^2 \vec{u}.</span></font></li><li class=""><font face="Menlo" class=""><span style="font-size:11px" class="">when ‘ifsplit’ is set to true, the viscosity is split in a explicit part and an implicit part. If this correct, how and where are defined the explicit and implicit parts?</span></font></li><li class=""><font face="Menlo" class=""><span style="font-size:11px" class="">‘ifstrs’: when set to true, ‘ifexplvis’ and ‘if split’ do not have any effect.</span></font></li></ul>
<div class=""><font face="Menlo" class=""><span style="font-size:11px" class=""><br class="">
</span></font></div>
<div class=""><font face="Menlo" class=""><span style="font-size:11px" class="">3) could someone shed some light on the subroutine ‘set_ds_filt’ in turbChannel.usr, please? It seems to compute some sort of filter that is then used to compute M_{i,j} and L_{i,j}</span></font></div>
<div class=""><font face="Menlo" class=""><span style="font-size:11px" class=""><br class="">
</span></font></div>
<div class=""><font face="Menlo" class=""><span style="font-size:11px" class=""><br class="">
</span></font></div>
<div class=""><font face="Menlo" class=""><span style="font-size:11px" class="">Thanks,</span></font></div>
<div class=""><font face="Menlo" class=""><span style="font-size:11px" class="">Marco</span></font></div>
<div class=""><font face="Menlo" class=""><span style="font-size:11px" class=""><br class="">
</span></font></div>
</div>
</div>
</div>
<br class="">
______________________________<wbr class="">_________________<br class="">
Nek5000-users mailing list<br class="">
<a href="mailto:Nek5000-users@lists.mcs.anl.gov" class="">Nek5000-users@lists.mcs.anl.<wbr class="">gov</a><br class="">
<a href="https://lists.mcs.anl.gov/mailman/listinfo/nek5000-users" rel="noreferrer" target="_blank" class="">https://lists.mcs.anl.gov/<wbr class="">mailman/listinfo/nek5000-users</a><br class="">
<br class="">
</blockquote>
</div>
<br class="">
</div>
_______________________________________________<br class="">
Nek5000-users mailing list<br class="">
<a href="mailto:Nek5000-users@lists.mcs.anl.gov" class="">Nek5000-users@lists.mcs.anl.gov</a><br class="">
https://lists.mcs.anl.gov/mailman/listinfo/nek5000-users<br class="">
</div>
</blockquote>
</div>
<br class="">
</div>
</body>
</html>