xref: /phasta/phSolver/common/input.f (revision 513954ef803c300cddba2bb96b4a5dac0b93489a)
1        subroutine input()
2c
3c----------------------------------------------------------------------
4c This routine inputs all the necessary data, allocates required array
5c storage, and sets up the appropriate parameters for the processing.
6c
7c
8c Farzin Shakib, Winter 1987.
9c Zdenek Johan,  Winter 1991.  (Fortran 90)
10c----------------------------------------------------------------------
11c
12        include "common.h"
13        include "mpif.h"
14
15        external endata
16
17        integer, allocatable :: nsons(:)
18c
19        character*8  date
20        character*80 card
21
22c assigned in phasta.cc
23c        numpe=npe
24c        myrank=mrank
25
26        call MPI_BARRIER(MPI_COMM_WORLD, ierr)
27        rsec=TMRC()
28        ttim(100) = rsec
29
30        epsM = sqrt(epsilon(one))
31c
32c.... read in and block all data
33c
34        call readnblk()
35c
36c.... open the echo file (echo closed at exit)
37c
38        if (myrank == master)
39     &  open (unit=iecho, file=fecho, status='unknown',   err=996)
40
41c
42c.... -------------------->  Control Parameters  <---------------------
43c
44c.... echo the global information
45c
46
47        title = 'Default Ensa Case'
48        call date_and_time (date)
49        title  = title(1:69) // ' ' // date(7:8) // '/' // date(5:6)
50     &                                           // '/' // date(3:4)
51        ititle = char(12) // title(1:78)
52
53        if (myrank == master) then
54          write (iecho,1100) ititle, numpe,  numnp,  numel,  numelb,
55     &                               nen,    nfaces, nsd,    numflx
56          write (iecho,1200)         iALE,   icoord, navier, irs,
57     &                               iexec,  necho
58c
59c.... check the input parameters
60c
61          if (iALE .lt. 0 .or. iALE .gt. 1)
62     &                     call error ('input   ','iALE    ',iALE)
63c
64          if (icoord .lt. 0 .or. icoord .gt. 1)
65     &                     call error ('input   ','icoord  ',icoord)
66c
67          if (navier .lt. 0 .or. navier .gt. 1)
68     &                     call error ('input   ','navier  ',navier)
69
70          if (irs    .lt. 0 .or. irs    .gt. 3)
71     &                     call error ('input   ','irs     ',irs)
72c
73          if (iexec  .lt. 0 .or. iexec  .gt. 1)
74     &                     call error ('input   ','iexec   ',iexec)
75c
76          if (necho  .lt. 0 .or. necho  .gt. 3)
77     &                     call error ('input   ','necho   ',necho)
78        endif
79
80        if (myrank == master) then
81          write (iecho,1300) ititle, ntseq,  imap,   ivart,  iDC,
82     &                             Kspace, nGMRES
83c
84c.... check the input parameters
85c
86          if (ntseq  .gt. 100) call error ('input   ','ntseq   ',ntseq)
87c
88          if (imap   .lt. 0 .or. imap  .gt. 1)
89     &                       call error ('input   ','imap    ',imap)
90c
91          if (ivart  .lt. 1 .or. ivart .gt. 3)
92     &                       call error ('input   ','ivart   ',ivart)
93c
94          if (iDC    .lt. 0 .or. iDC   .gt. 4)
95     &                       call error ('input   ','iDC     ',iDC)
96c
97          if (Kspace .lt. 1)   call error ('input   ','Kspace  ',Kspace)
98c
99          if (nGMRES .lt. 1)   call error ('input   ','nGMRES  ',nGMRES)
100        endif
101c
102c.... allocate memory for the Q-R algorithm of GMRES
103c
104        mHBrg = mpoint ('H-Berg  ', Kspace+1,Kspace,  0)
105        meBrg = mpoint ('e-Berg  ', Kspace+1,0,       0)
106        myBrg = mpoint ('y-Berg  ', Kspace,  0,       0)
107        mRcos = mpoint ('Rcos-QR ', Kspace,  0,       0)
108        mRsin = mpoint ('Rsin-QR ', Kspace,  0,       0)
109c
110c.... ----------------->  Time Sequence Parameters  <-----------------
111c
112c.... echo the solver information
113c
114        iprev = 0
115        do i = 1, ntseq
116          if (mod(i,50).eq.1 .and. myrank .eq. master)
117     &      write(iecho,1400) ititle
118
119          if (myrank .eq. master)
120     &      write (iecho,1500)      i, nstep(i),  niter(i),  impl(i),
121     &                                 LHSupd(i), epstol(i)
122c
123          if ((iALE .eq. 1) .or. (niter(i) .gt. 1)) iprev = 1
124        enddo
125c
126c.... echo the spatial and time integration information
127c
128        do i = 1, ntseq
129          if (mod(i,50).eq.1 .and. myrank .eq. master)
130     &      write(iecho,1600) ititle
131          if (myrank .eq. master)
132     &      write (iecho,1700)      i, intg(1,i), intg(2,i), rhoinf(i),
133     &                                 loctim(i), Delt(i),   CFLfl(i),
134     &                                 CFLsl(i)
135c
136        enddo
137c
138        if (myrank .eq. master)
139     &    write (iecho,1800) ititle, ntout,  ioform, ro,     vel,
140     &                               temper, press,  entrop
141
142        if (myrank .eq. master) then
143           write (*,*) 'Element block size = ',ibksiz
144        endif
145
146        if (iLSet .gt. 0 .and. myrank .eq. master)then
147           write(iecho,1900)iLSet, epsilon_ls, dtlset
148        endif
149c
150c.... generate the spatial integration rules
151c
152        call genint
153
154        ichem = 0
155c
156c.... estimate number of nonzero global entries:
157c....       nnonzero ~ nnz * nshg
158c
159        if (ipord .eq. 1) then
160           nnz = 35
161        else if (ipord .eq. 2) then
162           nnz = 85
163        else  !assumed cubic
164           nnz = 300
165        endif
166
167
168c
169c.... compute fluid thermodynamic properties
170c
171        Boltzm = Rh / Nh
172c
173        do i = 1, 5
174          Rs(i)   = Rh / Msh(i)
175          h0s(i)  = h0sh(i) / Msh(i)
176          cpsh(i) = ( pt5 * dofs(i) + one ) * Rh
177          cps(i)  = ( pt5 * dofs(i) + one ) * Rs(i)
178          cvs(i)  = pt5 * dofs(i) * Rs(i)
179        enddo
180c
181        do i = 1, 5
182          s0sh(i) = Rh * ( pt5*( log( (two*pi*Msh(i)/(Nh*Planck**2))**3
183     &                  * Boltzm**5 ) + five ) + log(g0s(i)) )
184        enddo
185c
186        do i = 1, 3
187          s0sh(i) = s0sh(i) + Rh * ( one - log(sigs(i)*Trot(i)) )
188        enddo
189c
190        Rgas  = one / ( xN2 / Rs(1) + xO2 / Rs(2) )
191        if(myrank.eq.0) write(*,*) 'input.f computes Rgas to be', Rgas
192c        Rgas  = 0.4*716.5
193c        Rgas = 8314/28.95
194        yN2   = xN2 * Rgas / Rs(1)
195        yO2   = xO2 * Rgas / Rs(2)
196c
197        s0    =     yN2 * s0sh(1) / Msh(1) + yO2 * s0sh(2) / Msh(2)
198        const = - ( yN2 * Rs(1) * log(xN2) + yO2 * Rs(2) * log(xO2) )
199c
200c.... stop CPU-timer
201c
202c        call timer ('Back    ')
203cc
204c..dumping common (useful for checking differences with
205c        old format input
206c
207        if(myrank.eq.-1) then
208        mxats=1
209        open (unit=23,   file="dumpnew.dat",   status='unknown')
210        write (23,*)" master, numpe, myrank"
211        write (23,*) master, numpe, myrank
212        write (23,*)" maxfront, nlwork"
213        write (23,*) maxfront, nlwork
214        write (23,*)"  numper, nshgt, nshg0"
215        write (23,*)  numper, nshgt, nshg0
216        write (23,*) " birth, death, comtim"
217        write (23,*)  birth, death, comtim
218        write (23,*)"  pzero, wtavei,dtavei, dke, ierrcalc,"
219        write (23,*)  pzero, wtavei,dtavei, dke, ierrcalc,
220     &                   itwmod,taucfct
221        write (23,*)"irscale, intpres,rxinlt, rxrecy,"
222        write (23,*)irscale, intpres,rxinlt, rxrecy,
223     &            rbltin,rvscal,  xlngth, ylngth, zlngth
224
225        write (23,*)"  scdiff(5),nsclr,isclr,nsolt"
226        write (23,*)  scdiff(5),nsclr,isclr,nsolt
227        write (23,*) " flxID(10,20), Force(3),HFlux, nsrflist(0:20)"
228        write (23,*)  flxID(10,20), Force(3),HFlux, nsrflist(0:20)
229        write (23,*) " numnp,  numel,  numelb, numpbc, nen,    nfaces,"
230        write (23,*)  numnp,  numel,  numelb, numpbc, nen,    nfaces,
231     &                  numflx, ndof,   iALE,   icoord, navier,
232     &                  irs,    iexec,  necho,  ichem,  iRK,    nedof,
233     &                  nshg,   nnz,    istop,  nflow,  nnz_tot, idtn,
234     &                  iLSet
235        write (23,*)"  epsilon_ls, epsilon_lsd, dtlset"
236        write (23,*)  epsilon_ls, epsilon_lsd, dtlset
237        write (23,*)" nshape, nshapeb, maxshb,"
238        write (23,*) nshape, nshapeb, maxshb,
239     &                  nshl, nshlb,nfath,  ntopsh,  nsonmax
240        write (23,*) " mshp,   mshgl,  mwght,  mshpb,  mshglb, mwghtb,"
241        write (23,*)  mshp,   mshgl,  mwght,  mshpb,  mshglb, mwghtb,
242     &                  mmut,   mrhot,  mxst
243        write (23,*)" mcsyst, melCat, nenCat(8,3),    nfaCat(8,3)"
244        write (23,*) mcsyst, melCat, nenCat(8,3),    nfaCat(8,3)
245
246        write (23,*)" lelCat, lcsyst, iorder, nenb, "
247        write (23,*) lelCat, lcsyst, iorder, nenb,
248     &                  nelblk, nelblb, ndofl,  nsymdl, nenl,   nfacel,
249     &                  nenbl,  intind, mattyp
250        write (23,*)" E3nsd,  I3nsd,  nsymdf, ndofBC, ndiBCB, ndBCB,"
251        write (23,*) E3nsd,  I3nsd,  nsymdf, ndofBC, ndiBCB, ndBCB,
252     &                  Jactyp, jump,   ires,   iprec,  ibound,
253     &                  idiff,  lhs,    itau,   ipord,  ipred,  lstres,
254     &                  iepstm, dtsfct, ibksiz, iabc
255        write (23,*)"  epstol(mxats),  Delt(mxats),"
256        write (23,*)  epstol(mxats),  Delt(mxats),     nstep(mxats),
257     &                  impl(mxats),    rhoinf(mxats),
258     &                  LHSupd(mxats),  loctim(mxats),  deltol(mxats,2)
259
260        write (23,*)" intg(2,mxats),  intpt(3),       intptb(3)"
261        write (23,*) intg(2,mxats),  intpt(3),       intptb(3)
262        write (23,*) " indQpt(3,3,4),  numQpt(3,3,4),"
263        write (23,*)  indQpt(3,3,4),  numQpt(3,3,4),
264     &                  intmax
265        write (23,*)" iin,    igeom,  ipar,   ibndc,  imat,   iecho,"
266        write (23,*) iin,    igeom,  ipar,   ibndc,  imat,   iecho,
267     &                  iout,   ichmou, irstin, irstou, ihist,  iflux,
268     &                  ierror, itable, iforce, igraph, itime
269        write (23,*)"fwr1,ngaussf,idim,nlist "
270        write (23,*)fwr1,ngaussf,idim,nlist
271        write (23,*) " fin,    fgeom,  fpar,   fbndc,  fmat,   fecho,"
272        write (23,*)  fin,    fgeom,  fpar,   fbndc,  fmat,   fecho,
273     &                  frstin, frstou, fhist,  ferror, ftable, fforce,
274     &                  fgraph, ftime
275        write (23,*)" fin,    fgeom,  fpar,   fbndc,  fmat,   fecho,"
276        write (23,*) fin,    fgeom,  fpar,   fbndc,  fmat,   fecho,
277     &                  frstin, frstou, fhist,  ferror, ftable, fforce,
278     &                  fgraph, ftime
279        write (23,*)" eGMRES, lGMRES, iKs,    ntotGM "
280        write (23,*) eGMRES, lGMRES, iKs,    ntotGM
281        write (23,*) " mHBrg,  meBrg,  myBrg,  mRcos,  mRsin"
282        write (23,*)  mHBrg,  meBrg,  myBrg,  mRcos,  mRsin
283c
284        write (23,*)" pr,     Planck, Stefan, Nh,     Rh,     Rgas,"
285        write (23,*) pr,     Planck, Stefan, Nh,     Rh,     Rgas,
286     &                  gamma,  gamma1, s0,     const,  xN2,    xO2,
287     &                  yN2,    yO2,    Msh(5), cpsh(5),s0sh(5),h0sh(5),
288     &                  Rs(5),  cps(5), cvs(5), h0s(5), Trot(5),sigs(5),
289     &                  Tvib(5),g0s(5), dofs(5),ithm
290        write (23,*) " mexist"
291        write (23,*)  mexist
292        write (23,*) " datmat(3,5,mxats),      matflg(5,mxats),"
293        write (23,*)  datmat(3,5,mxats),      matflg(5,mxats),
294     &                  nummat,                 mexist
295        write (23,*)"ro,     vel,    temper, press,  entrop, ntout,"
296        write (23,*)ro,     vel,    temper, press,  entrop, ntout,
297     &                  ioform
298        write (23,*)"mbeg,   mend,   mprec "
299        write (23,*)mbeg,   mend,   mprec
300        write (23,*)"epsM,   iabres, npro,resfrt"
301        write (23,*)epsM,   iabres, npro,resfrt
302        write (23,*)"  imap,   ivart,  iDC,    iPcond, Kspace, nGMRES"
303        write (23,*)  imap,   ivart,  iDC,    iPcond, Kspace, nGMRES
304
305        write (23,*)" indsym(5,5) "
306        write (23,*) indsym(5,5)
307        write (23,*) " time,   CFLfld, CFLsld, Dtgl,   Dtmax,  alpha,"
308        write (23,*)  time,   CFLfld, CFLsld, Dtgl,   Dtmax,  alpha,
309     &                  etol,   lstep,  ifunc,  itseq,  istep,  iter,
310     &                  nitr,   almi,   alfi,   gami,   flmpl,  flmpr,
311     &                  dtol(2)
312        write (23,*) "LCtime, ntseq"
313        write (23,*) LCtime, ntseq
314        write (23,*) " numeqns(100), minIters, maxIters,"
315        write (23,*)  numeqns(100), minIters, maxIters,
316     &                  iprjFlag,     nPrjs,    ipresPrjFlag, nPresPrjs,
317     &                  prestol,      statsflow(6), statssclr(6),
318     &                  iverbose
319        write (23,*) " ccode"
320        write (23,*)  ccode
321        write (23,*) " flops,  gbytes, sbytes, iclock, icd,    icode,"
322        write (23,*)  flops,  gbytes, sbytes, iclock, icd,    icode,
323     &                  icode2, icode3
324        write (23,*) " cpu(11),        cpu0(11),       nacess(11)"
325        write (23,*)  cpu(11),        cpu0(11),       nacess(11)
326        write (23,*) " title,  ititle"
327        write (23,*)  title,  ititle
328        close (23)
329        endif
330c
331c....return
332c
333        return
334c
335c.... end of file error handling
336c
337992     call error ('input   ','opening ', imat)
338993     call error ('input   ','opening ', iin)
339996     call error ('input   ','opening ', iecho)
340999     call error ('input   ','end file', iin)
341c
3421000    format(a69)
3431100    format(a80,//,
344     &  ' M a i n   C o n t r o l   P a r a m e t e r s        '   //,
345     &  ' number of processing elements . . . . . . . (numpe )=',i10//,
346     &  ' number of mesh nodes  . . . . . . . . . . . (numnp )=',i10//,
347     &  ' number of elements  . . . . . . . . . . . . (numel )=',i10//,
348     &  ' number of boundary elements . . . . . . . . (numelb)=',i10//,
349     &  ' number of element nodes . . . . . . . . . . (nen   )=',i10//,
350     &  ' number of element faces . . . . . . . . . . (nfaces)=',i10//,
351     &  ' number of space dimensions  . . . . . . . . (nsd   )=',i10//,
352     &  ' number of boundary flux nodes . . . . . . . (numflx)=',i10/)
3531200    format(
354     &  ' frame of reference  . . . . . . . . . . . . (iALE  )=',i10//,
355     &  '    eq. 0, Eulerian                                   ',  / ,
356     &  '    eq. 1, arbitrary Lagrangian-Eulerian              ',  //,
357     &  ' coordinate system . . . . . . . . . . . . . (icoord)=',i10//,
358     &  '    eq. 0, cartesian                                  ',  / ,
359     &  '    eq. 1, axisymmetric                               ',  //,
360     &  ' equation type . . . . . . . . . . . . . . . (navier)=',i10//,
361     &  '    eq. 0, Euler (inviscid)                           ',  / ,
362     &  '    eq. 1, Navier-Stokes (viscous)                    ',  //,
363     &  ' restart option  . . . . . . . . . . . . . . (irs   )=',i10//,
364     &  '    eq. 0, no restart nor solution written            ',  / ,
365     &  '    eq. 1, restart written                            ',  / ,
366     &  '    eq. 2, restart and solution written               ',  //,
367     &  ' execution code  . . . . . . . . . . . . . . (iexec )=',i10//,
368     &  '    eq. 0, data check only                            ',  / ,
369     &  '    eq. 1, execution                                  ',  //,
370     &  ' input echo parameter  . . . . . . . . . . . (necho )=',i10)
3711300    format(a80,//,
372     &  ' S o l u t i o n   P a r a m e t e r s                '   //,
373     &  ' number of time sequences  . . . . . . . . . (ntseq )=',i10//,
374     &  ' blocking algorithm  . . . . . . . . . . . . (imap  )=',i10//,
375     &  '    eq. 0, ordered blocking                           ',  / ,
376     &  '    eq. 1, disjoint element blocking                  ',  //,
377     &  ' variational formulation . . . . . . . . . . (ivart )=',i10//,
378     &  '    eq. 1, Galerkin                                   ',  / ,
379     &  '    eq. 2, Galerkin/least-squares                     ',  / ,
380     &  '    eq. 3, plus discontinuity-capturing operator      ',  //,
381     &  ' discontinuity-capturing type  . . . . . . . (iDC   )=',i10//,
382     &  '    eq. 1, DC-mallet                                  ',  / ,
383     &  '    eq. 2, quadratic DC                               ',  / ,
384     &  '    eq. 3, smallest of the previous two DCs           ',  //,
385     &  ' dimension of Krylov space . . . . . . . . . (kspace)=',i10//,
386     &  ' maximum number of GMRES cycles  . . . . . . (ngmres)=',i10)
3871400    format(a80,//,
388     &  ' S o l v e r   I n f o r m a t i o n                    ',//,
389     &  ' Seq num    Nstep    Niter    Impl      Nupdate',
390     &  '     Eps_Tol')
3911500    format(i6,i10,i9,i8,i11,2x,e15.5)
3921600    format(a80,//,
393     &  ' S p a t i a l   a n d   T i m e   I n t e g r a t i o n',//,
394     &  ' Seq num  Elem Int.  Bound Int.  Level  LCtime',
395     &  '    Delt       CFLfld    CFLsld')
3961700    format(i6,i8,i12,e13.4,1p,i8,1p,e13.4,0p,2f10.4)
3971800    format(a80,//,
398     &  ' O u t p u t   I n f o r m a t i o n                  ',1p,//,
399     &  ' number of time steps per output . . . . . . (ntout )=',i10//,
400     &  ' I/O format  . . . . . . . . . . . . . . . . (ioform)=',i10//,
401     &  '    eq. 0, ASCII                                      ',  / ,
402     &  '    eq. 1, binary                                     ',  //,
403     &' scaling factor for density  . . . . . . . . (ro    )=',e15.5//,
404     &' scaling factor for velocity . . . . . . . . (vel   )=',e15.5//,
405     &' scaling factor for temperature. . . . . . . (temper)=',e15.5//,
406     &' scaling factor for pressure . . . . . . . . (press )=',e15.5//,
407     &' scaling factor for entropy  . . . . . . . . (entrop)=',e15.5)
408c
409
4101900    format(//,
411     &  ' L e v e l   S e t   P a r a m e t e r s               '   //,
412     &  ' Level Set Switch        . . . . . . . . . . (iLSet )=',i10//,
413     &  '    eq. 0, No Level Set Solution Calculated            ',  / ,
414     &  '    eq. 1, Level Set Calculated, 2 Fluid Props Read    ',  / ,
415     &  '    eq. 2, Level Set and Redistancing Calcuations      ',  //,
416     &  ' Property Smearing Band Width  . . . . . .(epsilon_ls)=',e15.5)
417
418
419
420        end
421