xref: /phasta/phSolver/common/input.f (revision 8c06e07d75283b78095e57c11329d999e11c1ba6)
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.... ----------------->  Time Sequence Parameters  <-----------------
103c
104c.... echo the solver information
105c
106        iprev = 0
107        do i = 1, ntseq
108          if (mod(i,50).eq.1 .and. myrank .eq. master)
109     &      write(iecho,1400) ititle
110
111          if (myrank .eq. master)
112     &      write (iecho,1500)      i, nstep(i),  niter(i),  impl(i),
113     &                                 LHSupd(i), epstol(i)
114c
115          if ((iALE .eq. 1) .or. (niter(i) .gt. 1)) iprev = 1
116        enddo
117c
118c.... echo the spatial and time integration information
119c
120        do i = 1, ntseq
121          if (mod(i,50).eq.1 .and. myrank .eq. master)
122     &      write(iecho,1600) ititle
123          if (myrank .eq. master)
124     &      write (iecho,1700)      i, intg(1,i), intg(2,i), rhoinf(i),
125     &                                 loctim(i), Delt(i),   CFLfl(i),
126     &                                 CFLsl(i)
127c
128        enddo
129c
130        if (myrank .eq. master)
131     &    write (iecho,1800) ititle, ntout,  ioform, ro,     vel,
132     &                               temper, press,  entrop
133
134        if (myrank .eq. master) then
135           write (*,*) 'Element block size = ',ibksiz
136        endif
137
138        if (iLSet .gt. 0 .and. myrank .eq. master)then
139           write(iecho,1900)iLSet, epsilon_ls
140        endif
141c
142c.... generate the spatial integration rules
143c
144        call genint
145
146        ichem = 0
147c
148c.... estimate number of nonzero global entries:
149c....       nnonzero ~ nnz * nshg
150c
151        if (ipord .eq. 1) then
152           nnz = 35
153        else if (ipord .eq. 2) then
154           nnz = 85
155        else  !assumed cubic
156           nnz = 300
157        endif
158
159
160c
161c.... compute fluid thermodynamic properties
162c
163        Boltzm = Rh / Nh
164c
165        do i = 1, 5
166          Rs(i)   = Rh / Msh(i)
167          h0s(i)  = h0sh(i) / Msh(i)
168          cpsh(i) = ( pt5 * dofs(i) + one ) * Rh
169          cps(i)  = ( pt5 * dofs(i) + one ) * Rs(i)
170          cvs(i)  = pt5 * dofs(i) * Rs(i)
171        enddo
172c
173        do i = 1, 5
174          s0sh(i) = Rh * ( pt5*( log( (two*pi*Msh(i)/(Nh*Planck**2))**3
175     &                  * Boltzm**5 ) + five ) + log(g0s(i)) )
176        enddo
177c
178        do i = 1, 3
179          s0sh(i) = s0sh(i) + Rh * ( one - log(sigs(i)*Trot(i)) )
180        enddo
181c
182        Rgas  = one / ( xN2 / Rs(1) + xO2 / Rs(2) )
183        if(myrank.eq.0) write(*,*) 'input.f computes Rgas to be', Rgas
184c        Rgas  = 0.4*716.5
185c        Rgas = 8314/28.95
186        yN2   = xN2 * Rgas / Rs(1)
187        yO2   = xO2 * Rgas / Rs(2)
188c
189        s0    =     yN2 * s0sh(1) / Msh(1) + yO2 * s0sh(2) / Msh(2)
190        const = - ( yN2 * Rs(1) * log(xN2) + yO2 * Rs(2) * log(xO2) )
191c
192c.... stop CPU-timer
193c
194c        call timer ('Back    ')
195cc
196c..dumping common (useful for checking differences with
197c        old format input
198c
199        if(myrank.eq.-1) then
200        mxats=1
201        open (unit=23,   file="dumpnew.dat",   status='unknown')
202        write (23,*)" master, numpe, myrank"
203        write (23,*) master, numpe, myrank
204        write (23,*)" maxfront, nlwork"
205        write (23,*) maxfront, nlwork
206        write (23,*)"  numper, nshgt, nshg0"
207        write (23,*)  numper, nshgt, nshg0
208        write (23,*) " birth, death, comtim"
209        write (23,*)  birth, death, comtim
210        write (23,*)"  pzero, wtavei,dtavei, dke, ierrcalc,"
211        write (23,*)  pzero, wtavei,dtavei, dke, ierrcalc,
212     &                   itwmod,taucfct
213        write (23,*)"irscale, intpres,rxinlt, rxrecy,"
214        write (23,*)irscale, intpres,rxinlt, rxrecy,
215     &            rbltin,rvscal,  xlngth, ylngth, zlngth
216
217        write (23,*)"  scdiff(5),nsclr,isclr,nsolt"
218        write (23,*)  scdiff(5),nsclr,isclr,nsolt
219        write (23,*) " flxID(10,20), Force(3),HFlux, nsrflist(0:20)"
220        write (23,*)  flxID(10,20), Force(3),HFlux, nsrflist(0:20)
221        write (23,*) " numnp,  numel,  numelb, numpbc, nen,    nfaces,"
222        write (23,*)  numnp,  numel,  numelb, numpbc, nen,    nfaces,
223     &                  numflx, ndof,   iALE,   icoord, navier,
224     &                  irs,    iexec,  necho,  ichem,  iRK,    nedof,
225     &                  nshg,   nnz,    istop,  nflow,  nnz_tot, idtn,
226     &                  iLSet
227        write (23,*)"  epsilon_ls, epsilon_lsd, dtlset"
228        write (23,*)  epsilon_ls, epsilon_lsd, dtlset
229        write (23,*)" nshape, nshapeb, maxshb,"
230        write (23,*) nshape, nshapeb, maxshb,
231     &                  nshl, nshlb,nfath,  ntopsh,  nsonmax
232        write (23,*)" mcsyst, melCat, nenCat(8,3),    nfaCat(8,3)"
233        write (23,*) mcsyst, melCat, nenCat(8,3),    nfaCat(8,3)
234
235        write (23,*)" lelCat, lcsyst, iorder, nenb, "
236        write (23,*) lelCat, lcsyst, iorder, nenb,
237     &                  nelblk, nelblb, ndofl,  nsymdl, nenl,   nfacel,
238     &                  nenbl,  intind, mattyp
239        write (23,*)" E3nsd,  I3nsd,  nsymdf, ndofBC, ndiBCB, ndBCB,"
240        write (23,*) E3nsd,  I3nsd,  nsymdf, ndofBC, ndiBCB, ndBCB,
241     &                  Jactyp, jump,   ires,   iprec,  ibound,
242     &                  idiff,  lhs,    itau,   ipord,  ipred,  lstres,
243     &                  iepstm, dtsfct, ibksiz, iabc
244        write (23,*)"  epstol(mxats),  Delt(mxats),"
245        write (23,*)  epstol(mxats),  Delt(mxats),     nstep(mxats),
246     &                  impl(mxats),    rhoinf(mxats),
247     &                  LHSupd(mxats),  loctim(mxats),  deltol(mxats,2)
248
249        write (23,*)" intg(2,mxats),  intpt(3),       intptb(3)"
250        write (23,*) intg(2,mxats),  intpt(3),       intptb(3)
251        write (23,*) " indQpt(3,3,4),  numQpt(3,3,4),"
252        write (23,*)  indQpt(3,3,4),  numQpt(3,3,4),
253     &                  intmax
254        write (23,*)" iin,    igeom,  ipar,   ibndc,  imat,   iecho,"
255        write (23,*) iin,    igeom,  ipar,   ibndc,  imat,   iecho,
256     &                  iout,   ichmou, irstin, irstou, ihist,  iflux,
257     &                  ierror, itable, iforce, igraph, itime
258        write (23,*)"fwr1,ngaussf,idim,nlist "
259        write (23,*)fwr1,ngaussf,idim,nlist
260        write (23,*) " fin,    fgeom,  fpar,   fbndc,  fmat,   fecho,"
261        write (23,*)  fin,    fgeom,  fpar,   fbndc,  fmat,   fecho,
262     &                  frstin, frstou, fhist,  ferror, ftable, fforce,
263     &                  fgraph, ftime
264        write (23,*)" fin,    fgeom,  fpar,   fbndc,  fmat,   fecho,"
265        write (23,*) fin,    fgeom,  fpar,   fbndc,  fmat,   fecho,
266     &                  frstin, frstou, fhist,  ferror, ftable, fforce,
267     &                  fgraph, ftime
268        write (23,*)" eGMRES, lGMRES, iKs,    ntotGM "
269        write (23,*) eGMRES, lGMRES, iKs,    ntotGM
270        write (23,*) " mHBrg,  meBrg,  myBrg,  mRcos,  mRsin"
271        write (23,*)  mHBrg,  meBrg,  myBrg,  mRcos,  mRsin
272c
273        write (23,*)" pr,     Planck, Stefan, Nh,     Rh,     Rgas,"
274        write (23,*) pr,     Planck, Stefan, Nh,     Rh,     Rgas,
275     &                  gamma,  gamma1, s0,     const,  xN2,    xO2,
276     &                  yN2,    yO2,    Msh(5), cpsh(5),s0sh(5),h0sh(5),
277     &                  Rs(5),  cps(5), cvs(5), h0s(5), Trot(5),sigs(5),
278     &                  Tvib(5),g0s(5), dofs(5),ithm
279        write (23,*) " mexist"
280        write (23,*)  mexist
281        write (23,*) " datmat(3,5,mxats),      matflg(5,mxats),"
282        write (23,*)  datmat(3,5,mxats),      matflg(5,mxats),
283     &                  nummat,                 mexist
284        write (23,*)"ro,     vel,    temper, press,  entrop, ntout,"
285        write (23,*)ro,     vel,    temper, press,  entrop, ntout,
286     &                  ioform
287        write (23,*)"mbeg,   mend,   mprec "
288        write (23,*)mbeg,   mend,   mprec
289        write (23,*)"epsM,   iabres, npro,resfrt"
290        write (23,*)epsM,   iabres, npro,resfrt
291        write (23,*)"  imap,   ivart,  iDC,    iPcond, Kspace, nGMRES"
292        write (23,*)  imap,   ivart,  iDC,    iPcond, Kspace, nGMRES
293
294        write (23,*)" indsym(5,5) "
295        write (23,*) indsym(5,5)
296        write (23,*) " time,   CFLfld, CFLsld, Dtgl,   Dtmax,  alpha,"
297        write (23,*)  time,   CFLfld, CFLsld, Dtgl,   Dtmax,  alpha,
298     &                  etol,   lstep,  ifunc,  itseq,  istep,  iter,
299     &                  nitr,   almi,   alfi,   gami,   flmpl,  flmpr,
300     &                  dtol(2)
301        write (23,*) "LCtime, ntseq"
302        write (23,*) LCtime, ntseq
303        write (23,*) " numeqns(100), minIters, maxIters,"
304        write (23,*)  numeqns(100), minIters, maxIters,
305     &                  iprjFlag,     nPrjs,    ipresPrjFlag, nPresPrjs,
306     &                  prestol,      statsflow(6), statssclr(6),
307     &                  iverbose
308        write (23,*) " ccode"
309        write (23,*)  ccode
310        write (23,*) " flops,  gbytes, sbytes, iclock, icd,    icode,"
311        write (23,*)  flops,  gbytes, sbytes, iclock, icd,    icode,
312     &                  icode2, icode3
313        write (23,*) " cpu(11),        cpu0(11),       nacess(11)"
314        write (23,*)  cpu(11),        cpu0(11),       nacess(11)
315        write (23,*) " title,  ititle"
316        write (23,*)  title,  ititle
317        close (23)
318        endif
319c
320c....return
321c
322        return
323c
324c.... end of file error handling
325c
326992     call error ('input   ','opening ', imat)
327993     call error ('input   ','opening ', iin)
328996     call error ('input   ','opening ', iecho)
329999     call error ('input   ','end file', iin)
330c
3311000    format(a69)
3321100    format(a80,//,
333     &  ' M a i n   C o n t r o l   P a r a m e t e r s        '   //,
334     &  ' number of processing elements . . . . . . . (numpe )=',i10//,
335     &  ' number of mesh nodes  . . . . . . . . . . . (numnp )=',i10//,
336     &  ' number of elements  . . . . . . . . . . . . (numel )=',i10//,
337     &  ' number of boundary elements . . . . . . . . (numelb)=',i10//,
338     &  ' number of element nodes . . . . . . . . . . (nen   )=',i10//,
339     &  ' number of element faces . . . . . . . . . . (nfaces)=',i10//,
340     &  ' number of space dimensions  . . . . . . . . (nsd   )=',i10//,
341     &  ' number of boundary flux nodes . . . . . . . (numflx)=',i10/)
3421200    format(
343     &  ' frame of reference  . . . . . . . . . . . . (iALE  )=',i10//,
344     &  '    eq. 0, Eulerian                                   ',  / ,
345     &  '    eq. 1, arbitrary Lagrangian-Eulerian              ',  //,
346     &  ' coordinate system . . . . . . . . . . . . . (icoord)=',i10//,
347     &  '    eq. 0, cartesian                                  ',  / ,
348     &  '    eq. 1, axisymmetric                               ',  //,
349     &  ' equation type . . . . . . . . . . . . . . . (navier)=',i10//,
350     &  '    eq. 0, Euler (inviscid)                           ',  / ,
351     &  '    eq. 1, Navier-Stokes (viscous)                    ',  //,
352     &  ' restart option  . . . . . . . . . . . . . . (irs   )=',i10//,
353     &  '    eq. 0, no restart nor solution written            ',  / ,
354     &  '    eq. 1, restart written                            ',  / ,
355     &  '    eq. 2, restart and solution written               ',  //,
356     &  ' execution code  . . . . . . . . . . . . . . (iexec )=',i10//,
357     &  '    eq. 0, data check only                            ',  / ,
358     &  '    eq. 1, execution                                  ',  //,
359     &  ' input echo parameter  . . . . . . . . . . . (necho )=',i10)
3601300    format(a80,//,
361     &  ' S o l u t i o n   P a r a m e t e r s                '   //,
362     &  ' number of time sequences  . . . . . . . . . (ntseq )=',i10//,
363     &  ' blocking algorithm  . . . . . . . . . . . . (imap  )=',i10//,
364     &  '    eq. 0, ordered blocking                           ',  / ,
365     &  '    eq. 1, disjoint element blocking                  ',  //,
366     &  ' variational formulation . . . . . . . . . . (ivart )=',i10//,
367     &  '    eq. 1, Galerkin                                   ',  / ,
368     &  '    eq. 2, Galerkin/least-squares                     ',  / ,
369     &  '    eq. 3, plus discontinuity-capturing operator      ',  //,
370     &  ' discontinuity-capturing type  . . . . . . . (iDC   )=',i10//,
371     &  '    eq. 1, DC-mallet                                  ',  / ,
372     &  '    eq. 2, quadratic DC                               ',  / ,
373     &  '    eq. 3, smallest of the previous two DCs           ',  //,
374     &  ' dimension of Krylov space . . . . . . . . . (kspace)=',i10//,
375     &  ' maximum number of GMRES cycles  . . . . . . (ngmres)=',i10)
3761400    format(a80,//,
377     &  ' S o l v e r   I n f o r m a t i o n                    ',//,
378     &  ' Seq num    Nstep    Niter    Impl      Nupdate',
379     &  '     Eps_Tol')
3801500    format(i6,i10,i9,i8,i11,2x,e15.5)
3811600    format(a80,//,
382     &  ' 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',//,
383     &  ' Seq num  Elem Int.  Bound Int.  Level  LCtime',
384     &  '    Delt       CFLfld    CFLsld')
3851700    format(i6,i8,i12,e13.4,1p,i8,1p,e13.4,0p,2f10.4)
3861800    format(a80,//,
387     &  ' O u t p u t   I n f o r m a t i o n                  ',1p,//,
388     &  ' number of time steps per output . . . . . . (ntout )=',i10//,
389     &  ' I/O format  . . . . . . . . . . . . . . . . (ioform)=',i10//,
390     &  '    eq. 0, ASCII                                      ',  / ,
391     &  '    eq. 1, binary                                     ',  //,
392     &' scaling factor for density  . . . . . . . . (ro    )=',e15.5//,
393     &' scaling factor for velocity . . . . . . . . (vel   )=',e15.5//,
394     &' scaling factor for temperature. . . . . . . (temper)=',e15.5//,
395     &' scaling factor for pressure . . . . . . . . (press )=',e15.5//,
396     &' scaling factor for entropy  . . . . . . . . (entrop)=',e15.5)
397c
398
3991900    format(//,
400     &  ' L e v e l   S e t   P a r a m e t e r s               '   //,
401     &  ' Level Set Switch        . . . . . . . . . . (iLSet )=',i10//,
402     &  '    eq. 0, No Level Set Solution Calculated            ',  / ,
403     &  '    eq. 1, Level Set Calculated, 2 Fluid Props Read    ',  / ,
404     &  '    eq. 2, Level Set and Redistancing Calcuations      ',  //,
405     &  ' Property Smearing Band Width  . . . . . .(epsilon_ls)=',e15.5)
406
407
408
409        end
410