[FLASH-BUGS] Species Flux Handling with USM MHD in FLASH 4.3

Klaus Weide klaus at flash.uchicago.edu
Wed Jan 6 11:56:56 CST 2016


On Tue, 5 Jan 2016, Jason Galyardt wrote:

> Klaus,
> 
> I have had a chance to try the remaining two experiments you requested; the
> results are below. I've reverted hy_uhd_unsplit.F90 to the release version
> in FLASH 4.3. The short answer is that I'm still perplexed, but it might be
> a problem with undefined pointers (i.e. invalid targets). Do you have any
> other experiments to try?

Hi Jason,

I appreciate your willingness to dig into this.

I think now that this must be something else than a simple programming 
error in the FLASH code - like accessing an undefined pointer but in a 
predictable way - otherwise we should have run into this problem before
(with different compilers). I may be wrong.

The code uses some features of newer Fortran versions that may not be 
commonly used, esp. in combination, so I think it is possible that your 
compiler gets something wrong that is legal (but unusual) Fortran code.
In particular, I think of
  *  dummy arguments that are declared as POINTER *and* OPTIONAL;
  *  passing them through several levels of calls;
  *  passing a slice of such an array as actual argument for
     a 1-D dummy array argument that is declared OPTIONAL
     (but not POINTER);
  *  Array index ranges that do not start at 1;
  *  local names for external routines with explicit interfaces
     (as in "use ... MH  => hy_uhd_DataReconstructNormalDir_MH").

It could also be the case that the code-generating part of the compiler is 
doing its work correctly, but the compiler is still generating warnings or 
errors because of some flags or options - I am thinking of flags that 
request additional checks at runtime, possibly independent of other debug 
flags, like -traceback or -check uninit or -check pointers. If you turn 
all of those off, does the run time failure still occur?

I can think of two generic methods to debug something like this further:

1) Run the code in a debugger. Gdb may be more or less useful, the 
   understanding of Fortran syntax may be poor or not, depending on
   compiler and gdb versions.
   Run code in compiler until error occurs (setting a breakpoint at exit()
   with 'b exit' may be useful before 'r'unning), than examine variables 
   and arrays.  

2) Insert PRINT statement into the Fortran code in various places, to 
   check for definition state of variables and for shapes and bounds
   of arrays (if present).
   Checking and printing PRESENT(hy_spcR),LBOUND(hy_spcR),UBOUND(hy_spcR)
   (and for other variables) should be useful in particular.

I'll look at the details of your report again, perhaps I'll have some
more concrete suggestions later.

Klaus


More information about the flash-bugs mailing list