cpld_gridgen 1.14.0
Loading...
Searching...
No Matches
inputnml.F90
Go to the documentation of this file.
1
7
8module inputnml
9
10 use grdvars, only : nx,ny,ni,nj,npx,maxatmres,catm
11 use grdvars, only : editmask, debug, do_postwgts
12 use charstrings, only : dirsrc, dirout, fv3dir, res, topofile, editsfile
13
14 implicit none
15
16contains
17
23
24 subroutine read_inputnml(fname)
25
26 character(len=*), intent(in) :: fname
27
28 ! local variables
29 integer :: ii, nvalid, iounit, rc
30 character(len=200) :: tmpstr
31 character(len=6) :: atmreslist(maxatmres) = ''
32
33 namelist /grid_nml/ ni, nj, dirsrc, dirout, fv3dir, topofile, editsfile, &
34 res, editmask, debug, do_postwgts, atmreslist
35
36 ! Check whether file exists.
37 inquire (file=trim(fname), iostat=rc)
38 if (rc /= 0) then
39 write (0, '(3a)') 'Error: input file "', trim(fname), '" does not exist.'
40 stop 1
41 end if
42
43 ! Open and read Namelist file.
44 open (action='read', file=trim(fname), iostat=rc, newunit=iounit)
45 read (nml=grid_nml, iostat=rc, unit=iounit)
46 if (rc /= 0) then
47 backspace(iounit)
48 read(iounit,'(a)')tmpstr
49 write (6, '(a)') 'Error: invalid Namelist format '//trim(tmpstr)
50 stop 1
51 end if
52 close(iounit)
53
54 ! Set the desired ATM resolutions
55 nvalid = 0
56 do ii = 1,size(atmreslist)
57 if (len_trim(atmreslist(ii)) > 0) nvalid = nvalid+1
58 end do
59 allocate(catm(nvalid))
60 do ii = 1,size(catm)
61 read(atmreslist(ii),'(i4)')catm(ii)
62 end do
63 ! set supergrid dimensions
64 nx = ni*2
65 ny = nj*2
66
67 end subroutine read_inputnml
68end module inputnml