      subroutine DATA_INPUT(funitRes,iOpt,nTrunc,iTrunc,aoh,doh,beta,
     +                      ddoh,khStart,khStep,nkhPts,
     +                      xoaMin,xoaMax,nXPts,yoaMin,yoaMax,nYPts)

c**********************************************************************
c**** Reads in data from datafiles                                 ****
c****                                                              ****
c**** Written 12/08/2021                                           ****
c**********************************************************************
c                                                     column 72 here -->
      implicit none

      character*80     fnameInp,fnameRes,dummyChar

      integer          funitInp,funitRes
      integer          ind,LEN_TO_CHAR
      integer          nkhPts,iOpt,nTrunc,nXPts,nYPts,iTrunc

      double precision aoh,doh,ddoh,beta,khStart,khStep
      double precision xoaMin,xoaMax,yoaMin,yoaMax

c**********************************************************************
c**** Define the file unit numbers to be used                      ****
c**********************************************************************

      funitInp = 10

c**********************************************************************
c**** title and ask for control file name default available        ****
c**********************************************************************

      write (*,'(/18x,''Structured truncated cylinder'')')
      write (*,'(18x,''*****************************'')')
      write (*,'(/''Enter input file (default <CR>) : ''$)')
      read (*,'(a)') fnameInp
      if (fnameInp.eq.'') then
        fnameInp = 'default.inp'
      endif

c**********************************************************************
c**** Open input file and read in all relevant data                ****
c**********************************************************************

      call FOPEN(funitInp,fnameInp,'r')

      write (*,'('' Reading iOpt ... '')')
      read (funitInp,*) dummyChar
      read (funitInp,*) iOpt
      write (*,'(1x,i2)') iOpt

      write (*,'('' Reading nTrunc, iTrunc ... '')')
      read (funitInp,*) dummyChar
      read (funitInp,*) nTrunc,iTrunc
      write (*,'(2(1x,i5))') nTrunc,iTrunc

      write (*,'('' Reading a/h ... '')')
      read (funitInp,*) dummyChar
      read (funitInp,*) aoh
      write (*,'(1x,f10.6)') aoh

      write (*,'('' Reading d+/h, d-/h ... '')')
      read (funitInp,*) dummyChar
      read (funitInp,*) doh,ddoh
      write (*,'(2(1x,f10.6))') doh,ddoh

      write (*,'('' Reading beta ... '')')
      read (funitInp,*) dummyChar
      read (funitInp,*) beta
      write (*,'(1x,f10.6)') beta

      write (*,'('' Reading kh (Start, Step, Npts) ... '')')
      read (funitInp,*) dummyChar
      read (funitInp,*) khStart,khStep,nkhPts
      write (*,'(2(1x,f9.5),1x,i4)') khStart,khStep,nkhPts

      write (*,'('' Reading xoaMin, xoaMax, nXPts ... '')')
      read (funitInp,*) dummyChar
      read (funitInp,*) xoaMin,xoaMax,nXPts
      write (*,'(2(1x,f12.6),1x,i4)') xoaMin,xoaMax,nXPts

      write (*,'('' Reading yoaMin, yoaMax, nYPts ... '')')
      read (funitInp,*) dummyChar
      read (funitInp,*) yoaMin,yoaMax,nYPts
      write (*,'(2(1x,f12.6),1x,i4)') yoaMin,yoaMax,nYPts

c**********************************************************************
c**** Close control file                                           ****
c**********************************************************************

      close(funitInp)

c**********************************************************************
c**** Define a file for results to go into and open it for writing ****
c**********************************************************************

      ind = LEN_TO_CHAR(fnameInp,'.')
      fnameRes = fnameInp(1:ind)//'res'
      call FOPEN(funitRes,fnameRes,'w')

      return

      end
