MFIX  2016-1
flow_to_vel.f
Go to the documentation of this file.
1 !vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv!
2 ! !
3 ! Subroutine: FLOW_TO_VEL_NEW !
4 ! Author: M. Syamlal Date: 28-JUL-92 !
5 ! !
6 ! Purpose: Convert volumetric and mass flow rates to velocities !
7 ! A specified mass flow rate is first converted to volumetric !
8 ! flow rate. The volumetric flow rate is then converted to a !
9 ! velocity. !
10 ! !
11 ! When both flow rates and velocities are specified, a consistency !
12 ! check is done. The first time flow_to_vel is called in by setting !
13 ! the logical DO_VEL_CHECK to .TRUE.. If cut-cells are not used, !
14 ! flow_to_vel is only called once. When cut-cells are used, !
15 ! flow_to_vel is called another time after the cut-cell pre- !
16 ! processing stage. During, the second call, the velocity check !
17 ! should not be performed, because the velocity assigned suring the !
18 ! first call will not match the flow rate. Therfore, when called !
19 ! from cut_cell_preprocessing.f DO_VEL_CHECK is set to .FALSE.. !
20 ! !
21 !^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^!
22  SUBROUTINE flow_to_vel_new(DO_VEL_CHECK, M_TOT, SKIP, BCV)
23 
24  use param, only: dim_m
25  use param1, only: undefined
26  use geometry, only: no_i, no_j, no_k
27  use bc, only: bc_massflow_g
28  use bc, only: bc_volflow_g
29  use bc, only: bc_massflow_s
30  use bc, only: bc_volflow_s
31  use run, only: reinitializing
32 
33  use error_manager
34  use toleranc
35 
36  IMPLICIT NONE
37 !-----------------------------------------------
38 ! Local variables
39 !-----------------------------------------------
40  LOGICAL, intent(in) :: DO_VEL_CHECK
41 
42 ! loop/variable indices
43  INTEGER, intent(in) :: M_TOT
44  LOGICAL, intent(in) :: SKIP(dim_m)
45 
46 ! loop/variable indices
47  INTEGER, intent(in) :: BCV
48 
49 ! Whether any volumetric flow conversion was done
50  LOGICAL :: CONVERTED = .false.
51 
52 ! Loop index
53  INTEGER :: M
54 
55 
56  CALL init_err_msg("FLOW_TO_VEL_NEW")
57 
58 ! Mass flows rates are converted to volumetric flow rates.
59  IF(bc_massflow_g(bcv) /= undefined) &
60  CALL gas_massflow_to_volflow(bcv)
61 
62  DO m=1,m_tot
63  IF(bc_massflow_s(bcv,m) /= undefined) &
64  CALL solids_massflow_to_volflow(bcv,m,skip(m))
65  ENDDO
66 
67 ! Volumetric flow rates are converted to velocities.
68  IF(bc_volflow_g(bcv) /= undefined) THEN
69  CALL gas_volflow_to_velocity(do_vel_check, bcv)
70 ! Set the conversion flag.
71  converted = .true.
72  ENDIF
73 
74  DO m=1,m_tot
75  IF(bc_volflow_s(bcv,m) /= undefined) THEN
76  CALL solids_volflow_to_velocity(do_vel_check,bcv,m,skip(m))
77 ! Set the conversion flag.
78  converted = .true.
79  ENDIF
80  ENDDO
81 
82  IF(converted .AND. .NOT.reinitializing .AND. &
83  (no_i.OR.no_j.OR.no_k)) THEN
84  WRITE(err_msg, 1100)
85  CALL flush_err_msg
86  ENDIF
87 
88  CALL finl_err_msg
89 
90  RETURN
91 
92  1100 FORMAT('Warning 1100: Some volumetric or mass flow rates have ', &
93  'been converted',/'velocity. Ensure that the third (unused) ',&
94  'dimension in 2D simulations',/'is correctly specified (e.g.',&
95  ', in axisymmetric cylindrical coordinates',/'ZLENGTH = 2*Pi)')
96 
97  END SUBROUTINE flow_to_vel_new
98 
99 
100 
101 !vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv!
102 ! !
103 ! Subroutine: GAS_MASSFLOW_TO_VOLFLOW !
104 ! Author: M. Syamlal Date: 28-JUL-92 !
105 ! !
106 ! Purpose: Convert a gas phase BC input from a mass flow rate to !
107 ! a volumetric flow rate. !
108 ! !
109 !^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^!
110  SUBROUTINE gas_massflow_to_volflow(BCV)
112  use bc, only: bc_massflow_g
113  use bc, only: bc_p_g
114  use bc, only: bc_t_g
115  use bc, only: bc_volflow_g
116  use bc, only: bc_x_g
117  use eos, only: eosg
118  use error_manager
119  use param, only: dimension_bc
120  use param1, only: undefined
121  use param1, only: zero
122  use physprop, only: calc_mw
123  use physprop, only: mw_avg, mw_g
124  use physprop, only: nmax
125  use physprop, only: ro_g0
126  use scales, only: p_ref
127  use toleranc
128 
129  IMPLICIT NONE
130 
131  INTEGER, INTENT(in) :: BCV
132 
133 ! Volumetric flow rate computed from mass flow rate
134  DOUBLE PRECISION :: VOLFLOW
135 ! Average molecular weight
136  DOUBLE PRECISION :: MW
137 
138  CALL init_err_msg("GAS_MASSFLOW_TO_VOLFLOW")
139 
140 ! No need to convert if the mass flow is zero.
141  IF(compare(bc_massflow_g(bcv),zero)) THEN
142  volflow = zero
143 
144 ! Incompressible gas BC.
145  ELSEIF(ro_g0 /= undefined) THEN
146  volflow = bc_massflow_g(bcv)/ro_g0
147 
148 ! Well-defined compresible gas BC.
149  ELSEIF(bc_p_g(bcv)/=undefined .AND. bc_t_g(bcv)/=undefined) THEN
150  IF(mw_avg == undefined) THEN
151  mw = calc_mw(bc_x_g,dimension_bc,bcv,nmax(0),mw_g)
152  ELSE
153  mw = mw_avg
154  ENDIF
155  volflow = bc_massflow_g(bcv) / &
156  eosg(mw,(bc_p_g(bcv)-p_ref),bc_t_g(bcv))
157 
158 ! Fails. This shouldn't happen as previous checks should catch any
159 ! errors leading to this routine.
160  ELSE
161  WRITE(err_msg, 1100) bcv
162  CALL flush_err_msg(abort=.true.)
163 
164  1100 FORMAT('Error 1100: Boundary condition ',i3,' failed sanity ', &
165  'check.',/'Please report this to the MFIX mailing list.')
166 
167  ENDIF
168 
169 ! Check that a specified volumetric flow matches the calculated value.
170  IF(bc_volflow_g(bcv) /= undefined) THEN
171  IF(.NOT.compare(volflow,bc_volflow_g(bcv))) THEN
172  WRITE(err_msg,1101) trim(ivar('BC_MASSFLOW_g',bcv)), bcv, &
173  volflow, bc_volflow_g(bcv)
174  CALL flush_err_msg(abort=.true.)
175  ENDIF
176  ELSE
177 
178 ! Store the calculated volumetric flow rate.
179  bc_volflow_g(bcv) = volflow
180  ENDIF
181 
182  1101 FORMAT('Error 1101: Volumetric flow rate calculated from ',a,/ &
183  'does NOT equal the specified volumetric flow rate for BC',i3,&
184  /3x,'>>> Calculated: ',g14.7,/3x,'>>> Specified: ',g14.7,/ &
185  'Please correct the mfix.dat file.')
186 
187 ! Clean up and return.
188  CALL finl_err_msg
189 
190  RETURN
191 
192  END SUBROUTINE gas_massflow_to_volflow
193 
194 
195 
196 !vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv!
197 ! !
198 ! Subroutine: SOLIDS_MASSFLOW_TO_VOLFLOW !
199 ! Author: M. Syamlal Date: 28-JUL-92 !
200 ! !
201 ! Purpose: Convert solids phase BC input from a mass flow rate to !
202 ! a volumetric flow rate. !
203 ! !
204 !^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^!
205  SUBROUTINE solids_massflow_to_volflow(BCV,M, SKIP_M)
207  USE bc, only: bc_massflow_s
208  USE bc, only: bc_volflow_s
209  USE bc, only: bc_x_s
210  USE param1, only: undefined, zero
211  USE physprop, only: inert_species
212  USE physprop, only: ro_s0
213  USE physprop, only: x_s0
214  use eos, only: eoss
215  use error_manager
216  use toleranc
217 
218  IMPLICIT NONE
219 
220 ! loop/variable indices
221  INTEGER, INTENT(in) :: BCV, M
222  LOGICAL, INTENT(in) :: SKIP_M
223 
224 ! Volumetric flow rate computed from mass flow rate
225  DOUBLE PRECISION :: VOLFLOW
226 ! Index of inert species
227  INTEGER :: INERT
228 
229  CALL init_err_msg("SOLIDS_MASSFLOW_TO_VOLFLOW")
230 
231 
232  IF(skip_m) THEN
233  WRITE(err_msg,1100) m, bcv, trim(ivar("BC_MASSFLOW_S",bcv,m))
234  CALL flush_err_msg(abort=.true.)
235  ENDIF
236 
237  1100 FORMAT('Error 1100: Solids phase ',i2,' has a specified mass ', &
238  'flow rate',/'at BC ',i3,', ',a,'. But, both BC_ROP_s and ',&
239  'BC_EP_s are zero or undefined.',/'Please correct the ',&
240  'mfix.dat file.')
241 
242  IF(compare(bc_massflow_s(bcv,m),zero)) THEN
243  volflow = zero
244 ! Constant solids density.
245  ELSEIF(ro_s0(m) /= undefined) THEN
246  volflow = bc_massflow_s(bcv,m)/ro_s0(m)
247  ELSE
248 ! Set an alias for the inert species.
249  inert = inert_species(m)
250 ! Variable solids density.
251  volflow = bc_massflow_s(bcv,m)/eoss(ro_s0(m), &
252  x_s0(m,inert), bc_x_s(bcv,m,inert))
253  ENDIF
254 
255 ! If volumetric flow is also specified compare both
256  IF(bc_volflow_s(bcv,m) /= undefined) THEN
257  IF(.NOT.compare(volflow,bc_volflow_s(bcv,m))) THEN
258  WRITE(err_msg,1101) trim(ivar('BC_MASSFLOW_S',bcv,m)), bcv, &
259  volflow, bc_volflow_s(bcv,m)
260  CALL flush_err_msg(abort=.true.)
261  ENDIF
262  ELSE
263  bc_volflow_s(bcv,m) = volflow
264  ENDIF
265 
266  CALL finl_err_msg
267 
268  RETURN
269 
270  1101 FORMAT('Error 1101: Volumetric flow rate calculated from ',a,/ &
271  'does NOT equal the specified volumetric flow rate for BC',i3,&
272  /3x,'>>> Calculated: ',g14.7,/3x,'>>> Specified: ',g14.7,/ &
273  'Please correct the mfix.dat file.')
274 
275 
276  END SUBROUTINE solids_massflow_to_volflow
277 
278 
279 
280 
281 !vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv!
282 ! !
283 ! Subroutine: GAS_VOLFLOW_TO_VELOCITY !
284 ! Author: M. Syamlal Date: 28-JUL-92 !
285 ! !
286 ! Purpose: Convert gas phase volumetric rate to a velocity. !
287 ! !
288 !^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^!
289  SUBROUTINE gas_volflow_to_velocity(DO_VEL_CHECK, BCV)
291  USE bc
292  USE compar
293  USE discretelement
294  USE error_manager
295  USE exit, only: mfix_exit
296  USE fldvar
297  USE funits
298  USE geometry
299  USE indices
300  USE mfix_pic
301  USE param
302  USE param1
303  USE physprop
304  USE run
305  USE scales
306  USE toleranc
307 
308  IMPLICIT NONE
309 !-----------------------------------------------
310 ! Local variables
311 !-----------------------------------------------
312 ! loop/variable indices
313  INTEGER, INTENT(in) :: BCV
314 
315 ! Whether any volumetric flow conversion was done
316  LOGICAL, INTENT(in) :: DO_VEL_CHECK
317 
318 
319  DOUBLE PRECISION :: SGN, OFF
320 
321 ! Velocity computed from volumetric flow rate
322  DOUBLE PRECISION :: VEL
323 !-----------------------------------------------
324  CALL init_err_msg("GAS_VOLFLOW_TO_VELOCITY")
325 
326  SELECT CASE (bc_type_enum(bcv))
327  CASE (mass_inflow); sgn = one; off = zero
328  CASE (mass_outflow); sgn = -one; off = one
329  CASE DEFAULT
330  write(*,*) 'error in GAS_VOLFLOW_TO_VELOCITY'
331  call mfix_exit(mype)
332  END SELECT
333 
334  SELECT CASE (bc_plane(bcv))
335  CASE ('W'); sgn = -sgn
336  CASE ('S'); sgn = -sgn
337  CASE ('B'); sgn = -sgn
338  END SELECT
339 
340 ! Calculate the velocity based on the volumetric flow rate,
341 ! BC area and BC volume fraction.
342  vel = sgn*bc_volflow_g(bcv)/(bc_area(bcv)*bc_ep_g(bcv))
343 
344 ! if the user also defined the boundary velocity through the plane, then
345 ! check that the calculated value agrees with the specified value. if
346 ! the user did not define the boundary velocity through the plane, then
347 ! if mass_inflow set the value of the boundary velocity to the
348 ! calculated value. otherwise do nothing.
349  IF(bc_plane(bcv) == 'W' .OR. bc_plane(bcv)== 'E') THEN
350 
351  IF(bc_u_g(bcv) /= undefined .AND. do_vel_check) THEN
352  IF(.NOT.compare(vel,bc_u_g(bcv))) THEN
353  WRITE(err_msg,1100) bcv, vel, 'BC_U_g', bc_u_g(bcv)
354  CALL flush_err_msg(abort=.true.)
355  ENDIF
356  ELSE
357  bc_u_g(bcv) = vel
358  bc_v_g(bcv) = off * bc_v_g(bcv)
359  bc_w_g(bcv) = off * bc_w_g(bcv)
360  ENDIF
361 
362  ELSEIF(bc_plane(bcv) == 'S' .OR. bc_plane(bcv)== 'N') THEN
363  IF(bc_v_g(bcv) /= undefined .AND. do_vel_check) THEN
364  IF(.NOT.compare(vel,bc_v_g(bcv))) THEN
365  WRITE(err_msg, 1100) bcv, vel, 'BC_V_g', bc_v_g(bcv)
366  CALL flush_err_msg(abort=.true.)
367  ENDIF
368  ELSE
369  bc_v_g(bcv) = vel
370  bc_u_g(bcv) = off * bc_u_g(bcv)
371  bc_w_g(bcv) = off * bc_w_g(bcv)
372  ENDIF
373 
374  ELSEIF(bc_plane(bcv) == 'B' .OR. bc_plane(bcv)== 'T') THEN
375  IF(bc_w_g(bcv) /= undefined .AND. do_vel_check) THEN
376  IF(.NOT.compare(vel, bc_w_g(bcv))) THEN
377  WRITE(err_msg, 1100) bcv, vel, 'BC_W_g', bc_w_g(bcv)
378  CALL flush_err_msg(abort=.true.)
379  ENDIF
380  ELSE
381  bc_w_g(bcv) = vel
382  bc_u_g(bcv) = off * bc_u_g(bcv)
383  bc_v_g(bcv) = off * bc_v_g(bcv)
384  ENDIF
385 
386  ENDIF
387 
388  CALL finl_err_msg
389 
390  RETURN
391 
392  1100 FORMAT(/1x,70('*')//' From: FLOW_TO_VEL',/' Message: BC No:',i2,/,&
393  ' Computed velocity is not equal to specified value',/,&
394  ' Value computed from vol. or mass flow = ',g14.7,/,&
395  ' Specified value (',a,') = ',g14.7,/1x,70('*')/)
396 
397  END SUBROUTINE gas_volflow_to_velocity
398 
399 !vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv!
400 ! !
401 ! Subroutine: SOLIDS_VOLFLOW_TO_VELOCITY !
402 ! Author: M. Syamlal Date: 28-JUL-92 !
403 ! !
404 ! Purpose: Convert volumetric and mass flow rates to velocities !
405 ! A specified mass flow rate is first converted to volumetric !
406 ! flow rate. The volumetric flow rate is then converted to a !
407 ! velocity. !
408 ! !
409 !^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^!
410  SUBROUTINE solids_volflow_to_velocity(DO_VEL_CHECK, BCV, M, SKIP_M)
412  USE param
413  USE param1
414  USE geometry
415  USE fldvar
416  USE physprop
417  USE run
418  USE bc
419  USE scales
420  USE indices
421  USE funits
422  USE compar
423  USE discretelement
424  USE mfix_pic
425 
426  use error_manager
427  use toleranc
428 
429  IMPLICIT NONE
430 !-----------------------------------------------
431 ! Local variables
432 !-----------------------------------------------
433 ! loop/variable indices
434  INTEGER, INTENT(in) :: BCV, M
435 ! Logical to preform velocity check.
436  LOGICAL, INTENT(in) :: DO_VEL_CHECK, SKIP_M
437 
438 ! Velocity computed from volumetric flow rate
439  DOUBLE PRECISION :: VEL
440 
441  DOUBLE PRECISION :: SGN, OFF
442 
443 !-----------------------------------------------
444 
445  CALL init_err_msg("SOLIDS_VOLFLOW_TO_VELOCITY")
446 
447  IF(skip_m) THEN
448  WRITE(err_msg,1100) m, bcv, trim(ivar("BC_VOLFLOW_S",bcv,m))
449  CALL flush_err_msg(abort=.true.)
450  ENDIF
451 
452  1100 FORMAT('Error 1100: Solids phase ',i2,' has a specified ', &
453  'volumetric flow rate',/'at BC ',i3,', ',a,'. But, both ',&
454  'BC_ROP_s and BC_EP_s are zero or undefined.',/'Please ',&
455  'the mfix.dat file.')
456 
457  SELECT CASE (bc_type_enum(bcv))
458  CASE (mass_inflow); sgn = one; off = zero
459  CASE (mass_outflow); sgn = -one; off = one
460  CASE DEFAULT
461  write(*,*) 'error in SOLIDS_VOLFLOW_TO_VELOCITY'
462  call mfix_exit(mype)
463  END SELECT
464 
465  SELECT CASE (bc_plane(bcv))
466  CASE ('W'); sgn = -sgn
467  CASE ('S'); sgn = -sgn
468  CASE ('B'); sgn = -sgn
469  END SELECT
470 
471  IF(bc_ep_s(bcv,m) /= zero) THEN
472  vel = sgn * bc_volflow_s(bcv,m)/(bc_area(bcv)*bc_ep_s(bcv,m))
473  ELSE
474  IF(bc_volflow_s(bcv,m) == zero) THEN
475  vel = zero
476  ELSE
477  IF(dmp_log)WRITE (unit_log, 1101) bcv, m
478  CALL flush_err_msg(abort=.true.)
479  ENDIF
480  ENDIF
481 
482  1101 FORMAT('Error 1101: BC No:',i2,' Non-zero vol. or mass flow ',&
483  'specified with BC_ROP_s', i1,' = 0.')
484 
485  IF(bc_plane(bcv) == 'W' .OR. bc_plane(bcv)== 'E') THEN
486  IF(bc_u_s(bcv,m) /= undefined .AND. do_vel_check) THEN
487  IF(.NOT.compare(vel, bc_u_s(bcv,m))) THEN
488  WRITE(err_msg, 1300) bcv, (-vel), 'BC_U_s', m, bc_u_s(bcv,m)
489  CALL flush_err_msg(abort=.true.)
490  ENDIF
491  ELSE
492  bc_u_s(bcv,m) = vel
493  bc_v_s(bcv,m) = off * bc_v_s(bcv,m)
494  bc_w_s(bcv,m) = off * bc_w_s(bcv,m)
495  ENDIF
496 
497  ELSEIF(bc_plane(bcv) == 'S' .OR. bc_plane(bcv)== 'N') THEN
498  IF(bc_v_s(bcv,m) /= undefined .AND. do_vel_check) THEN
499  IF(.NOT.compare(vel,bc_v_s(bcv,m))) THEN
500  WRITE(err_msg,1300) bcv, vel, 'BC_V_s', m, bc_v_s(bcv,m)
501  CALL flush_err_msg(abort=.true.)
502  ENDIF
503  ELSE
504  bc_v_s(bcv,m) = vel
505  bc_u_s(bcv,m) = off * bc_u_s(bcv,m)
506  bc_w_s(bcv,m) = off * bc_w_s(bcv,m)
507  ENDIF
508 
509  ELSEIF(bc_plane(bcv) == 'B' .OR. bc_plane(bcv)== 'T') THEN
510  IF(bc_w_s(bcv,m) /= undefined .AND. do_vel_check) THEN
511  IF(.NOT.compare(vel,bc_w_s(bcv,m))) THEN
512  WRITE(err_msg, 1300) bcv, vel, 'BC_W_s', m, bc_w_s(bcv,m)
513  CALL flush_err_msg(abort=.true.)
514  ENDIF
515  ELSE
516  bc_w_s(bcv,m) = vel
517  bc_u_s(bcv,m) = off * bc_u_s(bcv,m)
518  bc_v_s(bcv,m) = off * bc_v_s(bcv,m)
519  ENDIF
520  ENDIF
521 
522 
523  CALL finl_err_msg
524 
525  RETURN
526 
527  1300 FORMAT(/1x,70('*')//' From: FLOW_TO_VEL',/' Message: BC No:',i2,/,&
528  ' Computed velocity is not equal to specified value',/,&
529  ' Value computed from vol. or mass flow = ',g14.7,/,&
530  ' Specified value (',a,i1,') = ',g14.7,/1x,70('*')/)
531 
532  END SUBROUTINE solids_volflow_to_velocity
533 
534 !vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvC
535 ! C
536 ! Subroutine: FLOW_TO_VEL C
537 ! Purpose: Convert volumetric and mass flow rates to velocities C
538 ! A specified mass flow rate is first converted to volumetric C
539 ! flow rate. The volumetric flow rate is then converted to a C
540 ! velocity. C
541 ! C
542 ! Author: M. Syamlal Date: 28-JUL-92 C
543 ! Reviewer: W. Rogers Date: 11-DEC-92 C
544 ! C
545 ! Revision Number: C
546 ! Purpose: C
547 ! Author: Date: dd-mmm-yy C
548 ! Reviewer: Date: dd-mmm-yy C
549 ! C
550 ! Literature/Document References: C
551 ! Variables referenced: C
552 ! Variables modified: C
553 ! Local variables: C
554 ! C
555 !^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^C
556 
557  SUBROUTINE flow_to_vel(DO_VEL_CHECK)
559 !-----------------------------------------------
560 ! Modules
561 !-----------------------------------------------
562  USE bc
563  USE compar
564  USE discretelement
565  USE eos, ONLY: eosg, eoss
566  USE exit, only: mfix_exit
567  USE fldvar
568  USE funits
569  USE geometry
570  USE indices
571  USE mfix_pic
572  USE param
573  USE param1
574  USE physprop
575  USE run
576  USE scales
577  USE toleranc
578 
579  IMPLICIT NONE
580 !-----------------------------------------------
581 ! Local variables
582 !-----------------------------------------------
583 ! loop/variable indices
584  INTEGER :: BCV, M
585 ! Volumetric flow rate computed from mass flow rate
586  DOUBLE PRECISION :: VOLFLOW
587 ! Velocity computed from volumetric flow rate
588  DOUBLE PRECISION :: VEL
589 ! Solids phase volume fraction
590  DOUBLE PRECISION :: EPS
591 ! Whether any volumetric flow conversion was done
592  LOGICAL :: CONVERTED,DO_VEL_CHECK
593 ! Average molecular weight
594  DOUBLE PRECISION :: MW
595 ! Index of inert species
596  INTEGER :: INERT
597 ! Solids density at BC plane
598  DOUBLE PRECISION :: BC_ROs
599 !-----------------------------------------------
600 
601 ! When both flow rates and velocities are specified, a consistency check is done
602 ! The first time flow_to_vel is called in
603 ! by setting the logical DO_VEL_CHECK to .TRUE.
604 ! If cut-cells are not used, flow_to_vel is only called once.
605 ! When cut-cells are used, flow_to_vel is called another time after
606 ! the cut-cell preprocessing stage. During, the second call, the velocity check
607 ! should not be performed, because the velocity assigned suring the first call
608 ! will not match the flow rate. Therfore, when called from cut_cell_preprocessing.f
609 ! DO_VEL_CHECK is set to .FALSE.
610 
611 ! initialize
612  volflow = undefined
613 
614  converted = .false.
615  DO bcv = 1, dimension_bc
616  IF (bc_defined(bcv)) THEN
617  IF (bc_type_enum(bcv)==mass_inflow .OR.&
618  bc_type_enum(bcv)==mass_outflow) THEN
619 
620 ! If gas mass flow is defined convert it to volumetric flow
621 ! ---------------------------------------------------------------->>>
622  IF (bc_massflow_g(bcv) /= undefined) THEN
623  IF (ro_g0 /= undefined) THEN
624  volflow = bc_massflow_g(bcv)/ro_g0
625  ELSE
626  IF (bc_p_g(bcv)/=undefined .AND. &
627  bc_t_g(bcv)/=undefined) THEN
628  IF (mw_avg == undefined) THEN
629  mw = calc_mw(bc_x_g,dimension_bc,bcv,nmax(0),mw_g)
630  ELSE
631  mw = mw_avg
632  ENDIF
633  volflow = bc_massflow_g(bcv)/&
634  eosg(mw,(bc_p_g(bcv)-p_ref),bc_t_g(bcv))
635 
636  ELSE
637 ! for mass_inflow, check_data_07 has already required that either ro_g0
638 ! be defined or bc_p_g and bc_t_g be defined. So this branch will never
639 ! be entered when mass_inflow. if mass_outflow, ro_g0 and either bc_p_g,
640 ! or bc_t_g, or both, must be undefined.
641 ! if the code comes through this branch without exiting and massflow is
642 ! non-zero, then volflow will remain undefined.
643 
644  IF (bc_type_enum(bcv) == mass_outflow) THEN ! this check seems unnecessary
645 
646 ! if no mass flow through the boundary, the volume flow is zero.
647 ! otherwise check that the value of velocity component through the
648 ! boundary plane is defined, and is non-zero (otherwise would be caught
649 ! by bc_massflow_g == zero branch)
650  IF (bc_massflow_g(bcv) == zero) THEN
651  volflow = zero
652  ELSEIF (bc_plane(bcv)=='W' .OR. &
653  bc_plane(bcv)=='E') THEN
654  IF (bc_u_g(bcv)==undefined .OR. &
655  bc_u_g(bcv)/=zero) THEN
656  IF(dmp_log)WRITE (unit_log, 1010)&
657  bcv, 'BC_U_g'
658  call mfix_exit(mype)
659  ENDIF
660  ELSEIF (bc_plane(bcv)=='N' .OR. &
661  bc_plane(bcv)=='S') THEN
662  IF (bc_v_g(bcv)==undefined .OR. &
663  bc_v_g(bcv)/=zero) THEN
664  IF(dmp_log)WRITE (unit_log, 1010) &
665  bcv, 'BC_V_g'
666  call mfix_exit(mype)
667  ENDIF
668  ELSEIF (bc_plane(bcv)=='T' .OR. &
669  bc_plane(bcv)=='B') THEN
670  IF (bc_w_g(bcv)==undefined .OR. &
671  bc_w_g(bcv)/=zero) THEN
672  IF(dmp_log)WRITE (unit_log, 1010) &
673  bcv, 'BC_W_g'
674  call mfix_exit(mype)
675  ENDIF
676  ENDIF
677  ELSE ! else branch if(bc_type=mass_outflow)
678 ! not sure how this branch will be reached by mass_inflow
679  IF(dmp_log)WRITE (unit_log, 1020) bcv
680  call mfix_exit(mype)
681  ENDIF ! end if (bc_type_enum(bcv)==mass_outflow)
682  ENDIF
683  ENDIF ! end if/else (ro_g0 /=undefined)
684 
685 ! If volumetric flow is also specified compare both
686  IF (bc_volflow_g(bcv) /= undefined) THEN
687 ! volflow may be undefined for mass_outflow boundaries wherein ro_g0 and
688 ! either bc_p_g, or bc_t_g, or both, were undefined.
689  IF (.NOT.compare(volflow,bc_volflow_g(bcv))) THEN
690  IF(dmp_log)WRITE (unit_log, 1000) bcv, &
691  volflow, bc_volflow_g(bcv)
692  call mfix_exit(mype)
693  ENDIF
694  ELSE
695  bc_volflow_g(bcv) = volflow
696  ENDIF
697  ENDIF ! end if (bc_massflow_g(bcv) /= undefined)
698 ! end gas mass flow conversion to volumetric flow
699 ! ----------------------------------------------------------------<<<
700 
701 ! If gas volumetric flow is defined convert it to velocity
702 ! ---------------------------------------------------------------->>>
703  IF (bc_volflow_g(bcv) /= undefined) THEN
704 
705  IF (bc_ep_g(bcv) /= undefined) THEN
706 ! volumetric flow rate and void fraction at the boundary are specified
707 ! (known) so that the corresponding gas velocity through the boundary
708 ! plane may be calculated.
709  vel = bc_volflow_g(bcv)/(bc_area(bcv)*bc_ep_g(bcv))
710  ELSE
711 ! for mass_inflow, check_data_07 has already required that bc_ep_g be
712 ! defined (i.e., this section will not happen for MI). For mass_outflow
713 ! the routine will exit here if bc_ep_g is not defined. However, for
714 ! this MO the boundary velocities must also be set or mfix will exit due
715 ! to later checks in check_data_07.
716  RETURN
717  ENDIF
718 
719 ! if the user also defined the boundary velocity through the plane, then
720 ! check that the calculated value agrees with the specified value. if
721 ! the user did not define the boundary velocity through the plane, then
722 ! if mass_inflow set the value of the boundary velocity to the
723 ! calculated value. otherwise do nothing.
724  converted = .true.
725  SELECT CASE (trim(bc_plane(bcv)))
726  CASE ('W')
727  IF (bc_u_g(bcv) /= undefined.AND.do_vel_check) THEN
728  IF (bc_type_enum(bcv)==mass_inflow .AND. &
729  .NOT.compare((-vel),bc_u_g(bcv))) THEN
730  IF(dmp_log) WRITE (unit_log, 1100) bcv,&
731  (-vel), 'BC_U_g', bc_u_g(bcv)
732  call mfix_exit(mype)
733  ENDIF
734  IF (bc_type_enum(bcv)==mass_outflow .AND. &
735  .NOT.compare(vel,bc_u_g(bcv))) THEN
736  IF(dmp_log) WRITE (unit_log, 1100) bcv, &
737  vel, 'BC_U_g', bc_u_g(bcv)
738  call mfix_exit(mype)
739  ENDIF
740  ELSE
741  IF (bc_type_enum(bcv) == mass_inflow) THEN
742  bc_u_g(bcv) = -vel
743  bc_v_g(bcv) = zero
744  bc_w_g(bcv) = zero
745  ELSE
746  bc_u_g(bcv) = vel
747  ENDIF
748  ENDIF
749  CASE ('E')
750  IF (bc_u_g(bcv) /= undefined.AND.do_vel_check) THEN
751  IF (bc_type_enum(bcv)==mass_inflow .AND. &
752  .NOT.compare(vel,bc_u_g(bcv))) THEN
753  IF(dmp_log) WRITE (unit_log, 1100) bcv, vel,&
754  'BC_U_g', bc_u_g(bcv)
755  call mfix_exit(mype)
756  ENDIF
757  IF (bc_type_enum(bcv)==mass_outflow .AND. &
758  .NOT.compare((-vel),bc_u_g(bcv))) THEN
759  IF(dmp_log) WRITE (unit_log, 1100) bcv, &
760  (-vel), 'BC_U_g', bc_u_g(bcv)
761  call mfix_exit(mype)
762  ENDIF
763  ELSE
764  IF (bc_type_enum(bcv) == mass_inflow) THEN
765  bc_u_g(bcv) = vel
766  bc_v_g(bcv) = zero
767  bc_w_g(bcv) = zero
768  ELSE
769  bc_u_g(bcv) = -vel
770  ENDIF
771  ENDIF
772  CASE ('S')
773  IF (bc_v_g(bcv) /= undefined.AND.do_vel_check) THEN
774  IF (bc_type_enum(bcv)==mass_inflow .AND. &
775  .NOT.compare((-vel),bc_v_g(bcv))) THEN
776  IF(dmp_log) WRITE (unit_log, 1100) bcv,&
777  (-vel), 'BC_V_g', bc_v_g(bcv)
778  call mfix_exit(mype)
779  ENDIF
780  IF (bc_type_enum(bcv)==mass_outflow .AND. &
781  .NOT.compare(vel,bc_v_g(bcv))) THEN
782  IF(dmp_log) WRITE (unit_log, 1100) bcv, vel,&
783  'BC_V_g', bc_v_g(bcv)
784  call mfix_exit(mype)
785  ENDIF
786  ELSE
787  IF (bc_type_enum(bcv) == mass_inflow) THEN
788  bc_u_g(bcv) = zero
789  bc_v_g(bcv) = -vel
790  bc_w_g(bcv) = zero
791  ELSE
792  bc_v_g(bcv) = vel
793  ENDIF
794  ENDIF
795  CASE ('N')
796  IF (bc_v_g(bcv) /= undefined.AND.do_vel_check) THEN
797  IF (bc_type_enum(bcv)==mass_inflow .AND. &
798  .NOT.compare(vel,bc_v_g(bcv))) THEN
799  IF(dmp_log) WRITE (unit_log, 1100) bcv, vel,&
800  'BC_V_g', bc_v_g(bcv)
801  call mfix_exit(mype)
802  ENDIF
803  IF (bc_type_enum(bcv)==mass_outflow .AND. &
804  .NOT.compare((-vel),bc_v_g(bcv))) THEN
805  IF(dmp_log) WRITE (unit_log, 1100) bcv, &
806  (-vel), 'BC_V_g', bc_v_g(bcv)
807  call mfix_exit(mype)
808  ENDIF
809  ELSE
810  IF (bc_type_enum(bcv) == mass_inflow) THEN
811  bc_u_g(bcv) = zero
812  bc_v_g(bcv) = vel
813  bc_w_g(bcv) = zero
814  ELSE
815  bc_v_g(bcv) = -vel
816  ENDIF
817  ENDIF
818  CASE ('B')
819  IF (bc_w_g(bcv) /= undefined.AND.do_vel_check) THEN
820  IF (bc_type_enum(bcv)==mass_inflow .AND. &
821  .NOT.compare((-vel),bc_w_g(bcv))) THEN
822  IF(dmp_log)WRITE (unit_log, 1100) bcv,&
823  (-vel), 'BC_W_g', bc_w_g(bcv)
824  call mfix_exit(mype)
825  ENDIF
826  IF (bc_type_enum(bcv)==mass_outflow .AND. &
827  .NOT.compare(vel,bc_w_g(bcv))) THEN
828  IF(dmp_log) WRITE (unit_log, 1100) bcv, vel,&
829  'BC_W_g', bc_w_g(bcv)
830  call mfix_exit(mype)
831  ENDIF
832  ELSE
833  IF (bc_type_enum(bcv) == mass_inflow) THEN
834  bc_u_g(bcv) = zero
835  bc_v_g(bcv) = zero
836  bc_w_g(bcv) = -vel
837  ELSE
838  bc_w_g(bcv) = vel
839  ENDIF
840  ENDIF
841  CASE ('T')
842  IF (bc_w_g(bcv) /= undefined.AND.do_vel_check) THEN
843  IF (bc_type_enum(bcv)==mass_inflow .AND. &
844  .NOT.compare(vel,bc_w_g(bcv))) THEN
845  IF(dmp_log) WRITE (unit_log, 1100) bcv, vel,&
846  'BC_W_g', bc_w_g(bcv)
847  call mfix_exit(mype)
848  ENDIF
849  IF (bc_type_enum(bcv)==mass_outflow .AND. &
850  .NOT.compare((-vel),bc_w_g(bcv))) THEN
851  IF(dmp_log) WRITE (unit_log, 1100) bcv,&
852  (-vel), 'BC_W_g', bc_w_g(bcv)
853  call mfix_exit(mype)
854  ENDIF
855  ELSE
856  IF (bc_type_enum(bcv) == mass_inflow) THEN
857  bc_u_g(bcv) = zero
858  bc_v_g(bcv) = zero
859  bc_w_g(bcv) = vel
860  ELSE
861  bc_w_g(bcv) = -vel
862  ENDIF
863  ENDIF
864  END SELECT ! end select (trim(bc_plane(bcv))
865  ENDIF ! end if (bc_volflow_g(bcv)/=undefined)
866 ! end gas volumetric flow conversion to velocity
867 ! ----------------------------------------------------------------<<<
868 
869  IF (.NOT.discrete_element .OR. (discrete_element &
870  .AND. des_continuum_hybrid).OR. (discrete_element &
871  .AND. mppic)) THEN
872 ! The following quantities should not be required for DEM simulations
873 ! To ensure this is the case leave them undefined in mfix.dat
874 ! MPPIC BC's are based on Two Fluid Model based specification.
875 ! So call the below for MPPIC.
876 
877 ! Do flow conversions for solids phases
878  DO m = 1, smax
879 
880 ! initialize
881  volflow = undefined
882  bc_ros = undefined
883 
884  IF((bc_massflow_s(bcv,m) /= undefined) .OR. &
885  (bc_volflow_s(bcv,m) /= undefined)) THEN
886 
887 ! Calculate the solid density.
888  bc_ros = undefined
889  IF(solve_ros(m))THEN
890  inert = inert_species(m)
891 ! Verify that the species mass fraction for the inert material is not
892 ! zero in the IC region when the solids is present.
893  IF(bc_x_s(bcv,m,inert) == zero) THEN
894  IF(bc_rop_s(bcv,m) /= zero) THEN
895  IF(dmp_log) THEN
896  WRITE(*,1401) m, bcv
897  WRITE(unit_log,1401) m, bcv
898  ENDIF
899  CALL mfix_exit(mype)
900  ELSE
901 ! If the solids isn't present, give it the baseline density.
902  bc_ros = ro_s0(m)
903  ENDIF
904  ELSE
905 ! Calculate the solids density.
906  bc_ros = eoss(ro_s0(m),x_s0(m,inert), &
907  bc_x_s(bcv,m,inert))
908  ENDIF
909  ELSE
910  bc_ros = ro_s0(m)
911  ENDIF
912  ELSE
913 ! Set a generic value to pass through sanity check.
914  bc_ros = ro_s0(m)
915  ENDIF
916 
917 
918 ! If solids mass flow is defined convert it to volumetric flow
919 ! ---------------------------------------------------------------->>>
920  IF (bc_massflow_s(bcv,m) /= undefined) THEN
921 
922 ! Sanity check on solids phase density.
923  IF(bc_ros <= zero .OR. bc_ros==undefined) THEN
924  IF(dmp_log)THEN
925  WRITE(*,1401) m, bcv
926  WRITE(unit_log,1401) m, bcv
927  ENDIF
928  CALL mfix_exit(mype)
929  ENDIF
930 
931  volflow = bc_massflow_s(bcv,m)/bc_ros
932 
933 ! If volumetric flow is also specified compare both
934  IF (bc_volflow_s(bcv,m) /= undefined) THEN
935  IF (.NOT.compare(volflow,bc_volflow_s(bcv,m))) THEN
936  IF(dmp_log) WRITE(unit_log,1200) &
937  bcv,volflow,m,bc_volflow_s(bcv,m)
938  call mfix_exit(mype)
939  ENDIF
940  ELSE
941  bc_volflow_s(bcv,m) = volflow
942  ENDIF
943  ENDIF ! end if (bc_massflow_s(bcv,m)/=undefined)
944 ! end solids mass flow conversion to volumetric flow
945 ! ----------------------------------------------------------------<<<
946 
947 
948 ! if possible, define bulk density based on ep_g. note if mass_outflow,
949 ! bc_ep_g may still be undefined at this point wherein bc_rop_s would
950 ! become set as 1-undefined. to avoid this issue, a check for bc_ep_g
951 ! defined was added. note if mass_inflow, check_data_07 later performs
952 ! the same calculations as below but with additional checks.
953  IF (bc_rop_s(bcv,m) == undefined .AND. &
954  bc_ep_g(bcv) /= undefined ) THEN
955  IF (bc_ep_g(bcv) == one) THEN
956  bc_rop_s(bcv,m) = zero
957  ELSEIF (smax == 1 .AND. &
958  .NOT.des_continuum_hybrid) THEN
959 
960 ! Sanity check on solids phase density.
961  IF(bc_ros <= zero .OR. bc_ros==undefined) THEN
962  IF(dmp_log)THEN
963  WRITE(*,1401) m, bcv
964  WRITE(unit_log,1401) m, bcv
965  ENDIF
966  CALL mfix_exit(mype)
967  ENDIF
968 
969 
970 ! bulk density must be explicitly defined for hybrid model and cannot be
971 ! defined from 1-bc_ep_g
972  bc_rop_s(bcv,m) = (one - bc_ep_g(bcv))*bc_ros
973  ENDIF
974  ENDIF
975 ! note bc_rop_s may still be undefined at this point
976 
977 
978 ! If solids volumetric flow is defined convert it to velocity
979 ! ---------------------------------------------------------------->>>
980  IF (bc_volflow_s(bcv,m) /= undefined) THEN
981 
982 ! Sanity check on solids phase density.
983  IF(bc_ros <= zero .OR. bc_ros==undefined) THEN
984  IF(dmp_log)THEN
985  WRITE(*,1401) m, bcv
986  WRITE(unit_log,1401) m, bcv
987  ENDIF
988  CALL mfix_exit(mype)
989  ENDIF
990 
991  IF (bc_rop_s(bcv,m) /= undefined) THEN
992  eps = bc_rop_s(bcv,m)/bc_ros
993 ! volumetric flow rate and solids volume fraction at the boundary are
994 ! specified (known) so that the corresponding solids velocity through
995 ! the boundary plane may be calculated.
996  IF (eps /= zero) THEN
997  vel = bc_volflow_s(bcv,m)/(bc_area(bcv)*eps)
998  ELSE
999  IF (bc_volflow_s(bcv,m) == zero) THEN
1000  vel = zero
1001  ELSE
1002  IF(dmp_log)WRITE (unit_log, 1250) bcv, m
1003  call mfix_exit(mype)
1004  ENDIF
1005  ENDIF
1006  ELSE ! bc_rop_s is undefined
1007  IF (bc_volflow_s(bcv,m) == zero) THEN
1008  vel = zero
1009  ELSE
1010 ! if bc_rop_s is undefined and bc_volflow_s is not zero exit MFIX with
1011 ! error
1012  IF(dmp_log)WRITE (unit_log, 1260) bcv, m
1013  call mfix_exit(mype)
1014  ENDIF
1015  ENDIF
1016 
1017 ! if the user also defined the boundary velocity through the plane, then
1018 ! check that the calculated value agrees with the specified value. if
1019 ! the user did not define the boundary velocity through the plane, then
1020 ! if mass_inflow set the value of the boundary velocity to the
1021 ! calculated value. otherwise do nothing.
1022  converted = .true.
1023  SELECT CASE (trim(bc_plane(bcv)))
1024  CASE ('W')
1025  IF (bc_u_s(bcv,m) /= undefined.AND.do_vel_check) THEN
1026  IF (bc_type_enum(bcv)==mass_inflow .AND. &
1027  .NOT.compare((-vel),bc_u_s(bcv,m))) THEN
1028  IF(dmp_log)WRITE (unit_log, 1300) bcv, &
1029  (-vel), 'BC_U_s', m, bc_u_s(bcv,m)
1030  call mfix_exit(mype)
1031  ENDIF
1032  IF (bc_type_enum(bcv)==mass_outflow .AND. &
1033  .NOT.compare(vel,bc_u_s(bcv,m))) THEN
1034  IF(dmp_log)WRITE (unit_log, 1300) bcv, &
1035  vel, 'BC_U_s', m, bc_u_s(bcv,m)
1036  call mfix_exit(mype)
1037  ENDIF
1038  ELSE
1039  IF (bc_type_enum(bcv) == mass_inflow) THEN
1040  bc_u_s(bcv,m) = -vel
1041  bc_v_s(bcv,m) = zero
1042  bc_w_s(bcv,m) = zero
1043  ELSE
1044  bc_u_s(bcv,m) = vel
1045  ENDIF
1046  ENDIF
1047  CASE ('E')
1048  IF (bc_u_s(bcv,m) /= undefined.AND.do_vel_check) THEN
1049  IF (bc_type_enum(bcv)==mass_inflow .AND. &
1050  .NOT.compare(vel,bc_u_s(bcv,m))) THEN
1051  IF(dmp_log)WRITE (unit_log, 1300) bcv, &
1052  vel, 'BC_U_s', m, bc_u_s(bcv,m)
1053  call mfix_exit(mype)
1054  ENDIF
1055  IF (bc_type_enum(bcv)==mass_outflow .AND. &
1056  .NOT.compare((-vel),bc_u_s(bcv,m))) THEN
1057  IF(dmp_log)WRITE (unit_log, 1300) bcv, &
1058  (-vel), 'BC_U_s', m, bc_u_s(bcv,m)
1059  call mfix_exit(mype)
1060  ENDIF
1061  ELSE
1062  IF (bc_type_enum(bcv) == mass_inflow) THEN
1063  bc_u_s(bcv,m) = vel
1064  bc_v_s(bcv,m) = zero
1065  bc_w_s(bcv,m) = zero
1066  ELSE
1067  bc_u_s(bcv,m) = -vel
1068  ENDIF
1069  ENDIF
1070  CASE ('S')
1071  IF (bc_v_s(bcv,m) /= undefined.AND.do_vel_check) THEN
1072  IF (bc_type_enum(bcv)==mass_inflow .AND. &
1073  .NOT.compare((-vel),bc_v_s(bcv,m))) THEN
1074  IF(dmp_log)WRITE (unit_log, 1300) bcv, &
1075  (-vel), 'BC_V_s', m, bc_v_s(bcv,m)
1076  call mfix_exit(mype)
1077  ENDIF
1078  IF (bc_type_enum(bcv)==mass_outflow .AND. &
1079  .NOT.compare(vel,bc_v_s(bcv,m))) THEN
1080  IF(dmp_log)WRITE (unit_log, 1300) bcv, &
1081  vel, 'BC_V_s', m, bc_v_s(bcv,m)
1082  call mfix_exit(mype)
1083  ENDIF
1084  ELSE
1085  IF (bc_type_enum(bcv) == mass_inflow) THEN
1086  bc_u_s(bcv,m) = zero
1087  bc_v_s(bcv,m) = -vel
1088  bc_w_s(bcv,m) = zero
1089  ELSE
1090  bc_v_s(bcv,m) = vel
1091  ENDIF
1092  ENDIF
1093  CASE ('N')
1094  IF (bc_v_s(bcv,m) /= undefined.AND.do_vel_check) THEN
1095  IF (bc_type_enum(bcv)==mass_inflow .AND. &
1096  .NOT.compare(vel,bc_v_s(bcv,m))) THEN
1097  IF(dmp_log)WRITE (unit_log, 1300) bcv, &
1098  vel, 'BC_V_s', m, bc_v_s(bcv,m)
1099  call mfix_exit(mype)
1100  ENDIF
1101  IF (bc_type_enum(bcv)==mass_outflow .AND. &
1102  .NOT.compare((-vel),bc_v_s(bcv,m))) THEN
1103  IF(dmp_log)WRITE (unit_log, 1300) bcv, &
1104  (-vel), 'BC_V_s', m, bc_v_s(bcv,m)
1105  call mfix_exit(mype)
1106  ENDIF
1107  ELSE
1108  IF (bc_type_enum(bcv) == mass_inflow) THEN
1109  bc_u_s(bcv,m) = zero
1110  bc_v_s(bcv,m) = vel
1111  bc_w_s(bcv,m) = zero
1112  ELSE
1113  bc_v_s(bcv,m) = -vel
1114  ENDIF
1115  ENDIF
1116  CASE ('B')
1117  IF (bc_w_s(bcv,m) /= undefined.AND.do_vel_check) THEN
1118  IF (bc_type_enum(bcv)==mass_inflow .AND. &
1119  .NOT.compare((-vel),bc_w_s(bcv,m))) THEN
1120  IF(dmp_log)WRITE (unit_log, 1300) bcv, &
1121  (-vel), 'BC_W_s', m, bc_w_s(bcv,m)
1122  call mfix_exit(mype)
1123  ENDIF
1124  IF (bc_type_enum(bcv)==mass_outflow .AND. &
1125  .NOT.compare(vel,bc_w_s(bcv,m))) THEN
1126  IF(dmp_log)WRITE (unit_log, 1300) bcv, &
1127  vel, 'BC_W_s', m, bc_w_s(bcv,m)
1128  call mfix_exit(mype)
1129  ENDIF
1130  ELSE
1131  IF (bc_type_enum(bcv) == mass_inflow) THEN
1132  bc_u_s(bcv,m) = zero
1133  bc_v_s(bcv,m) = zero
1134  bc_w_s(bcv,m) = -vel
1135  ELSE
1136  bc_w_s(bcv,m) = vel
1137  ENDIF
1138  ENDIF
1139  CASE ('T')
1140  IF (bc_w_s(bcv,m) /= undefined.AND.do_vel_check) THEN
1141  IF (bc_type_enum(bcv)==mass_inflow .AND. &
1142  .NOT.compare(vel,bc_w_s(bcv,m))) THEN
1143  IF(dmp_log)WRITE (unit_log, 1300) bcv, &
1144  vel, 'BC_W_s', m, bc_w_s(bcv,m)
1145  call mfix_exit(mype)
1146  ENDIF
1147  IF (bc_type_enum(bcv)==mass_outflow .AND. &
1148  .NOT.compare((-vel),bc_w_s(bcv,m))) THEN
1149  IF(dmp_log)WRITE (unit_log, 1300) bcv, &
1150  (-vel), 'BC_W_s', m, bc_w_s(bcv,m)
1151  call mfix_exit(mype)
1152  ENDIF
1153  ELSE
1154  IF (bc_type_enum(bcv) == mass_inflow) THEN
1155  bc_u_s(bcv,m) = zero
1156  bc_v_s(bcv,m) = zero
1157  bc_w_s(bcv,m) = vel
1158  ELSE
1159  bc_w_s(bcv,m) = -vel
1160  ENDIF
1161  ENDIF
1162  END SELECT ! end select (trim(bc_plane(bcv))
1163  ENDIF ! end if (bc_volflow_s(bcv,m) /= undefined)
1164 ! end solids volumetric flow conversion to velocity
1165 ! ----------------------------------------------------------------<<<
1166 
1167  ENDDO ! end do m = 1,smax
1168  ENDIF ! end if (.not.discrete_element)
1169 
1170  ENDIF ! end if (bc_type_enum(bcv)==mass_inflow or mass_outflow)
1171  ENDIF ! end if (bc_defined(bcv))
1172  ENDDO ! end do (bcv =1,dimension_bc)
1173 
1174 
1175  IF (converted .AND. (no_i .OR. no_j .OR. no_k) &
1176  .AND. dmp_log)WRITE (unit_log, 1500)
1177 
1178  RETURN
1179 
1180  1000 FORMAT(/1x,70('*')//' From: FLOW_TO_VEL',/' Message: BC No:',i2,/,&
1181  ' Computed volumetric flow is not equal to specified value',/,&
1182  ' Value computed from mass flow = ',g14.7,/,&
1183  ' Specified value (BC_VOLFLOW_g) = ',g14.7,/1x,70('*')/)
1184  1010 FORMAT(/1x,70('*')//' From: FLOW_TO_VEL',/' Message: BC No:',i2,&
1185  ' BC_P_g, BC_T_g, and BC_X_g or',/' a nonzero value for ',a,&
1186  ' should be specified',/1x,70('*')/)
1187  1020 FORMAT(/1x,70('*')//' From: FLOW_TO_VEL',/' Message: BC No:',i2,&
1188  ' BC_P_g, BC_T_g, and BC_X_g',/' should be specified',/1x,70('*')/)
1189  1100 FORMAT(/1x,70('*')//' From: FLOW_TO_VEL',/' Message: BC No:',i2,/,&
1190  ' Computed velocity is not equal to specified value',/,&
1191  ' Value computed from vol. or mass flow = ',g14.7,/,&
1192  ' Specified value (',a,') = ',g14.7,/1x,70('*')/)
1193  1200 FORMAT(/1x,70('*')//' From: FLOW_TO_VEL',/' Message: BC No:',i2,/,&
1194  ' Computed volumetric flow is not equal to specified value',/,&
1195  ' Value computed from mass flow = ',g14.7,/,&
1196  ' Specified value (BC_VOLFLOW_s',i1,') = ',g14.7,/1x,70('*')/)
1197  1250 FORMAT(/1x,70('*')//' From: FLOW_TO_VEL',/' Message: BC No:',i2,/,&
1198  ' Non-zero vol. or mass flow specified with BC_ROP_s',&
1199  i1,' = 0.',/1x,70('*')/)
1200  1260 FORMAT(/1x,70('*')//' From: FLOW_TO_VEL',/' Message: BC No:',i2,/,&
1201  ' BC_ROP_s',i1,' not specified',/1x,70('*')/)
1202  1300 FORMAT(/1x,70('*')//' From: FLOW_TO_VEL',/' Message: BC No:',i2,/,&
1203  ' Computed velocity is not equal to specified value',/,&
1204  ' Value computed from vol. or mass flow = ',g14.7,/,&
1205  ' Specified value (',a,i1,') = ',g14.7,/1x,70('*')/)
1206  1500 FORMAT(/1x,70('*')//' From: FLOW_TO_VEL',/&
1207  ' Message: Some volumetric or mass flow rates have been',/&
1208  ' converted to velocity values. In 2D simulations ensure',/&
1209  ' that the third (unused) dimension is correctly specified;',/&
1210  ' e.g. in axisymmetric cylindrical coordinates ZLENGTH = 2*Pi'/1x,70&
1211  ('*')/)
1212 
1213  1401 FORMAT(//1x,70('*')/' From: FLOW_TO_VEL',/,' Error 1401:', &
1214  ' Solids phase ',i2,' failed sanity check in BC region ',i3, &
1215  '. ',/' Please check mfix.dat file.',/1x,70('*')//)
1216 
1217 
1218  END SUBROUTINE flow_to_vel
subroutine flow_to_vel_new(DO_VEL_CHECK, M_TOT, SKIP, BCV)
Definition: flow_to_vel.f:23
logical dmp_log
Definition: funits_mod.f:6
double precision, dimension(dimension_bc) bc_volflow_g
Definition: bc_mod.f:195
character(len=32) function ivar(VAR, i1, i2, i3)
double precision, dimension(dimension_bc) bc_t_g
Definition: bc_mod.f:97
subroutine finl_err_msg
logical function compare(V1, V2)
Definition: toleranc_mod.f:94
logical no_i
Definition: geometry_mod.f:20
double precision, parameter one
Definition: param1_mod.f:29
double precision, dimension(dimension_bc, dim_m) bc_w_s
Definition: bc_mod.f:129
subroutine gas_volflow_to_velocity(DO_VEL_CHECK, BCV)
Definition: flow_to_vel.f:290
double precision, dimension(dimension_bc, dim_m, dim_n_s) bc_x_s
Definition: bc_mod.f:254
integer, parameter dim_m
Definition: param_mod.f:67
subroutine gas_massflow_to_volflow(BCV)
Definition: flow_to_vel.f:111
logical, dimension(dim_m) solve_ros
Definition: run_mod.f:250
integer, parameter dimension_bc
Definition: param_mod.f:61
integer, dimension(dimension_bc) bc_type_enum
Definition: bc_mod.f:146
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 function calc_mw(X_G, DIM, L, NMAX, MW_G)
Definition: physprop_mod.f:176
double precision, dimension(dim_n_g) mw_g
Definition: physprop_mod.f:124
double precision, dimension(dimension_bc) bc_v_g
Definition: bc_mod.f:117
character, dimension(dimension_bc) bc_plane
Definition: bc_mod.f:217
subroutine init_err_msg(CALLER)
double precision, dimension(dimension_bc, dim_m) bc_volflow_s
Definition: bc_mod.f:198
double precision function eosg(MW, PG, TG)
Definition: eos_mod.f:22
subroutine mfix_exit(myID, normal_termination)
Definition: exit.f:5
double precision ro_g0
Definition: physprop_mod.f:59
double precision function eoss(pBase, Xs0_INERT, Xs_INERT)
Definition: eos_mod.f:155
integer, dimension(dim_m) inert_species
Definition: physprop_mod.f:39
Definition: exit.f:2
Definition: eos_mod.f:10
logical, dimension(dimension_bc) bc_defined
Definition: bc_mod.f:207
double precision, dimension(dimension_bc) bc_p_g
Definition: bc_mod.f:80
integer, parameter unit_log
Definition: funits_mod.f:21
Definition: run_mod.f:13
Definition: param_mod.f:2
logical no_k
Definition: geometry_mod.f:28
double precision, dimension(dimension_bc, dim_m) bc_v_s
Definition: bc_mod.f:121
subroutine flow_to_vel(DO_VEL_CHECK)
Definition: flow_to_vel.f:558
double precision, dimension(dimension_bc) bc_massflow_g
Definition: bc_mod.f:201
integer, dimension(0:dim_m) nmax
Definition: physprop_mod.f:119
double precision, dimension(dimension_bc, dim_m) bc_massflow_s
Definition: bc_mod.f:204
logical reinitializing
Definition: run_mod.f:208
integer mype
Definition: compar_mod.f:24
double precision, dimension(dimension_bc) bc_u_g
Definition: bc_mod.f:109
logical no_j
Definition: geometry_mod.f:24
double precision mw_avg
Definition: physprop_mod.f:71
double precision, dimension(dimension_bc, dim_m) bc_u_s
Definition: bc_mod.f:113
character(len=line_length), dimension(line_count) err_msg
double precision p_ref
Definition: scales_mod.f:10
subroutine solids_volflow_to_velocity(DO_VEL_CHECK, BCV, M, SKIP_M
Definition: flow_to_vel.f:411
double precision, dimension(dimension_bc, dim_n_g) bc_x_g
Definition: bc_mod.f:251
double precision, dimension(dimension_bc) bc_ep_g
Definition: bc_mod.f:77
integer smax
Definition: physprop_mod.f:22
logical mppic
Definition: mfix_pic_mod.f:14
double precision, dimension(dim_m) ro_s0
Definition: physprop_mod.f:28
subroutine solids_massflow_to_volflow(BCV, M, SKIP_M)
Definition: flow_to_vel.f:206
double precision, dimension(dimension_bc) bc_w_g
Definition: bc_mod.f:125
double precision, dimension(dimension_bc, dim_m) bc_ep_s
Definition: bc_mod.f:93
double precision, dimension(:), allocatable x
Definition: geometry_mod.f:129
double precision, parameter zero
Definition: param1_mod.f:27
subroutine flush_err_msg(DEBUG, HEADER, FOOTER, ABORT, LOG, CALL_TREE)
double precision, dimension(dimension_bc, dim_m) bc_rop_s
Definition: bc_mod.f:92
Definition: bc_mod.f:23
double precision, dimension(dimension_bc) bc_area
Definition: bc_mod.f:245