paramesh amr_prolong(提升操作)

来源:互联网 发布:金蝶软件集团 编辑:程序博客网 时间:2024/05/17 03:15

amr_refine_derefine执行的操作


which_child(lnblocks2) = j在amr_refine_blocks中设定代表这是

父块的第几个子块(j为块的morton号)


Call amr_refine_blocks (nprocs, mype)
!-----refine blocks, create their children, the children's parents,
!-----turn the children on, and turn the parents off
      Do i = 1,maxblocks_tr
         newchild(i) = .False.
      End Do
//把当前块的newchild标志设为false,这些不是新生成的子块
  Do i = 1,lnblocks

         If (refine(i)) Then ! refine block 'i' on this processor

            Do j = 1,nchild ! create 'nchild' new child blocks for block 'i'

               lnblocks2 = lnblocks2 + 1

               child(1,j,i) = lnblocks2 ! child j's on-processor id
               child(2,j,i) = mype      ! child j's processor no.

               lrefine(lnblocks2) = lrefine(i) + 1 ! refinement level of child
//把新生成的块的newchild标志设为true
               newchild(lnblocks2) = .True. ! this is a new child


               parent(1,lnblocks2) = i ! child j's parent
               parent(2,lnblocks2) = mype ! child j's parent's processor



  p_cache_addr(:) = -1初始值为-1
Do lreflevel = lref_min,lref_max





模块2


  比如在不使用barsara方法的情况下,即prol_fc_dbz标志位false

对facevar变量进行提升操作(prolong)


   iblock=0
       lref_min = 100
       lref_max = 1
       If (lnblocks > 0) Then
          Do lb = 1,lnblocks
          If (newchild(lb)) Then
            iblock = iblock+1

     index(iblock) = lb
            indx(iblock) = iblock

iblock初始为0,iblock记录的是新生成的子块数量,这些子块的数据需要提升操作而来

indx(iblock)即为该子块在所有新子块中为第几块

index(iblock)存的该新子块的原来的块号索引


  If (iblock > 0) Then
       Do lbi = 1,iblock
       lb = index(indx(lbi))

//lb为新子块原来的块号索引


       If (lrefine(lb) == lreflevel) Then

!------compute offset for child cell inside parent
       ioff = mod(which_child(lb)-1,2)*nxb/2
       joff = mod((which_child(lb)-1)/2,2)*nyb/2
       koff = mod((which_child(lb)-1)/4,2)*nzb/2

需计算子块在父块中所处的位置
!------get address of parent block
       parent_blk = parent(1,lb)
       parent_pe  = parent(2,lb)

获取父块的块号与父块所在的cpu


这一段就是对facevar变量的插值提升操作,这里的facevarx1是父节点的数据,应该是在之前调用的amr_1blk_guardcell的时候保存到facevarx1,facevary1这些暂存变量的吧

   Else

!--------prolong using other methods
!--------x-face
         recvf(1:nfacevar, il_bnd1:iu_bnd1+1,                          & 
                     jl_bnd1:ju_bnd1,kl_bnd1:ku_bnd1)                  & 
            = facevarx1(1:nfacevar, il_bnd1:iu_bnd1+1,                 & 
                     jl_bnd1:ju_bnd1,kl_bnd1:ku_bnd1, 1)
         Call amr_1blk_fc_prol_gen_fun(recvf, & 
                    ia,ib+1,ja,jb,ka,kb,idest,ioff,joff,koff,          & 

                    mype,lb,parent_pe,parent_blk,1)

      If (ndim > 1) Then
!--------y-face
         recvf(1:nfacevar, il_bnd1:iu_bnd1,jl_bnd1:ju_bnd1+k2d,        & 
                    kl_bnd1:ku_bnd1)                                   & 
            = facevary1(1:nfacevar, il_bnd1:iu_bnd1,                   & 
                   jl_bnd1:ju_bnd1+k2d,kl_bnd1:ku_bnd1, 1)
         Call amr_1blk_fc_prol_gen_fun(recvf,                          & 
                    ia,ib,ja,jb+1,ka,kb,idest,ioff,joff,koff,          & 
                    mype,lb,parent_pe,parent_blk,2)
         End If  ! End If (ndim > 1)

         If (ndim == 3) Then
!--------z-face
         recvf(1:nfacevar, il_bnd1:iu_bnd1,jl_bnd1:ju_bnd1,            & 
                    kl_bnd1:ku_bnd1+k3d)                               & 
            = facevarz1(1:nfacevar, il_bnd1:iu_bnd1,jl_bnd1:ju_bnd1,   & 
                    kl_bnd1:ku_bnd1+k3d, 1)
         Call amr_1blk_fc_prol_gen_fun(recvf,                          & 
                    ia,ib,ja,jb,ka,kb+1,idest,ioff,joff,koff,          & 
                    mype,lb,parent_pe,parent_blk,3)


         End If  ! End If (ndim == 3)


amr_1blk_fc_prol_gen_fun再会根据interp_mask_facex(:),interp_mask_facey数组数据的设置选择特定的插值方法

这个数组只要在执行amr_prolong之前调用就可以了