[FLASH-USERS] small bug

Klaus Weide klaus at flash.uchicago.edu
Tue Oct 1 10:18:05 EDT 2013


On Tue, 1 Oct 2013, Seyit Hocuk wrote:

> I found a small bug while I was trying resolve an unrelated problem on
> particle destruction, which is another topic by itself. In any case, in
> Grid_mapMeshToParticles.F90 the default "gridDataStruct" is set to "Center",
> see below, however instead of using gDataStruct, still in many places
> gridDataStruct is used. It would normally be no problem by the way, but only
> in certain specific circumstances a problem could arise.
> 
> if(present(gridDataStruct)) then
>      gDataStruct=gridDataStruct
>   else
>      gDataStruct=CENTER
>   end if

Hi Seyit,

While the implementation in 
  Grid/GridParticles/GridParticlesMapFromMesh/Grid_mapMeshToParticles.F90
refers to gridDataStruct instead of gDataStruct, this occurs only in calls 
like

    call Grid_getBlkPtr(...,solnVec,gridDataStruct)
and
    call Grid_releaseBlkPtr(...,solnVec,gridDataStruct) .


It is valid to pass gridDataStruct as an actual argument in those calls, 
even when present(gridDataStruct) is false, because the 
third dummy argument in Grid_getBlkPtr and Grid_releaseBlkPtr is also 
OPTIONAL (and they fall back to CENTER if the argument is not present).

NOTE: For this to work right, the implementation in 
Grid_mapMeshToParticles.F90 MUST refer to the Grid interface module, as in

  use Grid_interface, ONLY : Grid_getBlkPtr,Grid_releaseBlkPtr,&  !...
 

Actually, since Grid_mapMeshToParticles only uses its gridDataStruct
optional argument to pass it along to other calls (where it is also 
optional), the gDataStruct variable isn't really needed at all, but 
it doesn't cause any harm either.

Bottom line, there isn't a bug, but some inelegant code.

Klaus



More information about the flash-users mailing list