Home     |     .Net Programming    |     cSharp Home    |     Sql Server Home    |     Javascript / Client Side Development     |     Ajax Programming

Ruby on Rails Development     |     Perl Programming     |     C Programming Language     |     C++ Programming     |     IT Jobs

Python Programming Language     |     Laptop Suggestions?    |     TCL Scripting     |     Fortran Programming     |     Scheme Programming Language


 
 
Cervo Technologies
The Right Source to Outsource

MS Dynamics CRM 3.0

Fortran Programming Language

XLF and NAMELIST


Hi,

I have a question concerning NAMELISTs and fortran.   Here is the
problem I have:

I am attempting to read in configuration information into a large
program (ZEUS-MP v2).  It has been compiled and tested on a different
machine (using the intel compiler); however, it refuses to read the
namelist properly.  For example,

 use config

 namelist /geomconf/ lgeom,ldimen

 read(1,goeomconf)

with namelist file

 &geomconf
 lgeom = 2,
 ldimen = 3/

would set lgeom=3 and leave ldimen unchanged (or undefined if it
hasn't be set previously).   lgeom and ldimen are definied in a
separate file which defines all of the modules.

Since ZEUS-MP is large, I took the two files involved and turned them
into a program.  Qualitatively, everything is the same, except that
the configure subroutine has been turned into a program.... and it now
reads everything properly.

I don't know what the problem is!  Can somebody give me an idea what
could be wrong?

I can post some code if people like.  I avoided doing it here because
it would take up a lot of space.

On Apr 6, 3:58 pm, duncanchris@gmail.com wrote:
...

> I am attempting to read in configuration information into a large
> program (ZEUS-MP v2).  It has been compiled and tested on a different
> machine (using the intel compiler); however, it refuses to read the
> namelist properly.  ...

...snip code segment showing a perfectly normal looking NAMELIST
example...

> Since ZEUS-MP is large, I took the two files involved and turned them
> into a program.  Qualitatively, everything is the same, except that
> the configure subroutine has been turned into a program.... and it now
> reads everything properly.

> ... Can somebody give me an idea what could be wrong?

...

It appears you've demonstrated that the problem isn't actually
NAMELIST but something in the rest of the code that has been pared.
My guess would be the READ actually did set the values of the
variables in the input namelist but there's an error in the definition
or scoping of the variables between the subroutine in which they are
being read and where you're trying to examine the values.

To confirm this hypothesis, can you display the affected variables
correctly directly after the execution of the NAMELIST input?  I'm
thinking you will be able to and it's only when leaving that
subroutine the problem is apparent.

On Apr 6, 7:09 pm, "dpb" <dpboza@swko.net> wrote:

I tried printing out the contents of the variables immediately after
the namelist is read.
The values aren't correct.

Here is a snipit of the actual code:

--------------------------------------------------------------------------- ----------------------------------------------------
c
      subroutine configure
c
      use real_prec
      use param
      use config
c
#ifdef MPI_USED
      use mpiyes
#else
      use mpino
#endif
      use mpipar
c
      implicit NONE
c
      integer ::  confi_buf(10)
      logical ::  confl_buf(20)
      real(rl)::  confr_buf(2)
      integer ::  x,dimen
c
      namelist /geomconf/  lgeom, ldimen
      namelist /physconf/  lrad   , xhydro , xgrav, xmhd    , xgrvfft,
     &                     xptmass, xtotnrg, xiso , xvgrid  , xsubav,
     &                     xforce , xsphgrv, xodad, leos    , nspec,
     &                     lopac
      namelist /ioconf/    xascii , xhdf, xrestart, xtsl
      namelist /preconf/   small_no, large_no
      namelist /arrayconf/ izones, jzones, kzones, maxijk

      namelist /duncan/ x,dimen

      open(unit=2,file='duncan',status='old')
      read(2,duncan)
      print *, x,dimen
      close(2)

c
c----------------------------------------------------------------------
c     If parallel execution, start up MPI
c----------------------------------------------------------------------
c
#ifdef MPI_USED
       call MPI_INIT( ierr )
       call MPI_COMM_RANK( MPI_COMM_WORLD, myid_w  , ierr )
       call MPI_COMM_SIZE( MPI_COMM_WORLD, nprocs_w, ierr )
#else
       myid_w = 0
       myid   = 0
#endif /* MPI_USED */
c
c----------------------------------------------------------------------
c     Open zmp_conf run configuration file
c----------------------------------------------------------------------
c

      if(myid_w .eq. 0) open(unit=1,file='zmp_inp',status='old')
c
c----------------------------------------------------------------------
c     Initialize all parameters to default values before continuing
c     with configuration READ
c----------------------------------------------------------------------
c
      lgeom    = 1
      ldimen   = 3
      lrad     = 0
      leos     = 1
      lopac    = 0
      nspec    = 1
      izones   = 32
      jzones   = 32
      kzones   = 32
      maxijk   = 32
      xvgrid   = .false.
      xhydro   = .false.
      xforce   = .false.
      xgrav    = .true.
      xgrvfft  = .false.
      xsphgrv  = .false.
      xptmass  = .false.
      xmhd     = .true.
      xodad    = .false.
      xtotnrg  = .false.
      xiso     = .false.
      xascii   = .false.
      xhdf    = .true.
      xrestart = .false.
      xtsl     = .false.
      large_no = 1.0D99
      small_no = 1.0D-99

c
c----------------------------------------------------------------------
c     Read remaining namelists
c----------------------------------------------------------------------
c
      if(myid_w .eq. 0) then

       read(1,geomconf)

       confi_buf(1) = lgeom
       confi_buf(2) = ldimen
c
c----------------------------------------------------------------------
c     Print offending variables... hmmmm... why aren't they being
read?
c----------------------------------------------------------------------
c
       print *,"LGEOM=",lgeom
       print *,"LDIMEN=",ldimen
c Doesn't print the correct variables.

--------------------------------------------------------------------------- -----------------------------

Duncan

On Apr 18, 2:02 pm, duncanchris@gmail.com wrote:

... snip code for brevity ...

> c
> c----------------------------------------------------------------------
> c     Read remaining namelists
> c----------------------------------------------------------------------
> c
>       if(myid_w .eq. 0) then

>        read(1,geomconf)

...

myid_w <> 0 would do it for one.

Another thing I noted is the test print is after an assignment, not
_immediately_ after the read so remains possibility of some memory or
definition/type issue I think.

W/O a compilable test case can't more than hypothesize but that the
NAMELIST was shown to actually work in your previous test case still
makes me almost convinced it isn't NAMELIST itself but something else,
either in the code or the data.

Do you have all possible diagnostic checking options on?

It seems peculiar variables named x and dimen would be integers, is
that correct?  Is it possible there's a mismatch between namelist and
data?

On Apr 19, 8:59 am, dpb <bozart@gmail.com> wrote:

Also recommend looking at the other thread on NAMELIST -- there the
problem Brendan reported was associated w/ the order of the
declarations of variables and NAMELIST (and apparently and unobserved
or compiler option that defeated an error/warning).
On Apr 6, 1:58 pm, duncanchris@gmail.com wrote:
> Hi,

> I have a question concerning NAMELISTs and fortran.   Here is the
> problem I have:

> I am attempting to read in configuration information into a large
> program (ZEUS-MP v2).  It has been compiled and tested on a different
> machine (using the intel compiler); however, it refuses to read the
> namelist properly.  For example,

<snip>

I realize this is a couple weeks old, but just in case...

You don't specify the platform, but the subject line mentions xlf.
Try some variation
of this:

setenv XLFRTEOPTS ${XLFRTEOPTS}:"namelist=old"

Just an idea...dt

On 2007-04-19 12:59:28 -0300, dptur@lbl.gov said:

This discussion has been about READing using NAMELIST. About if and
what was read or not read.

A very easy way to check on what was read is to use the NAMELIST to
WRITE out what was just read. It will also tell you about all the
other variables that were not read by the NAMELIST.

The output is rather stylized but it is definitive about what the
NAMELIST processor thinks is going on. It is easy to forget that
NAMELIST works in both directions. Out is not the popular direction.

Add to del.icio.us | Digg this | Stumble it | Powered by Megasolutions Inc