Nsrc init

Bug reports, work arounds and fixes

Moderators: arango, robertson

Post Reply
Message
Author
jcwarner
Posts: 1182
Joined: Wed Dec 31, 2003 6:16 pm
Location: USGS, USA

Nsrc init

#1 Unread post by jcwarner »

I am having an issue with a memory allocation, and it came back to the init for the var Nsrc.
In ROMS/Modules/mod_sources.F we have

#ifndef ANA_PSOURCE
....
Nsrc(mg)=var_Dsize(1) ! first dimension
....
#else
...
Msrc(ng)=200
Nsrc(ng)=Msrc(ng)
#endif
...
! Allocate point Sources/Sinks variables.
!
allocate ( SOURCES(ng) % Isrc(Nsrc(ng)) )

I do not have any Psources.
I did not set ana_psource.
Therefore Nsrc will only be set if i have a netcdf file.

--- Is it required to define ana_psource even if we do not have any sources? < this is my main question.
Can we just set Nsrc = 0 and adjust for a netcdf file or ana source?

-j

User avatar
wilkin
Posts: 884
Joined: Mon Apr 28, 2003 5:44 pm
Location: Rutgers University
Contact:

Re: Nsrc init

#2 Unread post by wilkin »

I don't follow the question.

If ANA_PSOURCE is not defined but logical flags in roms.in indicate sources are to be used, then the netcdf file is interrogated.

If ANA_PSOURCE is defined, an arbitrary allocation of 200 is accommodated (there should probably be a warning in ana_psourceF about this).
John Wilkin: DMCS Rutgers University
71 Dudley Rd, New Brunswick, NJ 08901-8521, USA. ph: 609-630-0559 jwilkin@rutgers.edu

jcwarner
Posts: 1182
Joined: Wed Dec 31, 2003 6:16 pm
Location: USGS, USA

Re: Nsrc init

#3 Unread post by jcwarner »

I had a mix of options that were not correct and it caused an issue. There is a catch in mod_arrays to prevent my problem:

IF (LuvSrc(ng).or.LwSrc(ng).or.ANY(LtracerSrc(:,ng))) THEN
CALL allocate_sources (ng)
END IF

so this is all good.
sorry to raise the flag.

happy modeling.
-j

Post Reply