[mpich-discuss] Guard Cells

ESMAEILI AMIN amin at cavelab.cs.tsukuba.ac.jp
Sun Aug 14 03:01:51 CDT 2011


Hi

I know the basic idea of the guard cells, but for example in the following
part of the program, as the charge decomposition is just forward (only nn+q
and no nn-1) it uses only 1 guard cell for each processor in y dirrection:

      do 10 j = 1, npp
c find interpolation weights
      nn = part(1,j)
      mm = part(2,j)
      dxp = qm*(part(1,j) - real(nn))
      dyp = part(2,j) - real(mm)
      nn = nn + 1
      mm = mm - mnoff
      amx = qm - dxp
      mp = mm + 1
      amy = 1.0 - dyp
      np = nn + 1
c deposit charge
      q(np,mp) = q(np,mp) + dxp*dyp
      q(nn,mp) = q(nn,mp) + amx*dyp
      q(np,mm) = q(np,mm) + dxp*amy
      q(nn,mm) = q(nn,mm) + amx*amy

and I did not understan why for the guard cell why it add the value of the
gaurd cell to the first node and then make the gaurd cell value as 0:?

      do 10 k = 1, myp1
      q(1,k) = q(1,k) + q(nx+1,k)
      q(nx+1,k) = 0.0
   10 continue



PPNAGUARD2L
c add guard cells
      kr = ks + 1
      if (kr.ge.nvp) kr = kr - nvp
      kl = ks - 1
      if (kl.lt.0) kl = kl + nvp
      ks = nyp + 1
c this segment is used for mpi computers
      call MPI_IRECV(scr,nxv,mreal,kl,moff,lgrp,msid,ierr)
      call MPI_SEND(f(1,ks),nxv,mreal,kr,moff,lgrp,ierr)
      call MPI_WAIT(msid,istatus,ierr)
c add up the guard cells
      do 20 j = 1, nx1
      f(j,1) = f(j,1) + scr(j)
      f(j,nyp+1) = 0.0
   20 continue

PPNCGUARD2L
         do 10 j = 1, nxv
         f(j,nyp+1) = f(j,1)
   10    continue
         return
      endif
      ks = kstrt - 1
      moff = nypmx*nvp + 2
c copy to guard cells
      kr = ks + 1
      if (kr.ge.nvp) kr = kr - nvp
      kl = ks - 1
      if (kl.lt.0)  kl = kl + nvp
      ks = nyp + 1
c this segment is used for mpi computers
      call MPI_IRECV(f(1,ks),nxv,mreal,kr,moff,lgrp,msid,ierr)
      call MPI_SEND(f,nxv,mreal,kl,moff,lgrp,ierr)
      call MPI_WAIT(msid,istatus,ierr)

and also if for interpolations if we had also backward (nn and np -1) which
cell it is better to choose for gaurd cells:
1-(cell 1 and cell nyp+1)?
2- (cell nyp+1 and cell nyp+2)?

Best Regards
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/mpich-discuss/attachments/20110814/49c8f67a/attachment.htm>


More information about the mpich-discuss mailing list