MFIX  2016-1
physical_prop.f
Go to the documentation of this file.
1 !vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvC
2 ! C
3 ! Subroutine: PHYSICAL_PROP C
4 ! Purpose: Calculate the indicated physical properties that vary C
5 ! with time if directed to do so by the corresponding flag C
6 ! C
7 ! Author: M. Syamlal Date: 17-JUL-92 C
8 ! Reviewer: P. Nicoletti Date: 11-DEC-92 C
9 ! C
10 ! Revision: Mods for MFIX 2.0 (old name CALC_PHYSPROP) C
11 ! Author: M. Syamlal Date: 23-APR-96 C
12 ! C
13 ! C
14 ! Literature/Document References: C
15 ! Perry, R.H., and C.H. Chilton, Chemical Engineer's Handbook, 5th C
16 ! edition, McGraw-Hill Kogakusha, Tokyo, 1973. C
17 ! C
18 ! C
19 !^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^C
20  SUBROUTINE physical_prop(IER, LEVEL)
21 
22 ! Modules
23 !---------------------------------------------------------------------//
24  use compar, only: numpes, mype, pe_io
25  use funits, only: unit_log
26  use exit, only: mfix_exit
27  use mpi_utility, only: global_all_sum
28  use physprop, only: smax
29  use coeff, only: density
30  use coeff, only: sp_heat
31  use coeff, only: psize
32  implicit none
33 
34 ! Dummy arguments
35 !---------------------------------------------------------------------//
36 ! Global error Flag.
37  INTEGER, intent(inout) :: IER
38  INTEGER, intent(in) :: LEVEL
39 
40 ! Local variables
41 !---------------------------------------------------------------------//
42 ! Arrays for storing errors:
43 ! 100 - Negative gas phase density
44 ! 101 - Negative solids phase density
45 ! 10x - Unclassified
46 ! 900 - Invalid temperature in calc_CpoR
47  INTEGER :: Err_l(0:numpes-1) ! local
48  INTEGER :: Err_g(0:numpes-1) ! global
49 ! loop index
50  INTEGER :: M
51 !......................................................................!
52 
53 ! Initialize error flags.
54  err_l = 0
55 
56 ! Calculate density only. This is invoked several times within iterate,
57 ! making it the most frequently called.
58  if(level == 0) then
59  if(density(0)) CALL physical_prop_rog
60  DO m=1,smax
61  if(density(m)) CALL physical_prop_ros(m)
62  ENDDO
63 
64 ! Calculate everything except density. This is called at the start of
65 ! each iteration.
66  elseif(level == 1) then
67  if(sp_heat(0)) CALL physical_prop_cpg
68  DO m=1,smax
69  if(sp_heat(m)) CALL physical_prop_cps(m)
70  if(psize(m)) CALL physical_prop_dp(m)
71  ENDDO
72 
73 
74 ! Calculate everything. This is invoked via calc_coeff_all as part of
75 ! the initialization (before starting the time march) and at the start
76 ! of each step step thereafter.
77  elseif(level == 2) then
78  if(density(0)) CALL physical_prop_rog
79  if(sp_heat(0)) CALL physical_prop_cpg
80  DO m=1,smax
81  if(density(m)) CALL physical_prop_ros(m)
82  if(sp_heat(m)) CALL physical_prop_cps(m)
83  if(psize(m)) CALL physical_prop_dp(m)
84  ENDDO
85  endif
86 
87 
88 ! In case of negative density force exit from the physical property
89 ! calculation routine and reduce the time step
90  CALL global_all_sum(err_l, err_g)
91  ier = maxval(err_g)
92  if(ier == 0) return
93 
94 
95 ! Error handeling. - Local.
96 ! An invalid temperature was found by calc_CpoR. This is a fatal run-
97 ! time error and forces a call to MFIX_EXIT.
98  IF(ier == 901 .OR. ier == 902) then
99 ! Temperature is now bounded so this error will not occur.
100  if(mype == pe_io) then
101  write(*,2000) ier
102  write(unit_log,2000) ier
103  endif
104  CALL mfix_exit(mype)
105  ENDIF
106 
107  return
108 
109  2000 FORMAT(/1x,70('*')/' From: PHYSICAL_PROP',/' Fatal Error 2000:', &
110  ' calc_CpoR reported an invalid temperature: 0x0', i3/, &
111  'See Cp.log for details. Calling MFIX_EXIT.',/1x,70('*')/)
112 
113  CONTAINS
114 
115 !vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvC
116 ! C
117 ! Subroutine: PHYSICAL_PROP_ROg C
118 ! Purpose: Calculate the gas phase density. C
119 ! C
120 ! Author: J. Musser Date: 28-JUN-13 C
121 ! C
122 !^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^C
123  SUBROUTINE physical_prop_rog
125 ! Global variables:
126 !---------------------------------------------------------------------//
127  use compar, only: ijkstart3, ijkend3
128 ! Equation of State - GAS
129  use eos, only: eosg
130 ! Gas phase species mass fractions.
131  use fldvar, only: x_g
132 ! Gas phase temperature.
133  use fldvar, only: t_g
134 ! Gas phase density (compressible).
135  use fldvar, only: ro_g
136 ! Gas phase pressure.
137  use fldvar, only: p_g
138 ! Gas phase volume fraction.
139  use fldvar, only: ep_g
140 ! Gas phase material density.
141  use fldvar, only: rop_g
142 
143  use functions, only: wall_at
144 ! Run time flag for generating negative gas density log files
145  use output, only: report_neg_density
146  use param1, only: undefined, zero, one
148 ! Maximum value for molecular weight (divided by one)
149  use toleranc, only: omw_max
150 ! Detect NaN in density for compressible flows.
151  use utilities, only: mfix_isnan
152 ! invoke user defined quantity
153  USE usr_prop, only: usr_rog, calc_usr_prop
154  USE usr_prop, only: gas_density
155  IMPLICIT NONE
156 
157 ! Local Variables:
158 !---------------------------------------------------------------------//
159 ! Average molecular weight
160  DOUBLE PRECISION :: MW
161 ! Loop indicies
162  INTEGER :: IJK ! Computational cell
163 ! Flag to write log header
164  LOGICAL :: wHeader
165 !......................................................................!
166 
167 ! Ensure that the database was read. This *should* have been caught by
168 ! check_gas_phase but this call remains to prevent an accident.
169  IF(.NOT.database_read) call read_database0(ier)
170 
171 ! User-defined function
172  IF(usr_rog) THEN
173  CALL calc_usr_prop(gas_density,lm=0,lerr=err_l)
174  RETURN
175  ENDIF
176 
177 ! Initialize:
178  wheader = .true.
179 
180  ijk_lp: DO ijk = ijkstart3, ijkend3
181  IF(wall_at(ijk)) cycle ijk_lp
182  IF (mw_avg == undefined) THEN
183 ! Calculating the average molecular weight of the fluid.
184  mw = sum(x_g(ijk,:nmax(0))/mw_g(:nmax(0)))
185  mw = one/max(mw,omw_max)
186  mw_mix_g(ijk) = mw
187 ! Calculate the fluid density and bulk density
188  ro_g(ijk) = eosg(mw,p_g(ijk),t_g(ijk))
189  rop_g(ijk) = ro_g(ijk)*ep_g(ijk)
190  ELSE
191  ro_g(ijk) = eosg(mw_avg,p_g(ijk),t_g(ijk))
192  rop_g(ijk) = ro_g(ijk)*ep_g(ijk)
193  ENDIF
194 
195  IF(ro_g(ijk) < zero .or. mfix_isnan(ro_g(ijk))) THEN
196  err_l(mype) = 100
197  IF(report_neg_density) CALL rogerr_log(ijk, wheader)
198  ENDIF
199  ENDDO ijk_lp
200 
201  RETURN
202  END SUBROUTINE physical_prop_rog
203 
204 
205 !vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvC
206 ! C
207 ! Subroutine: PHYSICAL_PROP_ROs C
208 ! Purpose: Calculate solids phase (variable) density. C
209 ! C
210 ! Author: J. Musser Date: 28-JUN-13 C
211 ! C
212 !^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^C
213  SUBROUTINE physical_prop_ros(M)
215 ! Global variables:
216 !---------------------------------------------------------------------//
217  use compar, only: ijkstart3, ijkend3
218 ! Equation of State - Solid
219  use eos, only: eoss
220 ! Solid phase species mass fractions.
221  use fldvar, only: x_s, rop_s, ro_s
222 ! Solid phase density (variable).
223  use fldvar, only: rop_s, ro_s
224 
225  use functions, only: wall_at
226 ! Run time flag for generating negative density log files.
227  use output, only: report_neg_density
228  use param1, only: undefined, zero
229 ! Baseline/Unreaced solids density
230  use physprop, only: ro_s0
231 ! Initial mass fraction of inert species
232  use physprop, only: x_s0
233 ! Index of inert solids phase species.
234  use physprop, only: inert_species
235 ! Inert solids phase species mass fraction in dilute region.
236  use physprop, only: dil_inert_x_vsd
237 ! Factor to define dilute region where DIL_INERT_X_VSD is used
238  use physprop, only: dil_factor_vsd
239 ! Flag for variable solids density.
240  use run, only: solve_ros
241 ! Minimum solids volume fraction
242  use toleranc, only: dil_ep_s
243 ! invoke user defined quantity
244  USE usr_prop, only: usr_ros, calc_usr_prop
245  USE usr_prop, only: solids_density
246  IMPLICIT NONE
247 
248 ! Dummy arguments
249 !---------------------------------------------------------------------//
250 ! solids phase index
251  INTEGER, INTENT(IN) :: M
252 
253 ! Local Variables:
254 !---------------------------------------------------------------------//
255 ! Loop indicies
256  INTEGER :: IJK
257 ! Index of inert species
258  INTEGER :: IIS
259 ! Flag to write log header
260  LOGICAL :: wHeader
261 ! Minimum bulk density
262  DOUBLE PRECISION :: minROPs
263 !......................................................................!
264 
265 ! User defined function
266  IF(usr_ros(m)) THEN
267  CALL calc_usr_prop(solids_density,lm=m,lerr=err_l)
268  RETURN
269  ENDIF
270 
271  IF(solve_ros(m)) THEN
272 ! Initialize header flag.
273  wheader = .true.
274 ! Set the index of the inert species
275  iis = inert_species(m)
276 ! Calculate the minimum solids denisty.
277  minrops = ro_s0(m)*(dil_factor_vsd*dil_ep_s)
278 
279 ! Calculate the solids denisty over all cells.
280  ijk_lp: DO ijk = ijkstart3, ijkend3
281  IF(wall_at(ijk)) cycle ijk_lp
282  IF(rop_s(ijk,m) > minrops) THEN
283  ro_s(ijk,m) = eoss(ro_s0(m), x_s0(m,iis), &
284  x_s(ijk,m,iis))
285  ELSE
286 ! RO_s(IJK,M) = RO_s0(M)
287  ro_s(ijk,m) = eoss(ro_s0(m), x_s0(m,iis), &
288  dil_inert_x_vsd(m))
289  ENDIF
290 
291 ! Report errors.
292  IF(ro_s(ijk,m) <= zero) THEN
293  err_l(mype) = 101
294  IF(report_neg_density) CALL roserr_log(ijk, m, wheader)
295  ENDIF
296  ENDDO ijk_lp
297  ENDIF
298 
299  RETURN
300  END SUBROUTINE physical_prop_ros
301 
302 
303 !vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvC
304 ! C
305 ! Subroutine: PHYSICAL_PROP_CPg C
306 ! Purpose: Calculate the gas phase constant pressure specific heat. C
307 ! C
308 ! Author: J. Musser Date: 28-JUN-13 C
309 ! C
310 ! Notes: C
311 ! > Unit conversion: 1 cal = 4.183925 J C
312 ! C
313 !^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^C
314  SUBROUTINE physical_prop_cpg
316 ! Global Variables:
317 !---------------------------------------------------------------------//
318  use compar, only: ijkstart3, ijkend3
319 ! Universal gas constant in cal/mol.K
320  use constant, only: rgas => gas_const_cal
321 ! Gas phase species mass fractions.
322  use fldvar, only: x_g
323 ! Gas phase temperature.
324  use fldvar, only: t_g
325 
326  use functions, only: wall_at
328  use param1, only: undefined, zero
329  use physprop, only: database_read
330  use physprop, only: mw_g, c_pg, nmax
331 ! Function to calculate Cp over gas constant R
332  use read_thermochemical, only: calc_cpor
333 ! Units: CGS/SI
334  use run, only: units
335 ! invoke user defined quantity
336  USE usr_prop, only: usr_cpg, calc_usr_prop
337  USE usr_prop, only: gas_specificheat
338  IMPLICIT NONE
339 
340 ! Local Variables:
341 !---------------------------------------------------------------------//
342 ! Species specific heat.
343  DOUBLE PRECISION :: lCp
344 ! Loop indicies
345  INTEGER :: IJK, NN
346 ! Flag to write log header
347  LOGICAL :: wHeader
348 ! Error flag returned from calc_CpoR
349  INTEGER :: lCP_Err
350  INTEGER :: gCP_Err
351 !......................................................................!
352 
353 ! Ensure that the database was read. This *should* have been caught by
354 ! check_gas_phase but this call remains to prevent an accident.
355  IF(.NOT.database_read) CALL read_database0(ier)
356 
357 ! User defined function
358  IF(usr_cpg) THEN
359  CALL calc_usr_prop(gas_specificheat,lm=0,lerr=err_l)
360  RETURN
361  ENDIF
362 
363 ! Initialize
364  wheader = .true.
365  gcp_err = 0
366  lcp_err = 0
367  ijk_lp: DO ijk = ijkstart3, ijkend3
368  IF(wall_at(ijk)) cycle ijk_lp
369 ! Calculating an average specific heat for the fluid.
370  c_pg(ijk) = zero
371  DO nn = 1, nmax(0)
372  lcp = calc_cpor(t_g(ijk), 0, nn)
373 ! calc_cpor used to return error flag (101/102) on out of bound
374 ! temperature. however, temperature is now bounded in routine.
375  gcp_err = max(gcp_err, lcp_err)
376  c_pg(ijk) = c_pg(ijk) + x_g(ijk,nn) * lcp * rgas / mw_g(nn)
377  ENDDO
378 
379 ! report errors
380  IF(c_pg(ijk) <= zero) THEN
381 ! gCP_err = 103
382  IF(report_neg_specificheat) CALL cpgerr_log(ijk, wheader)
383  ENDIF
384 
385  ENDDO ijk_lp
386 
387 ! The database calculation always returns cal/g.K thus the following
388 ! conversion is needed if using SI units.
389 ! Only convert useful part of the array. When the array is re-indexed,
390 ! elements past IJKEND3 are UNDEFINED and would keep growing if
391 ! multiplied, leading to overflow.
392  IF(units == 'SI') THEN
393  DO ijk = ijkstart3, ijkend3
394  c_pg(ijk) = 4.183925d3 * c_pg(ijk)
395  ENDDO
396  ENDIF
397 
398 ! Increment the error to 900+ to invoke fatal exit.
399  IF(gcp_err /= 0) err_l(mype) = 800 + gcp_err
400 
401  RETURN
402  END SUBROUTINE physical_prop_cpg
403 
404 
405 !vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvC
406 ! C
407 ! Subroutine: PHYSICAL_PROP_CPs C
408 ! Purpose: Calculate solids phase constant pressure specific heat. C
409 ! C
410 ! Author: J. Musser Date: 28-JUN-13 C
411 ! C
412 !^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^C
413  SUBROUTINE physical_prop_cps(M)
415 ! Global Variables:
416 !---------------------------------------------------------------------//
417  use compar, only: ijkstart3, ijkend3
418 ! Universal gas constant in cal/mol.K
419  use constant, only: rgas => gas_const_cal
420 ! Solids temperature
421  use fldvar, only: t_s
422 ! Solids species mass fractions
423  use fldvar, only: x_s
424 
425  use functions, only: wall_at
427  use param1, only: undefined, zero
428  use physprop, only: database_read
429  use physprop, only: mw_s, c_ps, nmax
430 ! Function to calculate Cp over gas constant R
431  use read_thermochemical, only: calc_cpor
432 ! Units: CGS/SI
433  use run, only: units
434 ! invoke user defined quantity
435  USE usr_prop, only: usr_cps, calc_usr_prop
436  USE usr_prop, only: solids_specificheat
437  IMPLICIT NONE
438 
439 ! Dummy arguments
440 !---------------------------------------------------------------------//
441 ! solids phase index
442  INTEGER, INTENT(IN) :: M
443 
444 ! Local variables:
445 !---------------------------------------------------------------------//
446 ! Local value for species specific heat (Cp)
447  DOUBLE PRECISION :: lCp
448 ! Loop indicies
449  INTEGER :: IJK, NN
450 ! Flag to write log header
451  LOGICAL :: wHeader
452 ! Error flag returned from calc_CpoR
453  INTEGER :: lCP_Err
454  INTEGER :: gCP_Err
455 !......................................................................!
456 
457 ! Ensure that the database was read. This *should* have been caught by
458 ! check_solids_common_all but this call remains to prevent an accident.
459  IF(.NOT.database_read) CALL read_database0(ier)
460 
461 ! User defined function
462  IF(usr_cps(m)) THEN
463  CALL calc_usr_prop(solids_specificheat,lm=m,lerr=err_l)
464  RETURN
465  ENDIF
466 
467 ! Initialize
468  wheader = .true.
469  gcp_err = 0
470  lcp_err = 0
471  ijk_lp: DO ijk = ijkstart3, ijkend3
472  IF(wall_at(ijk)) cycle ijk_lp
473 ! Calculating an average specific heat for the fluid.
474  c_ps(ijk, m) = zero
475  DO nn = 1, nmax(m)
476  lcp = calc_cpor(t_s(ijk,m), m, nn)
477 ! calc_cpor used to return error flag (101/102) based on out of bound
478 ! temperature. however, temperature is now bounded in routine
479  gcp_err = max(gcp_err, lcp_err)
480  c_ps(ijk,m) = c_ps(ijk,m) + x_s(ijk,m,nn) * &
481  (lcp * rgas / mw_s(m,nn))
482  ENDDO
483 
484 ! report errors
485  IF(c_ps(ijk,m) <= zero) THEN
486 ! gCP_err = 104
487  IF(report_neg_specificheat) CALL cpserr_log(ijk, m, wheader)
488  ENDIF
489 
490  ENDDO ijk_lp
491 
492 ! The database calculation always returns cal/g.K thus the following
493 ! conversion is needed if using SI units.
494 ! Only convert useful part of the array. When the array is re-indexed,
495 ! elements past IJKEND3 are UNDEFINED and would keep growing if
496 ! multiplied, leading to overflow.
497  IF(units == 'SI') THEN
498  DO ijk = ijkstart3, ijkend3
499  c_ps(ijk,m) = 4.183925d3 * c_ps(ijk,m)
500  ENDDO
501  ENDIF
502 
503 ! Increment the error to 900+ to invoke fatal exit.
504  IF(gcp_err /= 0) err_l(mype) = 800 + gcp_err
505 
506  RETURN
507  END SUBROUTINE physical_prop_cps
508 
509 
510 !vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvC
511 ! C
512 ! Subroutine: PHYSICAL_PROP_DP C
513 ! Purpose: Calculate solids phase diameter. C
514 ! C
515 ! Author: J. Musser Date: 28-JUN-13 C
516 ! C
517 !^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^C
518  SUBROUTINE physical_prop_dp(M)
520 ! Modules
521 !---------------------------------------------------------------------//
522  use compar, only: ijkstart3, ijkend3
523  use scalars, only: phase4scalar
524  use fldvar, only: scalar
525  use fldvar, only: d_p, ep_s
526  use functions, only: wall_at
527  use param1, only: small_number
528  use run, only: call_dqmom
529  implicit none
530 
531 ! Dummy arguments
532 !---------------------------------------------------------------------//
533 ! solids phase index
534  INTEGER, INTENT(IN) :: M
535 
536 ! Local variables
537 !---------------------------------------------------------------------//
538 ! Loop indicies
539  INTEGER :: IJK ! Computational cell
540 ! Map from true index to map.
541  INTEGER :: lM
542 !......................................................................!
543 
544  IF(.NOT.call_dqmom) return
545 
546  lm = phase4scalar(m) ! Map from scalar eq to solids phase
547 
548  ijk_lp: DO ijk = ijkstart3, ijkend3
549  IF(wall_at(ijk)) cycle ijk_lp
550  IF(ep_s(ijk,lm) > small_number) d_p(ijk,m)= scalar(ijk,lm)
551  ENDDO ijk_lp
552 
553  RETURN
554  END SUBROUTINE physical_prop_dp
555 
556 
557  END SUBROUTINE physical_prop
558 
559 !vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvC
560 ! C
561 ! Subroutine: ROgErr_LOG C
562 ! Purpose: Record information about the location and conditions that C
563 ! resulted in a negative gas phase density. C
564 ! C
565 ! Author: J. Musser Date: 28-JUN-13 C
566 ! C
567 !^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^C
568  SUBROUTINE rogerr_log(IJK, tHeader)
570 ! Global Variables:
571 !---------------------------------------------------------------------//
572  use compar, only: mype, numpes
573 ! Cutcell data.
574  use cutcell, only: cartesian_grid
575  use cutcell, only: cut_cell_at, small_cell_at
576  use cutcell, only: xg_e, yg_n, zg_t
577 ! Simulation time
578  use run, only: time
579 ! Gas phase temperature.
580  use fldvar, only: t_g
581 ! Gas phase density (compressible).
582  use fldvar, only: ro_g
583 !
584  use indices, only: i_of, j_of, k_of
585 ! Gas phase pressure.
586  use fldvar, only: p_g
587  IMPLICIT NONE
588 
589 ! Dummy arguments
590 !---------------------------------------------------------------------//
591  INTEGER, intent(in) :: IJK
592  LOGICAL, intent(inout) :: tHeader
593 
594 ! Local variables:
595 !---------------------------------------------------------------------//
596  LOGICAL :: lExists
597  CHARACTER(LEN=255) :: lFile
598  INTEGER, parameter :: lUnit = 4868
599  LOGICAL, save :: fHeader = .true.
600 !......................................................................!
601 
602  lfile = '';
603  if(numpes > 1) then
604  write(lfile,"('ROgErr_',I4.4,'.log')") mype
605  else
606  write(lfile,"('ROgErr.log')")
607  endif
608  inquire(file=trim(lfile),exist=lexists)
609  if(lexists) then
610  open(lunit,file=trim(adjustl(lfile)), &
611  status='old', position='append', convert='big_endian')
612  else
613  open(lunit,file=trim(adjustl(lfile)), status='new',&
614  convert='big_endian')
615  endif
616 
617  if(fheader) then
618  write(lunit,1000)
619  fheader = .false.
620  endif
621 
622  if(theader) then
623  write(lunit,"(/2x,'Simulation time: ',g12.5)") time
624  theader = .false.
625  endif
626 
627  write(lunit,1001) ijk, i_of(ijk), j_of(ijk), k_of(ijk)
628  write(lunit,"(6x,A,1X,g12.5)",advance='NO') 'RO_g:', ro_g(ijk)
629  write(lunit,"(2x,A,1X,g12.5)",advance='NO') 'P_g:', p_g(ijk)
630  write(lunit,"(2x,A,1X,g12.5)") 'T_g:', t_g(ijk)
631  if(cartesian_grid) then
632  write(lunit,"(6x,A,1X,L1)",advance='NO') 'Cut Cell:', cut_cell_at(ijk)
633  write(lunit,"(6x,A,1X,L1)") 'Small Cell:', small_cell_at(ijk)
634  write(lunit,"(6x,'Coordinates (E/N/T): ',1X,3(2x, g17.8))") &
635  xg_e(i_of(ijk)), yg_n(j_of(ijk)), zg_t(k_of(ijk))
636  endif
637 
638  close(lunit)
639 
640  RETURN
641 
642  1000 FORMAT(2x,'One or more cells have reported a negative/NaN gas', &
643  ' density (RO_g(IJK)). If',/2x,'this is a persistent issue,', &
644  ' lower UR_FAC(1) in mfix.dat.')
645 
646  1001 FORMAT(/4x,'IJK: ',i8,7x,'I: ',i4,' J: ',i4,' K: ',i4)
647 
648  END SUBROUTINE rogerr_log
649 
650 
651 !vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv!
652 ! !
653 ! Subroutine: ROsErr_LOG !
654 ! Purpose: Record information about the location and conditions that !
655 ! resulted in a negative solids phase density. !
656 ! !
657 ! Author: J. Musser Date: 09-Oct-13 !
658 ! !
659 !^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^!
660  SUBROUTINE roserr_log(IJK, M, tHeader)
662 ! Global variables:
663 !---------------------------------------------------------------------//
664  use compar, only: mype, numpes
665 ! Cutcell data.
666  use cutcell, only: cartesian_grid
667  use cutcell, only: cut_cell_at, small_cell_at
668  use cutcell, only: xg_e, yg_n, zg_t
669 ! Solid phase species mass fractions.
670  use fldvar, only: x_s
671 ! Solid phase density (variable).
672  use fldvar, only: ro_s
673 !
674  use indices, only: i_of, j_of, k_of
675 ! Baseline/Unreaced solids density
676  use physprop, only: ro_s0
677 ! Initial mass fraction of inert species
678  use physprop, only: x_s0
679 ! Index of inert solids phase species.
680  use physprop, only: inert_species
681 ! Simulation time
682  use run, only: time
683  IMPLICIT NONE
684 
685 ! Dummy arguments
686 !---------------------------------------------------------------------//
687 ! Fluid cell and solids phase indices
688  INTEGER, intent(in) :: IJK, M
689 ! Flag to output header
690  LOGICAL, intent(inout) :: tHeader
691 
692 ! Local Variables:
693 !---------------------------------------------------------------------//
694 ! Local aliase for inert species index
695  INTEGER :: NN
696 ! Local file values.
697  LOGICAL :: lExists
698  CHARACTER(LEN=255) :: lFile
699  INTEGER, parameter :: lUnit = 4868
700  LOGICAL, save :: fHeader = .true.
701 !......................................................................!
702 
703  lfile = '';
704  if(numpes > 1) then
705  write(lfile,"('ROsErr_',I4.4,'.log')") mype
706  else
707  write(lfile,"('ROsErr.log')")
708  endif
709  inquire(file=trim(lfile),exist=lexists)
710  if(lexists) then
711  open(lunit,file=trim(adjustl(lfile)), &
712  status='old', position='append',convert='big_endian')
713  else
714  open(lunit,file=trim(adjustl(lfile)), status='new',&
715  convert='big_endian')
716  endif
717 
718  if(fheader) then
719  write(lunit,1000)
720  fheader = .false.
721  endif
722 
723  if(theader) then
724  write(lunit,"(/2x,'Simulation time: ',g12.5,' Phase: ',I2)")&
725  time, m
726  theader = .false.
727  endif
728 
729  nn = inert_species(m)
730  write(lunit,1001) ijk, i_of(ijk), j_of(ijk), k_of(ijk)
731  write(lunit,"(6x,A,1X,g12.5)",advance='no') 'RO_s:', ro_s(ijk,m)
732  write(lunit,"(2x,A,1X,g12.5)",advance='no') 'Base:', ro_s0(m)
733  write(lunit,"(2x,A,1X,g12.5)",advance='no') 'X_s0:', x_s0(m,nn)
734  write(lunit,"(2x,A,1X,g12.5)") 'X_s:', x_s(ijk,m,nn)
735 
736  if(cartesian_grid) then
737  write(lunit,"(6x,A,1X,L1)",advance='NO') 'Cut Cell:', cut_cell_at(ijk)
738  write(lunit,"(6x,A,1X,L1)") 'Small Cell:', small_cell_at(ijk)
739  write(lunit,"(6x,'Coordinates (E/N/T): ',1X,3(2x, g17.8))") &
740  xg_e(i_of(ijk)), yg_n(j_of(ijk)), zg_t(k_of(ijk))
741  endif
742 
743  close(lunit)
744 
745  RETURN
746 
747  1000 FORMAT(2x,'One or more cells have reported a negative solids', &
748  ' density (RO_s(IJK)).')
749 
750  1001 FORMAT( 4x,'IJK: ',i8,7x,'I: ',i4,' J: ',i4,' K: ',i4)
751 
752  END SUBROUTINE roserr_log
753 
754 !vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv!
755 ! !
756 ! Subroutine: CPgErr_LOG !
757 ! Purpose: Record information about the location and conditions that !
758 ! resulted in a zero or negative gas specific heat. !
759 ! !
760 ! !
761 !^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^!
762  SUBROUTINE cpgerr_log(IJK, tHeader)
764 ! Global variables:
765 !---------------------------------------------------------------------//
766  use compar, only: mype, numpes
767 ! Cutcell data.
768  use cutcell, only: cartesian_grid
769  use cutcell, only: cut_cell_at, small_cell_at
770  use cutcell, only: xg_e, yg_n, zg_t
771 ! Gas phase species mass fractions.
772  use fldvar, only: t_g, x_g, ep_g
773 ! Gas phase density (variable).
774  use fldvar, only: ro_g
775 !
776  use indices, only: i_of, j_of, k_of
777 
778  use physprop, only: mw_g, c_pg, nmax
779 ! Simulation time
780  use run, only: time
781  IMPLICIT NONE
782 
783 ! Dummy arguments
784 !---------------------------------------------------------------------//
785 ! Fluid cell and solids phase indices
786  INTEGER, intent(in) :: IJK
787 ! Flag to output header
788  LOGICAL, intent(inout) :: tHeader
789 
790 ! Local Variables:
791 !---------------------------------------------------------------------//
792 ! Local aliase for inert species index
793  INTEGER :: NN
794 ! Local file values.
795  LOGICAL :: lExists
796  CHARACTER(LEN=255) :: lFile
797  INTEGER, parameter :: lUnit = 4868
798  LOGICAL, save :: fHeader = .true.
799  CHARACTER(LEN=7) :: X_gN
800 !......................................................................!
801 
802  lfile = '';
803  if(numpes > 1) then
804  write(lfile,"('CPgErr_',I4.4,'.log')") mype
805  else
806  write(lfile,"('CPgErr.log')")
807  endif
808  inquire(file=trim(lfile),exist=lexists)
809  if(lexists) then
810  open(lunit,file=trim(adjustl(lfile)), &
811  status='old', position='append',convert='big_endian')
812  else
813  open(lunit,file=trim(adjustl(lfile)), status='new',&
814  convert='big_endian')
815  endif
816 
817  if(fheader) then
818  write(lunit,1000)
819  fheader = .false.
820  endif
821 
822  if(theader) then
823  write(lunit,"(/2x,'Simulation time: ',g12.5)") time
824  theader = .false.
825  endif
826 
827  write(lunit,1001) ijk, i_of(ijk), j_of(ijk), k_of(ijk)
828  write(lunit,"(6x,A,1X,g12.5)",advance='no') 'C_PG:', c_pg(ijk)
829  write(lunit,"(2x,A,1X,g12.5)",advance='no') 'EP_G:', ep_g(ijk)
830  write(lunit,"(2x,A,1X,g12.5)") 'T_G:', t_g(ijk)
831  write(lunit,"(6x,A,1X)",advance='no') 'X_gN:'
832  DO nn = 1,nmax(0)
833  write(lunit,"(g12.5,2X)",advance='no') x_g(ijk,nn)
834  ENDDO
835  write(lunit,fmt='(/)')
836 
837  if(cartesian_grid) then
838  write(lunit,"(6x,A,1X,L1)",advance='NO') 'Cut Cell:', cut_cell_at(ijk)
839  write(lunit,"(6x,A,1X,L1)") 'Small Cell:', small_cell_at(ijk)
840  write(lunit,"(6x,'Coordinates (E/N/T): ',1X,3(2x, g17.8))") &
841  xg_e(i_of(ijk)), yg_n(j_of(ijk)), zg_t(k_of(ijk))
842  endif
843 
844  close(lunit)
845 
846  RETURN
847 
848  1000 FORMAT(2x,'One or more cells have reported a negative or zero',&
849  ' gas specific',/2x,'heat (C_pg(IJK)).')
850 
851  1001 FORMAT( 4x,'IJK: ',i8,7x,'I: ',i4,' J: ',i4,' K: ',i4)
852 
853  END SUBROUTINE cpgerr_log
854 
855 !vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv!
856 ! !
857 ! Subroutine: CPsErr_LOG !
858 ! Purpose: Record information about the location and conditions that !
859 ! resulted in a zero or negative solids specific heat. !
860 ! !
861 ! !
862 !^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^!
863  SUBROUTINE cpserr_log(IJK, M, tHeader)
865 ! Global variables:
866 !---------------------------------------------------------------------//
867  use compar, only: mype, numpes
868 ! Cutcell data.
869  use cutcell, only: cartesian_grid
870  use cutcell, only: cut_cell_at, small_cell_at
871  use cutcell, only: xg_e, yg_n, zg_t
872 ! Solid phase species mass fractions.
873  use fldvar, only: t_s, x_s, ep_s
874 ! Solid phase density (variable).
875  use fldvar, only: ro_s
876 !
877  use indices, only: i_of, j_of, k_of
878 
879  use physprop, only: mw_s, c_ps, nmax
880 ! Simulation time
881  use run, only: time
882  IMPLICIT NONE
883 
884 ! Dummy arguments
885 !---------------------------------------------------------------------//
886 ! Fluid cell and solids phase indices
887  INTEGER, intent(in) :: IJK, M
888 ! Flag to output header
889  LOGICAL, intent(inout) :: tHeader
890 
891 ! Local Variables:
892 !---------------------------------------------------------------------//
893 ! Local aliase for inert species index
894  INTEGER :: NN
895 ! Local file values.
896  LOGICAL :: lExists
897  CHARACTER(LEN=255) :: lFile
898  INTEGER, parameter :: lUnit = 4868
899  LOGICAL, save :: fHeader = .true.
900  CHARACTER(LEN=7) :: X_sN
901 !......................................................................!
902 
903  lfile = '';
904  if(numpes > 1) then
905  write(lfile,"('CPsErr_',I4.4,'.log')") mype
906  else
907  write(lfile,"('CPsErr.log')")
908  endif
909  inquire(file=trim(lfile),exist=lexists)
910  if(lexists) then
911  open(lunit,file=trim(adjustl(lfile)), &
912  status='old', position='append',convert='big_endian')
913  else
914  open(lunit,file=trim(adjustl(lfile)), status='new',&
915  convert='big_endian')
916  endif
917 
918  if(fheader) then
919  write(lunit,1000)
920  fheader = .false.
921  endif
922 
923  if(theader) then
924  write(lunit,"(/2x,'Simulation time: ',g12.5,' Phase: ',I2)")&
925  time, m
926  theader = .false.
927  endif
928 
929  write(lunit,1001) ijk, i_of(ijk), j_of(ijk), k_of(ijk)
930  write(lunit,"(6x,A,1X,g12.5)",advance='no') 'C_PS:', c_ps(ijk,m)
931  write(lunit,"(2x,A,1X,g12.5)",advance='no') 'EP_S:', ep_s(ijk,m)
932  write(lunit,"(2x,A,1X,g12.5)") 'T_S:', t_s(ijk,m)
933  write(lunit,"(6x,A,1X)",advance='no') 'X_sN:'
934  DO nn = 1,nmax(m)
935  write(lunit,"(g12.5,2X)",advance='no') x_s(ijk,m,nn)
936  ENDDO
937  write(lunit,fmt='(/)')
938 
939  if(cartesian_grid) then
940  write(lunit,"(6x,A,1X,L1)",advance='NO') 'Cut Cell:', cut_cell_at(ijk)
941  write(lunit,"(6x,A,1X,L1)") 'Small Cell:', small_cell_at(ijk)
942  write(lunit,"(6x,'Coordinates (E/N/T): ',1X,3(2x, g17.8))") &
943  xg_e(i_of(ijk)), yg_n(j_of(ijk)), zg_t(k_of(ijk))
944  endif
945 
946  close(lunit)
947 
948  RETURN
949 
950  1000 FORMAT(2x,'One or more cells have reported a negative or zero',&
951  ' solids specific',/2x,'heat (C_ps(IJK)).')
952 
953  1001 FORMAT( 4x,'IJK: ',i8,7x,'I: ',i4,' J: ',i4,' K: ',i4)
954 
955  END SUBROUTINE cpserr_log
956 
logical, dimension(dim_m) usr_ros
Definition: usr_prop_mod.f:9
double precision, dimension(:,:), allocatable c_ps
Definition: physprop_mod.f:86
subroutine physical_prop_cps(M)
integer, dimension(:), allocatable i_of
Definition: indices_mod.f:45
subroutine cpserr_log(IJK, M, tHeader)
integer ijkend3
Definition: compar_mod.f:80
double precision, dimension(:), allocatable yg_n
Definition: cutcell_mod.f:45
double precision, dimension(:), allocatable ep_g
Definition: fldvar_mod.f:15
subroutine rogerr_log(IJK, tHeader)
double precision, parameter one
Definition: param1_mod.f:29
double precision, dimension(:), allocatable xg_e
Definition: cutcell_mod.f:44
subroutine physical_prop_dp(M)
logical usr_rog
Definition: usr_prop_mod.f:7
double precision, parameter omw_max
Definition: toleranc_mod.f:37
double precision, dimension(:), allocatable t_g
Definition: fldvar_mod.f:63
logical, dimension(:), allocatable small_cell_at
Definition: cutcell_mod.f:360
logical, dimension(dim_m) solve_ros
Definition: run_mod.f:250
subroutine cpgerr_log(IJK, tHeader)
double precision, dimension(:,:), allocatable scalar
Definition: fldvar_mod.f:155
double precision, dimension(:), allocatable p_g
Definition: fldvar_mod.f:26
double precision, dimension(dim_m, dim_n_s) x_s0
Definition: physprop_mod.f:32
double precision, parameter undefined
Definition: param1_mod.f:18
double precision, dimension(dim_n_g) mw_g
Definition: physprop_mod.f:124
subroutine calc_usr_prop(lprop, lM, lL, lerr)
Definition: usr_prop_mod.f:49
integer numpes
Definition: compar_mod.f:24
logical, dimension(:), allocatable density
Definition: coeff_mod.f:13
integer, dimension(:), allocatable k_of
Definition: indices_mod.f:47
integer pe_io
Definition: compar_mod.f:30
double precision, dimension(:,:), allocatable d_p
Definition: fldvar_mod.f:57
double precision function eosg(MW, PG, TG)
Definition: eos_mod.f:22
subroutine mfix_exit(myID, normal_termination)
Definition: exit.f:5
subroutine physical_prop(IER, LEVEL)
Definition: physical_prop.f:21
double precision, dimension(:,:,:), allocatable x_s
Definition: fldvar_mod.f:78
integer, dimension(:), allocatable j_of
Definition: indices_mod.f:46
double precision function eoss(pBase, Xs0_INERT, Xs_INERT)
Definition: eos_mod.f:155
logical usr_cpg
Definition: usr_prop_mod.f:8
double precision, parameter small_number
Definition: param1_mod.f:24
double precision, dimension(:,:), allocatable t_s
Definition: fldvar_mod.f:66
double precision, dimension(:,:), allocatable x_g
Definition: fldvar_mod.f:75
logical, dimension(:), allocatable psize
Definition: coeff_mod.f:15
integer, dimension(dim_m) inert_species
Definition: physprop_mod.f:39
Definition: exit.f:2
Definition: eos_mod.f:10
double precision, dimension(dim_m) dil_inert_x_vsd
Definition: physprop_mod.f:43
pure double precision function calc_cpor(T, M, N)
subroutine read_database0()
logical call_dqmom
Definition: run_mod.f:127
integer, parameter unit_log
Definition: funits_mod.f:21
Definition: run_mod.f:13
double precision, parameter dil_ep_s
Definition: toleranc_mod.f:24
subroutine physical_prop_rog
double precision, dimension(:,:), allocatable ro_s
Definition: fldvar_mod.f:45
logical cartesian_grid
Definition: cutcell_mod.f:13
logical database_read
Definition: physprop_mod.f:133
character(len=16) units
Definition: run_mod.f:30
double precision, dimension(:), allocatable mw_mix_g
Definition: physprop_mod.f:130
integer, dimension(0:dim_m) nmax
Definition: physprop_mod.f:119
logical, dimension(:), allocatable cut_cell_at
Definition: cutcell_mod.f:355
integer mype
Definition: compar_mod.f:24
subroutine roserr_log(IJK, M, tHeader)
double precision mw_avg
Definition: physprop_mod.f:71
integer ijkstart3
Definition: compar_mod.f:80
double precision, dimension(dim_m, dim_n_s) mw_s
Definition: physprop_mod.f:127
double precision function ep_s(IJK, xxM)
Definition: fldvar_mod.f:178
subroutine physical_prop_ros(M)
logical function mfix_isnan(x)
Definition: utilities_mod.f:14
double precision, dimension(:,:), allocatable rop_s
Definition: fldvar_mod.f:51
integer smax
Definition: physprop_mod.f:22
double precision, dimension(dim_m) ro_s0
Definition: physprop_mod.f:28
Definition: coeff_mod.f:9
logical report_neg_density
Definition: output_mod.f:37
integer, dimension(1:dim_scalar) phase4scalar
Definition: scalars_mod.f:10
double precision time
Definition: run_mod.f:45
double precision, dimension(:), allocatable zg_t
Definition: cutcell_mod.f:46
subroutine physical_prop_cpg
logical, dimension(:), allocatable sp_heat
Definition: coeff_mod.f:14
double precision, dimension(:), allocatable ro_g
Definition: fldvar_mod.f:32
double precision, dimension(:), allocatable rop_g
Definition: fldvar_mod.f:38
double precision, parameter gas_const_cal
Definition: constant_mod.f:155
double precision, parameter zero
Definition: param1_mod.f:27
logical, dimension(dim_m) usr_cps
Definition: usr_prop_mod.f:10
double precision, dimension(:), allocatable c_pg
Definition: physprop_mod.f:80
double precision dil_factor_vsd
Definition: physprop_mod.f:47
logical report_neg_specificheat
Definition: output_mod.f:39