Re: flexible input parameter file
- From: Herman D. Knoble <SkipKnobleLESS@xxxxxxxxxxxxxxx>
- Date: Thu, 15 Sep 2005 14:05:12 -0400
Or as Glen pointed out the input file could look like:
&global
x2 = 0.2 !Time Step size
x1 = 0.1 !Number of Time Step
/
Skip
On Thu, 15 Sep 2005 17:52:56 +0000 (UTC), SC Huang <schuang21@xxxxxxxxx> wrote:
-|Thank you all for suggestions! After some trials, it appears that the
-|NAMELIST approach is the simplest solution for my original problem.
-|In the following, a simple sample code that I tested is listed below,
-|in case some "rookies" (like me) are looking for the same
-|solution. :-)
-|
-|To creates a namelist called "global", which contains two real numbers
-|(x1,x2):
-|
-| real :: x1,x2
-| integer :: fid=20
-| namelist /global/ x1,x2
-|
-| open(fid,file="nlist.in",form="formatted")
-| read(fid, NML=global)
-| close(fid)
-|
-|The input file "nlist.in" looks like:
-|
-|#
-|# input file for nlist.f
-|#
-|
-|&global
-|
-| !* time step size
-|
-| x2= 0.2
-|
-| !* number of time step
-|
-| x1= 0.1
-|/
-|
-|To print out the whole namelist (for checking), I used:
-|
-| write(*, NML=global)
-|
-|One can also print out variables x1 or x2 as usual:
-|
-| write(*, '(f10.3)') x1
-|
-|
-|Note that the order of x1 and x2 in the input file "nlist.in" does not
-|matter. This is a good feature for having more freedom in input file
-|format.
-|
-|Thank you all again. The NAMELIST usage has been an eye-opener for
-|me! :-)
.
- Follow-Ups:
- Re: flexible input parameter file
- From: SC Huang
- Re: flexible input parameter file
- References:
- flexible input parameter file
- From: SC Huang
- Re: flexible input parameter file
- From: Madhusudan Singh
- Re: flexible input parameter file
- From: glen herrmannsfeldt
- Re: flexible input parameter file
- From: SC Huang
- flexible input parameter file
- Prev by Date: Re: flexible input parameter file
- Next by Date: [Fortran 77] swaping two arrays (newbie)
- Previous by thread: Re: flexible input parameter file
- Next by thread: Re: flexible input parameter file
- Index(es):
Relevant Pages
|