memory allocation bug in do-bio subroutines

10 views
Skip to first unread message

Bert Rubash

unread,
Feb 13, 2012, 12:59:56 PM2/13/12
to gotm-...@googlegroups.com

Four array declarations over the range 0 to nlev should be changed
to declarations over the range 1 to numc.

In the file /gotm-git/src/extras/bio/iow/bio_iow.F90
a ratio variable is declared as

REALTYPE :: rat(0:nlev,0:nlev)

but is initialized with indices in the 1 to numc range

rat(de,fl)=h(1)
rat(fl,am)=1./h(1)
rat(fl,de)=1./h(1)

and used over the 1 to numc range:

do i=1,numc
do j=1,numc
if (i.ne.j) pp(i,j,ci)=rat(j,i)*dd(j,i,ci)
end do
end do

...

similarly in gotm-git/src/extras/bio/mangan/bio_mangan.F90

REALTYPE :: rat(0:nlev,0:nlev)

but
rat(mn2,mn2_sed)=h(1)/1000.
rat(mno,mno_sed)=h(1)/1000.
rat(spm,spm_sed)=h(1)
rat(mn2_sed,mn2)=1000./h(1)
rat(mno_sed,mno)=1000./h(1)
rat(spm_sed,spm)=1.0/h(1)
and
do i=1,numc
do j=1,numc
pp(i,j,ci)=rat(j,i)*dd(j,i,ci)
end do
end do
end do


Also in gotm-git/src/extras/bio/mab/bio_mab.F90

REALTYPE :: rat(0:nlev,0:nlev)

but
rat(de,fl)=h(1)
rat(fl,am)=1./h(1)
and
do i=1,numc
do j=1,numc
if (i.ne.j) pp(i,j,ci)=rat(j,i)*dd(j,i,ci)
end do
end do

'rat' is declared in gotm-git/src/extras/bio/rolm/bio_rolm.F90
as REALTYPE :: rat(0:nlev,0:nlev)
and initialized but not used.

-Bert Rubash

Jorn Bruggeman

unread,
Feb 13, 2012, 1:36:05 PM2/13/12
to gotm-...@googlegroups.com
Thanks - verified and fixed.

Cheers,

Jorn

Karsten Bolding

unread,
Feb 14, 2012, 1:56:14 AM2/14/12
to gotm-...@googlegroups.com
Hi Bert

Thanks for the error report. I guess nlev has always been bigger than
numc as no wrong results has been reported.

As you might be aware - the support for the old GOTM/BIO will be phased
out in favor of FABM. No new features will be added to GOTM/BIO and the
code will also disappear. Prensently new models are added to FABM and
comparisons between old GOTM/BIO and new FABM implementations are done.

Karsten

--
http://www.gotm.net/

Adolf STIPS

unread,
Feb 14, 2012, 2:23:56 AM2/14/12
to gotm-...@googlegroups.com

On Feb 14, 2012, at 7:56 AM, Karsten Bolding wrote:

> Hi Bert
>
> Thanks for the error report. I guess nlev has always been bigger than
> numc as no wrong results has been reported.
>

Unfortunately this is not correct, remember the respective error report from Gennadi, about 1.5 years ago.

He had exactly this case of using 10 layers in GOTM and bio_iow with fluff (11 variables)
and this failed, using 15 layers made it run.

Anyhow nice that even this case is solved now, ciao Adolf

Karsten Bolding

unread,
Feb 14, 2012, 2:50:23 AM2/14/12
to gotm-...@googlegroups.com
On Tue, Feb 14, 2012 at 08:23:56 +0100, Adolf STIPS wrote:
>

<snip>


>
> Unfortunately this is not correct, remember the respective error report from Gennadi, about 1.5 years ago.

searched in the mail archive - but can't find it

>

<snip>


--
http://www.gotm.net/

Reply all
Reply to author
Forward
0 new messages