[MITgcm-support] mnc pkg writing out additional variables...

Ed Hill ed at eh3.com
Wed Jun 15 10:42:27 EDT 2005


On Tue, 2005-06-14 at 18:35 -0400, Karsten Friis wrote:
> Hi Ed,
> 
> I want to add some variables to my netCDF output. At first this wasn't 
> too much off a problem following your instructions online help. 
> Everything was written in an additional file addvars.nc, worked fine. 
> But now indeed need some help again, seems to be I can't do it myself...
> 
> I want to write out some fluxes, which are calculated in the routine 
> dic_biotic_forcing.F, but ptracers_write_state.F doesn't know what I am 
> talking about, providing me with the error message:
> 
> ....
> Invalid declaration of or reference to symbol `cflux' at (^) [initially 
> seen at (^)]
> ...
> 
> I simply tried to call the subroutine:
> ...
>            call DIC_BIOTIC_Forcing(cflux(1-Olx,1-Oly,1,bi,bj),
>       &                          bi,bj,imin,imax,jmin,jmax,
>       &                          myIter,myTime,myThid)
> ...
> 
> But this doesn't work, I get the error message. So how do I make the 
> variables in dic_biotic_forcing.F or another file known to 
> ptracers_write_state.F?


Hi Karsten,

If you want a variable to be defined within two or more subroutines,
then it it needs to be either:

 (1) in a common block defined within those subroutines,  or
 (2) passed as an argument.

In your case, it will probably be easier to create a new common block,
add the "cflux" variable (which is currently a local variable and
therefor only defined within one subroutine) to the new common block,
and then define that new common block in both subroutines.  There are
many examples of common blocks in MITgcm so you can see how they work.

Alternatively, you can write the local variable(s) that you want from
within the subroutine(s) where they are currently defined.  But the
common block approach might be quicker and easier [although its rather
sloppy in terms of coding style! :-)].

Ed



-- 
Edward H. Hill III, PhD
office:  MIT Dept. of EAPS;  Rm 54-1424;  77 Massachusetts Ave.
             Cambridge, MA 02139-4307
emails:  eh3 at mit.edu                ed at eh3.com
URLs:    http://web.mit.edu/eh3/    http://eh3.com/
phone:   617-253-0098
fax:     617-253-4464




More information about the MITgcm-support mailing list