[RegCNET] Memory allocation fix in postproc.f
Raymond Arritt
rwarritt at bruce.agron.iastate.edu
Fri Jan 15 19:58:59 CET 2010
Dear RegCNET friends,
There is a small bug in postproc.f that may create a memory allocation
problem in some cases. In subroutine CALCMSE the working arrays tv,
p, and z are variable-size arrays but are only declared locally in the
subroutine. As a result memory is not allocated in a consistent way
and postproc may fail with a "segmentation fault" error.
One way to fix this is to add the following line to postproc.f
somewhere in the middle of the type declarations near the beginning of
the program:
real tv(nx,ny,nz), p(nx,ny,nz), z(nx,ny,nz)
I put this right before the line that begins with "real vmisdat (etc)"
but anywhere before the first executable statement is OK.
Then, add the variables tv, p and z to the arguments of CALCMSE in
each call (there are two calls). In each case replace the
continuation line
& , zs,sigh,pt,nti,nqvi,npsi,nmsei)
with
& , zs,sigh,pt,nti,nqvi,npsi,nmsei,tv,p,z)
Finally, add the variables tv, p, and z to the parameters of CALCMSE
where the subroutine is defined. To do this replace
SUBROUTINE CALCMSE(f2d,f3d,nx,ny,nz,nfld2d,nfld3d
& , zs,sigh,pt,nta,nqva,npsa,nmse)
with
SUBROUTINE CALCMSE(f2d,f3d,nx,ny,nz,nfld2d,nfld3d
& , zs,sigh,pt,nta,nqva,npsa,nmse,tv,p,z)
I hope this is helpful. You may or may not have had crashes with
postproc because of this. It seems most likely to make postproc fail
when the domain size is large.
Regards
Ray Arritt
--
Raymond W. Arritt tel: +1-424-242-0329
Professor, Department of Agronomy +1-515-294-9870
Iowa State University Skype: rwarritt
3010 Agronomy Hall, Ames, Iowa 50011 USA fax: +1-515-294-2619
---------------------------------------------------------------
"You miss 100% of the shots you don't take." -- Wayne Gretzky
More information about the RegCNET
mailing list