xref: /phasta/phSolver/common/input.f (revision 595995161822a203c8467e0e4a253d7bd7d6df32)
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) )
191c        Rgas  = 0.4*716.5
192c        Rgas = 8314/28.95
193        yN2   = xN2 * Rgas / Rs(1)
194        yO2   = xO2 * Rgas / Rs(2)
195c
196        s0    =     yN2 * s0sh(1) / Msh(1) + yO2 * s0sh(2) / Msh(2)
197        const = - ( yN2 * Rs(1) * log(xN2) + yO2 * Rs(2) * log(xO2) )
198c
199c.... stop CPU-timer
200c
201c        call timer ('Back    ')
202cc
203c..dumping common (useful for checking differences with
204c        old format input
205c
206        if(myrank.eq.master) then
207        mxats=1
208        open (unit=23,   file="dumpnew.dat",   status='unknown')
209        write (23,*)" master, numpe, myrank"
210        write (23,*) master, numpe, myrank
211        write (23,*)" maxfront, nlwork"
212        write (23,*) maxfront, nlwork
213        write (23,*)"  numper, nshgt, nshg0"
214        write (23,*)  numper, nshgt, nshg0
215        write (23,*) " birth, death, comtim"
216        write (23,*)  birth, death, comtim
217        write (23,*)"  pzero, wtavei,dtavei, dke, ierrcalc,"
218        write (23,*)  pzero, wtavei,dtavei, dke, ierrcalc,
219     &                   itwmod,taucfct
220        write (23,*)"irscale, intpres,rxinlt, rxrecy,"
221        write (23,*)irscale, intpres,rxinlt, rxrecy,
222     &            rbltin,rvscal,  xlngth, ylngth, zlngth
223
224        write (23,*)"  scdiff(5),nsclr,isclr,nsolt"
225        write (23,*)  scdiff(5),nsclr,isclr,nsolt
226        write (23,*) " flxID(10,20), Force(3),HFlux, nsrflist(0:20)"
227        write (23,*)  flxID(10,20), Force(3),HFlux, nsrflist(0:20)
228        write (23,*) " numnp,  numel,  numelb, numpbc, nen,    nfaces,"
229        write (23,*)  numnp,  numel,  numelb, numpbc, nen,    nfaces,
230     &                  numflx, ndof,   iALE,   icoord, navier,
231     &                  irs,    iexec,  necho,  ichem,  iRK,    nedof,
232     &                  nshg,   nnz,    istop,  nflow,  nnz_tot, idtn,
233     &                  iLSet
234        write (23,*)"  epsilon_ls, epsilon_lsd, dtlset"
235        write (23,*)  epsilon_ls, epsilon_lsd, dtlset
236        write (23,*)" nshape, nshapeb, maxshb,"
237        write (23,*) nshape, nshapeb, maxshb,
238     &                  nshl, nshlb,nfath,  ntopsh,  nsonmax
239        write (23,*) " mshp,   mshgl,  mwght,  mshpb,  mshglb, mwghtb,"
240        write (23,*)  mshp,   mshgl,  mwght,  mshpb,  mshglb, mwghtb,
241     &                  mmut,   mrhot,  mxst
242        write (23,*)" mcsyst, melCat, nenCat(8,3),    nfaCat(8,3)"
243        write (23,*) mcsyst, melCat, nenCat(8,3),    nfaCat(8,3)
244
245        write (23,*)" lelCat, lcsyst, iorder, nenb, "
246        write (23,*) lelCat, lcsyst, iorder, nenb,
247     &                  nelblk, nelblb, ndofl,  nsymdl, nenl,   nfacel,
248     &                  nenbl,  intind, mattyp
249        write (23,*)" E3nsd,  I3nsd,  nsymdf, ndofBC, ndiBCB, ndBCB,"
250        write (23,*) E3nsd,  I3nsd,  nsymdf, ndofBC, ndiBCB, ndBCB,
251     &                  Jactyp, jump,   ires,   iprec,  ibound,
252     &                  idiff,  lhs,    itau,   ipord,  ipred,  lstres,
253     &                  iepstm, dtsfct, ibksiz, iabc
254        write (23,*)"  epstol(mxats),  Delt(mxats),"
255        write (23,*)  epstol(mxats),  Delt(mxats),     nstep(mxats),
256     &                  impl(mxats),    rhoinf(mxats),
257     &                  LHSupd(mxats),  loctim(mxats),  deltol(mxats,2)
258
259        write (23,*)" intg(2,mxats),  intpt(3),       intptb(3)"
260        write (23,*) intg(2,mxats),  intpt(3),       intptb(3)
261        write (23,*) " indQpt(3,3,4),  numQpt(3,3,4),"
262        write (23,*)  indQpt(3,3,4),  numQpt(3,3,4),
263     &                  intmax
264        write (23,*)" iin,    igeom,  ipar,   ibndc,  imat,   iecho,"
265        write (23,*) iin,    igeom,  ipar,   ibndc,  imat,   iecho,
266     &                  iout,   ichmou, irstin, irstou, ihist,  iflux,
267     &                  ierror, itable, iforce, igraph, itime
268        write (23,*)"fwr1,ngaussf,idim,nlist "
269        write (23,*)fwr1,ngaussf,idim,nlist
270        write (23,*) " fin,    fgeom,  fpar,   fbndc,  fmat,   fecho,"
271        write (23,*)  fin,    fgeom,  fpar,   fbndc,  fmat,   fecho,
272     &                  frstin, frstou, fhist,  ferror, ftable, fforce,
273     &                  fgraph, ftime
274        write (23,*)" fin,    fgeom,  fpar,   fbndc,  fmat,   fecho,"
275        write (23,*) fin,    fgeom,  fpar,   fbndc,  fmat,   fecho,
276     &                  frstin, frstou, fhist,  ferror, ftable, fforce,
277     &                  fgraph, ftime
278        write (23,*)" eGMRES, lGMRES, iKs,    ntotGM "
279        write (23,*) eGMRES, lGMRES, iKs,    ntotGM
280        write (23,*) " mHBrg,  meBrg,  myBrg,  mRcos,  mRsin"
281        write (23,*)  mHBrg,  meBrg,  myBrg,  mRcos,  mRsin
282c
283        write (23,*)" pr,     Planck, Stefan, Nh,     Rh,     Rgas,"
284        write (23,*) pr,     Planck, Stefan, Nh,     Rh,     Rgas,
285     &                  gamma,  gamma1, s0,     const,  xN2,    xO2,
286     &                  yN2,    yO2,    Msh(5), cpsh(5),s0sh(5),h0sh(5),
287     &                  Rs(5),  cps(5), cvs(5), h0s(5), Trot(5),sigs(5),
288     &                  Tvib(5),g0s(5), dofs(5),ithm
289        write (23,*) " mexist"
290        write (23,*)  mexist
291        write (23,*) " datmat(3,5,mxats),      matflg(5,mxats),"
292        write (23,*)  datmat(3,5,mxats),      matflg(5,mxats),
293     &                  nummat,                 mexist
294        write (23,*)"ro,     vel,    temper, press,  entrop, ntout,"
295        write (23,*)ro,     vel,    temper, press,  entrop, ntout,
296     &                  ioform
297        write (23,*)"mbeg,   mend,   mprec "
298        write (23,*)mbeg,   mend,   mprec
299        write (23,*)"epsM,   iabres, npro,resfrt"
300        write (23,*)epsM,   iabres, npro,resfrt
301        write (23,*)"  imap,   ivart,  iDC,    iPcond, Kspace, nGMRES"
302        write (23,*)  imap,   ivart,  iDC,    iPcond, Kspace, nGMRES
303
304        write (23,*)" indsym(5,5) "
305        write (23,*) indsym(5,5)
306        write (23,*) " time,   CFLfld, CFLsld, Dtgl,   Dtmax,  alpha,"
307        write (23,*)  time,   CFLfld, CFLsld, Dtgl,   Dtmax,  alpha,
308     &                  etol,   lstep,  ifunc,  itseq,  istep,  iter,
309     &                  nitr,   almi,   alfi,   gami,   flmpl,  flmpr,
310     &                  dtol(2)
311        write (23,*) "LCtime, ntseq"
312        write (23,*) LCtime, ntseq
313        write (23,*) " numeqns(100), minIters, maxIters,"
314        write (23,*)  numeqns(100), minIters, maxIters,
315     &                  iprjFlag,     nPrjs,    ipresPrjFlag, nPresPrjs,
316     &                  prestol,      statsflow(6), statssclr(6),
317     &                  iverbose
318        write (23,*) " ccode"
319        write (23,*)  ccode
320        write (23,*) " flops,  gbytes, sbytes, iclock, icd,    icode,"
321        write (23,*)  flops,  gbytes, sbytes, iclock, icd,    icode,
322     &                  icode2, icode3
323        write (23,*) " cpu(11),        cpu0(11),       nacess(11)"
324        write (23,*)  cpu(11),        cpu0(11),       nacess(11)
325        write (23,*) " title,  ititle"
326        write (23,*)  title,  ititle
327        close (23)
328        endif
329c
330c....return
331c
332        return
333c
334c.... end of file error handling
335c
336992     call error ('input   ','opening ', imat)
337993     call error ('input   ','opening ', iin)
338996     call error ('input   ','opening ', iecho)
339999     call error ('input   ','end file', iin)
340c
3411000    format(a69)
3421100    format(a80,//,
343     &  ' M a i n   C o n t r o l   P a r a m e t e r s        '   //,
344     &  ' number of processing elements . . . . . . . (numpe )=',i10//,
345     &  ' number of mesh nodes  . . . . . . . . . . . (numnp )=',i10//,
346     &  ' number of elements  . . . . . . . . . . . . (numel )=',i10//,
347     &  ' number of boundary elements . . . . . . . . (numelb)=',i10//,
348     &  ' number of element nodes . . . . . . . . . . (nen   )=',i10//,
349     &  ' number of element faces . . . . . . . . . . (nfaces)=',i10//,
350     &  ' number of space dimensions  . . . . . . . . (nsd   )=',i10//,
351     &  ' number of boundary flux nodes . . . . . . . (numflx)=',i10/)
3521200    format(
353     &  ' frame of reference  . . . . . . . . . . . . (iALE  )=',i10//,
354     &  '    eq. 0, Eulerian                                   ',  / ,
355     &  '    eq. 1, arbitrary Lagrangian-Eulerian              ',  //,
356     &  ' coordinate system . . . . . . . . . . . . . (icoord)=',i10//,
357     &  '    eq. 0, cartesian                                  ',  / ,
358     &  '    eq. 1, axisymmetric                               ',  //,
359     &  ' equation type . . . . . . . . . . . . . . . (navier)=',i10//,
360     &  '    eq. 0, Euler (inviscid)                           ',  / ,
361     &  '    eq. 1, Navier-Stokes (viscous)                    ',  //,
362     &  ' restart option  . . . . . . . . . . . . . . (irs   )=',i10//,
363     &  '    eq. 0, no restart nor solution written            ',  / ,
364     &  '    eq. 1, restart written                            ',  / ,
365     &  '    eq. 2, restart and solution written               ',  //,
366     &  ' execution code  . . . . . . . . . . . . . . (iexec )=',i10//,
367     &  '    eq. 0, data check only                            ',  / ,
368     &  '    eq. 1, execution                                  ',  //,
369     &  ' input echo parameter  . . . . . . . . . . . (necho )=',i10)
3701300    format(a80,//,
371     &  ' S o l u t i o n   P a r a m e t e r s                '   //,
372     &  ' number of time sequences  . . . . . . . . . (ntseq )=',i10//,
373     &  ' blocking algorithm  . . . . . . . . . . . . (imap  )=',i10//,
374     &  '    eq. 0, ordered blocking                           ',  / ,
375     &  '    eq. 1, disjoint element blocking                  ',  //,
376     &  ' variational formulation . . . . . . . . . . (ivart )=',i10//,
377     &  '    eq. 1, Galerkin                                   ',  / ,
378     &  '    eq. 2, Galerkin/least-squares                     ',  / ,
379     &  '    eq. 3, plus discontinuity-capturing operator      ',  //,
380     &  ' discontinuity-capturing type  . . . . . . . (iDC   )=',i10//,
381     &  '    eq. 1, DC-mallet                                  ',  / ,
382     &  '    eq. 2, quadratic DC                               ',  / ,
383     &  '    eq. 3, smallest of the previous two DCs           ',  //,
384     &  ' dimension of Krylov space . . . . . . . . . (kspace)=',i10//,
385     &  ' maximum number of GMRES cycles  . . . . . . (ngmres)=',i10)
3861400    format(a80,//,
387     &  ' S o l v e r   I n f o r m a t i o n                    ',//,
388     &  ' Seq num    Nstep    Niter    Impl      Nupdate',
389     &  '     Eps_Tol')
3901500    format(i6,i10,i9,i8,i11,2x,e15.5)
3911600    format(a80,//,
392     &  ' 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',//,
393     &  ' Seq num  Elem Int.  Bound Int.  Level  LCtime',
394     &  '    Delt       CFLfld    CFLsld')
3951700    format(i6,i8,i12,e13.4,1p,i8,1p,e13.4,0p,2f10.4)
3961800    format(a80,//,
397     &  ' O u t p u t   I n f o r m a t i o n                  ',1p,//,
398     &  ' number of time steps per output . . . . . . (ntout )=',i10//,
399     &  ' I/O format  . . . . . . . . . . . . . . . . (ioform)=',i10//,
400     &  '    eq. 0, ASCII                                      ',  / ,
401     &  '    eq. 1, binary                                     ',  //,
402     &' scaling factor for density  . . . . . . . . (ro    )=',e15.5//,
403     &' scaling factor for velocity . . . . . . . . (vel   )=',e15.5//,
404     &' scaling factor for temperature. . . . . . . (temper)=',e15.5//,
405     &' scaling factor for pressure . . . . . . . . (press )=',e15.5//,
406     &' scaling factor for entropy  . . . . . . . . (entrop)=',e15.5)
407c
408
4091900    format(//,
410     &  ' L e v e l   S e t   P a r a m e t e r s               '   //,
411     &  ' Level Set Switch        . . . . . . . . . . (iLSet )=',i10//,
412     &  '    eq. 0, No Level Set Solution Calculated            ',  / ,
413     &  '    eq. 1, Level Set Calculated, 2 Fluid Props Read    ',  / ,
414     &  '    eq. 2, Level Set and Redistancing Calcuations      ',  //,
415     &  ' Property Smearing Band Width  . . . . . .(epsilon_ls)=',e15.5)
416
417
418
419        end
420