<div dir="ltr"><div><div>Hi Marco,<br><br></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><br></div><div>The following code gets rid of this short-coming.<br></div><div><br> subroutine eddy_visc(ediff,cs)<br><br>      include 'SIZE'<br>      include 'TOTAL'<br><br>      integer e<br>      real zn0,zn01,zn02<br>      integer ntot<br>      real cs,kappa,z0<br>      real ediff(lx1,ly1,lz1,lelv)<br>      common /dynsmg/ sij (lx1,ly1,lz1,ldim,ldim)<br>     $              , dg2 (lx1,ly1,lz1,lelv)<br>     $              , snrm(lx1,ly1,lz1,lelv)<br><br></div>          cstat = 0.16<br><div>t<br>          ntot = nx1*ny1*nz1<br><br>          call set_grid_spacing(dg2)<br>          if(nid.eq.0) write(6,*) 'Calculating eddy visosity',session<br><br>          do e=1,nelv<br>          call comp_gije(sij,vx(1,1,1,e),vy(<wbr>1,1,1,e),vz(1,1,1,e),e)<br>          call comp_sije(sij)<br><br>          call mag_tensor_e(snrm(1,1,1,e),<wbr>sij)<br>          call cmult(snrm(1,1,1,e),2.0,ntot)<br><br>           do k = 1,nz1<br>             do j = 1,ny1<br>              do i = 1,nx1<br>              ediff(i,j,k,e) = param(2) +<br>     &                        (cstat**2)*snrm(i,j,k,e)<br>              enddo<br>             enddo<br>           enddo<br>          enddo<br><br>      return<br>      end<br><br></div><div>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><br></div><div>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">http://www.scholarpedia.org/article/Turbulence:_Subgrid-Scale_Modeling</a>)<br><br></div><div>Best Regards,<br></div><div>Tanmoy<br></div><div><br><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Nov 30, 2016 at 7:56 AM,  <span dir="ltr"><<a href="mailto:nek5000-users@lists.mcs.anl.gov" target="_blank">nek5000-users@lists.mcs.anl.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">



<div style="word-wrap:break-word">
Hello,
<div><br>
</div>
<div>I have a few questions on the turbChannel example.</div>
<div><br>
</div>
<div>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><br>
</div>
<div>
<div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo">
<i><span style="font-variant-ligatures:no-common-ligatures">     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">
<i>     …</i></div>
<div style="margin:0px;line-height:normal">
<div style="font-family:Menlo;font-size:11px;margin:0px;line-height:normal">
<span style="font-variant-ligatures:no-common-ligatures"><i>         ntot = nx1*ny1*nz1*nelv</i></span></div>
<div style="font-family:Menlo;font-size:11px;margin:0px;line-height:normal">
<span style="font-variant-ligatures:no-common-ligatures"><i>         do i=1,ntot</i></span></div>
<div style="font-family:Menlo;font-size:11px;margin:0px;line-height:normal">
<span style="font-variant-ligatures:no-common-ligatures"><i>            cdyn = 0</i></span></div>
<div style="font-family:Menlo;font-size:11px;margin:0px;line-height:normal">
<span style="font-variant-ligatures:no-common-ligatures"><i>            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">
<span style="font-variant-ligatures:no-common-ligatures"><i>            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">
<span style="font-variant-ligatures:no-common-ligatures"><i>            ediff(i,1) = param(2)+cdyn*dg2(i,1)*snrm(i,<wbr>1)</i></span></div>
<div style="font-family:Menlo;font-size:11px;margin:0px;line-height:normal">
<span style="font-variant-ligatures:no-common-ligatures"><i>         enddo</i></span></div>
<div style="font-family:Menlo;font-size:11px;margin:0px;line-height:normal">
<span style="font-variant-ligatures:no-common-ligatures"><i>      endif</i></span></div>
<div style="font-family:Menlo;font-size:11px;margin:0px;line-height:normal">
<span style="font-variant-ligatures:no-common-ligatures"><i><br>
</i></span></div>
<div style="font-family:Menlo;font-size:11px;margin:0px;line-height:normal">
<span style="font-variant-ligatures:no-common-ligatures">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">
<span style="font-variant-ligatures:no-common-ligatures"><br>
</span></div>
<div style="font-family:Menlo;font-size:11px;margin:0px;line-height:normal">
<span style="font-variant-ligatures:no-common-ligatures">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">
<ul class="m_328645922656418868MailOutline">
<li><font face="Menlo"><span style="font-size:11px">‘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><font face="Menlo"><span style="font-size:11px">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><font face="Menlo"><span style="font-size:11px">‘ifstrs’: when set to true, ‘ifexplvis’ and ‘if split’ do not have any effect.</span></font></li></ul>
<div><font face="Menlo"><span style="font-size:11px"><br>
</span></font></div>
<div><font face="Menlo"><span style="font-size:11px">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><font face="Menlo"><span style="font-size:11px"><br>
</span></font></div>
<div><font face="Menlo"><span style="font-size:11px"><br>
</span></font></div>
<div><font face="Menlo"><span style="font-size:11px">Thanks,</span></font></div>
<div><font face="Menlo"><span style="font-size:11px">Marco</span></font></div>
<div><font face="Menlo"><span style="font-size:11px"><br>
</span></font></div>
</div>
</div>
</div>

<br>______________________________<wbr>_________________<br>
Nek5000-users mailing list<br>
<a href="mailto:Nek5000-users@lists.mcs.anl.gov">Nek5000-users@lists.mcs.anl.<wbr>gov</a><br>
<a href="https://lists.mcs.anl.gov/mailman/listinfo/nek5000-users" rel="noreferrer" target="_blank">https://lists.mcs.anl.gov/<wbr>mailman/listinfo/nek5000-users</a><br>
<br></blockquote></div><br></div>