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