cpld_gridgen  1.13.0
 All Data Structures Files Functions Variables Pages
inputnml.F90
Go to the documentation of this file.
1 
7 
8 module inputnml
9 
10  use grdvars, only : nx,ny,ni,nj,npx
11  use grdvars, only : editmask, debug, do_postwgts
12  use charstrings, only : dirsrc, dirout, fv3dir, res, atmres, topofile, editsfile
13 
14  implicit none
15 
16 contains
17 
23 
24  subroutine read_inputnml(fname)
25 
26  character(len=*), intent(in) :: fname
27 
28  ! local variables
29  integer :: stderr, iounit, rc
30 
31  namelist /grid_nml/ ni, nj, dirsrc, dirout, fv3dir, topofile, editsfile, &
32  res, atmres, npx, editmask, debug, &
33  do_postwgts
34 
35  ! Check whether file exists.
36  inquire (file=trim(fname), iostat=rc)
37 
38  if (rc /= 0) then
39  write (stderr, '(3a)') 'Error: input file "', trim(fname), '" does not exist.'
40  return
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 
47  ! set supergrid dimensions
48  nx = ni*2
49  ny = nj*2
50 
51  if (rc /= 0) then
52  write (stderr, '(a)') 'Error: invalid Namelist format.'
53  end if
54 
55  close (iounit)
56  end subroutine read_inputnml
57 end module inputnml
subroutine read_inputnml(fname)
Read input namelist file.
Definition: inputnml.F90:24