MFIX  2016-1
check_run_control.f
Go to the documentation of this file.
1 !vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv!
2 ! !
3 ! Subroutine: CHECK_RUN_CONTROL !
4 ! Purpose: Check the run control namelist section !
5 ! !
6 ! Author: P.Nicoletti Date: 27-NOV-91 !
7 ! J.Musser Date: 31-JAN-14 !
8 ! !
9 !^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^!
10  SUBROUTINE check_run_control
11 
12 
13 ! Global Variables:
14 !---------------------------------------------------------------------//
15 ! New or restart
16  USE run, only: run_type
17 ! Brief description of simulation.
18  USE run, only: description
19 ! Simulation units: SI, CGS
20  USE run, only: units
21 ! Simulation start/stop times.
22  USE run, only: time, tstop
23 ! Time step size, one over time step size.
24  USE run, only: dt, odt, steady_state
25 ! Flag: Use K-Epsilon turbulence model.
26  USE run, only: k_epsilon
27  USE run, only: ishii, jackson
28 ! Turbulence lenghth scale and viscosity bound.
29  use constant, only: l_scale0, mu_gmax
30 
31 ! Global Parameters:
32 !---------------------------------------------------------------------//
33  USE param1, only: undefined, undefined_c
34  USE param1, only: one, zero
35 
36 ! Global Module procedures:
37 !---------------------------------------------------------------------//
38  USE error_manager
39 
40  IMPLICIT NONE
41 
42 
43 ! Local Variables:
44 !---------------------------------------------------------------------//
45 
46 
47 !......................................................................!
48 
49 
50 ! Initialize the error manager.
51  CALL init_err_msg("CHECK_RUN_CONTROL")
52 
53 
54 ! Clear out the run description if not specified.
55  IF (description == undefined_c) description = ' '
56 
57 ! Verify UNITS input.
58  IF(units == undefined_c) THEN
59  WRITE(err_msg,1000) 'UNITS'
60  CALL flush_err_msg(abort=.true.)
61  ELSEIF((units /= 'CGS') .AND. (units /= 'SI')) THEN
62  WRITE(err_msg,1001) 'UNITS', units
63  CALL flush_err_msg(abort=.true.)
64  ENDIF
65 
66 ! Verify that DT is valid.
67  IF (dt < zero) THEN
68  WRITE(err_msg,1002) 'DT', dt
69  CALL flush_err_msg(abort=.true.)
70 
71 ! Steady-state simulation.
72  ELSEIF(dt == undefined .OR. dt == zero) THEN
73  steady_state = .true.
74  dt = zero
75  odt = zero
76  time = zero
77 
78 ! Transient simulation.
79  ELSE
80  steady_state = .false.
81 ! Calculate reciprocal of initial timestep.
82  odt = one/dt
83 ! Verify the remaining time settings.
84  IF (time == undefined) THEN
85  WRITE(err_msg,1000) 'TIME'
86  CALL flush_err_msg(abort=.true.)
87 
88  ELSEIF (tstop == undefined) THEN
89  WRITE(err_msg,1000) 'TSTOP'
90  CALL flush_err_msg(abort=.true.)
91 
92  ELSEIF (time < zero) THEN
93  WRITE(err_msg,1002)'TIME', time
94  CALL flush_err_msg(abort=.true.)
95 
96  ELSEIF (tstop < zero) THEN
97  WRITE(err_msg,1002) 'TSTOP', tstop
98  CALL flush_err_msg(abort=.true.)
99  ENDIF
100  ENDIF
101 
102 ! Verify the run type.
103  IF(.NOT.(run_type=='NEW' .OR. run_type=='RESTART_1' &
104  .OR. run_type=='RESTART_2')) THEN
105  WRITE(err_msg,1001) 'RUN_TYPE', run_type
106  CALL flush_err_msg(abort=.true.)
107  ENDIF
108 
109 ! Turbulence model:
110  IF (k_epsilon .AND. l_scale0 /= zero) THEN
111  WRITE(err_msg,2001)
112  CALL flush_err_msg(abort=.true.)
113  2001 FORMAT('Error 2001: Cannot set K_EPSILON = .T. and specify ', &
114  'L_SCALE0 /= ZERO')
115  ENDIF
116 
117 ! Ishii and jackson form of governing equations cannot both be invoked
118  IF (ishii .AND. jackson) THEN
119  WRITE(err_msg,2002)
120  CALL flush_err_msg(abort=.true.)
121  2002 FORMAT('Error 2002: Cannot set both ISHII = .T. and JACKSON = ',&
122  '.T.',/,'Please correct the mfix.dat file.')
123  ENDIF
124 
125 ! Check whether MU_gmax is specified for turbulence (sof)
126  IF (k_epsilon .AND. mu_gmax==undefined) THEN
127  WRITE(err_msg, 1000) 'MU_GMAX'
128  CALL flush_err_msg(abort=.true.)
129  ENDIF
130 
131 ! Clear the error manager
132  CALL finl_err_msg
133 
134  RETURN
135 
136  1000 FORMAT('Error 1000: Required input not specified: ',a,/'Please ',&
137  'correct the mfix.dat file.')
138 
139  1001 FORMAT('Error 1001: Illegal or unknown input: ',a,' = ',a,/ &
140  'Please correct the mfix.dat file.')
141 
142  1002 FORMAT('Error 1002: Illegal or unknown input: ',a,' = ',g14.4,/ &
143  'Please correct the mfix.dat file.')
144 
145  1003 FORMAT('Error 1003: Illegal or unknown input: ',a,' = ',i4,/ &
146  'Please correct the mfix.dat file.')
147 
148  END SUBROUTINE check_run_control
149 
150 
151 
double precision l_scale0
Definition: constant_mod.f:177
logical steady_state
Definition: run_mod.f:57
character(len=60) description
Definition: run_mod.f:27
subroutine check_run_control
subroutine finl_err_msg
double precision, parameter one
Definition: param1_mod.f:29
logical ishii
Definition: run_mod.f:85
double precision dt
Definition: run_mod.f:51
double precision mu_gmax
Definition: constant_mod.f:180
double precision, parameter undefined
Definition: param1_mod.f:18
logical jackson
Definition: run_mod.f:83
subroutine init_err_msg(CALLER)
double precision tstop
Definition: run_mod.f:48
character(len=16) run_type
Definition: run_mod.f:33
double precision odt
Definition: run_mod.f:54
Definition: run_mod.f:13
character(len=16) units
Definition: run_mod.f:30
logical k_epsilon
Definition: run_mod.f:97
character(len=line_length), dimension(line_count) err_msg
double precision time
Definition: run_mod.f:45
double precision, parameter zero
Definition: param1_mod.f:27
subroutine flush_err_msg(DEBUG, HEADER, FOOTER, ABORT, LOG, CALL_TREE)
character, parameter undefined_c
Definition: param1_mod.f:20