[FLASH-BUGS] Error when lrefine_max exceeds 20
Sean Couch
smc at flash.uchicago.edu
Thu Sep 1 17:07:17 CDT 2011
Hi Jeremy,
I fixed this in the trunk version of FLASH a while back but it has not made it into a release version yet. What I have done is to make gr_delta allocatable and then the array size is determined exactly by lrefine_max at runtime, removing the upper limit on lrefine_max.
So, simply:
real, dimension(3,somethingBig) :: gr_delta ====> real, allocatable, dimension(:,:) :: gr_delta
Then in Grid_init.F90 add
allocate(gr_delta(MDIM,lrefine_max))
after lrefine_max runtime parameter has been read-in.
Sean
------------------------------------------------------
Sean M. Couch
Hubble Fellow
Flash Center for Computational Science
Department of Astronomy & Astrophysics
University of Chicago
5747 S. Ellis Ave., Jo 315
Chicago, IL, 60637
773-702-3899 (office)
On Sep 1, 2011, at 4:56 PM, jritter at mail.utexas.edu wrote:
> Hello,
>
> I have come across a small bug in FLASH3.3 affecting users who want to increase lrefine_max above 20. There is an integer constant in Grid_data:
>
> integer, parameter :: somethingBig = 20
>
> which is used to statically allocate an array:
>
> real, dimension(3,somethingBig) :: gr_delta
>
> In Grid_init.F90 near line 409, there is a loop from i=1 to lrefine_max which sets the values of gr_delta(:,i). If lrefine_max is greater than 20, then this loop actually exceeds the dimensions of the array and will overwrite whatever variable is next in memory. In my case, this happened to be gr_lrefineDel, which gets set to some positive, nonzero value. This then affects gr_maxRefine which caused my simulation to completely derefine to the base refinement level.
>
> The fix is to either increase somethingBig to somethingBigger, or produce an error when lrefine_max is greater than somethingBig.
>
> Thanks!
> -Jeremy Ritter
> -University of Texas, Astronomy
More information about the flash-bugs
mailing list