Page 1 of 1

dynamic memory usage for inlet usclim.f90

Posted: Mon Sep 19, 2011 6:09 pm
by Ashton Neil
Hi,

I'm still trying to get my head around the dynamic memory as I move some test cases to the new version. I need to read in a data file which will be used as the inlet values for a test case. For v2.0.1 it works fine serial and parallel but with v2.1-rc2 it runs fine for one iteration but on the second I start getting silly values such as 3.69227267719853593E-312 for the velocity. It runs for further iterations but the values are completely off. I believe its because of usclim.f90 but I'm not sure which part of it I'm doing incorrectly.

I've attached both usclim.f90's files and I was hoping if you could quickly compare the two to see if I'm using the dynamic memory allocation in the correct way before I think about other subroutines being the source of the problem.

Thanks very much

Neil

Re: dynamic memory usage for inlet usclim.f90

Posted: Wed Sep 21, 2011 1:37 am
by Yvan Fournier
Hello,

I believe the array you allocate at the first time step is automatically freed when exiting usclim (this is the standard behavior for Fortran 95). To avoid this, adding a save attribute should help:

Code: Select all

integer, allocatable, save, dimension( : ) :: lstelt
double precision, allocatable, save, dimension( :, : ) :: vel
Best regards,

  Yvan