[FLASH-USERS] missing neighbor error

Klaus Weide klaus at flash.uchicago.edu
Fri Apr 12 12:56:31 EDT 2019


On the error reported by 杨云鹏:

1. I was able to reproduce the error and develop a fix. A patch is 
attached.

2. The error is specific to spherical coordinates in 2D or 3D.
If you do not use such coordinates, there is no need to apply this patch 
and no benefit from it.

3. About the error: This is a bug in the PARAMESH part of the code, and 
has been in FLASH for a number of releases, at least all FLASH 4.x. As a 
result of a applying a wrong test for whether a block's neighbor in a 
given direction is at a pole (theta = 0 or pi), refine flags of child 
blocks were not always properly communicated to all neighbor blocks. This 
resulted in an invalid refinement pattern, in which there was a point 
where refinement jumped by 2 levels (in a diagonal direction).

Klaus
-------------- next part --------------
Index: source/Grid/GridMain/paramesh/paramesh4/Paramesh4dev/PM4_package/mpi_source/amr_check_refine.F90
===================================================================
--- source/Grid/GridMain/paramesh/paramesh4/Paramesh4dev/PM4_package/mpi_source/amr_check_refine.F90	(revision 26845)
+++ source/Grid/GridMain/paramesh/paramesh4/Paramesh4dev/PM4_package/mpi_source/amr_check_refine.F90	(working copy)
@@ -348,8 +348,8 @@
 !start of new test section
          lrecv=.true.
       if(spherical_pm) then
-         if(j.eq.3.and.abs(bnd_box(2,2,i)-pi).lt.eps) lrecv=.false.
-         if(j.eq.4.and.abs(bnd_box(1,2,i)).lt.eps) lrecv=.false.
+         if(j.eq.4.and.abs(bnd_box(2,2,i)-pi).lt.eps) lrecv=.false.
+         if(j.eq.3.and.abs(bnd_box(1,2,i)).lt.eps) lrecv=.false.
       endif
             if (lrecv) then
             if (neigh(1,j,i).gt.0) then
@@ -376,7 +376,7 @@
                if (neigh(2,jr0,i).eq.mype) then
 ! Note the array ref_testts is larger than is really needed. More careful
 ! coding may reduce the size.
-                  ref_testts(:,:,:,i) = ref_test(:,:,:,i)
+                  ref_testts(:,:,:,neigh(1,jr0,i)) = ref_test(:,:,:,i)
                end if
             end if
             end if


More information about the flash-users mailing list